mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-29 15:21:53 +00:00 
			
		
		
		
	Compare commits
	
		
			193 Commits
		
	
	
		
			11.112
			...
			feature/rm
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | eaed720334 | ||
|  | 0a0e1d1ca8 | ||
|  | eace4a067a | ||
|  | 2d4140ea64 | ||
|  | 3c928a4928 | ||
|  | 599f5727a0 | ||
|  | 7ac5cb1807 | ||
|  | d311ef2c5f | ||
|  | 6f820e2c25 | ||
|  | e515dacab1 | ||
|  | 5041249f03 | ||
|  | 1b26e3a937 | ||
|  | a2d9afcecc | ||
|  | 577de6bf4c | ||
|  | f71f53c988 | ||
|  | 7e4d72a66a | ||
|  | 142f99b2a2 | ||
|  | 1b0ddb1e74 | ||
|  | 4fa0157594 | ||
|  | c1196ed8e9 | ||
|  | 90a69173bd | ||
|  | cb0a07d5da | ||
|  | 77e721d66a | ||
|  | 25d2a51254 | ||
|  | 54fe4bb969 | ||
|  | 7e719cae80 | ||
|  | 157a6ba1c5 | ||
|  | 4fc165150a | ||
|  | d574d05066 | ||
|  | f66426bb60 | ||
|  | b846ccd85e | ||
|  | 09fc6f1e25 | ||
|  | 630f553fce | ||
|  | 7242a78705 | ||
|  | 539a89537b | ||
|  | 608c16d4a4 | ||
|  | c00736c639 | ||
|  | 15cb7ff44e | ||
|  | 4776e37223 | ||
|  | cbd45fcb3e | ||
|  | 655cadbda0 | ||
|  | 6d7e3bb787 | ||
|  | bb8d10074e | ||
|  | 806880a86b | ||
|  | e68f56270a | ||
|  | 8705d97407 | ||
|  | 44e3242132 | ||
|  | 8a3cdd55a7 | ||
|  | cff2a70b17 | ||
|  | 3b41308ecc | ||
|  | 8a60e26ff0 | ||
|  | accfc4662d | ||
|  | 1e0fcfcc14 | ||
|  | 837a706514 | ||
|  | db290c98f2 | ||
|  | 12682ddcff | ||
|  | 0ed2e9b3a7 | ||
|  | 3442e91575 | ||
|  | 59b636e0ba | ||
|  | 0333fe05b5 | ||
|  | 9b592bfc13 | ||
|  | 386696d58b | ||
|  | 1f243d629e | ||
|  | dee7625998 | ||
|  | 1c541281db | ||
|  | c991290c01 | ||
|  | 9b62808ed7 | ||
|  | d4e8bba9f5 | ||
|  | 5ae240c392 | ||
|  | a5b35b7d96 | ||
|  | d2544b7a4d | ||
|  | b9abc05eda | ||
|  | 04e3743f01 | ||
|  | 745295c4ba | ||
|  | c9b08594de | ||
|  | 1d8044076c | ||
|  | 377b082ef8 | ||
|  | ad2525bf17 | ||
|  | 888b26ef72 | ||
|  | aa4a5a6063 | ||
|  | 7ea91ea702 | ||
|  | b3e8051f08 | ||
|  | 4ba0d3a899 | ||
|  | 8d78b257aa | ||
|  | df67011596 | ||
|  | 871bd40d6d | ||
|  | 2ef97e0b23 | ||
|  | f1d48f7aab | ||
|  | b5f24f5d58 | ||
|  | 14668044f4 | ||
|  | c5281d7f10 | ||
|  | 00565f3bc9 | ||
|  | f15c4d7a8f | ||
|  | 85a3c71849 | ||
|  | 4db8ca16e1 | ||
|  | 52e71719d1 | ||
|  | 507161a1d0 | ||
|  | 559171a32c | ||
|  | b9f449df57 | ||
|  | 3185ecf6cb | ||
|  | bd7f2a4250 | ||
|  | 79efa12b10 | ||
|  | 5807e756bd | ||
|  | 6ecb019b84 | ||
|  | c26f933c44 | ||
|  | 43e528878e | ||
|  | b120a9658f | ||
|  | 3875a84f74 | ||
|  | 8dddf293d0 | ||
|  | d01e9ffbbc | ||
|  | 6f8507ebe2 | ||
|  | 923261d9b9 | ||
|  | 078e461b71 | ||
|  | ddde92ef21 | ||
|  | 189011d528 | ||
|  | af849d2144 | ||
|  | 53208f207c | ||
|  | 4cf3f77824 | ||
|  | 9d24e083bb | ||
|  | 6345c0a825 | ||
|  | cda3d11c7e | ||
|  | 7ad35ac60d | ||
|  | a164917232 | ||
|  | 507c6b2ed8 | ||
|  | ab0d65897c | ||
|  | d92844cebb | ||
|  | 25986d77d6 | ||
|  | 2b8948b84b | ||
|  | 64bf49cc22 | ||
|  | 3ce95c5262 | ||
|  | e854a01988 | ||
|  | 65ba8b16e0 | ||
|  | d2bb3a980d | ||
|  | 59b641474f | ||
|  | 9ee56762fb | ||
|  | 6cb8e84ee4 | ||
|  | d540bb319b | ||
|  | 30a2bff92a | ||
|  | ac08612183 | ||
|  | 031d1c740c | ||
|  | aac73e2064 | ||
|  | ec72000380 | ||
|  | 015e3213af | ||
|  | d97510dfba | ||
|  | df98ad9e92 | ||
|  | 19a7239612 | ||
|  | 2af2e7b868 | ||
|  | 84824edffa | ||
|  | 646419c073 | ||
|  | ea854b55a4 | ||
|  | 4bfb26a660 | ||
|  | 1f608b1eb5 | ||
|  | 8652c9d644 | ||
|  | 57e8ee2c76 | ||
|  | 6cb00d8e3b | ||
|  | bb58c4a2d9 | ||
|  | 1766ce6e31 | ||
|  | 0c5498fba0 | ||
|  | 48045c8c38 | ||
|  | 89adfacca6 | ||
|  | 6159bee521 | ||
|  | a8a06f4b1f | ||
|  | 279ff3a0d8 | ||
|  | b6a50ae6e1 | ||
|  | 83097d452b | ||
|  | b26d03cc0c | ||
|  | af24fef02b | ||
|  | 85fa4b5a93 | ||
|  | 01b5fb5593 | ||
|  | 09f8d7a806 | ||
|  | 77691ec5fd | ||
|  | 472710ffd4 | ||
|  | 16f0714e99 | ||
|  | c7c40b06e1 | ||
|  | 439a9254a3 | ||
|  | a9f19de31c | ||
|  | d237e51bb2 | ||
|  | d7758d5509 | ||
|  | f8b40d3cc0 | ||
|  | 6d48c0979e | ||
|  | 1b7bada294 | ||
|  | 924f64409e | ||
|  | 7267ea5846 | ||
|  | c86d82e9cd | ||
|  | f7e6320a83 | ||
|  | cff733bbdf | ||
|  | 57942cd43b | ||
|  | 4aaae012c5 | ||
|  | 1c387add9d | ||
|  | d3ab782b57 | ||
|  | b3d43b0500 | ||
|  | a8e1ce909e | ||
|  | 76e815f9c5 | 
							
								
								
									
										181
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,181 @@ | ||||
| version: 2 | ||||
| registries: | ||||
|   maven-repository-artifacts-alfresco-com-nexus-content-groups-int: | ||||
|     type: maven-repository | ||||
|     url: https://artifacts.alfresco.com/nexus/content/groups/internal | ||||
|     username: ${{secrets.NEXUS_USERNAME}} | ||||
|     password: ${{secrets.NEXUS_PASSWORD}} | ||||
| updates: | ||||
| - package-ecosystem: maven | ||||
|   directory: "/" | ||||
|   schedule: | ||||
|     interval: daily | ||||
|     time: "22:00" | ||||
|     timezone: Africa/Abidjan | ||||
|   open-pull-requests-limit: 99 | ||||
|   ignore: | ||||
|   - dependency-name: com.google.code.gson:gson | ||||
|     versions: | ||||
|     - "> 2.8.6" | ||||
|   - dependency-name: io.fabric8:fabric8-maven-plugin | ||||
|     versions: | ||||
|     - "> 4.4.0" | ||||
|   - dependency-name: javax.servlet:javax.servlet-api | ||||
|     versions: | ||||
|     - "> 3.0.1" | ||||
|   - dependency-name: org.acegisecurity:acegi-security | ||||
|     versions: | ||||
|     - "> 0.8.2_patched" | ||||
|   - dependency-name: org.activiti:activiti-engine | ||||
|     versions: | ||||
|     - "> 5.23.0" | ||||
|   - dependency-name: org.activiti:activiti-engine | ||||
|     versions: | ||||
|     - ">= 7.1.a, < 7.2" | ||||
|   - dependency-name: org.activiti:activiti-spring | ||||
|     versions: | ||||
|     - "> 5.23.0" | ||||
|   - dependency-name: org.activiti:activiti-spring | ||||
|     versions: | ||||
|     - ">= 7.1.a, < 7.2" | ||||
|   - dependency-name: org.apache.camel:camel-activemq | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.camel:camel-amqp | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.camel:camel-direct | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.camel:camel-directvm | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.camel:camel-jackson | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.camel:camel-mock | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.camel:camel-spring | ||||
|     versions: | ||||
|     - "> 3.7.1" | ||||
|   - dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-client-impl | ||||
|     versions: | ||||
|     - "> 1.0.0" | ||||
|   - dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-commons-impl | ||||
|     versions: | ||||
|     - "> 1.0.0" | ||||
|   - dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-server-bindings | ||||
|     versions: | ||||
|     - "> 1.0.0" | ||||
|   - dependency-name: org.apache.chemistry.opencmis:chemistry-opencmis-test-tck | ||||
|     versions: | ||||
|     - "> 1.0.0" | ||||
|   - dependency-name: org.freemarker:freemarker | ||||
|     versions: | ||||
|     - "> 2.3.20-alfresco-patched-20200421" | ||||
|   - dependency-name: org.keycloak:keycloak-adapter-core | ||||
|     versions: | ||||
|     - "> 12.0.2" | ||||
|   - dependency-name: org.keycloak:keycloak-adapter-spi | ||||
|     versions: | ||||
|     - "> 12.0.2" | ||||
|   - dependency-name: org.keycloak:keycloak-authz-client | ||||
|     versions: | ||||
|     - "> 12.0.2" | ||||
|   - dependency-name: org.keycloak:keycloak-common | ||||
|     versions: | ||||
|     - "> 12.0.2" | ||||
|   - dependency-name: org.keycloak:keycloak-core | ||||
|     versions: | ||||
|     - "> 12.0.2" | ||||
|   - dependency-name: org.keycloak:keycloak-servlet-adapter-spi | ||||
|     versions: | ||||
|     - "> 12.0.2" | ||||
|   - dependency-name: org.eclipse.jetty:jetty-server | ||||
|     versions: | ||||
|     - 9.4.38.v20210224 | ||||
|   - dependency-name: org.alfresco.tas:cmis | ||||
|     versions: | ||||
|     - "1.28" | ||||
|   - dependency-name: org.springframework:spring-webmvc | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-web | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-tx | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-orm | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-test | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-jms | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-jdbc | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-expression | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-core | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-context-support | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-context | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-beans | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.springframework:spring-aop | ||||
|     versions: | ||||
|     - 5.3.4 | ||||
|     - 5.3.5 | ||||
|   - dependency-name: org.alfresco.tas:restapi | ||||
|     versions: | ||||
|     - "1.55" | ||||
|   - dependency-name: org.eclipse.jetty:jetty-security | ||||
|     versions: | ||||
|     - 11.0.1 | ||||
|   - dependency-name: org.alfresco.aos-module:alfresco-vti-bin | ||||
|     versions: | ||||
|     - 1.4.0-M1 | ||||
|   - dependency-name: org.alfresco.aos-module:alfresco-aos-module-distributionzip | ||||
|     versions: | ||||
|     - 1.4.0-M1 | ||||
|   - dependency-name: org.alfresco.aos-module:alfresco-aos-module | ||||
|     versions: | ||||
|     - 1.4.0-M1 | ||||
|   - dependency-name: org.alfresco.surf:spring-webscripts-api | ||||
|     versions: | ||||
|     - "8.16" | ||||
|   - dependency-name: org.alfresco.surf:spring-webscripts:tests | ||||
|     versions: | ||||
|     - "8.16" | ||||
|   - dependency-name: org.alfresco.surf:spring-webscripts | ||||
|     versions: | ||||
|     - "8.16" | ||||
|   - dependency-name: org.alfresco.surf:spring-surf-core-configservice | ||||
|     versions: | ||||
|     - "8.16" | ||||
|   registries: | ||||
|   - maven-repository-artifacts-alfresco-com-nexus-content-groups-int | ||||
							
								
								
									
										26
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -55,7 +55,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -70,7 +70,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -78,7 +78,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -97,7 +97,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -105,7 +105,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -113,7 +113,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -145,7 +145,8 @@ jobs: | ||||
|       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.6 tests" | ||||
|       if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ | ||||
|       # We run tests on the latest version of MariaDB on pull requests plus the normal master and release branches - ignored on feature branches | ||||
|       if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/                         ) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest 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.6 --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 | ||||
| @@ -159,7 +160,8 @@ jobs: | ||||
|       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\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ | ||||
|       # We run tests on the latest version of MySQL on pull requests plus the normal master and release branches - ignored on feature branches | ||||
|       if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/                         ) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest 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 | ||||
| @@ -210,7 +212,7 @@ jobs: | ||||
|  | ||||
|     - name: "Repository - PostgreSQL 13.3 tests" | ||||
|       # We only run DB tests on the latest version of PostgreSQL on feature branches | ||||
|       if: commit_message !~ /\[skip db\]/ | ||||
|       if: commit_message !~ /\[skip db\]/ OR commit_message =~ /\[latest db\]/ | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
| @@ -234,7 +236,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -242,7 +244,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
| @@ -250,7 +252,7 @@ jobs: | ||||
|       before_script: | ||||
|         - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.3 postgres -c 'max_connections=300' | ||||
|         - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.2 | ||||
|         - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.5.3 | ||||
|       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" | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-community-repo-amps</artifactId> | ||||
|       <version>11.112</version> | ||||
|       <version>14.24-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <modules> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-governance-services-community-parent</artifactId> | ||||
|       <version>11.112</version> | ||||
|       <version>14.24-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <modules> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-governance-services-automation-community-repo</artifactId> | ||||
|       <version>11.112</version> | ||||
|       <version>14.24-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|  | ||||
| @@ -40,7 +40,7 @@ | ||||
|       <dependency> | ||||
|          <groupId>org.slf4j</groupId> | ||||
|          <artifactId>slf4j-log4j12</artifactId> | ||||
|          <version>1.7.26</version> | ||||
|          <version>1.7.32</version> | ||||
|          <scope>test</scope> | ||||
|       </dependency> | ||||
|       <dependency> | ||||
| @@ -82,7 +82,7 @@ | ||||
|       <dependency> | ||||
|          <groupId>com.github.docker-java</groupId> | ||||
|          <artifactId>docker-java</artifactId> | ||||
|          <version>3.2.11</version> | ||||
|          <version>3.2.12</version> | ||||
|       </dependency> | ||||
|    </dependencies> | ||||
| </project> | ||||
|   | ||||
| @@ -55,6 +55,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo | ||||
| 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; | ||||
| 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; | ||||
| @@ -248,6 +249,9 @@ public class RecordProperties extends TestModel | ||||
|     @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE) | ||||
|     private Boolean recordSearchDispositionEventsEligible; | ||||
|  | ||||
|     @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS) | ||||
|     private List<String> recordSearchDispositionEvents; | ||||
|  | ||||
|     @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS) | ||||
|     private String recordSearchDispositionInstructions; | ||||
|  | ||||
|   | ||||
| @@ -47,6 +47,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo | ||||
| import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; | ||||
|  | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||||
| @@ -134,7 +135,7 @@ public class RecordCategoryChildProperties extends TestModel | ||||
|     private String recordSearchDispositionInstructions; | ||||
|  | ||||
|     @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS) | ||||
|     private Boolean recordSearchDispositionEvents; | ||||
|     private List<String> recordSearchDispositionEvents; | ||||
|      | ||||
|     @JsonProperty (PROPERTIES_OWNER) | ||||
|     private Owner owner; | ||||
|   | ||||
| @@ -619,11 +619,27 @@ public class BaseRMRestTest extends RestTest | ||||
|      * @return | ||||
|      */ | ||||
|     public List<String> searchForContentAsUser(UserModel user, String term) | ||||
|     { | ||||
|         String query = "cm:name:*" + term + "*"; | ||||
|         return searchForContentAsUser(user,query,"afts"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns search results for the given search term | ||||
|      * | ||||
|      * @param user | ||||
|      * @param term | ||||
|      * @param query language | ||||
|      * @return | ||||
|      * @throws Exception | ||||
|      */ | ||||
|     public List<String> searchForContentAsUser(UserModel user, String q, String queryLanguage) | ||||
|     { | ||||
|         getRestAPIFactory().getRmRestWrapper().authenticateUser(user); | ||||
|         RestRequestQueryModel queryReq = new RestRequestQueryModel(); | ||||
|         SearchRequest query = new SearchRequest(queryReq); | ||||
|         queryReq.setQuery("cm:name:*" + term + "*"); | ||||
|         queryReq.setQuery(q); | ||||
|         queryReq.setLanguage(queryLanguage); | ||||
|  | ||||
|         List<String> names = new ArrayList<>(); | ||||
|         // wait for solr indexing | ||||
|   | ||||
| @@ -52,10 +52,7 @@ 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.alfresco.utility.model.*; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.testng.annotations.AfterClass; | ||||
| import org.testng.annotations.BeforeClass; | ||||
| @@ -70,6 +67,7 @@ import org.testng.annotations.Test; | ||||
|  * @since 3.4 | ||||
|  */ | ||||
| @AlfrescoTest (jira = "APPS-35") | ||||
| @Test(groups = { TestGroup.NOT_SUPPORTED_ON_SINGLE_PIPELINE }) | ||||
| public class FileVersionAsRecordTests extends BaseRMRestTest | ||||
| { | ||||
|     private final static String DESTINATION_PATH_NOT_FOUND_EXC = "Unable to execute declare-version-record action, " + | ||||
| @@ -224,7 +222,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest | ||||
|      * Then I receive an error indicating that the access is denied | ||||
|      * And the document is not declared as a record | ||||
|      */ | ||||
|     @Test | ||||
|     @Test() | ||||
|     public void declareAndFileByUserWithReadOnlyPermission() throws Exception | ||||
|     { | ||||
|         STEP("Declare document as record with a record folder as location parameter"); | ||||
|   | ||||
| @@ -63,6 +63,7 @@ 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.TestGroup; | ||||
| import org.alfresco.utility.model.UserModel; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.testng.annotations.AfterClass; | ||||
| @@ -77,6 +78,7 @@ import org.testng.annotations.Test; | ||||
|  * @since 3.2 | ||||
|  */ | ||||
| @AlfrescoTest (jira = "RM-6874, RM-6873") | ||||
| @Test(groups = { TestGroup.NOT_SUPPORTED_ON_SINGLE_PIPELINE }) | ||||
| public class RemoveFromHoldsTests extends BaseRMRestTest | ||||
| { | ||||
|     private static final String HOLD_ONE = "HOLD_ONE" + generateTestPrefix(RemoveFromHoldsTests.class); | ||||
|   | ||||
| @@ -0,0 +1,268 @@ | ||||
| /*- | ||||
|  * #%L | ||||
|  * Alfresco Records Management Module | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software. | ||||
|  * - | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of | ||||
|  * the paid license agreement will prevail.  Otherwise, the software is | ||||
|  * provided under the following open source license terms: | ||||
|  * - | ||||
|  * Alfresco is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU Lesser General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * - | ||||
|  * Alfresco is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU Lesser General Public License for more details. | ||||
|  * - | ||||
|  * You should have received a copy of the GNU Lesser General Public License | ||||
|  * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
| package org.alfresco.rest.rm.community.recordcategories; | ||||
|  | ||||
| import static org.alfresco.rest.rm.community.model.recordcategory.RetentionPeriodProperty.CREATED_DATE; | ||||
| import static org.alfresco.rest.rm.community.model.recordcategory.RetentionPeriodProperty.CUT_OFF_DATE; | ||||
| import static org.alfresco.rest.rm.community.model.recordcategory.RetentionPeriodProperty.DATE_FILED; | ||||
| 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.data.RandomData.getRandomName; | ||||
| import static org.alfresco.utility.report.log.Step.STEP; | ||||
| import static org.springframework.http.HttpStatus.OK; | ||||
| import static org.testng.Assert.assertFalse; | ||||
| import static org.testng.Assert.assertTrue; | ||||
|  | ||||
| import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS; | ||||
| import org.alfresco.rest.core.v0.RMEvents; | ||||
| 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.annotations.AfterMethod; | ||||
| import org.testng.annotations.BeforeMethod; | ||||
| import org.testng.annotations.Test; | ||||
|  | ||||
| /** | ||||
|  * Tests for moving record categories between record categories with different retention schedule | ||||
|  */ | ||||
| public class MoveRecCategoriesWithRSTests extends BaseRMRestTest | ||||
| { | ||||
|     private RecordCategory rootCategory, rootCategory2; | ||||
|     private Record elRecord, nonElRecord; | ||||
|     @Autowired | ||||
|     private DispositionScheduleService dispositionScheduleService; | ||||
|  | ||||
|     /** | ||||
|      * Create two root categories with some retention schedules on record level | ||||
|      */ | ||||
|     @BeforeMethod | ||||
|     private void setUpMoveRecCategoriesWithRSTests() | ||||
|     { | ||||
|         STEP("Create record category with retention schedule and apply it to records."); | ||||
|         rootCategory = createRootCategory(getRandomName("rootCategory1")); | ||||
|         dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true); | ||||
|  | ||||
|         STEP("Create record category with retention schedule and apply it to records."); | ||||
|         rootCategory2 = createRootCategory(getRandomName("rootCategory2")); | ||||
|         dispositionScheduleService.createCategoryRetentionSchedule(rootCategory2.getName(), true); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Given following structure is created: | ||||
|      * rootCategory1 with RS applied on record level with cut off and destroy after 1 day | ||||
|      * - subCategory1 without RS | ||||
|      * - recFolder | ||||
|      * - incomplete electronic record | ||||
|      * - complete non-electronic record | ||||
|      * rootCategory2 with RS with retain and destroy both after  2 day | ||||
|      * When moving subcategory1 within rootCategory2 | ||||
|      * Then the records will inherit the RS from rootCategory2 | ||||
|      */ | ||||
|     @Test | ||||
|     @AlfrescoTest (jira = "APPS-1005") | ||||
|     public void testInheritWhenMoveToDifferentRSStep() throws Exception | ||||
|     { | ||||
|         STEP("Add retention schedule cut off step after 1 day period."); | ||||
|         dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "day|1", CREATED_DATE); | ||||
|  | ||||
|         STEP("Add retention schedule destroy step after 1 Day period."); | ||||
|         dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(rootCategory.getName(), "day|1", CUT_OFF_DATE); | ||||
|  | ||||
|         STEP("Create a subcategory with a record folder and records."); | ||||
|         RecordCategoryChild subCategory = createSubCategoryWithRecords(); | ||||
|  | ||||
|         STEP("Add retention schedule retain step after 2 day period."); | ||||
|         dispositionScheduleService.addRetainAfterPeriodStep(rootCategory2.getName(), "day|2"); | ||||
|  | ||||
|         STEP("Add retention schedule destroy step after 2 Day period."); | ||||
|         dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(rootCategory2.getName(), "day|2", DATE_FILED); | ||||
|  | ||||
|         STEP("Move the subcategory within the rootCategory2."); | ||||
|         getRestAPIFactory().getNodeAPI(toContentModel(subCategory.getId())).move(createBodyForMoveCopy(rootCategory2.getId())); | ||||
|         assertStatusCode(OK); | ||||
|  | ||||
|         STEP("Check that both records inherit rootCategory2 retention schedule"); | ||||
|         elRecord = getRestAPIFactory().getRecordsAPI().getRecord(elRecord.getId()); | ||||
|         nonElRecord = getRestAPIFactory().getRecordsAPI().getRecord(nonElRecord.getId()); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionActionName().equalsIgnoreCase(RM_ACTIONS.END_RETENTION.getAction()), | ||||
|                 "Disposition action should be retain"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionPeriod().equalsIgnoreCase("day"), | ||||
|                 "Disposition period property should be day"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionPeriodExpression().equalsIgnoreCase("2"), | ||||
|                 "Disposition period expression should be 2"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionActionName().equalsIgnoreCase(RM_ACTIONS.END_RETENTION.getAction()), | ||||
|                 "Disposition action should be retain"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionPeriod().equalsIgnoreCase("day"), | ||||
|                 "Disposition period property should be day"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionPeriodExpression().equalsIgnoreCase("2"), | ||||
|                 "Disposition period expression should be 2"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Given following structure is created: | ||||
|      * rootCategory1 with RS applied on record level with retain and destroy after 1 day | ||||
|      * - subCategory without RS | ||||
|      * - recFolder | ||||
|      * - incomplete electronic record | ||||
|      * - complete non-electronic record | ||||
|      * rootCategory2 with RS with cut off on event case closed and destroy both after  2 day | ||||
|      * When moving subcategory within rootCategory2 | ||||
|      * Then the records will inherit the RS from rootCategory2 | ||||
|      */ | ||||
|     @Test | ||||
|     @AlfrescoTest (jira = "APPS-1004") | ||||
|     public void testInheritWhenMoveToDifferentRSStepOnEventBase() throws Exception | ||||
|     { | ||||
|         STEP("Add retention schedule retain step after 1 day period."); | ||||
|         dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "day|1"); | ||||
|  | ||||
|         STEP("Add retention schedule destroy step after 1 Day period."); | ||||
|         dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(rootCategory.getName(), "day|1", CUT_OFF_DATE); | ||||
|  | ||||
|         STEP("Create a subcategory with a record folder and records."); | ||||
|         RecordCategoryChild subCategory = createSubCategoryWithRecords(); | ||||
|  | ||||
|         STEP("Add retention schedule cut off step on event case closed."); | ||||
|         dispositionScheduleService.addCutOffAfterEventStep(rootCategory2.getName(), RMEvents.CASE_CLOSED.getEventName()); | ||||
|  | ||||
|         STEP("Add retention schedule destroy step after 1 Day period."); | ||||
|         dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(rootCategory2.getName(), "day|2", DATE_FILED); | ||||
|  | ||||
|         STEP("Move the subcategory within the rootCategory2."); | ||||
|         getRestAPIFactory().getNodeAPI(toContentModel(subCategory.getId())).move(createBodyForMoveCopy(rootCategory2.getId())); | ||||
|         assertStatusCode(OK); | ||||
|  | ||||
|         STEP("Check that both records inherit rootCategory2 retention schedule"); | ||||
|         elRecord = getRestAPIFactory().getRecordsAPI().getRecord(elRecord.getId()); | ||||
|         nonElRecord = getRestAPIFactory().getRecordsAPI().getRecord(nonElRecord.getId()); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionActionName().equalsIgnoreCase(RM_ACTIONS.CUT_OFF.getAction()), | ||||
|                 "Disposition action should be cut off"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionPeriod().equalsIgnoreCase("none"), | ||||
|                 "Disposition period property should none"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionPeriodExpression().equalsIgnoreCase("0"), | ||||
|                 "Disposition period expression should be 0"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionEvents().contains(RMEvents.CASE_CLOSED.getEventName()), | ||||
|                 "Disposition event list doesn't contain case closed event"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionActionName().equalsIgnoreCase(RM_ACTIONS.CUT_OFF.getAction()), | ||||
|                 "Disposition action should be cut off"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionPeriod().equalsIgnoreCase("none"), | ||||
|                 "Disposition period property should be none"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionPeriodExpression().equalsIgnoreCase("0"), | ||||
|                 "Disposition period expression should be 0"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionEvents().contains(RMEvents.CASE_CLOSED.getEventName()), | ||||
|                 "Disposition event list doesn't contain case closed event"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Given following structure is created: | ||||
|      * rootCategory1 with RS applied on record level with cut off on event case closed and destroy after 1 day | ||||
|      * - subCategory2 without RS | ||||
|      * - recFolder | ||||
|      * - incomplete electronic record | ||||
|      * - complete non-electronic record | ||||
|      * rootCategory2 with cut off on event Obsolete and destroy both after 2 day | ||||
|      * When moving subcategory2 within rootCategory2 | ||||
|      * Then the records will inherit the RS from rootCategory2 | ||||
|      */ | ||||
|     @Test | ||||
|     @AlfrescoTest (jira = "APPS-1004") | ||||
|     public void testInheritWhenMoveToSameStepDifferentEvent() throws Exception | ||||
|     { | ||||
|         STEP("Add retention schedule cut off on case closed."); | ||||
|         dispositionScheduleService.addCutOffAfterEventStep(rootCategory.getName(), RMEvents.CASE_CLOSED.getEventName()); | ||||
|  | ||||
|         STEP("Add retention schedule destroy step after 1 Day period."); | ||||
|         dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(rootCategory.getName(), "day|1", CUT_OFF_DATE); | ||||
|  | ||||
|         STEP("Create a subcategory with a record folder and records."); | ||||
|         RecordCategoryChild subCategory = createSubCategoryWithRecords(); | ||||
|  | ||||
|         STEP("Add retention schedule cut off step on event separation."); | ||||
|         dispositionScheduleService.addCutOffAfterEventStep(rootCategory2.getName(), RMEvents.OBSOLETE.getEventName()); | ||||
|  | ||||
|         STEP("Add retention schedule destroy step after 2 Day period."); | ||||
|         dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(rootCategory2.getName(), "day|2", DATE_FILED); | ||||
|  | ||||
|         STEP("Move the subcategory within the rootCategory2."); | ||||
|         getRestAPIFactory().getNodeAPI(toContentModel(subCategory.getId())).move(createBodyForMoveCopy(rootCategory2.getId())); | ||||
|         assertStatusCode(OK); | ||||
|  | ||||
|         STEP("Check that both records inherit rootCategory2 retention schedule"); | ||||
|         elRecord = getRestAPIFactory().getRecordsAPI().getRecord(elRecord.getId()); | ||||
|         nonElRecord = getRestAPIFactory().getRecordsAPI().getRecord(nonElRecord.getId()); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionActionName().equalsIgnoreCase(RM_ACTIONS.CUT_OFF.getAction()), | ||||
|                 "Disposition action should be cut off"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionPeriod().equalsIgnoreCase("none"), | ||||
|                 "Disposition period property should be none"); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionPeriodExpression().equalsIgnoreCase("0"), | ||||
|                 "Disposition period expression should be 0"); | ||||
|         assertFalse(elRecord.getProperties().getRecordSearchDispositionEvents().contains(RMEvents.CASE_CLOSED.getEventName()), | ||||
|                 "Event list contain the event from the previous RS "); | ||||
|         assertTrue(elRecord.getProperties().getRecordSearchDispositionEvents().contains(RMEvents.OBSOLETE.getEventName()), | ||||
|                 "Event list doesn't contain the event from the current RS "); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionActionName().equalsIgnoreCase(RM_ACTIONS.CUT_OFF.getAction()), | ||||
|                 "Disposition action should be cut off"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionPeriod().equalsIgnoreCase("none"), | ||||
|                 "Disposition period property should be none"); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionPeriodExpression().equalsIgnoreCase("0"), | ||||
|                 "Disposition period expression should be 0"); | ||||
|         assertFalse(nonElRecord.getProperties().getRecordSearchDispositionEvents().contains(RMEvents.CASE_CLOSED.getEventName()), | ||||
|                 "Event list contain the event from the previous RS "); | ||||
|         assertTrue(nonElRecord.getProperties().getRecordSearchDispositionEvents().contains(RMEvents.OBSOLETE.getEventName()), | ||||
|                 "Event list doesn't contain the event from the current RS "); | ||||
|     } | ||||
|  | ||||
|     @AfterMethod (alwaysRun = true) | ||||
|     public void cleanupMoveRecCategoriesWithRSTests() | ||||
|     { | ||||
|         getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(rootCategory.getId()); | ||||
|         getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(rootCategory2.getId()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Helper method to create a sub-category with a folder, an incomplete electronic record and a complete | ||||
|      * electronic record | ||||
|      * @return | ||||
|      */ | ||||
|     private RecordCategoryChild createSubCategoryWithRecords() | ||||
|     { | ||||
|         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."); | ||||
|         elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord")); | ||||
|         nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord")); | ||||
|         getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId()); | ||||
|         return subCategory; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,89 @@ | ||||
| # dataprep related | ||||
| alfresco.scheme=http | ||||
| alfresco.server=localhost | ||||
| alfresco.port=8082 | ||||
|  | ||||
| # sync service related | ||||
| sync.scheme=http | ||||
| sync.server=localhost | ||||
| sync.port=9090 | ||||
|  | ||||
| # Solr Server Settings | ||||
| solr.scheme=http | ||||
| solr.server=localhost | ||||
| solr.port=8083 | ||||
|  | ||||
| #Solr Indexing Time | ||||
| solrWaitTimeInSeconds=20 | ||||
|  | ||||
| # credentials | ||||
| admin.user=admin | ||||
| admin.password=admin | ||||
|  | ||||
| # Identity Service configuration | ||||
| # set this property to run tests using AIS | ||||
| # identity-service.auth-server-url=http://localhost:8999/auth | ||||
|  | ||||
| # in containers we cannot access directly JMX, so we will use http://jolokia.org agent | ||||
| # disabling this we will use direct JMX calls to server | ||||
| jmx.useJolokiaAgent=false | ||||
|  | ||||
| # Server Health section | ||||
| # in ServerHealth#isServerReachable() - could also be shown. | ||||
| # enable this option to view if on server there are tenants or not | ||||
| serverHealth.showTenants=false | ||||
|  | ||||
| # TEST MANAGEMENT SECTION - Test Rail | ||||
| # | ||||
| # (currently supporting Test Rail v5.2.1.3472 integration) | ||||
| # | ||||
| # Example of configuration: | ||||
| # ------------------------------------------------------ | ||||
| # if testManagement.enabled=true we enabled TestRailExecutorListener (if used in your suite xml file) | ||||
| # testManagement.updateTestExecutionResultsOnly=true (this will just update the results of a test: no step will be updated - good for performance) | ||||
| # testManagement.endPoint=https://alfresco.testrail.com/ | ||||
| # testManagement.username=<username> | ||||
| # testManagement.apiKey=<api-key> | ||||
| # testManagement.project=<id-of-your-project | ||||
| # testManagement.testRun=<test-run-name>  | ||||
| # testManagement.includeOnlyTestCasesExecuted=true #if you want to include in your run ONLY the test cases that you run, then set this value to false | ||||
| # testManagement.rateLimitInSeconds=1 #is the default rate limit after what minimum time, should we upload the next request. http://docs.gurock.com/testrail-api2/introduction #Rate Limit  | ||||
| # testManagement.suiteId=23 (the id of the Master suite) | ||||
| # ------------------------------------------------------ | ||||
| testManagement.enabled=false | ||||
| testManagement.endPoint=https://alfresco.testrail.com/ | ||||
| testManagement.username= | ||||
| testManagement.apiKey= | ||||
| testManagement.project=7 | ||||
| testManagement.includeOnlyTestCasesExecuted=true | ||||
| testManagement.rateLimitInSeconds=1 | ||||
| testManagement.testRun=MyTestRunInTestRail | ||||
| testManagement.suiteId=12 | ||||
|  | ||||
| # The location of the reports path | ||||
| reports.path=./target/reports | ||||
|  | ||||
| # | ||||
| # Database Section | ||||
| # You should provide here the database URL, that can be a differed server as alfresco. | ||||
| # https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html | ||||
| # | ||||
| # Current supported db.url: | ||||
| # | ||||
| # MySQL: | ||||
| # db.url = jdbc:mysql://${alfresco.server}:3306/alfresco | ||||
| #  | ||||
| # PostgreSQL: | ||||
| # db.url = jdbc:postgresql://<your-DB-IP>:3306/alfresco | ||||
| # | ||||
| # Oracle: | ||||
| # db.url = jdbc:oracle://<your-DB-IP>:3306/alfresco | ||||
| # | ||||
| # MariaDB: | ||||
| # db.url = jdbc:mariadb://<your-DB-IP>:3306/alfresco | ||||
| # | ||||
| db.url = jdbc:mysql://${alfresco.server}:3306/alfresco | ||||
| db.username = alfresco | ||||
| db.password = alfresco | ||||
|  | ||||
| environment=default | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-governance-services-community-parent</artifactId> | ||||
|       <version>11.112</version> | ||||
|       <version>14.24-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <modules> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| TRANSFORMERS_TAG=2.5.2 | ||||
| TRANSFORMERS_TAG=2.5.3 | ||||
| SOLR6_TAG=2.0.2-RC1 | ||||
| POSTGRES_TAG=13.3 | ||||
| ACTIVEMQ_TAG=5.16.1 | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Nelze vytv\u00e1\u0159et | ||||
| rm.action.create.transfer.child-error-message=Nelze vytv\u00e1\u0159et polo\u017eky ve slo\u017ece p\u0159enosu. | ||||
| rm.action.create.record.folder.child-error-message=Z\u00e1znamy je mo\u017en\u00e9 vytv\u00e1\u0159et pouze ve slo\u017ek\u00e1ch z\u00e1znam\u016f a toto bylo {0}. | ||||
| rm.action.transfer-non-editable=Nelze upravovat metadata kontejneru nebo slo\u017eky pro p\u0159enos. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Akci {0} nelze prov\u00e9st, proto\u017ee uzel je zablokovan\u00fd nebo m\u00e1 zablokovan\u00e9 pod\u0159\u00edzen\u00e9 prvky. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Du kan ikke oprette elem | ||||
| rm.action.create.transfer.child-error-message=Du kan ikke oprette elementer i Overf\u00f8r-mapper. | ||||
| rm.action.create.record.folder.child-error-message=Du kan kun oprette poster i postmapper, og dette var en {0}. | ||||
| rm.action.transfer-non-editable=Du kan ikke redigere overf\u00f8rselsmappe- eller container-metadata. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Handlingen kan ikke udf\u00f8res {0}, fordi noden er l\u00e5st eller har l\u00e5ste underordnede noder. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Sie k\u00f6nnen keine El | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Die Aktion ''{0}'' kann nicht ausgef\u00fchrt werden, da der Knoten oder untergeordnete Elemente von ihm festgefahren ist bzw. sind. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=No se pueden crear eleme | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=No se puede realizar la acci\u00f3n {0} porque el nodo est\u00e1 congelado o tiene elementos secundarios congelados. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Siirtos\u00e4ili\u00f6\u | ||||
| rm.action.create.transfer.child-error-message=Siirtokansioihin ei voi luoda kohteita. | ||||
| rm.action.create.record.folder.child-error-message=Tietuekansioihin voi luoda ainoastaan tietueita, mutta t\u00e4m\u00e4 oli {0}. | ||||
| rm.action.transfer-non-editable=Siirtokansion tai -s\u00e4ili\u00f6n metatietoja ei voi muokata. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Toimintoa {0} ei voitu suorittaa, koska solmu on j\u00e4\u00e4dytetty tai sill\u00e4 on j\u00e4\u00e4dytettyj\u00e4 alatasoja. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Impossible de cr\u00e9er | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Impossible d''effectuer l''action {0} car le n\u0153ud ou ses enfants sont gel\u00e9s. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Impossibile creare eleme | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Impossibile eseguire l''azione {0} poich\u00e9 il nodo \u00e8 congelato o presenta nodi figlio congelati. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=\u8ee2\u9001\u30b3\u30f3 | ||||
| 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 | ||||
|  | ||||
| rm.action.node.frozen.error-message=\u30ce\u30fc\u30c9\u304c\u30d5\u30ea\u30fc\u30ba\u3057\u3066\u3044\u308b\u304b\u3001\u307e\u305f\u306f\u5b50\u304c\u51cd\u7d50\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30a2\u30af\u30b7\u30e7\u30f3 {0}\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093 | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Elementer kan ikke oppre | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Kan ikke utf\u00f8re handlingen {0} fordi noden er frossen eller har frosne underordnede elementer. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=U kunt geen onderdelen m | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Kan de actie {0} niet uitvoeren omdat de node geblokkeerd is of geblokkeerde onderliggende elementen heeft. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Nie mo\u017cna utworzy\u | ||||
| rm.action.create.transfer.child-error-message=Nie mo\u017cna utworzy\u0107 pozycji w folderach przesy\u0142ania. | ||||
| rm.action.create.record.folder.child-error-message=W folderach rekord\u00f3w mo\u017cna tworzy\u0107 tylko rekordy, a to by\u0142o {0}. | ||||
| rm.action.transfer-non-editable=Nie mo\u017cna edytowa\u0107 folderu przesy\u0142ania ani metadanych kontenera. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Nie mo\u017cna wykona\u0107 czynno\u015bci {0}, poniewa\u017c w\u0119ze\u0142 jest zablokowany lub ma zablokowane elementy podrz\u0119dne. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=N\u00e3o \u00e9 poss\u00 | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=N\u00e3o \u00e9 poss\u00edvel executar a a\u00e7\u00e3o {0} porque o n\u00f3 est\u00e1 congelado ou tem filhos congelados. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=\u041d\u0435\u0432\u043e | ||||
| 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. | ||||
|  | ||||
| rm.action.node.frozen.error-message=\u041d\u0435 \u0443\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0}, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443\u0437\u0435\u043b \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d \u0438\u043b\u0438 \u0438\u043c\u0435\u0435\u0442 \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=Du kan inte skapa objekt | ||||
| rm.action.create.transfer.child-error-message=Du kan inte skapa objekt i \u00d6verf\u00f6ringsmappar. | ||||
| rm.action.create.record.folder.child-error-message=Du kan endast skapa handlingar i handlingsmappar och detta var en {0}. | ||||
| rm.action.transfer-non-editable=Du kan inte redigera \u00f6verf\u00f6ringsmappen eller beh\u00e5llarens metadata. | ||||
|  | ||||
| rm.action.node.frozen.error-message=Det gick inte att utf\u00f6ra \u00e5tg\u00e4rd {0} eftersom noden \u00e4r frusen eller har frysta underordnade. | ||||
|   | ||||
| @@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=\u60a8\u65e0\u6cd5\u5728 | ||||
| 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 | ||||
|  | ||||
| rm.action.node.frozen.error-message=\u65e0\u6cd5\u6267\u884c\u64cd\u4f5c{0}\uff0c\u56e0\u4e3a\u8282\u70b9\u5df2\u51bb\u7ed3\u6216\u51bb\u7ed3\u7684\u5b50\u8282\u70b9\u3002 | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-governance-services-community-repo-parent</artifactId> | ||||
|       <version>11.112</version> | ||||
|       <version>14.24-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <properties> | ||||
| @@ -108,7 +108,7 @@ | ||||
|       </dependency> | ||||
|       <dependency> | ||||
|          <groupId>org.mockito</groupId> | ||||
|          <artifactId>mockito-all</artifactId> | ||||
|          <artifactId>mockito-core</artifactId> | ||||
|          <scope>test</scope> | ||||
|       </dependency> | ||||
|       <dependency> | ||||
|   | ||||
| @@ -306,7 +306,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private boolean isUnfiltered(NodeRef nodeRef) | ||||
|     protected boolean isUnfiltered(NodeRef nodeRef) | ||||
|     { | ||||
|         return !nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); | ||||
|  | ||||
|   | ||||
| @@ -27,8 +27,9 @@ | ||||
|  | ||||
| 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Mockito.doReturn; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.never; | ||||
| @@ -352,7 +353,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest | ||||
|     private void setupMockedAspects() | ||||
|     { | ||||
|         doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); | ||||
|         doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); | ||||
|         doReturn(true).when(mockedDictionaryService).isSubClass(nullable(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); | ||||
|   | ||||
| @@ -36,15 +36,13 @@ 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.ArgumentMatchers.anyMap; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.isNull; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| 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}. | ||||
| @@ -67,8 +65,6 @@ public class AddToHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     @Before | ||||
|     public void setUp() | ||||
|     { | ||||
|         initMocks(this); | ||||
|  | ||||
|         holdNodeRef = generateNodeRef(); | ||||
|         String holdName = "Hold " + GUID.generate(); | ||||
|  | ||||
| @@ -87,6 +83,6 @@ public class AddToHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     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)); | ||||
|         verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), nullable(String.class), isNull(), anyMap(), eq(true), eq(false)); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -37,15 +37,13 @@ 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.ArgumentMatchers.anyMap; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.isNull; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| 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}. | ||||
| @@ -68,8 +66,6 @@ public class CreateHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     @Before | ||||
|     public void setUp() | ||||
|     { | ||||
|         initMocks(this); | ||||
|  | ||||
|         holdNodeRef = generateNodeRef(); | ||||
|         String holdName = "Hold " + GUID.generate(); | ||||
|         String holdReason = "Reason " + GUID.generate(); | ||||
| @@ -88,6 +84,6 @@ public class CreateHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     public void testCreateHoldCausesAuditEvent() | ||||
|     { | ||||
|         createHoldAuditEvent.onCreateNode(childAssociationRef); | ||||
|         verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), any(String.class), isNull(Map.class), any(Map.class)); | ||||
|         verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), nullable(String.class), isNull(), anyMap()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -34,18 +34,15 @@ 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.ArgumentMatchers.anyMap; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.isNull; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| 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}. | ||||
| @@ -67,8 +64,6 @@ public class DeleteHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     @Before | ||||
|     public void setUp() | ||||
|     { | ||||
|         initMocks(this); | ||||
|  | ||||
|         holdNodeRef = generateNodeRef(); | ||||
|         String holdName = "Hold " + GUID.generate(); | ||||
|  | ||||
| @@ -84,6 +79,6 @@ public class DeleteHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     { | ||||
|         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)); | ||||
|             .auditEvent(eq(holdNodeRef), nullable(String.class), anyMap(), isNull(), eq(true), eq(false)); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -27,25 +27,24 @@ | ||||
|  | ||||
| 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.ArgumentMatchers.anyMap; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.isNull; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Mockito.lenient; | ||||
| 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.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
|  | ||||
| /** | ||||
|  * Unit tests for {@link RemoveFromHoldAuditEvent}. | ||||
| @@ -53,6 +52,7 @@ import org.mockito.Mock; | ||||
|  * @author Chris Shields | ||||
|  * @since 3.3 | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest | ||||
| { | ||||
|     @InjectMocks | ||||
| @@ -70,16 +70,14 @@ public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     @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); | ||||
|         lenient().when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName); | ||||
|         lenient().when(mockedNodeService.getProperty(contentNodeRef, PROP_NAME)).thenReturn(contentName); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -89,7 +87,7 @@ public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest | ||||
|     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)); | ||||
|         verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), nullable(String.class), anyMap(), isNull(), eq(true)); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -28,14 +28,14 @@ | ||||
| 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyList; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| 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.verifyNoMoreInteractions; | ||||
| import static org.mockito.Mockito.when; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| @@ -45,7 +45,6 @@ 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; | ||||
| @@ -81,7 +80,7 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest | ||||
|     public void testAddCustomRMPropertiesNoneFound() | ||||
|     {         | ||||
|         typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); | ||||
|         verifyZeroInteractions(mockForm);         | ||||
|         verifyNoMoreInteractions(mockForm); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
| @@ -130,8 +129,8 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest | ||||
|          | ||||
|         typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); | ||||
|          | ||||
|         verify(mockedIdentifierService).generateIdentifier(any(QName.class), any(NodeRef.class)); | ||||
|         verify(idDef).setDefaultValue(anyString()); | ||||
|         verify(mockedIdentifierService).generateIdentifier(nullable(QName.class), nullable(NodeRef.class)); | ||||
|         verify(idDef).setDefaultValue(nullable(String.class)); | ||||
|         verify(vrDef).setDefaultValue(Boolean.FALSE.toString()); | ||||
|         verify(rpDef).setDefaultValue("none|0"); | ||||
|     } | ||||
| @@ -162,7 +161,7 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest | ||||
|         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));        | ||||
|         verify(mockForm, times(1)).addFields(anyList()); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|   | ||||
| @@ -30,16 +30,16 @@ 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyBoolean; | ||||
| import static org.mockito.ArgumentMatchers.anyMap; | ||||
| import static org.mockito.ArgumentMatchers.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; | ||||
| @@ -57,7 +57,6 @@ 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; | ||||
|  | ||||
| @@ -98,7 +97,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|             return callback.execute(); | ||||
|         }; | ||||
|         doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class), | ||||
|             Matchers.anyBoolean(), Matchers.anyBoolean()); | ||||
|             anyBoolean(), anyBoolean()); | ||||
|  | ||||
|         // setup data | ||||
|         List<String> dispositionActions = buildList(CUTOFF, RETAIN); | ||||
| @@ -141,7 +140,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|         verifyQueryTimes(1); | ||||
|  | ||||
|         // ensure nothing else happens becuase we have no results | ||||
|         verifyZeroInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper); | ||||
|         verifyNoMoreInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -178,7 +177,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|         // 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()); | ||||
|             anyBoolean(), anyBoolean()); | ||||
|  | ||||
|         // ensure each node is process correctly | ||||
|         verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); | ||||
| @@ -186,7 +185,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|  | ||||
|         // ensure no more interactions | ||||
|         verifyNoMoreInteractions(mockedNodeService); | ||||
|         verifyZeroInteractions(mockedRecordsManagementActionService); | ||||
|         verifyNoMoreInteractions(mockedRecordsManagementActionService); | ||||
|  | ||||
|     } | ||||
|  | ||||
| @@ -216,7 +215,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|  | ||||
|         // ensure no more interactions | ||||
|         verifyNoMoreInteractions(mockedNodeService); | ||||
|         verifyZeroInteractions(mockedRecordsManagementActionService); | ||||
|         verifyNoMoreInteractions(mockedRecordsManagementActionService); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -258,7 +257,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|         // 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()); | ||||
|             anyBoolean(), anyBoolean()); | ||||
|  | ||||
|         // ensure each node is process correctly | ||||
|         // node1 | ||||
| @@ -307,7 +306,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest | ||||
|  | ||||
|         // mock the search service to return the right page | ||||
|         when(mockedSearchService.query(any(SearchParameters.class))).thenAnswer((Answer<ResultSet>) invocation -> { | ||||
|             SearchParameters params = invocation.getArgumentAt(0, SearchParameters.class); | ||||
|             SearchParameters params = invocation.getArgument(0, SearchParameters.class); | ||||
|             if (params.getSkipCount() == 0) | ||||
|             { | ||||
|                 // mock first page | ||||
|   | ||||
| @@ -27,17 +27,15 @@ | ||||
| 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.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; | ||||
| @@ -51,24 +49,22 @@ import org.alfresco.service.cmr.repository.NodeService; | ||||
| import org.alfresco.service.namespace.QName; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| import org.springframework.context.ApplicationContext; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
|  | ||||
| /** | ||||
|  * Test class for frozen aspect | ||||
|  * @author Ross Gale | ||||
|  * @since 3.2 | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class FrozenAspectUnitTest | ||||
| { | ||||
|     @Mock | ||||
|     private NodeService mockNodeService; | ||||
|  | ||||
|     @Mock | ||||
|     private ApplicationContext mockApplicationContext; | ||||
|  | ||||
|     @Mock | ||||
|     private ChildAssociationRef mockChildAssociationRef; | ||||
|  | ||||
| @@ -90,9 +86,6 @@ public class FrozenAspectUnitTest | ||||
|     @Mock | ||||
|     private ChildAssociationRef mockOldRef; | ||||
|  | ||||
|     @Mock | ||||
|     private Set mockSet; | ||||
|  | ||||
|     @Mock | ||||
|     private PropertyModificationAllowedCheck mockPropertyModificationAllowedCheck; | ||||
|  | ||||
| @@ -110,18 +103,17 @@ public class FrozenAspectUnitTest | ||||
|     @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); | ||||
|         frozenAspect.setNodeService(mockNodeService); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -142,7 +134,6 @@ public class FrozenAspectUnitTest | ||||
|     @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); | ||||
| @@ -157,7 +148,6 @@ public class FrozenAspectUnitTest | ||||
|     @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); | ||||
| @@ -233,7 +223,6 @@ public class FrozenAspectUnitTest | ||||
|     @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); | ||||
| @@ -247,8 +236,6 @@ public class FrozenAspectUnitTest | ||||
|     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); | ||||
|     } | ||||
|   | ||||
| @@ -33,7 +33,6 @@ import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagement | ||||
| 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; | ||||
| @@ -43,14 +42,17 @@ import org.alfresco.service.cmr.repository.NodeRef; | ||||
| import org.alfresco.service.cmr.repository.NodeService; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
|  | ||||
| /** | ||||
|  * Unit tests for the {@link RecordAspect}. | ||||
|  * | ||||
|  * @author Claudia Agache | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class RecordAspectUnitTest | ||||
| { | ||||
|     private static final NodeRef NODE_REF = new NodeRef("node://Ref/"); | ||||
| @@ -72,7 +74,7 @@ public class RecordAspectUnitTest | ||||
|     @Before | ||||
|     public void setUp() | ||||
|     { | ||||
|         initMocks(this); | ||||
|         recordAspect.setNodeService(mockNodeService); | ||||
|     } | ||||
|  | ||||
|     /** Check that the bin is duplicated before adding the aspect if the file has a copy. */ | ||||
|   | ||||
| @@ -45,13 +45,15 @@ import org.alfresco.service.cmr.repository.StoreRef; | ||||
| import org.alfresco.util.GUID; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
|  | ||||
| /** | ||||
|  * @author silviudinuta | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel, ContentModel | ||||
| { | ||||
|     private final static NodeRef CHILD_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, | ||||
| @@ -74,17 +76,15 @@ public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel, | ||||
|     @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); | ||||
|         nonElectronicRecordType.setNodeService(mockedNodeService); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
|   | ||||
| @@ -27,6 +27,7 @@ | ||||
|  | ||||
| package org.alfresco.module.org_alfresco_module_rm.script.hold; | ||||
|  | ||||
| import static org.mockito.Mockito.lenient; | ||||
| import static org.mockito.Mockito.when; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| @@ -71,8 +72,8 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest | ||||
|  | ||||
|         // 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); | ||||
|         lenient().when(mockedExtendedPermissionService.hasPermission(dmNodeRef, PermissionService.WRITE)).thenReturn(AccessStatus.ALLOWED); | ||||
|         lenient().when(mockedDictionaryService.isSubClass(mockedNodeService.getType(dmNodeRef), ContentModel.TYPE_CONTENT)).thenReturn(true); | ||||
|  | ||||
|         // list of active contents | ||||
|         activeContents = Collections.singletonList(dmNodeRef); | ||||
|   | ||||
| @@ -37,9 +37,12 @@ import java.util.List; | ||||
|  | ||||
| import org.alfresco.service.cmr.repository.NodeRef; | ||||
| import org.json.JSONObject; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.springframework.extensions.webscripts.DeclarativeWebScript; | ||||
|  | ||||
| /** | ||||
| @@ -48,6 +51,7 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript; | ||||
|  * @author Roy Wetherall | ||||
|  * @since 2.2 | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest | ||||
| { | ||||
|     /** classpath location of ftl template for web script */ | ||||
| @@ -77,6 +81,12 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest | ||||
|     /** | ||||
|      * Test that a record can be removed from holds. | ||||
|      */ | ||||
|  | ||||
|     @Before | ||||
|     public void setUp(){ | ||||
|         webScript.setHoldService(mockedHoldService); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Test | ||||
|     public void removeRecordFromHolds() throws Exception | ||||
|   | ||||
| @@ -34,11 +34,12 @@ 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anySet; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.doAnswer; | ||||
| import static org.mockito.Mockito.lenient; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.never; | ||||
| import static org.mockito.Mockito.verify; | ||||
| @@ -75,10 +76,11 @@ import org.alfresco.service.namespace.RegexQNamePattern; | ||||
| import org.alfresco.service.transaction.TransactionService; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| import org.mockito.invocation.InvocationOnMock; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.mockito.stubbing.Answer; | ||||
| import org.springframework.context.ApplicationContext; | ||||
| import org.springframework.context.event.ContextRefreshedEvent; | ||||
| @@ -89,6 +91,7 @@ import org.springframework.context.event.ContextRefreshedEvent; | ||||
|  * @author Roy Wetherall | ||||
|  * @since 2.5 | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class ExtendedSecurityServiceImplUnitTest | ||||
| { | ||||
|     /** service mocks*/ | ||||
| @@ -145,9 +148,6 @@ public class ExtendedSecurityServiceImplUnitTest | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Before public void before() | ||||
|     { | ||||
|         // initialise mocks  | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|          | ||||
|         // setup node | ||||
|         nodeRef = AlfMock.generateNodeRef(mockedNodeService); | ||||
|          | ||||
| @@ -157,7 +157,7 @@ public class ExtendedSecurityServiceImplUnitTest | ||||
|             .thenReturn(filePlan); | ||||
|          | ||||
|         // set-up application context | ||||
|         when(mockedApplicationContext.getBean("dbNodeService")) | ||||
|         lenient().when(mockedApplicationContext.getBean("dbNodeService")) | ||||
|             .thenReturn(mockedNodeService); | ||||
|  | ||||
|         // setup retrying transaction helper | ||||
| @@ -199,6 +199,7 @@ public class ExtendedSecurityServiceImplUnitTest | ||||
|             .forEach((a) ->  | ||||
|                when(mockedAuthorityService.authorityExists(a)) | ||||
|                    .thenReturn(true)); | ||||
|         extendedSecurityService.setNodeService(mockedNodeService); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
| @@ -481,7 +482,7 @@ public class ExtendedSecurityServiceImplUnitTest | ||||
|         .thenReturn(mockedWritePagingResults); | ||||
|          | ||||
|         // setup exact match | ||||
|         when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) | ||||
|         lenient().when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) | ||||
|             .thenReturn(true); | ||||
|         when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) | ||||
|             .thenReturn(Stream | ||||
| @@ -560,7 +561,7 @@ public class ExtendedSecurityServiceImplUnitTest | ||||
|         .thenReturn(mockedWritePagingResults); | ||||
|          | ||||
|         // setup exact match | ||||
|         when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) | ||||
|         lenient().when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) | ||||
|             .thenReturn(true); | ||||
|         when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) | ||||
|             .thenReturn(Stream | ||||
| @@ -651,7 +652,7 @@ public class ExtendedSecurityServiceImplUnitTest | ||||
|         .thenReturn(mockedWritePagingResults); | ||||
|  | ||||
|         // setup exact match | ||||
|         when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) | ||||
|         lenient().when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) | ||||
|             .thenReturn(true); | ||||
|         when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) | ||||
|             .thenReturn(Stream | ||||
|   | ||||
| @@ -27,8 +27,9 @@ | ||||
|  | ||||
| package org.alfresco.module.org_alfresco_module_rm.test.util; | ||||
|  | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.doReturn; | ||||
| import static org.mockito.Mockito.lenient; | ||||
| import static org.mockito.Mockito.when; | ||||
|  | ||||
| import java.util.UUID; | ||||
| @@ -119,7 +120,7 @@ public class AlfMock | ||||
|     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); | ||||
|         lenient().when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); | ||||
|         if (type != null) | ||||
|         { | ||||
|             when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); | ||||
|   | ||||
| @@ -28,10 +28,10 @@ | ||||
| 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.doReturn; | ||||
| import static org.mockito.Mockito.lenient; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
|  | ||||
| @@ -168,7 +168,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|  | ||||
|         // setup application context | ||||
|         doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); | ||||
|         lenient().doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); | ||||
|  | ||||
|         // setup retrying transaction helper | ||||
|         Answer<Object> doInTransactionAnswer = new Answer<Object>() | ||||
| @@ -181,7 +181,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|                 return callback.execute(); | ||||
|             } | ||||
|         }; | ||||
|         doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).<Object>doInTransaction(any(RetryingTransactionCallback.class)); | ||||
|         lenient().doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).<Object>doInTransaction(any(RetryingTransactionCallback.class)); | ||||
|  | ||||
|         // setup mocked authentication util | ||||
|         MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); | ||||
| @@ -189,15 +189,15 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|         // setup file plan | ||||
|         filePlan = generateNodeRef(TYPE_FILE_PLAN); | ||||
|         setupAsFilePlanComponent(filePlan); | ||||
|         doReturn(true).when(mockedFilePlanService).isFilePlan(filePlan); | ||||
|         lenient().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); | ||||
|         lenient().doReturn(RM_URI).when(mockedNamespaceService).getNamespaceURI(RM_PREFIX); | ||||
|         lenient().doReturn(CollectionUtils.unmodifiableSet(RM_PREFIX)).when(mockedNamespaceService).getPrefixes(RM_URI); | ||||
|  | ||||
|         // setup record folder and record | ||||
|         recordFolder = generateRecordFolder(); | ||||
| @@ -206,10 +206,10 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|         // set record as child of record folder | ||||
|         List<ChildAssociationRef> 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); | ||||
|         lenient().doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class)); | ||||
|         lenient().doReturn(result).when(mockedNodeService).getParentAssocs(record); | ||||
|         lenient().doReturn(Collections.singletonList(recordFolder)).when(mockedRecordFolderService).getRecordFolders(record); | ||||
|         lenient().doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -221,7 +221,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|     protected NodeRef generateHoldNodeRef(String name) | ||||
|     { | ||||
|         NodeRef hold = generateNodeRef(TYPE_HOLD); | ||||
|         doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME); | ||||
|         lenient().doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME); | ||||
|         doReturn(true).when(mockedHoldService).isHold(hold); | ||||
|         return hold; | ||||
|     } | ||||
| @@ -235,7 +235,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|     { | ||||
|         NodeRef recordFolder = generateNodeRef(TYPE_RECORD_FOLDER); | ||||
|         setupAsFilePlanComponent(recordFolder); | ||||
|         doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder); | ||||
|         lenient().doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder); | ||||
|         return recordFolder; | ||||
|     } | ||||
|  | ||||
| @@ -248,8 +248,8 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|     { | ||||
|         NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); | ||||
|         setupAsFilePlanComponent(record); | ||||
|         doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD); | ||||
|         doReturn(true).when(mockedRecordService).isRecord(record); | ||||
|         lenient().doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD); | ||||
|         lenient().doReturn(true).when(mockedRecordService).isRecord(record); | ||||
|         return record; | ||||
|     } | ||||
|  | ||||
| @@ -260,10 +260,10 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|      */ | ||||
|     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); | ||||
|         lenient().doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT); | ||||
|         lenient().doReturn(true).when(mockedFilePlanService).isFilePlanComponent(nodeRef); | ||||
|         lenient().doReturn(filePlan).when(mockedFilePlanService).getFilePlan(nodeRef); | ||||
|         lenient().doReturn(filePlan).when(mockedNodeService).getProperty(nodeRef, PROP_ROOT_NODEREF); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -297,7 +297,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|     protected NodeRef generateCmContent(String name) | ||||
|     { | ||||
|         NodeRef nodeRef = generateNodeRef(ContentModel.TYPE_CONTENT, true); | ||||
|         doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); | ||||
|         lenient().doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); | ||||
|         return nodeRef; | ||||
|     } | ||||
|  | ||||
| @@ -312,11 +312,11 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|     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); | ||||
|         lenient().when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); | ||||
|         if (type != null) | ||||
|         { | ||||
|             when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); | ||||
|             when(mockedNodeTypeUtility.instanceOf(type, type)).thenReturn(true); | ||||
|             lenient().when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); | ||||
|             lenient().when(mockedNodeTypeUtility.instanceOf(type, type)).thenReturn(true); | ||||
|         } | ||||
|         return nodeRef; | ||||
|     } | ||||
| @@ -334,7 +334,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel | ||||
|  | ||||
|         if (parent != null) | ||||
|         { | ||||
|             doReturn(parent).when(mockedChildAssociationRef).getParentRef(); | ||||
|             lenient().doReturn(parent).when(mockedChildAssociationRef).getParentRef(); | ||||
|         } | ||||
|  | ||||
|         if (child != null) | ||||
|   | ||||
| @@ -29,10 +29,12 @@ package org.alfresco.module.org_alfresco_module_rm.test.util; | ||||
|  | ||||
| import static java.util.Collections.emptyMap; | ||||
|  | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| 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.lenient; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
|  | ||||
| @@ -179,19 +181,19 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest | ||||
|         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(); | ||||
|         lenient().doReturn(match).when(mockedRequest).getServiceMatch(); | ||||
|         lenient().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(); | ||||
|             lenient().doReturn(content).when(mockedContent).getContent(); | ||||
|             lenient().doReturn(mockedContent).when(mockedRequest).getContent(); | ||||
|         } | ||||
|          | ||||
|         String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]); | ||||
|         doReturn(paramNames).when(mockedRequest).getParameterNames(); | ||||
|         doAnswer(new Answer() | ||||
|         lenient().doReturn(paramNames).when(mockedRequest).getParameterNames(); | ||||
|         lenient().doAnswer(new Answer() | ||||
|         { | ||||
|             @Override | ||||
|             public Object answer(InvocationOnMock invocation) throws Throwable | ||||
| @@ -201,9 +203,9 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest | ||||
|             } | ||||
|              | ||||
|         }).when(mockedRequest).getParameter(anyString()); | ||||
|          | ||||
|         doReturn(new String[0]).when(mockedRequest).getHeaderNames(); | ||||
|         doReturn("json").when(mockedRequest).getFormat(); | ||||
|  | ||||
|         lenient().doReturn(new String[0]).when(mockedRequest).getHeaderNames(); | ||||
|         lenient().doReturn("json").when(mockedRequest).getFormat(); | ||||
|          | ||||
|         return mockedRequest;         | ||||
|     } | ||||
| @@ -217,7 +219,7 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest | ||||
|     { | ||||
|         WebScriptResponse mockedResponse = mock(WebScriptResponse.class); | ||||
|         StringWriter writer = new StringWriter(); | ||||
|         doReturn(writer).when(mockedResponse).getWriter(); | ||||
|         lenient().doReturn(writer).when(mockedResponse).getWriter(); | ||||
|         return mockedResponse; | ||||
|     } | ||||
|      | ||||
| @@ -230,13 +232,13 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest | ||||
|     protected Container getMockedContainer(String template) throws Exception | ||||
|     { | ||||
|         FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class); | ||||
|         doReturn("application/json").when(mockedFormatRegistry).getMimeType(anyString(), anyString()); | ||||
|         lenient().doReturn("application/json").when(mockedFormatRegistry).getMimeType(nullable(String.class), nullable(String.class)); | ||||
|          | ||||
|         ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class); | ||||
|         doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString()); | ||||
|         lenient().doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString()); | ||||
|          | ||||
|         TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class); | ||||
|         doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString()); | ||||
|         lenient().doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString()); | ||||
|          | ||||
|         FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor() | ||||
|         { | ||||
| @@ -248,25 +250,25 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest | ||||
|         }; | ||||
|         ftlTemplateProcessor.init();         | ||||
|          | ||||
|         doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString()); | ||||
|         lenient().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(); | ||||
|         lenient().doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry(); | ||||
|         lenient().doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry(); | ||||
|         lenient().doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry(); | ||||
|          | ||||
|         Map<String, Object> containerTemplateParameters = new HashMap<>(5); | ||||
|         containerTemplateParameters.put("jsonUtils", new JSONUtils()); | ||||
|         containerTemplateParameters.put("people", getMockedPeopleObject()); | ||||
|         doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters(); | ||||
|         lenient().doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters(); | ||||
|  | ||||
|         SearchPath mockedSearchPath = mock(SearchPath.class); | ||||
|         doReturn(false).when(mockedSearchPath).hasDocument(anyString()); | ||||
|         doReturn(mockedSearchPath).when(mockedContainer).getSearchPath(); | ||||
|         lenient().doReturn(false).when(mockedSearchPath).hasDocument(anyString()); | ||||
|         lenient().doReturn(mockedSearchPath).when(mockedContainer).getSearchPath(); | ||||
|          | ||||
|         // setup description | ||||
|         Description mockDescription = mock(Description.class); | ||||
|         doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache(); | ||||
|         lenient().doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache(); | ||||
|          | ||||
|         return mockedContainer; | ||||
|     } | ||||
|   | ||||
| @@ -27,11 +27,10 @@ | ||||
|  | ||||
| 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.Mockito.lenient; | ||||
| 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; | ||||
| @@ -74,7 +73,7 @@ public class MockAuthenticationUtilHelper | ||||
|         reset(mockAuthenticationUtil); | ||||
|  | ||||
|         // just do the work | ||||
|         doAnswer(new Answer<Object>() | ||||
|         lenient().doAnswer(new Answer<Object>() | ||||
|         { | ||||
|             @SuppressWarnings("rawtypes") | ||||
|             @Override | ||||
| @@ -87,7 +86,7 @@ public class MockAuthenticationUtilHelper | ||||
|         }).when(mockAuthenticationUtil).<Object> runAsSystem(any(RunAsWork.class)); | ||||
|  | ||||
|         // just do the work | ||||
|         doAnswer(new Answer<Object>() | ||||
|         lenient().doAnswer(new Answer<Object>() | ||||
|         { | ||||
|             @SuppressWarnings("rawtypes") | ||||
|             @Override | ||||
| @@ -99,10 +98,10 @@ public class MockAuthenticationUtilHelper | ||||
|  | ||||
|         }).when(mockAuthenticationUtil).<Object> 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); | ||||
|         lenient().when(mockAuthenticationUtil.getAdminUserName()).thenReturn(ADMIN_USER); | ||||
|         lenient().when(mockAuthenticationUtil.getFullyAuthenticatedUser()).thenReturn(fullyAuthenticatedUser); | ||||
|         lenient().when(mockAuthenticationUtil.getRunAsUser()).thenReturn(fullyAuthenticatedUser); | ||||
|         lenient().when(mockAuthenticationUtil.getSystemUserName()).thenReturn(SYSTEM_USER); | ||||
|         lenient().when(mockAuthenticationUtil.getGuestUserName()).thenReturn(GUEST_USER); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -87,6 +87,7 @@ public class ContentBinDuplicationUtilityUnitTest | ||||
|     public void setUp() | ||||
|     { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         contentBinDuplicationUtility.setNodeService(mockNodeService); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -29,10 +29,11 @@ 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyMap; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Mockito.doReturn; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.never; | ||||
| @@ -52,7 +53,6 @@ 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; | ||||
| @@ -61,9 +61,11 @@ 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.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
|  | ||||
| /** | ||||
|  * Recordable version service implementation unit test. | ||||
| @@ -71,6 +73,7 @@ import org.mockito.Spy; | ||||
|  * @author Roy Wetherall | ||||
|  * @since 2.3 | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
| { | ||||
|     /** versioned content name */ | ||||
| @@ -108,34 +111,23 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|         recordableVersionService.initialise(); | ||||
|  | ||||
|         doReturn(generateChildAssociationRef(null, generateNodeRef(Version2Model.TYPE_QNAME_VERSION_HISTORY))) | ||||
|             .when(mockedDbNodeService).createNode(any(NodeRef.class), | ||||
|                                                   any(QName.class), | ||||
|                                                   any(QName.class), | ||||
|             .when(mockedDbNodeService).createNode(nullable(NodeRef.class), | ||||
|                                                   nullable(QName.class), | ||||
|                                                   nullable(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()); | ||||
|                                                   nullable(Map.class)); | ||||
|  | ||||
|         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), | ||||
|                                                                 nullable(NodeRef.class), | ||||
|                                                                 eq(Version2Model.CHILD_QNAME_VERSIONS), | ||||
|                                                                 any(QName.class), | ||||
|                                                                 nullable(QName.class), | ||||
|                                                                 eq(TYPE_CONTENT), | ||||
|                                                                 anyMap()); | ||||
|                                                                 nullable(Map.class)); | ||||
|         recordableVersionService.setDbNodeService(mockedDbNodeService); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -167,7 +159,6 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|      { | ||||
|          // 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 | ||||
| @@ -357,7 +348,6 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|     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); | ||||
|  | ||||
| @@ -376,7 +366,6 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|     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); | ||||
|  | ||||
| @@ -391,8 +380,6 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|     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); | ||||
|  | ||||
| @@ -461,16 +448,15 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|         // 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)); | ||||
|         doReturn(versionHistoryNodeRef).when(mockedDbNodeService).getChildByName(nullable(NodeRef.class), eq(Version2Model.CHILD_QNAME_VERSION_HISTORIES), nullable(String.class)); | ||||
|          | ||||
|         // version number | ||||
|         doReturn(mockedVersion).when(recordableVersionService).getCurrentVersion(nodeRef); | ||||
|         doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(any(NodeRef.class)); | ||||
|         doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(nullable(NodeRef.class)); | ||||
|         makePrimaryParentOf(versionNodeRef, versionHistoryNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "something-0"), mockedDbNodeService); | ||||
|          | ||||
|         // created version | ||||
| @@ -478,36 +464,36 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|         doReturn(generateChildAssociationRef(versionHistoryNodeRef, newVersionNodeRef)).when(mockedDbNodeService).createNode( | ||||
|                 eq(versionHistoryNodeRef), | ||||
|                 eq(Version2Model.CHILD_QNAME_VERSIONS), | ||||
|                 any(QName.class), | ||||
|                 any(QName.class), | ||||
|                 any(Map.class)); | ||||
|                 nullable(QName.class), | ||||
|                 nullable(QName.class), | ||||
|                 nullable(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)); | ||||
|                 eq(filePlan), | ||||
|                 nullable(String.class), | ||||
|                 nullable(QName.class), | ||||
|                 nullable(Map.class), | ||||
|                 nullable(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)); | ||||
|                 eq(filePlan), | ||||
|                 nullable(String.class), | ||||
|                 nullable(QName.class), | ||||
|                 any(Map.class), | ||||
|                 nullable(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)); | ||||
|                 nullable(QName.class), | ||||
|                 nullable(QName.class), | ||||
|                 nullable(Map.class)); | ||||
|         verify(mockedNodeService, times(1)).addAspect(eq(newVersionNodeRef), eq(Version2Model.ASPECT_VERSION), any(Map.class)); | ||||
|         verify(mockedNodeService, times(1)).addAspect( | ||||
|                 newVersionNodeRef,  | ||||
| @@ -605,20 +591,13 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|         // 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); | ||||
|          | ||||
| @@ -643,20 +622,13 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest | ||||
|         // 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); | ||||
|          | ||||
|   | ||||
| @@ -33,10 +33,11 @@ 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyBoolean; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Mockito.doAnswer; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.never; | ||||
| @@ -562,7 +563,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme | ||||
|         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)); | ||||
|                     csvFileCaptor.capture(), nullable(Long.class), any(Boolean.class), any(String.class), any(Map.class)); | ||||
|  | ||||
|         File fileForDownload = csvFileCaptor.getValue(); | ||||
|         assertNotNull(fileForDownload); | ||||
|   | ||||
| @@ -28,8 +28,9 @@ | ||||
| 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.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.never; | ||||
| import static org.mockito.Mockito.times; | ||||
| @@ -41,7 +42,6 @@ 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; | ||||
| @@ -59,10 +59,11 @@ import org.alfresco.service.cmr.view.Location; | ||||
| import org.alfresco.service.namespace.QName; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.ArgumentCaptor; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
|  | ||||
| /** | ||||
|  * Unit Test class for RMSitesImpl. | ||||
| @@ -71,6 +72,7 @@ import org.mockito.MockitoAnnotations; | ||||
|  * @since 2.6 | ||||
|  * | ||||
|  */ | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
| { | ||||
|     private static final String RM_SITE_TITLE_AFTER_UPDATE = "Updated Title"; | ||||
| @@ -86,8 +88,6 @@ public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
|     @Mock | ||||
|     private SiteService mockedSiteService; | ||||
|     @Mock | ||||
|     AuthenticationUtil mockAuthenticationUtil; | ||||
|     @Mock | ||||
|     private ImporterService mockedImporterService; | ||||
|     @Mock | ||||
|     private FavouritesService mockedFavouritesService; | ||||
| @@ -95,7 +95,6 @@ public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
|     @Before | ||||
|     public void before() | ||||
|     { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
| @@ -138,7 +137,7 @@ public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
|  | ||||
|         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(mockedFavouritesService, times(1)).addFavourite(nullable(String.class), any(NodeRef.class)); | ||||
|  | ||||
|         //verify returned values for RM site are the right ones | ||||
|         assertEquals(RMSiteCompliance.STANDARD, createdRMSite.getCompliance()); | ||||
| @@ -191,7 +190,7 @@ public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
|  | ||||
|         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(mockedFavouritesService, times(1)).addFavourite(nullable(String.class), any(NodeRef.class)); | ||||
|  | ||||
|         //verify returned values for RM site are the right ones | ||||
|         assertEquals(RMSiteCompliance.DOD5015, createdRMSite.getCompliance()); | ||||
| @@ -253,13 +252,12 @@ public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
|         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); | ||||
|         when(mockedSiteService.getMembersRole(eq(siteId), nullable(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); | ||||
|  | ||||
| @@ -309,7 +307,7 @@ public class RMSitesImplUnitTest  extends BaseUnitTest | ||||
|         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); | ||||
|         when(mockedSiteService.getMembersRole(eq(siteId), nullable(String.class))).thenReturn(RM_SITE_MANAGER_ROLE); | ||||
|  | ||||
|         //STANDARD compliance | ||||
|         RMSite rmSite = rmSitesImpl.getRMSite(siteId); | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-governance-services-community-repo-parent</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <build> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modules> | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-amps</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <parent> | ||||
|       <groupId>org.alfresco</groupId> | ||||
|       <artifactId>alfresco-community-repo</artifactId> | ||||
|       <version>11.112</version> | ||||
|       <version>14.24-SNAPSHOT</version> | ||||
|    </parent> | ||||
|  | ||||
|    <dependencies> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -25,16 +25,17 @@ | ||||
|  */ | ||||
| package org.alfresco.repo.content; | ||||
|  | ||||
| import java.util.Date; | ||||
|  | ||||
| import org.alfresco.api.AlfrescoPublicApi; | ||||
| import org.alfresco.service.Experimental; | ||||
| import org.alfresco.service.cmr.repository.ContentAccessor; | ||||
| import org.alfresco.service.cmr.repository.ContentIOException; | ||||
| import org.alfresco.service.cmr.repository.ContentReader; | ||||
| import org.alfresco.service.cmr.repository.ContentStreamListener; | ||||
| import org.alfresco.service.cmr.repository.ContentWriter; | ||||
| import org.alfresco.service.cmr.repository.DirectAccessUrl; | ||||
| import org.alfresco.service.cmr.repository.NodeRef; | ||||
|  | ||||
| import java.util.Collections; | ||||
| import java.util.Map; | ||||
|  | ||||
|  | ||||
| /** | ||||
| @@ -254,9 +255,10 @@ public interface ContentStore | ||||
|     /** | ||||
|      * Checks if the store supports the retrieving of a direct access URL for the given node. | ||||
|      * | ||||
|      * @param contentUrl    the {@code URL} of the content for which to request a direct access {@code URL} | ||||
|      * @return {@code true} if direct access URLs retrieving is supported for the node, {@code false} otherwise | ||||
|      */ | ||||
|     default boolean isContentDirectUrlEnabled(NodeRef nodeRef) | ||||
|     default boolean isContentDirectUrlEnabled(String contentUrl) | ||||
|     { | ||||
|         return false; | ||||
|     } | ||||
| @@ -271,9 +273,25 @@ public interface ContentStore | ||||
|      * @return A direct access {@code URL} object for the content | ||||
|      * @throws UnsupportedOperationException if the store is unable to provide the information | ||||
|      */ | ||||
|     @Deprecated | ||||
|     default DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName) | ||||
|     { | ||||
|         return requestContentDirectUrl(contentUrl, attachment, fileName, null); | ||||
|         return requestContentDirectUrl(contentUrl, attachment, fileName, null, null); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets a presigned URL to directly access the content. It is up to the actual store | ||||
|      * implementation if it can fulfil this request with an expiry time or not. | ||||
|      * | ||||
|      * @param contentUrl A content store {@code URL} | ||||
|      * @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}. | ||||
|      * @param fileName File name of the content | ||||
|      * @return A direct access {@code URL} object for the content | ||||
|      * @throws UnsupportedOperationException if the store is unable to provide the information | ||||
|      */ | ||||
|     default DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimetype) | ||||
|     { | ||||
|         return requestContentDirectUrl(contentUrl, attachment, fileName, mimetype, null); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -287,36 +305,43 @@ public interface ContentStore | ||||
|      * @return A direct access {@code URL} object for the content. | ||||
|      * @throws UnsupportedOperationException if the store is unable to provide the information | ||||
|      */ | ||||
|     @Deprecated | ||||
|     default DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, Long validFor) | ||||
|     { | ||||
|         throw new UnsupportedOperationException( | ||||
|                 "Retrieving direct access URLs is not supported by this content store."); | ||||
|         return requestContentDirectUrl(contentUrl, attachment, fileName, null, validFor); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets a presigned URL to directly access a binary content. It is up to the actual store | ||||
|      * Gets a presigned URL to directly access the content. It is up to the actual store | ||||
|      * implementation if it can fulfil this request with an expiry time or not. | ||||
|      * | ||||
|      * @param contentUrl A content store URL | ||||
|      * @param expiresAt An optional expiry date, so the direct access url would become invalid when the expiry date is reached | ||||
|      * @return A direct access URL object for a binary content | ||||
|      * @param contentUrl A content store {@code URL} | ||||
|      * @param attachment {@code true} if an attachment URL is requested, {@code false} for an embedded {@code URL}. | ||||
|      * @param fileName File name of the content | ||||
|      * @param mimetype Mimetype of the content | ||||
|      * @param validFor The time at which the direct access {@code URL} will expire. | ||||
|      * @return A direct access {@code URL} object for the content. | ||||
|      * @throws UnsupportedOperationException if the store is unable to provide the information | ||||
|      */ | ||||
|     @Deprecated | ||||
|     default DirectAccessUrl getDirectAccessUrl(String contentUrl, Date expiresAt) | ||||
|     default DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimetype, Long validFor) | ||||
|     { | ||||
|         throw new UnsupportedOperationException( | ||||
|                 "Retrieving direct access URLs is not supported by this content store."); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if the store supports the retrieving of direct access URLs. | ||||
|      * Gets a key-value (String-String) collection of storage headers/properties with their respective values. | ||||
|      * A particular Cloud Connector will fill in that data with Cloud Storage Provider generic data. | ||||
|      * Map may be also filled in with entries consisting of pre-defined Alfresco keys of {@code ObjectStorageProps} and their values. | ||||
|      * If empty Map is returned - no connector is present or connector is not supporting retrieval of the properties | ||||
|      * or cannot determine the properties. | ||||
|      * | ||||
|      * @return true if direct access URLs retrieving is supported, false otherwise | ||||
|      * @param contentUrl the URL of the content for which the storage properties are to be retrieved. | ||||
|      * @return Returns a key-value (String-String) collection of storage headers/properties with their respective values. | ||||
|      */ | ||||
|     @Deprecated | ||||
|     default boolean isDirectAccessSupported() | ||||
|     @Experimental | ||||
|     default Map<String, String> getStorageProperties(String contentUrl) | ||||
|     { | ||||
|         return false; | ||||
|         return Collections.emptyMap(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,64 @@ | ||||
| /* | ||||
|  * #%L | ||||
|  * Alfresco Data model classes | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software. | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of | ||||
|  * the paid license agreement will prevail.  Otherwise, the software is | ||||
|  * provided under the following open source license terms: | ||||
|  * | ||||
|  * Alfresco is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU Lesser General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * Alfresco is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public License | ||||
|  * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
|  | ||||
| package org.alfresco.repo.content; | ||||
|  | ||||
| import org.alfresco.service.Experimental; | ||||
|  | ||||
| /** | ||||
|  * Enumeration with "header" values for Alfresco derived Storage Properties | ||||
|  * Values of this enum should be used when adding Alfresco derived key-value pairs in Storage Properties map. | ||||
|  * Subject to expand/change. | ||||
|  * | ||||
|  * @author mpichura | ||||
|  */ | ||||
| @Experimental | ||||
| public enum ObjectStorageProps { | ||||
|     /** | ||||
|      * Object's content is archived and not immediately accessible. | ||||
|      */ | ||||
|     X_ALF_ARCHIVED("x-alf-archived"), | ||||
|     /** | ||||
|      * Object's content retrieval from archive is in progress | ||||
|      */ | ||||
|     X_ALF_ARCHIVE_RESTORE_IN_PROGRESS("x-alf-archive-restore-in-progress"), | ||||
|     /** | ||||
|      * Expiry date and time of object's content retrieved from archive. | ||||
|      * Use YYYYMMDDThhmmssZ (ISO-8601) datetime format when using this value as key in Storage Properties map. | ||||
|      */ | ||||
|     X_ALF_ARCHIVE_RESTORE_EXPIRY("x-alf-archive-restore-expiry"); | ||||
|  | ||||
|     ObjectStorageProps(String value) { | ||||
|         this.value = value; | ||||
|     } | ||||
|  | ||||
|     private final String value; | ||||
|  | ||||
|     public String getValue() { | ||||
|         return value; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Data model classes | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2016 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
|   | ||||
| @@ -0,0 +1,55 @@ | ||||
| /* | ||||
|  * #%L | ||||
|  * Alfresco Data model classes | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software. | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of | ||||
|  * the paid license agreement will prevail.  Otherwise, the software is | ||||
|  * provided under the following open source license terms: | ||||
|  * | ||||
|  * Alfresco is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU Lesser General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * Alfresco is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public License | ||||
|  * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
| package org.alfresco.service; | ||||
|  | ||||
| import java.lang.annotation.Documented; | ||||
| import java.lang.annotation.ElementType; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
| import java.lang.annotation.Target; | ||||
|  | ||||
| /** | ||||
|  * Annotation to mark a type/method/field as experimental. | ||||
|  * <p> | ||||
|  * If this annotation is present on an element it marks it as experimental and subject to change without further notice. | ||||
|  * The element may even be deleted or renamed without any notice. | ||||
|  * Experimental element may likely become a valid one (not experimental anymore) in future releases but there is no guarantee when | ||||
|  * and if that happens. | ||||
|  * | ||||
|  * @author mpichura | ||||
|  */ | ||||
| @Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE}) | ||||
| @Retention(RetentionPolicy.CLASS) | ||||
| @Documented | ||||
| public @interface Experimental { | ||||
|     /** | ||||
|      * Further description that can optionally be added to clarify possible future changes of annotated object. | ||||
|      * | ||||
|      * @return a String, the default is an empty String. | ||||
|      */ | ||||
|     String description() default ""; | ||||
|  | ||||
| } | ||||
| @@ -9,6 +9,6 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
| </project> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| # Fetch image based on Tomcat 9.0, Java 11 and Centos 8 | ||||
| # More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat | ||||
| FROM alfresco/alfresco-base-tomcat:9.0.45-java-11-centos-8 | ||||
| FROM alfresco/alfresco-base-tomcat:9.0.52-java-11-centos-7 | ||||
|  | ||||
| # Set default docker_context. | ||||
| ARG resource_path=target | ||||
| @@ -65,12 +65,12 @@ RUN sed -i -e "s_log4j.appender.File.File\=alfresco.log_log4j.appender.File.File | ||||
|  | ||||
| # fontconfig is required by Activiti worflow diagram generator | ||||
| # installing pinned dependencies as well | ||||
| RUN yum install -y fontconfig-2.13.1-3.el8 \ | ||||
|                    dejavu-fonts-common-2.35-7.el8 \ | ||||
|                    fontpackages-filesystem-1.44-22.el8 \ | ||||
|                    freetype-2.9.1-4.el8_3.1 \ | ||||
|                    libpng-1.6.34-5.el8 \ | ||||
|                    dejavu-sans-fonts-2.35-7.el8 && \ | ||||
| RUN yum install -y fontconfig-2.13.0-4.3.el7 \ | ||||
|                    dejavu-fonts-common-2.33-6.el7 \ | ||||
|                    fontpackages-filesystem-1.44-8.el7 \ | ||||
|                    freetype-2.8-14.el7_9.1 \ | ||||
|                    libpng-1.5.13-8.el7 \ | ||||
|                    dejavu-sans-fonts-2.33-6.el7 && \ | ||||
|     yum clean all | ||||
|  | ||||
| # The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,  | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modules> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| TRANSFORMERS_TAG=2.5.2 | ||||
| TRANSFORMERS_TAG=2.5.3 | ||||
| SOLR6_TAG=2.0.2 | ||||
| POSTGRES_TAG=13.3 | ||||
| ACTIVEMQ_TAG=5.16.1 | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modules> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
| @@ -93,7 +93,7 @@ | ||||
|         <dependency> | ||||
|             <groupId>com.jayway.jsonpath</groupId> | ||||
|             <artifactId>json-path</artifactId> | ||||
|             <version>2.5.0</version> | ||||
|             <version>${dependency.jakarta-json-path.version}</version> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-tests</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <developers> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo-packaging</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <properties> | ||||
|   | ||||
							
								
								
									
										53
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | ||||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|     <artifactId>alfresco-community-repo</artifactId> | ||||
|     <version>11.112</version> | ||||
|     <version>14.24-SNAPSHOT</version> | ||||
|     <packaging>pom</packaging> | ||||
|     <name>Alfresco Community Repo Parent</name> | ||||
|  | ||||
| @@ -23,7 +23,7 @@ | ||||
|  | ||||
|     <properties> | ||||
|         <acs.version.major>7</acs.version.major> | ||||
|         <acs.version.minor>1</acs.version.minor> | ||||
|         <acs.version.minor>2</acs.version.minor> | ||||
|         <acs.version.revision>0</acs.version.revision> | ||||
|         <acs.version.label /> | ||||
|         <amp.min.version>${acs.version.major}.0.0</amp.min.version> | ||||
| @@ -53,35 +53,34 @@ | ||||
|         <dependency.activiti.version>5.23.0</dependency.activiti.version> | ||||
|         <dependency.alfresco-transform-model.version>1.4.0</dependency.alfresco-transform-model.version> | ||||
|         <dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version> | ||||
|         <dependency.acs-event-model.version>0.0.12</dependency.acs-event-model.version> | ||||
|         <dependency.acs-event-model.version>0.0.13</dependency.acs-event-model.version> | ||||
|  | ||||
|         <dependency.spring.version>5.3.9</dependency.spring.version> | ||||
|         <dependency.spring.version>5.3.10</dependency.spring.version> | ||||
|         <dependency.antlr.version>3.5.2</dependency.antlr.version> | ||||
|         <dependency.jackson.version>2.12.3</dependency.jackson.version> | ||||
|         <dependency.jackson-databind.version>2.12.4</dependency.jackson-databind.version> | ||||
|         <dependency.cxf.version>3.4.4</dependency.cxf.version> | ||||
|         <dependency.cxf.version>3.4.5</dependency.cxf.version> | ||||
|         <dependency.opencmis.version>1.0.0</dependency.opencmis.version> | ||||
|         <dependency.webscripts.version>8.22</dependency.webscripts.version> | ||||
|         <dependency.webscripts.version>8.24</dependency.webscripts.version> | ||||
|         <dependency.bouncycastle.version>1.69</dependency.bouncycastle.version> | ||||
|         <dependency.mockito-core.version>3.11.2</dependency.mockito-core.version> | ||||
|         <dependency.mockito-all.version>1.10.19</dependency.mockito-all.version> | ||||
|         <dependency.org-json.version>20210307</dependency.org-json.version> | ||||
|         <dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version> | ||||
|         <dependency.commons-io.version>2.8.0</dependency.commons-io.version> | ||||
|         <dependency.commons-io.version>2.11.0</dependency.commons-io.version> | ||||
|         <dependency.gson.version>2.8.5</dependency.gson.version> | ||||
|         <dependency.httpclient.version>4.5.13</dependency.httpclient.version> | ||||
|         <dependency.httpcore.version>4.4.14</dependency.httpcore.version> | ||||
|         <dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version> | ||||
|         <dependency.xercesImpl.version>2.12.1</dependency.xercesImpl.version> | ||||
|         <dependency.slf4j.version>1.7.30</dependency.slf4j.version> | ||||
|         <dependency.slf4j.version>1.7.32</dependency.slf4j.version> | ||||
|         <dependency.gytheio.version>0.12</dependency.gytheio.version> | ||||
|         <dependency.groovy.version>2.5.9</dependency.groovy.version> | ||||
|         <dependency.groovy.version>3.0.9</dependency.groovy.version> | ||||
|         <dependency.tika.version>1.27</dependency.tika.version> | ||||
|         <dependency.spring-security.version>5.5.1</dependency.spring-security.version> | ||||
|         <dependency.spring-security.version>5.5.2</dependency.spring-security.version> | ||||
|         <dependency.truezip.version>7.7.10</dependency.truezip.version> | ||||
|         <dependency.poi.version>4.1.2</dependency.poi.version> | ||||
|         <dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version> | ||||
|         <dependency.keycloak.version>13.0.1</dependency.keycloak.version> | ||||
|         <dependency.keycloak.version>15.0.2</dependency.keycloak.version> | ||||
|         <dependency.jboss.logging.version>3.4.2.Final</dependency.jboss.logging.version> | ||||
|         <dependency.camel.version>3.7.4</dependency.camel.version> | ||||
|         <dependency.activemq.version>5.16.1</dependency.activemq.version> | ||||
| @@ -101,21 +100,22 @@ | ||||
|         <dependency.jakarta-jws-api.version>2.1.0</dependency.jakarta-jws-api.version> | ||||
|         <dependency.jakarta-mail-api.version>1.6.5</dependency.jakarta-mail-api.version> | ||||
|         <dependency.jakarta-json-api.version>1.1.6</dependency.jakarta-json-api.version> | ||||
|         <dependency.jakarta-json-path.version>2.5.0</dependency.jakarta-json-path.version> | ||||
|         <dependency.jakarta-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version> | ||||
|  | ||||
|         <alfresco.googledrive.version>3.2.1.3</alfresco.googledrive.version> | ||||
|         <alfresco.aos-module.version>1.4.0.1</alfresco.aos-module.version> | ||||
|         <alfresco.api-explorer.version>7.0.0</alfresco.api-explorer.version> | ||||
|         <alfresco.api-explorer.version>7.1.0.1</alfresco.api-explorer.version> <!-- Also in alfresco-enterprise-share --> | ||||
|         <alfresco.maven-plugin.version>2.2.0</alfresco.maven-plugin.version> | ||||
|  | ||||
|         <dependency.postgresql.version>42.2.20</dependency.postgresql.version> | ||||
|         <dependency.postgresql.version>42.2.24</dependency.postgresql.version> | ||||
|         <dependency.mysql.version>8.0.25</dependency.mysql.version> | ||||
|         <dependency.mysql-image.version>8</dependency.mysql-image.version> | ||||
|         <dependency.mariadb.version>2.7.2</dependency.mariadb.version> | ||||
|         <dependency.mariadb.version>2.7.4</dependency.mariadb.version> | ||||
|         <dependency.tas-utility.version>3.0.45</dependency.tas-utility.version> | ||||
|         <dependency.rest-assured.version>3.3.0</dependency.rest-assured.version> | ||||
|         <dependency.tas-restapi.version>1.63</dependency.tas-restapi.version> | ||||
|         <dependency.tas-cmis.version>1.30</dependency.tas-cmis.version> | ||||
|         <dependency.tas-restapi.version>1.64</dependency.tas-restapi.version> | ||||
|         <dependency.tas-cmis.version>1.31</dependency.tas-cmis.version> | ||||
|         <dependency.tas-email.version>1.8</dependency.tas-email.version> | ||||
|         <dependency.tas-webdav.version>1.6</dependency.tas-webdav.version> | ||||
|         <dependency.tas-ftp.version>1.5</dependency.tas-ftp.version> | ||||
| @@ -142,7 +142,7 @@ | ||||
|         <connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection> | ||||
|         <developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection> | ||||
|         <url>https://github.com/Alfresco/alfresco-community-repo</url> | ||||
|         <tag>11.112</tag> | ||||
|         <tag>HEAD</tag> | ||||
|     </scm> | ||||
|  | ||||
|     <distributionManagement> | ||||
| @@ -638,7 +638,7 @@ | ||||
|             <dependency> | ||||
|                 <groupId>org.jsoup</groupId> | ||||
|                 <artifactId>jsoup</artifactId> | ||||
|                 <version>1.13.1</version> | ||||
|                 <version>1.14.3</version> | ||||
|             </dependency> | ||||
|             <!-- upgrade dependency from TIKA --> | ||||
|             <dependency> | ||||
| @@ -711,7 +711,7 @@ | ||||
|             <dependency> | ||||
|                 <groupId>joda-time</groupId> | ||||
|                 <artifactId>joda-time</artifactId> | ||||
|                 <version>2.10.10</version> | ||||
|                 <version>2.10.12</version> | ||||
|             </dependency> | ||||
|  | ||||
|             <!-- provided dependencies --> | ||||
| @@ -733,11 +733,6 @@ | ||||
|                 <artifactId>gunit</artifactId> | ||||
|                 <version>${dependency.antlr.version}</version> | ||||
|             </dependency> | ||||
|             <dependency> | ||||
|                 <groupId>org.mockito</groupId> | ||||
|                 <artifactId>mockito-all</artifactId> | ||||
|                 <version>${dependency.mockito-all.version}</version> | ||||
|             </dependency> | ||||
|             <dependency> | ||||
|                 <groupId>org.mockito</groupId> | ||||
|                 <artifactId>mockito-core</artifactId> | ||||
| @@ -850,7 +845,7 @@ | ||||
|             <dependency> | ||||
|                 <groupId>org.projectlombok</groupId> | ||||
|                 <artifactId>lombok</artifactId> | ||||
|                 <version>1.18.20</version> | ||||
|                 <version>1.18.22</version> | ||||
|                 <scope>provided</scope> | ||||
|             </dependency> | ||||
|         </dependencies> | ||||
| @@ -870,7 +865,7 @@ | ||||
|                 <plugin> | ||||
|                     <groupId>io.fabric8</groupId> | ||||
|                     <artifactId>docker-maven-plugin</artifactId> | ||||
|                     <version>0.34.1</version> | ||||
|                     <version>0.37.0</version> | ||||
|                 </plugin> | ||||
|                 <plugin> | ||||
|                     <artifactId>maven-surefire-plugin</artifactId> | ||||
| @@ -886,12 +881,12 @@ | ||||
|                 </plugin> | ||||
|                 <plugin> | ||||
|                     <artifactId>maven-war-plugin</artifactId> | ||||
|                     <version>3.2.2</version> | ||||
|                     <version>3.3.2</version> | ||||
|                 </plugin> | ||||
|                 <plugin> | ||||
|                     <groupId>org.apache.maven.plugins</groupId> | ||||
|                     <artifactId>maven-javadoc-plugin</artifactId> | ||||
|                     <version>3.3.0</version> | ||||
|                     <version>3.3.1</version> | ||||
|                 </plugin> | ||||
|                 <plugin> | ||||
|                     <groupId>org.apache.maven.plugins</groupId> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <parent> | ||||
|         <groupId>org.alfresco</groupId> | ||||
|         <artifactId>alfresco-community-repo</artifactId> | ||||
|         <version>11.112</version> | ||||
|         <version>14.24-SNAPSHOT</version> | ||||
|     </parent> | ||||
|  | ||||
|     <dependencies> | ||||
| @@ -47,7 +47,7 @@ | ||||
|         <dependency> | ||||
|             <groupId>org.apache.santuario</groupId> | ||||
|             <artifactId>xmlsec</artifactId> | ||||
|             <version>1.5.8</version> | ||||
|             <version>2.2.3</version> | ||||
|         </dependency> | ||||
|         <!-- newer version, see REPO-3133 --> | ||||
|         <dependency> | ||||
|   | ||||
| @@ -27,17 +27,14 @@ package org.alfresco.opencmis; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.io.PrintWriter; | ||||
| import java.net.MalformedURLException; | ||||
| import java.net.URL; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import java.util.Enumeration; | ||||
| import java.util.EventListener; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
| import java.util.Locale; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
|  | ||||
| @@ -48,19 +45,17 @@ import javax.servlet.Servlet; | ||||
| import javax.servlet.ServletConfig; | ||||
| import javax.servlet.ServletContext; | ||||
| import javax.servlet.ServletException; | ||||
| import javax.servlet.ServletOutputStream; | ||||
| import javax.servlet.ServletRegistration; | ||||
| import javax.servlet.SessionCookieConfig; | ||||
| import javax.servlet.SessionTrackingMode; | ||||
| import javax.servlet.descriptor.JspConfigDescriptor; | ||||
| import javax.servlet.http.Cookie; | ||||
| import javax.servlet.http.HttpServlet; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | ||||
| import org.alfresco.error.AlfrescoRuntimeException; | ||||
| import org.alfresco.opencmis.CMISDispatcherRegistry.Binding; | ||||
| import org.alfresco.opencmis.CMISDispatcherRegistry.Endpoint; | ||||
| import org.alfresco.repo.tenant.TenantAdminService; | ||||
| import org.alfresco.rest.framework.core.exceptions.JsonpCallbackNotAllowedException; | ||||
| import org.alfresco.service.descriptor.Descriptor; | ||||
| import org.alfresco.service.descriptor.DescriptorService; | ||||
| import org.apache.chemistry.opencmis.commons.enums.CmisVersion; | ||||
| @@ -69,7 +64,6 @@ import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener; | ||||
| import org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet; | ||||
| import org.springframework.extensions.webscripts.WebScriptRequest; | ||||
| import org.springframework.extensions.webscripts.WebScriptResponse; | ||||
| import org.springframework.extensions.webscripts.servlet.WebScriptServletRuntime; | ||||
|  | ||||
| /** | ||||
|  * Dispatches OpenCMIS requests to a servlet e.g. the OpenCMIS AtomPub servlet. | ||||
| @@ -90,6 +84,8 @@ public abstract class CMISServletDispatcher implements CMISDispatcher | ||||
| 	protected CmisVersion cmisVersion; | ||||
| 	protected TenantAdminService tenantAdminService; | ||||
|  | ||||
| 	private boolean allowUnsecureCallbackJSONP; | ||||
|  | ||||
|     private Set<String> nonAttachContentTypes = Collections.emptySet(); // pre-configured whitelist, eg. images & pdf | ||||
|  | ||||
| 	public void setTenantAdminService(TenantAdminService tenantAdminService) | ||||
| @@ -151,7 +147,17 @@ public abstract class CMISServletDispatcher implements CMISDispatcher | ||||
|  | ||||
| 		return this.currentDescriptor; | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	public void setAllowUnsecureCallbackJSONP(boolean allowUnsecureCallbackJSONP) | ||||
| 	{ | ||||
| 		this.allowUnsecureCallbackJSONP = allowUnsecureCallbackJSONP; | ||||
| 	} | ||||
|  | ||||
| 	public boolean isAllowUnsecureCallbackJSONP() | ||||
| 	{ | ||||
| 		return allowUnsecureCallbackJSONP; | ||||
| 	} | ||||
|  | ||||
| 	public void init() | ||||
| 	{ | ||||
| 		Endpoint endpoint = new Endpoint(getBinding(), version); | ||||
| @@ -219,12 +225,22 @@ public abstract class CMISServletDispatcher implements CMISDispatcher | ||||
| 			CMISHttpServletResponse httpResWrapper = getHttpResponse(res); | ||||
| 	    	CMISHttpServletRequest httpReqWrapper = getHttpRequest(req); | ||||
|  | ||||
| 	    	servlet.service(httpReqWrapper, httpResWrapper); | ||||
| 			// check for "callback" query param | ||||
| 			if (!allowUnsecureCallbackJSONP && httpReqWrapper.getParameter("callback") != null) | ||||
| 			{ | ||||
| 				throw new JsonpCallbackNotAllowedException(); | ||||
| 			} | ||||
| 			servlet.service(httpReqWrapper, httpResWrapper); | ||||
| 		} | ||||
| 		catch(ServletException e) | ||||
| 		{ | ||||
| 			throw new AlfrescoRuntimeException("", e); | ||||
| 		} | ||||
| 		catch (JsonpCallbackNotAllowedException e) | ||||
| 		{ | ||||
| 			res.setStatus(403); | ||||
| 			res.getWriter().append(e.getMessage()); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2019 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
| @@ -30,6 +30,7 @@ import java.net.SocketException; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Objects; | ||||
| import java.util.function.Supplier; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| @@ -355,7 +356,10 @@ public class RepositoryContainer extends AbstractRuntimeContainer | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if ((required == RequiredAuthentication.user || required == RequiredAuthentication.admin) && isGuest) | ||||
|         // if the required authentication is not equal to guest, then it should be one of the following: | ||||
|         // user | sysadmin | admin (the 'none' authentication is handled above) | ||||
|         // in this case the guest user should not be able to execute those scripts. | ||||
|         if (required != RequiredAuthentication.guest && isGuest) | ||||
|         { | ||||
|             throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + desc.getId() + " requires user authentication; however, a guest has attempted access."); | ||||
|         } | ||||
| @@ -383,28 +387,9 @@ public class RepositoryContainer extends AbstractRuntimeContainer | ||||
|                 { | ||||
|                     return false; | ||||
|                 } | ||||
|                 // The user will now have been authenticated, based on HTTP Auth, Ticket etc | ||||
|                 // The user will now have been authenticated, based on HTTP Auth, Ticket, etc. | ||||
|                 // Check that the user they authenticated as has appropriate access to the script | ||||
|  | ||||
|                 // Check to see if they supplied HTTP Auth or Ticket as guest, on a script that needs more | ||||
|                 if (required == RequiredAuthentication.user || required == RequiredAuthentication.admin) | ||||
|                 { | ||||
|                     final String authenticatedUser = AuthenticationUtil.getFullyAuthenticatedUser(); | ||||
|                     final String runAsUser = AuthenticationUtil.getRunAsUser(); | ||||
|  | ||||
|                     if ( (authenticatedUser == null) || | ||||
|                          (authenticatedUser.equals(runAsUser) && authorityService.hasGuestAuthority()) || | ||||
|                          (!authenticatedUser.equals(runAsUser) && authorityService.isGuestAuthority(authenticatedUser)) ) | ||||
|                     { | ||||
|                         throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + desc.getId() + " requires user authentication; however, a guest has attempted access."); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 // Check to see if they're admin or system on an Admin only script | ||||
|                 if (required == RequiredAuthentication.admin && !(authorityService.hasAdminAuthority() || AuthenticationUtil.getFullyAuthenticatedUser().equals(AuthenticationUtil.getSystemUserName()))) | ||||
|                 { | ||||
|                     throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + desc.getId() + " requires admin authentication; however, a non-admin has attempted access."); | ||||
|                 } | ||||
|                 checkScriptAccess(required, desc.getId()); | ||||
|  | ||||
|                 if (debug) | ||||
|                 { | ||||
| @@ -424,7 +409,7 @@ public class RepositoryContainer extends AbstractRuntimeContainer | ||||
|  | ||||
|             // Execute Web Script if authentication passed | ||||
|             // The Web Script has its own txn management with potential runAs() user | ||||
|             transactionedExecuteAs(script, scriptReq, scriptRes); | ||||
|             transactionedExecuteAs(script, scriptReq, scriptRes, required); | ||||
|         } | ||||
|         finally | ||||
|         { | ||||
| @@ -441,6 +426,65 @@ public class RepositoryContainer extends AbstractRuntimeContainer | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private boolean isSystemUser() | ||||
|     { | ||||
|         return Objects.equals(AuthenticationUtil.getFullyAuthenticatedUser(), AuthenticationUtil.getSystemUserName()); | ||||
|     } | ||||
|  | ||||
|     private boolean isSysAdminUser() | ||||
|     { | ||||
|         return authorityService.hasSysAdminAuthority(); | ||||
|     } | ||||
|  | ||||
|     private boolean isAdmin() | ||||
|     { | ||||
|         return authorityService.hasAdminAuthority(); | ||||
|     } | ||||
|  | ||||
|     public final boolean isAdminOrSystemUser() | ||||
|     { | ||||
|         return isAdmin() || isSystemUser(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Check to see if they supplied HTTP Auth or Ticket as guest, on a script that needs more | ||||
|      */ | ||||
|     private void checkGuestAccess(RequiredAuthentication required, String scriptDescriptorId) | ||||
|     { | ||||
|         if (required == RequiredAuthentication.user || required == RequiredAuthentication.admin | ||||
|                     || required == RequiredAuthentication.sysadmin) | ||||
|         { | ||||
|             final String authenticatedUser = AuthenticationUtil.getFullyAuthenticatedUser(); | ||||
|             final String runAsUser = AuthenticationUtil.getRunAsUser(); | ||||
|  | ||||
|             if ((authenticatedUser == null) || (authenticatedUser.equals(runAsUser) | ||||
|                         && authorityService.hasGuestAuthority()) || (!authenticatedUser.equals(runAsUser) | ||||
|                         && authorityService.isGuestAuthority(authenticatedUser))) | ||||
|             { | ||||
|                 throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + scriptDescriptorId | ||||
|                             + " requires user authentication; however, a guest has attempted access."); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkScriptAccess(RequiredAuthentication required, String scriptDescriptorId) | ||||
|     { | ||||
|         // first, check guest access | ||||
|         checkGuestAccess(required, scriptDescriptorId); | ||||
|  | ||||
|         // Check to see if the user is sysAdmin, admin or system on a sysadmin scripts | ||||
|         if (required == RequiredAuthentication.sysadmin && !(isSysAdminUser() || isAdminOrSystemUser())) | ||||
|         { | ||||
|             throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + scriptDescriptorId | ||||
|                         + " requires system-admin authentication; however, a non-system-admin has attempted access."); | ||||
|         } | ||||
|         else if (required == RequiredAuthentication.admin && !isAdminOrSystemUser()) | ||||
|         { | ||||
|             throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + scriptDescriptorId | ||||
|                         + " requires admin authentication; however, a non-admin has attempted access."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Execute script within required level of transaction | ||||
|      *  | ||||
| @@ -626,6 +670,35 @@ public class RepositoryContainer extends AbstractRuntimeContainer | ||||
|             }, runAs); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Execute script within required level of transaction as required effective user. | ||||
|      * | ||||
|      * @param script    WebScript | ||||
|      * @param scriptReq WebScriptRequest | ||||
|      * @param scriptRes WebScriptResponse | ||||
|      * @param requiredAuthentication Required authentication | ||||
|      * @throws IOException | ||||
|      */ | ||||
|     private void transactionedExecuteAs(final WebScript script, final WebScriptRequest scriptReq, | ||||
|                                         final WebScriptResponse scriptRes, RequiredAuthentication requiredAuthentication) throws IOException | ||||
|     { | ||||
|         // Execute as System if and only if, the current user is a member of System-Admin group, and he is not a super admin. | ||||
|         // E.g. if 'jdoe' is a member of ALFRESCO_SYSTEM_ADMINISTRATORS group, then the work should be executed as System to satisfy the ACL checks. | ||||
|         // But, if the current user is Admin (i.e. super admin, which by default he is a member fo the ALFRESCO_SYSTEM_ADMINISTRATORS group) | ||||
|         // then don't wrap the work as RunAs, since he can do anything! | ||||
|         if (requiredAuthentication == RequiredAuthentication.sysadmin && isSysAdminUser() && !isAdmin()) | ||||
|         { | ||||
|             AuthenticationUtil.runAs(() -> { | ||||
|                 transactionedExecute(script, scriptReq, scriptRes); | ||||
|                 return null; | ||||
|             }, AuthenticationUtil.SYSTEM_USER_NAME); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             transactionedExecuteAs(script, scriptReq, scriptRes); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     /* (non-Javadoc) | ||||
|      * @see org.alfresco.web.scripts.AbstractRuntimeContainer#onApplicationEvent(org.springframework.context.ApplicationEvent) | ||||
|   | ||||
| @@ -30,8 +30,19 @@ import java.net.InetAddress; | ||||
| import java.net.UnknownHostException; | ||||
| import java.util.Arrays; | ||||
| import java.util.Date; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| import java.util.Objects; | ||||
| import java.util.OptionalInt; | ||||
| import java.util.function.Function; | ||||
| import java.util.function.Supplier; | ||||
|  | ||||
| import com.google.common.primitives.Ints; | ||||
|  | ||||
| import org.alfresco.repo.bulkimport.BulkFilesystemImporter; | ||||
| import org.alfresco.repo.bulkimport.BulkImportParameters; | ||||
| import org.alfresco.repo.bulkimport.NodeImporter; | ||||
| import org.alfresco.repo.bulkimport.impl.MultiThreadedBulkFilesystemImporter; | ||||
| import org.alfresco.repo.model.Repository; | ||||
| import org.alfresco.service.cmr.model.FileFolderService; | ||||
| import org.alfresco.service.cmr.model.FileInfo; | ||||
| @@ -39,8 +50,12 @@ import org.alfresco.service.cmr.model.FileNotFoundException; | ||||
| 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; | ||||
| 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; | ||||
|  | ||||
| /** | ||||
|  * contains common fields and methods for the import web scripts. | ||||
| @@ -60,10 +75,10 @@ public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript | ||||
|     // Web scripts parameters (common) | ||||
| 	protected static final String PARAMETER_REPLACE_EXISTING        = "replaceExisting"; | ||||
| 	protected static final String PARAMETER_EXISTING_FILE_MODE      = "existingFileMode"; | ||||
| 	protected static final String PARAMETER_VALUE_REPLACE_EXISTING 	= "replaceExisting"; | ||||
| 	protected static final String PARAMETER_VALUE_REPLACE_EXISTING 	= "true"; | ||||
| 	protected static final String PARAMETER_SOURCE_DIRECTORY       	= "sourceDirectory"; | ||||
| 	protected static final String PARAMETER_DISABLE_RULES		    = "disableRules"; | ||||
| 	protected static final String PARAMETER_VALUE_DISABLE_RULES		= "disableRules"; | ||||
| 	protected static final String PARAMETER_VALUE_DISABLE_RULES		= "true"; | ||||
|  | ||||
| 	protected static final String IMPORT_ALREADY_IN_PROGRESS_MODEL_KEY = "importInProgress"; | ||||
| 	protected static final String IMPORT_ALREADY_IN_PROGRESS_ERROR_KEY ="bfsit.error.importAlreadyInProgress"; | ||||
| @@ -75,7 +90,7 @@ public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript | ||||
| 	protected Repository repository; | ||||
| 	    | ||||
| 	protected volatile boolean importInProgress; | ||||
|      | ||||
|  | ||||
| 	protected NodeRef getTargetNodeRef(String targetNodeRefStr, String targetPath) throws FileNotFoundException | ||||
| 	{ | ||||
| 		NodeRef targetNodeRef; | ||||
| @@ -219,4 +234,198 @@ public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript | ||||
| 		this.repository = repository; | ||||
| 	} | ||||
|  | ||||
| 	protected class MultithreadedImportWebScriptLogic | ||||
| 	{ | ||||
| 		private final MultiThreadedBulkFilesystemImporter bulkImporter; | ||||
| 		private final Supplier<NodeImporter> nodeImporterFactory; | ||||
| 		private final WebScriptRequest request; | ||||
| 		private final Status status; | ||||
| 		private final Cache cache; | ||||
|  | ||||
| 		public MultithreadedImportWebScriptLogic(MultiThreadedBulkFilesystemImporter bulkImporter, Supplier<NodeImporter> nodeImporterFactory, WebScriptRequest request, Status status, Cache cache) | ||||
| 		{ | ||||
| 			this.bulkImporter = Objects.requireNonNull(bulkImporter); | ||||
| 			this.nodeImporterFactory = Objects.requireNonNull(nodeImporterFactory); | ||||
| 			this.request = Objects.requireNonNull(request); | ||||
| 			this.status = Objects.requireNonNull(status); | ||||
| 			this.cache = Objects.requireNonNull(cache); | ||||
| 		} | ||||
|  | ||||
| 		public Map<String, Object> executeImport() | ||||
| 		{ | ||||
| 			Map<String, Object> model  = new HashMap<>(); | ||||
| 			cache.setNeverCache(true); | ||||
| 			String targetPath = null; | ||||
|  | ||||
| 			try | ||||
| 			{ | ||||
| 				targetPath = request.getParameter(PARAMETER_TARGET_PATH); | ||||
| 				if (isRunning()) | ||||
| 				{ | ||||
| 					model.put(IMPORT_ALREADY_IN_PROGRESS_MODEL_KEY, I18NUtil.getMessage(IMPORT_ALREADY_IN_PROGRESS_ERROR_KEY)); | ||||
| 					return model; | ||||
| 				} | ||||
|  | ||||
| 				final BulkImportParameters bulkImportParameters = getBulkImportParameters(); | ||||
| 				final NodeImporter nodeImporter = nodeImporterFactory.get(); | ||||
|  | ||||
| 				bulkImporter.asyncBulkImport(bulkImportParameters, nodeImporter); | ||||
|  | ||||
| 				waitForImportToBegin(); | ||||
|  | ||||
| 				// redirect to the status Web Script | ||||
| 				status.setCode(Status.STATUS_MOVED_TEMPORARILY); | ||||
| 				status.setRedirect(true); | ||||
| 				status.setLocation(request.getServiceContextPath() + WEB_SCRIPT_URI_BULK_FILESYSTEM_IMPORT_STATUS); | ||||
| 			} | ||||
| 			catch (WebScriptException | IllegalArgumentException e) | ||||
| 			{ | ||||
| 				status.setCode(Status.STATUS_BAD_REQUEST, e.getMessage()); | ||||
| 				status.setRedirect(true); | ||||
| 			} | ||||
| 			catch (FileNotFoundException fnfe) | ||||
| 			{ | ||||
| 				status.setCode(Status.STATUS_BAD_REQUEST,"The repository path '" + targetPath + "' does not exist !"); | ||||
| 				status.setRedirect(true); | ||||
| 			} | ||||
| 			catch (Throwable t) | ||||
| 			{ | ||||
| 				throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, buildTextMessage(t), t); | ||||
| 			} | ||||
|  | ||||
| 			return model; | ||||
| 		} | ||||
|  | ||||
| 		private void waitForImportToBegin() throws InterruptedException | ||||
| 		{ | ||||
| 			// ACE-3047 fix, since bulk import is started asynchronously there is a chance that client | ||||
| 			// will get into the status page before import is actually started. | ||||
| 			// In this case wrong information (for previous import) will be displayed. | ||||
| 			// So lets ensure that import started before redirecting client to status page. | ||||
| 			int i = 0; | ||||
| 			while (!bulkImporter.getStatus().inProgress() && i < 10) | ||||
| 			{ | ||||
| 				Thread.sleep(100); | ||||
| 				i++; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		private BulkImportParameters getBulkImportParameters() throws FileNotFoundException | ||||
| 		{ | ||||
| 			final BulkImportParametersExtractor extractor = new BulkImportParametersExtractor(request::getParameter, | ||||
| 					AbstractBulkFileSystemImportWebScript.this::getTargetNodeRef, | ||||
| 					bulkImporter.getDefaultBatchSize(), | ||||
| 					bulkImporter.getDefaultNumThreads()); | ||||
| 			return extractor.extract(); | ||||
| 		} | ||||
|  | ||||
| 		private boolean isRunning() | ||||
| 		{ | ||||
| 			return bulkImporter.getStatus().inProgress(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	protected static class BulkImportParametersExtractor | ||||
| 	{ | ||||
| 		private final Function<String, String> paramsProvider; | ||||
| 		private final NodeRefCreator nodeRefCreator; | ||||
| 		private final int defaultBatchSize; | ||||
| 		private final int defaultNumThreads; | ||||
|  | ||||
| 		public BulkImportParametersExtractor(final Function<String, String> paramsProvider, final NodeRefCreator nodeRefCreator, | ||||
| 											 final int defaultBatchSize, final int defaultNumThreads) | ||||
| 		{ | ||||
| 			this.paramsProvider = Objects.requireNonNull(paramsProvider); | ||||
| 			this.nodeRefCreator = Objects.requireNonNull(nodeRefCreator); | ||||
| 			this.defaultBatchSize = defaultBatchSize; | ||||
| 			this.defaultNumThreads = defaultNumThreads; | ||||
| 		} | ||||
|  | ||||
| 		public BulkImportParameters extract() throws FileNotFoundException | ||||
| 		{ | ||||
| 			BulkImportParameters result = new BulkImportParameters(); | ||||
|  | ||||
| 			result.setTarget(getTargetNodeRef()); | ||||
| 			setExistingFileMode(result); | ||||
| 			result.setNumThreads(getOptionalPositiveInteger(PARAMETER_NUM_THREADS).orElse(defaultNumThreads)); | ||||
| 			result.setBatchSize(getOptionalPositiveInteger(PARAMETER_BATCH_SIZE).orElse(defaultBatchSize)); | ||||
| 			setDisableRules(result); | ||||
|  | ||||
| 			return result; | ||||
| 		} | ||||
|  | ||||
| 		private void setExistingFileMode(BulkImportParameters params) | ||||
| 		{ | ||||
| 			String replaceExistingStr = getParamStringValue(PARAMETER_REPLACE_EXISTING); | ||||
| 			String existingFileModeStr = getParamStringValue(PARAMETER_EXISTING_FILE_MODE); | ||||
|  | ||||
| 			if (!isNullOrEmpty(replaceExistingStr) && !isNullOrEmpty(existingFileModeStr)) | ||||
| 			{ | ||||
| 				// Check that we haven't had both the deprecated and new (existingFileMode) | ||||
| 				// parameters supplied. | ||||
| 				throw new IllegalStateException( | ||||
| 						String.format("Only one of these parameters may be used, not both: %s, %s", | ||||
| 								PARAMETER_REPLACE_EXISTING, | ||||
| 								PARAMETER_EXISTING_FILE_MODE)); | ||||
| 			} | ||||
|  | ||||
| 			if (!isNullOrEmpty(existingFileModeStr)) | ||||
| 			{ | ||||
| 				params.setExistingFileMode(BulkImportParameters.ExistingFileMode.valueOf(existingFileModeStr)); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				params.setReplaceExisting(PARAMETER_VALUE_REPLACE_EXISTING.equals(replaceExistingStr)); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		private void setDisableRules(final BulkImportParameters params) | ||||
| 		{ | ||||
| 			final String disableRulesStr = getParamStringValue(PARAMETER_DISABLE_RULES); | ||||
| 			params.setDisableRulesService(!isNullOrEmpty(disableRulesStr) && PARAMETER_VALUE_DISABLE_RULES.equals(disableRulesStr)); | ||||
| 		} | ||||
|  | ||||
| 		private NodeRef getTargetNodeRef() throws FileNotFoundException | ||||
| 		{ | ||||
| 			String targetNodeRefStr = getParamStringValue(PARAMETER_TARGET_NODEREF); | ||||
| 			String targetPath = getParamStringValue(PARAMETER_TARGET_PATH); | ||||
| 			return nodeRefCreator.fromNodeRefAndPath(targetNodeRefStr, targetPath); | ||||
| 		} | ||||
|  | ||||
| 		private OptionalInt getOptionalPositiveInteger(final String paramName) | ||||
| 		{ | ||||
| 			final String strValue = getParamStringValue(paramName); | ||||
| 			if (isNullOrEmpty(strValue)) | ||||
| 			{ | ||||
| 				return OptionalInt.empty(); | ||||
| 			} | ||||
|  | ||||
| 			final Integer asInt = Ints.tryParse(strValue); | ||||
| 			if (asInt == null || asInt < 1) | ||||
| 			{ | ||||
| 				throw new WebScriptException("Error: parameter '" + paramName + "' must be an integer > 0."); | ||||
| 			} | ||||
|  | ||||
| 			return OptionalInt.of(asInt); | ||||
| 		} | ||||
|  | ||||
| 		private String getParamStringValue(String paramName) | ||||
| 		{ | ||||
| 			Objects.requireNonNull(paramName); | ||||
|  | ||||
| 			return paramsProvider.apply(paramName); | ||||
| 		} | ||||
|  | ||||
| 		private boolean isNullOrEmpty(String str) | ||||
| 		{ | ||||
| 			return str == null || str.trim().length() == 0; | ||||
| 		} | ||||
|  | ||||
| 		@FunctionalInterface | ||||
| 		protected interface NodeRefCreator | ||||
| 		{ | ||||
| 			NodeRef fromNodeRefAndPath(String nodeRef, String path) throws FileNotFoundException; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| } | ||||
| @@ -27,17 +27,12 @@ | ||||
| package org.alfresco.repo.web.scripts.bulkimport.copy; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
|  | ||||
| import org.alfresco.repo.bulkimport.BulkImportParameters; | ||||
| import org.alfresco.repo.bulkimport.NodeImporter; | ||||
| import org.alfresco.repo.bulkimport.impl.MultiThreadedBulkFilesystemImporter; | ||||
| import org.alfresco.repo.bulkimport.impl.StreamingNodeImporterFactory; | ||||
| import org.alfresco.repo.web.scripts.bulkimport.AbstractBulkFileSystemImportWebScript; | ||||
| import org.alfresco.service.cmr.model.FileNotFoundException; | ||||
| import org.alfresco.service.cmr.repository.NodeRef; | ||||
| import org.springframework.extensions.surf.util.I18NUtil; | ||||
| import org.springframework.extensions.webscripts.Cache; | ||||
| import org.springframework.extensions.webscripts.Status; | ||||
| import org.springframework.extensions.webscripts.WebScriptException; | ||||
| @@ -69,170 +64,22 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW | ||||
|     @Override | ||||
|     protected Map<String, Object> executeImpl(final WebScriptRequest request, final Status status, final Cache cache) | ||||
|     { | ||||
|         Map<String, Object> model  = new HashMap<String, Object>(); | ||||
|         String targetNodeRefStr = null; | ||||
|         String targetPath = null; | ||||
|         String sourceDirectoryStr = null; | ||||
|         @Deprecated String replaceExistingStr = null; | ||||
|         String existingFileModeStr = null; | ||||
|         String batchSizeStr = null; | ||||
|         String numThreadsStr = null; | ||||
|         String disableRulesStr = null; | ||||
|         final MultithreadedImportWebScriptLogic importLogic = new MultithreadedImportWebScriptLogic(bulkImporter, | ||||
|                 () -> createNodeImporter(request), request, status, cache); | ||||
|         return importLogic.executeImport(); | ||||
|     } | ||||
|  | ||||
|         cache.setNeverCache(true); | ||||
|          | ||||
|         try | ||||
|     private NodeImporter createNodeImporter(WebScriptRequest request) | ||||
|     { | ||||
|         final String sourceDirectoryStr = request.getParameter(PARAMETER_SOURCE_DIRECTORY); | ||||
|         if (sourceDirectoryStr == null || sourceDirectoryStr.trim().length() == 0) | ||||
|         { | ||||
|             if(!bulkImporter.getStatus().inProgress()) | ||||
|             { | ||||
|                 NodeRef targetNodeRef = null; | ||||
|                 File sourceDirectory = null; | ||||
|                 boolean replaceExisting = false; | ||||
|                 BulkImportParameters.ExistingFileMode existingFileMode = null; | ||||
|                 int batchSize = bulkImporter.getDefaultBatchSize(); | ||||
|                 int numThreads = bulkImporter.getDefaultNumThreads(); | ||||
|                 boolean disableRules = false; | ||||
|                  | ||||
|                 // Retrieve, validate and convert parameters | ||||
|                 targetNodeRefStr = request.getParameter(PARAMETER_TARGET_NODEREF); | ||||
|                 targetPath = request.getParameter(PARAMETER_TARGET_PATH); | ||||
|                 sourceDirectoryStr = request.getParameter(PARAMETER_SOURCE_DIRECTORY); | ||||
|                 replaceExistingStr = request.getParameter(PARAMETER_REPLACE_EXISTING); | ||||
|                 existingFileModeStr = request.getParameter(PARAMETER_EXISTING_FILE_MODE); | ||||
|  | ||||
|                 batchSizeStr = request.getParameter(PARAMETER_BATCH_SIZE); | ||||
|                 numThreadsStr = request.getParameter(PARAMETER_NUM_THREADS); | ||||
|                 disableRulesStr = request.getParameter(PARAMETER_DISABLE_RULES); | ||||
|  | ||||
|                 targetNodeRef = getTargetNodeRef(targetNodeRefStr, targetPath); | ||||
|                  | ||||
|                 if (sourceDirectoryStr == null || sourceDirectoryStr.trim().length() == 0) | ||||
|                 { | ||||
|                     throw new RuntimeException("Error: mandatory parameter '" + PARAMETER_SOURCE_DIRECTORY + "' was not provided."); | ||||
|                 } | ||||
|                  | ||||
|                 sourceDirectory = new File(sourceDirectoryStr.trim()); | ||||
|  | ||||
|                 if (replaceExistingStr != null && existingFileModeStr != null) | ||||
|                 { | ||||
|                     // Check that we haven't had both the deprecated and new (existingFileMode) | ||||
|                     // parameters supplied. | ||||
|                     throw new IllegalStateException( | ||||
|                             String.format("Only one of these parameters may be used, not both: %s, %s", | ||||
|                                     PARAMETER_REPLACE_EXISTING, | ||||
|                                     PARAMETER_EXISTING_FILE_MODE)); | ||||
|                 } | ||||
|  | ||||
|                 if (replaceExistingStr != null && replaceExistingStr.trim().length() > 0) | ||||
|                 { | ||||
|                     replaceExisting = PARAMETER_VALUE_REPLACE_EXISTING.equals(replaceExistingStr); | ||||
|                 } | ||||
|  | ||||
|                 if (existingFileModeStr != null && existingFileModeStr.trim().length() > 0) | ||||
|                 { | ||||
|                     existingFileMode = BulkImportParameters.ExistingFileMode.valueOf(existingFileModeStr); | ||||
|                 } | ||||
|  | ||||
|                 if (disableRulesStr != null && disableRulesStr.trim().length() > 0) | ||||
|                 { | ||||
|                     disableRules = PARAMETER_VALUE_DISABLE_RULES.equals(disableRulesStr); | ||||
|                 } | ||||
|  | ||||
|                 // Initiate the import | ||||
|                 NodeImporter nodeImporter = nodeImporterFactory.getNodeImporter(sourceDirectory); | ||||
|                 BulkImportParameters bulkImportParameters = new BulkImportParameters(); | ||||
|                  | ||||
|                 if (numThreadsStr != null && numThreadsStr.trim().length() > 0) | ||||
|                 { | ||||
|                 	try | ||||
|                 	{ | ||||
|                 		numThreads = Integer.parseInt(numThreadsStr); | ||||
|                 		if(numThreads < 1) | ||||
|                 		{ | ||||
|                             throw new RuntimeException("Error: parameter '" + PARAMETER_NUM_THREADS + "' must be an integer > 0."); | ||||
|                 		} | ||||
|                         bulkImportParameters.setNumThreads(numThreads); | ||||
|                 	} | ||||
|                 	catch(NumberFormatException e) | ||||
|                 	{ | ||||
|                         throw new RuntimeException("Error: parameter '" + PARAMETER_NUM_THREADS + "' must be an integer > 0."); | ||||
|                 	} | ||||
|                 } | ||||
|                  | ||||
|                 if (batchSizeStr != null && batchSizeStr.trim().length() > 0) | ||||
|                 { | ||||
|                 	try | ||||
|                 	{ | ||||
|                 		batchSize = Integer.parseInt(batchSizeStr); | ||||
|                 		if(batchSize < 1) | ||||
|                 		{ | ||||
|                             throw new RuntimeException("Error: parameter '" + PARAMETER_BATCH_SIZE + "' must be an integer > 0."); | ||||
|                 		} | ||||
|                         bulkImportParameters.setBatchSize(batchSize); | ||||
|                 	} | ||||
|                 	catch(NumberFormatException e) | ||||
|                 	{ | ||||
|                         throw new RuntimeException("Error: parameter '" + PARAMETER_BATCH_SIZE + "' must be an integer > 0."); | ||||
|                 	} | ||||
|                 } | ||||
|  | ||||
|                 if (existingFileMode != null) | ||||
|                 { | ||||
|                     bulkImportParameters.setExistingFileMode(existingFileMode); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     // Fall back to the old/deprecated way. | ||||
|                     bulkImportParameters.setReplaceExisting(replaceExisting); | ||||
|                 } | ||||
|  | ||||
|                 bulkImportParameters.setTarget(targetNodeRef); | ||||
|                 bulkImportParameters.setDisableRulesService(disableRules); | ||||
|  | ||||
|                 bulkImporter.asyncBulkImport(bulkImportParameters, nodeImporter); | ||||
|  | ||||
|                 // ACE-3047 fix, since bulk import is started asynchronously there is a chance that client  | ||||
|                 // will get into the status page before import is actually started. | ||||
|                 // In this case wrong information (for previous import) will be displayed. | ||||
|                 // So lets ensure that import started before redirecting client to status page. | ||||
|                 int i = 0; | ||||
|                 while (!bulkImporter.getStatus().inProgress() && i < 10) | ||||
|                 { | ||||
|                 	Thread.sleep(100); | ||||
|                 	i++; | ||||
|                 } | ||||
|                  | ||||
|                 // redirect to the status Web Script | ||||
|                 status.setCode(Status.STATUS_MOVED_TEMPORARILY); | ||||
|                 status.setRedirect(true); | ||||
|                 status.setLocation(request.getServiceContextPath() + WEB_SCRIPT_URI_BULK_FILESYSTEM_IMPORT_STATUS); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|             	model.put(IMPORT_ALREADY_IN_PROGRESS_MODEL_KEY, I18NUtil.getMessage(IMPORT_ALREADY_IN_PROGRESS_ERROR_KEY)); | ||||
|             } | ||||
|             throw new WebScriptException("Error: mandatory parameter '" + PARAMETER_SOURCE_DIRECTORY + "' was not provided."); | ||||
|         } | ||||
|         catch (WebScriptException wse) | ||||
|         { | ||||
|         	status.setCode(Status.STATUS_BAD_REQUEST, wse.getMessage()); | ||||
|         	status.setRedirect(true); | ||||
|         } | ||||
|         catch (FileNotFoundException fnfe) | ||||
|         { | ||||
|         	status.setCode(Status.STATUS_BAD_REQUEST,"The repository path '" + targetPath + "' does not exist !"); | ||||
|         	status.setRedirect(true); | ||||
|         } | ||||
|         catch(IllegalArgumentException iae) | ||||
|         { | ||||
|         	status.setCode(Status.STATUS_BAD_REQUEST,iae.getMessage()); | ||||
|         	status.setRedirect(true); | ||||
|         } | ||||
|         catch (Throwable t) | ||||
|         { | ||||
|             throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, buildTextMessage(t), t); | ||||
|         } | ||||
|          | ||||
|         return model; | ||||
|  | ||||
|         final File sourceDirectory = new File(sourceDirectoryStr.trim()); | ||||
|  | ||||
|         return nodeImporterFactory.getNodeImporter(sourceDirectory); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,28 +1,28 @@ | ||||
| /* | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * 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 <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
| /* | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * 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 <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
| package org.alfresco.repo.web.scripts.quickshare; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| @@ -31,10 +31,12 @@ import java.util.Map; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | ||||
| import org.alfresco.model.QuickShareModel; | ||||
| import org.alfresco.repo.tenant.TenantUtil; | ||||
| import org.alfresco.service.cmr.quickshare.InvalidSharedIdException; | ||||
| import org.alfresco.service.cmr.repository.InvalidNodeRefException; | ||||
| import org.alfresco.service.cmr.repository.NodeRef; | ||||
| import org.alfresco.service.cmr.repository.NodeService; | ||||
| import org.alfresco.util.Pair; | ||||
| import org.apache.commons.logging.Log; | ||||
| import org.apache.commons.logging.LogFactory; | ||||
| import org.springframework.extensions.webscripts.Cache; | ||||
| @@ -82,14 +84,15 @@ public class UnshareContentDelete extends AbstractQuickShareContent | ||||
|  | ||||
|         try | ||||
|         { | ||||
|             NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond(); | ||||
|             Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId); | ||||
|             String networkTenantDomain = pair.getFirst(); | ||||
|  | ||||
|             String sharedBy = (String) nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY); | ||||
|             if (!quickShareService.canDeleteSharedLink(nodeRef, sharedBy)) | ||||
|             TenantUtil.runAsSystemTenant(() -> | ||||
|             { | ||||
|                 throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Can't perform unshare action: " + sharedId); | ||||
|             } | ||||
|             quickShareService.unshareContent(sharedId); | ||||
|                 checkIfCanDeleteSharedLink(sharedId); | ||||
|                 quickShareService.unshareContent(sharedId); | ||||
|                 return null; | ||||
|             }, networkTenantDomain); | ||||
|  | ||||
|             Map<String, Object> model = new HashMap<>(1); | ||||
|             model.put("success", Boolean.TRUE); | ||||
| @@ -106,4 +109,14 @@ public class UnshareContentDelete extends AbstractQuickShareContent | ||||
|             throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find: " + sharedId); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkIfCanDeleteSharedLink(String sharedId) { | ||||
|         NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond(); | ||||
|  | ||||
|         String sharedBy = (String) nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY); | ||||
|         if (!quickShareService.canDeleteSharedLink(nodeRef, sharedBy)) | ||||
|         { | ||||
|             throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Can't perform unshare action: " + sharedId); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2016 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
| @@ -34,6 +34,7 @@ import org.alfresco.rest.api.model.UserInfo; | ||||
| import org.alfresco.rest.framework.resource.content.BinaryResource; | ||||
| import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; | ||||
| import org.alfresco.rest.framework.resource.parameters.Parameters; | ||||
| import org.alfresco.service.cmr.repository.DirectAccessUrl; | ||||
|  | ||||
| /** | ||||
|  * Handles trashcan / deleted nodes | ||||
| @@ -99,4 +100,29 @@ public interface DeletedNodes | ||||
|      * @return | ||||
|      */ | ||||
|     CollectionWithPagingInfo<Rendition> getRenditions(String archivedId, Parameters parameters); | ||||
|  | ||||
|     /** | ||||
|     * Gets a presigned URL to directly access content. | ||||
|      * | ||||
|     * @param archivedId The node id for which to obtain the direct access {@code URL} | ||||
|     * @param renditionId The rendition id for which to obtain the direct access {@code URL} | ||||
|     * @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}, {@code true} by default. | ||||
|     * @return A direct access {@code URL} object for the content. | ||||
|     */ | ||||
|     default DirectAccessUrl requestContentDirectUrl(String archivedId, String renditionId, boolean attachment) | ||||
|     { | ||||
|         return requestContentDirectUrl(archivedId, renditionId, attachment, null); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets a presigned URL to directly access content. | ||||
|      * | ||||
|      * @param archivedId The node id for which to obtain the direct access {@code URL} | ||||
|      * @param renditionId The rendition id for which to obtain the direct access {@code URL} | ||||
|      * @param attachment {@code true} if an attachment {@code URL} is requested, {@code false} for an embedded {@code URL}, {@code true} by default. | ||||
|      * @param validFor The time at which the direct access {@code URL} will expire. | ||||
|      * @return A direct access {@code URL} object for the content. | ||||
|      */ | ||||
|     DirectAccessUrl requestContentDirectUrl(String archivedId, String renditionId, boolean attachment, Long validFor); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2016 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
| @@ -55,6 +55,7 @@ import org.alfresco.rest.framework.resource.content.BinaryResource; | ||||
| import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; | ||||
| import org.alfresco.rest.framework.resource.parameters.Parameters; | ||||
| import org.alfresco.rest.framework.tools.RecognizedParamsExtractor; | ||||
| import org.alfresco.service.cmr.repository.DirectAccessUrl; | ||||
| import org.alfresco.service.cmr.repository.NodeRef; | ||||
| import org.alfresco.service.cmr.repository.NodeService; | ||||
| import org.alfresco.service.cmr.repository.StoreRef; | ||||
| @@ -244,4 +245,23 @@ public class DeletedNodesImpl implements DeletedNodes, RecognizedParamsExtractor | ||||
|         NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, archivedId); | ||||
|         return renditions.getRenditions(nodeRef, parameters); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritDoc} | ||||
|      */ | ||||
|     @Override | ||||
|     public DirectAccessUrl requestContentDirectUrl(String originalNodeId, String renditionId, boolean attachment, Long validFor) | ||||
|     { | ||||
|         //First check the node is valid and has been archived. | ||||
|         NodeRef validatedNodeRef = nodes.validateNode(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, originalNodeId); | ||||
|  | ||||
|         if (renditionId != null) | ||||
|         { | ||||
|             return renditions.requestContentDirectUrl(validatedNodeRef, null, renditionId, attachment, validFor); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             return nodes.requestContentDirectUrl(validatedNodeRef, attachment, validFor); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -274,15 +274,15 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt | ||||
|  | ||||
|         try | ||||
|         { | ||||
|             NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond(); | ||||
|             Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId); | ||||
|             String networkTenantDomain = pair.getFirst(); | ||||
|  | ||||
|             String sharedByUserId = (String)nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY); | ||||
|             if (!quickShareService.canDeleteSharedLink(nodeRef, sharedByUserId)) | ||||
|             TenantUtil.runAsSystemTenant(() -> | ||||
|             { | ||||
|                 throw new PermissionDeniedException("Can't perform unshare action: " + sharedId); | ||||
|             } | ||||
|  | ||||
|             quickShareService.unshareContent(sharedId); | ||||
|                 checkIfCanDeleteSharedLink(sharedId); | ||||
|                 quickShareService.unshareContent(sharedId); | ||||
|                 return null; | ||||
|             }, networkTenantDomain); | ||||
|         } | ||||
|         catch (InvalidSharedIdException ex) | ||||
|         { | ||||
| @@ -698,4 +698,14 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt | ||||
|             throw new InvalidArgumentException("A valid recipientEmail must be specified."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void checkIfCanDeleteSharedLink(String sharedId) { | ||||
|         NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond(); | ||||
|  | ||||
|         String sharedByUserId = (String)nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDBY); | ||||
|         if (!quickShareService.canDeleteSharedLink(nodeRef, sharedByUserId)) | ||||
|         { | ||||
|             throw new PermissionDeniedException("Can't perform unshare action: " + sharedId); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -63,6 +63,7 @@ public class RestApiDirectUrlConfig extends AbstractDirectUrlConfig | ||||
|             logger.error("Disabling REST API direct access URLs due to configuration error: " + ex.getMessage()); | ||||
|             setEnabled(false); | ||||
|         } | ||||
|         logger.info("REST API direct access URLs are " + (isEnabled() ? "enabled" : "disabled")); | ||||
|     } | ||||
|  | ||||
|     /* Helper method to validate the REST API direct access url configuration settings */ | ||||
|   | ||||
| @@ -119,8 +119,8 @@ public class NodeRenditionsRelation implements RelationshipResourceAction.Read<R | ||||
|         return renditions.getContent(nodeRef, renditionId, parameters); | ||||
|     } | ||||
|  | ||||
|     @Operation ("requestRenditionDirectAccessUrl") | ||||
|     @WebApiParam (name = "requestRenditionDirectAccessUrl", title = "Request direct access url", description = "Request direct access url", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @Operation("request-direct-access-url") | ||||
|     @WebApiParam (name = "directAccessUrlRequest", title = "Request direct access url", description = "Options for direct access url request", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @WebApiDescription(title = "Request content url", | ||||
|             description="Generates a direct access URL.", | ||||
|             successStatus = HttpServletResponse.SC_OK) | ||||
|   | ||||
| @@ -26,28 +26,18 @@ | ||||
|  | ||||
| package org.alfresco.rest.api.nodes; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | ||||
|  | ||||
| import org.alfresco.repo.content.directurl.DirectAccessUrlDisabledException; | ||||
| import org.alfresco.rest.api.DirectAccessUrlHelper; | ||||
| import org.alfresco.rest.api.Renditions; | ||||
| import org.alfresco.rest.api.model.DirectAccessUrlRequest; | ||||
| import org.alfresco.rest.api.model.Rendition; | ||||
| 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.ResourceParameter; | ||||
| import org.alfresco.rest.framework.core.exceptions.DisabledServiceException; | ||||
| import org.alfresco.rest.framework.resource.RelationshipResource; | ||||
| import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; | ||||
| import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceBinaryAction; | ||||
| import org.alfresco.rest.framework.resource.content.BinaryResource; | ||||
| 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.service.cmr.repository.DirectAccessUrl; | ||||
| import org.alfresco.service.cmr.repository.NodeRef; | ||||
| import org.alfresco.service.cmr.repository.StoreRef; | ||||
| import org.alfresco.util.PropertyCheck; | ||||
| @@ -62,7 +52,6 @@ import org.springframework.extensions.webscripts.Status; | ||||
|  * - POST /nodes/{nodeId}/versions/{versionId}/renditions | ||||
|  * - GET  /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId} | ||||
|  * - GET  /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content | ||||
|  * - POST /nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/requestVersionDirectAccessUrl | ||||
|  * | ||||
|  * @author janv | ||||
|  */ | ||||
| @@ -74,18 +63,12 @@ public class NodeVersionRenditionsRelation implements RelationshipResourceAction | ||||
|         InitializingBean | ||||
| { | ||||
|     private Renditions renditions; | ||||
|     private DirectAccessUrlHelper directAccessUrlHelper; | ||||
|  | ||||
|     public void setRenditions(Renditions renditions) | ||||
|     { | ||||
|         this.renditions = renditions; | ||||
|     } | ||||
|  | ||||
|     public void setDirectAccessUrlHelper(DirectAccessUrlHelper directAccessUrlHelper) | ||||
|     { | ||||
|         this.directAccessUrlHelper = directAccessUrlHelper; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void afterPropertiesSet() throws Exception | ||||
|     { | ||||
| @@ -132,28 +115,4 @@ public class NodeVersionRenditionsRelation implements RelationshipResourceAction | ||||
|         return renditions.getContent(nodeRef, versionId, renditionId, parameters); | ||||
|     } | ||||
|  | ||||
|     @Operation ("requestVersionRenditionDirectAccessUrl") | ||||
|     @WebApiParam (name = "requestVersionRenditionDirectAccessUrl", title = "Request direct access url", description = "Request direct access url", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @WebApiDescription(title = "Request content url", | ||||
|             description="Generates a direct access URL.", | ||||
|             successStatus = HttpServletResponse.SC_OK) | ||||
|     public DirectAccessUrl requestContentDirectUrl(String nodeId, String versionId, DirectAccessUrlRequest directAccessUrlRequest, Parameters parameters, WithResponse withResponse) | ||||
|     { | ||||
|         boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest); | ||||
|         Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec(); | ||||
|         NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId); | ||||
|         String renditionId = parameters.getRelationship2Id(); | ||||
|  | ||||
|         DirectAccessUrl directAccessUrl; | ||||
|         try | ||||
|         { | ||||
|             directAccessUrl = renditions.requestContentDirectUrl(nodeRef, versionId, renditionId, attachment, validFor); | ||||
|         } | ||||
|         catch (DirectAccessUrlDisabledException ex) | ||||
|         { | ||||
|             throw new DisabledServiceException(ex.getMessage()); | ||||
|         } | ||||
|         return directAccessUrl; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -302,8 +302,8 @@ public class NodeVersionsRelation extends AbstractNodeRelation implements | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Operation("requestVersionDirectAccessUrl") | ||||
|     @WebApiParam (name = "requestVersionDirectAccessUrl", title = "Request direct access url", description = "Request direct access url", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @Operation("request-direct-access-url") | ||||
|     @WebApiParam (name = "directAccessUrlRequest", title = "Request direct access url", description = "Options for direct access url request", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @WebApiDescription(title = "Request content url", | ||||
|             description="Generates a direct access URL.", | ||||
|             successStatus = HttpServletResponse.SC_OK) | ||||
|   | ||||
| @@ -202,8 +202,8 @@ public class NodesEntityResource implements | ||||
|         return nodes.unlock(nodeId, parameters); | ||||
|     } | ||||
|  | ||||
|     @Operation("requestNodeDirectAccessUrl") | ||||
|     @WebApiParam(name = "requestNodeDirectAccessUrl", title = "Request direct access url", description = "Request direct access url", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @Operation("request-direct-access-url") | ||||
|     @WebApiParam(name = "directAccessUrlRequest", title = "Request direct access url", description = "Options for direct access url request", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @WebApiDescription(title = "Request content url", | ||||
|             description="Generates a direct access URL.", | ||||
|             successStatus = HttpServletResponse.SC_OK) | ||||
|   | ||||
| @@ -23,8 +23,10 @@ | ||||
|  * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
|  | ||||
| package org.alfresco.rest.api.probes; | ||||
|  | ||||
| import org.alfresco.repo.admin.RepoHealthChecker; | ||||
| import org.alfresco.rest.api.discovery.DiscoveryApiWebscript; | ||||
| import org.alfresco.rest.api.model.Probe; | ||||
| import org.alfresco.rest.framework.WebApiDescription; | ||||
| @@ -35,29 +37,26 @@ import org.alfresco.rest.framework.core.exceptions.ServiceUnavailableException; | ||||
| 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.apache.commons.logging.Log; | ||||
| import org.apache.commons.logging.LogFactory; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| /** | ||||
|  * An implementation of an Entity Resource for Probes. | ||||
|  */ | ||||
| @EntityResource(name="probes", title = "Probes") | ||||
| public class ProbeEntityResource implements EntityResourceAction.ReadById<Probe> | ||||
| @EntityResource(name = "probes", title = "Probes") public class ProbeEntityResource | ||||
|             implements EntityResourceAction.ReadById<Probe> | ||||
| { | ||||
|     public static final String LIVE = "-live-"; | ||||
|     public static final String READY = "-ready-"; | ||||
|  | ||||
|     public static final long CHECK_PERIOD = 10 * 1000; // Maximum of only one checkResult every 10 seconds. | ||||
|  | ||||
|     protected static Log logger = LogFactory.getLog(ProbeEntityResource.class);; | ||||
|  | ||||
|     private long nextCheckTime = 0; | ||||
|     private final static Logger logger = LoggerFactory.getLogger(ProbeEntityResource.class); | ||||
|     private final Object lock = new Object(); | ||||
|     private final Probe liveProbe = new Probe("liveProbe: Success - Tested"); | ||||
|     private long lastCheckTime = 0; | ||||
|     private Boolean checkResult; | ||||
|     private Boolean checking = false; | ||||
|     private boolean readySent; | ||||
|  | ||||
|     private DiscoveryApiWebscript discovery; | ||||
|  | ||||
|     private RepoHealthChecker repoHealthChecker; | ||||
|  | ||||
|     public DiscoveryApiWebscript setDiscovery(DiscoveryApiWebscript discovery) | ||||
|     { | ||||
|         DiscoveryApiWebscript result = this.discovery; | ||||
| @@ -65,145 +64,141 @@ public class ProbeEntityResource implements EntityResourceAction.ReadById<Probe> | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     public void setRepoHealthChecker(RepoHealthChecker repoHealthChecker) | ||||
|     { | ||||
|         this.repoHealthChecker = repoHealthChecker; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns a status code of 200 for okay. The probe contains little information for security reasons. | ||||
|      * | ||||
|      * Note: does *not* require authenticated access, so limits the amount of work performed to avoid a DDOS. | ||||
|      */ | ||||
|     @Override | ||||
|     @WebApiDescription(title="Get probe status", description = "Returns 200 if valid") | ||||
|     @WebApiParam(name = "probeName", title = "The probe's name") | ||||
|     @WebApiNoAuth | ||||
|     public Probe readById(String name, Parameters parameters) | ||||
|     @Override @WebApiDescription(title = "Get probe status", description = "Returns 200 if valid") @WebApiParam(name = "probeName", title = "The probe's name") @WebApiNoAuth public Probe readById( | ||||
|                   String name, Parameters parameters) | ||||
|     { | ||||
|         boolean isLiveProbe = LIVE.equalsIgnoreCase(name); | ||||
|         if (!isLiveProbe && !READY.equalsIgnoreCase(name)) | ||||
|         ProbeType probeType = ProbeType.fromString(name); | ||||
|         Probe probeResponse = null; | ||||
|  | ||||
|         switch (probeType) | ||||
|         { | ||||
|             throw new InvalidArgumentException("Bad probe name"); | ||||
|             case LIVE: | ||||
|                 probeResponse = liveProbe; | ||||
|                 break; | ||||
|             case READY: | ||||
|                 String message = doReadyCheck(); | ||||
|                 probeResponse = new Probe(message); | ||||
|                 break; | ||||
|             case UNKNOWN: | ||||
|                 throw new InvalidArgumentException("Bad probe name"); | ||||
|         } | ||||
|  | ||||
|         String message = doCheckOrNothing(isLiveProbe); | ||||
|         return new Probe(message); | ||||
|         return probeResponse; | ||||
|     } | ||||
|  | ||||
|     // We don't want to be doing checks all the time or holding monitors for a long time to avoid a DDOS. | ||||
|     public String doCheckOrNothing(boolean isLiveProbe) | ||||
|     public String doReadyCheck() | ||||
|     { | ||||
|         boolean doCheck = false; | ||||
|         long now = 0; | ||||
|         boolean result; | ||||
|         String message = "No test"; | ||||
|         boolean logInfo = false; | ||||
|         synchronized(checking) | ||||
|  | ||||
|         synchronized (lock) | ||||
|         { | ||||
|             // Initially ready needs to be false so we don't get requests and live true so the pod is not killed. | ||||
|             if (checkResult == null) | ||||
|             String message; | ||||
|             long now = System.currentTimeMillis(); | ||||
|  | ||||
|             if (checkResult == null || isAfterCheckPeriod(now)) | ||||
|             { | ||||
|                 result = isLiveProbe; | ||||
|                 try | ||||
|                 { | ||||
|                     performReadinessCheck(); | ||||
|                     checkResult = true; | ||||
|                 } | ||||
|                 catch (Exception e) | ||||
|                 { | ||||
|                     checkResult = false; | ||||
|                     logger.debug("Exception during readiness check", e); | ||||
|                 } | ||||
|                 finally | ||||
|                 { | ||||
|  | ||||
|                     setLastCheckTime(now); | ||||
|                     message = getMessage(checkResult, "Tested"); | ||||
|                     logger.info(message); | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 result = checkResult; | ||||
|                 // if no check is performed, use previous check result | ||||
|                 message = getMessage(checkResult, "No test"); | ||||
|                 logger.debug(message); | ||||
|  | ||||
|             } | ||||
|             if (checkResult) | ||||
|             { | ||||
|                 return message; | ||||
|             } | ||||
|  | ||||
|             if (checking) // Is another thread is checking? | ||||
|             { | ||||
|                 if (!readySent && result && !isLiveProbe) | ||||
|                 { | ||||
|                     readySent = true; | ||||
|                     logInfo = true; | ||||
|                 } | ||||
|             } | ||||
|             else // This thread will do a check | ||||
|             { | ||||
|                 now = System.currentTimeMillis(); | ||||
|                 if (checkResult == null || nextCheckTime <= now) | ||||
|                 { | ||||
|                     doCheck = true; | ||||
|                     checking = true; | ||||
|                 } | ||||
|             } | ||||
|             throw new ServiceUnavailableException(message); | ||||
|         } | ||||
|  | ||||
|         if (doCheck) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 message = "Tested"; | ||||
|                 doCheck(isLiveProbe); | ||||
|                 result = true; | ||||
|             } | ||||
|             catch (Exception e) | ||||
|             { | ||||
|                 result = false; | ||||
|             } | ||||
|             finally | ||||
|             { | ||||
|                 synchronized (checking) | ||||
|                 { | ||||
|                     checking = false; | ||||
|                     checkResult = result; | ||||
|                     setNextCheckTime(now); | ||||
|                     if (result && !readySent && !isLiveProbe) // Are we initially ready | ||||
|                     { | ||||
|                         readySent = true; | ||||
|                         logInfo = true; | ||||
|                     } | ||||
|                     else if (!result && (isLiveProbe || readySent)) // Are we sick | ||||
|                     { | ||||
|                         logInfo = true; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         message = getMessage(isLiveProbe, result, message); | ||||
|  | ||||
|         if (logInfo) | ||||
|         { | ||||
|             logger.info(message); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             logger.debug(message); | ||||
|         } | ||||
|  | ||||
|         if (result) | ||||
|         { | ||||
|             return message; | ||||
|         } | ||||
|         throw new ServiceUnavailableException(message); | ||||
|     } | ||||
|  | ||||
|     private String getMessage(boolean isLiveProbe, boolean result, String message) | ||||
|     private String getMessage(boolean result, String message) | ||||
|     { | ||||
|         return (isLiveProbe ? "liveProbe" : "readyProbe")+": "+ | ||||
|         (result ? "Success" : "Failure") + | ||||
|         " - "+message; | ||||
|  | ||||
|         return "readyProbe: " + (result ? "Success" : "Failure") + " - " + message; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private void doCheck(boolean isLiveProbe) | ||||
|     private void performReadinessCheck() | ||||
|     { | ||||
|  | ||||
|         discovery.getRepositoryInfo(); | ||||
|         repoHealthChecker.checkDatabase(); | ||||
|         logger.debug("All checks complete"); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private void setNextCheckTime(long now) | ||||
|     private void setLastCheckTime(long time) | ||||
|     { | ||||
|         long oldValue = nextCheckTime; | ||||
|         if (nextCheckTime == 0) | ||||
|         this.lastCheckTime = time; | ||||
|         long nextCheckTime = lastCheckTime + CHECK_PERIOD; | ||||
|  | ||||
|         logger.trace("nextCheckTime: {} (+{} secs)", nextCheckTime, ((CHECK_PERIOD) / 1000)); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private boolean isAfterCheckPeriod(long currentTime) | ||||
|     { | ||||
|         return ((currentTime - lastCheckTime) >= CHECK_PERIOD); | ||||
|     } | ||||
|  | ||||
|     public enum ProbeType | ||||
|     { | ||||
|         LIVE("-live-"), READY("-ready-"), UNKNOWN(""); | ||||
|  | ||||
|         String value; | ||||
|  | ||||
|         ProbeType(String strValue) | ||||
|         { | ||||
|             nextCheckTime = (now / 60000) * 60000; | ||||
|             value = strValue; | ||||
|         } | ||||
|  | ||||
|         do | ||||
|         public static ProbeType fromString(String text) | ||||
|         { | ||||
|             nextCheckTime += CHECK_PERIOD; | ||||
|             for (ProbeType p : ProbeType.values()) | ||||
|             { | ||||
|                 if (p.value.equalsIgnoreCase(text)) | ||||
|                 { | ||||
|                     return p; | ||||
|                 } | ||||
|             } | ||||
|             return UNKNOWN; | ||||
|         } | ||||
|         while (nextCheckTime <= now); | ||||
|  | ||||
|         if (logger.isTraceEnabled()) | ||||
|         public String getValue() | ||||
|         { | ||||
|             logger.trace("nextCheckTime: " + nextCheckTime + " (+" + ((nextCheckTime - oldValue) / 1000) + " secs)"); | ||||
|             return value; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -78,6 +78,7 @@ import org.alfresco.rest.api.search.model.SearchSQLQuery; | ||||
| import org.alfresco.rest.api.search.model.TupleEntry; | ||||
| import org.alfresco.rest.api.search.model.TupleList; | ||||
| import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; | ||||
| import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException; | ||||
| import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; | ||||
| import org.alfresco.rest.framework.resource.parameters.Paging; | ||||
| import org.alfresco.rest.framework.resource.parameters.Params; | ||||
| @@ -152,7 +153,7 @@ public class ResultMapper | ||||
|      * Turns the results into a CollectionWithPagingInfo | ||||
|      * @param params | ||||
|      * @param searchQuery | ||||
|      *@param results  @return CollectionWithPagingInfo<Node> | ||||
|      * @param results  @return CollectionWithPagingInfo<Node> | ||||
|      */ | ||||
|     public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(Params params, SearchRequestContext searchRequestContext, SearchQuery searchQuery, ResultSet results) | ||||
|     { | ||||
| @@ -205,61 +206,69 @@ public class ResultMapper | ||||
|      * @param params | ||||
|      * @param mapUserInfo | ||||
|      * @param isHistory | ||||
|      * @return Node | ||||
|      * @return The node object or null if the user does not have permission to view it. | ||||
|      */ | ||||
|     public Node getNode(ResultSetRow aRow, Params params, Map<String, UserInfo> mapUserInfo, boolean isHistory) | ||||
|     { | ||||
|         String nodeStore = storeMapper.getStore(aRow.getNodeRef()); | ||||
|         if (isHistory) nodeStore = HISTORY; | ||||
|         String nodeStore = isHistory ? HISTORY : storeMapper.getStore(aRow.getNodeRef()); | ||||
|  | ||||
|         Node aNode = null; | ||||
|  | ||||
|         switch (nodeStore) | ||||
|         try | ||||
|         { | ||||
|             case LIVE_NODES: | ||||
|                 aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo); | ||||
|                 break; | ||||
|             case HISTORY: | ||||
|                 aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo); | ||||
|                 break; | ||||
|             case VERSIONS: | ||||
|                 Map<QName, Serializable> properties = serviceRegistry.getNodeService().getProperties(aRow.getNodeRef()); | ||||
|                 NodeRef frozenNodeRef = ((NodeRef) properties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF)); | ||||
|                 String versionLabelId = (String) properties.get(Version2Model.PROP_QNAME_VERSION_LABEL); | ||||
|                 Version v = null; | ||||
|                 try | ||||
|                 { | ||||
|                     if (frozenNodeRef != null && versionLabelId != null) | ||||
|             switch (nodeStore) | ||||
|             { | ||||
|                 case LIVE_NODES: | ||||
|                     aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo); | ||||
|                     break; | ||||
|                 case HISTORY: | ||||
|                     aNode = nodes.getFolderOrDocument(aRow.getNodeRef(), null, null, params.getInclude(), mapUserInfo); | ||||
|                     break; | ||||
|                 case VERSIONS: | ||||
|                     Map<QName, Serializable> properties = serviceRegistry.getNodeService().getProperties(aRow.getNodeRef()); | ||||
|                     NodeRef frozenNodeRef = ((NodeRef) properties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF)); | ||||
|                     String versionLabelId = (String) properties.get(Version2Model.PROP_QNAME_VERSION_LABEL); | ||||
|                     Version v = null; | ||||
|                     try | ||||
|                     { | ||||
|                         v = nodeVersions.findVersion(frozenNodeRef.getId(),versionLabelId); | ||||
|                         aNode = nodes.getFolderOrDocument(v.getFrozenStateNodeRef(), null, null, params.getInclude(), mapUserInfo); | ||||
|                         if (frozenNodeRef != null && versionLabelId != null) | ||||
|                         { | ||||
|                             v = nodeVersions.findVersion(frozenNodeRef.getId(), versionLabelId); | ||||
|                             aNode = nodes.getFolderOrDocument(v.getFrozenStateNodeRef(), null, null, params.getInclude(), mapUserInfo); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 catch (EntityNotFoundException|InvalidNodeRefException e) | ||||
|                 { | ||||
|                     //Solr says there is a node but we can't find it | ||||
|                     logger.debug("Failed to find a versioned node with id of "+frozenNodeRef | ||||
|                     catch (EntityNotFoundException | InvalidNodeRefException e) | ||||
|                     { | ||||
|                         //Solr says there is a node but we can't find it | ||||
|                         logger.debug("Failed to find a versioned node with id of " + frozenNodeRef | ||||
|                                 + " this is probably because the original node has been deleted."); | ||||
|                 } | ||||
|                     } | ||||
|  | ||||
|                 if (v != null && aNode != null) | ||||
|                 { | ||||
|                     nodeVersions.mapVersionInfo(v, aNode, aRow.getNodeRef()); | ||||
|                     aNode.setNodeId(frozenNodeRef.getId()); | ||||
|                     aNode.setVersionLabel(versionLabelId); | ||||
|                 } | ||||
|                 break; | ||||
|             case DELETED: | ||||
|                 try | ||||
|                 { | ||||
|                     aNode = deletedNodes.getDeletedNode(aRow.getNodeRef().getId(), params, false, mapUserInfo); | ||||
|                 } | ||||
|                 catch (EntityNotFoundException enfe) | ||||
|                 { | ||||
|                     //Solr says there is a deleted node but we can't find it, we want the rest of the search to return so lets ignore it. | ||||
|                     logger.debug("Failed to find a deleted node with id of "+aRow.getNodeRef().getId()); | ||||
|                 } | ||||
|                 break; | ||||
|                     if (v != null && aNode != null) | ||||
|                     { | ||||
|                         nodeVersions.mapVersionInfo(v, aNode, aRow.getNodeRef()); | ||||
|                         aNode.setNodeId(frozenNodeRef.getId()); | ||||
|                         aNode.setVersionLabel(versionLabelId); | ||||
|                     } | ||||
|                     break; | ||||
|                 case DELETED: | ||||
|                     try | ||||
|                     { | ||||
|                         aNode = deletedNodes.getDeletedNode(aRow.getNodeRef().getId(), params, false, mapUserInfo); | ||||
|                     } | ||||
|                     catch (EntityNotFoundException enfe) | ||||
|                     { | ||||
|                         //Solr says there is a deleted node but we can't find it, we want the rest of the search to return so lets ignore it. | ||||
|                         logger.debug("Failed to find a deleted node with id of " + aRow.getNodeRef().getId()); | ||||
|                     } | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
|         catch (PermissionDeniedException e) | ||||
|         { | ||||
|             logger.debug("Unable to access node: " + aRow.toString()); | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         if (aNode != null) | ||||
|         { | ||||
|             aNode.setLocation(nodeStore); | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2016 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
| @@ -28,7 +28,10 @@ package org.alfresco.rest.api.trashcan; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | ||||
| import org.alfresco.repo.content.directurl.DirectAccessUrlDisabledException; | ||||
| import org.alfresco.rest.api.DeletedNodes; | ||||
| import org.alfresco.rest.api.DirectAccessUrlHelper; | ||||
| import org.alfresco.rest.api.model.DirectAccessUrlRequest; | ||||
| import org.alfresco.rest.api.model.Node; | ||||
| import org.alfresco.rest.api.model.NodeTargetAssoc; | ||||
| import org.alfresco.rest.framework.BinaryProperties; | ||||
| @@ -36,6 +39,7 @@ import org.alfresco.rest.framework.Operation; | ||||
| import org.alfresco.rest.framework.WebApiDescription; | ||||
| import org.alfresco.rest.framework.WebApiParam; | ||||
| import org.alfresco.rest.framework.core.ResourceParameter; | ||||
| import org.alfresco.rest.framework.core.exceptions.DisabledServiceException; | ||||
| import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; | ||||
| import org.alfresco.rest.framework.resource.EntityResource; | ||||
| import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAction; | ||||
| @@ -44,6 +48,7 @@ import org.alfresco.rest.framework.resource.content.BinaryResource; | ||||
| 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.service.cmr.repository.DirectAccessUrl; | ||||
|  | ||||
| /** | ||||
|  * An implementation of an Entity Resource for handling archived content | ||||
| @@ -55,12 +60,18 @@ public class TrashcanEntityResource implements | ||||
|         EntityResourceAction.ReadById<Node>, EntityResourceAction.Read<Node>, EntityResourceAction.Delete, BinaryResourceAction.Read | ||||
| { | ||||
|     private DeletedNodes deletedNodes; | ||||
|     private DirectAccessUrlHelper directAccessUrlHelper; | ||||
|  | ||||
|     public void setDeletedNodes(DeletedNodes deletedNodes) | ||||
|     { | ||||
|         this.deletedNodes = deletedNodes; | ||||
|     } | ||||
|  | ||||
|     public void setDirectAccessUrlHelper(DirectAccessUrlHelper directAccessUrlHelper) | ||||
|     { | ||||
|         this.directAccessUrlHelper = directAccessUrlHelper; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public CollectionWithPagingInfo<Node> readAll(Parameters params) | ||||
|     { | ||||
| @@ -89,6 +100,27 @@ public class TrashcanEntityResource implements | ||||
|         return deletedNodes.getContent(nodeId, null, parameters); | ||||
|     } | ||||
|  | ||||
|     @Operation("request-direct-access-url") | ||||
|     @WebApiParam(name = "directAccessUrlRequest", title = "Request direct access url", description = "Options for direct access url request", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @WebApiDescription(title = "Request content url", | ||||
|             description="Generates a direct access URL.", | ||||
|             successStatus = HttpServletResponse.SC_OK) | ||||
|     public DirectAccessUrl requestContentDirectUrl(String originalNodeId, DirectAccessUrlRequest directAccessUrlRequest, Parameters parameters, WithResponse withResponse) | ||||
|     { | ||||
|         boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest); | ||||
|         Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec(); | ||||
|         DirectAccessUrl directAccessUrl; | ||||
|         try | ||||
|         { | ||||
|             directAccessUrl = deletedNodes.requestContentDirectUrl(originalNodeId, null, attachment, validFor); | ||||
|         } | ||||
|         catch (DirectAccessUrlDisabledException ex) | ||||
|         { | ||||
|             throw new DisabledServiceException(ex.getMessage()); | ||||
|         } | ||||
|         return directAccessUrl; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void delete(String nodeId, Parameters parameters) | ||||
|     { | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2016 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software. | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of | ||||
| @@ -25,18 +25,27 @@ | ||||
|  */ | ||||
| package org.alfresco.rest.api.trashcan; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | ||||
| import org.alfresco.repo.content.directurl.DirectAccessUrlDisabledException; | ||||
| import org.alfresco.rest.api.DeletedNodes; | ||||
| import org.alfresco.rest.api.DirectAccessUrlHelper; | ||||
| import org.alfresco.rest.api.model.DirectAccessUrlRequest; | ||||
| import org.alfresco.rest.api.model.Rendition; | ||||
| import org.alfresco.rest.framework.BinaryProperties; | ||||
| import org.alfresco.rest.framework.Operation; | ||||
| import org.alfresco.rest.framework.WebApiDescription; | ||||
| import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; | ||||
| import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException; | ||||
| import org.alfresco.rest.framework.WebApiParam; | ||||
| import org.alfresco.rest.framework.core.ResourceParameter; | ||||
| import org.alfresco.rest.framework.core.exceptions.DisabledServiceException; | ||||
| import org.alfresco.rest.framework.resource.RelationshipResource; | ||||
| import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; | ||||
| import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceBinaryAction; | ||||
| import org.alfresco.rest.framework.resource.content.BinaryResource; | ||||
| 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.service.cmr.repository.DirectAccessUrl; | ||||
| import org.alfresco.util.ParameterCheck; | ||||
| import org.springframework.beans.factory.InitializingBean; | ||||
|  | ||||
| @@ -46,12 +55,18 @@ public class TrashcanRenditionsRelation | ||||
| { | ||||
|  | ||||
|     private DeletedNodes deletedNodes; | ||||
|     private DirectAccessUrlHelper directAccessUrlHelper; | ||||
|  | ||||
|     public void setDeletedNodes(DeletedNodes deletedNodes) | ||||
|     { | ||||
|         this.deletedNodes = deletedNodes; | ||||
|     } | ||||
|  | ||||
|     public void setDirectAccessUrlHelper(DirectAccessUrlHelper directAccessUrlHelper) | ||||
|     { | ||||
|         this.directAccessUrlHelper = directAccessUrlHelper; | ||||
|     } | ||||
|  | ||||
|     @WebApiDescription(title = "List renditions", description = "List available (created) renditions") | ||||
|     @Override | ||||
|     public CollectionWithPagingInfo<Rendition> readAll(String nodeId, Parameters parameters) | ||||
| @@ -74,6 +89,27 @@ public class TrashcanRenditionsRelation | ||||
|         return deletedNodes.getContent(nodeId, renditionId, parameters); | ||||
|     } | ||||
|  | ||||
|     @Operation ("request-direct-access-url") | ||||
|     @WebApiParam (name = "directAccessUrlRequest", title = "Request direct access url", description = "Options for direct access url request", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT) | ||||
|     @WebApiDescription(title = "Request content url", | ||||
|             description="Generates a direct access URL.", | ||||
|             successStatus = HttpServletResponse.SC_OK) | ||||
|     public DirectAccessUrl requestContentDirectUrl(String originalNodeId, String renditionId, DirectAccessUrlRequest directAccessUrlRequest, Parameters parameters, WithResponse withResponse) | ||||
|     { | ||||
|         boolean attachment = directAccessUrlHelper.getAttachment(directAccessUrlRequest); | ||||
|         Long validFor = directAccessUrlHelper.getDefaultExpiryTimeInSec(); | ||||
|         DirectAccessUrl directAccessUrl; | ||||
|         try | ||||
|         { | ||||
|             directAccessUrl = deletedNodes.requestContentDirectUrl(originalNodeId, renditionId, attachment, validFor); | ||||
|         } | ||||
|         catch (DirectAccessUrlDisabledException ex) | ||||
|         { | ||||
|             throw new DisabledServiceException(ex.getMessage()); | ||||
|         } | ||||
|         return directAccessUrl; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void afterPropertiesSet() throws Exception | ||||
|     { | ||||
|   | ||||
| @@ -0,0 +1,49 @@ | ||||
| /* | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
|  * the paid license agreement will prevail.  Otherwise, the software is  | ||||
|  * provided under the following open source license terms: | ||||
|  *  | ||||
|  * Alfresco is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU Lesser General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  *  | ||||
|  * Alfresco is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU Lesser General Public License for more details. | ||||
|  *  | ||||
|  * You should have received a copy of the GNU Lesser General Public License | ||||
|  * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * #L% | ||||
|  */ | ||||
| package org.alfresco.rest.framework.core.exceptions; | ||||
|  | ||||
| /** | ||||
|  * JSONP callback not allowed | ||||
|  * | ||||
|  * @author Vitor Moreira | ||||
|  */ | ||||
| public class JsonpCallbackNotAllowedException extends ApiException | ||||
| { | ||||
|     private static final long serialVersionUID = 7198491358180044895L; | ||||
|  | ||||
|     public static String DEFAULT_MESSAGE_ID = "framework.exception.JsonpCallbackNotAllowed"; | ||||
|  | ||||
|     public JsonpCallbackNotAllowedException() | ||||
|     { | ||||
|         super(DEFAULT_MESSAGE_ID); | ||||
|     } | ||||
|  | ||||
|     public JsonpCallbackNotAllowedException(String msgId) | ||||
|     { | ||||
|         super(msgId); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * #%L | ||||
|  * Alfresco Remote API | ||||
|  * %% | ||||
|  * Copyright (C) 2005 - 2016 Alfresco Software Limited | ||||
|  * Copyright (C) 2005 - 2021 Alfresco Software Limited | ||||
|  * %% | ||||
|  * This file is part of the Alfresco software.  | ||||
|  * If the software was purchased under a paid Alfresco license, the terms of  | ||||
| @@ -35,6 +35,7 @@ import org.alfresco.repo.jscript.ScriptUtils; | ||||
| import org.alfresco.repo.web.scripts.RepositoryContainer; | ||||
| import org.alfresco.service.cmr.admin.RepoUsage; | ||||
| import org.alfresco.service.cmr.repository.StoreRef; | ||||
| import org.springframework.extensions.webscripts.Description.RequiredAuthentication; | ||||
| import org.springframework.extensions.webscripts.WebScript; | ||||
|  | ||||
| /** | ||||
| @@ -65,27 +66,61 @@ public class WebScriptUtils extends ScriptUtils | ||||
|      */ | ||||
|     public Object[] findWebScripts(String family) | ||||
|     { | ||||
|         List<Object> values = new ArrayList<Object>(); | ||||
|          | ||||
|         List<Object> values = new ArrayList<>(); | ||||
|  | ||||
|         for (WebScript webscript : this.repositoryContainer.getRegistry().getWebScripts()) | ||||
|         { | ||||
|             if (family != null) | ||||
|             addScriptDescription(family, values, webscript); | ||||
|         } | ||||
|  | ||||
|         return values.toArray(new Object[0]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Searches for webscript components with the given family name accessible to the current user. | ||||
|      * | ||||
|      * @param family        the family | ||||
|      * | ||||
|      * @return An array of webscripts that match the given family name accessible to the current user | ||||
|      * | ||||
|      * @since 7.1 | ||||
|      */ | ||||
|     public Object[] findWebScriptsForCurrentUser(String family) | ||||
|     { | ||||
|         List<Object> values = new ArrayList<>(); | ||||
|  | ||||
|         final boolean isAdminOrSystemUser = repositoryContainer.isAdminOrSystemUser(); | ||||
|         for (WebScript webscript : this.repositoryContainer.getRegistry().getWebScripts()) | ||||
|         { | ||||
|             final RequiredAuthentication required = webscript.getDescription().getRequiredAuthentication(); | ||||
|             // Ignore admin webscripts if the current user is not an Admin or System | ||||
|             if (RequiredAuthentication.admin == required && !isAdminOrSystemUser) | ||||
|             { | ||||
|                 Set<String> familys = webscript.getDescription().getFamilys(); | ||||
|                 if (familys != null && familys.contains(family)) | ||||
|                 { | ||||
|                     values.add(webscript.getDescription()); | ||||
|                 } | ||||
|                 continue; | ||||
|             } | ||||
|             else | ||||
|  | ||||
|             addScriptDescription(family, values, webscript); | ||||
|         } | ||||
|  | ||||
|         return values.toArray(new Object[0]); | ||||
|     } | ||||
|  | ||||
|     private void addScriptDescription(String family, List<Object> values, WebScript webscript) | ||||
|     { | ||||
|         if (family != null) | ||||
|         { | ||||
|             Set<String> families = webscript.getDescription().getFamilys(); | ||||
|             if (families != null && families.contains(family)) | ||||
|             { | ||||
|                 values.add(webscript.getDescription()); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         return values.toArray(new Object[0]); | ||||
|         else | ||||
|         { | ||||
|             values.add(webscript.getDescription()); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|  | ||||
|     public String getHostAddress() | ||||
|     { | ||||
|         try | ||||
|   | ||||
| @@ -14,4 +14,6 @@ framework.exception.UnsupportedResourceOperation=The operation is unsupported | ||||
| framework.exception.DeletedResource=In this version of the REST API resource {0} has been deleted | ||||
| framework.exception.RequestEntityTooLarge=The file can't be uploaded because it's larger than the maximum upload size | ||||
| framework.exception.InsufficientStorage=The file upload exceeds the content storage allowance | ||||
| framework.exception.JsonpCallbackNotAllowed=For security reasons the callback parameter is not allowed | ||||
| framework.no.stacktrace=For security reasons the stack trace is no longer displayed, but the property is kept for previous versions | ||||
|  | ||||
|   | ||||
| @@ -995,9 +995,9 @@ | ||||
|  | ||||
|     <bean class="org.alfresco.rest.api.trashcan.TrashcanEntityResource"> | ||||
|         <property name="deletedNodes" ref="DeletedNodes" /> | ||||
|         <property name="directAccessUrlHelper" ref="directAccessUrlHelper" /> | ||||
|     </bean> | ||||
|  | ||||
|  | ||||
|     <bean class="org.alfresco.rest.api.quicksharelinks.QuickShareLinkEntityResource"> | ||||
|         <property name="quickShareLinks" ref="QuickShareLinks" /> | ||||
|     </bean> | ||||
| @@ -1070,18 +1070,19 @@ | ||||
|         <property name="enabled" value="${system.api.discovery.enabled}" /> | ||||
|         <property name="thumbnailService" ref="ThumbnailService" /> | ||||
|         <property name="restApiDirectUrlConfig" ref="restApiDirectUrlConfig" /> | ||||
|         <property name="contentService" ref="ContentService" /> | ||||
|         <property name="contentService" ref="contentService" /> | ||||
|     </bean> | ||||
|  | ||||
|     <bean id="org.alfresco.rest.api.probes.ProbeEntityResource.get" class="org.alfresco.rest.api.probes.ProbeEntityResource"> | ||||
|         <property name="discovery" ref="webscript.org.alfresco.api.DiscoveryApiWebscript.get" /> | ||||
|         <property name="repoHealthChecker" ref="repoHealthChecker" /> | ||||
|     </bean> | ||||
|  | ||||
|     <!-- REST API direct access URL configuration settings --> | ||||
|     <bean id="restApiDirectUrlConfig" class="org.alfresco.rest.api.impl.directurl.RestApiDirectUrlConfig" init-method="init"> | ||||
|         <property name="systemWideDirectUrlConfig" ref="systemWideDirectUrlConfig" /> | ||||
|         <property name="enabled" value="${restApi.directAccessUrl.enabled}" /> | ||||
|         <property name="defaultExpiryTimeInSec" value="${restApi.directAccessUrl.defaultExpiryTimeInSec}" /> | ||||
|         <property name="enabled" value="#{T(Boolean).valueOf('${restApi.directAccessUrl.enabled}')}"/> | ||||
|         <property name="defaultExpiryTimeInSec" value="#{T(Integer).parseInt('${restApi.directAccessUrl.defaultExpiryTimeInSec}')}" /> | ||||
|     </bean> | ||||
|  | ||||
|     <!-- OpenCMIS --> | ||||
| @@ -1138,6 +1139,7 @@ | ||||
|         <property name="cmisVersion"        value="1.1"/> | ||||
|         <property name="tenantAdminService" ref="tenantAdminService"/> | ||||
|         <property name="nonAttachContentTypes" ref="nodes.nonAttachContentTypes"/> | ||||
|         <property name="allowUnsecureCallbackJSONP" value="${allow.unsecure.callback.jsonp}"/> | ||||
|     </bean> | ||||
|  | ||||
|     <bean   id="webscript.org.alfresco.api.opencmis.OpenCMIS.get"  | ||||
| @@ -1429,7 +1431,6 @@ | ||||
|  | ||||
|     <bean class="org.alfresco.rest.api.nodes.NodeVersionRenditionsRelation"> | ||||
|         <property name="renditions" ref="Renditions" /> | ||||
|         <property name="directAccessUrlHelper" ref="directAccessUrlHelper" /> | ||||
|     </bean> | ||||
|  | ||||
|     <bean class="org.alfresco.rest.api.quicksharelinks.QuickShareLinkRenditionsRelation"> | ||||
| @@ -1438,6 +1439,7 @@ | ||||
|  | ||||
|     <bean class="org.alfresco.rest.api.trashcan.TrashcanRenditionsRelation"> | ||||
|         <property name="deletedNodes" ref="DeletedNodes"/> | ||||
|         <property name="directAccessUrlHelper" ref="directAccessUrlHelper" /> | ||||
|     </bean> | ||||
|  | ||||
|     <!-- HeartBeat rest api renditions data collector --> | ||||
|   | ||||
| @@ -40,7 +40,7 @@ var Admin = Admin || {}; | ||||
|       var toolInfo = {}; | ||||
|        | ||||
|       // collect the tools required for the Admin Console | ||||
|       var tools = utils.findWebScripts("AdminConsole"); | ||||
|       var tools = utils.findWebScriptsForCurrentUser("AdminConsole"); | ||||
|        | ||||
|       // process each tool and generate the data so that a label+link can | ||||
|       // be output by the component template for each tool required | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|    <!-- COMMUNITY ONLY --> | ||||
|    <family>AdminConsole:Edition:Community</family> | ||||
|    <format default="html">argument</format> | ||||
|    <authentication>admin</authentication> | ||||
|    <authentication>sysadmin</authentication> | ||||
|    <lifecycle>internal</lifecycle> | ||||
|    <transaction allow="readonly">required</transaction> | ||||
| </webscript> | ||||
| </webscript> | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|    <url>/admin/</url> | ||||
|    <family>AdminConsoleHelper</family> | ||||
|    <format default="html">argument</format> | ||||
|    <authentication>admin</authentication> | ||||
|    <authentication>sysadmin</authentication> | ||||
|    <lifecycle>internal</lifecycle> | ||||
|    <transaction allow="readonly">required</transaction> | ||||
| </webscript> | ||||
| </webscript> | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|    </description> | ||||
|    <url>/api/admin/jmxdump</url> | ||||
|    <family>AdminConsoleHelper</family> | ||||
|    <authentication>admin</authentication> | ||||
|    <authentication>sysadmin</authentication> | ||||
|    <transaction allow="readonly"/> | ||||
|    <lifecycle>internal</lifecycle> | ||||
| </webscript> | ||||
| </webscript> | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user