mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-24 14:32:01 +00:00
Compare commits
395 Commits
repo-5439-
...
9.40
Author | SHA1 | Date | |
---|---|---|---|
|
cf905313e3 | ||
|
aa611b2885 | ||
|
473237460f | ||
|
c2775e3d3d | ||
|
9681d99bf4 | ||
|
616604a4ef | ||
|
e2596492d5 | ||
|
659bcf5393 | ||
|
872f7c80e9 | ||
|
b8ef25b059 | ||
|
abdeddcabf | ||
|
4aa2f30cf6 | ||
|
5984d62107 | ||
|
0035c997ca | ||
|
b9686dc9b2 | ||
|
3e16565272 | ||
|
154efed2eb | ||
|
956ce6c1a2 | ||
|
c68be19071 | ||
|
bcda52f5e2 | ||
|
d92603ef2b | ||
|
9f1abd5db0 | ||
|
c4f567e7ba | ||
|
dd03941907 | ||
|
b5ee3c06a9 | ||
|
5b6d080e8a | ||
|
e03c8a72d1 | ||
|
70e7f68a4b | ||
|
19053341b8 | ||
|
24c41b97cc | ||
|
97de175cde | ||
|
6a719bb5f6 | ||
|
b8a3724ee7 | ||
|
0077d31bed | ||
|
342bd5a103 | ||
|
d848e12981 | ||
|
9cb2b23ef5 | ||
|
7db90ee90c | ||
|
9d0106e000 | ||
|
26c991a563 | ||
|
ddfabba4ba | ||
|
ab7d757412 | ||
|
fe028f5b85 | ||
|
2baf1b9c91 | ||
|
3818f94268 | ||
|
53b41068d4 | ||
|
c302bc31ff | ||
|
9a30044064 | ||
|
41edced9f1 | ||
|
15ca9e21be | ||
|
36bf6d2f81 | ||
|
cf01f167ae | ||
|
4c94059bbf | ||
|
5efe11008d | ||
|
3225eefd0b | ||
|
b6de89aa8d | ||
|
4cc1c10ce5 | ||
|
7641c128c5 | ||
|
a62ad8715e | ||
|
542f189907 | ||
|
a006b5acaf | ||
|
c2e516b69a | ||
|
2c5044896b | ||
|
24454afe6b | ||
|
aec55ed8a6 | ||
|
ddd5a4ae48 | ||
|
e523245a10 | ||
|
c4217b32fb | ||
|
2fbd21076f | ||
|
cb1419b140 | ||
|
9a6c6f2ee9 | ||
|
eaff930456 | ||
|
4a03e8cc98 | ||
|
0eaeea35f8 | ||
|
f4c632c26b | ||
|
3c96ed9482 | ||
|
0141284b37 | ||
|
2c8ed7f4b5 | ||
|
decbe6b285 | ||
|
f0f538bad0 | ||
|
c0aaf75284 | ||
|
7f5889474e | ||
|
11c6125760 | ||
|
ba4effc6ec | ||
|
3f52aec2dc | ||
|
eb3df043be | ||
|
c5aed167f4 | ||
|
a477c19e9a | ||
|
1497362d3e | ||
|
27e2775e40 | ||
|
f2ecce0f46 | ||
|
0ad54cbf77 | ||
|
3e3cd479c2 | ||
|
b9b41a10e8 | ||
|
664d0b9704 | ||
|
1493b02d8d | ||
|
70c1a1279c | ||
|
f0638e8d7d | ||
|
983dd47c35 | ||
|
24d092cb02 | ||
|
ddb299ab03 | ||
|
19d214fcb0 | ||
|
870ff8cc64 | ||
|
aed08fe5d9 | ||
|
a3b0541560 | ||
|
2f6c5614c3 | ||
|
82d3828351 | ||
|
c986498481 | ||
|
c93d81379e | ||
|
d348e0b72d | ||
|
dc5e7405cc | ||
|
3c8bb7f154 | ||
|
bb8d42d23c | ||
|
9c1aa53819 | ||
|
885f4a49a5 | ||
|
9989ec3260 | ||
|
78ad14b696 | ||
|
8ae2009c13 | ||
|
df92479664 | ||
|
40133c350e | ||
|
f0c95819ad | ||
|
1b3ae47b98 | ||
|
6a017abf3e | ||
|
19767d2fc7 | ||
|
77935da9df | ||
|
80612db4e3 | ||
|
49b652f696 | ||
|
999ce58b43 | ||
|
2bf41ccfea | ||
|
f485581d5e | ||
|
a4bf9b5e47 | ||
|
1fde058fc4 | ||
|
d60cd5ed1c | ||
|
f77ceb2072 | ||
|
b072d935aa | ||
|
2b03e2bbf0 | ||
|
748272bcde | ||
|
3aad844812 | ||
|
1e5188a4a7 | ||
|
f5e5093ead | ||
|
fef8cc9256 | ||
|
2e6b40d8c7 | ||
|
4be06a5e20 | ||
|
f7ecb45991 | ||
|
6349b6ff7b | ||
|
16c998ca94 | ||
|
a37bf29faa | ||
|
42d14c2abe | ||
|
8544f6f90e | ||
|
ee7936334e | ||
|
50a1e87962 | ||
|
0266dfec6a | ||
|
e0ce4ddf42 | ||
|
783f0fad55 | ||
|
6ea080d819 | ||
|
1bb233405b | ||
|
9af54e1dc4 | ||
|
3a2119cbd2 | ||
|
c3476a725f | ||
|
30baf81b44 | ||
|
c60268eae4 | ||
|
5911315c4d | ||
|
2294a87908 | ||
|
75d6722efd | ||
|
bcd72f35d0 | ||
|
3a5cedd418 | ||
|
5a4fbbe095 | ||
|
fc89ed17f2 | ||
|
064e87a4aa | ||
|
4e50446c4e | ||
|
e5ca36936c | ||
|
6f0c21662e | ||
|
1a5aa34d3d | ||
|
24f2737255 | ||
|
0cbbe42369 | ||
|
1f4666076d | ||
|
d2f21bcea1 | ||
|
5d3c4730ec | ||
|
299003c0c7 | ||
|
d0c93dc170 | ||
|
c1002b8684 | ||
|
43410785a5 | ||
|
2cbd2d98d4 | ||
|
1b768f7c1f | ||
|
cdec3f2f93 | ||
|
aaf2b32d02 | ||
|
2ce490042a | ||
|
e88aab47f7 | ||
|
36937eaad7 | ||
|
2f043eac24 | ||
|
fd7adefe27 | ||
|
cf91e0afe0 | ||
|
1394442d93 | ||
|
9f00a2b561 | ||
|
07891b2765 | ||
|
2a781e364b | ||
|
95ab60263c | ||
|
bb19c61253 | ||
|
6f17779e71 | ||
|
1ff90242b0 | ||
|
de18900d90 | ||
|
6360842e06 | ||
|
cee63b31f6 | ||
|
a74cdea223 | ||
|
e53b61d2bf | ||
|
cad18795fd | ||
|
14e43ed825 | ||
|
2ee3b2085a | ||
|
a7935b0d08 | ||
|
557a666fd3 | ||
|
87b7d524ea | ||
|
43daee3529 | ||
|
c9638187a1 | ||
|
659e2baef8 | ||
|
fb2035e82e | ||
|
366e4b23bf | ||
|
5f6734728e | ||
|
371791a0bb | ||
|
b2d65d6ac1 | ||
|
69dca8f852 | ||
|
4d73b11d12 | ||
|
582235dacf | ||
|
fbac196c19 | ||
|
fc2cde41ad | ||
|
685c4b0844 | ||
|
06d00e5193 | ||
|
3ad33034f1 | ||
|
e6e710751e | ||
|
fe649b3302 | ||
|
fb322089ab | ||
|
d6ad134d4c | ||
|
9688dab484 | ||
|
e3dca6ecbd | ||
|
8db3fc230e | ||
|
022519b5fd | ||
|
fafdfa6945 | ||
|
d50f62906d | ||
|
ff34ca3d01 | ||
|
592dde531f | ||
|
1776a43a30 | ||
|
5355592cb6 | ||
|
08bc7d4599 | ||
|
c54abf1b62 | ||
|
78aa6dc080 | ||
|
2171bcc192 | ||
|
f6166297d3 | ||
|
b270ec1f8d | ||
|
d2b87f31c4 | ||
|
0211392ff6 | ||
|
cc3c518940 | ||
|
465a1cec4d | ||
|
9858324d92 | ||
|
727847b17e | ||
|
2979082767 | ||
|
a84a68cb9a | ||
|
5cdade38a8 | ||
|
072faf603e | ||
|
438dfa9d12 | ||
|
72be8daf01 | ||
|
ba9ae7071a | ||
|
48ec102598 | ||
|
e8e2ded02a | ||
|
503b50738a | ||
|
8e90612619 | ||
|
134ca108e9 | ||
|
af5c5133f6 | ||
|
a903d9ec44 | ||
|
2b1f63e07f | ||
|
1c1b956ad1 | ||
|
14ca5bb726 | ||
|
3d0099d742 | ||
|
fd491d83fe | ||
|
6ef30c46e9 | ||
|
2b9ecf1ece | ||
|
930b312cd1 | ||
|
64122bf31b | ||
|
10efd50add | ||
|
3879e28590 | ||
|
471492c8e0 | ||
|
ae26d9c1c4 | ||
|
c2733b9da7 | ||
|
65a93c31f5 | ||
|
58e7c41bbb | ||
|
8cfc05758d | ||
|
b1ea30fc74 | ||
|
f6021faef8 | ||
|
da3220864e | ||
|
631e2f100a | ||
|
15a68ee177 | ||
|
f9af668d8d | ||
|
358bd704df | ||
|
0543a800f7 | ||
|
b4b591b8af | ||
|
d3860738da | ||
|
d5bff09158 | ||
|
16eebe4681 | ||
|
7d99fb235b | ||
|
83a1c7bd59 | ||
|
5df53eb3bf | ||
|
bd65a45128 | ||
|
ba060da9df | ||
|
44da1cb33c | ||
|
97428142b7 | ||
|
7f36c47977 | ||
|
ba301ba19a | ||
|
2ffbb2ca23 | ||
|
b3454b762c | ||
|
1b09fea6fc | ||
|
45e31ebe82 | ||
|
401833665e | ||
|
23b5dc3aef | ||
|
c4eb95471d | ||
|
a9e54bd08c | ||
|
f9aaddd787 | ||
|
81ab6e1583 | ||
|
c7d219ee23 | ||
|
ad1079aaef | ||
|
5177e607ee | ||
|
10f0104d0d | ||
|
8ea6d79b5d | ||
|
24fcf258d3 | ||
|
de6022db01 | ||
|
3195c93a9e | ||
|
8c5ec402a5 | ||
|
e772d3b898 | ||
|
8fcaa7febb | ||
|
e9f1b9f21b | ||
|
67b7552686 | ||
|
facbef9ca9 | ||
|
a6fce739b6 | ||
|
89fddfc614 | ||
|
6a2e3b64d0 | ||
|
7479379af8 | ||
|
66db333cdd | ||
|
b41ff7ae4d | ||
|
ecba5737bc | ||
|
7a335fd0ff | ||
|
112ddd4fd7 | ||
|
6ddc4c37bc | ||
|
bc36a2f261 | ||
|
7fae74b9ff | ||
|
adf67f1939 | ||
|
310496de04 | ||
|
fad7f82a2e | ||
|
54689899f9 | ||
|
4f8ca02f7f | ||
|
8af971e704 | ||
|
54457a43ef | ||
|
fae8c0a3cd | ||
|
c537c4523e | ||
|
e1f6012dd7 | ||
|
e80256e92e | ||
|
df333e32ee | ||
|
04d699cf86 | ||
|
be8e77941d | ||
|
af51b65014 | ||
|
b4f9c8a672 | ||
|
cb3912ba36 | ||
|
a8f911e2a1 | ||
|
06e877f7e5 | ||
|
da66a843da | ||
|
4d838c6286 | ||
|
5d2c83c14b | ||
|
affccc1b4d | ||
|
8a13fda5d9 | ||
|
792a86f1ee | ||
|
9d52aa3c64 | ||
|
5e5082d9b3 | ||
|
cb973c4d87 | ||
|
653694b030 | ||
|
f786f4ffaf | ||
|
a79f782a91 | ||
|
3eab59c273 | ||
|
b9adb42c30 | ||
|
9c1bfca7ad | ||
|
a4bf93d33f | ||
|
a74db1443e | ||
|
1600704bee | ||
|
c7d5736f37 | ||
|
3891306459 | ||
|
bf73af71a3 | ||
|
57c04411ed | ||
|
7962cf0b03 | ||
|
eeb49f4b36 | ||
|
31d65ceb42 | ||
|
1b2c5d4c37 | ||
|
c0d1098db0 | ||
|
27af7d2f49 | ||
|
11cf9fa16c | ||
|
5f19aa76af | ||
|
2cffc61164 | ||
|
53c58d4b46 | ||
|
96c6ca844a | ||
|
b3e48b0072 | ||
|
e59c0d7186 |
@@ -1,4 +1,4 @@
|
||||
# For SmartGit
|
||||
[bugtraq "jira"]
|
||||
url = https://issues.alfresco.com/jira/browse/%BUGID%
|
||||
url = https://alfresco.atlassian.net/browse/%BUGID%
|
||||
logRegex = ([A-Z]+-\\d+)
|
||||
|
215
.travis.yml
215
.travis.yml
@@ -33,7 +33,7 @@ stages:
|
||||
- name: test
|
||||
if: commit_message !~ /\[skip tests\]/
|
||||
- name: release
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/ OR branch =~ /fix\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/
|
||||
- name: update_downstream
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/
|
||||
- name: trigger_downstream
|
||||
@@ -44,59 +44,49 @@ install: travis_retry travis_wait 40 bash scripts/travis/build.sh
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "WhiteSource scan"
|
||||
stage: test
|
||||
# only on release branches or master and if it is not a PR
|
||||
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request
|
||||
script:
|
||||
# Download the latest version of WhiteSource Unified Agent
|
||||
- curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar
|
||||
# Run WhiteSource Unified Agent
|
||||
- java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config -d ./packaging/war
|
||||
|
||||
# - name: "Source Clear Scan"
|
||||
# # only on release branches or master and if it is not a PR
|
||||
# if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request
|
||||
# script: skip
|
||||
# addons:
|
||||
# srcclr: true
|
||||
|
||||
- name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
script:
|
||||
- travis_retry mvn -B test -pl core,data-model
|
||||
- travis_retry mvn -B test -pl repository -Dtest=AllUnitTestsSuite
|
||||
|
||||
- name: "Repository - AppContext01TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext02TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext03TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext04TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext05TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- mkdir -p "${HOME}/tmp"
|
||||
- cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp"
|
||||
- export HOST_IP=$(hostname -I | cut -f1 -d' ')
|
||||
@@ -104,94 +94,141 @@ jobs:
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth"
|
||||
|
||||
- name: "Repository - AppContext06TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContextExtraTestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MiscContextTestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
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 -Dalfresco-pdf-renderer.url=http://localhost:8090/ -Djodconverter.url=http://localhost:8090/ -Dimg.url=http://localhost:8090/ -Dtika.url=http://localhost:8090/ -Dtransform.misc.url=http://localhost:8090/
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - SearchTestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=SearchTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6
|
||||
|
||||
- name: "Repository - MySQL tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 10 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 11 tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MariaDB tests"
|
||||
if: commit_message !~ /\[skip db\]/
|
||||
- name: "Repository - MariaDB 10.2.18 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Remote-api - AppContext01TestSuite"
|
||||
- name: "Repository - MariaDB 10.4 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.4 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MariaDB 10.5 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) 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.5 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver
|
||||
|
||||
- name: "Repository - MySQL 5.7.28 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.28 --transaction-isolation='READ-COMMITTED'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MySQL 8 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) 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
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 10.9 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 11.7 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 12.4 tests"
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:12.4 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - PostgreSQL 13.1 tests"
|
||||
# We only run DB tests on the latest version of PostgreSQL on feature branches
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext01TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext02TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext03TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.6
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext04TestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContextExtraTestSuite"
|
||||
if: commit_message !~ /\[skip repo\]/
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.15.8
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "REST API TAS tests part1"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
# TAS tests are generally skipped on feature branches as they will be repeated on the enterprise repo or community packaging builds
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -199,7 +236,7 @@ jobs:
|
||||
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "REST API TAS tests part2"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -207,7 +244,7 @@ jobs:
|
||||
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "REST API TAS tests part3"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -215,7 +252,7 @@ jobs:
|
||||
- travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "CMIS TAS tests - BROWSER binding"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -223,7 +260,7 @@ jobs:
|
||||
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-browser -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "CMIS TAS tests - ATOM binding"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -231,7 +268,7 @@ jobs:
|
||||
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-atom -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "CMIS TAS tests - WEBSERVICES binding"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -239,7 +276,7 @@ jobs:
|
||||
- travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-webservices -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "Email TAS tests"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -247,7 +284,7 @@ jobs:
|
||||
- travis_wait 30 mvn -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "WebDAV TAS tests"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
@@ -255,7 +292,7 @@ jobs:
|
||||
- travis_wait 30 mvn -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- name: "Integration TAS tests"
|
||||
if: branch = master OR commit_message =~ /\[tas\]/
|
||||
if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/
|
||||
before_script:
|
||||
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml
|
||||
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
|
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"generalSettings": {
|
||||
"shouldScanRepo": true
|
||||
},
|
||||
"checkRunSettings": {
|
||||
"vulnerableCheckRunConclusionLevel": "failure"
|
||||
}
|
||||
}
|
@@ -1,228 +0,0 @@
|
||||
####################################################################
|
||||
# WhiteSource Unified-Agent configuration file
|
||||
####################################################################
|
||||
##########################################
|
||||
# GENERAL SCAN MODE: Files and Package Managers
|
||||
##########################################
|
||||
|
||||
checkPolicies=true
|
||||
forceCheckAllDependencies=true
|
||||
forceUpdate=true
|
||||
forceUpdate.failBuildOnPolicyViolation=true
|
||||
offline=false
|
||||
#ignoreSourceFiles=true
|
||||
#scanComment=
|
||||
#updateInventory=false
|
||||
#resolveAllDependencies=false
|
||||
#failErrorLevel=ALL
|
||||
#requireKnownSha1=false
|
||||
#generateScanReport=true
|
||||
#scanReportTimeoutMinutes=10
|
||||
#excludeDependenciesFromNodes=.*commons-io.*,.*maven-model
|
||||
|
||||
#projectPerFolder=true
|
||||
#projectPerFolderIncludes=
|
||||
#projectPerFolderExcludes=
|
||||
|
||||
#wss.connectionTimeoutMinutes=60
|
||||
# Change the below URL to your WhiteSource server.
|
||||
# Use the 'WhiteSource Server URL' which can be retrieved
|
||||
# from your 'Profile' page on the 'Server URLs' panel.
|
||||
# Then, add the '/agent' path to it.
|
||||
wss.url=https://saas.whitesourcesoftware.com/agent
|
||||
|
||||
#npm.resolveDependencies=false
|
||||
#npm.ignoreSourceFiles=false
|
||||
#npm.includeDevDependencies=true
|
||||
#npm.runPreStep=true
|
||||
#npm.ignoreNpmLsErrors=true
|
||||
#npm.ignoreScripts=true
|
||||
#npm.yarnProject=true
|
||||
#npm.accessToken=
|
||||
#npm.identifyByNameAndVersion=true
|
||||
|
||||
#bower.resolveDependencies=false
|
||||
#bower.ignoreSourceFiles=true
|
||||
#bower.runPreStep=true
|
||||
|
||||
#nuget.resolvePackagesConfigFiles=false
|
||||
#nuget.resolveCsProjFiles=false
|
||||
#nuget.resolveDependencies=false
|
||||
#nuget.restoreDependencies=true
|
||||
#nuget.ignoreSourceFiles=true
|
||||
#nuget.runPreStep=true
|
||||
#nuget.resolveNuspecFiles=false
|
||||
|
||||
#python.resolveDependencies=false
|
||||
#python.ignoreSourceFiles=false
|
||||
#python.ignorePipInstallErrors=true
|
||||
#python.installVirtualenv=true
|
||||
#python.resolveHierarchyTree=false
|
||||
#python.requirementsFileIncludes=requirements.txt
|
||||
#python.resolveSetupPyFiles=true
|
||||
#python.runPipenvPreStep=true
|
||||
#python.pipenvDevDependencies=true
|
||||
#python.IgnorePipenvInstallErrors=true
|
||||
|
||||
#maven.ignoredScopes=test provided
|
||||
maven.resolveDependencies=true
|
||||
#maven.ignoreSourceFiles=true
|
||||
#maven.aggregateModules=true
|
||||
maven.ignorePomModules=false
|
||||
#maven.runPreStep=true
|
||||
#maven.ignoreMvnTreeErrors=true
|
||||
#maven.environmentPath=
|
||||
#maven.m2RepositoryPath=
|
||||
|
||||
#gradle.ignoredScopes=
|
||||
#gradle.resolveDependencies=false
|
||||
#gradle.runAssembleCommand=false
|
||||
#gradle.runPreStep=true
|
||||
#gradle.ignoreSourceFiles=true
|
||||
#gradle.aggregateModules=true
|
||||
#gradle.preferredEnvironment=wrapper
|
||||
#gradle.localRepositoryPath=
|
||||
|
||||
#paket.resolveDependencies=false
|
||||
#paket.ignoredGroups=
|
||||
#paket.ignoreSourceFiles=false
|
||||
#paket.runPreStep=true
|
||||
#paket.exePath=
|
||||
|
||||
#go.resolveDependencies=false
|
||||
#go.collectDependenciesAtRuntime=true
|
||||
#go.dependencyManager=
|
||||
#go.ignoreSourceFiles=true
|
||||
#go.glide.ignoreTestPackages=false
|
||||
#go.gogradle.enableTaskAlias=true
|
||||
|
||||
#ruby.resolveDependencies = false
|
||||
#ruby.ignoreSourceFiles = false
|
||||
#ruby.installMissingGems = true
|
||||
#ruby.runBundleInstall = true
|
||||
#ruby.overwriteGemFile = true
|
||||
|
||||
#sbt.resolveDependencies=false
|
||||
#sbt.ignoreSourceFiles=true
|
||||
#sbt.aggregateModules=true
|
||||
#sbt.runPreStep=true
|
||||
#sbt.targetFolder=
|
||||
|
||||
#php.resolveDependencies=false
|
||||
#php.runPreStep=true
|
||||
#php.includeDevDependencies=true
|
||||
|
||||
#html.resolveDependencies=false
|
||||
|
||||
#cocoapods.resolveDependencies=false
|
||||
#cocoapods.runPreStep=true
|
||||
#cocoapods.ignoreSourceFiles=false
|
||||
|
||||
#hex.resolveDependencies=false
|
||||
#hex.runPreStep=true
|
||||
#hex.ignoreSourceFiles=false
|
||||
#hex.aggregateModules=true
|
||||
|
||||
##################################
|
||||
# Organization tokens:
|
||||
##################################
|
||||
apiKey=
|
||||
|
||||
#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option
|
||||
#userKey=
|
||||
|
||||
projectName=alfresco-community-repo
|
||||
projectVersion=
|
||||
projectToken=
|
||||
|
||||
productName=ACS Community
|
||||
productVersion=
|
||||
productToken=
|
||||
#updateType=APPEND
|
||||
#requesterEmail=user@provider.com
|
||||
|
||||
#########################################################################################
|
||||
# Includes/Excludes Glob patterns - PLEASE USE ONLY ONE EXCLUDE LINE AND ONE INCLUDE LINE
|
||||
#########################################################################################
|
||||
#includes=**/*.c **/*.cc **/*.cp **/*.cpp **/*.cxx **/*.c++ **/*.h **/*.hpp **/*.hxx
|
||||
|
||||
#includes=**/*.m **/*.mm **/*.js **/*.php
|
||||
includes=**/*.jar
|
||||
#includes=**/*.gem **/*.rb
|
||||
#includes=**/*.dll **/*.cs **/*.nupkg
|
||||
#includes=**/*.tgz **/*.deb **/*.gzip **/*.rpm **/*.tar.bz2
|
||||
#includes=**/*.zip **/*.tar.gz **/*.egg **/*.whl **/*.py
|
||||
|
||||
## Exclude file extensions or specific directories by adding **/*.<extension> or **<excluded_dir>/**
|
||||
excludes=**/*sources.jar **/*javadoc.jar
|
||||
|
||||
case.sensitive.glob=false
|
||||
followSymbolicLinks=true
|
||||
|
||||
##################################
|
||||
# Archive properties
|
||||
##################################
|
||||
#archiveExtractionDepth=2
|
||||
#archiveIncludes=**/*.war **/*.ear
|
||||
#archiveExcludes=**/*sources.jar
|
||||
|
||||
##################################
|
||||
# Proxy settings
|
||||
##################################
|
||||
#proxy.host=
|
||||
#proxy.port=
|
||||
#proxy.user=
|
||||
#proxy.pass=
|
||||
|
||||
##################################
|
||||
# SCM settings
|
||||
##################################
|
||||
#scm.type=
|
||||
#scm.user=
|
||||
#scm.pass=
|
||||
#scm.ppk=
|
||||
#scm.url=
|
||||
#scm.branch=
|
||||
#scm.tag=
|
||||
#scm.npmInstall=
|
||||
#scm.npmInstallTimeoutMinutes=
|
||||
#scm.repositoriesFile=
|
||||
|
||||
##############################################
|
||||
# SCAN MODE: Linux package manager settings
|
||||
##############################################
|
||||
#scanPackageManager=true
|
||||
|
||||
##################################
|
||||
# SCAN MODE: Docker images
|
||||
##################################
|
||||
#docker.scanImages=true
|
||||
#docker.includes=.*.*
|
||||
#docker.excludes=
|
||||
#docker.pull.enable=true
|
||||
#docker.pull.images=.*.*
|
||||
#docker.pull.maxImages=10
|
||||
#docker.pull.tags=.*.*
|
||||
#docker.pull.digest=
|
||||
#docker.delete.force=true
|
||||
#docker.login.sudo=false
|
||||
|
||||
#docker.aws.enable=true
|
||||
#docker.aws.registryIds=
|
||||
|
||||
##################################
|
||||
# SCAN MODE: Docker containers
|
||||
##################################
|
||||
#docker.scanContainers=true
|
||||
#docker.containerIncludes=.*.*
|
||||
#docker.containerExcludes=
|
||||
|
||||
################################
|
||||
# Serverless settings
|
||||
################################
|
||||
#serverless.provider=
|
||||
#serverless.scanFunctions=true
|
||||
#serverless.includes=
|
||||
#serverless.excludes=
|
||||
#serverless.region=
|
||||
#serverless.maxFunctions=10
|
14
README.md
14
README.md
@@ -34,7 +34,7 @@ Repository is a library packaged as a jar file which contains the following:
|
||||
Tests are combined into test classes split by test type or Spring application context used in the test, see classes
|
||||
in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test
|
||||
class name and a set of DB connection properties. Check the travis.yml file for docker images that should be started
|
||||
to provide a sutable test environment. For example:
|
||||
to provide a suitable test environment. For example:
|
||||
~~~
|
||||
mvn clean test -Dtest=SomeRepoTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
~~~
|
||||
@@ -114,7 +114,7 @@ want to make changes to both of them if you are changing the repository code.
|
||||
|
||||
~~~
|
||||
mkdir work
|
||||
cd works
|
||||
cd work
|
||||
git clone git@github.com:Alfresco/alfresco-community-repo.git
|
||||
git clone git@github.com:Alfresco/acs-community-packaging.git
|
||||
~~~
|
||||
@@ -131,16 +131,6 @@ cd ..
|
||||
In Intellij IDEA, create a new project using the `work` directory as the source.
|
||||
* File > New Project from Existing Sources > .../work > Maven
|
||||
|
||||
## Docker
|
||||
We generally use Docker for testing. In order to reduce the size of images we also supply a squash option that collapses
|
||||
the layers in the image. This is a long-standing experimental feature that we have fould useful. However you will need
|
||||
to enable experimental features in your Docker Engine.
|
||||
~~~
|
||||
{
|
||||
"experimental": true,
|
||||
"debug": true
|
||||
}
|
||||
~~~
|
||||
## Branches
|
||||
As multiple projects have been combined, branch names use the ACS version they are targeting.
|
||||
For example the code used to create the repository in ACS 6.2.1 is a branch called `releases/6.2.1`.
|
||||
|
30
core/pom.xml
30
core/pom.xml
@@ -7,10 +7,25 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-jta_1.1_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
@@ -79,24 +94,11 @@
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-surf-core-configservice</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.guessencoding</groupId>
|
||||
<artifactId>guessencoding</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
|
@@ -21,7 +21,6 @@ package org.alfresco.httpclient;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.AlgorithmParameters;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -32,14 +31,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import org.alfresco.encryption.AlfrescoKeyStore;
|
||||
import org.alfresco.encryption.AlfrescoKeyStoreImpl;
|
||||
import org.alfresco.encryption.EncryptionUtils;
|
||||
import org.alfresco.encryption.Encryptor;
|
||||
import org.alfresco.encryption.KeyProvider;
|
||||
import org.alfresco.encryption.KeyResourceLoader;
|
||||
import org.alfresco.encryption.KeyStoreParameters;
|
||||
import org.alfresco.encryption.ssl.AuthSSLProtocolSocketFactory;
|
||||
import org.alfresco.encryption.ssl.SSLEncryptionParameters;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
|
||||
import org.apache.commons.httpclient.HostConfiguration;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
@@ -53,8 +49,6 @@ import org.apache.commons.httpclient.SimpleHttpConnectionManager;
|
||||
import org.apache.commons.httpclient.URI;
|
||||
import org.apache.commons.httpclient.URIException;
|
||||
import org.apache.commons.httpclient.cookie.CookiePolicy;
|
||||
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.params.DefaultHttpParams;
|
||||
import org.apache.commons.httpclient.params.DefaultHttpParamsFactory;
|
||||
import org.apache.commons.httpclient.params.HttpClientParams;
|
||||
@@ -75,23 +69,25 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class HttpClientFactory
|
||||
{
|
||||
/**
|
||||
* Communication type for HttpClient:
|
||||
* - NONE is plain http
|
||||
* - SECRET is plain http with a shared secret via request header
|
||||
* - HTTPS is mTLS with client authentication (certificates are required)
|
||||
*/
|
||||
public static enum SecureCommsType
|
||||
{
|
||||
HTTPS, NONE;
|
||||
HTTPS, NONE, SECRET;
|
||||
|
||||
public static SecureCommsType getType(String type)
|
||||
{
|
||||
if(type.equalsIgnoreCase("https"))
|
||||
switch (type.toLowerCase())
|
||||
{
|
||||
return HTTPS;
|
||||
}
|
||||
else if(type.equalsIgnoreCase("none"))
|
||||
{
|
||||
return NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid communications type");
|
||||
case "https": return HTTPS;
|
||||
case "none": return NONE;
|
||||
case "secret": return SECRET;
|
||||
default: throw new IllegalArgumentException("Invalid communications type");
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -122,14 +118,24 @@ public class HttpClientFactory
|
||||
|
||||
private int connectionTimeout = 0;
|
||||
|
||||
// Shared secret parameters
|
||||
private String sharedSecret;
|
||||
private String sharedSecretHeader = DEFAULT_SHAREDSECRET_HEADER;
|
||||
|
||||
// Default name for HTTP Request Header when using shared secret communication
|
||||
public static final String DEFAULT_SHAREDSECRET_HEADER = "X-Alfresco-Search-Secret";
|
||||
|
||||
public HttpClientFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor for legacy subsystems.
|
||||
*/
|
||||
public HttpClientFactory(SecureCommsType secureCommsType, SSLEncryptionParameters sslEncryptionParameters,
|
||||
KeyResourceLoader keyResourceLoader, KeyStoreParameters keyStoreParameters,
|
||||
MD5EncryptionParameters encryptionParameters, String host, int port, int sslPort, int maxTotalConnections,
|
||||
int maxHostConnections, int socketTimeout)
|
||||
KeyResourceLoader keyResourceLoader, KeyStoreParameters keyStoreParameters,
|
||||
MD5EncryptionParameters encryptionParameters, String host, int port, int sslPort,
|
||||
int maxTotalConnections, int maxHostConnections, int socketTimeout)
|
||||
{
|
||||
this.secureCommsType = secureCommsType;
|
||||
this.sslEncryptionParameters = sslEncryptionParameters;
|
||||
@@ -145,6 +151,21 @@ public class HttpClientFactory
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recommended constructor for subsystems supporting Shared Secret communication.
|
||||
* This constructor supports Shared Secret ("secret") communication method additionally to the legacy ones: "none" and "https".
|
||||
*/
|
||||
public HttpClientFactory(SecureCommsType secureCommsType, SSLEncryptionParameters sslEncryptionParameters,
|
||||
KeyResourceLoader keyResourceLoader, KeyStoreParameters keyStoreParameters,
|
||||
MD5EncryptionParameters encryptionParameters, String sharedSecret, String sharedSecretHeader,
|
||||
String host, int port, int sslPort, int maxTotalConnections, int maxHostConnections, int socketTimeout)
|
||||
{
|
||||
this(secureCommsType, sslEncryptionParameters, keyResourceLoader, keyStoreParameters, encryptionParameters,
|
||||
host, port, sslPort, maxTotalConnections, maxHostConnections, socketTimeout);
|
||||
this.sharedSecret = sharedSecret;
|
||||
this.sharedSecretHeader = sharedSecretHeader;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
this.sslKeyStore = new AlfrescoKeyStoreImpl(sslEncryptionParameters.getKeyStoreParameters(), keyResourceLoader);
|
||||
@@ -272,10 +293,44 @@ public class HttpClientFactory
|
||||
this.connectionTimeout = connectionTimeout;
|
||||
}
|
||||
|
||||
protected HttpClient constructHttpClient()
|
||||
/**
|
||||
* Shared secret used for SECRET communication
|
||||
* @param secret shared secret word
|
||||
*/
|
||||
public void setSharedSecret(String sharedSecret)
|
||||
{
|
||||
this.sharedSecret = sharedSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Shared secret used for SECRET communication
|
||||
*/
|
||||
public String getSharedSecret()
|
||||
{
|
||||
return sharedSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP Request header used for SECRET communication
|
||||
* @param sharedSecretHeader HTTP Request header
|
||||
*/
|
||||
public void setSharedSecretHeader(String sharedSecretHeader)
|
||||
{
|
||||
this.sharedSecretHeader = sharedSecretHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HTTP Request header used for SECRET communication
|
||||
*/
|
||||
public String getSharedSecretHeader()
|
||||
{
|
||||
return sharedSecretHeader;
|
||||
}
|
||||
|
||||
protected RequestHeadersHttpClient constructHttpClient()
|
||||
{
|
||||
MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
|
||||
HttpClient httpClient = new HttpClient(connectionManager);
|
||||
RequestHeadersHttpClient httpClient = new RequestHeadersHttpClient(connectionManager);
|
||||
HttpClientParams params = httpClient.getParams();
|
||||
params.setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true);
|
||||
params.setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, true);
|
||||
@@ -291,15 +346,15 @@ public class HttpClientFactory
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
protected HttpClient getHttpsClient()
|
||||
protected RequestHeadersHttpClient getHttpsClient()
|
||||
{
|
||||
return getHttpsClient(host, sslPort);
|
||||
}
|
||||
|
||||
protected HttpClient getHttpsClient(String httpsHost, int httpsPort)
|
||||
protected RequestHeadersHttpClient getHttpsClient(String httpsHost, int httpsPort)
|
||||
{
|
||||
// Configure a custom SSL socket factory that will enforce mutual authentication
|
||||
HttpClient httpClient = constructHttpClient();
|
||||
RequestHeadersHttpClient httpClient = constructHttpClient();
|
||||
// Default port is 443 for the HostFactory, when including customised port (like 8983) the port name is skipped from "getHostURL" string
|
||||
HttpHostFactory hostFactory = new HttpHostFactory(new Protocol("https", sslSocketFactory, HttpsURL.DEFAULT_PORT));
|
||||
httpClient.setHostConfiguration(new HostConfigurationWithHostFactory(hostFactory));
|
||||
@@ -307,28 +362,54 @@ public class HttpClientFactory
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
protected HttpClient getDefaultHttpClient()
|
||||
protected RequestHeadersHttpClient getDefaultHttpClient()
|
||||
{
|
||||
return getDefaultHttpClient(host, port);
|
||||
}
|
||||
|
||||
protected HttpClient getDefaultHttpClient(String httpHost, int httpPort)
|
||||
protected RequestHeadersHttpClient getDefaultHttpClient(String httpHost, int httpPort)
|
||||
{
|
||||
HttpClient httpClient = constructHttpClient();
|
||||
RequestHeadersHttpClient httpClient = constructHttpClient();
|
||||
httpClient.getHostConfiguration().setHost(httpHost, httpPort);
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build HTTP Client using default headers
|
||||
* @return RequestHeadersHttpClient including default header for shared secret method
|
||||
*/
|
||||
protected RequestHeadersHttpClient constructSharedSecretHttpClient()
|
||||
{
|
||||
RequestHeadersHttpClient client = constructHttpClient();
|
||||
client.setDefaultHeaders(Map.of(sharedSecretHeader, sharedSecret));
|
||||
return client;
|
||||
}
|
||||
|
||||
protected RequestHeadersHttpClient getSharedSecretHttpClient()
|
||||
{
|
||||
return getSharedSecretHttpClient(host, port);
|
||||
}
|
||||
|
||||
protected RequestHeadersHttpClient getSharedSecretHttpClient(String httpHost, int httpPort)
|
||||
{
|
||||
RequestHeadersHttpClient httpClient = constructSharedSecretHttpClient();
|
||||
httpClient.getHostConfiguration().setHost(httpHost, httpPort);
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
protected AlfrescoHttpClient getAlfrescoHttpsClient()
|
||||
{
|
||||
AlfrescoHttpClient repoClient = new HttpsClient(getHttpsClient());
|
||||
return repoClient;
|
||||
return new HttpsClient(getHttpsClient());
|
||||
}
|
||||
|
||||
protected AlfrescoHttpClient getAlfrescoHttpClient()
|
||||
{
|
||||
AlfrescoHttpClient repoClient = new DefaultHttpClient(getDefaultHttpClient());
|
||||
return repoClient;
|
||||
return new DefaultHttpClient(getDefaultHttpClient());
|
||||
}
|
||||
|
||||
protected AlfrescoHttpClient getAlfrescoSharedSecretClient()
|
||||
{
|
||||
return new DefaultHttpClient(getSharedSecretHttpClient());
|
||||
}
|
||||
|
||||
protected HttpClient getMD5HttpClient(String host, int port)
|
||||
@@ -341,66 +422,37 @@ public class HttpClientFactory
|
||||
|
||||
public AlfrescoHttpClient getRepoClient(String host, int port)
|
||||
{
|
||||
AlfrescoHttpClient repoClient = null;
|
||||
|
||||
if(secureCommsType == SecureCommsType.HTTPS)
|
||||
switch (secureCommsType)
|
||||
{
|
||||
repoClient = getAlfrescoHttpsClient();
|
||||
case HTTPS: return getAlfrescoHttpsClient();
|
||||
case NONE: return getAlfrescoHttpClient();
|
||||
case SECRET: return getAlfrescoSharedSecretClient();
|
||||
default: throw new AlfrescoRuntimeException("Invalid Solr secure communications type configured in [solr|alfresco].secureComms, should be 'ssl', 'none' or 'secret'");
|
||||
}
|
||||
else if(secureCommsType == SecureCommsType.NONE)
|
||||
}
|
||||
|
||||
public RequestHeadersHttpClient getHttpClient()
|
||||
{
|
||||
switch (secureCommsType)
|
||||
{
|
||||
repoClient = getAlfrescoHttpClient();
|
||||
case HTTPS: return getHttpsClient();
|
||||
case NONE: return getDefaultHttpClient();
|
||||
case SECRET: return getSharedSecretHttpClient();
|
||||
default: throw new AlfrescoRuntimeException("Invalid Solr secure communications type configured in [solr|alfresco].secureComms, should be 'ssl', 'none' or 'secret'");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid Solr secure communications type configured in alfresco.secureComms, should be 'ssl'or 'none'");
|
||||
}
|
||||
|
||||
return repoClient;
|
||||
}
|
||||
|
||||
public HttpClient getHttpClient()
|
||||
public RequestHeadersHttpClient getHttpClient(String host, int port)
|
||||
{
|
||||
HttpClient httpClient = null;
|
||||
|
||||
if(secureCommsType == SecureCommsType.HTTPS)
|
||||
switch (secureCommsType)
|
||||
{
|
||||
httpClient = getHttpsClient();
|
||||
case HTTPS: return getHttpsClient(host, port);
|
||||
case NONE: return getDefaultHttpClient(host, port);
|
||||
case SECRET: return getSharedSecretHttpClient(host, port);
|
||||
default: throw new AlfrescoRuntimeException("Invalid Solr secure communications type configured in [solr|alfresco].secureComms, should be 'ssl', 'none' or 'secret'");
|
||||
}
|
||||
else if(secureCommsType == SecureCommsType.NONE)
|
||||
{
|
||||
httpClient = getDefaultHttpClient();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid Solr secure communications type configured in alfresco.secureComms, should be 'ssl'or 'none'");
|
||||
}
|
||||
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
public HttpClient getHttpClient(String host, int port)
|
||||
{
|
||||
HttpClient httpClient = null;
|
||||
|
||||
if(secureCommsType == SecureCommsType.HTTPS)
|
||||
{
|
||||
httpClient = getHttpsClient(host, port);
|
||||
}
|
||||
else if(secureCommsType == SecureCommsType.NONE)
|
||||
{
|
||||
httpClient = getDefaultHttpClient(host, port);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid Solr secure communications type configured in alfresco.secureComms, should be 'ssl'or 'none'");
|
||||
}
|
||||
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A secure client connection to the repository.
|
||||
*
|
||||
|
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2021 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.httpclient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.httpclient.HostConfiguration;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
import org.apache.commons.httpclient.HttpState;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
|
||||
/**
|
||||
* Since Apache HttpClient 3.1 doesn't support including custom headers by default,
|
||||
* this class is adding that custom headers every time a method is invoked.
|
||||
*/
|
||||
public class RequestHeadersHttpClient extends HttpClient
|
||||
{
|
||||
|
||||
private Map<String, String> defaultHeaders;
|
||||
|
||||
public RequestHeadersHttpClient(MultiThreadedHttpConnectionManager connectionManager)
|
||||
{
|
||||
super(connectionManager);
|
||||
}
|
||||
|
||||
public Map<String, String> getDefaultHeaders()
|
||||
{
|
||||
return defaultHeaders;
|
||||
}
|
||||
|
||||
public void setDefaultHeaders(Map<String, String> defaultHeaders)
|
||||
{
|
||||
this.defaultHeaders = defaultHeaders;
|
||||
}
|
||||
|
||||
private void addDefaultHeaders(HttpMethod method)
|
||||
{
|
||||
if (defaultHeaders != null)
|
||||
{
|
||||
defaultHeaders.forEach((k,v) -> {
|
||||
method.addRequestHeader(k, v);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeMethod(HttpMethod method) throws IOException, HttpException
|
||||
{
|
||||
addDefaultHeaders(method);
|
||||
return super.executeMethod(method);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeMethod(HostConfiguration hostConfiguration, HttpMethod method) throws IOException, HttpException
|
||||
{
|
||||
addDefaultHeaders(method);
|
||||
return super.executeMethod(hostConfiguration, method);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeMethod(HostConfiguration hostconfig, HttpMethod method, HttpState state)
|
||||
throws IOException, HttpException
|
||||
{
|
||||
addDefaultHeaders(method);
|
||||
return super.executeMethod(hostconfig, method, state);
|
||||
}
|
||||
|
||||
}
|
@@ -113,7 +113,7 @@ public abstract class AbstractCannedQuery<R> implements CannedQuery<R>
|
||||
final List<List<R>> finalPages = pages;
|
||||
|
||||
// Has more items beyond requested pages ? ... ie. at least one more page (with at least one result)
|
||||
final boolean hasMoreItems = (rawResults.size() > pagingDetails.getResultsRequiredForPaging());
|
||||
final boolean hasMoreItems = (rawResults.size() > pagingDetails.getResultsRequiredForPaging()) || (totalCount.getFirst() > pagingDetails.getResultsRequiredForPaging());
|
||||
|
||||
results = new CannedQueryResults<R>()
|
||||
{
|
||||
|
@@ -24,8 +24,10 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -348,6 +350,17 @@ public class TempFileProvider
|
||||
{
|
||||
public static final String KEY_PROTECT_HOURS = "protectHours";
|
||||
public static final String KEY_DIRECTORY_NAME = "directoryName";
|
||||
public static final String KEY_MAX_FILES_TO_DELETE = "maxFilesToDelete";
|
||||
public static final String KEY_MAX_TIME_TO_RUN = "maxTimeToRun";
|
||||
|
||||
/** The time when the job has actually started */
|
||||
private static long jobStartTime;
|
||||
|
||||
/** The maximum number of files that can be deleted when the cleaning jobs runs */
|
||||
private static AtomicLong maxFilesToDelete;
|
||||
|
||||
/** The maximum time allowed for the cleaning job to run */
|
||||
private static Duration maxTimeToRun;
|
||||
|
||||
/**
|
||||
* Gets a list of all files in the {@link TempFileProvider#ALFRESCO_TEMP_FILE_DIR temp directory}
|
||||
@@ -376,24 +389,59 @@ public class TempFileProvider
|
||||
}
|
||||
|
||||
String directoryName = (String) context.getJobDetail().getJobDataMap().get(KEY_DIRECTORY_NAME);
|
||||
|
||||
try
|
||||
{
|
||||
final Object oMaxFilesToDelete = context.getJobDetail().getJobDataMap().get(KEY_MAX_FILES_TO_DELETE);
|
||||
if (oMaxFilesToDelete != null)
|
||||
{
|
||||
final String strMaxFilesToDelete = (String) oMaxFilesToDelete;
|
||||
maxFilesToDelete = new AtomicLong(Long.parseLong(strMaxFilesToDelete));
|
||||
logger.debug("Set the maximum number of temp files to be deleted to: " + maxFilesToDelete.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug("No maximum number of files was configured for the temp file clean job.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.warn(e);
|
||||
throw new JobExecutionException("Invalid job data, maxFilesToDelete");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final Object oMaxTimeToRun = context.getJobDetail().getJobDataMap().get(KEY_MAX_TIME_TO_RUN);
|
||||
if (oMaxTimeToRun != null)
|
||||
{
|
||||
final String strMaxTimeToRun = (String) oMaxTimeToRun;
|
||||
maxTimeToRun = Duration.parse(strMaxTimeToRun);
|
||||
logger.debug("Set the maximum duration time of the temp file clean job to: " + maxTimeToRun);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug("No maximum duration was configured for the temp file clean job.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.warn(e);
|
||||
throw new JobExecutionException("Invalid job data, maxTimeToRun");
|
||||
}
|
||||
|
||||
if (directoryName == null)
|
||||
{
|
||||
directoryName = ALFRESCO_TEMP_FILE_DIR;
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
long aFewHoursBack = now - (3600L * 1000L * protectHours);
|
||||
|
||||
long aLongTimeBack = now - (24 * 3600L * 1000L);
|
||||
jobStartTime = System.currentTimeMillis();
|
||||
long aFewHoursBack = jobStartTime - (3600L * 1000L * protectHours);
|
||||
long aLongTimeBack = jobStartTime - (24 * 3600L * 1000L);
|
||||
|
||||
File tempDir = TempFileProvider.getTempDir(directoryName);
|
||||
int count = removeFiles(tempDir, aFewHoursBack, aLongTimeBack, false); // don't delete this directory
|
||||
// done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Removed " + count + " files from temp directory: " + tempDir);
|
||||
}
|
||||
logger.debug("Removed " + count + " files from temp directory: " + tempDir);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -429,29 +477,23 @@ public class TempFileProvider
|
||||
}
|
||||
// list all files
|
||||
File[] files = directory.listFiles();
|
||||
File[] filesToIterate = files != null ? files : new File[0];
|
||||
int count = 0;
|
||||
for (File file : files)
|
||||
for (File file : filesToIterate)
|
||||
{
|
||||
if (shouldTheDeletionStop())
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (file.isDirectory())
|
||||
{
|
||||
if(isLongLifeTempDir(file))
|
||||
{
|
||||
// long life for this folder and its children
|
||||
int countRemoved = removeFiles(file, longLifeBefore, longLifeBefore, true);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Removed " + countRemoved + " files from temp directory: " + file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// enter subdirectory and clean it out and remove itsynetics
|
||||
int countRemoved = removeFiles(file, removeBefore, longLifeBefore, true);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Removed " + countRemoved + " files from directory: " + file);
|
||||
}
|
||||
}
|
||||
// long life for this folder and its children
|
||||
// OR
|
||||
// enter subdirectory and clean it out and remove itsynetics
|
||||
int countRemoved = removeFiles(file,
|
||||
isLongLifeTempDir(file) ? longLifeBefore : removeBefore, longLifeBefore,
|
||||
true);
|
||||
logger.debug("Removed " + countRemoved + " files from " + (isLongLifeTempDir(file) ? "temp " : " ") + "directory: " + file);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -464,11 +506,19 @@ public class TempFileProvider
|
||||
// it is a file - attempt a delete
|
||||
try
|
||||
{
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Deleting temp file: " + file);
|
||||
}
|
||||
logger.debug("Deleting temp file: " + file);
|
||||
file.delete();
|
||||
|
||||
if (maxFilesToDelete != null)
|
||||
{
|
||||
maxFilesToDelete.decrementAndGet();
|
||||
logger.debug(maxFilesToDelete.get() + " files left to delete.");
|
||||
}
|
||||
if (maxTimeToRun != null)
|
||||
{
|
||||
logger.debug((jobStartTime + maxTimeToRun.toMillis() - System.currentTimeMillis()) + " millis left to delete.");
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
catch (Throwable e)
|
||||
@@ -487,10 +537,8 @@ public class TempFileProvider
|
||||
if(listing != null && listing.length == 0)
|
||||
{
|
||||
// directory is empty
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Deleting empty directory: " + directory);
|
||||
}
|
||||
logger.debug("Deleting empty directory: " + directory);
|
||||
// ignore the limits for empty directories that just need cleanup
|
||||
directory.delete();
|
||||
}
|
||||
}
|
||||
@@ -499,8 +547,21 @@ public class TempFileProvider
|
||||
logger.info("Failed to remove temp directory: " + directory, e);
|
||||
}
|
||||
}
|
||||
// done
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides whether or not the job should continue iterating through the temp files and delete.
|
||||
* It achieves the result by checking the number of files deleted against the limit and whether
|
||||
* or not it is within the time limit
|
||||
*
|
||||
* @return true or false
|
||||
*/
|
||||
private static boolean shouldTheDeletionStop()
|
||||
{
|
||||
return maxFilesToDelete != null && maxFilesToDelete.get() <= 0
|
||||
|| maxTimeToRun != null && ((jobStartTime + maxTimeToRun.toMillis()) < System
|
||||
.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -424,12 +424,7 @@ public abstract class AbstractAsynchronouslyRefreshedCache<T>
|
||||
@Override
|
||||
public Void call()
|
||||
{
|
||||
long threadId = Thread.currentThread().getId();
|
||||
logger.debug("Thread # " + threadId + "-> call()");
|
||||
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().lock()");
|
||||
liveLock.writeLock().lock();
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().locked [");
|
||||
liveLock.writeLock().lock();
|
||||
try
|
||||
{
|
||||
doCall();
|
||||
@@ -452,9 +447,7 @@ public abstract class AbstractAsynchronouslyRefreshedCache<T>
|
||||
}
|
||||
finally
|
||||
{
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().unlock()");
|
||||
liveLock.writeLock().unlock();
|
||||
logger.debug("Thread # " + threadId + "call()->liveLock.writeLock().unlocked]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,10 @@
|
||||
*/
|
||||
package org.alfresco.util.transaction;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.transaction.HeuristicMixedException;
|
||||
import javax.transaction.HeuristicRollbackException;
|
||||
@@ -135,7 +138,9 @@ public class SpringAwareUserTransaction
|
||||
private long threadId = Long.MIN_VALUE;
|
||||
/** make sure that we clean up the thread transaction stack properly */
|
||||
private boolean finalized = false;
|
||||
|
||||
|
||||
private Collection<String> labels = emptyList();
|
||||
|
||||
/**
|
||||
* Creates a user transaction that defaults to {@link TransactionDefinition#PROPAGATION_REQUIRED}.
|
||||
*
|
||||
@@ -200,6 +205,21 @@ public class SpringAwareUserTransaction
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate one or more labels with this transaction attribute.
|
||||
* <p>This may be used for applying specific transactional behavior
|
||||
* or follow a purely descriptive nature.
|
||||
*/
|
||||
public void setLabels(Collection<String> labels) {
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getLabels()
|
||||
{
|
||||
return this.labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link UserTransaction } must rollback regardless of the error. The
|
||||
* {@link #rollback() rollback} behaviour is implemented by simulating a caught
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -127,9 +127,28 @@
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
| compile dependencies
|
||||
-->
|
||||
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces com.sun.activation:javax.activation -->
|
||||
<dependency>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>jakarta.activation</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces javax.annotation:javax.annotation-api -->
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jibx</groupId>
|
||||
<artifactId>jibx-run</artifactId>
|
||||
@@ -148,31 +167,9 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>5.0.3</version>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces org.apache.geronimo.specs:geronimo-jta_1.1_spec -->
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces javax.annotation:javax.annotation-api -->
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
<!-- REPO-5047 - Replaces com.sun.activation:javax.activation -->
|
||||
<dependency>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>jakarta.activation</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>6.2.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- the cxf libs were updated, see dependencyManagement section -->
|
||||
<dependency>
|
||||
<groupId>org.apache.chemistry.opencmis</groupId>
|
||||
@@ -266,15 +263,6 @@
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicate classes from com.sun.xml.bind:jaxb-core-->
|
||||
<exclusion>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>txw2</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.istack</groupId>
|
||||
<artifactId>istack-commons-runtime</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.jws:jakarta.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
@@ -295,6 +283,31 @@
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>javax.activation</artifactId>
|
||||
</exclusion>
|
||||
<!-- No longer needed -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox-tools</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>preflight</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>jempbox</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>xmpbox</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>jbig2-imageio</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
@@ -662,7 +662,6 @@ public class MimetypeMap implements MimetypeService
|
||||
boolean successReadingConfig = true;
|
||||
if (jsonConfigFileFinder != null)
|
||||
{
|
||||
// This should not be "alfresco/mimetype" which is used for the in JVM jodconverter
|
||||
successReadingConfig &= jsonConfigFileFinder.readFiles("alfresco/mimetypes", logger);
|
||||
if (mimetypeJsonConfigDir != null && !mimetypeJsonConfigDir.isBlank())
|
||||
{
|
||||
@@ -877,11 +876,6 @@ public class MimetypeMap implements MimetypeService
|
||||
*/
|
||||
private MediaType detectType(String filename, ContentReader reader)
|
||||
{
|
||||
// Metadata metadata = new Metadata();
|
||||
// if (filename != null)
|
||||
// {
|
||||
// metadata.add(Metadata.RESOURCE_NAME_KEY, filename);
|
||||
// }
|
||||
TikaInputStream inp = null;
|
||||
try
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -33,8 +33,7 @@ import org.alfresco.api.AlfrescoPublicApi;
|
||||
* same action might succeed, all other things not having changed.
|
||||
* <p/>
|
||||
* An example of this would be the case where a request to create a thumbnail
|
||||
* has failed because the necessary thumbnailing software is not available e.g. because the OpenOffice.org process
|
||||
* is not currently running.
|
||||
* has failed because the necessary thumbnailing software is not available.
|
||||
*
|
||||
* @author Neil Mc Erlean
|
||||
* @since 4.0.1
|
||||
|
@@ -100,26 +100,25 @@ public abstract class BaseApplicationContextHelper
|
||||
classpath[i] = resources[i].getURL();
|
||||
}
|
||||
// Let's give our classloader 'child-first' resource loading qualities!
|
||||
ClassLoader classLoader = new URLClassLoader(classpath, Thread.currentThread().getContextClassLoader())
|
||||
{
|
||||
@Override
|
||||
public URL getResource(String name)
|
||||
{
|
||||
URL ret = findResource(name);
|
||||
return ret == null ? super.getResource(name) : ret;
|
||||
}
|
||||
return new URLClassLoader(classpath, Thread.currentThread().getContextClassLoader())
|
||||
{
|
||||
@Override
|
||||
public URL getResource(String name)
|
||||
{
|
||||
URL ret = findResource(name);
|
||||
return ret == null ? super.getResource(name) : ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enumeration<URL> getResources(String name) throws IOException
|
||||
{
|
||||
Enumeration[] tmp = new Enumeration[2];
|
||||
tmp[0] = findResources(name);
|
||||
tmp[1] = super.getResources(name);
|
||||
return new CompoundEnumeration<URL>(tmp);
|
||||
}
|
||||
};
|
||||
return classLoader;
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enumeration<URL> getResources(String name) throws IOException
|
||||
{
|
||||
Enumeration[] tmp = new Enumeration[2];
|
||||
tmp[0] = findResources(name);
|
||||
tmp[1] = super.getResources(name);
|
||||
return new CompoundEnumeration<URL>(tmp);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 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
|
||||
@@ -57,12 +57,18 @@ public abstract class ConfigScheduler<Data>
|
||||
public static class ConfigSchedulerJob implements Job
|
||||
{
|
||||
@Override
|
||||
// Synchronized has little effect in normal operation, but on laptops that are suspended, there can be a number
|
||||
// of Threads calling execute concurrently without it, resulting in errors in the log. Theoretically possible in
|
||||
// production but not very likely.
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException
|
||||
{
|
||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||
ConfigScheduler configScheduler = (ConfigScheduler)dataMap.get(CONFIG_SCHEDULER);
|
||||
boolean successReadingConfig = configScheduler.readConfigAndReplace(true);
|
||||
configScheduler.changeScheduleOnStateChange(successReadingConfig);
|
||||
synchronized (configScheduler)
|
||||
{
|
||||
boolean successReadingConfig = configScheduler.readConfigAndReplace(true);
|
||||
configScheduler.changeScheduleOnStateChange(successReadingConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -1,110 +0,0 @@
|
||||
The authoritative ImageMagick license can be found at
|
||||
http://www.imagemagick.org/script/license.php and ImageMagick notices at
|
||||
http://www.imagemagick.org/www/Notice.html.
|
||||
|
||||
Before we get to the text of the license, lets just review what the license says in simple terms:
|
||||
|
||||
It allows you to:
|
||||
|
||||
* freely download and use ImageMagick software, in whole or in part, for personal, company internal, or commercial purposes;
|
||||
* use ImageMagick software in packages or distributions that you create;
|
||||
* link against a library under a different license;
|
||||
* link code under a different license against a library under this license;
|
||||
* merge code into a work under a different license;
|
||||
* extend patent grants to any code using code under this license;
|
||||
*and extend patent protection.
|
||||
|
||||
It forbids you to:
|
||||
|
||||
* redistribute any piece of ImageMagick-originated software without proper attribution;
|
||||
* use any marks owned by ImageMagick Studio LLC in any way that might state or imply that ImageMagick Studio LLC endorses your distribution;
|
||||
* use any marks owned by ImageMagick Studio LLC in any way that might state or imply that you created the ImageMagick software in question.
|
||||
|
||||
It requires you to:
|
||||
|
||||
* include a copy of the license in any redistribution you may make that includes ImageMagick software;
|
||||
* provide clear attribution to ImageMagick Studio LLC for any distributions that include ImageMagick software.
|
||||
|
||||
It does not require you to:
|
||||
|
||||
* include the source of the ImageMagick software itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it;
|
||||
* submit changes that you make to the software back to the ImageMagick Studio LLC (though such feedback is encouraged).
|
||||
|
||||
A few other clarifications include:
|
||||
* ImageMagick is freely available without charge;
|
||||
* you may include ImageMagick on any digital media as long as you comply with the terms of the license;
|
||||
* you can give modified code away for free or sell it under the terms of the ImageMagick license or distribute the result under a different license, but you need to acknowledge the use of the ImageMagick software;
|
||||
* the license is compatible with the GPL V3.
|
||||
* when exporting the ImageMagick software, review its export classification.
|
||||
|
||||
Terms and Conditions for Use, Reproduction, and Distribution
|
||||
|
||||
The legally binding and authoritative terms and conditions for use, reproduction, and distribution of ImageMagick follow:
|
||||
|
||||
Copyright © 1999-2018 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available.
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
a. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
b. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
c. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
d. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
How to Apply the License to your Work
|
||||
|
||||
To apply the ImageMagick License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information (don't include the brackets). The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the ImageMagick License (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy
|
||||
of the License at
|
||||
|
||||
https://www.imagemagick.org/script/license.php
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
File diff suppressed because it is too large
Load Diff
@@ -45,7 +45,6 @@ commons-pool http://jakarta.apache.org/commons/
|
||||
commons-validator http://jakarta.apache.org/commons/
|
||||
ConcurrentLinkedHashMap http://code.google.com/p/concurrentlinkedhashmap/
|
||||
Fast Infoset Project http://fi.java.net/
|
||||
PDFBox http://pdfbox.apache.org/
|
||||
Google Data Java Client Library http://code.google.com/p/gdata-java-client/
|
||||
Geronimo Activation http://geronimo.apache.org/
|
||||
Geronimo Annotation http://geronimo.apache.org/
|
||||
@@ -191,10 +190,6 @@ truezip http://truezip.java.net/
|
||||
icu4j http://icu-project.org/
|
||||
|
||||
|
||||
=== Imagemagick ===
|
||||
Imagemagick http://www.imagemagick.org/script/license.php
|
||||
|
||||
|
||||
=== JSON license ===
|
||||
JSon http://www.json.org/java/
|
||||
|
||||
@@ -211,16 +206,11 @@ libwmf http://wvware.sourceforge.net/libwmf.html
|
||||
=== LGPL 2.1 ===
|
||||
Hibernate http://www.hibernate.org/
|
||||
jid3lib http://javamusictag.sourceforge.net/
|
||||
JMagick http://sourceforge.net/projects/jmagick/
|
||||
JODConverter http://jodconverter.sourceforge.net/
|
||||
PDF Renderer http://java.net/projects/pdf-renderer
|
||||
TinyMCE http://www.tinymce.com/
|
||||
|
||||
|
||||
=== LGPL 3.0 ===
|
||||
Gytheio https://github.com/Alfresco/gytheio
|
||||
Jut.jar http://www.openoffice.org/licenses/lgpl_license.html
|
||||
OpenOffice SDK http://www.openoffice.org/licenses/lgpl_license.html
|
||||
|
||||
|
||||
=== MIT License ===
|
||||
@@ -243,7 +233,6 @@ juniversalchardet http://code.google.com/p/juniversalchardet/
|
||||
=== Mozilla Public License 2.0 ===
|
||||
CCC2 http://www.webdetails.pt/ctools/ccc/
|
||||
rhino-js http://www.mozilla.org/rhino/
|
||||
LibreOffice http://www.libreoffice.org/
|
||||
|
||||
|
||||
=== Oracle Binary Code License ===
|
||||
@@ -279,7 +268,6 @@ The svn diff files with the details of the changes can be found in the following
|
||||
=== Apache 2.0 License ====
|
||||
acegi http://sourceforge.net/projects/acegisecurity/
|
||||
commons-dbcp http://jakarta.apache.org/commons/
|
||||
PDFBox http://pdfbox.apache.org/
|
||||
Greenmail http://www.icegreen.com/greenmail/
|
||||
POI http://poi.apache.org/
|
||||
quartz http://quartz-scheduler.org/
|
||||
@@ -297,12 +285,9 @@ TrueLicense http://truelicense.java.net/
|
||||
|
||||
=== LGPL 2.1 ===
|
||||
Hibernate http://www.hibernate.org/
|
||||
JODConverter http://jodconverter.sourceforge.net/
|
||||
PDF Renderer http://java.net/projects/pdf-renderer
|
||||
TinyMCE http://www.tinymce.com/
|
||||
|
||||
=== LGPL 3.0 ===
|
||||
Jut.jar http://www.openoffice.org/licenses/lgpl_license.html
|
||||
|
||||
=== Mozilla Public License 2.0 ===
|
||||
rhino-js http://www.mozilla.org/rhino/
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Fetch image based on Tomcat 8.5 and Java 11
|
||||
# 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:8.5.51-java-11-openjdk-centos-7
|
||||
FROM alfresco/alfresco-base-tomcat:9.0.52-java-11-centos-7
|
||||
|
||||
# Set default docker_context.
|
||||
ARG resource_path=target
|
||||
@@ -68,8 +68,8 @@ RUN sed -i -e "s_log4j.appender.File.File\=alfresco.log_log4j.appender.File.File
|
||||
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-12.el7 \
|
||||
libpng-1.5.13-7.el7_2 \
|
||||
freetype-2.8-14.el7_9.1 \
|
||||
libpng-1.5.13-8.el7 \
|
||||
dejavu-sans-fonts-2.33-6.el7 && \
|
||||
yum clean all
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -134,17 +134,11 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
@@ -169,29 +163,17 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<images>
|
||||
<!-- Quay image -->
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<registry>${image.registry}</registry>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
<!-- DockerHub image -->
|
||||
<image>
|
||||
<name>${image.name}:${image.tag}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
<buildOptions>
|
||||
<squash>true</squash>
|
||||
</buildOptions>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<profiles>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.3.6
|
||||
SOLR6_TAG=2.0.1
|
||||
POSTGRES_TAG=11.7
|
||||
ACTIVEMQ_TAG=5.15.8
|
||||
TRANSFORMERS_TAG=2.4.0
|
||||
SOLR6_TAG=2.0.2-RC2
|
||||
POSTGRES_TAG=13.1
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -38,13 +38,8 @@ services:
|
||||
-Dftp.dataPortTo=30099
|
||||
-Dshare.host=localhost
|
||||
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
|
||||
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
-Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
|
||||
-Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/
|
||||
-Djodconverter.url=http://transform-core-aio:8090/
|
||||
-Dimg.url=http://transform-core-aio:8090/
|
||||
-Dtika.url=http://transform-core-aio:8090/
|
||||
-Dtransform.misc.url=http://transform-core-aio:8090/
|
||||
-Dimap.server.port=1143
|
||||
-Dftp.port=1221
|
||||
-Dcors.enabled=true
|
||||
|
@@ -38,7 +38,7 @@ services:
|
||||
-Dftp.dataPortTo=30099
|
||||
-Dshare.host=localhost
|
||||
-Daos.baseUrlOverwrite=http://localhost:8082/alfresco/aos
|
||||
-Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
-Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
-Dlocal.transform.service.enabled=false
|
||||
-Dlegacy.transform.service.enabled=false
|
||||
-Dimap.server.port=1143
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -39,16 +39,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>javax.mail-api</artifactId>
|
||||
<version>${dependency.javax.mail.version}</version>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>${dependency.javax.mail.version}</version>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -95,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
@@ -59,7 +59,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.json</artifactId>
|
||||
<artifactId>jakarta.json</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -0,0 +1,54 @@
|
||||
package org.alfresco.rest.models.aspects;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestAspectModel;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetAspectTests extends RestTest
|
||||
{
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent aspect and status code is Not Found (404)")
|
||||
public void getInexistentAspect() throws Exception
|
||||
{
|
||||
String unknownAspect = "unknown:aspect";
|
||||
restClient.withModelAPI().getAspect(unknownAspect);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, unknownAspect));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Aspect Info and status code is OK (200)")
|
||||
public void getAspect() throws Exception
|
||||
{
|
||||
RestAspectModel aspect = restClient.withModelAPI().getAspect("cm:titled");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspect.assertThat().field("associations").isEmpty().and()
|
||||
.field("mandatoryAspects").isEmpty().and()
|
||||
.field("properties").isNotEmpty().and()
|
||||
.field("includedInSupertypeQuery").is(true).and()
|
||||
.field("isContainer").is(false).and()
|
||||
.field("id").is("cm:titled").and()
|
||||
.field("description").is("Titled").and()
|
||||
.field("title").is("Titled").and()
|
||||
.field("model.id").is("cm:contentmodel").and()
|
||||
.field("model.author").is("Alfresco").and()
|
||||
.field("model.description").is("Alfresco Content Domain Model").and()
|
||||
.field("model.namespaceUri").is("http://www.alfresco.org/model/content/1.0").and()
|
||||
.field("model.namespacePrefix").is("cm");
|
||||
}
|
||||
}
|
@@ -0,0 +1,199 @@
|
||||
package org.alfresco.rest.models.aspects;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestAbstractClassModel;
|
||||
import org.alfresco.rest.model.RestAspectsCollection;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetAspectsTests extends RestTest
|
||||
{
|
||||
|
||||
private UserModel regularUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user get aspects and gets status code OK (200)")
|
||||
public void getAspects() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.assertThat()
|
||||
.entriesListCountIs(100)
|
||||
.and().entriesListContains("id", "cm:classifiable")
|
||||
.and().entriesListContains("id", "cm:author")
|
||||
.and().entriesListContains("id", "cm:checkedOut");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using namespace uri and gets status code OK (200)")
|
||||
public void getAspectByNamespaceUri() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.assertThat().entriesListCountIs(100);
|
||||
|
||||
aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(not namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.assertThat().entriesListCountIs(0);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using modelId and gets status code OK (200)")
|
||||
public void getAspectByModelsIds() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel', 'smf:smartFolder'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isLessThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using modelId with subaspects and gets status code OK (200)")
|
||||
public void getAspectByModelsIdsWithIncludeSubAspects() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBASPECTS', 'smf:smartFolder INCLUDESUBASPECTS'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isGreaterThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter aspects using parentId and gets status code OK (200)")
|
||||
public void getAspectByParentId() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
aspects.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").is(5).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should Aspects association, properties and mandatory aspects and gets status code OK (200)")
|
||||
public void getAspectIncludeParams() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("include=properties,mandatoryAspects,associations")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
for (RestAbstractClassModel aspect : aspects.getEntries())
|
||||
{
|
||||
aspect.onModel().assertThat()
|
||||
.field("associations").isNotNull().and()
|
||||
.field("properties").isNotNull().and()
|
||||
.field("mandatoryAspects").isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should verify the query errors with possible options")
|
||||
public void verifyAspectsQueryError()
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in (' ')")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBASPECTS',))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBTYPES'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in (' ')")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content',))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content',))&include=properties")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('*'))")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content'))&include=properties")
|
||||
.getAspects();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets aspects with high skipCount and maxItems parameter applied")
|
||||
public void getPaginationParameter() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser)
|
||||
.withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=10")
|
||||
.getAspects();
|
||||
aspects.assertThat().entriesListCountIs(10);
|
||||
aspects.assertThat().paginationField("hasMoreItems").is("true");
|
||||
aspects.assertThat().paginationField("skipCount").is("10");
|
||||
aspects.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets aspects with hasMoreItems applied bases on skip count and maxItems")
|
||||
public void getHighPaginationQuery() throws Exception
|
||||
{
|
||||
RestAspectsCollection aspects = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=150")
|
||||
.getAspects();
|
||||
aspects.assertThat().entriesListCountIs(0);
|
||||
aspects.assertThat().paginationField("hasMoreItems").is("false");
|
||||
aspects.assertThat().paginationField("skipCount").is("150");
|
||||
aspects.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
package org.alfresco.rest.models.types;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestTypeModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetTypeTests extends RestTest
|
||||
{
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.createRandomTestUser());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify inexistent type and status code is Not Found (404)")
|
||||
public void getInexistentType() throws Exception
|
||||
{
|
||||
String unknownType = "unknown:type";
|
||||
restClient.withModelAPI().getType(unknownType);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, unknownType));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Type Info and status code is OK (200)")
|
||||
public void getType() throws Exception
|
||||
{
|
||||
RestTypeModel type = restClient.withModelAPI().getType("cm:content");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
type.assertThat().field("associations").isEmpty().and()
|
||||
.field("mandatoryAspects").isNotEmpty().and()
|
||||
.field("properties").isNotEmpty().and()
|
||||
.field("includedInSupertypeQuery").is(true).and()
|
||||
.field("isArchive").is(true).and()
|
||||
.field("isContainer").is(false).and()
|
||||
.field("id").is("cm:content").and()
|
||||
.field("description").is("Base Content Object").and()
|
||||
.field("title").is("Content").and()
|
||||
.field("model.id").is("cm:contentmodel").and()
|
||||
.field("model.author").is("Alfresco").and()
|
||||
.field("model.description").is("Alfresco Content Domain Model").and()
|
||||
.field("model.namespaceUri").is("http://www.alfresco.org/model/content/1.0").and()
|
||||
.field("model.namespacePrefix").is("cm");
|
||||
}
|
||||
}
|
@@ -0,0 +1,199 @@
|
||||
package org.alfresco.rest.models.types;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestAbstractClassModel;
|
||||
import org.alfresco.rest.model.RestTypesCollection;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetTypesTests extends RestTest
|
||||
{
|
||||
|
||||
private UserModel regularUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify user get types and gets status code OK (200)")
|
||||
public void getTypes() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.assertThat()
|
||||
.entriesListCountIs(100)
|
||||
.and().entriesListContains("id", "cm:content")
|
||||
.and().entriesListContains("id", "cm:systemfolder")
|
||||
.and().entriesListContains("id", "cm:folder");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using namespace uri and gets status code OK (200)")
|
||||
public void getTypeByNamespaceUri() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.assertThat().entriesListCountIs(100);
|
||||
|
||||
types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(not namespaceUri matches('http://www.alfresco.org/model.*'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.assertThat().entriesListCountIs(0);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using modelId and gets status code OK (200)")
|
||||
public void getTypeByModelsIds() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel', 'smf:smartFolder'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isLessThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using modelId with subtypes and gets status code OK (200)")
|
||||
public void getTypeByModelsIdsWithIncludeSubTypes() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBTYPES', 'smf:smartFolder INCLUDESUBTYPES'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isGreaterThan(65).and()
|
||||
.field("maxItems").is(100).and()
|
||||
.field("skipCount").isGreaterThan(0).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should filter types using parentId and gets status code OK (200)")
|
||||
public void getTypeByParentId() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:content'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
types.getPagination().assertThat().fieldsCount().is(5).and()
|
||||
.field("totalItems").isGreaterThan(40).and()
|
||||
.field("hasMoreItems").is(false);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should get Type with association, properties and mandatory types and gets status code OK (200)")
|
||||
public void getTypeIncludeParams() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("include=properties,mandatoryAspects,associations")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
for (RestAbstractClassModel type : types.getEntries())
|
||||
{
|
||||
type.onModel().assertThat()
|
||||
.field("associations").isNotNull().and()
|
||||
.field("properties").isNotNull().and()
|
||||
.field("mandatoryAspects").isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.MODEL }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Should verify the query errors with possible options")
|
||||
public void verifyTypesQueryError() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in (' ')")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBTYPES',))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(modelId in ('cm:contentmodel INCLUDESUBASPECTS'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in (' ')")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled',))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled',))&include=properties")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(namespaceUri matches('*'))")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("where=(parentId in ('cm:titled'))&include=properties")
|
||||
.getTypes();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets types with high skipCount and maxItems parameter applied")
|
||||
public void getPaginationParameter() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser)
|
||||
.withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=10")
|
||||
.getTypes();
|
||||
types.assertThat().entriesListCountIs(10);
|
||||
types.assertThat().paginationField("hasMoreItems").is("true");
|
||||
types.assertThat().paginationField("skipCount").is("10");
|
||||
types.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.MODEL, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.MODEL}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets types with hasMoreItems applied bases on skip count and maxItems")
|
||||
public void getHighPaginationQuery() throws Exception
|
||||
{
|
||||
RestTypesCollection types = restClient.authenticateUser(regularUser).withModelAPI()
|
||||
.usingParams("maxItems=10&skipCount=150")
|
||||
.getTypes();
|
||||
types.assertThat().entriesListCountIs(0);
|
||||
types.assertThat().paginationField("hasMoreItems").is("false");
|
||||
types.assertThat().paginationField("skipCount").is("150");
|
||||
types.assertThat().paginationField("maxItems").is("10");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
}
|
@@ -347,13 +347,30 @@ public class GetSitesTests extends RestTest
|
||||
public void checkPaginationWithSkipCountAndMaxItems() throws Exception
|
||||
{
|
||||
sites = restClient.authenticateUser(regularUser).withParams("skipCount=10&maxItems=110").withCoreAPI().getSites();
|
||||
|
||||
int expectedCount;
|
||||
if (sites.getPagination().isHasMoreItems())
|
||||
{
|
||||
expectedCount = sites.getPagination().getMaxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sites.getPagination().getTotalItems() < sites.getPagination().getSkipCount())
|
||||
{
|
||||
expectedCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedCount = sites.getPagination().getTotalItems() - sites.getPagination().getSkipCount();
|
||||
}
|
||||
}
|
||||
|
||||
sites.getPagination().assertThat()
|
||||
.field("totalItems").isNotEmpty().and()
|
||||
.field("maxItems").is("110").and()
|
||||
.field("hasMoreItems").is((sites.getPagination().getTotalItems() - sites.getPagination().getSkipCount() > sites.getPagination().getMaxItems())?"true":"false").and()
|
||||
.field("skipCount").is("10").and()
|
||||
.field("count").is((sites.getPagination().isHasMoreItems()) ? sites.getPagination().getMaxItems()
|
||||
: sites.getPagination().getTotalItems() - sites.getPagination().getSkipCount());
|
||||
.field("count").is(expectedCount);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION})
|
||||
|
@@ -0,0 +1,280 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteGroupModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class AddSiteGroupTests extends RestTest
|
||||
{
|
||||
private UserModel adminUserModel;
|
||||
private SiteModel publicSiteModel, moderatedSiteModel;
|
||||
private ListUserWithRoles publicSiteUsersWithRoles;
|
||||
private String addMemberJson, addMembersJson;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
publicSiteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
moderatedSiteModel = dataSite.usingUser(adminUserModel).createModeratedRandomSite();
|
||||
publicSiteUsersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel,
|
||||
UserRole.SiteManager,
|
||||
UserRole.SiteCollaborator,
|
||||
UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
addMemberJson = "{\"role\":\"%s\",\"id\":\"%s\"}";
|
||||
addMembersJson = "{\"role\":\"%s\",\"id\":\"%s\"}, {\"role\":\"%s\",\"id\":\"%s\"}";
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that user can not be added to an inexistent site and gets status code 404")
|
||||
public void notAbleToAddGroupToAnInExistentSite() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
SiteModel inexistentSite = new SiteModel("inexistentSite");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(inexistentSite).addSiteGroup(getId(group), UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, inexistentSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that inexistent group can not be added to site and gets status code 404")
|
||||
public void notAbleToAddInExistentGroupToSite() throws Exception
|
||||
{
|
||||
GroupModel group = new GroupModel("inExistentGroup");
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(group.getGroupIdentifier(), UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY)
|
||||
.containsSummary(String.format("An authority was not found for %s", group.getGroupIdentifier()))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that user can not add group that is already present and gets status code 409")
|
||||
public void notAbleToAddGroupThatIsAlreadyAPresent() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addSiteGroup(getId(group), UserRole.SiteManager);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(moderatedSiteModel).addSiteGroup(getId(group), UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT).assertLastError().containsSummary(String.format(RestErrorModel.ALREADY_Site_MEMBER, getId(group), moderatedSiteModel.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that several groups with different roles can be added once in a row to a site and gets status code 201")
|
||||
public void addSeveralGroupsWithDifferentRolesToASite() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
GroupModel secondGroup = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String json = String.format(addMembersJson, UserRole.SiteContributor, getId(firstGroup), UserRole.SiteCollaborator, getId(secondGroup));
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that several groups with same roles can be added once in a row to a site and gets status code 201")
|
||||
public void addSeveralGroupsWithSameRolesToASite() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
GroupModel secondGroup = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String json = String.format(addMembersJson, UserRole.SiteCollaborator, getId(firstGroup), UserRole.SiteCollaborator, getId(secondGroup));
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that several users that are already added to the site can not be added once in a row and gets status code 400")
|
||||
public void addSeveralGroupsThatAreAlreadyAddedToASite() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
GroupModel secondGroup = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
String json = String.format(addMembersJson, UserRole.SiteCollaborator, getId(firstGroup), UserRole.SiteCollaborator, getId(secondGroup));
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CONFLICT).assertLastError().containsSummary(String.format(RestErrorModel.ALREADY_Site_MEMBER, getId(firstGroup), publicSiteModel.getId())) ;
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Add new site group membership request by providing an empty body")
|
||||
public void addSiteGroupsUsingEmptyBody() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "", "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT, "No content to map due to end-of-input"))
|
||||
.containsErrorKey(String.format(RestErrorModel.NO_CONTENT, "No content to map due to end-of-input"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check lower and upper case letters for role field")
|
||||
public void checkLowerUpperCaseLettersForRole() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
String json = String.format(addMemberJson, "SITEMANAGER", getId(group));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format("An authority was not found for GROUP_site_%s_%s", publicSiteModel.getId(), "SITEMANAGER"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
json = String.format(addMemberJson, "sitemanager", getId(group));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format("An authority was not found for GROUP_site_%s_%s", publicSiteModel.getId(), "sitemanager"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Check empty value for user role")
|
||||
public void checkEmptyValueForRole() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
String json = String.format(addMemberJson, "", getId(group));
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/group-members?{parameters}", publicSiteModel.getId(), restClient.getParameters());
|
||||
restClient.processModel(RestSiteGroupModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsErrorKey(String.format(RestErrorModel.NO_CONTENT, "N/A"))
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT, "N/A"))
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that manager is able to add site group membership and gets status code CREATED (201)")
|
||||
public void managerIsAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteCollaborator)
|
||||
.assertThat()
|
||||
.field("id").is(getId(group))
|
||||
.and()
|
||||
.field("role").is(UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site collaborator is not able to add site group membership and gets status code FORBIDDEN (403)")
|
||||
public void collaboratorIsNotAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteCollaborator);
|
||||
|
||||
restClient.assertLastError().containsSummary("The current user does not have permissions to modify the membership details of the site");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION})
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site contributor is not able to add site group membership and gets status code FORBIDDEN (403)")
|
||||
public void contributorIsNotAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteContributor);
|
||||
|
||||
restClient.assertLastError().containsSummary("The current user does not have permissions to modify the membership details of the site");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that site consumer is not able to add site group membership and gets status code FORBIDDEN (403)")
|
||||
public void consumerIsNotAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsersWithRoles.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteConsumer);;
|
||||
|
||||
restClient.assertLastError().containsSummary("The current user does not have permissions to modify the membership details of the site");
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that admin user is able to add site group membership and gets status code CREATED (201)")
|
||||
public void adminIsAbleToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel)
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteConsumer)
|
||||
.assertThat()
|
||||
.field("id").is(getId(group))
|
||||
.and()
|
||||
.field("role").is(UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that unauthenticated user is not able to add site group membership")
|
||||
public void unauthenticatedUserIsNotAuthorizedToAddSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
|
||||
UserModel userModel = dataUser.createRandomTestUser();
|
||||
userModel.setPassword("user wrong password");
|
||||
dataUser.addUserToSite(userModel, publicSiteModel, UserRole.SiteManager);
|
||||
|
||||
restClient.authenticateUser(userModel)
|
||||
.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager can add another user as manager to a public site and gets status code CREATED (201)")
|
||||
public void addManagerToPublicSite() throws Exception
|
||||
{
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(group), UserRole.SiteManager)
|
||||
.assertThat()
|
||||
.field("id").is(getId(group))
|
||||
.and()
|
||||
.field("role").is(UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -0,0 +1,135 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetSiteGroupTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser;
|
||||
private SiteModel publicSiteModel;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
private GroupModel manager, consumer;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
publicSiteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
|
||||
consumer = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(consumer, dataUser.createRandomTestUser());
|
||||
|
||||
manager = dataGroup.createRandomGroup();
|
||||
dataGroup.addListOfUsersToGroup(consumer, dataUser.createRandomTestUser());
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(manager), UserRole.SiteManager);
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(consumer), UserRole.SiteConsumer);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user can get site group and gets status code OK (200)")
|
||||
public void getSiteGroupWithAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(manager))
|
||||
.and().field("id").is(getId(manager))
|
||||
.and().field("role").is(UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Failed authentication get site group call returns status code 401")
|
||||
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteGroup() throws JsonToModelConversionException, Exception
|
||||
{
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(consumer));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role doesn't get a site group of inexistent site and status code is Not Found (404)")
|
||||
public void getSiteGroupOfInexistentSite() throws Exception
|
||||
{
|
||||
SiteModel invalidSite = new SiteModel("invalidSite");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(invalidSite).getSiteGroup(getId(consumer));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, invalidSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role doesn't get non site group of inexistent site and status code is Not Found (404)")
|
||||
public void getSiteGroupForNonSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel nonGroup = dataGroup.createRandomGroup();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(nonGroup));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format("Given authority is not a member of the site"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role doesn't get not existing site group and status code is Not Found (404)")
|
||||
public void getSiteGroupForInexistentSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel inexistentGroup = new GroupModel("inexistentGroup");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(inexistentGroup));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format("An authority was not found for %s", getId(inexistentGroup)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role can get site group for empty siteId")
|
||||
public void getSiteGroupForEmptySiteId() throws Exception
|
||||
{
|
||||
SiteModel emptySite = new SiteModel("");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(emptySite).getSiteGroup(getId(consumer));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Manager role gets site groups with Manager role and status code is OK (200)")
|
||||
public void getSiteGroupWithManagerRole() throws Exception
|
||||
{
|
||||
GroupModel anotherManager = dataGroup.createRandomGroup();
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).addSiteGroup(getId(anotherManager), UserRole.SiteManager);
|
||||
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).getSiteGroup(getId(anotherManager))
|
||||
.assertThat().field("id").is(getId(anotherManager))
|
||||
.and().field("role").is(UserRole.SiteManager);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -0,0 +1,275 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.*;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GetSiteGroupsTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSite, moderatedSite;
|
||||
private List<GroupModel> publicSiteGroups, moderatedSiteGroups;
|
||||
private DataUser.ListUserWithRoles publicSiteUsers;
|
||||
private UserModel siteCreator;
|
||||
private UserModel regularUser;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
siteCreator = dataUser.createRandomTestUser();
|
||||
regularUser = dataUser.createRandomTestUser();
|
||||
|
||||
publicSite = dataSite.usingUser(siteCreator).createPublicRandomSite();
|
||||
moderatedSite = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
|
||||
publicSiteUsers = dataUser.addUsersWithRolesToSite(publicSite,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
publicSiteGroups = addGroupToSite(publicSite,UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
moderatedSiteGroups = addGroupToSite(moderatedSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("properties=role,id").getSiteGroups();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify Manager role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithManagerRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(0)))
|
||||
.and().entriesListContains("role", UserRole.SiteManager.name())
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(1)))
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.name())
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(2)))
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.name())
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(3)))
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Collaborator role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithCollaboratorRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(1)))
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Contributor role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithContributorRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteContributor))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(3)))
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Consumer role gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithConsumerRole() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteConsumer))
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(2)))
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin user gets site groups and gets status code OK (200)")
|
||||
public void getSiteGroupsWithAdminUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups()
|
||||
.assertThat()
|
||||
.entriesListCountIs(4)
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(0)))
|
||||
.and().entriesListContains("role", UserRole.SiteManager.name());
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Failed authentication get site groups call returns status code 401")
|
||||
public void unauthenticatedUserIsNotAuthorizedToRetrieveSiteGroups() throws Exception
|
||||
{
|
||||
UserModel userModel = dataUser.createRandomTestUser();
|
||||
userModel.setPassword("user wrong password");
|
||||
dataUser.addUserToSite(userModel, publicSite, UserRole.SiteManager);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site members call returns status code 404 if siteId does not exist")
|
||||
public void checkStatusCodeForNonExistentSiteId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteContributor)).withCoreAPI()
|
||||
.usingSite("NonExistentSiteId").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.assertLastError().containsSummary(String.format("Site %s does not exist", "NonExistentSiteId"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site groups call returns status code 400 for invalid maxItems")
|
||||
public void checkStatusCodeForInvalidMaxItems() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withParams("maxItems=0").withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
|
||||
restClient.withParams("maxItems=A").withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_MAXITEMS, "A"));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify get site groups call returns status code 400 for invalid skipCount ")
|
||||
public void checkStatusCodeForInvalidSkipCount() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(regularUser).withParams("skipCount=A")
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_SKIPCOUNT, "A"));
|
||||
|
||||
restClient.withParams("skipCount=-1")
|
||||
.withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(RestErrorModel.NEGATIVE_VALUES_SKIPCOUNT);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets public site groups and status code is 200")
|
||||
public void getPublicSiteGroups() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(regularUser).withCoreAPI().usingSite(publicSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().entriesListCountIs(4).assertThat()
|
||||
.entriesListContains("id", getId(publicSiteGroups.get(0)))
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(1)))
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(2)))
|
||||
.and().entriesListContains("id", getId(publicSiteGroups.get(3)))
|
||||
.and().paginationField("count").is("4");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups and status code is 200")
|
||||
public void getModeratedSiteGroups() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(regularUser).withCoreAPI().usingSite(moderatedSite).getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().entriesListCountIs(4).assertThat()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(0))).and()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(1))).and()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(2))).and()
|
||||
.entriesListContains("id", getId(moderatedSiteGroups.get(3))).and()
|
||||
.paginationField("count").is("4");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with properties parameter applied and status code is 200")
|
||||
public void getModeratedSiteGroupsUsingPropertiesParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("properties=role,id").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().entriesListCountIs(4)
|
||||
.and().entriesListDoesNotContain("person")
|
||||
.and().entriesListContains("role", UserRole.SiteManager.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(0)))
|
||||
.and().entriesListContains("role", UserRole.SiteContributor.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(1)))
|
||||
.and().entriesListContains("role", UserRole.SiteCollaborator.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(2)))
|
||||
.and().entriesListContains("role", UserRole.SiteConsumer.toString())
|
||||
.and().entriesListContains("id", getId(moderatedSiteGroups.get(3)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with skipCount parameter applied")
|
||||
public void getModeratedSiteGroupsUsingSkipCountParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("skipCount=2").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().paginationField("count").is("2");
|
||||
siteGroups.assertThat().paginationField("skipCount").is("2");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with high skipCount parameter applied")
|
||||
public void getModeratedSiteGroupsUsingHighSkipCountParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("skipCount=100").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().paginationField("count").is("0");
|
||||
siteGroups.assertThat().paginationField("skipCount").is("100");
|
||||
siteGroups.assertThat().entriesListIsEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if any user gets moderated site groups with maxItems parameter applied and check all pagination fields")
|
||||
public void getModeratedSiteGroupsUsingMaxItemsParameter() throws Exception
|
||||
{
|
||||
RestSiteGroupModelsCollection siteGroups = restClient.authenticateUser(siteCreator).withCoreAPI().usingSite(moderatedSite).usingParams("maxItems=1").getSiteGroups();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteGroups.assertThat().paginationField("count").is("1");
|
||||
siteGroups.assertThat().paginationField("hasMoreItems").is("true");
|
||||
siteGroups.assertThat().paginationField("maxItems").is("1");
|
||||
siteGroups.assertThat().paginationField("totalItems").is("4");
|
||||
siteGroups.assertThat().entriesListCountIs(1);
|
||||
}
|
||||
|
||||
List<GroupModel> addGroupToSite(SiteModel siteModel, UserRole ...roles) {
|
||||
List<GroupModel> groups = new ArrayList<GroupModel>();
|
||||
for (UserRole role: roles) {
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(siteModel).addSiteGroup(getId(group), role);
|
||||
groups.add(group);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -0,0 +1,197 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RemoveSiteGroupTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSiteModel, privateSiteModel;
|
||||
private UserModel adminUserModel;
|
||||
private DataUser.ListUserWithRoles usersWithRoles;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
UserModel siteCreator = dataUser.createRandomTestUser();
|
||||
|
||||
publicSiteModel = dataSite.usingUser(siteCreator).createPublicRandomSite();
|
||||
privateSiteModel = dataSite.usingUser(siteCreator).createPrivateRandomSite();
|
||||
|
||||
usersWithRoles = dataUser.addUsersWithRolesToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
addGroupToSite(publicSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer, UserRole.SiteContributor);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify manager can delete site group and gets status code 204, 'No Content'")
|
||||
public void siteManagerIsAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
|
||||
.getSiteGroups().assertThat().entriesListDoesNotContain("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.REGRESSION, description = "Verify collaborator cannot delete site group and gets status code 403, 'Forbidden'")
|
||||
public void siteCollaboratorIsNotAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI()
|
||||
.usingSite(publicSiteModel).getSiteGroups()
|
||||
.assertThat().entriesListContains("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.REGRESSION, description = "Verify contributor cannot delete site group and gets status code 403, 'Forbidden'")
|
||||
public void siteContributorIsNotAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteContributor));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
|
||||
.getSiteGroups().assertThat().entriesListContains("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.REGRESSION, description = "Verify consumer cannot delete site member and gets status code 403, 'Forbidden'")
|
||||
public void siteConsumerIsNotAbleToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteConsumer)).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
|
||||
Utility.sleep(300, 30000, () -> restClient.withCoreAPI().usingSite(publicSiteModel)
|
||||
.getSiteGroups().assertThat().entriesListContains("id", getId(group)));
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.SITES }, executionType = ExecutionType.SANITY, description = "Verify that unauthenticated user is not able to delete site group")
|
||||
public void unauthenticatedUserIsNotAuthorizedToDeleteSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager can NOT delete site group for an inexistent user and gets status code 404, 'Not Found'")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void managerIsNotAbleToDeleteInexistentSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel inexistentUser = new GroupModel("inexistentUser");
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(inexistentUser));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format("An authority was not found for %s", getId(inexistentUser)));
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify manager can NOT delete site group for a non site group and gets status code 400, 'Bad Request'")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void managerIsNotAbleToDeleteNotSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel nonMember = dataGroup.createRandomGroup();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(nonMember));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary(String.format("Given authority is not a member of the site"));
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager can NOT delete site group for an invalid site and gets status code 404, 'Not Found'")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void managerIsNotAbleToDeleteSiteMemberOfInvalidSite() throws Exception
|
||||
{
|
||||
SiteModel invalidSite = new SiteModel("invalidSite");
|
||||
GroupModel testGroupModel = dataGroup.createRandomGroup();
|
||||
|
||||
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(invalidSite).deleteSiteGroup(getId(testGroupModel));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, "invalidSite"));
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin can delete a site group of private site and gets status code 204")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
public void adminIsAbleToDeletePrivateSiteGroup() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(privateSiteModel, UserRole.SiteConsumer).get(0);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(privateSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin can not delete a site group twice and gets status code 404 for the second attempt")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@Bug(id="ACE-5447")
|
||||
public void adminIsNotAbleToRemoveSiteGroupTwice() throws Exception
|
||||
{
|
||||
GroupModel group = addGroupToSite(publicSiteModel, UserRole.SiteContributor).get(0);
|
||||
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
restClient.authenticateUser(adminUserModel).withCoreAPI().usingSite(publicSiteModel).deleteSiteGroup(getId(group));
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError()
|
||||
.containsSummary("Given authority is not a member of the site");
|
||||
}
|
||||
|
||||
List<GroupModel> addGroupToSite(SiteModel siteModel, UserRole ...roles) {
|
||||
List<GroupModel> groups = new ArrayList<GroupModel>();
|
||||
for (UserRole role: roles) {
|
||||
GroupModel group = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingSite(siteModel).addSiteGroup(getId(group), role);
|
||||
groups.add(group);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,187 @@
|
||||
package org.alfresco.rest.sites.groups;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteMemberModel;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class UpdateSiteGroupTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser, siteCreator;
|
||||
private GroupModel regularGroup;
|
||||
private SiteModel publicSite;
|
||||
private DataUser.ListUserWithRoles publicSiteUsers;
|
||||
private GroupModel groupToBeUpdated;
|
||||
|
||||
@BeforeClass(alwaysRun=true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
siteCreator = dataUser.createRandomTestUser();
|
||||
publicSite = dataSite.usingUser(siteCreator).createPublicRandomSite();
|
||||
publicSiteUsers = dataUser.addUsersWithRolesToSite(publicSite, UserRole.SiteManager, UserRole.SiteCollaborator, UserRole.SiteConsumer,
|
||||
UserRole.SiteContributor);
|
||||
regularGroup = dataGroup.createRandomGroup();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that collaborator is not able to update site group membership and gets status code FORBIDDEN (403)")
|
||||
public void collaboratorIsNotAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteCollaborator));
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
restClient.assertLastError()
|
||||
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that contributor is not able to update site membership and gets status code FORBIDDEN (403)")
|
||||
public void contributorIsNotAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteContributor));
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
restClient.assertLastError()
|
||||
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that consumer is not able to update site group and gets status code FORBIDDEN (403)")
|
||||
public void consumerIsNotAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteManager));
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.authenticateUser(publicSiteUsers.getOneUserWithRole(UserRole.SiteConsumer));
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
restClient.assertLastError()
|
||||
.containsSummary(String.format("The current user does not have permissions to modify the membership details of the site %s.", publicSite.getTitle()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that admin is able to update site member and gets status code OK (200)")
|
||||
public void adminIsAbleToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator)
|
||||
.assertThat().field("id").is(getId(groupToBeUpdated))
|
||||
.and().field("role").is(UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.SANITY })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.SANITY,
|
||||
description = "Verify that unauthenticated user is not able to update site member")
|
||||
|
||||
public void unauthenticatedUserIsNotAuthorizedToUpdateSiteGroup() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUser);
|
||||
restClient.withCoreAPI().usingSite(publicSite).addSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
UserModel inexistentUser = new UserModel("inexistent user", "inexistent password");
|
||||
restClient.authenticateUser(inexistentUser);
|
||||
restClient.withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteCollaborator);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site group request returns status code 404 when nonexistent siteId is used")
|
||||
public void updateSiteGroupOfNonexistentSite() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
SiteModel deletedSite = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
dataSite.deleteSite(deletedSite);
|
||||
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(deletedSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, deletedSite.getId()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 400 when personId is not member of the site")
|
||||
public void updateNotASiteMember() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("authority is not a member of the site");
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 404 when personId does not exist")
|
||||
public void updateNonexistentSiteMember() throws Exception
|
||||
{
|
||||
GroupModel nonexistentUser = new GroupModel("nonexistentUser");
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(nonexistentUser), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format("An authority was not found for %s", getId(nonexistentUser)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 404 when empty siteId is used")
|
||||
public void updateSiteMemberUsingEmptySiteId() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite("").updateSiteGroup(getId(regularGroup), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, ""));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 405 when empty personId is used")
|
||||
public void updateSiteMemberUsingEmptyPersonId() throws Exception
|
||||
{
|
||||
GroupModel emptyGroup = new GroupModel("");
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(emptyGroup), UserRole.SiteConsumer);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format("An authority was not found for %s", getId(emptyGroup)));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if update site member request returns status code 400 when invalid role is used")
|
||||
public void updateSiteMemberUsingInvalidRole() throws Exception
|
||||
{
|
||||
groupToBeUpdated = dataGroup.createRandomGroup();
|
||||
restClient.authenticateUser(siteCreator).withCoreAPI();
|
||||
restClient.authenticateUser(adminUser).withCoreAPI().usingSite(publicSite).updateSiteGroup(getId(groupToBeUpdated), UserRole.SiteConsumer);
|
||||
String json = JsonBodyGenerator.keyValueJson("role","invalidRole");
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "sites/{siteId}/group-members/{groupId}", publicSite.getId(), getId(groupToBeUpdated));
|
||||
restClient.processModel(RestSiteMemberModel.class, request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError().containsSummary("authority is not a member of the site");
|
||||
}
|
||||
|
||||
String getId(GroupModel group) {
|
||||
return "GROUP_" + group.getGroupIdentifier();
|
||||
}
|
||||
}
|
@@ -6,6 +6,7 @@ import org.alfresco.rest.model.RestSiteMemberModel;
|
||||
import org.alfresco.rest.model.RestSiteMemberModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.data.DataUser.ListUserWithRoles;
|
||||
import org.alfresco.utility.model.GroupModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
@@ -20,7 +21,7 @@ import org.testng.annotations.Test;
|
||||
*/
|
||||
public class GetSiteMembersTests extends RestTest
|
||||
{
|
||||
private SiteModel publicSite, privateSite, moderatedSite, moderatedSite2, moderatedSite3;
|
||||
private SiteModel publicSite, privateSite, moderatedSite, moderatedSite2, moderatedSite3, moderatedSite4;
|
||||
private RestSiteMemberModelsCollection siteMembers;
|
||||
private ListUserWithRoles usersWithRoles, moderatedSiteUsers;
|
||||
private UserModel regularUser, privateSiteConsumer, siteCreator;
|
||||
@@ -38,6 +39,7 @@ public class GetSiteMembersTests extends RestTest
|
||||
moderatedSite = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
moderatedSite2 = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
moderatedSite3 = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
moderatedSite4 = dataSite.usingUser(siteCreator).createModeratedRandomSite();
|
||||
|
||||
dataUser.addUserToSite(privateSiteConsumer, privateSite, UserRole.SiteConsumer);
|
||||
dataUser.addUserToSite(privateSiteConsumer, moderatedSite3, UserRole.SiteConsumer);
|
||||
@@ -351,4 +353,32 @@ public class GetSiteMembersTests extends RestTest
|
||||
.and().entriesListContains("role", UserRole.SiteManager.toString())
|
||||
.and().entriesListContains("id", siteCreator.getUsername());
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.REGRESSION })
|
||||
@TestRail(section={TestGroup.REST_API, TestGroup.SITES}, executionType= ExecutionType.REGRESSION,
|
||||
description= "Verify if isMemberOfGroup if user part of the group")
|
||||
public void verifyIsMemberOfGroupProps() throws Exception
|
||||
{
|
||||
GroupModel firstGroup = dataGroup.createRandomGroup();
|
||||
UserModel user = dataUser.createRandomTestUser();
|
||||
dataGroup.addListOfUsersToGroup(firstGroup, user);
|
||||
|
||||
siteMembers = restClient.authenticateUser(siteCreator).withCoreAPI()
|
||||
.usingSite(moderatedSite4).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(1);
|
||||
|
||||
restClient.withCoreAPI().usingSite(moderatedSite4).addSiteGroup("GROUP_" + firstGroup.getGroupIdentifier(), UserRole.SiteCollaborator);
|
||||
|
||||
siteMembers = restClient.withCoreAPI().usingSite(moderatedSite4).getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(2);
|
||||
siteMembers.getEntryByIndex(0).assertThat().field("isMemberOfGroup").isNotNull();
|
||||
siteMembers.getEntryByIndex(1).assertThat().field("isMemberOfGroup").isNotNull();
|
||||
|
||||
siteMembers = restClient.withCoreAPI().usingSite(moderatedSite4).usingParams("where=(isMemberOfGroup=false)").getSiteMembers();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
siteMembers.assertThat().entriesListCountIs(1);
|
||||
siteMembers.getEntries().get(0).assertThat().field("isMemberOfGroup").is(false);
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<package name="org.alfresco.rest.tags.*"/>
|
||||
<package name="org.alfresco.rest.trashcan.*"/>
|
||||
<package name="org.alfresco.rest.workflow.*"/>
|
||||
<package name="org.alfresco.rest.models.*"/>
|
||||
</packages>
|
||||
</test>
|
||||
</suite>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<scm-path>${project.parent.parent.scm.url}</scm-path>
|
||||
<scm-revision>${build-number}</scm-revision>
|
||||
<scm-revision>${buildNumber}</scm-revision>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -60,12 +60,10 @@
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.soap</groupId>
|
||||
<artifactId>javax.xml.soap-api</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<groupId>jakarta.xml.soap</groupId>
|
||||
<artifactId>jakarta.xml.soap-api</artifactId>
|
||||
</dependency>
|
||||
<!-- 'provided' dependencies, not packaged in war -->
|
||||
<dependency>
|
||||
@@ -95,11 +93,6 @@
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- required by GDocs-->
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
@@ -147,6 +140,23 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<!-- Gets the scm revision and stores it in the ${buildNumber} variable -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<shortRevisionLength>8</shortRevisionLength>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
|
@@ -66,6 +66,8 @@
|
||||
|
||||
<bean id="SOLRAuthenticationFilter" class="org.alfresco.repo.web.scripts.solr.SOLRAuthenticationFilter">
|
||||
<property name="secureComms" value="${solr.secureComms}"/>
|
||||
<property name="sharedSecret" value="${solr.sharedSecret}"/>
|
||||
<property name="sharedSecretHeader" value="${solr.sharedSecret.header}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="WebscriptAuthenticationFilter" class="org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory">
|
||||
|
@@ -184,5 +184,15 @@
|
||||
</filter>
|
||||
|
||||
</config>
|
||||
|
||||
<!--
|
||||
A set of HTTP response headers that instructs the browser to behave in certain ways to improve security
|
||||
-->
|
||||
<config evaluator="string-compare" condition="SecurityHeadersPolicy">
|
||||
<headers>
|
||||
<header>
|
||||
<name>X-Frame-Options</name>
|
||||
<value>SAMEORIGIN</value>
|
||||
</header>
|
||||
</headers>
|
||||
</config>
|
||||
</alfresco-config>
|
@@ -239,11 +239,6 @@ log4j.logger.freemarker.runtime=
|
||||
# Metadata extraction
|
||||
log4j.logger.org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter=warn
|
||||
|
||||
# Reduces PDFont error level due to ALF-7105
|
||||
log4j.logger.org.apache.pdfbox.pdmodel.font.PDSimpleFont=fatal
|
||||
log4j.logger.org.apache.pdfbox.pdmodel.font.PDFont=fatal
|
||||
log4j.logger.org.apache.pdfbox.pdmodel.font.PDCIDFont=fatal
|
||||
|
||||
# no index support
|
||||
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexIndexer=fatal
|
||||
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexSearchService=fatal
|
||||
@@ -264,10 +259,7 @@ log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationsConsistenc
|
||||
log4j.logger.org.alfresco.heartbeat=info
|
||||
|
||||
# Transformations
|
||||
log4j.logger.org.alfresco.repo.content.transform.JodContentTransformer=info
|
||||
log4j.logger.org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker=info
|
||||
log4j.logger.org.alfresco.repo.content.transform.pdfrenderer.AlfrescoPdfRendererContentTransformerWorker=info
|
||||
log4j.logger.org.alfresco.repo.content.transform.TikaPoweredContentTransformer=info
|
||||
#log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
|
||||
|
||||
log4j.logger.org.alfresco.repo.content.transform=info
|
||||
|
||||
|
@@ -104,6 +104,12 @@
|
||||
<filter-class>org.springframework.extensions.webscripts.servlet.CSRFFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<description>Security Headers filter. Adds security response headers based on config.</description>
|
||||
<filter-name>Security Headers Filter</filter-name>
|
||||
<filter-class>org.springframework.extensions.webscripts.servlet.SecurityHeadersFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<!-- Enterprise filter placeholder -->
|
||||
<filter-mapping>
|
||||
<filter-name>Clear security context filter</filter-name>
|
||||
@@ -225,6 +231,11 @@
|
||||
<url-pattern>/wcs/admin/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Security Headers Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Enterprise filter-mapping placeholder -->
|
||||
|
||||
<!-- Spring Context Loader listener - can disable loading of context if runtime config changes are needed -->
|
||||
|
@@ -57,8 +57,8 @@ ModuleDetails shareServicesModule = moduleService.getModule("alfresco-share-serv
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Alfresco</title>
|
||||
<link rel="stylesheet" type="text/css" href="./css/reset.css" />
|
||||
<link rel="stylesheet" type="text/css" href="./css/alfresco.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/<%=sysAdminParams.getAlfrescoContext()%>/css/reset.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/<%=sysAdminParams.getAlfrescoContext()%>/css/alfresco.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="sticky-wrapper">
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
@@ -4,21 +4,21 @@
|
||||
%%
|
||||
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
|
||||
This file is part of the Alfresco software.
|
||||
If the software was purchased under a paid Alfresco license, the terms of
|
||||
the paid license agreement will prevail. Otherwise, the software is
|
||||
provided under the following open source license terms:
|
||||
|
||||
|
||||
Alfresco is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
Alfresco is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General 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%
|
||||
@@ -57,19 +57,19 @@ ModuleDetails shareServicesModule = moduleService.getModule("alfresco-share-serv
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Alfresco</title>
|
||||
<link rel="stylesheet" type="text/css" href="./css/reset.css" />
|
||||
<link rel="stylesheet" type="text/css" href="./css/alfresco.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/<%=sysAdminParams.getAlfrescoContext()%>/css/reset.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/<%=sysAdminParams.getAlfrescoContext()%>/css/alfresco.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="sticky-wrapper">
|
||||
<div class="index">
|
||||
|
||||
|
||||
<div class="title">
|
||||
<span class="logo"><a href="http://www.alfresco.com"><img src="./images/logo/logo.png" width="145" height="48" alt="" border="0" /></a></span>
|
||||
<span class="logo-separator"> </span>
|
||||
<h1>Welcome to Alfresco</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="index-list">
|
||||
<h4><%=descriptorService.getServerDescriptor().getEdition()%> - <%=descriptorService.getServerDescriptor().getVersion()%></h4>
|
||||
<p></p>
|
||||
@@ -94,7 +94,7 @@ ModuleDetails shareServicesModule = moduleService.getModule("alfresco-share-serv
|
||||
{
|
||||
%>
|
||||
<p>WARNING: The system is in Read Only mode, the License may have failed to deploy. Please visit the <a href="./s/enterprise/admin">Alfresco Administration Console</a> (admin only)</p>
|
||||
<%
|
||||
<%
|
||||
}
|
||||
if (descriptorService.getLicenseDescriptor() != null && descriptorService.getLicenseDescriptor().getLicenseMode().toString().equals("ENTERPRISE"))
|
||||
{
|
||||
@@ -120,7 +120,7 @@ ModuleDetails shareServicesModule = moduleService.getModule("alfresco-share-serv
|
||||
<p><a href="./api/-default-/public/cmis/versions/1.1/atom">CMIS 1.1 AtomPub Service Document</a></p>
|
||||
<p><a href="./api/-default-/public/cmis/versions/1.1/browser">CMIS 1.1 Browser Binding URL</a></p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="push"></div>
|
||||
</div>
|
||||
|
330
pom.xml
330
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>repo-5439-M3c1</version>
|
||||
<version>9.40</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>0</acs.version.minor>
|
||||
<acs.version.revision>0</acs.version.revision>
|
||||
<acs.version.revision>1</acs.version.revision>
|
||||
<acs.version.label />
|
||||
|
||||
<version.edition>Community</version.edition>
|
||||
@@ -34,85 +34,90 @@
|
||||
<image.registry>quay.io</image.registry>
|
||||
|
||||
<java.version>11</java.version>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<maven.build.sourceVersion>${java.version}</maven.build.sourceVersion>
|
||||
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
<img.exe>convert</img.exe>
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
<dependency.alfresco-mmt.version>6.0</dependency.alfresco-mmt.version>
|
||||
<dependency.alfresco-pdf-renderer.version>1.1</dependency.alfresco-pdf-renderer.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.3</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.4.1</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
||||
<dependency.alfresco-server-root.version>6.0.1</dependency.alfresco-server-root.version>
|
||||
<dependency.alfresco-messaging-repo.version>1.2.15</dependency.alfresco-messaging-repo.version>
|
||||
<dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
|
||||
<dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
|
||||
<dependency.activiti.version>5.23.0</dependency.activiti.version>
|
||||
<dependency.transform.model.version>1.0.2.11</dependency.transform.model.version>
|
||||
<dependency.transform.model.version>1.3.1</dependency.transform.model.version>
|
||||
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
|
||||
<dependency.acs-event-model.version>0.0.11</dependency.acs-event-model.version>
|
||||
<dependency.acs-event-model.version>0.0.12</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.spring.version>5.2.9.RELEASE</dependency.spring.version>
|
||||
<dependency.spring.version>5.3.3</dependency.spring.version>
|
||||
<dependency.antlr.version>3.5.2</dependency.antlr.version>
|
||||
<dependency.jackson.version>2.11.3</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.11.2</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.4.1</dependency.cxf.version>
|
||||
<dependency.jackson.version>2.12.3</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.12.3</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.4.4</dependency.cxf.version>
|
||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||
<dependency.pdfbox.version>2.0.21</dependency.pdfbox.version>
|
||||
<dependency.webscripts.version>8.12</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.66</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.6.0</dependency.mockito-core.version>
|
||||
<dependency.org-json.version>20200518</dependency.org-json.version>
|
||||
<dependency.webscripts.version>8.27</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.69</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>3.9.0</dependency.mockito-core.version>
|
||||
<dependency.org-json.version>20210307</dependency.org-json.version>
|
||||
<dependency.commons-dbcp.version>1.4-DBCP330</dependency.commons-dbcp.version>
|
||||
<dependency.guava.version>28.2-jre</dependency.guava.version>
|
||||
<dependency.commons-io.version>2.8.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.13</dependency.httpcore.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.0-alfresco-patched-20191004</dependency.xercesImpl.version>
|
||||
<dependency.xercesImpl.version>2.12.1</dependency.xercesImpl.version>
|
||||
<dependency.slf4j.version>1.7.30</dependency.slf4j.version>
|
||||
<dependency.gytheio.version>0.11.6</dependency.gytheio.version>
|
||||
<dependency.jaxb.version>2.3.3</dependency.jaxb.version>
|
||||
<dependency.gytheio.version>0.12</dependency.gytheio.version>
|
||||
<dependency.groovy.version>2.5.9</dependency.groovy.version>
|
||||
<dependency.javax.mail.version>1.6.2</dependency.javax.mail.version>
|
||||
<dependency.tika.version>1.24.1</dependency.tika.version>
|
||||
<dependency.spring-security.version>5.4.1</dependency.spring-security.version>
|
||||
<dependency.tika.version>1.26</dependency.tika.version>
|
||||
<dependency.spring-security.version>5.5.0</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>11.0.0-alfresco-001</dependency.keycloak.version>
|
||||
<dependency.keycloak.version>13.0.1</dependency.keycloak.version>
|
||||
<dependency.jboss.logging.version>3.4.1.Final</dependency.jboss.logging.version>
|
||||
<dependency.camel.version>2.24.2</dependency.camel.version>
|
||||
<dependency.activemq.version>5.16.0</dependency.activemq.version>
|
||||
<dependency.camel.version>3.7.4</dependency.camel.version>
|
||||
<dependency.activemq.version>5.16.1</dependency.activemq.version>
|
||||
<dependency.apache-compress.version>1.20</dependency.apache-compress.version>
|
||||
<dependency.apache.taglibs.version>1.2.5</dependency.apache.taglibs.version>
|
||||
<dependency.awaitility.version>4.0.3</dependency.awaitility.version>
|
||||
<dependency.awaitility.version>4.1.0</dependency.awaitility.version>
|
||||
|
||||
<alfresco.googledrive.version>3.2.0</alfresco.googledrive.version>
|
||||
<alfresco.aos-module.version>1.4.0-M1</alfresco.aos-module.version>
|
||||
<dependency.jakarta-jaxb-api.version>2.3.3</dependency.jakarta-jaxb-api.version>
|
||||
<dependency.jakarta-ws-api.version>2.3.3</dependency.jakarta-ws-api.version>
|
||||
<dependency.jakarta-soap-api.version>1.4.2</dependency.jakarta-soap-api.version>
|
||||
<dependency.jakarta-activation-api.version>1.2.2</dependency.jakarta-activation-api.version>
|
||||
<dependency.jakarta-annotation-api.version>1.3.5</dependency.jakarta-annotation-api.version>
|
||||
<dependency.jakarta-transaction-api.version>1.3.3</dependency.jakarta-transaction-api.version>
|
||||
<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-rpc-api.version>1.1.4</dependency.jakarta-rpc-api.version>
|
||||
|
||||
<dependency.postgresql.version>42.2.18</dependency.postgresql.version>
|
||||
<dependency.mysql.version>8.0.22</dependency.mysql.version>
|
||||
<dependency.mariadb.version>2.7.0</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.40</dependency.tas-utility.version>
|
||||
<alfresco.googledrive.version>3.2.1.3</alfresco.googledrive.version>
|
||||
<alfresco.aos-module.version>1.4.0.1</alfresco.aos-module.version>
|
||||
|
||||
<dependency.postgresql.version>42.2.20</dependency.postgresql.version>
|
||||
<dependency.mysql.version>8.0.25</dependency.mysql.version>
|
||||
<dependency.mariadb.version>2.7.2</dependency.mariadb.version>
|
||||
<dependency.tas-utility.version>3.0.44</dependency.tas-utility.version>
|
||||
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
|
||||
<dependency.javax.json.version>1.1.4</dependency.javax.json.version>
|
||||
<dependency.tas-restapi.version>1.48</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.21</dependency.tas-cmis.version>
|
||||
<dependency.tas-restapi.version>1.58</dependency.tas-restapi.version>
|
||||
<dependency.tas-cmis.version>1.30</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>
|
||||
<dependency.tas-dataprep.version>2.3</dependency.tas-dataprep.version>
|
||||
<dependency.tas-dataprep.version>2.6</dependency.tas-dataprep.version>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<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>repo-5439-M3c1</tag>
|
||||
<tag>9.40</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -128,6 +133,92 @@
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>${dependency.jakarta-jaxb-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>${dependency.jakarta-jaxb-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.ws</groupId>
|
||||
<artifactId>jakarta.xml.ws-api</artifactId>
|
||||
<version>${dependency.jakarta-ws-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.soap</groupId>
|
||||
<artifactId>jakarta.xml.soap-api</artifactId>
|
||||
<version>${dependency.jakarta-soap-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
<version>${dependency.jakarta-activation-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>jakarta.activation</artifactId>
|
||||
<version>${dependency.jakarta-activation-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${dependency.jakarta-annotation-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
<version>${dependency.jakarta-transaction-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
<version>${dependency.jakarta-jws-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<version>${dependency.jakarta-mail-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
<version>${dependency.jakarta-mail-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.json</groupId>
|
||||
<artifactId>jakarta.json-api</artifactId>
|
||||
<version>${dependency.jakarta-json-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>jakarta.json</artifactId>
|
||||
<version>${dependency.jakarta-json-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.rpc</groupId>
|
||||
<artifactId>jakarta.xml.rpc-api</artifactId>
|
||||
<version>${dependency.jakarta-rpc-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.rpc</groupId>
|
||||
<artifactId>jaxrpc-impl</artifactId>
|
||||
<version>${dependency.jakarta-rpc-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-jlan-embed</artifactId>
|
||||
@@ -142,6 +233,13 @@
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-heartbeat-data-sender</artifactId>
|
||||
<version>${dependency.alfresco-hb-data-sender.version}</version>
|
||||
<exclusions>
|
||||
<!-- Duplicates classes from jakarta.xml.bind:jakarta.xml.bind-api -->
|
||||
<exclusion>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xalan</groupId>
|
||||
@@ -159,26 +257,18 @@
|
||||
<groupId>org.alfresco.services</groupId>
|
||||
<artifactId>alfresco-messaging-repo</artifactId>
|
||||
<version>${dependency.alfresco-messaging-repo.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-broker</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-mmt</artifactId>
|
||||
<version>${dependency.alfresco-mmt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<version>${dependency.alfresco-pdf-renderer.version}</version>
|
||||
<classifier>linux</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<version>${dependency.alfresco-pdf-renderer.version}</version>
|
||||
<classifier>win64</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-server-root</artifactId>
|
||||
@@ -261,21 +351,12 @@
|
||||
<artifactId>commons-digester</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>${dependency.jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
@@ -399,11 +480,6 @@
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
<version>${dependency.jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
@@ -474,8 +550,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.67</version>
|
||||
<!-- <version>${dependency.bouncycastle.version}</version>-->
|
||||
<version>${dependency.bouncycastle.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
@@ -508,13 +583,13 @@
|
||||
<dependency>
|
||||
<groupId>com.drewnoakes</groupId>
|
||||
<artifactId>metadata-extractor</artifactId>
|
||||
<version>2.15.0</version>
|
||||
<version>2.16.0</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
<artifactId>junrar</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>7.4.0</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
@@ -523,22 +598,10 @@
|
||||
<version>1.13.1</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${dependency.guava.version}</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.20</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>${dependency.pdfbox.version}</version>
|
||||
<version>${dependency.apache-compress.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -577,12 +640,6 @@
|
||||
<version>${dependency.rest-assured.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.json</artifactId>
|
||||
<version>${dependency.javax.json.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>restapi</artifactId>
|
||||
@@ -619,15 +676,10 @@
|
||||
<version>${dependency.tas-dataprep.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.transaction</groupId>
|
||||
<artifactId>jakarta.transaction-api</artifactId>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.8</version>
|
||||
<version>2.10.10</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided dependencies -->
|
||||
@@ -642,7 +694,7 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13</version>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -667,6 +719,75 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${dependency.gson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-activemq</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-broker</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-amqp</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<exclusions>
|
||||
<!-- conflicts with activemq geronimo-jms_1.1_spec -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jms_2.0_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-jackson</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-directvm</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-direct</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-management</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-mock</artifactId>
|
||||
<version>${dependency.camel.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -683,8 +804,8 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.34.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -693,7 +814,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -708,5 +829,4 @@
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>repo-5439-M3c1</version>
|
||||
<version>9.40</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -16,38 +16,13 @@
|
||||
<artifactId>alfresco-repository</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jakarta... -->
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-data-model</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<!-- Duplicate classes from com.sun.activation:jakarta.activation-->
|
||||
<exclusion>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>javax.activation</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-4998 - Exclusion due to classpath conflicts between org.codehaus.woodstox:woodstox-core-asl and com.fasterxml.woodstox:woodstox-core -->
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicate classes from jakarta.annotation:jakarta.annotation-api-->
|
||||
<exclusion>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-5009 Excluded to avoid duplicated classes with javax.jws:javax.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>jakarta.xml.rpc</groupId>
|
||||
<artifactId>jakarta.xml.rpc-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
@@ -79,23 +54,12 @@
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
<artifactId>spring-webscripts</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml</groupId>
|
||||
<artifactId>jaxrpc-api</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This is needed at runtime by Web Client, so not really a test dependency -->
|
||||
<dependency>
|
||||
<groupId>org.apache.chemistry.opencmis</groupId>
|
||||
<artifactId>chemistry-opencmis-test-tck</artifactId>
|
||||
<version>${dependency.opencmis.version}</version>
|
||||
<exclusions>
|
||||
<!-- Duplicate classes from com.sun.activation:jakarta.activation-->
|
||||
<exclusion>
|
||||
<groupId>com.sun.activation</groupId>
|
||||
<artifactId>javax.activation</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-5009 Excluded to avoid duplicated classes with javax.jws:javax.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
@@ -141,18 +105,6 @@
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
</exclusion>
|
||||
<!-- Duplicates classes from jakarta.xml.bind:jakarta.xml.bind-api -->
|
||||
<exclusion>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.surf</groupId>
|
||||
@@ -195,6 +147,11 @@
|
||||
<version>2.0</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
<!-- REPO-5009 Excluded to avoid duplicated classes with javax.jws:javax.jws-api -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
@@ -207,101 +164,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-mock</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<!-- Profiles to extract the alfresco-pdf-renderer -->
|
||||
<profile>
|
||||
<id>win-alfresco-pdf-renderer-test</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>windows</family>
|
||||
</os>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<classifier>win64</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<inherited>false</inherited>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>extract-alfresco-pdf-renderer-test</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${skipTests}</skip>
|
||||
<target>
|
||||
<echo message="Extracting alfresco-pdf-renderer (windows) for testing..." />
|
||||
<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
|
||||
<untar compression="gzip" src="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-win64.tgz" dest="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>linux-alfresco-pdf-renderer-test</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>linux</family>
|
||||
</os>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-pdf-renderer</artifactId>
|
||||
<classifier>linux</classifier>
|
||||
<type>tgz</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<inherited>false</inherited>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>extract-alfresco-pdf-renderer-test</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${skipTests}</skip>
|
||||
<target>
|
||||
<echo message="Extracting alfresco-pdf-renderer (linux) for testing..." />
|
||||
<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
|
||||
<exec failonerror="true" executable="tar" dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer">
|
||||
<arg value="xf" />
|
||||
<arg value="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-linux.tgz" />
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@@ -335,8 +203,6 @@
|
||||
<!-- To prevent tests alfresco.log to be created in project roots and bother while synchronizing with SCM -->
|
||||
<workingDirectory>${project.build.directory}</workingDirectory>
|
||||
<systemPropertyVariables>
|
||||
<alfresco-pdf-renderer.exe>${alfresco-pdf-renderer.exe}</alfresco-pdf-renderer.exe>
|
||||
|
||||
<!-- Database related properties -->
|
||||
<db.url>${db.url}</db.url>
|
||||
<db.driver>${db.driver}</db.driver>
|
||||
@@ -344,7 +210,6 @@
|
||||
<db.username>${db.username}</db.username>
|
||||
<db.password>${db.password}</db.password>
|
||||
<dir.root>${dir.root}</dir.root>
|
||||
<img.exe>${img.exe}</img.exe>
|
||||
<!-- BDE-91 -->
|
||||
<alfresco.rmi.services.retries>30</alfresco.rmi.services.retries>
|
||||
<alfresco.rmi.services.retryInterval>2000</alfresco.rmi.services.retryInterval>
|
||||
|
@@ -1,62 +1,61 @@
|
||||
/*
|
||||
* #%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.solr;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.httpclient.HttpClientFactory;
|
||||
import org.alfresco.repo.web.filter.beans.DependencyInjectedFilter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* This filter protects the solr callback urls by verifying MACs on requests and encrypting responses
|
||||
* and generating MACs on responses, if the secureComms property is set to "md5". If it is set to "https"
|
||||
* or "none", the filter does nothing to the request and response.
|
||||
*
|
||||
* This filter protects the solr callback urls by verifying a shared secret on the request header if
|
||||
* the secureComms property is set to "secret". If it is set to "https", this will will just verify
|
||||
* that the request came in through a "secure" tomcat connector. (but it will not validate the certificate
|
||||
* on the request; this done in a different filter).
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
public class SOLRAuthenticationFilter implements DependencyInjectedFilter
|
||||
public class SOLRAuthenticationFilter implements DependencyInjectedFilter, InitializingBean
|
||||
{
|
||||
public static enum SecureCommsType
|
||||
{
|
||||
HTTPS, NONE;
|
||||
HTTPS, SECRET, NONE;
|
||||
|
||||
public static SecureCommsType getType(String type)
|
||||
{
|
||||
@@ -64,6 +63,10 @@ public class SOLRAuthenticationFilter implements DependencyInjectedFilter
|
||||
{
|
||||
return HTTPS;
|
||||
}
|
||||
else if(type.equalsIgnoreCase("secret"))
|
||||
{
|
||||
return SECRET;
|
||||
}
|
||||
else if(type.equalsIgnoreCase("none"))
|
||||
{
|
||||
return NONE;
|
||||
@@ -79,7 +82,11 @@ public class SOLRAuthenticationFilter implements DependencyInjectedFilter
|
||||
private static Log logger = LogFactory.getLog(SOLRAuthenticationFilter.class);
|
||||
|
||||
private SecureCommsType secureComms = SecureCommsType.HTTPS;
|
||||
|
||||
|
||||
private String sharedSecret;
|
||||
|
||||
private String sharedSecretHeader = HttpClientFactory.DEFAULT_SHAREDSECRET_HEADER;
|
||||
|
||||
public void setSecureComms(String type)
|
||||
{
|
||||
try
|
||||
@@ -92,6 +99,33 @@ public class SOLRAuthenticationFilter implements DependencyInjectedFilter
|
||||
}
|
||||
}
|
||||
|
||||
public void setSharedSecret(String sharedSecret)
|
||||
{
|
||||
this.sharedSecret = sharedSecret;
|
||||
}
|
||||
|
||||
public void setSharedSecretHeader(String sharedSecretHeader)
|
||||
{
|
||||
this.sharedSecretHeader = sharedSecretHeader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
if(secureComms == SecureCommsType.SECRET)
|
||||
{
|
||||
if(sharedSecret == null || sharedSecret.length()==0)
|
||||
{
|
||||
logger.fatal("Missing value for solr.sharedSecret configuration property. If solr.secureComms is set to \"secret\", a value for solr.sharedSecret is required. See https://docs.alfresco.com/search-services/latest/install/options/");
|
||||
throw new AlfrescoRuntimeException("Missing value for solr.sharedSecret configuration property");
|
||||
}
|
||||
if(sharedSecretHeader == null || sharedSecretHeader.length()==0)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Missing value for sharedSecretHeader");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doFilter(ServletContext context, ServletRequest request,
|
||||
ServletResponse response, FilterChain chain) throws IOException,
|
||||
ServletException
|
||||
@@ -99,52 +133,22 @@ public class SOLRAuthenticationFilter implements DependencyInjectedFilter
|
||||
HttpServletRequest httpRequest = (HttpServletRequest)request;
|
||||
HttpServletResponse httpResponse = (HttpServletResponse)response;
|
||||
|
||||
/* if(secureComms == SecureCommsType.ALFRESCO)
|
||||
if(secureComms == SecureCommsType.SECRET)
|
||||
{
|
||||
// Need to get as a byte array because we need to read the request twice, once for authentication
|
||||
// and again by the web service.
|
||||
SOLRHttpServletRequestWrapper requestWrapper = new SOLRHttpServletRequestWrapper(httpRequest, encryptionUtils);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
if(sharedSecret.equals(httpRequest.getHeader(sharedSecretHeader)))
|
||||
{
|
||||
logger.debug("Authenticating " + httpRequest.getRequestURI());
|
||||
}
|
||||
|
||||
if(encryptionUtils.authenticate(httpRequest, requestWrapper.getDecryptedBody()))
|
||||
{
|
||||
try
|
||||
{
|
||||
OutputStream out = response.getOutputStream();
|
||||
|
||||
GenericResponseWrapper responseWrapper = new GenericResponseWrapper(httpResponse);
|
||||
|
||||
// TODO - do I need to chain to other authenticating filters - probably not?
|
||||
// Could also remove sending of credentials with http request
|
||||
chain.doFilter(requestWrapper, responseWrapper);
|
||||
|
||||
Pair<byte[], AlgorithmParameters> pair = encryptor.encrypt(KeyProvider.ALIAS_SOLR, null, responseWrapper.getData());
|
||||
|
||||
encryptionUtils.setResponseAuthentication(httpRequest, httpResponse, responseWrapper.getData(), pair.getSecond());
|
||||
|
||||
httpResponse.setHeader("Content-Length", Long.toString(pair.getFirst().length));
|
||||
out.write(pair.getFirst());
|
||||
out.close();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("", e);
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
httpResponse.setStatus(401);
|
||||
httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN, "Authentication failure");
|
||||
}
|
||||
}
|
||||
else */if(secureComms == SecureCommsType.HTTPS)
|
||||
else if(secureComms == SecureCommsType.HTTPS)
|
||||
{
|
||||
if(httpRequest.isSecure())
|
||||
{
|
||||
// https authentication
|
||||
// https authentication; cert got verified in X509 filter
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
else
|
||||
@@ -158,128 +162,4 @@ public class SOLRAuthenticationFilter implements DependencyInjectedFilter
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean validateTimestamp(String timestampStr)
|
||||
{
|
||||
if(timestampStr == null || timestampStr.equals(""))
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Missing timestamp on request");
|
||||
}
|
||||
long timestamp = -1;
|
||||
try
|
||||
{
|
||||
timestamp = Long.valueOf(timestampStr);
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid timestamp on request");
|
||||
}
|
||||
if(timestamp == -1)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid timestamp on request");
|
||||
}
|
||||
long currentTime = System.currentTimeMillis();
|
||||
return((currentTime - timestamp) < 30 * 1000); // 5s
|
||||
}
|
||||
|
||||
/* private static class SOLRHttpServletRequestWrapper extends HttpServletRequestWrapper
|
||||
{
|
||||
private byte[] body;
|
||||
|
||||
SOLRHttpServletRequestWrapper(HttpServletRequest req, EncryptionUtils encryptionUtils) throws IOException
|
||||
{
|
||||
super(req);
|
||||
this.body = encryptionUtils.decryptBody(req);
|
||||
}
|
||||
|
||||
byte[] getDecryptedBody()
|
||||
{
|
||||
return body;
|
||||
}
|
||||
|
||||
public ServletInputStream getInputStream()
|
||||
{
|
||||
final InputStream in = (body != null ? new ByteArrayInputStream(body) : null);
|
||||
return new ServletInputStream()
|
||||
{
|
||||
public int read() throws IOException
|
||||
{
|
||||
if(in == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = in.read();
|
||||
if(i == -1)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}*/
|
||||
|
||||
private static class ByteArrayServletOutputStream extends ServletOutputStream
|
||||
{
|
||||
private ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
|
||||
ByteArrayServletOutputStream()
|
||||
{
|
||||
}
|
||||
|
||||
public byte[] getData()
|
||||
{
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException
|
||||
{
|
||||
out.write(b);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GenericResponseWrapper extends HttpServletResponseWrapper {
|
||||
private ByteArrayServletOutputStream output;
|
||||
private int contentLength;
|
||||
private String contentType;
|
||||
|
||||
public GenericResponseWrapper(HttpServletResponse response) {
|
||||
super(response);
|
||||
output = new ByteArrayServletOutputStream();
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return output.getData();
|
||||
}
|
||||
|
||||
public ServletOutputStream getOutputStream() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public PrintWriter getWriter() {
|
||||
return new PrintWriter(getOutputStream(),true);
|
||||
}
|
||||
|
||||
public void setContentLength(int length) {
|
||||
this.contentLength = length;
|
||||
super.setContentLength(length);
|
||||
}
|
||||
|
||||
public int getContentLength() {
|
||||
return contentLength;
|
||||
}
|
||||
|
||||
public void setContentType(String type) {
|
||||
this.contentType = type;
|
||||
super.setContentType(type);
|
||||
}
|
||||
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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.webdav;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -82,8 +82,6 @@ public class UnlockMethod extends WebDAVMethod
|
||||
{
|
||||
if (!(strLockTokenHeader.startsWith("<") && strLockTokenHeader.endsWith(">")))
|
||||
{
|
||||
// ALF-13904: Header isn't correctly enclosed in < and > characters. Try correcting this
|
||||
// to allow for Windows 7 + OpenOffice.org bug.
|
||||
strLockTokenHeader = "<" + strLockTokenHeader + ">";
|
||||
}
|
||||
if (strLockTokenHeader.startsWith("<" + WebDAV.OPAQUE_LOCK_TOKEN) && strLockTokenHeader.endsWith(">"))
|
||||
|
@@ -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.webdav;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -31,7 +31,6 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.UnavailableException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@@ -716,7 +716,7 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!pathInfo.substring(0, 6).toLowerCase().equals("/cmis/") && !pathInfo.equals("/discovery"))
|
||||
if((pathInfo.length() > 5 && !pathInfo.substring(0, 6).toLowerCase().equals("/cmis/")) && !pathInfo.equals("/discovery"))
|
||||
{
|
||||
// remove tenant
|
||||
int idx = pathInfo.indexOf('/', 1);
|
||||
|
51
remote-api/src/main/java/org/alfresco/rest/api/Aspects.java
Normal file
51
remote-api/src/main/java/org/alfresco/rest/api/Aspects.java
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* #%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.api;
|
||||
|
||||
import org.alfresco.rest.api.model.Aspect;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
|
||||
/**
|
||||
* Aspect API
|
||||
*/
|
||||
public interface Aspects
|
||||
{
|
||||
/**
|
||||
* Lists aspects
|
||||
* @param params
|
||||
* @return Collection of aspects
|
||||
*/
|
||||
CollectionWithPagingInfo<Aspect> listAspects(Parameters params);
|
||||
|
||||
/**
|
||||
* Gets an aspect by id
|
||||
* @param aspectId
|
||||
* @return an aspect
|
||||
*/
|
||||
Aspect getAspect(String aspectId);
|
||||
}
|
@@ -25,15 +25,14 @@
|
||||
*/
|
||||
package org.alfresco.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.model.NodeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
|
||||
/**
|
||||
* Maps representations from TypeDefinition to NodeDefinition
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public interface NodeDefinitionMapper
|
||||
public interface ClassDefinitionMapper
|
||||
{
|
||||
NodeDefinition fromTypeDefinition(TypeDefinition typeDefinition, MessageLookup messageLookup);
|
||||
org.alfresco.rest.api.model.ClassDefinition fromDictionaryClassDefinition(org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, MessageLookup messageLookup);
|
||||
}
|
53
remote-api/src/main/java/org/alfresco/rest/api/Types.java
Normal file
53
remote-api/src/main/java/org/alfresco/rest/api/Types.java
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* #%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.api;
|
||||
|
||||
import org.alfresco.rest.api.model.Type;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
|
||||
/**
|
||||
* Types API
|
||||
*/
|
||||
public interface Types
|
||||
{
|
||||
/**
|
||||
* Lists types
|
||||
*
|
||||
* @param params
|
||||
* @return Collection of types
|
||||
*/
|
||||
CollectionWithPagingInfo<Type> listTypes(Parameters params);
|
||||
|
||||
/**
|
||||
* Gets a type by id
|
||||
*
|
||||
* @param typeId
|
||||
* @return type
|
||||
*/
|
||||
Type getType(String typeId);
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%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.api.aspects;
|
||||
|
||||
import org.alfresco.rest.api.Aspects;
|
||||
import org.alfresco.rest.api.model.Aspect;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@EntityResource(name = "aspects", title = "Aspects")
|
||||
public class AspectEntityResource implements EntityResourceAction.ReadById<Aspect>, EntityResourceAction.Read<Aspect>, InitializingBean
|
||||
{
|
||||
|
||||
private Aspects aspects;
|
||||
|
||||
public void setAspects(Aspects aspects)
|
||||
{
|
||||
this.aspects = aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("aspects", this.aspects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Aspect> readAll(Parameters params)
|
||||
{
|
||||
return aspects.listAspects(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect readById(String id, Parameters parameters)
|
||||
{
|
||||
return aspects.getAspect(id);
|
||||
}
|
||||
}
|
@@ -1,38 +1,30 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* 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
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General 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.search.impl;
|
||||
|
||||
/**
|
||||
* Json returned from Solr
|
||||
*
|
||||
* @author Gethin James
|
||||
* @since 5.0
|
||||
*/
|
||||
public interface JSONResult
|
||||
{
|
||||
public Long getQueryTime();
|
||||
public long getNumberFound();
|
||||
}
|
||||
@WebApi(name="alfresco", scope= Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rest.api.aspects;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
* #%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.api.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.AssociationSource;
|
||||
import org.alfresco.rest.api.model.Association;
|
||||
import org.alfresco.rest.api.model.AbstractClass;
|
||||
import org.alfresco.rest.api.model.PropertyDefinition;
|
||||
import org.alfresco.rest.api.model.ClassDefinition;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.where.Query;
|
||||
import org.alfresco.rest.framework.resource.parameters.where.QueryHelper;
|
||||
import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker;
|
||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class AbstractClassImpl<T extends AbstractClass> {
|
||||
static String PARAM_MODEL_IDS = "modelId";
|
||||
static String PARAM_PARENT_IDS = "parentId";
|
||||
static String PARAM_NAMESPACE_URI = "namespaceUri";
|
||||
static String PARAM_INCLUDE_SUBASPECTS = "INCLUDESUBASPECTS";
|
||||
static String PARAM_INCLUDE_SUBTYPES = "INCLUDESUBTYPES";
|
||||
static String PARAM_INCLUDE_PROPERTIES = "properties";
|
||||
static String PARAM_INCLUDE_MANDATORY_ASPECTS = "mandatoryAspects";
|
||||
static String PARAM_INCLUDE_ASSOCIATIONS = "associations";
|
||||
static List<String> ALL_PROPERTIES = ImmutableList.of(PARAM_INCLUDE_PROPERTIES, PARAM_INCLUDE_MANDATORY_ASPECTS, PARAM_INCLUDE_ASSOCIATIONS);
|
||||
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespacePrefixResolver namespaceService;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
AbstractClassImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespaceService, ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
this.namespaceService = namespaceService;
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
public CollectionWithPagingInfo<T> createPagedResult(List<T> list, Paging paging)
|
||||
{
|
||||
int skipCount = paging.getSkipCount();
|
||||
int maxItems = paging.getMaxItems();
|
||||
int totalItems = list.size();
|
||||
|
||||
Collections.sort(list);
|
||||
|
||||
if (skipCount >= totalItems)
|
||||
{
|
||||
List<T> empty = Collections.emptyList();
|
||||
return CollectionWithPagingInfo.asPaged(paging, empty, false, totalItems);
|
||||
}
|
||||
else
|
||||
{
|
||||
int end = Math.min(skipCount + maxItems, totalItems);
|
||||
boolean hasMoreItems = totalItems > end;
|
||||
list = list.subList(skipCount, end);
|
||||
return CollectionWithPagingInfo.asPaged(paging, list, hasMoreItems, totalItems);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean filterByNamespace(ModelApiFilter query, QName qName)
|
||||
{
|
||||
//System aspect/type is not allowed
|
||||
if (qName.getNamespaceURI().equals(NamespaceService.SYSTEM_MODEL_1_0_URI))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (query != null && query.getMatchedPrefix() != null)
|
||||
{
|
||||
return Pattern.matches(query.getMatchedPrefix(), qName.getNamespaceURI());
|
||||
}
|
||||
if (query != null && query.getNotMatchedPrefix() != null)
|
||||
{
|
||||
return !Pattern.matches(query.getNotMatchedPrefix(), qName.getNamespaceURI());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public ModelApiFilter getQuery(Query queryParameters)
|
||||
{
|
||||
if (queryParameters != null)
|
||||
{
|
||||
ClassQueryWalker propertyWalker = new ClassQueryWalker();
|
||||
QueryHelper.walk(queryParameters, propertyWalker);
|
||||
|
||||
return ModelApiFilter.builder()
|
||||
.withModelId(propertyWalker.getModelIds())
|
||||
.withParentIds(propertyWalker.getParentIds())
|
||||
.withMatchPrefix(propertyWalker.getMatchedPrefix())
|
||||
.withNotMatchPrefix(propertyWalker.getNotMatchedPrefix())
|
||||
.build();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void validateListParam(Set<String> listParam, String paramName)
|
||||
{
|
||||
if (listParam.isEmpty())
|
||||
{
|
||||
throw new IllegalArgumentException(StringUtils.capitalize(paramName) + "s filter list cannot be empty.");
|
||||
}
|
||||
|
||||
listParam.stream()
|
||||
.filter(StringUtils::isBlank)
|
||||
.findAny()
|
||||
.ifPresent(qName -> {
|
||||
throw new IllegalArgumentException(StringUtils.capitalize(paramName) + " cannot be empty (i.e. '')");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected Set<Pair<QName,Boolean>> parseModelIds(Set<String> modelIds, String apiSuffix)
|
||||
{
|
||||
return modelIds.stream().map(modelId ->
|
||||
{
|
||||
QName qName = null;
|
||||
boolean filterIncludeSubClass = false;
|
||||
|
||||
int idx = modelId.lastIndexOf(' ');
|
||||
if (idx > 0)
|
||||
{
|
||||
String suffix = modelId.substring(idx);
|
||||
if (suffix.equalsIgnoreCase(" " + apiSuffix))
|
||||
{
|
||||
filterIncludeSubClass = true;
|
||||
modelId = modelId.substring(0, idx);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
qName = QName.createQName(modelId, this.namespaceService);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidArgumentException(modelId + " isn't a valid QName. " + ex.getMessage());
|
||||
}
|
||||
|
||||
if (qName == null)
|
||||
throw new InvalidArgumentException(modelId + " isn't a valid QName. ");
|
||||
|
||||
return new Pair<>(qName, filterIncludeSubClass);
|
||||
}).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
public T constructFromFilters(T abstractClass, org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, List<String> includes) {
|
||||
|
||||
if (includes != null && includes.contains(PARAM_INCLUDE_PROPERTIES))
|
||||
{
|
||||
List<PropertyDefinition> properties = Collections.emptyList();
|
||||
ClassDefinition _classDefinition = this.classDefinitionMapper.fromDictionaryClassDefinition(classDefinition, dictionaryService);
|
||||
if (_classDefinition.getProperties() != null)
|
||||
{
|
||||
properties = _classDefinition.getProperties();
|
||||
}
|
||||
abstractClass.setProperties(properties);
|
||||
}
|
||||
|
||||
if (includes != null && includes.contains(PARAM_INCLUDE_ASSOCIATIONS))
|
||||
{
|
||||
List<Association> associations = getAssociations(classDefinition.getAssociations());
|
||||
abstractClass.setAssociations(associations);
|
||||
}
|
||||
|
||||
if (includes != null && includes.contains(PARAM_INCLUDE_MANDATORY_ASPECTS))
|
||||
{
|
||||
if (classDefinition.getDefaultAspectNames() != null)
|
||||
{
|
||||
List<String> aspects = classDefinition.getDefaultAspectNames().stream().map(QName::toPrefixString).collect(Collectors.toList());
|
||||
abstractClass.setMandatoryAspects(aspects);
|
||||
}
|
||||
}
|
||||
|
||||
abstractClass.setIsContainer(classDefinition.isContainer());
|
||||
abstractClass.setIsArchive(classDefinition.getArchive());
|
||||
abstractClass.setIncludedInSupertypeQuery(classDefinition.getIncludedInSuperTypeQuery());
|
||||
return abstractClass;
|
||||
}
|
||||
|
||||
List<Association> getAssociations(Map<QName, AssociationDefinition> associationDefinitionMap)
|
||||
{
|
||||
Collection<AssociationDefinition> associationDefinitions = associationDefinitionMap.values();
|
||||
|
||||
if (associationDefinitions.size() == 0)
|
||||
return Collections.emptyList();
|
||||
|
||||
List<Association> associations = new ArrayList<Association>();
|
||||
|
||||
for (AssociationDefinition definition : associationDefinitions)
|
||||
{
|
||||
Association association = new Association();
|
||||
|
||||
association.setId(definition.getName().toPrefixString());
|
||||
association.setTitle(definition.getTitle());
|
||||
association.setDescription(definition.getDescription());
|
||||
association.setIsChild(definition.isChild());
|
||||
association.setIsProtected(definition.isProtected());
|
||||
|
||||
AssociationSource source = new AssociationSource();
|
||||
|
||||
String sourceRole = definition.getSourceRoleName() != null ? definition.getSourceRoleName().toPrefixString() : null;
|
||||
source.setRole(sourceRole);
|
||||
|
||||
String sourceClass = definition.getSourceClass() != null ? definition.getSourceClass().getName().toPrefixString() : null;
|
||||
source.setCls(sourceClass);
|
||||
|
||||
source.setIsMany(definition.isSourceMany());
|
||||
source.setIsMandatory(definition.isSourceMandatory());
|
||||
|
||||
AssociationSource target = new AssociationSource();
|
||||
String targetRole = definition.getTargetRoleName() != null ? definition.getTargetRoleName().toPrefixString() : null;
|
||||
target.setRole(targetRole);
|
||||
|
||||
String targetClass = definition.getTargetClass() != null ? definition.getTargetClass().getName().toPrefixString() : null;
|
||||
target.setCls(targetClass);
|
||||
|
||||
target.setIsMany(definition.isTargetMany());
|
||||
target.setIsMandatory(definition.isTargetMandatory());
|
||||
target.setIsMandatoryEnforced(definition.isTargetMandatoryEnforced());
|
||||
|
||||
association.setSource(source);
|
||||
association.setTarget(target);
|
||||
associations.add(association);
|
||||
}
|
||||
|
||||
return associations;
|
||||
}
|
||||
|
||||
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
|
||||
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
|
||||
}
|
||||
|
||||
public static class ClassQueryWalker extends MapBasedQueryWalker
|
||||
{
|
||||
private Set<String> modelIds = null;
|
||||
private Set<String> parentIds = null;
|
||||
private String notMatchedPrefix = null;
|
||||
private String matchedPrefix = null;
|
||||
|
||||
public ClassQueryWalker()
|
||||
{
|
||||
super(new HashSet<>(Arrays.asList(PARAM_MODEL_IDS, PARAM_PARENT_IDS)), new HashSet<>(Collections.singleton(PARAM_NAMESPACE_URI)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void in(String propertyName, boolean negated, String... propertyValues)
|
||||
{
|
||||
if (negated)
|
||||
{
|
||||
throw new InvalidArgumentException("Cannot use NOT for " + propertyName);
|
||||
}
|
||||
|
||||
if (propertyName.equalsIgnoreCase(PARAM_MODEL_IDS))
|
||||
{
|
||||
modelIds = new HashSet<>(Arrays.asList(propertyValues));
|
||||
}
|
||||
|
||||
if (propertyName.equalsIgnoreCase(PARAM_PARENT_IDS))
|
||||
{
|
||||
parentIds = new HashSet<>(Arrays.asList(propertyValues));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void matches(String property, String value, boolean negated)
|
||||
{
|
||||
if (negated && property.equals(PARAM_NAMESPACE_URI))
|
||||
{
|
||||
notMatchedPrefix = value;
|
||||
}
|
||||
else if (property.equals(PARAM_NAMESPACE_URI))
|
||||
{
|
||||
matchedPrefix = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getModelIds()
|
||||
{
|
||||
return this.modelIds;
|
||||
}
|
||||
|
||||
public Set<String> getParentIds()
|
||||
{
|
||||
return this.parentIds;
|
||||
}
|
||||
|
||||
public String getNotMatchedPrefix()
|
||||
{
|
||||
return this.notMatchedPrefix;
|
||||
}
|
||||
|
||||
public String getMatchedPrefix()
|
||||
{
|
||||
return this.matchedPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ModelApiFilter
|
||||
{
|
||||
private Set<String> modelIds;
|
||||
private Set<String> parentIds;
|
||||
private String matchedPrefix;
|
||||
private String notMatchedPrefix;
|
||||
|
||||
public ModelApiFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public Set<String> getModelIds()
|
||||
{
|
||||
return modelIds;
|
||||
}
|
||||
|
||||
public String getMatchedPrefix()
|
||||
{
|
||||
return matchedPrefix;
|
||||
}
|
||||
|
||||
public String getNotMatchedPrefix()
|
||||
{
|
||||
return notMatchedPrefix;
|
||||
}
|
||||
|
||||
public Set<String> getParentIds()
|
||||
{
|
||||
return parentIds;
|
||||
}
|
||||
|
||||
public static ModelApiFilterBuilder builder()
|
||||
{
|
||||
return new ModelApiFilterBuilder();
|
||||
}
|
||||
|
||||
public static class ModelApiFilterBuilder
|
||||
{
|
||||
private Set<String> modelIds;
|
||||
private Set<String> parentIds;
|
||||
private String matchedPrefix;
|
||||
private String notMatchedPrefix;
|
||||
|
||||
public ModelApiFilterBuilder withModelId(Set<String> modelIds)
|
||||
{
|
||||
this.modelIds = modelIds;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelApiFilterBuilder withParentIds(Set<String> parentIds)
|
||||
{
|
||||
this.parentIds = parentIds;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelApiFilterBuilder withMatchPrefix(String matchedPrefix)
|
||||
{
|
||||
this.matchedPrefix = matchedPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelApiFilterBuilder withNotMatchPrefix(String notMatchedPrefix)
|
||||
{
|
||||
this.notMatchedPrefix = notMatchedPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelApiFilter build()
|
||||
{
|
||||
ModelApiFilter modelApiFilter = new ModelApiFilter();
|
||||
modelApiFilter.modelIds = modelIds;
|
||||
modelApiFilter.parentIds = parentIds;
|
||||
modelApiFilter.matchedPrefix = matchedPrefix;
|
||||
modelApiFilter.notMatchedPrefix = notMatchedPrefix;
|
||||
return modelApiFilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* #%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.api.impl;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.rest.api.Aspects;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.Aspect;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceException;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class AspectsImpl extends AbstractClassImpl<Aspect> implements Aspects
|
||||
{
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespacePrefixResolver namespaceService;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
public void setNamespaceService(NamespacePrefixResolver namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
public void setClassDefinitionMapper(ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "dictionaryService", dictionaryService);
|
||||
PropertyCheck.mandatory(this, "namespaceService", namespaceService);
|
||||
PropertyCheck.mandatory(this, "classDefinitionMapper", classDefinitionMapper);
|
||||
}
|
||||
|
||||
AspectsImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespaceService, ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
super(dictionaryService, namespaceService, classDefinitionMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Aspect> listAspects(Parameters params)
|
||||
{
|
||||
Paging paging = params.getPaging();
|
||||
ModelApiFilter query = getQuery(params.getQuery());
|
||||
Stream<QName> aspectStream = null;
|
||||
|
||||
if (query != null && query.getModelIds() != null)
|
||||
{
|
||||
validateListParam(query.getModelIds(), PARAM_MODEL_IDS);
|
||||
Set<Pair<QName, Boolean>> modelsFilter = parseModelIds(query.getModelIds(), PARAM_INCLUDE_SUBASPECTS);
|
||||
aspectStream = modelsFilter.stream().map(this::getModelAspects).flatMap(Collection::stream);
|
||||
}
|
||||
else if (query != null && query.getParentIds() != null)
|
||||
{
|
||||
validateListParam(query.getParentIds(), PARAM_PARENT_IDS);
|
||||
aspectStream = query.getParentIds().stream().map(this::getChildAspects).flatMap(Collection::stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
aspectStream = this.dictionaryService.getAllAspects().stream();
|
||||
}
|
||||
|
||||
List<Aspect> allAspects = aspectStream.filter((qName) -> filterByNamespace(query, qName))
|
||||
.filter(distinctByKey(QName::getPrefixString))
|
||||
.map((qName) -> this.convertToAspect(dictionaryService.getAspect(qName), params.getInclude()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return createPagedResult(allAspects, paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getAspect(String aspectId)
|
||||
{
|
||||
if (aspectId == null)
|
||||
throw new InvalidArgumentException("Invalid parameter: unknown scheme specified");
|
||||
|
||||
AspectDefinition aspectDefinition = null;
|
||||
|
||||
try
|
||||
{
|
||||
aspectDefinition = dictionaryService.getAspect(QName.createQName(aspectId, this.namespaceService));
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new EntityNotFoundException(aspectId);
|
||||
}
|
||||
|
||||
if (aspectDefinition == null)
|
||||
throw new EntityNotFoundException(aspectId);
|
||||
|
||||
return this.convertToAspect(aspectDefinition, ALL_PROPERTIES);
|
||||
}
|
||||
|
||||
public Aspect convertToAspect(AspectDefinition aspectDefinition, List<String> includes)
|
||||
{
|
||||
try
|
||||
{
|
||||
Aspect aspect = new Aspect(aspectDefinition, dictionaryService);
|
||||
constructFromFilters(aspect, aspectDefinition, includes);
|
||||
return aspect;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to parse Aspect: " + aspectDefinition.getName() + " . " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Collection<QName> getModelAspects(Pair<QName,Boolean> model)
|
||||
{
|
||||
ModelDefinition modelDefinition = null;
|
||||
|
||||
try
|
||||
{
|
||||
modelDefinition = this.dictionaryService.getModel(model.getFirst());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
if (modelDefinition == null)
|
||||
throw new EntityNotFoundException("model");
|
||||
|
||||
Collection<QName> aspects = this.dictionaryService.getAspects(modelDefinition.getName());
|
||||
|
||||
if (!model.getSecond()) // look for model aspects alone
|
||||
return aspects;
|
||||
|
||||
Stream<QName> aspectStream = aspects.stream();
|
||||
Stream<QName> childrenStream = aspects.stream()
|
||||
.map(aspect -> this.dictionaryService.getSubAspects(aspect, false))
|
||||
.flatMap(Collection::stream);
|
||||
|
||||
return Stream.concat(aspectStream, childrenStream).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Collection<QName> getChildAspects(String aspectId)
|
||||
{
|
||||
Collection<QName> subAspects = null;
|
||||
try
|
||||
{
|
||||
QName parentAspect = QName.createQName(aspectId, this.namespaceService);
|
||||
subAspects = this.dictionaryService.getSubAspects(parentAspect, true);
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
return subAspects;
|
||||
}
|
||||
}
|
@@ -32,13 +32,8 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.rest.api.NodeDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.NodeDefinitionConstraint;
|
||||
import org.alfresco.rest.api.model.NodeDefinition;
|
||||
import org.alfresco.rest.api.model.NodeDefinitionProperty;
|
||||
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.model.ClassDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -47,33 +42,33 @@ import org.alfresco.service.namespace.QName;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
public class ClassDefinitionMapperImpl implements ClassDefinitionMapper
|
||||
{
|
||||
|
||||
private final List<String> EXCLUDED_NS = Arrays.asList(NamespaceService.SYSTEM_MODEL_1_0_URI);
|
||||
private static final List<QName> EXCLUDED_PROPS = Arrays.asList(ContentModel.PROP_CONTENT);
|
||||
|
||||
|
||||
@Override
|
||||
public NodeDefinition fromTypeDefinition(TypeDefinition typeDefinition,
|
||||
MessageLookup messageLookup)
|
||||
public ClassDefinition fromDictionaryClassDefinition(org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, MessageLookup messageLookup)
|
||||
{
|
||||
|
||||
if (typeDefinition == null)
|
||||
if (classDefinition == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Undefined definition for the node");
|
||||
throw new AlfrescoRuntimeException("Undefined ClassDefinition for the node");
|
||||
}
|
||||
NodeDefinition nodeDefinition = new NodeDefinition();
|
||||
nodeDefinition.setProperties(getProperties(typeDefinition.getProperties(), messageLookup));
|
||||
|
||||
return nodeDefinition;
|
||||
|
||||
ClassDefinition _classDefinition = new ClassDefinition();
|
||||
_classDefinition.setProperties(getProperties(classDefinition.getProperties(), messageLookup));
|
||||
|
||||
return _classDefinition;
|
||||
}
|
||||
|
||||
private boolean isPropertyExcluded(QName propertyName)
|
||||
private boolean isPropertyExcluded(QName propertyName)
|
||||
{
|
||||
return EXCLUDED_NS.contains(propertyName.getNamespaceURI()) || EXCLUDED_PROPS.contains(propertyName);
|
||||
}
|
||||
|
||||
private List <NodeDefinitionProperty> getProperties(Map<QName, PropertyDefinition> propertiesMap, MessageLookup messageLookup)
|
||||
private List <org.alfresco.rest.api.model.PropertyDefinition> getProperties(Map<QName, org.alfresco.service.cmr.dictionary.PropertyDefinition> propertiesMap, MessageLookup messageLookup)
|
||||
{
|
||||
return propertiesMap.values().stream()
|
||||
.filter(p -> !isPropertyExcluded(p.getName()))
|
||||
@@ -81,10 +76,10 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private NodeDefinitionProperty fromPropertyDefinitionToProperty(PropertyDefinition propertyDefinition,
|
||||
MessageLookup messageLookup)
|
||||
private org.alfresco.rest.api.model.PropertyDefinition fromPropertyDefinitionToProperty(org.alfresco.service.cmr.dictionary.PropertyDefinition propertyDefinition,
|
||||
MessageLookup messageLookup)
|
||||
{
|
||||
NodeDefinitionProperty property = new NodeDefinitionProperty();
|
||||
org.alfresco.rest.api.model.PropertyDefinition property = new org.alfresco.rest.api.model.PropertyDefinition();
|
||||
property.setId(propertyDefinition.getName().toPrefixString());
|
||||
property.setTitle(propertyDefinition.getTitle(messageLookup));
|
||||
property.setDescription(propertyDefinition.getDescription(messageLookup));
|
||||
@@ -99,8 +94,8 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
return property;
|
||||
}
|
||||
|
||||
private List<NodeDefinitionConstraint> getConstraints( Collection<ConstraintDefinition> constraintDefinitions,
|
||||
MessageLookup messageLookup)
|
||||
private List<org.alfresco.rest.api.model.ConstraintDefinition> getConstraints(Collection<org.alfresco.service.cmr.dictionary.ConstraintDefinition> constraintDefinitions,
|
||||
MessageLookup messageLookup)
|
||||
{
|
||||
|
||||
return constraintDefinitions.stream()
|
||||
@@ -109,10 +104,10 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private NodeDefinitionConstraint fromConstraintDefinitionToConstraint(ConstraintDefinition constraintDefinition,
|
||||
MessageLookup messageLookup)
|
||||
private org.alfresco.rest.api.model.ConstraintDefinition fromConstraintDefinitionToConstraint(org.alfresco.service.cmr.dictionary.ConstraintDefinition constraintDefinition,
|
||||
MessageLookup messageLookup)
|
||||
{
|
||||
NodeDefinitionConstraint constraint = new NodeDefinitionConstraint();
|
||||
org.alfresco.rest.api.model.ConstraintDefinition constraint = new org.alfresco.rest.api.model.ConstraintDefinition();
|
||||
constraint.setId(constraintDefinition.getConstraint().getShortName());
|
||||
constraint.setType(constraintDefinition.getConstraint().getType());
|
||||
constraint.setTitle(constraintDefinition.getTitle(messageLookup));
|
||||
@@ -120,5 +115,4 @@ public class NodeDefinitionMapperImpl implements NodeDefinitionMapper
|
||||
constraint.setParameters(constraintDefinition.getConstraint().getParameters());
|
||||
return constraint;
|
||||
}
|
||||
|
||||
}
|
@@ -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 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General 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.api.impl;
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.alfresco.repo.dictionary.M2Type;
|
||||
import org.alfresco.repo.dictionary.ValueDataTypeValidator;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.rest.api.CustomModels;
|
||||
import org.alfresco.rest.api.model.AbstractClassModel;
|
||||
import org.alfresco.rest.api.model.AbstractCustomClass;
|
||||
import org.alfresco.rest.api.model.AbstractCommonDetails;
|
||||
import org.alfresco.rest.api.model.CustomAspect;
|
||||
import org.alfresco.rest.api.model.CustomModel;
|
||||
@@ -331,9 +331,9 @@ public class CustomModelsImpl implements CustomModels
|
||||
}
|
||||
}
|
||||
|
||||
private void replacePrefix(List<? extends AbstractClassModel> existingTypesOrAspects, String modelOldNamespacePrefix, String modelNewNamespacePrefix)
|
||||
private void replacePrefix(List<? extends AbstractCustomClass> existingTypesOrAspects, String modelOldNamespacePrefix, String modelNewNamespacePrefix)
|
||||
{
|
||||
for(AbstractClassModel classModel : existingTypesOrAspects)
|
||||
for(AbstractCustomClass classModel : existingTypesOrAspects)
|
||||
{
|
||||
// Type/Aspect's parent name
|
||||
String parentName = classModel.getParentName();
|
||||
@@ -460,7 +460,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
return updateTypeAspect(modelName, type, parameters);
|
||||
}
|
||||
|
||||
private <T extends AbstractClassModel> T updateTypeAspect(String modelName, T classDef, Parameters parameters)
|
||||
private <T extends AbstractCustomClass> T updateTypeAspect(String modelName, T classDef, Parameters parameters)
|
||||
{
|
||||
// Check the current user is authorised to update the custom model
|
||||
validateCurrentUser();
|
||||
@@ -476,7 +476,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
|
||||
ModelDetails existingModelDetails = new ModelDetails(getCustomModelImpl(modelName));
|
||||
|
||||
List<? extends AbstractClassModel> allClassDefs = isAspect ? existingModelDetails.getAspects() : existingModelDetails.getTypes();
|
||||
List<? extends AbstractCustomClass> allClassDefs = isAspect ? existingModelDetails.getAspects() : existingModelDetails.getTypes();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
T existingClassDef = (T) getObjectByName(allClassDefs, name);
|
||||
@@ -1186,7 +1186,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
m2Class.setParentName(parentPrefixedName);
|
||||
}
|
||||
|
||||
private void validateTypeAspectParent(AbstractClassModel typeAspect, CustomModel existingModel)
|
||||
private void validateTypeAspectParent(AbstractCustomClass typeAspect, CustomModel existingModel)
|
||||
{
|
||||
String parentPrefixedName = typeAspect.getParentName();
|
||||
if (StringUtils.isBlank(parentPrefixedName))
|
||||
@@ -1305,7 +1305,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeProperties(AbstractClassModel existingDetails, AbstractClassModel newDetails, Parameters parameters, boolean isModelActive)
|
||||
private void mergeProperties(AbstractCustomClass existingDetails, AbstractCustomClass newDetails, Parameters parameters, boolean isModelActive)
|
||||
{
|
||||
validateList(newDetails.getProperties(), "cmm.rest_api.properties_empty_null");
|
||||
|
||||
@@ -1386,7 +1386,7 @@ public class CustomModelsImpl implements CustomModels
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteProperty(AbstractClassModel existingClassModel, String propertyName)
|
||||
private void deleteProperty(AbstractCustomClass existingClassModel, String propertyName)
|
||||
{
|
||||
// Transform existing properties into a map
|
||||
Map<String, CustomModelProperty> existingProperties = transformToMap(existingClassModel.getProperties(), toNameFunction());
|
||||
@@ -1427,9 +1427,9 @@ public class CustomModelsImpl implements CustomModels
|
||||
return result;
|
||||
}
|
||||
|
||||
private void validateTypeAspectDelete(Collection<? extends AbstractClassModel> list, String classPrefixedName)
|
||||
private void validateTypeAspectDelete(Collection<? extends AbstractCustomClass> list, String classPrefixedName)
|
||||
{
|
||||
for(AbstractClassModel acm : list)
|
||||
for(AbstractCustomClass acm : list)
|
||||
{
|
||||
if(classPrefixedName.equals(acm.getParentName()))
|
||||
{
|
||||
|
@@ -79,12 +79,12 @@ import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.repo.virtual.store.VirtualStore;
|
||||
import org.alfresco.rest.antlr.WhereClauseParser;
|
||||
import org.alfresco.rest.api.Activities;
|
||||
import org.alfresco.rest.api.NodeDefinitionMapper;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.rest.api.QuickShareLinks;
|
||||
import org.alfresco.rest.api.model.AssocChild;
|
||||
import org.alfresco.rest.api.model.AssocTarget;
|
||||
import org.alfresco.rest.api.model.NodeDefinition;
|
||||
import org.alfresco.rest.api.model.ClassDefinition;
|
||||
import org.alfresco.rest.api.model.Document;
|
||||
import org.alfresco.rest.api.model.Folder;
|
||||
import org.alfresco.rest.api.model.LockInfo;
|
||||
@@ -214,7 +214,7 @@ public class NodesImpl implements Nodes
|
||||
private RetryingTransactionHelper retryingTransactionHelper;
|
||||
private LockService lockService;
|
||||
private VirtualStore smartStore; // note: remove as part of REPO-1173
|
||||
private NodeDefinitionMapper nodeDefinitionMapper;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
private enum Activity_Type
|
||||
{
|
||||
@@ -229,10 +229,13 @@ public class NodesImpl implements Nodes
|
||||
private Repository repositoryHelper;
|
||||
private ServiceRegistry sr;
|
||||
private Set<String> defaultIgnoreTypesAndAspects;
|
||||
private Set<String> defaultPersonLookupProperties;
|
||||
|
||||
// ignore types/aspects
|
||||
private Set<QName> ignoreQNames;
|
||||
|
||||
private Set<QName> personLookupProperties = new HashSet<>();
|
||||
|
||||
private ConcurrentHashMap<String,NodeRef> ddCache = new ConcurrentHashMap<>();
|
||||
|
||||
private Set<String> nonAttachContentTypes = Collections.emptySet(); // pre-configured whitelist, eg. images & pdf
|
||||
@@ -276,6 +279,14 @@ public class NodesImpl implements Nodes
|
||||
ignoreQNames.add(createQName(type));
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultPersonLookupProperties != null)
|
||||
{
|
||||
for (String property : defaultPersonLookupProperties)
|
||||
{
|
||||
personLookupProperties.add(createQName(property));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry sr)
|
||||
@@ -303,6 +314,10 @@ public class NodesImpl implements Nodes
|
||||
this.defaultIgnoreTypesAndAspects = ignoreTypesAndAspects;
|
||||
}
|
||||
|
||||
public void setPersonLookupProperties(Set<String> personLookupProperties) {
|
||||
this.defaultPersonLookupProperties = personLookupProperties;
|
||||
}
|
||||
|
||||
public void setPoster(ActivityPoster poster)
|
||||
{
|
||||
this.poster = poster;
|
||||
@@ -313,9 +328,9 @@ public class NodesImpl implements Nodes
|
||||
this.smartStore = smartStore;
|
||||
}
|
||||
|
||||
public void setNodeDefinitionMapper(NodeDefinitionMapper nodeDefinitionMapper)
|
||||
public void setClassDefinitionMapper(ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.nodeDefinitionMapper = nodeDefinitionMapper;
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
// excluded namespaces (aspects, properties, assoc types)
|
||||
@@ -338,13 +353,6 @@ public class NodesImpl implements Nodes
|
||||
ContentModel.PROP_AUTO_VERSION_PROPS,
|
||||
ContentModel.PROP_AUTO_VERSION);
|
||||
|
||||
public static final List<QName> PROPS_USERLOOKUP = Arrays.asList(
|
||||
ContentModel.PROP_CREATOR,
|
||||
ContentModel.PROP_MODIFIER,
|
||||
ContentModel.PROP_OWNER,
|
||||
ContentModel.PROP_LOCK_OWNER,
|
||||
ContentModel.PROP_WORKING_COPY_OWNER);
|
||||
|
||||
public final static Map<String,QName> PARAM_SYNONYMS_QNAME;
|
||||
static
|
||||
{
|
||||
@@ -1033,8 +1041,8 @@ public class NodesImpl implements Nodes
|
||||
|
||||
if (includeParam.contains(PARAM_INCLUDE_DEFINITION))
|
||||
{
|
||||
NodeDefinition nodeDefinition = nodeDefinitionMapper.fromTypeDefinition(getTypeDefinition(nodeRef), dictionaryService);
|
||||
node.setDefinition(nodeDefinition);
|
||||
ClassDefinition classDefinition = classDefinitionMapper.fromDictionaryClassDefinition(getTypeDefinition(nodeRef), dictionaryService);
|
||||
node.setDefinition(classDefinition);
|
||||
}
|
||||
|
||||
node.setNodeType(nodeTypeQName.toPrefixString(namespaceService));
|
||||
@@ -1222,9 +1230,9 @@ public class NodesImpl implements Nodes
|
||||
Serializable value = nodeProps.get(qName);
|
||||
if (value != null)
|
||||
{
|
||||
if (PROPS_USERLOOKUP.contains(qName))
|
||||
if (personLookupProperties.contains(qName))
|
||||
{
|
||||
value = Node.lookupUserInfo((String)value, mapUserInfo, sr.getPersonService());
|
||||
value = Node.lookupUserInfo((String) value, mapUserInfo, personService);
|
||||
}
|
||||
|
||||
// Empty (zero length) string values are considered to be
|
||||
|
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* #%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.api.impl;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.rest.api.ClassDefinitionMapper;
|
||||
import org.alfresco.rest.api.Types;
|
||||
import org.alfresco.rest.api.model.Type;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceException;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TypesImpl extends AbstractClassImpl<Type> implements Types
|
||||
{
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespacePrefixResolver namespaceService;
|
||||
private ClassDefinitionMapper classDefinitionMapper;
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
public void setNamespaceService(NamespacePrefixResolver namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
public void setClassDefinitionMapper(ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
this.classDefinitionMapper = classDefinitionMapper;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "dictionaryService", dictionaryService);
|
||||
PropertyCheck.mandatory(this, "namespaceService", namespaceService);
|
||||
PropertyCheck.mandatory(this, "classDefinitionMapper", classDefinitionMapper);
|
||||
}
|
||||
|
||||
TypesImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespaceService, ClassDefinitionMapper classDefinitionMapper)
|
||||
{
|
||||
super(dictionaryService, namespaceService, classDefinitionMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Type> listTypes(Parameters params)
|
||||
{
|
||||
Paging paging = params.getPaging();
|
||||
ModelApiFilter query = getQuery(params.getQuery());
|
||||
Stream<QName> typeStream = null;
|
||||
|
||||
if (query != null && query.getModelIds() != null)
|
||||
{
|
||||
validateListParam(query.getModelIds(), PARAM_MODEL_IDS);
|
||||
Set<Pair<QName, Boolean>> modelsFilter = parseModelIds(query.getModelIds(), PARAM_INCLUDE_SUBTYPES);
|
||||
typeStream = modelsFilter.stream().map(this::getModelTypes).flatMap(Collection::stream);
|
||||
}
|
||||
else if (query != null && query.getParentIds() != null)
|
||||
{
|
||||
validateListParam(query.getParentIds(), PARAM_PARENT_IDS);
|
||||
typeStream = query.getParentIds().stream().map(this::getChildTypes).flatMap(Collection::stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeStream = this.dictionaryService.getAllTypes().stream();
|
||||
}
|
||||
|
||||
List<Type> allTypes = typeStream
|
||||
.filter((qName) -> filterByNamespace(query, qName))
|
||||
.filter(distinctByKey(QName::getPrefixString))
|
||||
.map((qName) -> this.convertToType(dictionaryService.getType(qName), params.getInclude()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return createPagedResult(allTypes, paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType(String typeId)
|
||||
{
|
||||
if (typeId == null)
|
||||
throw new InvalidArgumentException("Invalid parameter: unknown scheme specified");
|
||||
|
||||
TypeDefinition typeDefinition = null;
|
||||
|
||||
try
|
||||
{
|
||||
typeDefinition = dictionaryService.getType(QName.createQName(typeId, this.namespaceService));
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new EntityNotFoundException(typeId);
|
||||
}
|
||||
|
||||
if (typeDefinition == null)
|
||||
throw new EntityNotFoundException(typeId);
|
||||
|
||||
return this.convertToType(typeDefinition, ALL_PROPERTIES);
|
||||
}
|
||||
|
||||
public Type convertToType(TypeDefinition typeDefinition, List<String> includes)
|
||||
{
|
||||
try
|
||||
{
|
||||
Type type = new Type(typeDefinition, dictionaryService);
|
||||
constructFromFilters(type, typeDefinition, includes);
|
||||
return type;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to parse Type: " + typeDefinition.getName() + " . " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Collection<QName> getModelTypes(Pair<QName,Boolean> model)
|
||||
{
|
||||
ModelDefinition modelDefinition = null;
|
||||
|
||||
try
|
||||
{
|
||||
modelDefinition = this.dictionaryService.getModel(model.getFirst());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
if (modelDefinition == null)
|
||||
throw new EntityNotFoundException("model");
|
||||
|
||||
Collection<QName> aspects = this.dictionaryService.getTypes(modelDefinition.getName());
|
||||
|
||||
if (!model.getSecond()) //look for model types alone
|
||||
return aspects;
|
||||
|
||||
Stream<QName> aspectStream = aspects.stream();
|
||||
Stream<QName> childrenStream = aspects.stream()
|
||||
.map(aspect -> this.dictionaryService.getSubTypes(aspect, false))
|
||||
.flatMap(Collection::stream);
|
||||
|
||||
return Stream.concat(aspectStream, childrenStream).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Collection<QName> getChildTypes(String typeId)
|
||||
{
|
||||
Collection<QName> subTypes = null;
|
||||
try
|
||||
{
|
||||
QName parentType = QName.createQName(typeId, this.namespaceService);
|
||||
subTypes = this.dictionaryService.getSubTypes(parentType, true);
|
||||
}
|
||||
catch (NamespaceException exception)
|
||||
{
|
||||
throw new InvalidArgumentException(exception.getMessage());
|
||||
}
|
||||
|
||||
return subTypes;
|
||||
}
|
||||
}
|
@@ -25,15 +25,12 @@
|
||||
*/
|
||||
package org.alfresco.rest.api.lookups;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||
import org.alfresco.rest.api.impl.NodesImpl;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.api.model.UserInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -63,10 +60,9 @@ public class PersonPropertyLookup implements PropertyLookup<String>
|
||||
return supported;
|
||||
}
|
||||
|
||||
public void setSupported(List<String> supported)
|
||||
public void setSupported(Set<String> supported)
|
||||
{
|
||||
NodesImpl.PROPS_USERLOOKUP.forEach(entry -> this.supported.add(entry.toString()));
|
||||
this.supported.addAll(supported);
|
||||
this.supported = supported;
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
|
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* #%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.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.NamespaceDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class AbstractClass extends ClassDefinition implements Comparable<AbstractClass>
|
||||
{
|
||||
protected String id;
|
||||
protected String title;
|
||||
protected String description;
|
||||
protected String parentId;
|
||||
protected Boolean isContainer = null;
|
||||
protected Boolean isArchive = null;
|
||||
protected Boolean includedInSupertypeQuery = null;
|
||||
protected List<String> mandatoryAspects = null;
|
||||
protected List<Association> associations = null;
|
||||
protected Model model;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Model getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(Model model)
|
||||
{
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public Boolean getIsContainer()
|
||||
{
|
||||
return isContainer;
|
||||
}
|
||||
|
||||
public void setIsContainer(Boolean isContainer)
|
||||
{
|
||||
this.isContainer = isContainer;
|
||||
}
|
||||
|
||||
public Boolean getIsArchive()
|
||||
{
|
||||
return isArchive;
|
||||
}
|
||||
|
||||
public void setIsArchive(Boolean isArchive)
|
||||
{
|
||||
this.isArchive = isArchive;
|
||||
}
|
||||
|
||||
public Boolean getIncludedInSupertypeQuery()
|
||||
{
|
||||
return includedInSupertypeQuery;
|
||||
}
|
||||
|
||||
public void setIncludedInSupertypeQuery(Boolean includedInSupertypeQuery)
|
||||
{
|
||||
this.includedInSupertypeQuery = includedInSupertypeQuery;
|
||||
}
|
||||
|
||||
public List<String> getMandatoryAspects()
|
||||
{
|
||||
return mandatoryAspects;
|
||||
}
|
||||
|
||||
public void setMandatoryAspects(List<String> mandatoryAspects)
|
||||
{
|
||||
this.mandatoryAspects = mandatoryAspects;
|
||||
}
|
||||
|
||||
public List<Association> getAssociations()
|
||||
{
|
||||
return associations;
|
||||
}
|
||||
|
||||
public void setAssociations(List<Association> associations)
|
||||
{
|
||||
this.associations = associations;
|
||||
}
|
||||
|
||||
String getParentNameAsString(QName parentQName)
|
||||
{
|
||||
if (parentQName != null)
|
||||
{
|
||||
return parentQName.toPrefixString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Model getModelInfo(org.alfresco.service.cmr.dictionary.ClassDefinition classDefinition, MessageLookup messageLookup)
|
||||
{
|
||||
final ModelDefinition modelDefinition = classDefinition.getModel();
|
||||
final String prefix = classDefinition.getName().toPrefixString().split(":")[0];
|
||||
|
||||
final NamespaceDefinition namespaceDefinition = modelDefinition.getNamespaces().stream()
|
||||
.filter(definition -> definition.getPrefix().equals(prefix))
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
final String modelId = modelDefinition.getName().toPrefixString();
|
||||
final String author = modelDefinition.getAuthor();
|
||||
final String description = modelDefinition.getDescription(messageLookup);
|
||||
|
||||
return new Model(modelId, author, description, namespaceDefinition.getUri(), namespaceDefinition.getPrefix());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(id, title, description, parentId, properties, isContainer, isArchive, includedInSupertypeQuery, mandatoryAspects, associations, model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(AbstractClass other)
|
||||
{
|
||||
return this.id.compareTo(other.getId());
|
||||
}
|
||||
}
|
@@ -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 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General 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.api.model;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.alfresco.service.namespace.QName;
|
||||
/**
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public abstract class AbstractClassModel extends AbstractCommonDetails
|
||||
public abstract class AbstractCustomClass extends AbstractCommonDetails
|
||||
{
|
||||
/* package */String parentName;
|
||||
/* package */List<CustomModelProperty> properties = Collections.emptyList();
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%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.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
|
||||
public class Aspect extends AbstractClass
|
||||
{
|
||||
public Aspect()
|
||||
{
|
||||
}
|
||||
|
||||
public Aspect(AspectDefinition aspectDefinition, MessageLookup messageLookup)
|
||||
{
|
||||
this.id = aspectDefinition.getName().toPrefixString();
|
||||
this.title = aspectDefinition.getTitle(messageLookup);
|
||||
this.description = aspectDefinition.getDescription(messageLookup);
|
||||
this.parentId = getParentNameAsString(aspectDefinition.getParentName());
|
||||
this.model = getModelInfo(aspectDefinition, messageLookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(512);
|
||||
builder.append("Aspect [id=").append(this.id)
|
||||
.append(", title=").append(this.title)
|
||||
.append(", description=").append(this.description)
|
||||
.append(", parentId=").append(parentId)
|
||||
.append(", properties=").append(properties)
|
||||
.append(", mandatoryAspects=").append(mandatoryAspects)
|
||||
.append(", isContainer=").append(isContainer)
|
||||
.append(", isArchive=").append(isArchive)
|
||||
.append(", associations=").append(associations)
|
||||
.append(", model=").append(model)
|
||||
.append(", includedInSupertypeQuery=").append(includedInSupertypeQuery)
|
||||
.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* #%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.api.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Association
|
||||
{
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private Boolean isChild;
|
||||
private Boolean isProtected;
|
||||
private AssociationSource source = null;
|
||||
private AssociationSource target = null;
|
||||
|
||||
public Association()
|
||||
{
|
||||
}
|
||||
|
||||
public Association(String id, String title, String description, Boolean isChild, Boolean isProtected, AssociationSource source, AssociationSource target)
|
||||
{
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.isChild = isChild;
|
||||
this.isProtected = isProtected;
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Boolean getIsChild()
|
||||
{
|
||||
return isChild;
|
||||
}
|
||||
|
||||
public void setIsChild(Boolean isChild)
|
||||
{
|
||||
this.isChild = isChild;
|
||||
}
|
||||
|
||||
public Boolean getIsProtected()
|
||||
{
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public void setIsProtected(Boolean isProtected)
|
||||
{
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public AssociationSource getSource()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(AssociationSource source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public AssociationSource getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(AssociationSource target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Association other = (Association) obj;
|
||||
return Objects.equals(id, other.getId()) &&
|
||||
Objects.equals(title, other.getTitle()) &&
|
||||
Objects.equals(description, other.getDescription()) &&
|
||||
Objects.equals(isChild, other.getIsChild()) &&
|
||||
Objects.equals(isProtected, other.getIsProtected()) &&
|
||||
Objects.equals(source, other.getSource()) &&
|
||||
Objects.equals(target, other.getTarget());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(512);
|
||||
builder.append("Association [id=").append(this.id)
|
||||
.append(", title=").append(this.title)
|
||||
.append(", description=").append(this.description)
|
||||
.append(", isChild=").append(isChild)
|
||||
.append(", isProtected=").append(isProtected)
|
||||
.append(", source=").append(source)
|
||||
.append(", target=").append(target)
|
||||
.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* #%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.api.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class AssociationSource {
|
||||
private String role = null;
|
||||
private String cls = null;
|
||||
private Boolean isMany = null;
|
||||
private Boolean isMandatory = null;
|
||||
private Boolean isMandatoryEnforced = null;
|
||||
|
||||
public AssociationSource()
|
||||
{
|
||||
}
|
||||
|
||||
public AssociationSource(String role, String cls, Boolean isMany, Boolean isMandatory, Boolean isMandatoryEnforced)
|
||||
{
|
||||
this.role = role;
|
||||
this.cls = cls;
|
||||
this.isMany = isMany;
|
||||
this.isMandatory = isMandatory;
|
||||
this.isMandatoryEnforced = isMandatoryEnforced;
|
||||
}
|
||||
|
||||
public String getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role)
|
||||
{
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getCls()
|
||||
{
|
||||
return cls;
|
||||
}
|
||||
|
||||
public void setCls(String cls)
|
||||
{
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
public Boolean getIsMany()
|
||||
{
|
||||
return isMany;
|
||||
}
|
||||
|
||||
public void setIsMany(Boolean isMany)
|
||||
{
|
||||
this.isMany = isMany;
|
||||
}
|
||||
|
||||
public Boolean getIsMandatory()
|
||||
{
|
||||
return isMandatory;
|
||||
}
|
||||
|
||||
public void setIsMandatory(Boolean isMandatory)
|
||||
{
|
||||
this.isMandatory = isMandatory;
|
||||
}
|
||||
|
||||
public Boolean getIsMandatoryEnforced()
|
||||
{
|
||||
return isMandatoryEnforced;
|
||||
}
|
||||
|
||||
public void setIsMandatoryEnforced(Boolean isMandatoryEnforced)
|
||||
{
|
||||
this.isMandatoryEnforced = isMandatoryEnforced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
AssociationSource other = (AssociationSource) obj;
|
||||
return Objects.equals(role, other.getRole()) &&
|
||||
Objects.equals(cls, other.getCls()) &&
|
||||
Objects.equals(isMany, other.getIsMany()) &&
|
||||
Objects.equals(isMandatory, other.getIsMandatory()) &&
|
||||
Objects.equals(isMandatoryEnforced, other.getIsMandatoryEnforced());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(512);
|
||||
builder.append("AssociationSource [role=").append(this.role)
|
||||
.append(", cls=").append(this.cls)
|
||||
.append(", isMany=").append(this.isMany)
|
||||
.append(", isMandatory=").append(isMandatory)
|
||||
.append(", isMandatoryEnforced=").append(isMandatoryEnforced)
|
||||
.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
@@ -31,17 +31,17 @@ import java.util.List;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinition
|
||||
public class ClassDefinition
|
||||
{
|
||||
|
||||
List <NodeDefinitionProperty> properties;
|
||||
List <PropertyDefinition> properties;
|
||||
|
||||
public List<NodeDefinitionProperty> getProperties()
|
||||
public List<PropertyDefinition> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<NodeDefinitionProperty> properties)
|
||||
public void setProperties(List<PropertyDefinition> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinitionConstraint
|
||||
public class ConstraintDefinition
|
||||
{
|
||||
private String id;
|
||||
private String type;
|
@@ -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 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General 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.api.model;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
/**
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class CustomAspect extends AbstractClassModel
|
||||
public class CustomAspect extends AbstractCustomClass
|
||||
{
|
||||
|
||||
public CustomAspect()
|
||||
|
@@ -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 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General 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.api.model;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
/**
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class CustomType extends AbstractClassModel
|
||||
public class CustomType extends AbstractCustomClass
|
||||
{
|
||||
|
||||
public CustomType()
|
||||
|
105
remote-api/src/main/java/org/alfresco/rest/api/model/Model.java
Normal file
105
remote-api/src/main/java/org/alfresco/rest/api/model/Model.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* #%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.api.model;
|
||||
|
||||
public class Model implements Comparable<Model>
|
||||
{
|
||||
private String id;
|
||||
private String author;
|
||||
private String description;
|
||||
private String namespaceUri;
|
||||
private String namespacePrefix;
|
||||
|
||||
public Model()
|
||||
{
|
||||
}
|
||||
|
||||
public Model(String name, String author, String description, String namespaceUri, String namespacePrefix)
|
||||
{
|
||||
this.id = name;
|
||||
this.author = author;
|
||||
this.description = description;
|
||||
this.namespaceUri = namespaceUri;
|
||||
this.namespacePrefix = namespacePrefix;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getNamespaceUri()
|
||||
{
|
||||
return namespaceUri;
|
||||
}
|
||||
|
||||
public void setNamespaceUri(String namespaceUri)
|
||||
{
|
||||
this.namespaceUri = namespaceUri;
|
||||
}
|
||||
|
||||
public String getNamespacePrefix()
|
||||
{
|
||||
return namespacePrefix;
|
||||
}
|
||||
|
||||
public void setNamespacePrefix(String namespacePrefix)
|
||||
{
|
||||
this.namespacePrefix = namespacePrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Model model)
|
||||
{
|
||||
return this.id.compareTo(model.getId());
|
||||
}
|
||||
}
|
@@ -95,7 +95,7 @@ public class Node implements Comparable<Node>
|
||||
|
||||
protected List<String> allowableOperations;
|
||||
protected NodePermissions nodePermissions;
|
||||
protected NodeDefinition definition;
|
||||
protected ClassDefinition definition;
|
||||
|
||||
//optional SearchEntry (only ever returned from a search)
|
||||
protected SearchEntry search = null;
|
||||
@@ -470,12 +470,12 @@ public class Node implements Comparable<Node>
|
||||
this.secondaryChildren = secondaryChildren;
|
||||
}
|
||||
|
||||
public NodeDefinition getDefinition()
|
||||
public ClassDefinition getDefinition()
|
||||
{
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(NodeDefinition definition)
|
||||
public void setDefinition(ClassDefinition definition)
|
||||
{
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*
|
||||
* @author gfertuso
|
||||
*/
|
||||
public class NodeDefinitionProperty
|
||||
public class PropertyDefinition
|
||||
{
|
||||
private String id;
|
||||
private String title;
|
||||
@@ -42,7 +42,7 @@ public class NodeDefinitionProperty
|
||||
private Boolean isMandatory;
|
||||
private Boolean isMandatoryEnforced;
|
||||
private Boolean isProtected;
|
||||
private List<NodeDefinitionConstraint> constraints;
|
||||
private List<ConstraintDefinition> constraints;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
@@ -104,12 +104,12 @@ public class NodeDefinitionProperty
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public List<NodeDefinitionConstraint> getConstraints()
|
||||
public List<ConstraintDefinition> getConstraints()
|
||||
{
|
||||
return constraints;
|
||||
}
|
||||
|
||||
public void setConstraints(List<NodeDefinitionConstraint> constraints)
|
||||
public void setConstraints(List<ConstraintDefinition> constraints)
|
||||
{
|
||||
this.constraints = constraints;
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%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.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||
|
||||
public class Type extends AbstractClass
|
||||
{
|
||||
public Type()
|
||||
{
|
||||
}
|
||||
|
||||
public Type(TypeDefinition typeDefinition, MessageLookup messageLookup)
|
||||
{
|
||||
this.id = typeDefinition.getName().toPrefixString();
|
||||
this.title = typeDefinition.getTitle(messageLookup);
|
||||
this.description = typeDefinition.getDescription(messageLookup);
|
||||
this.parentId = getParentNameAsString(typeDefinition.getParentName());
|
||||
this.model = getModelInfo(typeDefinition, messageLookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(512);
|
||||
builder.append("Type [id=").append(this.id)
|
||||
.append(", title=").append(this.title)
|
||||
.append(", description=").append(this.description)
|
||||
.append(", parentId=").append(parentId)
|
||||
.append(", properties=").append(properties)
|
||||
.append(", mandatoryAspects=").append(mandatoryAspects)
|
||||
.append(", isContainer=").append(isContainer)
|
||||
.append(", isArchive=").append(isArchive)
|
||||
.append(", associations=").append(associations)
|
||||
.append(", model=").append(model)
|
||||
.append(", includedInSupertypeQuery=").append(includedInSupertypeQuery)
|
||||
.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
@@ -82,7 +82,6 @@ public class SearchApiWebscript extends AbstractWebScript implements RecognizedP
|
||||
@Override
|
||||
public void execute(WebScriptRequest webScriptRequest, WebScriptResponse webScriptResponse) throws IOException
|
||||
{
|
||||
|
||||
try {
|
||||
//Turn JSON into a Java object respresentation
|
||||
SearchQuery searchQuery = extractJsonContent(webScriptRequest, assistant.getJsonHelper(), SearchQuery.class);
|
||||
|
@@ -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
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
package org.alfresco.rest.api.search.impl;
|
||||
|
||||
import static java.util.Optional.empty;
|
||||
import static java.util.Optional.of;
|
||||
import static org.alfresco.rest.api.search.impl.StoreMapper.DELETED;
|
||||
import static org.alfresco.rest.api.search.impl.StoreMapper.HISTORY;
|
||||
import static org.alfresco.rest.api.search.impl.StoreMapper.LIVE_NODES;
|
||||
@@ -42,9 +44,10 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.alfresco.repo.search.impl.solr.SolrJSONResultSet;
|
||||
import org.alfresco.repo.search.SearchEngineResultSet;
|
||||
import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericBucket;
|
||||
import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse;
|
||||
import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse.FACET_TYPE;
|
||||
@@ -153,12 +156,10 @@ public class ResultMapper
|
||||
*/
|
||||
public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(Params params, SearchRequestContext searchRequestContext, SearchQuery searchQuery, ResultSet results)
|
||||
{
|
||||
SearchContext context = null;
|
||||
Integer total = null;
|
||||
List<Node> noderesults = new ArrayList<Node>();
|
||||
List<Node> noderesults = new ArrayList<>();
|
||||
Map<String, UserInfo> mapUserInfo = new HashMap<>(10);
|
||||
Map<NodeRef, List<Pair<String, List<String>>>> hightLighting = results.getHighlighting();
|
||||
int notFound = 0;
|
||||
Map<NodeRef, List<Pair<String, List<String>>>> highLighting = results.getHighlighting();
|
||||
final AtomicInteger unknownNodeRefsCount = new AtomicInteger();
|
||||
boolean isHistory = searchRequestContext.getStores().contains(StoreMapper.HISTORY);
|
||||
|
||||
for (ResultSetRow row:results)
|
||||
@@ -169,7 +170,7 @@ public class ResultMapper
|
||||
{
|
||||
float f = row.getScore();
|
||||
List<HighlightEntry> highlightEntries = null;
|
||||
List<Pair<String, List<String>>> high = hightLighting.get(row.getNodeRef());
|
||||
List<Pair<String, List<String>>> high = highLighting.get(row.getNodeRef());
|
||||
|
||||
if (high != null && !high.isEmpty())
|
||||
{
|
||||
@@ -185,26 +186,21 @@ public class ResultMapper
|
||||
else
|
||||
{
|
||||
logger.debug("Unknown noderef returned from search results "+row.getNodeRef());
|
||||
notFound++;
|
||||
unknownNodeRefsCount.incrementAndGet();
|
||||
}
|
||||
}
|
||||
|
||||
SolrJSONResultSet solrResultSet = findSolrResultSet(results);
|
||||
SearchContext context =
|
||||
toSearchEngineResultSet(results)
|
||||
.map(resultSet -> toSearchContext(resultSet, searchRequestContext, searchQuery))
|
||||
.orElse(null);
|
||||
|
||||
if (solrResultSet != null)
|
||||
{
|
||||
//We used Solr for this query
|
||||
context = toSearchContext(solrResultSet, searchRequestContext, searchQuery, notFound);
|
||||
}
|
||||
|
||||
total = setTotal(results);
|
||||
|
||||
return CollectionWithPagingInfo.asPaged(params.getPaging(), noderesults, results.hasMore(), total, null, context);
|
||||
return CollectionWithPagingInfo.asPaged(params.getPaging(), noderesults, results.hasMore(), setTotal(results), null, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a node representation based on a ResultSetRow;
|
||||
* @param searchRequestContext
|
||||
*
|
||||
* @param aRow
|
||||
* @param params
|
||||
* @param mapUserInfo
|
||||
@@ -285,14 +281,14 @@ public class ResultMapper
|
||||
|
||||
/**
|
||||
* Uses the results from Solr to set the Search Context
|
||||
* @param SolrJSONResultSet
|
||||
*
|
||||
* @param searchQuery
|
||||
* @return SearchContext
|
||||
*/
|
||||
public SearchContext toSearchContext(SolrJSONResultSet solrResultSet, SearchRequestContext searchRequestContext, SearchQuery searchQuery, int notFound)
|
||||
public SearchContext toSearchContext(SearchEngineResultSet resultSet, SearchRequestContext searchRequestContext, SearchQuery searchQuery)
|
||||
{
|
||||
SearchContext context = null;
|
||||
Map<String, Integer> facetQueries = solrResultSet.getFacetQueries();
|
||||
Map<String, Integer> facetQueries = resultSet.getFacetQueries();
|
||||
List<GenericFacetResponse> facets = new ArrayList<>();
|
||||
List<FacetQueryContext> facetResults = null;
|
||||
SpellCheckContext spellCheckContext = null;
|
||||
@@ -330,7 +326,7 @@ public class ResultMapper
|
||||
}
|
||||
|
||||
//Field Facets
|
||||
Map<String, List<Pair<String, Integer>>> facetFields = solrResultSet.getFieldFacets();
|
||||
Map<String, List<Pair<String, Integer>>> facetFields = resultSet.getFieldFacets();
|
||||
if(FacetFormat.V2 == searchQuery.getFacetFormat())
|
||||
{
|
||||
facets.addAll(getFacetBucketsForFacetFieldsAsFacets(facetFields, searchQuery));
|
||||
@@ -340,28 +336,29 @@ public class ResultMapper
|
||||
ffcs.addAll(getFacetBucketsForFacetFields(facetFields, searchQuery));
|
||||
}
|
||||
|
||||
Map<String, List<Pair<String, Integer>>> facetInterval = solrResultSet.getFacetIntervals();
|
||||
Map<String, List<Pair<String, Integer>>> facetInterval = resultSet.getFacetIntervals();
|
||||
facets.addAll(getGenericFacetsForIntervals(facetInterval, searchQuery));
|
||||
|
||||
Map<String,List<Map<String,String>>> facetRanges = solrResultSet.getFacetRanges();
|
||||
Map<String,List<Map<String,String>>> facetRanges = resultSet.getFacetRanges();
|
||||
facets.addAll(RangeResultMapper.getGenericFacetsForRanges(facetRanges, searchQuery.getFacetRanges()));
|
||||
|
||||
List<GenericFacetResponse> stats = getFieldStats(searchRequestContext, solrResultSet.getStats());
|
||||
List<GenericFacetResponse> pimped = getPivots(searchRequestContext, solrResultSet.getPivotFacets(), stats);
|
||||
List<GenericFacetResponse> stats = getFieldStats(searchRequestContext, resultSet.getStats());
|
||||
List<GenericFacetResponse> pimped = getPivots(searchRequestContext, resultSet.getPivotFacets(), stats);
|
||||
facets.addAll(pimped);
|
||||
facets.addAll(stats);
|
||||
|
||||
//Spelling
|
||||
SpellCheckResult spell = solrResultSet.getSpellCheckResult();
|
||||
SpellCheckResult spell = resultSet.getSpellCheckResult();
|
||||
if (spell != null && spell.getResultName() != null && !spell.getResults().isEmpty())
|
||||
{
|
||||
spellCheckContext = new SpellCheckContext(spell.getResultName(),spell.getResults());
|
||||
}
|
||||
|
||||
//Put it all together
|
||||
context = new SearchContext(solrResultSet.getLastIndexedTxId(), facets, facetResults, ffcs, spellCheckContext, searchRequestContext.includeRequest()?searchQuery:null);
|
||||
context = new SearchContext(resultSet.getLastIndexedTxId(), facets, facetResults, ffcs, spellCheckContext, searchRequestContext.includeRequest()?searchQuery:null);
|
||||
return isNullContext(context)?null:context;
|
||||
}
|
||||
|
||||
public static boolean hasGroup(SearchQuery searchQuery)
|
||||
{
|
||||
if(searchQuery != null && searchQuery.getFacetQueries() != null)
|
||||
@@ -618,26 +615,32 @@ public class ResultMapper
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets SolrJSONResultSet class if there is one.
|
||||
* @param results
|
||||
* @return
|
||||
* Tries to see if the input {@link ResultSet} or one of the wrapped {@link ResultSet}
|
||||
* is an instance of {@link SearchEngineResultSet}.
|
||||
* Since some concrete ResultSet implements the decorator patterns, the code
|
||||
* assumes (in those cases) a nested structure with a maximum of 3 levels.
|
||||
* Probably the code could be generalised better in order to scan a decorator
|
||||
* chain with an unlimited depth, but that would require a change in the ResultSet interface.
|
||||
*/
|
||||
protected SolrJSONResultSet findSolrResultSet(ResultSet results)
|
||||
protected Optional<SearchEngineResultSet> toSearchEngineResultSet(ResultSet results)
|
||||
{
|
||||
ResultSet theResultSet = results;
|
||||
|
||||
if (results instanceof FilteringResultSet)
|
||||
{
|
||||
theResultSet = ((FilteringResultSet) results).getUnFilteredResultSet();
|
||||
// 1st level
|
||||
results = ((FilteringResultSet) results).getUnFilteredResultSet();
|
||||
|
||||
// 2nd level
|
||||
if (results instanceof FilteringResultSet)
|
||||
{
|
||||
results = ((FilteringResultSet) results).getUnFilteredResultSet();
|
||||
}
|
||||
}
|
||||
|
||||
if (theResultSet instanceof SolrJSONResultSet)
|
||||
{
|
||||
return (SolrJSONResultSet) theResultSet;
|
||||
}
|
||||
|
||||
return null;
|
||||
return results instanceof SearchEngineResultSet
|
||||
? of(results).map(SearchEngineResultSet.class::cast)
|
||||
: empty();
|
||||
}
|
||||
|
||||
public CollectionWithPagingInfo<TupleList> toCollectionWithPagingInfo(JSONArray docs, SearchSQLQuery searchQuery) throws JSONException
|
||||
{
|
||||
if(docs == null )
|
||||
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* #%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.api.types;
|
||||
|
||||
import org.alfresco.rest.api.Types;
|
||||
import org.alfresco.rest.api.model.Type;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@EntityResource(name = "types", title = "types")
|
||||
public class TypeEntityResource implements EntityResourceAction.ReadById<Type>, EntityResourceAction.Read<Type>, InitializingBean
|
||||
{
|
||||
|
||||
private Types types;
|
||||
|
||||
public void setTypes(Types types)
|
||||
{
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("types", this.types);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Type> readAll(Parameters params)
|
||||
{
|
||||
return types.listTypes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type readById(String id, Parameters parameters)
|
||||
{
|
||||
return types.getType(id);
|
||||
}
|
||||
}
|
@@ -1,40 +1,30 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* 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
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General 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.transform.magick;
|
||||
|
||||
import org.alfresco.service.cmr.repository.CropSourceOptions;
|
||||
|
||||
/**
|
||||
* Deprecated crop options.
|
||||
*
|
||||
* @deprecated replaced by {@link CropSourceOptions}
|
||||
* @see CropSourceOptions
|
||||
*/
|
||||
public class ImageCropOptions extends CropSourceOptions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@WebApi(name="alfresco", scope= Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rest.api.types;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -41,7 +41,11 @@ public class DefaultExceptionResolver implements ExceptionResolver<Exception>
|
||||
@Override
|
||||
public ErrorResponse resolveException(Exception ex)
|
||||
{
|
||||
return new ErrorResponse(DEFAULT_MESSAGE_ID, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getLocalizedMessage(), ex.getStackTrace(), null);
|
||||
return new ErrorResponse(DEFAULT_MESSAGE_ID,
|
||||
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||
ex.getLocalizedMessage(),
|
||||
ex.getStackTrace(),
|
||||
null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* 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
|
||||
@@ -23,25 +23,26 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.content.transform;
|
||||
package org.alfresco.rest.framework.core.exceptions;
|
||||
|
||||
import org.alfresco.repo.search.QueryParserException;
|
||||
|
||||
/**
|
||||
* Specifies transformations that are considered to be 'exceptional' so
|
||||
* should be used in preference to other transformers that can perform
|
||||
* the same transformation.
|
||||
*
|
||||
* @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries.
|
||||
* QueryParserException is related with search requests to Search Services.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ExplictTransformationDetails extends SupportedTransformation
|
||||
public class QueryParserExceptionResolver implements ExceptionResolver<QueryParserException>
|
||||
{
|
||||
public ExplictTransformationDetails()
|
||||
|
||||
@Override
|
||||
public ErrorResponse resolveException(QueryParserException ex)
|
||||
{
|
||||
super();
|
||||
return new ErrorResponse(
|
||||
DefaultExceptionResolver.DEFAULT_MESSAGE_ID,
|
||||
// Mapping the original HTTP Status code returned by Search Services
|
||||
ex.getHttpStatusCode(),
|
||||
ex.getLocalizedMessage(),
|
||||
ex.getStackTrace(),
|
||||
null);
|
||||
}
|
||||
|
||||
public ExplictTransformationDetails(String sourceMimetype, String targetMimetype)
|
||||
{
|
||||
super(sourceMimetype, targetMimetype);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -26,10 +26,12 @@
|
||||
package org.alfresco.rest.framework.tools;
|
||||
|
||||
import org.alfresco.metrics.rest.RestMetricsReporter;
|
||||
import org.alfresco.repo.search.QueryParserException;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.core.exceptions.DefaultExceptionResolver;
|
||||
import org.alfresco.rest.framework.core.exceptions.ErrorResponse;
|
||||
import org.alfresco.rest.framework.core.exceptions.ExceptionResolver;
|
||||
import org.alfresco.rest.framework.core.exceptions.QueryParserExceptionResolver;
|
||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -48,6 +50,7 @@ public class ApiAssistant {
|
||||
|
||||
private ExceptionResolver<Exception> defaultResolver = new DefaultExceptionResolver();
|
||||
private ExceptionResolver<WebScriptException> webScriptExceptionResolver;
|
||||
private ExceptionResolver<QueryParserException> queryParserExceptionResolver;
|
||||
private ExceptionResolver<Exception> resolver;
|
||||
private JacksonHelper jsonHelper;
|
||||
private RestMetricsReporter restMetricsReporter;
|
||||
@@ -77,6 +80,10 @@ public class ApiAssistant {
|
||||
{
|
||||
error = webScriptExceptionResolver.resolveException((WebScriptException) ex);
|
||||
}
|
||||
else if (ex instanceof QueryParserException)
|
||||
{
|
||||
error = queryParserExceptionResolver.resolveException((QueryParserException) ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = resolver.resolveException(ex);
|
||||
@@ -100,6 +107,11 @@ public class ApiAssistant {
|
||||
this.webScriptExceptionResolver = webScriptExceptionResolver;
|
||||
}
|
||||
|
||||
public void setQueryParserExceptionResolver(ExceptionResolver<QueryParserException> queryParserExceptionResolver)
|
||||
{
|
||||
this.queryParserExceptionResolver = queryParserExceptionResolver;
|
||||
}
|
||||
|
||||
public void setResolver(ExceptionResolver<Exception> resolver) {
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.alfresco.httpclient.HttpClientFactory.SecureCommsType;
|
||||
import org.alfresco.web.scripts.servlet.X509ServletFilterBase;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -70,7 +71,9 @@ public class AlfrescoX509ServletFilter extends X509ServletFilterBase
|
||||
* Return true or false based on the property. This will switch on/off X509 enforcement in the X509ServletFilterBase.
|
||||
*/
|
||||
|
||||
if (prop == null || "none".equals(prop))
|
||||
if (prop == null ||
|
||||
SecureCommsType.getType(prop) == SecureCommsType.NONE ||
|
||||
SecureCommsType.getType(prop) == SecureCommsType.SECRET)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Close
|
||||
admin-console.password.show=Show Password
|
||||
admin-console.password.hide=Hide Password
|
||||
admin-console.unavailable=Information is currently unavailable
|
||||
admin-console.not.installed=Not Installed
|
||||
|
||||
admin-console.requesterror=We couldn't complete your request. Try again.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Zav\u0159\u00edt
|
||||
admin-console.password.show=Zobrazit heslo
|
||||
admin-console.password.hide=Skr\u00fdt heslo
|
||||
admin-console.unavailable=Informace nejsou moment\u00e1ln\u011b k\u00a0dispozici
|
||||
admin-console.not.installed=Nen\u00ed nainstalov\u00e1no
|
||||
|
||||
admin-console.requesterror=V\u00e1\u0161 po\u017eadavek nebylo mo\u017en\u00e9 dokon\u010dit. Zkuste to znovu.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Luk
|
||||
admin-console.password.show=Vis adgangskode
|
||||
admin-console.password.hide=Skjul adgangskode
|
||||
admin-console.unavailable=Oplysningerne er i \u00f8jeblikket ikke tilg\u00e6ngelige
|
||||
admin-console.not.installed=Ikke installeret
|
||||
|
||||
admin-console.requesterror=Vi kunne ikke fuldf\u00f8re anmodningen. Pr\u00f8v igen.
|
||||
|
||||
|
@@ -20,7 +20,6 @@ admin-console.close=Schlie\u00dfen
|
||||
admin-console.password.show=Passwort anzeigen
|
||||
admin-console.password.hide=Passwort ausblenden
|
||||
admin-console.unavailable=Information ist derzeit nicht verf\u00fcgbar
|
||||
admin-console.not.installed=Nicht installiert
|
||||
|
||||
admin-console.requesterror=Die Anfrage konnte nicht durchgef\u00fchrt werden.
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user