mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-29 15:21:53 +00:00
Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0a3b843f2 | ||
|
|
2889b1a8a3 | ||
|
|
22aa1f2725 | ||
|
|
77ab7d83fe | ||
|
|
a8faa94d15 | ||
|
|
baafbbbeb2 | ||
|
|
ed061f2287 | ||
|
|
6e435e1a8c | ||
|
|
05f6b90df8 | ||
|
|
0550dcd4f7 | ||
|
|
e137c91152 | ||
|
|
5a1c8334c8 | ||
|
|
c7bbb1f74b | ||
|
|
49a34c4fe3 | ||
|
|
70af2ea3ad | ||
|
|
ab6c5feba7 | ||
|
|
cb3cbb553a | ||
|
|
9470c27f3d | ||
|
|
edf263c43f | ||
|
|
69bb9a308a | ||
|
|
853d1bdc1b | ||
|
|
f7d1bbcec3 | ||
|
|
731d580f7e | ||
|
|
ad4126ffea | ||
|
|
933aced67c | ||
|
|
de0ba15a91 | ||
|
|
00c36251d4 | ||
|
|
ea9ce0c0c2 | ||
|
|
37231e50a2 | ||
|
|
26d8c7dcbe | ||
|
|
6ea97033d3 | ||
|
|
cd0b2ffd24 | ||
|
|
a14cbacb68 | ||
|
|
fc0b9863d4 | ||
|
|
29dc42d445 | ||
|
|
39da968d76 | ||
|
|
6a4fecd46e | ||
|
|
e083d4fcc2 | ||
|
|
53e8a06a6e | ||
|
|
c80e1fa94b | ||
|
|
675c6f7aa1 | ||
|
|
44d67847da | ||
|
|
d405043c5d | ||
|
|
da50f6271c | ||
|
|
a5e713c176 | ||
|
|
2dcd2788b2 | ||
|
|
6b738342c1 | ||
|
|
ba5f5418ab | ||
|
|
ee8f3bec18 | ||
|
|
39395af528 | ||
|
|
e6f9d88779 | ||
|
|
70f70c6ed3 | ||
|
|
15045f9612 | ||
|
|
c50c7c6a7e | ||
|
|
60199141f5 | ||
|
|
b5e023950d | ||
|
|
d4591acf2c | ||
|
|
f34f2849dd | ||
|
|
52f2be49f3 | ||
|
|
748be1f4a0 | ||
|
|
52f1af2da6 | ||
|
|
626a97ff45 | ||
|
|
4a91132226 | ||
|
|
b6fb8725ce | ||
|
|
5fc0d9edde | ||
|
|
44d394b1a0 | ||
|
|
c1d62cca4d | ||
|
|
24ae4ce57c | ||
|
|
b8f2ec252d | ||
|
|
ae721c86f6 | ||
|
|
aacef0c949 | ||
|
|
e4edceda75 | ||
|
|
09ec6688c6 | ||
|
|
14025f00de | ||
|
|
22c5a5e134 | ||
|
|
154cad1ff8 | ||
|
|
7749b89e2b | ||
|
|
bbb45e667b | ||
|
|
a5f01e0d94 | ||
|
|
0c6d455ec4 | ||
|
|
5e86f5163e | ||
|
|
4981be1564 | ||
|
|
9a30fbb75a | ||
|
|
9c86fdb8b5 | ||
|
|
c52f74832d | ||
|
|
70dd7642f4 |
184
.github/workflows/ci.yml
vendored
184
.github/workflows/ci.yml
vendored
@@ -44,14 +44,14 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- id: changed-files
|
- id: changed-files
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/github-list-changes@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/github-list-changes@v8.2.0
|
||||||
with:
|
with:
|
||||||
write-list-to-env: true
|
write-list-to-env: true
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Prepare maven cache and check compilation"
|
- name: "Prepare maven cache and check compilation"
|
||||||
@@ -69,12 +69,12 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v8.2.0
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}
|
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}
|
||||||
@@ -92,10 +92,10 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/github-download-file@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/github-download-file@v8.2.0
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||||
repository: "Alfresco/veracode-baseline-archive"
|
repository: "Alfresco/veracode-baseline-archive"
|
||||||
@@ -142,9 +142,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[skip tests]') &&
|
!contains(github.event.head_commit.message, '[skip tests]') &&
|
||||||
!contains(github.event.head_commit.message, '[force]')
|
!contains(github.event.head_commit.message, '[force]')
|
||||||
steps:
|
steps:
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- uses: Alfresco/ya-pmd-scan@v4.1.0
|
- uses: Alfresco/ya-pmd-scan@v4.1.0
|
||||||
with:
|
with:
|
||||||
classpath-build-command: "mvn test-compile -ntp -Pags -pl \"-:alfresco-community-repo-docker\""
|
classpath-build-command: "mvn test-compile -ntp -Pags -pl \"-:alfresco-community-repo-docker\""
|
||||||
@@ -175,14 +175,14 @@ jobs:
|
|||||||
testAttributes: "-Dtest=AllMmtUnitTestSuite"
|
testAttributes: "-Dtest=AllMmtUnitTestSuite"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testModule }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testModule }}
|
||||||
@@ -213,7 +213,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -255,9 +255,9 @@ jobs:
|
|||||||
REQUIRES_INSTALLED_ARTIFACTS: true
|
REQUIRES_INSTALLED_ARTIFACTS: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||||
run: |
|
run: |
|
||||||
@@ -270,7 +270,7 @@ jobs:
|
|||||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testSuite }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testSuite }}
|
||||||
@@ -301,7 +301,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -334,9 +334,9 @@ jobs:
|
|||||||
version: ['10.2.18', '10.4', '10.5']
|
version: ['10.2.18', '10.4', '10.5']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: Run MariaDB ${{ matrix.version }} database
|
- name: Run MariaDB ${{ matrix.version }} database
|
||||||
@@ -345,7 +345,7 @@ jobs:
|
|||||||
MARIADB_VERSION: ${{ matrix.version }}
|
MARIADB_VERSION: ${{ matrix.version }}
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.version }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.version }}
|
||||||
@@ -376,7 +376,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -405,9 +405,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run MariaDB 10.6 database"
|
- name: "Run MariaDB 10.6 database"
|
||||||
@@ -416,7 +416,7 @@ jobs:
|
|||||||
MARIADB_VERSION: 10.6
|
MARIADB_VERSION: 10.6
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -447,7 +447,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -476,9 +476,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run MySQL 8 database"
|
- name: "Run MySQL 8 database"
|
||||||
@@ -487,7 +487,7 @@ jobs:
|
|||||||
MYSQL_VERSION: 8
|
MYSQL_VERSION: 8
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -518,7 +518,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -546,9 +546,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run PostgreSQL 13.12 database"
|
- name: "Run PostgreSQL 13.12 database"
|
||||||
@@ -557,7 +557,7 @@ jobs:
|
|||||||
POSTGRES_VERSION: 13.12
|
POSTGRES_VERSION: 13.12
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -588,7 +588,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -616,9 +616,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run PostgreSQL 14.9 database"
|
- name: "Run PostgreSQL 14.9 database"
|
||||||
@@ -627,7 +627,7 @@ jobs:
|
|||||||
POSTGRES_VERSION: 14.9
|
POSTGRES_VERSION: 14.9
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -658,7 +658,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -686,9 +686,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run PostgreSQL 15.4 database"
|
- name: "Run PostgreSQL 15.4 database"
|
||||||
@@ -697,7 +697,7 @@ jobs:
|
|||||||
POSTGRES_VERSION: 15.4
|
POSTGRES_VERSION: 15.4
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -728,7 +728,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -754,16 +754,16 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run ActiveMQ"
|
- name: "Run ActiveMQ"
|
||||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile activemq up -d
|
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile activemq up -d
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -794,7 +794,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -854,9 +854,9 @@ jobs:
|
|||||||
mvn-options: '-Dencryption.ssl.keystore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.keystore -Dencryption.ssl.truststore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.truststore'
|
mvn-options: '-Dencryption.ssl.keystore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.keystore -Dencryption.ssl.truststore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.truststore'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Set transformers tag"
|
- name: "Set transformers tag"
|
||||||
@@ -879,7 +879,7 @@ jobs:
|
|||||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testSuite }} ${{ matrix.idp }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testSuite }} ${{ matrix.idp }}
|
||||||
@@ -910,7 +910,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -968,9 +968,9 @@ jobs:
|
|||||||
REQUIRES_LOCAL_IMAGES: true
|
REQUIRES_LOCAL_IMAGES: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||||
run: |
|
run: |
|
||||||
@@ -986,7 +986,7 @@ jobs:
|
|||||||
run: mvn install -pl :alfresco-community-repo-integration-test -am -DskipTests -Pall-tas-tests
|
run: mvn install -pl :alfresco-community-repo-integration-test -am -DskipTests -Pall-tas-tests
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.test-name }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.test-name }}
|
||||||
@@ -1024,7 +1024,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.tests.outcome }}
|
tests-outcome: ${{ steps.tests.outcome }}
|
||||||
@@ -1050,16 +1050,16 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force')
|
!contains(github.event.head_commit.message, '[force')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- name: "Run Postgres 15.4 database"
|
- name: "Run Postgres 15.4 database"
|
||||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile postgres up -d
|
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile postgres up -d
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -1090,7 +1090,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -1124,9 +1124,9 @@ jobs:
|
|||||||
REQUIRES_INSTALLED_ARTIFACTS: true
|
REQUIRES_INSTALLED_ARTIFACTS: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||||
run: |
|
run: |
|
||||||
@@ -1134,7 +1134,7 @@ jobs:
|
|||||||
bash ./scripts/ci/build.sh
|
bash ./scripts/ci/build.sh
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} 0${{ matrix.part }} - (PostgreSQL) ${{ matrix.test-name }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} 0${{ matrix.part }} - (PostgreSQL) ${{ matrix.test-name }}
|
||||||
@@ -1170,9 +1170,9 @@ jobs:
|
|||||||
REQUIRES_INSTALLED_ARTIFACTS: true
|
REQUIRES_INSTALLED_ARTIFACTS: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||||
run: |
|
run: |
|
||||||
@@ -1180,7 +1180,7 @@ jobs:
|
|||||||
bash ./scripts/ci/build.sh
|
bash ./scripts/ci/build.sh
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} 0${{ matrix.part }} - (MySQL) ${{ matrix.test-name }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} 0${{ matrix.part }} - (MySQL) ${{ matrix.test-name }}
|
||||||
@@ -1212,9 +1212,9 @@ jobs:
|
|||||||
REQUIRES_LOCAL_IMAGES: true
|
REQUIRES_LOCAL_IMAGES: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||||
run: |
|
run: |
|
||||||
@@ -1228,7 +1228,7 @@ jobs:
|
|||||||
mvn -B install -pl :alfresco-governance-services-automation-community-rest-api -am -Pags -Pall-tas-tests -DskipTests
|
mvn -B install -pl :alfresco-governance-services-automation-community-rest-api -am -Pags -Pall-tas-tests -DskipTests
|
||||||
- name: "Prepare Report Portal"
|
- name: "Prepare Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||||
id: rp-prepare
|
id: rp-prepare
|
||||||
with:
|
with:
|
||||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||||
@@ -1260,7 +1260,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Summarize Report Portal"
|
- name: "Summarize Report Portal"
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||||
id: rp-summarize
|
id: rp-summarize
|
||||||
with:
|
with:
|
||||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||||
@@ -1302,9 +1302,9 @@ jobs:
|
|||||||
!contains(github.event.head_commit.message, '[force]')
|
!contains(github.event.head_commit.message, '[force]')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
16
.github/workflows/master_release.yml
vendored
16
.github/workflows/master_release.yml
vendored
@@ -34,12 +34,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.2.0
|
||||||
with:
|
with:
|
||||||
username: ${{ env.GIT_USERNAME }}
|
username: ${{ env.GIT_USERNAME }}
|
||||||
email: ${{ env.GIT_EMAIL }}
|
email: ${{ env.GIT_EMAIL }}
|
||||||
@@ -63,12 +63,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||||
- name: "Init"
|
- name: "Init"
|
||||||
run: bash ./scripts/ci/init.sh
|
run: bash ./scripts/ci/init.sh
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v7.1.0
|
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.2.0
|
||||||
with:
|
with:
|
||||||
username: ${{ env.GIT_USERNAME }}
|
username: ${{ env.GIT_USERNAME }}
|
||||||
email: ${{ env.GIT_EMAIL }}
|
email: ${{ env.GIT_EMAIL }}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Version label
|
# Version label
|
||||||
version.major=23
|
version.major=25
|
||||||
version.minor=4
|
version.minor=1
|
||||||
version.revision=0
|
version.revision=0
|
||||||
version.label=
|
version.label=
|
||||||
|
|
||||||
|
|||||||
@@ -33,14 +33,15 @@ import static org.mockito.Mockito.times;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO;
|
|
||||||
import org.alfresco.repo.domain.propval.PropertyStringValueEntity;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO;
|
||||||
|
import org.alfresco.repo.domain.propval.PropertyStringValueEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RM V3.3 Hold audit entries values patch unit test
|
* RM V3.3 Hold audit entries values patch unit test
|
||||||
*
|
*
|
||||||
@@ -55,7 +56,6 @@ public class RMv33HoldAuditEntryValuesPatchUnitTest
|
|||||||
@InjectMocks
|
@InjectMocks
|
||||||
private RMv33HoldAuditEntryValuesPatch patch;
|
private RMv33HoldAuditEntryValuesPatch patch;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp()
|
public void setUp()
|
||||||
{
|
{
|
||||||
@@ -93,15 +93,15 @@ public class RMv33HoldAuditEntryValuesPatchUnitTest
|
|||||||
verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity);
|
verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity);
|
||||||
|
|
||||||
assertEquals("Add To Hold", addToHoldPropertyStringValueEntity.getStringValue());
|
assertEquals("Add To Hold", addToHoldPropertyStringValueEntity.getStringValue());
|
||||||
assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringLower());
|
assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringEndLower());
|
||||||
assertEquals(Long.valueOf(770_786_109L), addToHoldPropertyStringValueEntity.getStringCrc());
|
assertEquals(Long.valueOf(770_786_109L), addToHoldPropertyStringValueEntity.getStringCrc());
|
||||||
|
|
||||||
assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStringValue());
|
assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStringValue());
|
||||||
assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringLower());
|
assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringEndLower());
|
||||||
assertEquals(Long.valueOf(2_967_613_012L), removeFromHoldPropertyStringValueEntity.getStringCrc());
|
assertEquals(Long.valueOf(2_967_613_012L), removeFromHoldPropertyStringValueEntity.getStringCrc());
|
||||||
|
|
||||||
assertEquals("Delete Hold", deleteHoldPropertyStringValueEntity.getStringValue());
|
assertEquals("Delete Hold", deleteHoldPropertyStringValueEntity.getStringValue());
|
||||||
assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringLower());
|
assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringEndLower());
|
||||||
assertEquals(Long.valueOf(132_640_810L), deleteHoldPropertyStringValueEntity.getStringCrc());
|
assertEquals(Long.valueOf(132_640_810L), deleteHoldPropertyStringValueEntity.getStringCrc());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,5 +123,3 @@ public class RMv33HoldAuditEntryValuesPatchUnitTest
|
|||||||
verify(mockedRecordsManagementQueryDAO, times(0)).updatePropertyStringValueEntity(any());
|
verify(mockedRecordsManagementQueryDAO, times(0)).updatePropertyStringValueEntity(any());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -118,6 +118,18 @@
|
|||||||
<groupId>org.jibx</groupId>
|
<groupId>org.jibx</groupId>
|
||||||
<artifactId>jibx-run</artifactId>
|
<artifactId>jibx-run</artifactId>
|
||||||
<version>1.4.2</version>
|
<version>1.4.2</version>
|
||||||
|
<exclusions>
|
||||||
|
<!-- [ACS-5371] Excluded to avoid conflict in JDK9+ as it includes javax.xml-->
|
||||||
|
<exclusion>
|
||||||
|
<groupId>xpp3</groupId>
|
||||||
|
<artifactId>xpp3</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.kxml</groupId>
|
||||||
|
<artifactId>kxml2</artifactId>
|
||||||
|
<version>${dependency.kxml2.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ libgif http://giflib.sourceforge.net/
|
|||||||
libfreetype http://www.freetype.org/
|
libfreetype http://www.freetype.org/
|
||||||
PostgreSQL http://www.postgresql.org/
|
PostgreSQL http://www.postgresql.org/
|
||||||
PostgreSQL JDBC Driver http://www.postgresql.org/
|
PostgreSQL JDBC Driver http://www.postgresql.org/
|
||||||
|
kXML 2 http://kxml.sourceforge.net/
|
||||||
|
|
||||||
|
|
||||||
=== CDDL 1.0 ===
|
=== CDDL 1.0 ===
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -55,4 +55,4 @@ else
|
|||||||
echo "Last 200 lines from alfresco.log on container $ALFCONTAINER:"
|
echo "Last 200 lines from alfresco.log on container $ALFCONTAINER:"
|
||||||
docker logs --tail=200 $ALFCONTAINER
|
docker logs --tail=200 $ALFCONTAINER
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<organization>
|
<organization>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
<groupId>org.codehaus.groovy</groupId>
|
||||||
<artifactId>groovy</artifactId>
|
<artifactId>groovy</artifactId>
|
||||||
<version>3.0.22</version>
|
<version>3.0.23</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
|
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* alfresco-tas-restapi
|
* alfresco-tas-restapi
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -29,6 +29,12 @@ import static io.restassured.RestAssured.given;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import io.restassured.RestAssured;
|
||||||
|
import io.restassured.http.ContentType;
|
||||||
|
import io.restassured.response.ValidatableResponse;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||||
import org.alfresco.rest.core.RestRequest;
|
import org.alfresco.rest.core.RestRequest;
|
||||||
import org.alfresco.rest.core.RestResponse;
|
import org.alfresco.rest.core.RestResponse;
|
||||||
@@ -56,12 +62,6 @@ import org.alfresco.utility.model.FileModel;
|
|||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.SiteModel;
|
import org.alfresco.utility.model.SiteModel;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
|
|
||||||
import io.restassured.RestAssured;
|
|
||||||
import io.restassured.http.ContentType;
|
|
||||||
import io.restassured.response.ValidatableResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declares all Rest API under the /people path
|
* Declares all Rest API under the /people path
|
||||||
@@ -97,9 +97,7 @@ public class People extends ModelRequest<People>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve list of activities for a specific person using GET call on "people/{personId}/activities"
|
* Retrieve list of activities for a specific person using GET call on "people/{personId}/activities" Please note that it retries to get the list of activities several times before returning the empty list. The list of activities are not displayed as they are created.
|
||||||
* Please note that it retries to get the list of activities several times before returning the empty list. The list of activities are not displayed as
|
|
||||||
* they are created.
|
|
||||||
*/
|
*/
|
||||||
public RestActivityModelsCollection getPersonActivitiesUntilEntriesCountIs(int expectedNoOfEntries)
|
public RestActivityModelsCollection getPersonActivitiesUntilEntriesCountIs(int expectedNoOfEntries)
|
||||||
{
|
{
|
||||||
@@ -173,6 +171,15 @@ public class People extends ModelRequest<People>
|
|||||||
return restWrapper.processModel(RestPreferenceModel.class, request);
|
return restWrapper.processModel(RestPreferenceModel.class, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a specific preference of a specific person using PUT call on "people/{personId}/preferences/{preferenceName}"
|
||||||
|
*/
|
||||||
|
public RestPreferenceModel updatePersonPreferenceInformation(String preferenceName, RestPreferenceModel preferenceModel)
|
||||||
|
{
|
||||||
|
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, preferenceModel.toJson(), "people/{personId}/preferences/{preferenceName}", this.person.getUsername(), preferenceName);
|
||||||
|
return restWrapper.processModel(RestPreferenceModel.class, request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a specific site from favorite sites list of a person using DELETE call on "people/{personId}/favorite-sites/{siteId}"
|
* Remove a specific site from favorite sites list of a person using DELETE call on "people/{personId}/favorite-sites/{siteId}"
|
||||||
*/
|
*/
|
||||||
@@ -334,7 +341,7 @@ public class People extends ModelRequest<People>
|
|||||||
*/
|
*/
|
||||||
public RestWrapper deleteSiteFromFavorites(SiteModel site)
|
public RestWrapper deleteSiteFromFavorites(SiteModel site)
|
||||||
{
|
{
|
||||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "people/{personId}/favorites/{favoriteId}", this.person.getUsername(), site.getGuid());
|
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "people/{personId}/favorites/{favoriteId}", this.person.getUsername(), site.getGuid());
|
||||||
restWrapper.processEmptyModel(request);
|
restWrapper.processEmptyModel(request);
|
||||||
return restWrapper;
|
return restWrapper;
|
||||||
}
|
}
|
||||||
@@ -379,7 +386,7 @@ public class People extends ModelRequest<People>
|
|||||||
public RestNetworkModel getNetwork(UserModel tenant)
|
public RestNetworkModel getNetwork(UserModel tenant)
|
||||||
{
|
{
|
||||||
Utility.checkObjectIsInitialized(tenant.getDomain(), "tenant.getDomain()");
|
Utility.checkObjectIsInitialized(tenant.getDomain(), "tenant.getDomain()");
|
||||||
String personId = tenant.getUsername().contains("-me-@")? "-me-" : tenant.getUsername();
|
String personId = tenant.getUsername().contains("-me-@") ? "-me-" : tenant.getUsername();
|
||||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/networks/{networkId}?{parameters}", personId, tenant.getDomain(), restWrapper.getParameters());
|
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/networks/{networkId}?{parameters}", personId, tenant.getDomain(), restWrapper.getParameters());
|
||||||
return restWrapper.processModel(RestNetworkModel.class, request);
|
return restWrapper.processModel(RestNetworkModel.class, request);
|
||||||
}
|
}
|
||||||
@@ -410,10 +417,9 @@ public class People extends ModelRequest<People>
|
|||||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, newPerson.toJson(), "people");
|
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, newPerson.toJson(), "people");
|
||||||
return restWrapper.processModel(RestPersonModel.class, request);
|
return restWrapper.processModel(RestPersonModel.class, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get people avatar image using GET call on '/people/{personId}/avatar Please note that it retries to get the
|
* Get people avatar image using GET call on '/people/{personId}/avatar Please note that it retries to get the renditions response several times because on the alfresco server the rendition can take a while to be created.
|
||||||
* renditions response several times because on the alfresco server the rendition can take a while to be created.
|
|
||||||
*/
|
*/
|
||||||
public RestResponse downloadAvatarContent()
|
public RestResponse downloadAvatarContent()
|
||||||
{
|
{
|
||||||
@@ -456,17 +462,8 @@ public class People extends ModelRequest<People>
|
|||||||
return new WhereClause(this);
|
return new WhereClause(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the Where clause of getFavorites
|
* Construct the Where clause of getFavorites You can use the where parameter to restrict the list in the response to entries of a specific kind. The where parameter takes a value. The value is a single predicate that can include one or more EXISTS conditions. The EXISTS condition uses a single operand to limit the list to include entries that include that one property. The property values are:- target/file target/folder target/site Usage: where.. targetFileExist().or().targetSiteExist().filterAnd().getFavorites(...) At this point this method is working only with @link {@link RestFavoritesApi#getFavorites(UserModel) method.
|
||||||
* You can use the where parameter to restrict the list in the response to entries of a specific kind. The where parameter takes a value. The value is a
|
|
||||||
* single predicate that can include one or more EXISTS conditions. The EXISTS condition uses a single operand to limit the list to include entries that
|
|
||||||
* include that one property. The property values are:-
|
|
||||||
* target/file
|
|
||||||
* target/folder
|
|
||||||
* target/site
|
|
||||||
* Usage:
|
|
||||||
* where.. targetFileExist().or().targetSiteExist().filterAnd().getFavorites(...)
|
|
||||||
* At this point this method is working only with @link {@link RestFavoritesApi#getFavorites(UserModel) method.
|
|
||||||
*
|
*
|
||||||
* @author paul.brodner
|
* @author paul.brodner
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package org.alfresco.rest.people.preferences;
|
package org.alfresco.rest.people.preferences;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import org.alfresco.rest.RestTest;
|
import org.alfresco.rest.RestTest;
|
||||||
import org.alfresco.rest.model.RestErrorModel;
|
import org.alfresco.rest.model.RestErrorModel;
|
||||||
import org.alfresco.rest.model.RestPreferenceModel;
|
import org.alfresco.rest.model.RestPreferenceModel;
|
||||||
@@ -9,11 +15,6 @@ import org.alfresco.utility.model.*;
|
|||||||
import org.alfresco.utility.report.Bug;
|
import org.alfresco.utility.report.Bug;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
public class GetPeoplePreferenceFullTests extends RestTest
|
public class GetPeoplePreferenceFullTests extends RestTest
|
||||||
{
|
{
|
||||||
@@ -29,53 +30,53 @@ public class GetPeoplePreferenceFullTests extends RestTest
|
|||||||
dataSite.usingUser(userModel).usingSite(siteModel).addSiteToFavorites();
|
dataSite.usingUser(userModel).usingSite(siteModel).addSiteToFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Check that properties parameter is applied")
|
description = "Check that properties parameter is applied")
|
||||||
public void propertiesParameterIsAppliedWhenRetrievingPreference() throws Exception
|
public void propertiesParameterIsAppliedWhenRetrievingPreference() throws Exception
|
||||||
{
|
{
|
||||||
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id").withCoreAPI().usingUser(userModel)
|
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id").withCoreAPI().usingUser(userModel)
|
||||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||||
.and().field("value").isNull();
|
.and().field("value").isNull();
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id,value").withCoreAPI().usingUser(userModel)
|
restPreferenceModel = restClient.authenticateUser(userModel).withParams("properties=id,value").withCoreAPI().usingUser(userModel)
|
||||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||||
.and().field("value").is("true");
|
.and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Validate ID element in get site preference response")
|
description = "Validate ID element in get site preference response")
|
||||||
public void validateIdElementInGetSitePreferenceResponse() throws Exception
|
public void validateIdElementInGetSitePreferenceResponse() throws Exception
|
||||||
{
|
{
|
||||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()))
|
||||||
.and().field("value").is("true");
|
.and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Validate ID element in get folder preference response")
|
description = "Validate ID element in get folder preference response")
|
||||||
public void validateIdElementInGetFolderPreferenceResponse() throws Exception
|
public void validateIdElementInGetFolderPreferenceResponse() throws Exception
|
||||||
{
|
{
|
||||||
FolderModel folderFavorite = new FolderModel("favoriteFolder");
|
FolderModel folderFavorite = new FolderModel("favoriteFolder");
|
||||||
folderFavorite = dataContent.usingSite(siteModel).createFolder(folderFavorite);
|
folderFavorite = dataContent.usingSite(siteModel).createFolder(folderFavorite);
|
||||||
dataContent.getContentActions().setFolderAsFavorite(userModel.getUsername(), userModel.getPassword(), siteModel.getId(), folderFavorite.getName());
|
dataContent.getContentActions().setFolderAsFavorite(userModel.getUsername(), userModel.getPassword(), siteModel.getId(), folderFavorite.getName());
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.FOLDERS_FAVORITES_PREFIX)
|
restPreferenceModel.assertThat().field("id").is(PreferenceName.FOLDERS_FAVORITES_PREFIX)
|
||||||
.and().field("value").is(Utility.removeLastSlash(Utility.buildPath("workspace://SpacesStore", folderFavorite.getNodeRef())));
|
.and().field("value").is(Utility.removeLastSlash(Utility.buildPath("workspace://SpacesStore", folderFavorite.getNodeRef())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Validate ID element in get file preference response")
|
description = "Validate ID element in get file preference response")
|
||||||
public void validateIdElementInGetFilePreferenceResponse() throws Exception
|
public void validateIdElementInGetFilePreferenceResponse() throws Exception
|
||||||
{
|
{
|
||||||
FileModel fileFavorite = new FileModel("favoriteFile", FileType.TEXT_PLAIN);
|
FileModel fileFavorite = new FileModel("favoriteFile", FileType.TEXT_PLAIN);
|
||||||
@@ -85,86 +86,86 @@ public class GetPeoplePreferenceFullTests extends RestTest
|
|||||||
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
||||||
restPreferenceModel.assertThat().field("id").is(PreferenceName.DOCUMENTS_FAVORITES_PREFIX)
|
restPreferenceModel.assertThat().field("id").is(PreferenceName.DOCUMENTS_FAVORITES_PREFIX)
|
||||||
.and().field("value").is(Utility.removeLastSlash(Utility.buildPath("workspace://SpacesStore", fileFavorite.getNodeRefWithoutVersion())));
|
.and().field("value").is(Utility.removeLastSlash(Utility.buildPath("workspace://SpacesStore", fileFavorite.getNodeRefWithoutVersion())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Get preference of an user that has no preferences")
|
description = "Get preference of an user that has no preferences")
|
||||||
public void getPreferenceForUserWithoutPreferences() throws Exception
|
public void getPreferenceForUserWithoutPreferences() throws Exception
|
||||||
{
|
{
|
||||||
UserModel newUser = dataUser.createRandomTestUser();
|
UserModel newUser = dataUser.createRandomTestUser();
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString()));
|
PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString()));
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.SITES_FAVORITES_PREFIX.toString()));
|
PreferenceName.SITES_FAVORITES_PREFIX.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Change one preference for an user then perform get call")
|
description = "Change one preference for an user then perform get call")
|
||||||
@Bug(id = "REPO-1922")
|
@Bug(id = "REPO-1922")
|
||||||
public void changePreferenceThenPerformGetPreferenceCall() throws Exception
|
public void changePreferenceThenPerformGetPreferenceCall() throws Exception
|
||||||
{
|
{
|
||||||
UserModel newUser = dataUser.createRandomTestUser();
|
UserModel newUser = dataUser.createRandomTestUser();
|
||||||
SiteModel site = dataSite.usingUser(newUser).createPublicRandomSite();
|
SiteModel site = dataSite.usingUser(newUser).createPublicRandomSite();
|
||||||
|
|
||||||
dataSite.usingUser(newUser).usingSite(site).addSiteToFavorites();
|
dataSite.usingUser(newUser).usingSite(site).addSiteToFavorites();
|
||||||
|
|
||||||
FileModel fileFavorite = new FileModel("favoriteFile", FileType.TEXT_PLAIN);
|
FileModel fileFavorite = new FileModel("favoriteFile", FileType.TEXT_PLAIN);
|
||||||
fileFavorite = dataContent.usingSite(site).createContent(fileFavorite);
|
fileFavorite = dataContent.usingSite(site).createContent(fileFavorite);
|
||||||
dataContent.getContentActions().setFileAsFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), String.format("%s.%s", fileFavorite.getName(), fileFavorite.getFileType().extension));
|
dataContent.getContentActions().setFileAsFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), String.format("%s.%s", fileFavorite.getName(), fileFavorite.getFileType().extension));
|
||||||
|
|
||||||
FolderModel folderFavorite = new FolderModel("favoriteFolder");
|
FolderModel folderFavorite = new FolderModel("favoriteFolder");
|
||||||
folderFavorite = dataContent.usingSite(site).createFolder(folderFavorite);
|
folderFavorite = dataContent.usingSite(site).createFolder(folderFavorite);
|
||||||
dataContent.getContentActions().setFolderAsFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), folderFavorite.getName());
|
dataContent.getContentActions().setFolderAsFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), folderFavorite.getName());
|
||||||
|
|
||||||
dataSite.usingUser(newUser).usingSite(site).removeSiteFromFavorites();
|
dataSite.usingUser(newUser).usingSite(site).removeSiteFromFavorites();
|
||||||
dataContent.getContentActions().removeFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), folderFavorite.getName());
|
dataContent.getContentActions().removeFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), folderFavorite.getName());
|
||||||
dataContent.getContentActions().removeFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), Paths.get(fileFavorite.getCmisLocation()).getFileName().toString());
|
dataContent.getContentActions().removeFavorite(newUser.getUsername(), newUser.getPassword(), site.getId(), Paths.get(fileFavorite.getCmisLocation()).getFileName().toString());
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.SITES_FAVORITES_PREFIX.toString()));
|
PreferenceName.SITES_FAVORITES_PREFIX.toString()));
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString()));
|
PreferenceName.DOCUMENTS_FAVORITES_PREFIX.toString()));
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
.getPersonPreferenceInformation(PreferenceName.FOLDERS_FAVORITES_PREFIX.toString());
|
||||||
restClient.assertLastError().containsSummary(
|
restClient.assertLastError().containsSummary(
|
||||||
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
String.format("The relationship resource was not found for the" + " entity with id: %s and a relationship id of %s", newUser.getUsername(),
|
||||||
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
PreferenceName.FOLDERS_FAVORITES_PREFIX.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Verify admin is able to get preference of another user")
|
description = "Verify admin is able to get preference of another user")
|
||||||
public void adminIsAbleToGetOtherUserPreference() throws Exception
|
public void adminIsAbleToGetOtherUserPreference() throws Exception
|
||||||
{
|
{
|
||||||
restPreferenceModel = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(userModel)
|
restPreferenceModel = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(userModel)
|
||||||
@@ -172,18 +173,62 @@ public class GetPeoplePreferenceFullTests extends RestTest
|
|||||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.REGRESSION})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.REGRESSION,
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
description = "Verify regular user is not able to get preference of admin user")
|
description = "Verify regular user is not able to get preference of admin user")
|
||||||
public void regularUserIsNotAbleToGetAdminPreference() throws Exception
|
public void regularUserIsNotAbleToGetAdminPreference() throws Exception
|
||||||
{
|
{
|
||||||
SiteModel newSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
|
SiteModel newSite = dataSite.usingUser(dataUser.getAdminUser()).createPublicRandomSite();
|
||||||
dataSite.usingUser(dataUser.getAdminUser()).usingSite(newSite).addSiteToFavorites();
|
dataSite.usingUser(dataUser.getAdminUser()).usingSite(newSite).addSiteToFavorites();
|
||||||
|
|
||||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(dataUser.getAdminUser())
|
restClient.authenticateUser(userModel).withCoreAPI().usingUser(dataUser.getAdminUser())
|
||||||
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + newSite.getId());
|
.getPersonPreferenceInformation(PreferenceName.SITES_FAVORITES_PREFIX + newSite.getId());
|
||||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||||
restClient.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
restClient.assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.REGRESSION})
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Verify regular user is able to change own preferences")
|
||||||
|
public void regularUserIsAbleToChangeOwnPreference() throws Exception
|
||||||
|
{
|
||||||
|
var newUser = dataUser.createRandomTestUser();
|
||||||
|
var newSite = dataSite.usingUser(newUser).createPublicRandomSite();
|
||||||
|
var preferenceId = String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), newSite.getId());
|
||||||
|
var updatedPreferenceModel = new RestPreferenceModel();
|
||||||
|
updatedPreferenceModel.setId(preferenceId);
|
||||||
|
updatedPreferenceModel.setValue("");
|
||||||
|
|
||||||
|
dataSite.usingUser(newUser).usingSite(newSite).addSiteToFavorites();
|
||||||
|
restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
|
.getPersonPreferenceInformation(preferenceId);
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
|
||||||
|
restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser().updatePersonPreferenceInformation(preferenceId, updatedPreferenceModel);
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
var personPreferences = restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser().getPersonPreferences();
|
||||||
|
personPreferences.assertThat().entriesListDoesNotContain("id", preferenceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.REGRESSION})
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.REGRESSION,
|
||||||
|
description = "Verify admin is not able to change regular user preferences")
|
||||||
|
public void adminIsNotAbleToChangeRegularUserPreference() throws Exception
|
||||||
|
{
|
||||||
|
var newUser = dataUser.createRandomTestUser();
|
||||||
|
var newSite = dataSite.usingUser(newUser).createPublicRandomSite();
|
||||||
|
var preferenceId = String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), newSite.getId());
|
||||||
|
var updatedPreferenceModel = new RestPreferenceModel();
|
||||||
|
updatedPreferenceModel.setId(preferenceId);
|
||||||
|
updatedPreferenceModel.setValue("");
|
||||||
|
|
||||||
|
dataSite.usingUser(newUser).usingSite(newSite).addSiteToFavorites();
|
||||||
|
restClient.authenticateUser(newUser).withCoreAPI().usingAuthUser()
|
||||||
|
.getPersonPreferenceInformation(preferenceId);
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
|
||||||
|
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(newUser).updatePersonPreferenceInformation(preferenceId, updatedPreferenceModel);
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package org.alfresco.rest.people.preferences;
|
package org.alfresco.rest.people.preferences;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import org.alfresco.rest.RestTest;
|
import org.alfresco.rest.RestTest;
|
||||||
import org.alfresco.rest.model.RestErrorModel;
|
|
||||||
import org.alfresco.rest.model.RestPreferenceModel;
|
import org.alfresco.rest.model.RestPreferenceModel;
|
||||||
import org.alfresco.utility.constants.PreferenceName;
|
import org.alfresco.utility.constants.PreferenceName;
|
||||||
import org.alfresco.utility.constants.UserRole;
|
import org.alfresco.utility.constants.UserRole;
|
||||||
@@ -10,9 +13,6 @@ import org.alfresco.utility.model.TestGroup;
|
|||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
import org.alfresco.utility.testrail.ExecutionType;
|
import org.alfresco.utility.testrail.ExecutionType;
|
||||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for Get a Peference (/people/{personId}/preferences/{preferenceName}) RestAPI call
|
* Tests for Get a Peference (/people/{personId}/preferences/{preferenceName}) RestAPI call
|
||||||
@@ -33,8 +33,8 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
|||||||
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user gets a specific preference with Rest API and response is successful (200)")
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify manager user gets a specific preference with Rest API and response is successful (200)")
|
||||||
public void managerUserGetsAPreferenceWithSuccess() throws Exception
|
public void managerUserGetsAPreferenceWithSuccess() throws Exception
|
||||||
{
|
{
|
||||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||||
@@ -47,8 +47,8 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
|||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets a specific preference with Rest API and response is successful (200)")
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets a specific preference with Rest API and response is successful (200)")
|
||||||
public void collaboratorUserGetsAPreferenceWithSuccess() throws Exception
|
public void collaboratorUserGetsAPreferenceWithSuccess() throws Exception
|
||||||
{
|
{
|
||||||
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||||
@@ -61,8 +61,24 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
|||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify contributor user gets a specific preference with Rest API and response is successful (200)")
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify collaborator user gets a specific preference with Rest API and response is successful (200)")
|
||||||
|
public void collaboratorUserUpdatesAPreferenceWithSuccess() throws Exception
|
||||||
|
{
|
||||||
|
UserModel collaboratorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||||
|
|
||||||
|
var updatedRestPreferenceModel = new RestPreferenceModel();
|
||||||
|
updatedRestPreferenceModel.setId("user.preference");
|
||||||
|
updatedRestPreferenceModel.setValue("user.value");
|
||||||
|
|
||||||
|
restPreferenceModel = restClient.authenticateUser(collaboratorUser).withCoreAPI().usingAuthUser()
|
||||||
|
.updatePersonPreferenceInformation(updatedRestPreferenceModel.getId(), updatedRestPreferenceModel);
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
restPreferenceModel.assertThat().field("id").is("user.preference").and().field("value").is("user.value");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify contributor user gets a specific preference with Rest API and response is successful (200)")
|
||||||
public void contributorUserGetsAPreferenceWithSuccess() throws Exception
|
public void contributorUserGetsAPreferenceWithSuccess() throws Exception
|
||||||
{
|
{
|
||||||
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
UserModel contributorUser = dataUser.usingAdmin().createRandomTestUser();
|
||||||
@@ -75,8 +91,8 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
|||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
@TestRail(section = { TestGroup.REST_API,TestGroup.PEOPLE, TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify consumer user gets a specific preference with Rest API and response is successful (200)")
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify consumer user gets a specific preference with Rest API and response is successful (200)")
|
||||||
public void consumerUserGetsAPreferenceWithSuccess() throws Exception
|
public void consumerUserGetsAPreferenceWithSuccess() throws Exception
|
||||||
{
|
{
|
||||||
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
UserModel consumerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||||
@@ -84,13 +100,13 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
|||||||
dataSite.usingUser(consumerUser).usingSite(siteModel).addSiteToFavorites();
|
dataSite.usingUser(consumerUser).usingSite(siteModel).addSiteToFavorites();
|
||||||
|
|
||||||
restPreferenceModel = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser()
|
restPreferenceModel = restClient.authenticateUser(consumerUser).withCoreAPI().usingAuthUser()
|
||||||
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(),siteModel.getId()));
|
.getPersonPreferenceInformation(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId()));
|
||||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(),siteModel.getId())).and().field("value").is("true");
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify admin user gets a specific preference with Rest API and response is successful (200)")
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify admin user gets a specific preference with Rest API and response is successful (200)")
|
||||||
public void adminUserGetsAPreferenceWithSuccess() throws Exception
|
public void adminUserGetsAPreferenceWithSuccess() throws Exception
|
||||||
{
|
{
|
||||||
UserModel adminUser = dataUser.getAdminUser();
|
UserModel adminUser = dataUser.getAdminUser();
|
||||||
@@ -102,9 +118,9 @@ public class GetPeoplePreferenceSanityTests extends RestTest
|
|||||||
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
restPreferenceModel.assertThat().field("id").is(String.format(PreferenceName.SITES_FAVORITES_PREFIX.toString(), siteModel.getId())).and().field("value").is("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY })
|
@Test(groups = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES, TestGroup.SANITY})
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE,TestGroup.PREFERENCES }, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to get a specific preference with Rest API when authentication fails (401)")
|
@TestRail(section = {TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.PREFERENCES}, executionType = ExecutionType.SANITY, description = "Verify manager user is NOT Authorized to get a specific preference with Rest API when authentication fails (401)")
|
||||||
// @Bug(id = "MNT-16904", description = "fails only on environment with tenants")
|
// @Bug(id = "MNT-16904", description = "fails only on environment with tenants")
|
||||||
public void managerUserNotAuthorizedFailsToGetsAPreference() throws Exception
|
public void managerUserNotAuthorizedFailsToGetsAPreference() throws Exception
|
||||||
{
|
{
|
||||||
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
UserModel managerUser = dataUser.usingAdmin().createRandomTestUser();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
37
pom.xml
37
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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Alfresco Community Repo Parent</name>
|
<name>Alfresco Community Repo Parent</name>
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<acs.version.major>23</acs.version.major>
|
<acs.version.major>25</acs.version.major>
|
||||||
<acs.version.minor>4</acs.version.minor>
|
<acs.version.minor>1</acs.version.minor>
|
||||||
<acs.version.revision>0</acs.version.revision>
|
<acs.version.revision>0</acs.version.revision>
|
||||||
<acs.version.label />
|
<acs.version.label />
|
||||||
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
|
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
<dependency.alfresco-transform-core.version>5.1.5</dependency.alfresco-transform-core.version>
|
<dependency.alfresco-transform-core.version>5.1.5</dependency.alfresco-transform-core.version>
|
||||||
<dependency.alfresco-transform-service.version>4.1.5</dependency.alfresco-transform-service.version>
|
<dependency.alfresco-transform-service.version>4.1.5</dependency.alfresco-transform-service.version>
|
||||||
<dependency.alfresco-greenmail.version>7.0</dependency.alfresco-greenmail.version>
|
<dependency.alfresco-greenmail.version>7.0</dependency.alfresco-greenmail.version>
|
||||||
<dependency.acs-event-model.version>0.0.33</dependency.acs-event-model.version>
|
<dependency.acs-event-model.version>1.0.2</dependency.acs-event-model.version>
|
||||||
|
|
||||||
<dependency.aspectj.version>1.9.22.1</dependency.aspectj.version>
|
<dependency.aspectj.version>1.9.22.1</dependency.aspectj.version>
|
||||||
<dependency.spring.version>6.1.14</dependency.spring.version>
|
<dependency.spring.version>6.1.14</dependency.spring.version>
|
||||||
@@ -64,38 +64,39 @@
|
|||||||
<dependency.cxf.version>4.0.5</dependency.cxf.version>
|
<dependency.cxf.version>4.0.5</dependency.cxf.version>
|
||||||
<dependency.opencmis.version>1.0.0-jakarta-1</dependency.opencmis.version>
|
<dependency.opencmis.version>1.0.0-jakarta-1</dependency.opencmis.version>
|
||||||
<dependency.webscripts.version>9.4</dependency.webscripts.version>
|
<dependency.webscripts.version>9.4</dependency.webscripts.version>
|
||||||
<dependency.bouncycastle.version>1.78.1</dependency.bouncycastle.version>
|
<dependency.bouncycastle.version>1.79</dependency.bouncycastle.version>
|
||||||
<dependency.mockito-core.version>5.14.1</dependency.mockito-core.version>
|
<dependency.mockito-core.version>5.14.1</dependency.mockito-core.version>
|
||||||
<dependency.assertj.version>3.26.3</dependency.assertj.version>
|
<dependency.assertj.version>3.26.3</dependency.assertj.version>
|
||||||
<dependency.org-json.version>20240303</dependency.org-json.version>
|
<dependency.org-json.version>20240303</dependency.org-json.version>
|
||||||
<dependency.commons-dbcp.version>2.12.0</dependency.commons-dbcp.version>
|
<dependency.commons-dbcp.version>2.12.0</dependency.commons-dbcp.version>
|
||||||
<dependency.commons-io.version>2.17.0</dependency.commons-io.version>
|
<dependency.commons-io.version>2.18.0</dependency.commons-io.version>
|
||||||
<dependency.gson.version>2.11.0</dependency.gson.version>
|
<dependency.gson.version>2.11.0</dependency.gson.version>
|
||||||
<dependency.guava.version>33.3.1-jre</dependency.guava.version>
|
<dependency.guava.version>33.3.1-jre</dependency.guava.version>
|
||||||
<dependency.httpclient.version>4.5.14</dependency.httpclient.version>
|
<dependency.httpclient.version>4.5.14</dependency.httpclient.version>
|
||||||
<dependency.httpcore.version>4.4.16</dependency.httpcore.version>
|
<dependency.httpcore.version>4.4.16</dependency.httpcore.version>
|
||||||
<dependency.httpcomponents-httpclient5.version>5.2.1</dependency.httpcomponents-httpclient5.version>
|
<dependency.httpcomponents-httpclient5.version>5.4.1</dependency.httpcomponents-httpclient5.version>
|
||||||
<dependency.httpcomponents-httpcore5.version>5.3</dependency.httpcomponents-httpcore5.version>
|
<dependency.httpcomponents-httpcore5.version>5.3</dependency.httpcomponents-httpcore5.version>
|
||||||
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
|
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
|
||||||
<dependency.xercesImpl.version>2.12.2</dependency.xercesImpl.version>
|
<dependency.xercesImpl.version>2.12.2</dependency.xercesImpl.version>
|
||||||
<dependency.slf4j.version>2.0.16</dependency.slf4j.version>
|
<dependency.slf4j.version>2.0.16</dependency.slf4j.version>
|
||||||
<dependency.log4j.version>2.23.1</dependency.log4j.version>
|
<dependency.log4j.version>2.24.2</dependency.log4j.version>
|
||||||
<dependency.groovy.version>3.0.22</dependency.groovy.version>
|
<dependency.groovy.version>3.0.23</dependency.groovy.version>
|
||||||
<dependency.tika.version>2.9.2</dependency.tika.version>
|
<dependency.tika.version>2.9.2</dependency.tika.version>
|
||||||
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
||||||
<dependency.poi.version>5.3.0</dependency.poi.version>
|
<dependency.poi.version>5.3.0</dependency.poi.version>
|
||||||
<dependency.jboss.logging.version>3.5.0.Final</dependency.jboss.logging.version>
|
<dependency.jboss.logging.version>3.5.0.Final</dependency.jboss.logging.version>
|
||||||
<dependency.camel.version>4.6.0</dependency.camel.version> <!-- when bumping this version, please keep track/sync with included netty.io dependencies -->
|
<dependency.camel.version>4.6.0</dependency.camel.version> <!-- when bumping this version, please keep track/sync with included netty.io dependencies -->
|
||||||
<dependency.netty.version>4.1.113.Final</dependency.netty.version> <!-- must be in sync with camels transitive dependencies, e.g.: netty-common -->
|
<dependency.netty.version>4.1.113.Final</dependency.netty.version> <!-- must be in sync with camels transitive dependencies, e.g.: netty-common -->
|
||||||
<dependency.activemq.version>5.18.3</dependency.activemq.version>
|
<dependency.activemq.version>5.18.6</dependency.activemq.version>
|
||||||
<dependency.apache-compress.version>1.27.1</dependency.apache-compress.version>
|
<dependency.apache-compress.version>1.27.1</dependency.apache-compress.version>
|
||||||
<dependency.awaitility.version>4.2.2</dependency.awaitility.version>
|
<dependency.awaitility.version>4.2.2</dependency.awaitility.version>
|
||||||
<dependency.swagger-ui.version>4.1.3</dependency.swagger-ui.version>
|
<dependency.swagger-ui.version>4.1.3</dependency.swagger-ui.version>
|
||||||
<dependency.swagger-parser.version>1.0.71</dependency.swagger-parser.version>
|
<dependency.swagger-parser.version>1.0.72</dependency.swagger-parser.version>
|
||||||
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
|
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
|
||||||
<dependency.maven-artifact.version>3.8.6</dependency.maven-artifact.version>
|
<dependency.maven-artifact.version>3.8.6</dependency.maven-artifact.version>
|
||||||
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
|
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
|
||||||
<dependency.pooled-jms.version>3.1.6</dependency.pooled-jms.version>
|
<dependency.pooled-jms.version>3.1.6</dependency.pooled-jms.version>
|
||||||
|
<dependency.kxml2.version>2.3.0</dependency.kxml2.version>
|
||||||
|
|
||||||
<dependency.jakarta-ee-jaxb-api.version>4.0.2</dependency.jakarta-ee-jaxb-api.version>
|
<dependency.jakarta-ee-jaxb-api.version>4.0.2</dependency.jakarta-ee-jaxb-api.version>
|
||||||
<dependency.jakarta-ee-jaxb-impl.version>4.0.5</dependency.jakarta-ee-jaxb-impl.version>
|
<dependency.jakarta-ee-jaxb-impl.version>4.0.5</dependency.jakarta-ee-jaxb-impl.version>
|
||||||
@@ -154,7 +155,7 @@
|
|||||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||||
<tag>23.4.0.67</tag>
|
<tag>25.1.0.16</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
@@ -371,7 +372,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
<artifactId>quartz</artifactId>
|
<artifactId>quartz</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.5.0</version>
|
||||||
<!-- exclude c3p0 -->
|
<!-- exclude c3p0 -->
|
||||||
<!-- see https://issues.alfresco.com/jira/browse/REPO-3447 -->
|
<!-- see https://issues.alfresco.com/jira/browse/REPO-3447 -->
|
||||||
<exclusions>
|
<exclusions>
|
||||||
@@ -465,7 +466,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlbeans</groupId>
|
<groupId>org.apache.xmlbeans</groupId>
|
||||||
<artifactId>xmlbeans</artifactId>
|
<artifactId>xmlbeans</artifactId>
|
||||||
<version>5.2.1</version>
|
<version>5.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
@@ -703,7 +704,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.networknt</groupId>
|
<groupId>com.networknt</groupId>
|
||||||
<artifactId>json-schema-validator</artifactId>
|
<artifactId>json-schema-validator</artifactId>
|
||||||
<version>1.5.1</version>
|
<version>1.5.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- upgrade dependency from TIKA -->
|
<!-- upgrade dependency from TIKA -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -950,7 +951,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.34</version>
|
<version>1.18.36</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -1015,7 +1016,7 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>3.5.1</version>
|
<version>3.5.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
@@ -1028,7 +1029,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.10.1</version>
|
<version>3.11.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.santuario</groupId>
|
<groupId>org.apache.santuario</groupId>
|
||||||
<artifactId>xmlsec</artifactId>
|
<artifactId>xmlsec</artifactId>
|
||||||
<version>4.0.2</version>
|
<version>4.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- newer version, see REPO-3133 -->
|
<!-- newer version, see REPO-3133 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-server</artifactId>
|
<artifactId>jetty-server</artifactId>
|
||||||
<version>11.0.15</version>
|
<version>11.0.24</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -23,14 +23,17 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api;
|
package org.alfresco.rest.api;
|
||||||
|
|
||||||
import org.alfresco.rest.api.model.Preference;
|
import org.alfresco.rest.api.model.Preference;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||||
|
|
||||||
public interface Preferences
|
public interface Preferences
|
||||||
{
|
{
|
||||||
public Preference getPreference(String personId, String preferenceName);
|
Preference getPreference(String personId, String preferenceName);
|
||||||
public CollectionWithPagingInfo<Preference> getPreferences(String personId, Paging paging);
|
|
||||||
}
|
CollectionWithPagingInfo<Preference> getPreferences(String personId, Paging paging);
|
||||||
|
|
||||||
|
Preference updatePreference(String personId, Preference preference);
|
||||||
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class AuditImpl implements Audit
|
|||||||
|
|
||||||
// list of equals filter's auditEntry (via where clause)
|
// list of equals filter's auditEntry (via where clause)
|
||||||
private final static Set<String> LIST_AUDIT_ENTRY_EQUALS_QUERY_PROPERTIES = new HashSet<>(
|
private final static Set<String> LIST_AUDIT_ENTRY_EQUALS_QUERY_PROPERTIES = new HashSet<>(
|
||||||
Arrays.asList(new String[] { CREATED_BY_USER, VALUES_KEY, VALUES_VALUE }));
|
Arrays.asList(new String[]{CREATED_BY_USER, VALUES_KEY, VALUES_VALUE}));
|
||||||
|
|
||||||
// map of sort parameters for the moment one createdAt
|
// map of sort parameters for the moment one createdAt
|
||||||
private final static Map<String, String> SORT_PARAMS_TO_NAMES;
|
private final static Map<String, String> SORT_PARAMS_TO_NAMES;
|
||||||
@@ -295,23 +295,29 @@ public class AuditImpl implements Audit
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hasMoreItems) {
|
if (hasMoreItems)
|
||||||
if (q != null) {
|
{
|
||||||
|
if (q != null)
|
||||||
|
{
|
||||||
// filtering via "where" clause
|
// filtering via "where" clause
|
||||||
AuditEntryQueryWalker propertyWalker = new AuditEntryQueryWalker();
|
AuditEntryQueryWalker propertyWalker = new AuditEntryQueryWalker();
|
||||||
QueryHelper.walk(q, propertyWalker);
|
QueryHelper.walk(q, propertyWalker);
|
||||||
totalItems = getAuditEntriesCountByAppAndProperties(auditApplication, propertyWalker);
|
totalItems = getAuditEntriesCountByAppAndProperties(auditApplication, propertyWalker);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
totalItems = getAuditEntriesCountByApp(auditApplication);
|
totalItems = getAuditEntriesCountByApp(auditApplication);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
totalItems = totalRetrievedItems;
|
totalItems = totalRetrievedItems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entriesAudit = (skipCount >= totalRetrievedItems)
|
entriesAudit = (skipCount >= totalRetrievedItems)
|
||||||
? Collections.emptyList()
|
? Collections.emptyList()
|
||||||
: entriesAudit.subList(skipCount, end);
|
: entriesAudit.subList(skipCount, end);
|
||||||
return CollectionWithPagingInfo.asPaged(paging, entriesAudit, hasMoreItems, totalItems);
|
return CollectionWithPagingInfo.asPaged(paging, entriesAudit, hasMoreItems, totalItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,8 +481,7 @@ public class AuditImpl implements Audit
|
|||||||
final Map<String, UserInfo> mapUserInfo = new HashMap<>(10);
|
final Map<String, UserInfo> mapUserInfo = new HashMap<>(10);
|
||||||
|
|
||||||
// create the callback for auditQuery method
|
// create the callback for auditQuery method
|
||||||
final AuditQueryCallback callback = new AuditQueryCallback()
|
final AuditQueryCallback callback = new AuditQueryCallback() {
|
||||||
{
|
|
||||||
public boolean valuesRequired()
|
public boolean valuesRequired()
|
||||||
{
|
{
|
||||||
return ((includeParam != null) && (includeParam.contains(PARAM_INCLUDE_VALUES)));
|
return ((includeParam != null) && (includeParam.contains(PARAM_INCLUDE_VALUES)));
|
||||||
@@ -532,7 +537,7 @@ public class AuditImpl implements Audit
|
|||||||
params.setApplicationName(auditApplication.getName());
|
params.setApplicationName(auditApplication.getName());
|
||||||
params.setFromId(auditEntryId);
|
params.setFromId(auditEntryId);
|
||||||
params.setToId(auditEntryId + 1);
|
params.setToId(auditEntryId + 1);
|
||||||
|
|
||||||
List<String> includeParam = new ArrayList<>();
|
List<String> includeParam = new ArrayList<>();
|
||||||
if (parameters != null)
|
if (parameters != null)
|
||||||
{
|
{
|
||||||
@@ -545,8 +550,7 @@ public class AuditImpl implements Audit
|
|||||||
final List<AuditEntry> results = new ArrayList<>();
|
final List<AuditEntry> results = new ArrayList<>();
|
||||||
|
|
||||||
// create the callback for auditQuery method
|
// create the callback for auditQuery method
|
||||||
final AuditQueryCallback callback = new AuditQueryCallback()
|
final AuditQueryCallback callback = new AuditQueryCallback() {
|
||||||
{
|
|
||||||
public boolean valuesRequired()
|
public boolean valuesRequired()
|
||||||
{
|
{
|
||||||
return ((includeParam != null) && (includeParam.contains(PARAM_INCLUDE_VALUES)));
|
return ((includeParam != null) && (includeParam.contains(PARAM_INCLUDE_VALUES)));
|
||||||
@@ -710,8 +714,7 @@ public class AuditImpl implements Audit
|
|||||||
@Override
|
@Override
|
||||||
public CollectionWithPagingInfo<AuditEntry> listAuditEntriesByNodeId(String nodeId, Parameters parameters)
|
public CollectionWithPagingInfo<AuditEntry> listAuditEntriesByNodeId(String nodeId, Parameters parameters)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
AuthenticationUtil.runAs(new RunAsWork<Void>() {
|
||||||
{
|
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
checkEnabled();
|
checkEnabled();
|
||||||
@@ -772,8 +775,7 @@ public class AuditImpl implements Audit
|
|||||||
final List<AuditEntry> results = new ArrayList<>();
|
final List<AuditEntry> results = new ArrayList<>();
|
||||||
|
|
||||||
String auditAppId = "alfresco-access";
|
String auditAppId = "alfresco-access";
|
||||||
String auditApplicationName = AuthenticationUtil.runAs(new RunAsWork<String>()
|
String auditApplicationName = AuthenticationUtil.runAs(new RunAsWork<String>() {
|
||||||
{
|
|
||||||
public String doWork() throws Exception
|
public String doWork() throws Exception
|
||||||
{
|
{
|
||||||
return findAuditAppByIdOr404(auditAppId).getName();
|
return findAuditAppByIdOr404(auditAppId).getName();
|
||||||
@@ -781,8 +783,7 @@ public class AuditImpl implements Audit
|
|||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// create the callback for auditQuery method
|
// create the callback for auditQuery method
|
||||||
final AuditQueryCallback callback = new AuditQueryCallback()
|
final AuditQueryCallback callback = new AuditQueryCallback() {
|
||||||
{
|
|
||||||
public boolean valuesRequired()
|
public boolean valuesRequired()
|
||||||
{
|
{
|
||||||
return ((includeParam != null) && (includeParam.contains(PARAM_INCLUDE_VALUES)));
|
return ((includeParam != null) && (includeParam.contains(PARAM_INCLUDE_VALUES)));
|
||||||
@@ -808,8 +809,7 @@ public class AuditImpl implements Audit
|
|||||||
Long toTime = propertyWalker.getToTime();
|
Long toTime = propertyWalker.getToTime();
|
||||||
validateWhereBetween(nodeRef.getId(), fromTime, toTime);
|
validateWhereBetween(nodeRef.getId(), fromTime, toTime);
|
||||||
|
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
AuthenticationUtil.runAs(new RunAsWork<Object>() {
|
||||||
{
|
|
||||||
public Object doWork() throws Exception
|
public Object doWork() throws Exception
|
||||||
{
|
{
|
||||||
// QueryParameters
|
// QueryParameters
|
||||||
@@ -820,7 +820,7 @@ public class AuditImpl implements Audit
|
|||||||
pathParams.setFromTime(fromTime);
|
pathParams.setFromTime(fromTime);
|
||||||
pathParams.setToTime(toTime);
|
pathParams.setToTime(toTime);
|
||||||
pathParams.setApplicationName(auditApplicationName);
|
pathParams.setApplicationName(auditApplicationName);
|
||||||
pathParams.addSearchKey("/"+auditAppId+"/transaction/path", nodePath);
|
pathParams.addSearchKey("/" + auditAppId + "/transaction/path", nodePath);
|
||||||
auditService.auditQuery(callback, pathParams, limit);
|
auditService.auditQuery(callback, pathParams, limit);
|
||||||
|
|
||||||
AuditQueryParameters copyFromPathParams = new AuditQueryParameters();
|
AuditQueryParameters copyFromPathParams = new AuditQueryParameters();
|
||||||
@@ -830,7 +830,7 @@ public class AuditImpl implements Audit
|
|||||||
copyFromPathParams.setFromTime(fromTime);
|
copyFromPathParams.setFromTime(fromTime);
|
||||||
copyFromPathParams.setToTime(toTime);
|
copyFromPathParams.setToTime(toTime);
|
||||||
copyFromPathParams.setApplicationName(auditApplicationName);
|
copyFromPathParams.setApplicationName(auditApplicationName);
|
||||||
copyFromPathParams.addSearchKey("/"+auditAppId+"/transaction/copy/from/path", nodePath);
|
copyFromPathParams.addSearchKey("/" + auditAppId + "/transaction/copy/from/path", nodePath);
|
||||||
auditService.auditQuery(callback, copyFromPathParams, limit);
|
auditService.auditQuery(callback, copyFromPathParams, limit);
|
||||||
|
|
||||||
AuditQueryParameters moveFromPathParams = new AuditQueryParameters();
|
AuditQueryParameters moveFromPathParams = new AuditQueryParameters();
|
||||||
@@ -840,7 +840,7 @@ public class AuditImpl implements Audit
|
|||||||
moveFromPathParams.setFromTime(fromTime);
|
moveFromPathParams.setFromTime(fromTime);
|
||||||
moveFromPathParams.setToTime(toTime);
|
moveFromPathParams.setToTime(toTime);
|
||||||
moveFromPathParams.setApplicationName(auditApplicationName);
|
moveFromPathParams.setApplicationName(auditApplicationName);
|
||||||
moveFromPathParams.addSearchKey("/"+auditAppId+"/transaction/move/from/path", nodePath);
|
moveFromPathParams.addSearchKey("/" + auditAppId + "/transaction/move/from/path", nodePath);
|
||||||
auditService.auditQuery(callback, moveFromPathParams, limit);
|
auditService.auditQuery(callback, moveFromPathParams, limit);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -857,7 +857,7 @@ public class AuditImpl implements Audit
|
|||||||
|
|
||||||
public AuditEntriesByNodeIdQueryWalker()
|
public AuditEntriesByNodeIdQueryWalker()
|
||||||
{
|
{
|
||||||
super(new HashSet<>(Arrays.asList(new String[] { CREATED_BY_USER })), null);
|
super(new HashSet<>(Arrays.asList(new String[]{CREATED_BY_USER})), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -904,19 +904,22 @@ public class AuditImpl implements Audit
|
|||||||
public int getAuditEntriesCountByApp(AuditService.AuditApplication auditApplication)
|
public int getAuditEntriesCountByApp(AuditService.AuditApplication auditApplication)
|
||||||
{
|
{
|
||||||
final String applicationName = auditApplication.getKey().substring(1);
|
final String applicationName = auditApplication.getKey().substring(1);
|
||||||
|
|
||||||
return auditService.getAuditEntriesCountByApp(applicationName);
|
return auditService.getAuditEntriesCountByApp(applicationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication auditApplication, AuditEntryQueryWalker propertyWalker)
|
public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication auditApplication, AuditEntryQueryWalker propertyWalker)
|
||||||
{
|
{
|
||||||
|
final String applicationName = auditApplication.getKey().substring(1);
|
||||||
|
|
||||||
AuditQueryParameters parameters = new AuditQueryParameters();
|
AuditQueryParameters parameters = new AuditQueryParameters();
|
||||||
parameters.setApplicationName(auditApplication.getName());
|
parameters.setApplicationName(applicationName);
|
||||||
parameters.setFromTime(propertyWalker.getFromTime());
|
parameters.setFromTime(propertyWalker.getFromTime());
|
||||||
parameters.setToTime(propertyWalker.getToTime());
|
parameters.setToTime(propertyWalker.getToTime());
|
||||||
parameters.setFromId(propertyWalker.getFromId());
|
parameters.setFromId(propertyWalker.getFromId());
|
||||||
parameters.setToId(propertyWalker.getToId());
|
parameters.setToId(propertyWalker.getToId());
|
||||||
parameters.setUser(propertyWalker.getCreatedByUser());
|
parameters.setUser(propertyWalker.getCreatedByUser());
|
||||||
|
|
||||||
return auditService.getAuditEntriesCountByAppAndProperties(parameters);
|
return auditService.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -23,69 +23,92 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.impl;
|
package org.alfresco.rest.api.impl;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import org.alfresco.query.PagingResults;
|
import java.util.Map;
|
||||||
import org.alfresco.rest.api.People;
|
|
||||||
import org.alfresco.rest.api.Preferences;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.rest.api.model.Preference;
|
import org.alfresco.rest.api.People;
|
||||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
import org.alfresco.rest.api.Preferences;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.api.model.Preference;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||||
import org.alfresco.service.cmr.preference.PreferenceService;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||||
|
import org.alfresco.service.cmr.preference.PreferenceService;
|
||||||
/**
|
import org.alfresco.util.Pair;
|
||||||
* Centralises access to preference services and maps between representations.
|
|
||||||
*
|
/**
|
||||||
* @author steveglover
|
* Centralises access to preference services and maps between representations.
|
||||||
* @since publicapi1.0
|
*
|
||||||
*/
|
* @author steveglover
|
||||||
public class PreferencesImpl implements Preferences
|
* @since publicapi1.0
|
||||||
{
|
*/
|
||||||
private People people;
|
public class PreferencesImpl implements Preferences
|
||||||
private PreferenceService preferenceService;
|
{
|
||||||
|
private People people;
|
||||||
public void setPeople(People people)
|
private PreferenceService preferenceService;
|
||||||
{
|
|
||||||
this.people = people;
|
public void setPeople(People people)
|
||||||
}
|
{
|
||||||
|
this.people = people;
|
||||||
public void setPreferenceService(PreferenceService preferenceService)
|
}
|
||||||
{
|
|
||||||
this.preferenceService = preferenceService;
|
public void setPreferenceService(PreferenceService preferenceService)
|
||||||
}
|
{
|
||||||
|
this.preferenceService = preferenceService;
|
||||||
public Preference getPreference(String personId, String preferenceName)
|
}
|
||||||
{
|
|
||||||
personId = people.validatePerson(personId);
|
@Override
|
||||||
Serializable preferenceValue = preferenceService.getPreference(personId, preferenceName);
|
public Preference getPreference(String personId, String preferenceName)
|
||||||
if(preferenceValue != null)
|
{
|
||||||
{
|
personId = people.validatePerson(personId);
|
||||||
return new Preference(preferenceName, preferenceValue);
|
Serializable preferenceValue = preferenceService.getPreference(personId, preferenceName);
|
||||||
}
|
if (preferenceValue != null)
|
||||||
else
|
{
|
||||||
{
|
return new Preference(preferenceName, preferenceValue);
|
||||||
throw new RelationshipResourceNotFoundException(personId, preferenceName);
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
throw new RelationshipResourceNotFoundException(personId, preferenceName);
|
||||||
public CollectionWithPagingInfo<Preference> getPreferences(String personId, Paging paging)
|
}
|
||||||
{
|
}
|
||||||
personId = people.validatePerson(personId);
|
|
||||||
|
@Override
|
||||||
PagingResults<Pair<String, Serializable>> preferences = preferenceService.getPagedPreferences(personId, null, Util.getPagingRequest(paging));
|
public CollectionWithPagingInfo<Preference> getPreferences(String personId, Paging paging)
|
||||||
List<Preference> ret = new ArrayList<Preference>(preferences.getPage().size());
|
{
|
||||||
for(Pair<String, Serializable> prefEntity : preferences.getPage())
|
personId = people.validatePerson(personId);
|
||||||
{
|
|
||||||
Preference pref = new Preference(prefEntity.getFirst(), prefEntity.getSecond());
|
PagingResults<Pair<String, Serializable>> preferences = preferenceService.getPagedPreferences(personId, null, Util.getPagingRequest(paging));
|
||||||
ret.add(pref);
|
List<Preference> ret = new ArrayList<>(preferences.getPage().size());
|
||||||
}
|
for (Pair<String, Serializable> prefEntity : preferences.getPage())
|
||||||
|
{
|
||||||
return CollectionWithPagingInfo.asPaged(paging, ret, preferences.hasMoreItems(), preferences.getTotalResultCount().getFirst());
|
Preference pref = new Preference(prefEntity.getFirst(), prefEntity.getSecond());
|
||||||
}
|
ret.add(pref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CollectionWithPagingInfo.asPaged(paging, ret, preferences.hasMoreItems(), preferences.getTotalResultCount().getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Preference updatePreference(String personId, Preference preference)
|
||||||
|
{
|
||||||
|
personId = people.validatePerson(personId, true);
|
||||||
|
final Map<String, Serializable> preferencesToSet;
|
||||||
|
if (preference.getValue() == null || "".equals(preference.getValue()))
|
||||||
|
{
|
||||||
|
preferencesToSet = new HashMap<>(1);
|
||||||
|
preferencesToSet.put(preference.getName(), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
preferencesToSet = Map.of(preference.getName(), preference.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
preferenceService.setPreferences(personId, preferencesToSet);
|
||||||
|
return new Preference(preference.getName(), preferenceService.getPreference(personId, preference.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,93 +1,105 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.people;
|
package org.alfresco.rest.api.people;
|
||||||
|
|
||||||
import org.alfresco.rest.api.Preferences;
|
import org.apache.commons.logging.Log;
|
||||||
import org.alfresco.rest.api.model.Preference;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
import org.alfresco.rest.api.Preferences;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.api.model.Preference;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||||
import org.apache.commons.logging.Log;
|
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
@RelationshipResource(name = "preferences", entityResource = PeopleEntityResource.class, title = "Person Preferences")
|
import org.alfresco.util.ParameterCheck;
|
||||||
public class PersonPreferencesRelation implements RelationshipResourceAction.Read<Preference>, RelationshipResourceAction.ReadById<Preference>, InitializingBean
|
|
||||||
{
|
@RelationshipResource(name = "preferences", entityResource = PeopleEntityResource.class, title = "Person Preferences")
|
||||||
private static final Log logger = LogFactory.getLog(PersonPreferencesRelation.class);
|
public class PersonPreferencesRelation implements RelationshipResourceAction.Read<Preference>, RelationshipResourceAction.ReadById<Preference>, RelationshipResourceAction.Update<Preference>, InitializingBean
|
||||||
|
{
|
||||||
private Preferences preferences;
|
private static final Log logger = LogFactory.getLog(PersonPreferencesRelation.class);
|
||||||
|
|
||||||
public void setPreferences(Preferences preferences)
|
private Preferences preferences;
|
||||||
{
|
|
||||||
this.preferences = preferences;
|
public void setPreferences(Preferences preferences)
|
||||||
}
|
{
|
||||||
|
this.preferences = preferences;
|
||||||
@Override
|
}
|
||||||
public void afterPropertiesSet()
|
|
||||||
{
|
@Override
|
||||||
ParameterCheck.mandatory("preferences", this.preferences);
|
public void afterPropertiesSet()
|
||||||
}
|
{
|
||||||
|
ParameterCheck.mandatory("preferences", this.preferences);
|
||||||
/**
|
}
|
||||||
* Returns a paged list of preferences for the user personId.
|
|
||||||
*
|
/**
|
||||||
* If personId does not exist, NotFoundException (status 404).
|
* Returns a paged list of preferences for the user personId.
|
||||||
*
|
*
|
||||||
* @see org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction.Read#readAll(java.lang.String, org.alfresco.rest.framework.resource.parameters.Parameters)
|
* If personId does not exist, NotFoundException (status 404).
|
||||||
*/
|
*
|
||||||
@Override
|
* @see org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction.Read#readAll(java.lang.String, org.alfresco.rest.framework.resource.parameters.Parameters)
|
||||||
@WebApiDescription(title = "A paged list of the persons preferences.")
|
*/
|
||||||
public CollectionWithPagingInfo<Preference> readAll(String personId, Parameters parameters)
|
@Override
|
||||||
{
|
@WebApiDescription(title = "A paged list of the persons preferences.")
|
||||||
return preferences.getPreferences(personId, parameters.getPaging());
|
public CollectionWithPagingInfo<Preference> readAll(String personId, Parameters parameters)
|
||||||
}
|
{
|
||||||
|
return preferences.getPreferences(personId, parameters.getPaging());
|
||||||
/**
|
}
|
||||||
* Returns information regarding the preference 'preferenceName' for user personId.
|
|
||||||
*
|
/**
|
||||||
* If personId does not exist, NotFoundException (status 404).
|
* Returns information regarding the preference 'preferenceName' for user personId.
|
||||||
*
|
*
|
||||||
* @see org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction.ReadById#readById(String, String, org.alfresco.rest.framework.resource.parameters.Parameters)
|
* If personId does not exist, NotFoundException (status 404).
|
||||||
*/
|
*
|
||||||
@Override
|
* @see org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction.ReadById#readById(String, String, org.alfresco.rest.framework.resource.parameters.Parameters)
|
||||||
@WebApiDescription(title = "Preference value for preference 'preferenceName' for person 'personId'.")
|
*/
|
||||||
public Preference readById(String personId, String preferenceName, Parameters parameters)
|
@Override
|
||||||
{
|
@WebApiDescription(title = "Preference value for preference 'preferenceName' for person 'personId'.")
|
||||||
// fix for REPO-855
|
public Preference readById(String personId, String preferenceName, Parameters parameters)
|
||||||
String url = parameters.getRequest().getURL();
|
{
|
||||||
if(url.matches(".*workspace://SpacesStore/.*")){
|
// fix for REPO-855
|
||||||
preferenceName += url.substring(url.indexOf("//SpacesStore/"));
|
String url = parameters.getRequest().getURL();
|
||||||
}
|
if (url.matches(".*workspace://SpacesStore/.*"))
|
||||||
//
|
{
|
||||||
|
preferenceName += url.substring(url.indexOf("//SpacesStore/"));
|
||||||
return preferences.getPreference(personId, preferenceName);
|
}
|
||||||
}
|
//
|
||||||
|
|
||||||
}
|
return preferences.getPreference(personId, preferenceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Preference update(String personId, Preference preference, Parameters parameters)
|
||||||
|
{
|
||||||
|
if (preference.getName() == null || preference.getName().isBlank())
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException();
|
||||||
|
}
|
||||||
|
return preferences.updatePreference(personId, preference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -30,6 +30,15 @@ import java.io.InputStream;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
|
||||||
|
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.rest.framework.core.ResourceLocator;
|
import org.alfresco.rest.framework.core.ResourceLocator;
|
||||||
import org.alfresco.rest.framework.core.ResourceMetadata;
|
import org.alfresco.rest.framework.core.ResourceMetadata;
|
||||||
@@ -47,14 +56,7 @@ import org.alfresco.rest.framework.resource.parameters.Params;
|
|||||||
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
|
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
|
||||||
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
|
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
|
||||||
import org.alfresco.rest.framework.tools.RequestReader;
|
import org.alfresco.rest.framework.tools.RequestReader;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
|
||||||
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
|
|
||||||
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
/**
|
/**
|
||||||
* Handles the HTTP PUT for a Resource, equivalent to CRUD Update
|
* Handles the HTTP PUT for a Resource, equivalent to CRUD Update
|
||||||
*
|
*
|
||||||
@@ -64,15 +66,15 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
RecognizedParamsExtractor, RequestReader
|
RecognizedParamsExtractor, RequestReader
|
||||||
{
|
{
|
||||||
|
|
||||||
private static Log logger = LogFactory.getLog(ResourceWebScriptPut.class);
|
private static final Log logger = LogFactory.getLog(ResourceWebScriptPut.class);
|
||||||
|
|
||||||
public ResourceWebScriptPut()
|
public ResourceWebScriptPut()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
setHttpMethod(HttpMethod.PUT);
|
setHttpMethod(HttpMethod.PUT);
|
||||||
setParamsExtractor(this);
|
setParamsExtractor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Params extractParams(ResourceMetadata resourceMeta, WebScriptRequest req)
|
public Params extractParams(ResourceMetadata resourceMeta, WebScriptRequest req)
|
||||||
{
|
{
|
||||||
@@ -86,81 +88,87 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
|
|
||||||
switch (resourceMeta.getType())
|
switch (resourceMeta.getType())
|
||||||
{
|
{
|
||||||
case ENTITY:
|
case ENTITY:
|
||||||
if (StringUtils.isBlank(entityId))
|
if (StringUtils.isBlank(entityId))
|
||||||
{
|
{
|
||||||
throw new UnsupportedResourceOperationException("PUT is executed against the instance URL");
|
throw new UnsupportedResourceOperationException("PUT is executed against the instance URL");
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
|
{
|
||||||
|
|
||||||
Object putEnt = extractJsonContent(req, assistant.getJsonHelper(), resourceMeta.getObjectType(operation));
|
Object putEnt = extractJsonContent(req, assistant.getJsonHelper(), resourceMeta.getObjectType(operation));
|
||||||
return Params.valueOf(entityId,params,putEnt, req);
|
return Params.valueOf(entityId, params, putEnt, req);
|
||||||
}
|
}
|
||||||
case RELATIONSHIP:
|
case RELATIONSHIP:
|
||||||
if (StringUtils.isBlank(relationshipId))
|
if (StringUtils.isBlank(relationshipId))
|
||||||
|
{
|
||||||
|
throw new UnsupportedResourceOperationException("PUT is executed against the instance URL");
|
||||||
|
}
|
||||||
|
Object putRel = extractJsonContent(req, assistant.getJsonHelper(), resourceMeta.getObjectType(operation));
|
||||||
|
if (StringUtils.isNotBlank(relationship2Id))
|
||||||
|
{
|
||||||
|
ResourceWebScriptHelper.setUniqueId(putRel, relationship2Id);
|
||||||
|
return Params.valueOf(false, entityId, relationshipId, relationship2Id,
|
||||||
|
putRel, null, null, params, null, req);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResourceWebScriptHelper.setUniqueId(putRel, relationshipId);
|
||||||
|
return Params.valueOf(entityId, relationshipId, params, putRel, req);
|
||||||
|
}
|
||||||
|
case PROPERTY:
|
||||||
|
final String resourceName = resourceVars.get(ResourceLocator.RELATIONSHIP_RESOURCE);
|
||||||
|
final String propertyName = resourceVars.get(ResourceLocator.PROPERTY);
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(entityId) && StringUtils.isNotBlank(resourceName))
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotBlank(propertyName))
|
||||||
{
|
{
|
||||||
throw new UnsupportedResourceOperationException("PUT is executed against the instance URL");
|
return Params.valueOf(entityId, relationshipId, null, getStream(req), propertyName, params, getContentInfo(req), req);
|
||||||
}
|
|
||||||
Object putRel = extractJsonContent(req, assistant.getJsonHelper(), resourceMeta.getObjectType(operation));
|
|
||||||
if (StringUtils.isNotBlank(relationship2Id))
|
|
||||||
{
|
|
||||||
ResourceWebScriptHelper.setUniqueId(putRel, relationship2Id);
|
|
||||||
return Params.valueOf(false, entityId, relationshipId, relationship2Id,
|
|
||||||
putRel, null, null, params, null, req);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ResourceWebScriptHelper.setUniqueId(putRel,relationshipId);
|
return Params.valueOf(entityId, null, null, getStream(req), resourceName, params, getContentInfo(req), req);
|
||||||
return Params.valueOf(entityId, params, putRel, req);
|
|
||||||
}
|
}
|
||||||
case PROPERTY:
|
|
||||||
final String resourceName = resourceVars.get(ResourceLocator.RELATIONSHIP_RESOURCE);
|
|
||||||
final String propertyName = resourceVars.get(ResourceLocator.PROPERTY);
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(entityId) && StringUtils.isNotBlank(resourceName))
|
}
|
||||||
{
|
// Fall through to unsupported.
|
||||||
if (StringUtils.isNotBlank(propertyName))
|
default:
|
||||||
{
|
throw new UnsupportedResourceOperationException("PUT not supported for this request.");
|
||||||
return Params.valueOf(entityId, relationshipId, null, getStream(req), propertyName, params, getContentInfo(req), req);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Params.valueOf(entityId, null, null, getStream(req), resourceName, params, getContentInfo(req), req);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Fall through to unsupported.
|
|
||||||
default:
|
|
||||||
throw new UnsupportedResourceOperationException("PUT not supported for this request.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the basic content info from the request.
|
* Returns the basic content info from the request.
|
||||||
* @param req WebScriptRequest
|
*
|
||||||
|
* @param req
|
||||||
|
* WebScriptRequest
|
||||||
* @return BasicContentInfo
|
* @return BasicContentInfo
|
||||||
*/
|
*/
|
||||||
private BasicContentInfo getContentInfo(WebScriptRequest req) {
|
private BasicContentInfo getContentInfo(WebScriptRequest req)
|
||||||
|
{
|
||||||
String encoding = "UTF-8";
|
|
||||||
String contentType = MimetypeMap.MIMETYPE_BINARY;
|
String encoding = "UTF-8";
|
||||||
|
String contentType = MimetypeMap.MIMETYPE_BINARY;
|
||||||
if (StringUtils.isNotEmpty(req.getContentType()))
|
|
||||||
{
|
if (StringUtils.isNotEmpty(req.getContentType()))
|
||||||
MediaType media = MediaType.parseMediaType(req.getContentType());
|
{
|
||||||
contentType = media.getType()+'/'+media.getSubtype();
|
MediaType media = MediaType.parseMediaType(req.getContentType());
|
||||||
if (media.getCharset() != null)
|
contentType = media.getType() + '/' + media.getSubtype();
|
||||||
{
|
if (media.getCharset() != null)
|
||||||
encoding = media.getCharset().toString();
|
{
|
||||||
}
|
encoding = media.getCharset().toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new ContentInfoImpl(contentType, encoding, -1, Locale.getDefault());
|
return new ContentInfoImpl(contentType, encoding, -1, Locale.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the input stream for the request
|
* Returns the input stream for the request
|
||||||
* @param req WebScriptRequest
|
*
|
||||||
|
* @param req
|
||||||
|
* WebScriptRequest
|
||||||
* @return InputStream
|
* @return InputStream
|
||||||
*/
|
*/
|
||||||
private InputStream getStream(WebScriptRequest req)
|
private InputStream getStream(WebScriptRequest req)
|
||||||
@@ -186,11 +194,14 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the action on the resource
|
* Executes the action on the resource
|
||||||
* @param resource ResourceWithMetadata
|
*
|
||||||
* @param params parameters to use
|
* @param resource
|
||||||
|
* ResourceWithMetadata
|
||||||
|
* @param params
|
||||||
|
* parameters to use
|
||||||
* @return anObject the result of the execute
|
* @return anObject the result of the execute
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -198,87 +209,87 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
{
|
{
|
||||||
switch (resource.getMetaData().getType())
|
switch (resource.getMetaData().getType())
|
||||||
{
|
{
|
||||||
case ENTITY:
|
case ENTITY:
|
||||||
if (EntityResourceAction.Update.class.isAssignableFrom(resource.getResource().getClass()))
|
if (EntityResourceAction.Update.class.isAssignableFrom(resource.getResource().getClass()))
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(EntityResourceAction.Update.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(EntityResourceAction.Update.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
EntityResourceAction.Update<Object> updateEnt = (EntityResourceAction.Update<Object>) resource.getResource();
|
|
||||||
Object result = updateEnt.update(params.getEntityId(), params.getPassedIn(), params);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else
|
EntityResourceAction.Update<Object> updateEnt = (EntityResourceAction.Update<Object>) resource.getResource();
|
||||||
|
Object result = updateEnt.update(params.getEntityId(), params.getPassedIn(), params);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(EntityResourceAction.UpdateWithResponse.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(EntityResourceAction.UpdateWithResponse.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
EntityResourceAction.UpdateWithResponse<Object> updateEnt = (EntityResourceAction.UpdateWithResponse<Object>) resource.getResource();
|
|
||||||
Object result = updateEnt.update(params.getEntityId(), params.getPassedIn(), params, withResponse);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
case RELATIONSHIP:
|
EntityResourceAction.UpdateWithResponse<Object> updateEnt = (EntityResourceAction.UpdateWithResponse<Object>) resource.getResource();
|
||||||
if (RelationshipResourceAction.UpdateWithResponse.class.isAssignableFrom(resource.getResource().getClass()))
|
Object result = updateEnt.update(params.getEntityId(), params.getPassedIn(), params, withResponse);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
case RELATIONSHIP:
|
||||||
|
if (RelationshipResourceAction.UpdateWithResponse.class.isAssignableFrom(resource.getResource().getClass()))
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(RelationshipResourceAction.UpdateWithResponse.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(RelationshipResourceAction.UpdateWithResponse.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
RelationshipResourceAction.UpdateWithResponse<Object> relationUpdater = (RelationshipResourceAction.UpdateWithResponse<Object>) resource.getResource();
|
|
||||||
Object relResult = relationUpdater.update(params.getEntityId(), params.getPassedIn(), params, withResponse);
|
|
||||||
return relResult;
|
|
||||||
}
|
}
|
||||||
else
|
RelationshipResourceAction.UpdateWithResponse<Object> relationUpdater = (RelationshipResourceAction.UpdateWithResponse<Object>) resource.getResource();
|
||||||
|
Object relResult = relationUpdater.update(params.getEntityId(), params.getPassedIn(), params, withResponse);
|
||||||
|
return relResult;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(RelationshipResourceAction.Update.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(RelationshipResourceAction.Update.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
RelationshipResourceAction.Update<Object> relationUpdater = (RelationshipResourceAction.Update<Object>) resource.getResource();
|
|
||||||
Object relResult = relationUpdater.update(params.getEntityId(), params.getPassedIn(), params);
|
|
||||||
return relResult;
|
|
||||||
}
|
}
|
||||||
case PROPERTY:
|
RelationshipResourceAction.Update<Object> relationUpdater = (RelationshipResourceAction.Update<Object>) resource.getResource();
|
||||||
if (BinaryResourceAction.Update.class.isAssignableFrom(resource.getResource().getClass()))
|
Object relResult = relationUpdater.update(params.getEntityId(), params.getPassedIn(), params);
|
||||||
|
return relResult;
|
||||||
|
}
|
||||||
|
case PROPERTY:
|
||||||
|
if (BinaryResourceAction.Update.class.isAssignableFrom(resource.getResource().getClass()))
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(BinaryResourceAction.Update.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(BinaryResourceAction.Update.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
BinaryResourceAction.Update<Object> binUpdater = (BinaryResourceAction.Update<Object>) resource.getResource();
|
|
||||||
return binUpdater.updateProperty(params.getEntityId(), params.getContentInfo(), params.getStream(), params);
|
|
||||||
}
|
}
|
||||||
if (BinaryResourceAction.UpdateWithResponse.class.isAssignableFrom(resource.getResource().getClass()))
|
BinaryResourceAction.Update<Object> binUpdater = (BinaryResourceAction.Update<Object>) resource.getResource();
|
||||||
|
return binUpdater.updateProperty(params.getEntityId(), params.getContentInfo(), params.getStream(), params);
|
||||||
|
}
|
||||||
|
if (BinaryResourceAction.UpdateWithResponse.class.isAssignableFrom(resource.getResource().getClass()))
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(BinaryResourceAction.UpdateWithResponse.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(BinaryResourceAction.UpdateWithResponse.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
BinaryResourceAction.UpdateWithResponse<Object> binUpdater = (BinaryResourceAction.UpdateWithResponse<Object>) resource.getResource();
|
|
||||||
return binUpdater.updateProperty(params.getEntityId(), params.getContentInfo(), params.getStream(), params, withResponse);
|
|
||||||
}
|
}
|
||||||
if (RelationshipResourceBinaryAction.Update.class.isAssignableFrom(resource.getResource().getClass()))
|
BinaryResourceAction.UpdateWithResponse<Object> binUpdater = (BinaryResourceAction.UpdateWithResponse<Object>) resource.getResource();
|
||||||
|
return binUpdater.updateProperty(params.getEntityId(), params.getContentInfo(), params.getStream(), params, withResponse);
|
||||||
|
}
|
||||||
|
if (RelationshipResourceBinaryAction.Update.class.isAssignableFrom(resource.getResource().getClass()))
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(RelationshipResourceBinaryAction.Update.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(RelationshipResourceBinaryAction.Update.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
RelationshipResourceBinaryAction.Update<Object> binUpdater = (RelationshipResourceBinaryAction.Update<Object>) resource.getResource();
|
|
||||||
return binUpdater.updateProperty(params.getEntityId(), params.getRelationshipId(), params.getContentInfo(), params.getStream(), params);
|
|
||||||
}
|
}
|
||||||
if (RelationshipResourceBinaryAction.UpdateWithResponse.class.isAssignableFrom(resource.getResource().getClass()))
|
RelationshipResourceBinaryAction.Update<Object> binUpdater = (RelationshipResourceBinaryAction.Update<Object>) resource.getResource();
|
||||||
|
return binUpdater.updateProperty(params.getEntityId(), params.getRelationshipId(), params.getContentInfo(), params.getStream(), params);
|
||||||
|
}
|
||||||
|
if (RelationshipResourceBinaryAction.UpdateWithResponse.class.isAssignableFrom(resource.getResource().getClass()))
|
||||||
|
{
|
||||||
|
if (resource.getMetaData().isDeleted(RelationshipResourceBinaryAction.UpdateWithResponse.class))
|
||||||
{
|
{
|
||||||
if (resource.getMetaData().isDeleted(RelationshipResourceBinaryAction.UpdateWithResponse.class))
|
throw new DeletedResourceException("(UPDATE) " + resource.getMetaData().getUniqueId());
|
||||||
{
|
|
||||||
throw new DeletedResourceException("(UPDATE) "+resource.getMetaData().getUniqueId());
|
|
||||||
}
|
|
||||||
RelationshipResourceBinaryAction.UpdateWithResponse<Object> binUpdater = (RelationshipResourceBinaryAction.UpdateWithResponse<Object>) resource.getResource();
|
|
||||||
return binUpdater.updateProperty(params.getEntityId(), params.getRelationshipId(), params.getContentInfo(), params.getStream(), params, withResponse);
|
|
||||||
}
|
}
|
||||||
default:
|
RelationshipResourceBinaryAction.UpdateWithResponse<Object> binUpdater = (RelationshipResourceBinaryAction.UpdateWithResponse<Object>) resource.getResource();
|
||||||
throw new UnsupportedResourceOperationException("PUT not supported for Actions");
|
return binUpdater.updateProperty(params.getEntityId(), params.getRelationshipId(), params.getContentInfo(), params.getStream(), params, withResponse);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new UnsupportedResourceOperationException("PUT not supported for Actions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,416 +1,411 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.tests;
|
package org.alfresco.rest.api.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.alfresco.repo.tenant.TenantUtil;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
import org.junit.Test;
|
||||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
|
||||||
import org.alfresco.rest.api.tests.RepoService.TestPerson;
|
import org.alfresco.repo.tenant.TenantUtil;
|
||||||
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
|
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||||
import org.alfresco.rest.api.tests.client.PublicApiClient.Paging;
|
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||||
import org.alfresco.rest.api.tests.client.PublicApiClient.People;
|
import org.alfresco.rest.api.tests.RepoService.TestPerson;
|
||||||
import org.alfresco.rest.api.tests.client.PublicApiException;
|
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
|
||||||
import org.alfresco.rest.api.tests.client.RequestContext;
|
import org.alfresco.rest.api.tests.client.PublicApiClient.Paging;
|
||||||
import org.alfresco.rest.api.tests.client.data.Preference;
|
import org.alfresco.rest.api.tests.client.PublicApiClient.People;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.rest.api.tests.client.PublicApiException;
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.alfresco.rest.api.tests.client.RequestContext;
|
||||||
import org.junit.Test;
|
import org.alfresco.rest.api.tests.client.data.Preference;
|
||||||
|
import org.alfresco.util.GUID;
|
||||||
public class TestUserPreferences extends EnterpriseTestApi
|
|
||||||
{
|
public class TestUserPreferences extends EnterpriseTestApi
|
||||||
@Test
|
{
|
||||||
public void testUserPreferences() throws Exception
|
@Test
|
||||||
{
|
public void testUserPreferences() throws Exception
|
||||||
Iterator<TestNetwork> networksIt = getTestFixture().getNetworksIt();
|
{
|
||||||
assertTrue(networksIt.hasNext());
|
Iterator<TestNetwork> networksIt = getTestFixture().getNetworksIt();
|
||||||
final TestNetwork network1 = networksIt.next();
|
assertTrue(networksIt.hasNext());
|
||||||
assertTrue(networksIt.hasNext());
|
final TestNetwork network1 = networksIt.next();
|
||||||
final TestNetwork network2 = networksIt.next();
|
assertTrue(networksIt.hasNext());
|
||||||
|
final TestNetwork network2 = networksIt.next();
|
||||||
final List<TestPerson> people = new ArrayList<TestPerson>(3);
|
|
||||||
|
final List<TestPerson> people = new ArrayList<TestPerson>(3);
|
||||||
// create users and some preferences
|
|
||||||
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>()
|
// create users and some preferences
|
||||||
{
|
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
TestPerson person = network1.createUser();
|
TestPerson person = network1.createUser();
|
||||||
people.add(person);
|
people.add(person);
|
||||||
person = network1.createUser();
|
person = network1.createUser();
|
||||||
people.add(person);
|
people.add(person);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, network1.getId());
|
}, network1.getId());
|
||||||
|
|
||||||
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>()
|
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>() {
|
||||||
{
|
@Override
|
||||||
@Override
|
public Void doWork() throws Exception
|
||||||
public Void doWork() throws Exception
|
{
|
||||||
{
|
TestPerson person = network2.createUser();
|
||||||
TestPerson person = network2.createUser();
|
people.add(person);
|
||||||
people.add(person);
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
}, network2.getId());
|
||||||
}, network2.getId());
|
|
||||||
|
final TestPerson person1 = people.get(0);
|
||||||
final TestPerson person1 = people.get(0);
|
final TestPerson person2 = people.get(1);
|
||||||
final TestPerson person2 = people.get(1);
|
final TestPerson person3 = people.get(2);
|
||||||
final TestPerson person3 = people.get(2);
|
|
||||||
|
final List<Preference> expectedPreferences = new ArrayList<Preference>();
|
||||||
final List<Preference> expectedPreferences = new ArrayList<Preference>();
|
expectedPreferences.add(new Preference("org.alfresco.share.documentList.testPreference2", String.valueOf(true)));
|
||||||
expectedPreferences.add(new Preference("org.alfresco.share.documentList.testPreference2", String.valueOf(true)));
|
expectedPreferences.add(new Preference("org.alfresco.share.documentList.testPreference1", String.valueOf(true)));
|
||||||
expectedPreferences.add(new Preference("org.alfresco.share.documentList.testPreference1", String.valueOf(true)));
|
expectedPreferences.add(new Preference("org.alfresco.share.documentList.sortAscending", String.valueOf(true)));
|
||||||
expectedPreferences.add(new Preference("org.alfresco.share.documentList.sortAscending", String.valueOf(true)));
|
expectedPreferences.add(new Preference("org.alfresco.share.documentList.testPreference3", String.valueOf(true)));
|
||||||
expectedPreferences.add(new Preference("org.alfresco.share.documentList.testPreference3", String.valueOf(true)));
|
// new preference name for issue REPO-855
|
||||||
// new preference name for issue REPO-855
|
expectedPreferences.add(new Preference("org.alfresco.ext.folders.favourites.workspace://SpacesStore/4e3d0779-388a-4b94-91e1-eab588a7da3d.createdAt", String.valueOf(true)));
|
||||||
expectedPreferences.add(new Preference("org.alfresco.ext.folders.favourites.workspace://SpacesStore/4e3d0779-388a-4b94-91e1-eab588a7da3d.createdAt", String.valueOf(true)));
|
|
||||||
|
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {
|
||||||
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
|
@Override
|
||||||
{
|
public Void doWork() throws Exception
|
||||||
@Override
|
{
|
||||||
public Void doWork() throws Exception
|
for (Preference pref : expectedPreferences)
|
||||||
{
|
{
|
||||||
for(Preference pref : expectedPreferences)
|
// TODO add preferences thru api
|
||||||
{
|
repoService.addPreference(person1.getId(), pref.getId(), pref.getValue());
|
||||||
// TODO add preferences thru api
|
}
|
||||||
repoService.addPreference(person1.getId(), pref.getId(), pref.getValue());
|
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
return null;
|
}, person1.getId(), network1.getId());
|
||||||
}
|
|
||||||
}, person1.getId(), network1.getId());
|
Collections.sort(expectedPreferences);
|
||||||
|
|
||||||
Collections.sort(expectedPreferences);
|
People peopleProxy = publicApiClient.people();
|
||||||
|
|
||||||
People peopleProxy = publicApiClient.people();
|
// GET preferences
|
||||||
|
// Test case: cloud-1492
|
||||||
// GET preferences
|
|
||||||
// Test case: cloud-1492
|
// unknown user
|
||||||
|
try
|
||||||
// unknown user
|
{
|
||||||
try
|
int skipCount = 0;
|
||||||
{
|
int maxItems = 2;
|
||||||
int skipCount = 0;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
int maxItems = 2;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
peopleProxy.getPreferences(GUID.generate(), createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
|
||||||
peopleProxy.getPreferences(GUID.generate(), createParams(paging, null));
|
fail();
|
||||||
|
}
|
||||||
fail();
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
// test paging
|
||||||
|
{
|
||||||
// test paging
|
int skipCount = 0;
|
||||||
{
|
int maxItems = 2;
|
||||||
int skipCount = 0;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
int maxItems = 2;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
ListResponse<Preference> resp = peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
||||||
ListResponse<Preference> resp = peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
}
|
||||||
checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
|
||||||
}
|
{
|
||||||
|
int skipCount = 2;
|
||||||
{
|
int maxItems = 10;
|
||||||
int skipCount = 2;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
int maxItems = 10;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
ListResponse<Preference> resp = peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
||||||
ListResponse<Preference> resp = peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
}
|
||||||
checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
|
||||||
}
|
// "-me-" user
|
||||||
|
{
|
||||||
// "-me-" user
|
int skipCount = 0;
|
||||||
{
|
int maxItems = 2;
|
||||||
int skipCount = 0;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
int maxItems = 2;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
ListResponse<Preference> resp = peopleProxy.getPreferences(org.alfresco.rest.api.People.DEFAULT_USER, createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
||||||
ListResponse<Preference> resp = peopleProxy.getPreferences(org.alfresco.rest.api.People.DEFAULT_USER, createParams(paging, null));
|
}
|
||||||
checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
|
||||||
}
|
// invalid user - 404
|
||||||
|
try
|
||||||
// invalid user - 404
|
{
|
||||||
try
|
int skipCount = 2;
|
||||||
{
|
int maxItems = 10;
|
||||||
int skipCount = 2;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
int maxItems = 10;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
peopleProxy.getPreferences("invalid.user", createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
fail("");
|
||||||
peopleProxy.getPreferences("invalid.user", createParams(paging, null));
|
}
|
||||||
fail("");
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
// user from another account - 401
|
||||||
|
try
|
||||||
// user from another account - 401
|
{
|
||||||
try
|
int skipCount = 0;
|
||||||
{
|
int maxItems = 2;
|
||||||
int skipCount = 0;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person3.getId()));
|
||||||
int maxItems = 2;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person3.getId()));
|
// ListResponse<Preference> resp = peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
// checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
||||||
// ListResponse<Preference> resp = peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
||||||
// checkList(expectedPreferences.subList(skipCount, skipCount + paging.getExpectedPaging().getCount()), paging.getExpectedPaging(), resp);
|
fail();
|
||||||
peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
}
|
||||||
fail();
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(e.getHttpResponse().getStatusCode(), HttpStatus.SC_UNAUTHORIZED);
|
||||||
{
|
}
|
||||||
assertEquals(e.getHttpResponse().getStatusCode(), HttpStatus.SC_UNAUTHORIZED);
|
|
||||||
}
|
// another user from the same account - 403
|
||||||
|
try
|
||||||
// another user from the same account - 403
|
{
|
||||||
try
|
int skipCount = 0;
|
||||||
{
|
int maxItems = 2;
|
||||||
int skipCount = 0;
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2.getId()));
|
||||||
int maxItems = 2;
|
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2.getId()));
|
peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
||||||
Paging paging = getPaging(skipCount, maxItems, expectedPreferences.size(), expectedPreferences.size());
|
fail();
|
||||||
peopleProxy.getPreferences(person1.getId(), createParams(paging, null));
|
}
|
||||||
fail();
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(HttpStatus.SC_FORBIDDEN, e.getHttpResponse().getStatusCode());
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_FORBIDDEN, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
// get a single preference
|
||||||
|
// Test Case: cloud-1493
|
||||||
// get a single preference
|
|
||||||
// Test Case: cloud-1493
|
{
|
||||||
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
{
|
Preference pref = expectedPreferences.get(0);
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
Preference ret = peopleProxy.getPreference(person1.getId(), pref.getId());
|
||||||
Preference pref = expectedPreferences.get(0);
|
pref.expected(ret);
|
||||||
Preference ret = peopleProxy.getPreference(person1.getId(), pref.getId());
|
}
|
||||||
pref.expected(ret);
|
|
||||||
}
|
// unknown person id
|
||||||
|
try
|
||||||
// unknown person id
|
{
|
||||||
try
|
Preference pref = expectedPreferences.get(0);
|
||||||
{
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2.getId()));
|
||||||
Preference pref = expectedPreferences.get(0);
|
peopleProxy.getPreference(GUID.generate(), pref.getId());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2.getId()));
|
fail();
|
||||||
peopleProxy.getPreference(GUID.generate(), pref.getId());
|
}
|
||||||
fail();
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
// unknown preference id
|
||||||
|
try
|
||||||
// unknown preference id
|
{
|
||||||
try
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
{
|
peopleProxy.getPreference(person1.getId(), GUID.generate());
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
fail();
|
||||||
peopleProxy.getPreference(person1.getId(), GUID.generate());
|
}
|
||||||
fail();
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_NOT_FOUND, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
// Invalid methods
|
||||||
|
// Test case: cloud-1968
|
||||||
// Invalid methods
|
try
|
||||||
// Test case: cloud-1968
|
{
|
||||||
try
|
Preference pref = expectedPreferences.get(0);
|
||||||
{
|
|
||||||
Preference pref = expectedPreferences.get(0);
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
|
peopleProxy.create("people", person1.getId(), "preferences", pref.getId(), pref.toJSON().toString(), "Unable to POST to a preference");
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
fail();
|
||||||
peopleProxy.create("people", person1.getId(), "preferences", pref.getId(), pref.toJSON().toString(), "Unable to POST to a preference");
|
}
|
||||||
fail();
|
catch (PublicApiException e)
|
||||||
}
|
{
|
||||||
catch(PublicApiException e)
|
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
{
|
||||||
|
Preference updatedPref = new Preference("preference.to.update", "updated.value");
|
||||||
try
|
|
||||||
{
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
Preference pref = expectedPreferences.get(0);
|
Preference response = peopleProxy.updatePreference(person1.getId(), updatedPref);
|
||||||
|
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
assertEquals(updatedPref.getId(), response.getId());
|
||||||
peopleProxy.update("people", person1.getId(), "preferences", pref.getId(), pref.toJSON().toString(), "Unable to PUT a preference");
|
assertEquals(updatedPref.getValue(), response.getValue());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch(PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
Preference pref = expectedPreferences.get(0);
|
||||||
}
|
|
||||||
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
try
|
peopleProxy.remove("people", person1.getId(), "preferences", pref.getId(), "Unable to DELETE a preference");
|
||||||
{
|
fail();
|
||||||
Preference pref = expectedPreferences.get(0);
|
}
|
||||||
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.remove("people", person1.getId(), "preferences", pref.getId(), "Unable to DELETE a preference");
|
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch(PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
Preference pref = expectedPreferences.get(0);
|
||||||
}
|
|
||||||
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
try
|
peopleProxy.create("people", person1.getId(), "preferences", null, pref.toJSON().toString(), "Unable to POST to preferences");
|
||||||
{
|
fail();
|
||||||
Preference pref = expectedPreferences.get(0);
|
}
|
||||||
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.create("people", person1.getId(), "preferences", null, pref.toJSON().toString(), "Unable to POST to preferences");
|
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch(PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
Preference pref = expectedPreferences.get(0);
|
||||||
}
|
|
||||||
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
try
|
peopleProxy.update("people", person1.getId(), "preferences", null, pref.toJSON().toString(), "Unable to PUT preferences");
|
||||||
{
|
fail();
|
||||||
Preference pref = expectedPreferences.get(0);
|
}
|
||||||
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.update("people", person1.getId(), "preferences", null, pref.toJSON().toString(), "Unable to PUT preferences");
|
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch(PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
}
|
peopleProxy.remove("people", person1.getId(), "preferences", null, "Unable to DELETE preferences");
|
||||||
|
fail();
|
||||||
try
|
}
|
||||||
{
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.remove("people", person1.getId(), "preferences", null, "Unable to DELETE preferences");
|
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch(PublicApiException e)
|
{
|
||||||
{
|
// REPO-1061, REPO-890
|
||||||
assertEquals(HttpStatus.SC_METHOD_NOT_ALLOWED, e.getHttpResponse().getStatusCode());
|
try
|
||||||
}
|
{
|
||||||
|
String skipCount = "a";
|
||||||
{
|
String maxItems = "hi";
|
||||||
// REPO-1061, REPO-890
|
HashMap<String, String> params = new HashMap<String, String>();
|
||||||
try
|
params.put("skipCount", skipCount);
|
||||||
{
|
params.put("maxItems", maxItems);
|
||||||
String skipCount = "a";
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
String maxItems = "hi";
|
peopleProxy.getPreferences(person1.getId(), params);
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
fail();
|
||||||
params.put("skipCount", skipCount);
|
}
|
||||||
params.put("maxItems", maxItems);
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.getPreferences(person1.getId(), params);
|
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch (PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
String skipCount = "a";
|
||||||
}
|
String maxItems = "null";
|
||||||
|
HashMap<String, String> params = new HashMap<String, String>();
|
||||||
try
|
params.put("skipCount", skipCount);
|
||||||
{
|
params.put("maxItems", maxItems);
|
||||||
String skipCount = "a";
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
String maxItems = "null";
|
peopleProxy.getPreferences(person1.getId(), params);
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
fail();
|
||||||
params.put("skipCount", skipCount);
|
}
|
||||||
params.put("maxItems", maxItems);
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.getPreferences(person1.getId(), params);
|
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch (PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
String maxItems = "Red";
|
||||||
}
|
HashMap<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("maxItems", maxItems);
|
||||||
try
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
{
|
peopleProxy.getPreferences(person1.getId(), params);
|
||||||
String maxItems = "Red";
|
fail();
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
}
|
||||||
params.put("maxItems", maxItems);
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.getPreferences(person1.getId(), params);
|
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch (PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
String skipCount = "yuck";
|
||||||
}
|
HashMap<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("skipCount", skipCount);
|
||||||
try
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
{
|
peopleProxy.getPreferences(person1.getId(), params);
|
||||||
String skipCount = "yuck";
|
fail();
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
}
|
||||||
params.put("skipCount", skipCount);
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.getPreferences(person1.getId(), params);
|
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch (PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
String skipCount = "-1";
|
||||||
}
|
HashMap<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("skipCount", skipCount);
|
||||||
try
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
{
|
peopleProxy.getPreferences(person1.getId(), params);
|
||||||
String skipCount = "-1";
|
fail();
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
}
|
||||||
params.put("skipCount", skipCount);
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.getPreferences(person1.getId(), params);
|
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
|
||||||
catch (PublicApiException e)
|
try
|
||||||
{
|
{
|
||||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
String maxItems = "0";
|
||||||
}
|
HashMap<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("maxItems", maxItems);
|
||||||
try
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
||||||
{
|
peopleProxy.getPreferences(person1.getId(), params);
|
||||||
String maxItems = "0";
|
fail();
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
}
|
||||||
params.put("maxItems", maxItems);
|
catch (PublicApiException e)
|
||||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1.getId()));
|
{
|
||||||
peopleProxy.getPreferences(person1.getId(), params);
|
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
||||||
fail();
|
}
|
||||||
}
|
}
|
||||||
catch (PublicApiException e)
|
}
|
||||||
{
|
}
|
||||||
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>23.4.0.67</version>
|
<version>25.1.0.16</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -397,7 +397,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
<artifactId>mybatis</artifactId>
|
<artifactId>mybatis</artifactId>
|
||||||
<version>3.5.16</version>
|
<version>3.5.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
@@ -850,12 +850,12 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<complianceLevel>1.8</complianceLevel>
|
<complianceLevel>17</complianceLevel>
|
||||||
<outxml>false</outxml>
|
<outxml>false</outxml>
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<showWeaveInfo>true</showWeaveInfo>
|
<showWeaveInfo>true</showWeaveInfo>
|
||||||
<source>1.8</source>
|
<source>17</source>
|
||||||
<target>1.8</target>
|
<target>17</target>
|
||||||
<additionalCompilerArgs>
|
<additionalCompilerArgs>
|
||||||
<arg>-parameters</arg>
|
<arg>-parameters</arg>
|
||||||
</additionalCompilerArgs>
|
</additionalCompilerArgs>
|
||||||
|
|||||||
@@ -1,195 +1,199 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.admin;
|
package org.alfresco.repo.admin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Properties;
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.core.LoggerContext;
|
||||||
import org.apache.logging.log4j.core.LoggerContext;
|
import org.apache.logging.log4j.core.config.properties.PropertiesConfiguration;
|
||||||
import org.apache.logging.log4j.core.config.properties.PropertiesConfiguration;
|
import org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder;
|
||||||
import org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
|
||||||
|
/**
|
||||||
/**
|
* Initialises Log4j's HierarchyDynamicMBean (refer to core-services-context.xml) and any overriding log4.properties files. The actual implementation uses introspection to avoid any hard-coded references to Log4J classes. If Log4J is not present, this class will do nothing.
|
||||||
* Initialises Log4j's HierarchyDynamicMBean (refer to core-services-context.xml) and any overriding log4.properties files.
|
* <p>
|
||||||
* The actual implementation uses introspection to avoid any hard-coded references to Log4J classes. If Log4J is
|
* Alfresco modules can provide their own log4j2.properties file, which augments/overrides the global log4j2.properties within the Alfresco webapp. Within the module's source tree, suppose you create:
|
||||||
* not present, this class will do nothing.
|
*
|
||||||
* <p>
|
* <pre>
|
||||||
* Alfresco modules can provide their own log4j2.properties file, which augments/overrides the global log4j2.properties
|
* config/alfresco/module/{module.id}/log4j2.properties
|
||||||
* within the Alfresco webapp. Within the module's source tree, suppose you create:
|
* </pre>
|
||||||
* <pre>
|
*
|
||||||
* config/alfresco/module/{module.id}/log4j2.properties
|
* At deployment time, this log4j2.properties file will be placed in:
|
||||||
* </pre>
|
*
|
||||||
* At deployment time, this log4j2.properties file will be placed in:
|
* <pre>
|
||||||
* <pre>
|
* WEB-INF/classes/alfresco/module/{module.id}/log4j2.properties
|
||||||
* WEB-INF/classes/alfresco/module/{module.id}/log4j2.properties
|
* </pre>
|
||||||
* </pre>
|
*
|
||||||
* Where {module.id} is whatever value is set within the AMP's module.properties file. For details, see: <a
|
* Where {module.id} is whatever value is set within the AMP's module.properties file. For details, see: <a href='http://wiki.alfresco.com/wiki/Developing_an_Alfresco_Module'>Developing an Alfresco Module</a>
|
||||||
* href='http://wiki.alfresco.com/wiki/Developing_an_Alfresco_Module'>Developing an Alfresco Module</a>
|
* <p>
|
||||||
* <p>
|
* For example, if {module.id} is "org.alfresco.module.someModule", then within your source code you'll have:
|
||||||
* For example, if {module.id} is "org.alfresco.module.someModule", then within your source code you'll have:
|
*
|
||||||
*
|
* <pre>
|
||||||
* <pre>
|
* config / alfresco / module / org.alfresco.module.someModule / log4j2.properties
|
||||||
* config / alfresco / module / org.alfresco.module.someModule / log4j2.properties
|
* </pre>
|
||||||
* </pre>
|
* <p>
|
||||||
* <p>
|
* This would be deployed to:
|
||||||
* This would be deployed to:
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* WEB - INF / classes / alfresco / module / org.alfresco.module.someModule / log4j2.properties
|
* WEB - INF / classes / alfresco / module / org.alfresco.module.someModule / log4j2.properties
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class Log4JHierarchyInit implements ApplicationContextAware
|
public class Log4JHierarchyInit implements ApplicationContextAware
|
||||||
{
|
{
|
||||||
private static final Log LOGGER = LogFactory.getLog(Log4JHierarchyInit.class);
|
private static final Log LOGGER = LogFactory.getLog(Log4JHierarchyInit.class);
|
||||||
private final List<String> extraLog4jUrls;
|
private final List<String> extraLog4jUrls;
|
||||||
private ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
private ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||||
|
|
||||||
public Log4JHierarchyInit()
|
static
|
||||||
{
|
{
|
||||||
extraLog4jUrls = new ArrayList<>();
|
System.setProperty("log4j2.disableJmx", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Log4JHierarchyInit()
|
||||||
* Loads a set of augmenting/overriding log4j2.properties files from locations specified via an array of Spring URLS.
|
{
|
||||||
* <p>
|
extraLog4jUrls = new ArrayList<>();
|
||||||
* This function supports Spring's syntax for retrieving multiple class path resources with the same name,
|
}
|
||||||
* via the "classpath*:" prefix. For details, see: {@link PathMatchingResourcePatternResolver}.
|
|
||||||
*/
|
/**
|
||||||
public void setExtraLog4jUrls(List<String> urls)
|
* Loads a set of augmenting/overriding log4j2.properties files from locations specified via an array of Spring URLS.
|
||||||
{
|
* <p>
|
||||||
extraLog4jUrls.addAll(urls);
|
* This function supports Spring's syntax for retrieving multiple class path resources with the same name, via the "classpath*:" prefix. For details, see: {@link PathMatchingResourcePatternResolver}.
|
||||||
}
|
*/
|
||||||
|
public void setExtraLog4jUrls(List<String> urls)
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
{
|
||||||
{
|
extraLog4jUrls.addAll(urls);
|
||||||
this.resolver = applicationContext;
|
}
|
||||||
}
|
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||||
public void init()
|
{
|
||||||
{
|
this.resolver = applicationContext;
|
||||||
importLogSettings();
|
}
|
||||||
}
|
|
||||||
|
public void init()
|
||||||
private void importLogSettings()
|
{
|
||||||
{
|
importLogSettings();
|
||||||
try
|
}
|
||||||
{
|
|
||||||
Properties mainProperties = new Properties();
|
private void importLogSettings()
|
||||||
|
{
|
||||||
importMainLogSettings(mainProperties);
|
try
|
||||||
for (String url : extraLog4jUrls)
|
{
|
||||||
{
|
Properties mainProperties = new Properties();
|
||||||
importLogSettings(url, mainProperties);
|
|
||||||
}
|
importMainLogSettings(mainProperties);
|
||||||
|
for (String url : extraLog4jUrls)
|
||||||
PropertiesConfiguration propertiesConfiguration = new PropertiesConfigurationBuilder()
|
{
|
||||||
.setConfigurationSource(null)
|
importLogSettings(url, mainProperties);
|
||||||
.setRootProperties(mainProperties)
|
}
|
||||||
.setLoggerContext((LoggerContext) LogManager.getContext(false))
|
|
||||||
.build();
|
PropertiesConfiguration propertiesConfiguration = new PropertiesConfigurationBuilder()
|
||||||
|
.setConfigurationSource(null)
|
||||||
propertiesConfiguration.initialize();
|
.setRootProperties(mainProperties)
|
||||||
((LoggerContext) LogManager.getContext(false)).reconfigure(propertiesConfiguration);
|
.setLoggerContext((LoggerContext) LogManager.getContext(false))
|
||||||
}
|
.build();
|
||||||
catch (Throwable t)
|
|
||||||
{
|
propertiesConfiguration.initialize();
|
||||||
if (LOGGER.isDebugEnabled())
|
((LoggerContext) LogManager.getContext(false)).reconfigure(propertiesConfiguration);
|
||||||
{
|
}
|
||||||
LOGGER.debug("Failed to add extra Logger configuration: \n" + " Error: " + t.getMessage(), t);
|
catch (Throwable t)
|
||||||
}
|
{
|
||||||
}
|
if (LOGGER.isDebugEnabled())
|
||||||
|
{
|
||||||
}
|
LOGGER.debug("Failed to add extra Logger configuration: \n" + " Error: " + t.getMessage(), t);
|
||||||
|
}
|
||||||
private static void importMainLogSettings(Properties mainProperties) throws IOException
|
}
|
||||||
{
|
|
||||||
File file = ((LoggerContext) LogManager.getContext()).getConfiguration().getConfigurationSource().getFile();
|
}
|
||||||
if (file != null)
|
|
||||||
{
|
private static void importMainLogSettings(Properties mainProperties) throws IOException
|
||||||
try (FileInputStream fis = new FileInputStream(file))
|
{
|
||||||
{
|
File file = ((LoggerContext) LogManager.getContext()).getConfiguration().getConfigurationSource().getFile();
|
||||||
mainProperties.load(fis);
|
if (file != null)
|
||||||
}
|
{
|
||||||
catch (FileNotFoundException e)
|
try (FileInputStream fis = new FileInputStream(file))
|
||||||
{
|
{
|
||||||
if (LOGGER.isDebugEnabled())
|
mainProperties.load(fis);
|
||||||
{
|
}
|
||||||
LOGGER.debug("Failed to find initial configuration: \n" + " Error: " + e.getMessage(), e);
|
catch (FileNotFoundException e)
|
||||||
}
|
{
|
||||||
}
|
if (LOGGER.isDebugEnabled())
|
||||||
}
|
{
|
||||||
}
|
LOGGER.debug("Failed to find initial configuration: \n" + " Error: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
private void importLogSettings(String springUrl, Properties mainProperties)
|
}
|
||||||
{
|
}
|
||||||
Resource[] resources = null;
|
}
|
||||||
|
|
||||||
try
|
private void importLogSettings(String springUrl, Properties mainProperties)
|
||||||
{
|
{
|
||||||
resources = resolver.getResources(springUrl);
|
Resource[] resources = null;
|
||||||
}
|
|
||||||
catch (Exception e)
|
try
|
||||||
{
|
{
|
||||||
LOGGER.warn("Failed to find additional Logger configuration: " + springUrl);
|
resources = resolver.getResources(springUrl);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
// Read each resource
|
{
|
||||||
for (Resource resource : resources)
|
LOGGER.warn("Failed to find additional Logger configuration: " + springUrl);
|
||||||
{
|
}
|
||||||
try
|
|
||||||
{
|
// Read each resource
|
||||||
InputStream inputStream = resource.getInputStream();
|
for (Resource resource : resources)
|
||||||
Properties properties = new Properties();
|
{
|
||||||
properties.load(inputStream);
|
try
|
||||||
mainProperties.putAll(properties);
|
{
|
||||||
}
|
InputStream inputStream = resource.getInputStream();
|
||||||
catch (Throwable e)
|
Properties properties = new Properties();
|
||||||
{
|
properties.load(inputStream);
|
||||||
if (LOGGER.isDebugEnabled())
|
mainProperties.putAll(properties);
|
||||||
{
|
}
|
||||||
LOGGER.debug("Failed to add extra Logger configuration: \n" + " URL: " + springUrl + "\n"
|
catch (Throwable e)
|
||||||
+ " Error: " + e.getMessage(), e);
|
{
|
||||||
}
|
if (LOGGER.isDebugEnabled())
|
||||||
}
|
{
|
||||||
}
|
LOGGER.debug("Failed to add extra Logger configuration: \n" + " URL: " + springUrl + "\n"
|
||||||
}
|
+ " Error: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,286 +1,282 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.audit;
|
package org.alfresco.repo.audit;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.repo.audit.model.AuditApplication;
|
import org.alfresco.repo.audit.model.AuditApplication;
|
||||||
import org.alfresco.repo.audit.model.AuditModelRegistry;
|
import org.alfresco.repo.audit.model.AuditModelRegistry;
|
||||||
import org.alfresco.repo.audit.model._3.AuditPath;
|
import org.alfresco.repo.audit.model._3.AuditPath;
|
||||||
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
||||||
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The audit component. Used by the AuditService and AuditMethodInterceptor to insert audit entries.
|
* The audit component. Used by the AuditService and AuditMethodInterceptor to insert audit entries.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
public interface AuditComponent
|
public interface AuditComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determines whether audit is globally enabled or disabled.
|
* Determines whether audit is globally enabled or disabled.
|
||||||
*
|
*
|
||||||
* @return Returns <code>true</code> if audit is enabled
|
* @return Returns <code>true</code> if audit is enabled
|
||||||
*
|
*
|
||||||
* @since 3.3
|
* @since 3.3
|
||||||
*/
|
*/
|
||||||
public boolean isAuditEnabled();
|
public boolean isAuditEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch auditing on or off
|
* Switch auditing on or off
|
||||||
*
|
*
|
||||||
* @param enable <tt>true</tt> to enable auditing or <tt>false</tt> to disable
|
* @param enable
|
||||||
*
|
* <tt>true</tt> to enable auditing or <tt>false</tt> to disable
|
||||||
* @since 3.4
|
*
|
||||||
*/
|
* @since 3.4
|
||||||
public void setAuditEnabled(boolean enable);
|
*/
|
||||||
|
public void setAuditEnabled(boolean enable);
|
||||||
/**
|
|
||||||
* @param userAuditFilter UserAuditFilter
|
/**
|
||||||
*
|
* @param userAuditFilter
|
||||||
* @since 4.2
|
* UserAuditFilter
|
||||||
*/
|
*
|
||||||
public void setUserAuditFilter(UserAuditFilter userAuditFilter);
|
* @since 4.2
|
||||||
|
*/
|
||||||
/**
|
public void setUserAuditFilter(UserAuditFilter userAuditFilter);
|
||||||
* Get all registered audit applications, whether active or not.
|
|
||||||
*
|
/**
|
||||||
* @return Returns a map of registered audit applications keyed by name
|
* Get all registered audit applications, whether active or not.
|
||||||
*
|
*
|
||||||
* @since 3.4
|
* @return Returns a map of registered audit applications keyed by name
|
||||||
*/
|
*
|
||||||
public Map<String, AuditApplication> getAuditApplications();
|
* @since 3.4
|
||||||
|
*/
|
||||||
/**
|
public Map<String, AuditApplication> getAuditApplications();
|
||||||
* Determine whether the audit infrastructure expects audit values to be passed in.
|
|
||||||
* This is a helper method to allow optimizations in the client code. Reasons why
|
/**
|
||||||
* this method might return <tt>false</tt> are: auditing is disabled; no audit applications
|
* Determine whether the audit infrastructure expects audit values to be passed in. This is a helper method to allow optimizations in the client code. Reasons why this method might return <tt>false</tt> are: auditing is disabled; no audit applications have been registered. Sometimes, depending on the log level, this method may always return <tt>true</tt>.
|
||||||
* have been registered. Sometimes, depending on the log level, this method may always
|
*
|
||||||
* return <tt>true</tt>.
|
*
|
||||||
*
|
* @return Returns <code>true</code> if the calling code (data producers) should go ahead and generate the data for {@link #recordAuditValues(String, Map) recording}.
|
||||||
*
|
*
|
||||||
* @return Returns <code>true</code> if the calling code (data producers)
|
* @since 3.3
|
||||||
* should go ahead and generate the data for
|
*/
|
||||||
* {@link #recordAuditValues(String, Map) recording}.
|
public boolean areAuditValuesRequired();
|
||||||
*
|
|
||||||
* @since 3.3
|
/**
|
||||||
*/
|
* Determines if audit values are required based on whether there are any audit applications registered to record data for the given path. This helper method gives data producers a shortcut in the event that nothing would be recorded in any event.
|
||||||
public boolean areAuditValuesRequired();
|
*
|
||||||
|
* @param path
|
||||||
/**
|
* the audit path
|
||||||
* Determines if audit values are required based on whether there are any audit applications
|
* @return Returns <tt>true</tt> if there is at least one audit application registered to handle the given path.
|
||||||
* registered to record data for the given path. This helper method gives data producers a
|
*
|
||||||
* shortcut in the event that nothing would be recorded in any event.
|
* @since 3.4
|
||||||
*
|
*/
|
||||||
* @param path the audit path
|
public boolean areAuditValuesRequired(String path);
|
||||||
* @return Returns <tt>true</tt> if there is at least one audit application
|
|
||||||
* registered to handle the given path.
|
/**
|
||||||
*
|
* Delete audit entries for the given application and time range
|
||||||
* @since 3.4
|
*
|
||||||
*/
|
* @param applicationName
|
||||||
public boolean areAuditValuesRequired(String path);
|
* the name of the application
|
||||||
|
* @param fromTime
|
||||||
/**
|
* the start time of entries to remove (inclusive and optional)
|
||||||
* Delete audit entries for the given application and time range
|
* @param toTime
|
||||||
*
|
* the end time of entries to remove (exclusive and optional)
|
||||||
* @param applicationName the name of the application
|
* @return Returns the number of entries deleted
|
||||||
* @param fromTime the start time of entries to remove (inclusive and optional)
|
*
|
||||||
* @param toTime the end time of entries to remove (exclusive and optional)
|
* @since 3.2
|
||||||
* @return Returns the number of entries deleted
|
*/
|
||||||
*
|
int deleteAuditEntries(String applicationName, Long fromTime, Long toTime);
|
||||||
* @since 3.2
|
|
||||||
*/
|
/**
|
||||||
int deleteAuditEntries(String applicationName, Long fromTime, Long toTime);
|
* Delete audit entries for the given application and id range
|
||||||
|
*
|
||||||
/**
|
* @param applicationName
|
||||||
* Delete audit entries for the given application and id range
|
* the name of the application
|
||||||
*
|
* @param fromId
|
||||||
* @param applicationName the name of the application
|
* the start time of entries to remove (inclusive and optional)
|
||||||
* @param fromId the start time of entries to remove (inclusive and optional)
|
* @param toId
|
||||||
* @param toId the end time of entries to remove (exclusive and optional)
|
* the end time of entries to remove (exclusive and optional)
|
||||||
* @return Returns the number of entries deleted
|
* @return Returns the number of entries deleted
|
||||||
*
|
*
|
||||||
* @since 5.2.2
|
* @since 5.2.2
|
||||||
*/
|
*/
|
||||||
int deleteAuditEntriesByIdRange(String applicationName, Long fromId, Long toId);
|
int deleteAuditEntriesByIdRange(String applicationName, Long fromId, Long toId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a discrete list of audit entries based on ID
|
* Delete a discrete list of audit entries based on ID
|
||||||
*
|
*
|
||||||
* @param auditEntryIds the audit entry IDs to delete
|
* @param auditEntryIds
|
||||||
* @return Returns the number of entries deleted
|
* the audit entry IDs to delete
|
||||||
*/
|
* @return Returns the number of entries deleted
|
||||||
int deleteAuditEntries(List<Long> auditEntryIds);
|
*/
|
||||||
|
int deleteAuditEntries(List<Long> auditEntryIds);
|
||||||
/**
|
|
||||||
* Check if an audit path is enabled. The path will be disabled if it or any higher
|
/**
|
||||||
* path has been explicitly disabled. Any disabled path will not be processed when
|
* Check if an audit path is enabled. The path will be disabled if it or any higher path has been explicitly disabled. Any disabled path will not be processed when data is audited.
|
||||||
* data is audited.
|
*
|
||||||
*
|
* @param applicationName
|
||||||
* @param applicationName the name of the application being logged to
|
* the name of the application being logged to
|
||||||
* @param path the audit path to check or <tt>null</tt> to assume the
|
* @param path
|
||||||
* application's root path
|
* the audit path to check or <tt>null</tt> to assume the application's root path
|
||||||
* @return Returns <tt>true</tt> if the audit path has been disabled
|
* @return Returns <tt>true</tt> if the audit path has been disabled
|
||||||
*
|
*
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
boolean isAuditPathEnabled(String applicationName, String path);
|
boolean isAuditPathEnabled(String applicationName, String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable auditing (if it is not already enabled) for all paths that contain the given path.
|
* Enable auditing (if it is not already enabled) for all paths that contain the given path. The path is the path as originally logged and not the path that the generated data may contain - although this would be similarly enabled.
|
||||||
* The path is the path as originally logged and
|
* <p>
|
||||||
* not the path that the generated data may contain - although this would be similarly
|
* If the enabled
|
||||||
* enabled.
|
*
|
||||||
* <p>
|
* @param applicationName
|
||||||
* If the enabled
|
* the name of the application being logged to
|
||||||
*
|
* @param path
|
||||||
* @param applicationName the name of the application being logged to
|
* the audit path to check or <tt>null</tt> to assume the application's root path
|
||||||
* @param path the audit path to check or <tt>null</tt> to assume the
|
*
|
||||||
* application's root path
|
* @since 3.2
|
||||||
*
|
*/
|
||||||
* @since 3.2
|
void enableAudit(String applicationName, String path);
|
||||||
*/
|
|
||||||
void enableAudit(String applicationName, String path);
|
/**
|
||||||
|
* Disable auditing (if it is not already disabled) for all paths that contain the given path. The path is the path as originally logged and not the path that the generated data may contain - although this would be similarly disabled.
|
||||||
/**
|
* <p>
|
||||||
* Disable auditing (if it is not already disabled) for all paths that contain the given path.
|
* If the path is <b>/x/y</b> then any data paths that start with <b>/x/y</b> will be stripped out <u>before</u> data generators and data recorders are applied. If the path represents the root path of the application, then auditing for that application is effectively disabled.
|
||||||
* The path is the path as originally logged and
|
*
|
||||||
* not the path that the generated data may contain - although this would be similarly
|
* @param applicationName
|
||||||
* disabled.
|
* the name of the application being logged to
|
||||||
* <p>
|
* @param path
|
||||||
* If the path is <b>/x/y</b> then any data paths that start with <b>/x/y</b> will be stripped
|
* the audit path to check or <tt>null</tt> to assume the application's root path
|
||||||
* out <u>before</u> data generators and data recorders are applied. If the path represents
|
*
|
||||||
* the root path of the application, then auditing for that application is effectively disabled.
|
* @since 3.2
|
||||||
*
|
*/
|
||||||
* @param applicationName the name of the application being logged to
|
void disableAudit(String applicationName, String path);
|
||||||
* @param path the audit path to check or <tt>null</tt> to assume the
|
|
||||||
* application's root path
|
/**
|
||||||
*
|
* Remove all disabled paths i.e. enable all per-path based auditing. Auditing may still be disabled globally. This is primarily for test purposes; applications should know which paths need {@link #enableAudit(String, String) enabling} or {@link #disableAudit(String, String) disabled}.
|
||||||
* @since 3.2
|
*
|
||||||
*/
|
* @param applicationName
|
||||||
void disableAudit(String applicationName, String path);
|
* the name of the application
|
||||||
|
*
|
||||||
/**
|
* @since 3.2
|
||||||
* Remove all disabled paths i.e. enable all per-path based auditing. Auditing may still be
|
*/
|
||||||
* disabled globally. This is primarily for test purposes; applications should know which
|
void resetDisabledPaths(String applicationName);
|
||||||
* paths need {@link #enableAudit(String, String) enabling} or
|
|
||||||
* {@link #disableAudit(String, String) disabled}.
|
/**
|
||||||
*
|
* Create an audit entry for the given map of values. The map key is a path - starting with '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR}) - relative to the root path provided.
|
||||||
* @param applicationName the name of the application
|
* <p/>
|
||||||
*
|
* The root path and value keys are combined to produce a map of data keyed by full path. This fully-pathed map is then passed through the {@link AuditModelRegistry#getAuditPathMapper() audit path mapper}. The result may yield data destined for several different {@link AuditModelRegistry#getAuditApplicationByKey(String) audit applications}. depending on the data extraction and generation defined in the applications, values (or derived values) may be recorded against several audit entries (one per application represented).
|
||||||
* @since 3.2
|
* <p/>
|
||||||
*/
|
* The return values reflect what was actually persisted and is controlled by the data extractors defined in the audit configuration.
|
||||||
void resetDisabledPaths(String applicationName);
|
* <p/>
|
||||||
|
* A new read-write transaction is started if there are values to write that there is not a viable transaction present.
|
||||||
/**
|
*
|
||||||
* Create an audit entry for the given map of values. The map key is a path - starting with '/'
|
* @param rootPath
|
||||||
* ({@link AuditApplication#AUDIT_PATH_SEPARATOR}) - relative to the root path provided.
|
* a base path of {@link AuditPath} key entries concatenated with the path separator '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR})
|
||||||
* <p/>
|
* @param values
|
||||||
* The root path and value keys are combined to produce a map of data keyed by full path. This
|
* the values to audit mapped by {@link AuditPath} key relative to root path (may be <tt>null</tt>)
|
||||||
* fully-pathed map is then passed through the
|
* @return Returns the values that were actually persisted, keyed by their full path.
|
||||||
* {@link AuditModelRegistry#getAuditPathMapper() audit path mapper}. The result may yield data
|
* @throws IllegalStateException
|
||||||
* destined for several different
|
* if the transaction state could not be determined
|
||||||
* {@link AuditModelRegistry#getAuditApplicationByKey(String) audit applications}. depending on
|
*
|
||||||
* the data extraction and generation defined in the applications, values (or derived values) may
|
* @since 3.2
|
||||||
* be recorded against several audit entries (one per application represented).
|
*/
|
||||||
* <p/>
|
Map<String, Serializable> recordAuditValues(String rootPath, Map<String, Serializable> values);
|
||||||
* The return values reflect what was actually persisted and is controlled by the data extractors
|
|
||||||
* defined in the audit configuration.
|
/**
|
||||||
* <p/>
|
* The same as {@link AuditComponent#recordAuditValues(String, Map)}, but with controlled usage of userFilter
|
||||||
* A new read-write transaction is started if there are values to write that there is not a viable
|
*
|
||||||
* transaction present.
|
* @param rootPath
|
||||||
*
|
* a base path of {@link AuditPath} key entries concatenated with the path separator '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR})
|
||||||
* @param rootPath a base path of {@link AuditPath} key entries concatenated with the path separator
|
* @param values
|
||||||
* '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR})
|
* the values to audit mapped by {@link AuditPath} key relative to root path (may be <tt>null</tt>)
|
||||||
* @param values the values to audit mapped by {@link AuditPath} key relative to root path
|
* @param useUserFilter
|
||||||
* (may be <tt>null</tt>)
|
* if <tt>false</tt> the user filter is disabled.
|
||||||
* @return Returns the values that were actually persisted, keyed by their full path.
|
* @return Returns the values that were actually persisted, keyed by their full path.
|
||||||
* @throws IllegalStateException if the transaction state could not be determined
|
* @throws IllegalStateException
|
||||||
*
|
* if the transaction state could not be determined
|
||||||
* @since 3.2
|
*/
|
||||||
*/
|
Map<String, Serializable> recordAuditValuesWithUserFilter(String rootPath, Map<String, Serializable> values, boolean useUserFilter);
|
||||||
Map<String, Serializable> recordAuditValues(String rootPath, Map<String, Serializable> values);
|
|
||||||
|
/**
|
||||||
/**
|
* Find audit entries using the given parameters
|
||||||
* The same as {@link AuditComponent#recordAuditValues(String, Map)}, but with controlled usage of userFilter
|
*
|
||||||
*
|
* @param callback
|
||||||
* @param rootPath a base path of {@link AuditPath} key entries concatenated with the path separator
|
* the data callback per entry
|
||||||
* '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR})
|
* @param parameters
|
||||||
* @param values the values to audit mapped by {@link AuditPath} key relative to root path
|
* the parameters for the query (may not be <tt>null</tt>)
|
||||||
* (may be <tt>null</tt>)
|
* @param maxResults
|
||||||
* @param useUserFilter if <tt>false</tt> the user filter is disabled.
|
* the maximum number of results to retrieve (must be greater than 0)
|
||||||
* @return Returns the values that were actually persisted, keyed by their full path.
|
*
|
||||||
* @throws IllegalStateException if the transaction state could not be determined
|
* @throws IllegalArgumentException
|
||||||
*/
|
* if maxResults less or equal to zero
|
||||||
Map<String, Serializable> recordAuditValuesWithUserFilter(String rootPath, Map<String, Serializable> values, boolean useUserFilter);
|
*
|
||||||
|
* @since 3.2
|
||||||
/**
|
*/
|
||||||
* Find audit entries using the given parameters
|
void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults);
|
||||||
*
|
|
||||||
* @param callback the data callback per entry
|
/**
|
||||||
* @param parameters the parameters for the query (may not be <tt>null</tt>)
|
* Issue an audit query to retrieve min / max audit record id for a given application.
|
||||||
* @param maxResults the maximum number of results to retrieve (must be greater than 0)
|
*
|
||||||
*
|
* @param applicationName
|
||||||
* @throws IllegalArgumentException if maxResults less or equal to zero
|
* the name of the application
|
||||||
*
|
* @param extremes
|
||||||
* @since 3.2
|
* a list containing min/max or both
|
||||||
*/
|
* @return a map containing min/max and the associated value
|
||||||
void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults);
|
*/
|
||||||
|
HashMap<String, Long> getAuditMinMaxByApp(String applicationName, List<String> extremes);
|
||||||
/**
|
|
||||||
* Issue an audit query to retrieve min / max audit record id for a given application.
|
/**
|
||||||
*
|
* Issue an audit query to retrieve count of records for a given application.
|
||||||
* @param applicationName the name of the application
|
*
|
||||||
* @param extremes a list containing min/max or both
|
* @param applicationName
|
||||||
* @return a map containing min/max and the associated value
|
* the name of the application
|
||||||
*/
|
* @return a map containing min/max and the associated value
|
||||||
HashMap<String, Long> getAuditMinMaxByApp(String applicationName, List<String> extremes);
|
*/
|
||||||
|
default int getAuditEntriesCountByApp(String applicationName)
|
||||||
/**
|
{
|
||||||
* Issue an audit query to retrieve count of records for a given application.
|
return -1;
|
||||||
*
|
}
|
||||||
* @param applicationName the name of the application
|
|
||||||
* @return a map containing min/max and the associated value
|
/**
|
||||||
*/
|
* Issue an audit query to retrieve count of records for a given application and properties
|
||||||
default int getAuditEntriesCountByApp(String applicationName)
|
*
|
||||||
{
|
* @param applicationName
|
||||||
return -1;
|
* the name of the application
|
||||||
}
|
* @param parameters
|
||||||
|
* audit parameters provided by the <code>where</code> clause on the ReST API
|
||||||
/**
|
* @return a map containing min/max and the associated value
|
||||||
* Issue an audit query to retrieve count of records for a given application and properties
|
*/
|
||||||
*
|
default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
||||||
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
{
|
||||||
* @return a map containing min/max and the associated value
|
return -1;
|
||||||
*/
|
}
|
||||||
default int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
}
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,197 +1,210 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.audit;
|
package org.alfresco.repo.audit;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
||||||
import org.alfresco.service.cmr.audit.AuditService;
|
import org.alfresco.service.cmr.audit.AuditService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The implementation of the AuditService for application auditing.
|
* The implementation of the AuditService for application auditing.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public class AuditServiceImpl implements AuditService
|
public class AuditServiceImpl implements AuditService
|
||||||
{
|
{
|
||||||
private AuditComponent auditComponent;
|
private AuditComponent auditComponent;
|
||||||
|
|
||||||
public AuditServiceImpl()
|
public AuditServiceImpl()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuditComponent(AuditComponent auditComponent)
|
public void setAuditComponent(AuditComponent auditComponent)
|
||||||
{
|
{
|
||||||
this.auditComponent = auditComponent;
|
this.auditComponent = auditComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.4
|
*
|
||||||
*/
|
* @since 3.4
|
||||||
public boolean isAuditEnabled()
|
*/
|
||||||
{
|
public boolean isAuditEnabled()
|
||||||
return auditComponent.isAuditEnabled();
|
{
|
||||||
}
|
return auditComponent.isAuditEnabled();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
/**
|
||||||
* @since 3.4
|
* {@inheritDoc}
|
||||||
*/
|
*
|
||||||
@Override
|
* @since 3.4
|
||||||
public void setAuditEnabled(boolean enable)
|
*/
|
||||||
{
|
@Override
|
||||||
auditComponent.setAuditEnabled(enable);
|
public void setAuditEnabled(boolean enable)
|
||||||
}
|
{
|
||||||
|
auditComponent.setAuditEnabled(enable);
|
||||||
/**
|
}
|
||||||
* {@inheritDoc}
|
|
||||||
* @since 3.4
|
/**
|
||||||
*/
|
* {@inheritDoc}
|
||||||
@Override
|
*
|
||||||
public Map<String, AuditApplication> getAuditApplications()
|
* @since 3.4
|
||||||
{
|
*/
|
||||||
Map<String, org.alfresco.repo.audit.model.AuditApplication> apps = auditComponent.getAuditApplications();
|
@Override
|
||||||
|
public Map<String, AuditApplication> getAuditApplications()
|
||||||
Map<String, AuditApplication> ret = new TreeMap<String, AuditApplication>();
|
{
|
||||||
for (String app : apps.keySet())
|
Map<String, org.alfresco.repo.audit.model.AuditApplication> apps = auditComponent.getAuditApplications();
|
||||||
{
|
|
||||||
String name = app;
|
Map<String, AuditApplication> ret = new TreeMap<String, AuditApplication>();
|
||||||
String key = org.alfresco.repo.audit.model.AuditApplication.AUDIT_PATH_SEPARATOR + apps.get(app).getApplicationKey();
|
for (String app : apps.keySet())
|
||||||
boolean enabled = auditComponent.isAuditPathEnabled(app, key);
|
{
|
||||||
AuditApplication auditApplication = new AuditApplication(name, key, enabled);
|
String name = app;
|
||||||
ret.put(name, auditApplication);
|
String key = org.alfresco.repo.audit.model.AuditApplication.AUDIT_PATH_SEPARATOR + apps.get(app).getApplicationKey();
|
||||||
}
|
boolean enabled = auditComponent.isAuditPathEnabled(app, key);
|
||||||
return ret;
|
AuditApplication auditApplication = new AuditApplication(name, key, enabled);
|
||||||
}
|
ret.put(name, auditApplication);
|
||||||
|
}
|
||||||
/**
|
return ret;
|
||||||
* {@inheritDoc}
|
}
|
||||||
* @since 3.2
|
|
||||||
*/
|
/**
|
||||||
public boolean isAuditEnabled(String applicationName, String path)
|
* {@inheritDoc}
|
||||||
{
|
*
|
||||||
return auditComponent.isAuditPathEnabled(applicationName, path);
|
* @since 3.2
|
||||||
}
|
*/
|
||||||
|
public boolean isAuditEnabled(String applicationName, String path)
|
||||||
/**
|
{
|
||||||
* {@inheritDoc}
|
return auditComponent.isAuditPathEnabled(applicationName, path);
|
||||||
* @since 3.2
|
}
|
||||||
*/
|
|
||||||
public void enableAudit(String applicationName, String path)
|
/**
|
||||||
{
|
* {@inheritDoc}
|
||||||
auditComponent.enableAudit(applicationName, path);
|
*
|
||||||
}
|
* @since 3.2
|
||||||
|
*/
|
||||||
/**
|
public void enableAudit(String applicationName, String path)
|
||||||
* {@inheritDoc}
|
{
|
||||||
* @since 3.2
|
auditComponent.enableAudit(applicationName, path);
|
||||||
*/
|
}
|
||||||
public void disableAudit(String applicationName, String path)
|
|
||||||
{
|
/**
|
||||||
auditComponent.disableAudit(applicationName, path);
|
* {@inheritDoc}
|
||||||
}
|
*
|
||||||
|
* @since 3.2
|
||||||
/**
|
*/
|
||||||
* {@inheritDoc}
|
public void disableAudit(String applicationName, String path)
|
||||||
* @since 3.2
|
{
|
||||||
*/
|
auditComponent.disableAudit(applicationName, path);
|
||||||
public int clearAudit(String applicationName)
|
}
|
||||||
{
|
|
||||||
Long now = Long.valueOf(System.currentTimeMillis());
|
/**
|
||||||
return auditComponent.deleteAuditEntries(applicationName, null, now);
|
* {@inheritDoc}
|
||||||
}
|
*
|
||||||
|
* @since 3.2
|
||||||
/**
|
*/
|
||||||
* {@inheritDoc}
|
public int clearAudit(String applicationName)
|
||||||
* @since 3.4
|
{
|
||||||
*/
|
Long now = Long.valueOf(System.currentTimeMillis());
|
||||||
@Override
|
return auditComponent.deleteAuditEntries(applicationName, null, now);
|
||||||
public int clearAudit(String applicationName, Long fromTime, Long toTime)
|
}
|
||||||
{
|
|
||||||
toTime = (toTime == null) ? Long.valueOf(System.currentTimeMillis()) : toTime;
|
/**
|
||||||
return auditComponent.deleteAuditEntries(applicationName, fromTime, toTime);
|
* {@inheritDoc}
|
||||||
}
|
*
|
||||||
|
* @since 3.4
|
||||||
/**
|
*/
|
||||||
* {@inheritDoc}
|
@Override
|
||||||
* @since 5.2.2
|
public int clearAudit(String applicationName, Long fromTime, Long toTime)
|
||||||
*/
|
{
|
||||||
@Override
|
toTime = (toTime == null) ? Long.valueOf(System.currentTimeMillis()) : toTime;
|
||||||
public int clearAuditByIdRange(String applicationName, Long fromId, Long toId)
|
return auditComponent.deleteAuditEntries(applicationName, fromTime, toTime);
|
||||||
{
|
}
|
||||||
return auditComponent.deleteAuditEntriesByIdRange(applicationName, fromId, toId);
|
|
||||||
}
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
/**
|
*
|
||||||
* {@inheritDoc}
|
* @since 5.2.2
|
||||||
* @since 3.4
|
*/
|
||||||
*/
|
@Override
|
||||||
@Override
|
public int clearAuditByIdRange(String applicationName, Long fromId, Long toId)
|
||||||
public int clearAudit(List<Long> auditEntryIds)
|
{
|
||||||
{
|
return auditComponent.deleteAuditEntriesByIdRange(applicationName, fromId, toId);
|
||||||
return auditComponent.deleteAuditEntries(auditEntryIds);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* {@inheritDoc}
|
||||||
* {@inheritDoc}
|
*
|
||||||
* @since 3.3
|
* @since 3.4
|
||||||
*/
|
*/
|
||||||
public void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
|
@Override
|
||||||
{
|
public int clearAudit(List<Long> auditEntryIds)
|
||||||
auditComponent.auditQuery(callback, parameters, maxResults);
|
{
|
||||||
}
|
return auditComponent.deleteAuditEntries(auditEntryIds);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
/**
|
||||||
*/
|
* {@inheritDoc}
|
||||||
public HashMap<String, Long> getAuditMinMaxByApp(String applicationName, List<String> extremes)
|
*
|
||||||
{
|
* @since 3.3
|
||||||
return auditComponent.getAuditMinMaxByApp(applicationName, extremes);
|
*/
|
||||||
}
|
public void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
|
||||||
|
{
|
||||||
/**
|
auditComponent.auditQuery(callback, parameters, maxResults);
|
||||||
* {@inheritDoc}
|
}
|
||||||
*/
|
|
||||||
@Override
|
/**
|
||||||
public int getAuditEntriesCountByApp(String applicationName)
|
* {@inheritDoc}
|
||||||
{
|
*/
|
||||||
return auditComponent.getAuditEntriesCountByApp(applicationName);
|
public HashMap<String, Long> getAuditMinMaxByApp(String applicationName, List<String> extremes)
|
||||||
}
|
{
|
||||||
|
return auditComponent.getAuditMinMaxByApp(applicationName, extremes);
|
||||||
/**
|
}
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
/**
|
||||||
@Override public int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
* {@inheritDoc}
|
||||||
{
|
*/
|
||||||
return auditComponent.getAuditEntriesCountByAppAndProperties(parameters);
|
@Override
|
||||||
}
|
public int getAuditEntriesCountByApp(String applicationName)
|
||||||
}
|
{
|
||||||
|
return auditComponent.getAuditEntriesCountByApp(applicationName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
||||||
|
{
|
||||||
|
return auditComponent.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,493 +1,484 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.content;
|
package org.alfresco.repo.content;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.apache.commons.logging.Log;
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.repo.cache.SimpleCache;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.apache.commons.logging.Log;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.alfresco.util.GUID;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
/**
|
|
||||||
* A store providing support for content store implementations that provide
|
/**
|
||||||
* routing of content read and write requests based on context.
|
* A store providing support for content store implementations that provide routing of content read and write requests based on context.
|
||||||
*
|
*
|
||||||
* @see ContentContext
|
* @see ContentContext
|
||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractRoutingContentStore implements ContentStore
|
public abstract class AbstractRoutingContentStore implements ContentStore
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(AbstractRoutingContentStore.class);
|
private static Log logger = LogFactory.getLog(AbstractRoutingContentStore.class);
|
||||||
|
|
||||||
private String instanceKey = GUID.generate();
|
private String instanceKey = GUID.generate();
|
||||||
private SimpleCache<Pair<String, String>, ContentStore> storesByContentUrl;
|
private SimpleCache<Pair<String, String>, ContentStore> storesByContentUrl;
|
||||||
private ReadLock storesCacheReadLock;
|
private ReadLock storesCacheReadLock;
|
||||||
private WriteLock storesCacheWriteLock;
|
private WriteLock storesCacheWriteLock;
|
||||||
|
|
||||||
protected AbstractRoutingContentStore()
|
protected AbstractRoutingContentStore()
|
||||||
{
|
{
|
||||||
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
storesCacheReadLock = lock.readLock();
|
storesCacheReadLock = lock.readLock();
|
||||||
storesCacheWriteLock = lock.writeLock();
|
storesCacheWriteLock = lock.writeLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param storesCache cache of stores used to access URLs
|
* @param storesCache
|
||||||
*/
|
* cache of stores used to access URLs
|
||||||
public void setStoresCache(SimpleCache<Pair<String, String>, ContentStore> storesCache)
|
*/
|
||||||
{
|
public void setStoresCache(SimpleCache<Pair<String, String>, ContentStore> storesCache)
|
||||||
this.storesByContentUrl = storesCache;
|
{
|
||||||
}
|
this.storesByContentUrl = storesCache;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return Returns a list of all possible stores available for reading or writing
|
/**
|
||||||
*/
|
* @return Returns a list of all possible stores available for reading or writing
|
||||||
protected abstract List<ContentStore> getAllStores();
|
*/
|
||||||
|
protected abstract List<ContentStore> getAllStores();
|
||||||
/**
|
|
||||||
* Get a content store based on the context provided. The applicability of the
|
/**
|
||||||
* context and even the types of context allowed are up to the implementation, but
|
* Get a content store based on the context provided. The applicability of the context and even the types of context allowed are up to the implementation, but normally there should be a fallback case for when the parameters are not adequate to make a decision.
|
||||||
* normally there should be a fallback case for when the parameters are not adequate
|
*
|
||||||
* to make a decision.
|
* @param ctx
|
||||||
*
|
* the context to use to make the choice
|
||||||
* @param ctx the context to use to make the choice
|
* @return Returns the store most appropriate for the given context and <b>never <tt>null</tt></b>
|
||||||
* @return Returns the store most appropriate for the given context and
|
*/
|
||||||
* <b>never <tt>null</tt></b>
|
protected abstract ContentStore selectWriteStore(ContentContext ctx);
|
||||||
*/
|
|
||||||
protected abstract ContentStore selectWriteStore(ContentContext ctx);
|
/**
|
||||||
|
* Checks the cache for the store and ensures that the URL is in the store.
|
||||||
/**
|
*
|
||||||
* Checks the cache for the store and ensures that the URL is in the store.
|
* @param contentUrl
|
||||||
*
|
* the content URL to search for
|
||||||
* @param contentUrl the content URL to search for
|
* @return Returns the store matching the content URL
|
||||||
* @return Returns the store matching the content URL
|
*/
|
||||||
*/
|
private ContentStore selectReadStore(String contentUrl)
|
||||||
private ContentStore selectReadStore(String contentUrl)
|
{
|
||||||
{
|
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
||||||
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
storesCacheReadLock.lock();
|
||||||
storesCacheReadLock.lock();
|
try
|
||||||
try
|
{
|
||||||
{
|
// Check if the store is in the cache
|
||||||
// Check if the store is in the cache
|
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
if (store != null)
|
||||||
if (store != null)
|
{
|
||||||
{
|
// We found a store that was previously used
|
||||||
// We found a store that was previously used
|
try
|
||||||
try
|
{
|
||||||
{
|
// It is possible for content to be removed from a store and
|
||||||
// It is possible for content to be removed from a store and
|
// it might have moved into another store.
|
||||||
// it might have moved into another store.
|
if (store.exists(contentUrl))
|
||||||
if (store.exists(contentUrl))
|
{
|
||||||
{
|
// We found a store and can use it
|
||||||
// We found a store and can use it
|
return store;
|
||||||
return store;
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (UnsupportedContentUrlException e)
|
||||||
catch (UnsupportedContentUrlException e)
|
{
|
||||||
{
|
// This is odd. The store that previously supported the content URL
|
||||||
// This is odd. The store that previously supported the content URL
|
// no longer does so. I can't think of a reason why that would be.
|
||||||
// no longer does so. I can't think of a reason why that would be.
|
throw new AlfrescoRuntimeException(
|
||||||
throw new AlfrescoRuntimeException(
|
"Found a content store that previously supported a URL, but no longer does: \n" +
|
||||||
"Found a content store that previously supported a URL, but no longer does: \n" +
|
" Store: " + store + "\n" +
|
||||||
" Store: " + store + "\n" +
|
" Content URL: " + contentUrl);
|
||||||
" Content URL: " + contentUrl);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
finally
|
||||||
finally
|
{
|
||||||
{
|
storesCacheReadLock.unlock();
|
||||||
storesCacheReadLock.unlock();
|
}
|
||||||
}
|
// Get the write lock and double check
|
||||||
// Get the write lock and double check
|
storesCacheWriteLock.lock();
|
||||||
storesCacheWriteLock.lock();
|
try
|
||||||
try
|
{
|
||||||
{
|
// Double check
|
||||||
// Double check
|
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
if (store != null && store.exists(contentUrl))
|
||||||
if (store != null && store.exists(contentUrl))
|
{
|
||||||
{
|
// We found a store and can use it
|
||||||
// We found a store and can use it
|
if (logger.isDebugEnabled())
|
||||||
if (logger.isDebugEnabled())
|
{
|
||||||
{
|
logger.debug(
|
||||||
logger.debug(
|
"Found mapped store for content URL: \n" +
|
||||||
"Found mapped store for content URL: \n" +
|
" Content URL: " + contentUrl + "\n" +
|
||||||
" Content URL: " + contentUrl + "\n" +
|
" Store: " + store);
|
||||||
" Store: " + store);
|
}
|
||||||
}
|
return store;
|
||||||
return store;
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
store = null;
|
||||||
store = null;
|
}
|
||||||
}
|
// It isn't, so search all the stores
|
||||||
// It isn't, so search all the stores
|
List<ContentStore> stores = getAllStores();
|
||||||
List<ContentStore> stores = getAllStores();
|
// Keep track of the unsupported state of the content URL - it might be a rubbish URL
|
||||||
// Keep track of the unsupported state of the content URL - it might be a rubbish URL
|
boolean contentUrlSupported = false;
|
||||||
boolean contentUrlSupported = false;
|
for (ContentStore storeInList : stores)
|
||||||
for (ContentStore storeInList : stores)
|
{
|
||||||
{
|
boolean exists = false;
|
||||||
boolean exists = false;
|
try
|
||||||
try
|
{
|
||||||
{
|
exists = storeInList.exists(contentUrl);
|
||||||
exists = storeInList.exists(contentUrl);
|
// At least the content URL was supported
|
||||||
// At least the content URL was supported
|
contentUrlSupported = true;
|
||||||
contentUrlSupported = true;
|
}
|
||||||
}
|
catch (UnsupportedContentUrlException e)
|
||||||
catch (UnsupportedContentUrlException e)
|
{
|
||||||
{
|
// The store can't handle the content URL
|
||||||
// The store can't handle the content URL
|
}
|
||||||
}
|
if (!exists)
|
||||||
if (!exists)
|
{
|
||||||
{
|
// It is not in the store
|
||||||
// It is not in the store
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
// We found one
|
||||||
// We found one
|
store = storeInList;
|
||||||
store = storeInList;
|
// Put the value in the cache
|
||||||
// Put the value in the cache
|
storesByContentUrl.put(cacheKey, store);
|
||||||
storesByContentUrl.put(cacheKey, store);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
// Check if the content URL was supported
|
||||||
// Check if the content URL was supported
|
if (!contentUrlSupported)
|
||||||
if (!contentUrlSupported)
|
{
|
||||||
{
|
throw new UnsupportedContentUrlException(this, contentUrl);
|
||||||
throw new UnsupportedContentUrlException(this, contentUrl);
|
}
|
||||||
}
|
// Done
|
||||||
// Done
|
if (logger.isDebugEnabled())
|
||||||
if (logger.isDebugEnabled())
|
{
|
||||||
{
|
logger.debug(
|
||||||
logger.debug(
|
"Mapped content URL to store for reading: \n" +
|
||||||
"Mapped content URL to store for reading: \n" +
|
" Content URL: " + contentUrl + "\n" +
|
||||||
" Content URL: " + contentUrl + "\n" +
|
" Store: " + store);
|
||||||
" Store: " + store);
|
}
|
||||||
}
|
return store;
|
||||||
return store;
|
}
|
||||||
}
|
finally
|
||||||
finally
|
{
|
||||||
{
|
storesCacheWriteLock.unlock();
|
||||||
storesCacheWriteLock.unlock();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns <tt>true</tt> if the URL is supported by any of the stores.
|
||||||
* @return Returns <tt>true</tt> if the URL is supported by any of the stores.
|
*/
|
||||||
*/
|
public boolean isContentUrlSupported(String contentUrl)
|
||||||
public boolean isContentUrlSupported(String contentUrl)
|
{
|
||||||
{
|
List<ContentStore> stores = getAllStores();
|
||||||
List<ContentStore> stores = getAllStores();
|
boolean supported = false;
|
||||||
boolean supported = false;
|
for (ContentStore store : stores)
|
||||||
for (ContentStore store : stores)
|
{
|
||||||
{
|
if (store.isContentUrlSupported(contentUrl))
|
||||||
if (store.isContentUrlSupported(contentUrl))
|
{
|
||||||
{
|
supported = true;
|
||||||
supported = true;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
// Done
|
||||||
// Done
|
if (logger.isDebugEnabled())
|
||||||
if (logger.isDebugEnabled())
|
{
|
||||||
{
|
logger.debug("The url " + (supported ? "is" : "is not") + " supported by at least one store.");
|
||||||
logger.debug("The url " + (supported ? "is" : "is not") + " supported by at least one store.");
|
}
|
||||||
}
|
return supported;
|
||||||
return supported;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns <tt>true</tt> if write is supported by any of the stores.
|
||||||
* @return Returns <tt>true</tt> if write is supported by any of the stores.
|
*/
|
||||||
*/
|
public boolean isWriteSupported()
|
||||||
public boolean isWriteSupported()
|
{
|
||||||
{
|
List<ContentStore> stores = getAllStores();
|
||||||
List<ContentStore> stores = getAllStores();
|
boolean supported = false;
|
||||||
boolean supported = false;
|
for (ContentStore store : stores)
|
||||||
for (ContentStore store : stores)
|
{
|
||||||
{
|
if (store.isWriteSupported())
|
||||||
if (store.isWriteSupported())
|
{
|
||||||
{
|
supported = true;
|
||||||
supported = true;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
// Done
|
||||||
// Done
|
if (logger.isDebugEnabled())
|
||||||
if (logger.isDebugEnabled())
|
{
|
||||||
{
|
logger.debug("Writing " + (supported ? "is" : "is not") + " supported by at least one store.");
|
||||||
logger.debug("Writing " + (supported ? "is" : "is not") + " supported by at least one store.");
|
}
|
||||||
}
|
return supported;
|
||||||
return supported;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns <b>.</b> always
|
||||||
* @return Returns <b>.</b> always
|
*/
|
||||||
*/
|
public String getRootLocation()
|
||||||
public String getRootLocation()
|
{
|
||||||
{
|
return ".";
|
||||||
return ".";
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns <tt>-1</tt> always
|
||||||
* @return Returns <tt>-1</tt> always
|
*/
|
||||||
*/
|
@Override
|
||||||
@Override
|
public long getSpaceFree()
|
||||||
public long getSpaceFree()
|
{
|
||||||
{
|
return -1L;
|
||||||
return -1L;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns <tt>-1</tt> always
|
||||||
* @return Returns <tt>-1</tt> always
|
*/
|
||||||
*/
|
@Override
|
||||||
@Override
|
public long getSpaceTotal()
|
||||||
public long getSpaceTotal()
|
{
|
||||||
{
|
return -1L;
|
||||||
return -1L;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @see #selectReadStore(String)
|
||||||
* @see #selectReadStore(String)
|
*/
|
||||||
*/
|
public boolean exists(String contentUrl) throws ContentIOException
|
||||||
public boolean exists(String contentUrl) throws ContentIOException
|
{
|
||||||
{
|
ContentStore store = selectReadStore(contentUrl);
|
||||||
ContentStore store = selectReadStore(contentUrl);
|
return (store != null);
|
||||||
return (store != null);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns a valid reader from one of the stores otherwise a {@link EmptyContentReader} is returned.
|
||||||
* @return Returns a valid reader from one of the stores otherwise
|
*/
|
||||||
* a {@link EmptyContentReader} is returned.
|
public ContentReader getReader(String contentUrl) throws ContentIOException
|
||||||
*/
|
{
|
||||||
public ContentReader getReader(String contentUrl) throws ContentIOException
|
ContentStore store = selectReadStore(contentUrl);
|
||||||
{
|
if (store != null)
|
||||||
ContentStore store = selectReadStore(contentUrl);
|
{
|
||||||
if (store != null)
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
logger.debug("Getting reader from store: \n" +
|
||||||
{
|
" Content URL: " + contentUrl + "\n" +
|
||||||
logger.debug("Getting reader from store: \n" +
|
" Store: " + store);
|
||||||
" Content URL: " + contentUrl + "\n" +
|
}
|
||||||
" Store: " + store);
|
return store.getReader(contentUrl);
|
||||||
}
|
}
|
||||||
return store.getReader(contentUrl);
|
else
|
||||||
}
|
{
|
||||||
else
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
logger.debug("Getting empty reader for content URL: " + contentUrl);
|
||||||
{
|
}
|
||||||
logger.debug("Getting empty reader for content URL: " + contentUrl);
|
return new EmptyContentReader(contentUrl);
|
||||||
}
|
}
|
||||||
return new EmptyContentReader(contentUrl);
|
}
|
||||||
}
|
|
||||||
}
|
/**
|
||||||
|
* Selects a store for the given context and caches store that was used.
|
||||||
/**
|
*
|
||||||
* Selects a store for the given context and caches store that was used.
|
* @see #selectWriteStore(ContentContext)
|
||||||
*
|
*/
|
||||||
* @see #selectWriteStore(ContentContext)
|
public ContentWriter getWriter(ContentContext context) throws ContentIOException
|
||||||
*/
|
{
|
||||||
public ContentWriter getWriter(ContentContext context) throws ContentIOException
|
String contentUrl = context.getContentUrl();
|
||||||
{
|
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
||||||
String contentUrl = context.getContentUrl();
|
if (contentUrl != null)
|
||||||
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
{
|
||||||
if (contentUrl != null)
|
// Check to see if it is in the cache
|
||||||
{
|
storesCacheReadLock.lock();
|
||||||
// Check to see if it is in the cache
|
try
|
||||||
storesCacheReadLock.lock();
|
{
|
||||||
try
|
// Check if the store is in the cache
|
||||||
{
|
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||||
// Check if the store is in the cache
|
if (store != null)
|
||||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
{
|
||||||
if (store != null)
|
throw new ContentExistsException(this, contentUrl);
|
||||||
{
|
}
|
||||||
throw new ContentExistsException(this, contentUrl);
|
/* We could go further and check each store for the existence of the URL, but that would be overkill. The main problem we need to prevent is the simultaneous access of the same store. The router represents a single store and therefore if the URL is present in any of the stores, it is effectively present in all of them. */
|
||||||
}
|
}
|
||||||
/*
|
finally
|
||||||
* We could go further and check each store for the existence of the URL,
|
{
|
||||||
* but that would be overkill. The main problem we need to prevent is
|
storesCacheReadLock.unlock();
|
||||||
* the simultaneous access of the same store. The router represents
|
}
|
||||||
* a single store and therefore if the URL is present in any of the stores,
|
}
|
||||||
* it is effectively present in all of them.
|
// Select the store for writing
|
||||||
*/
|
ContentStore store = selectWriteStore(context);
|
||||||
}
|
// Check that we were given a valid store
|
||||||
finally
|
if (store == null)
|
||||||
{
|
{
|
||||||
storesCacheReadLock.unlock();
|
throw new NullPointerException(
|
||||||
}
|
"Unable to find a writer. 'selectWriteStore' may not return null: \n" +
|
||||||
}
|
" Router: " + this + "\n" +
|
||||||
// Select the store for writing
|
" Chose: " + store);
|
||||||
ContentStore store = selectWriteStore(context);
|
}
|
||||||
// Check that we were given a valid store
|
else if (!store.isWriteSupported())
|
||||||
if (store == null)
|
{
|
||||||
{
|
throw new AlfrescoRuntimeException(
|
||||||
throw new NullPointerException(
|
"A write store was chosen that doesn't support writes: \n" +
|
||||||
"Unable to find a writer. 'selectWriteStore' may not return null: \n" +
|
" Router: " + this + "\n" +
|
||||||
" Router: " + this + "\n" +
|
" Chose: " + store);
|
||||||
" Chose: " + store);
|
}
|
||||||
}
|
ContentWriter writer = store.getWriter(context);
|
||||||
else if (!store.isWriteSupported())
|
String newContentUrl = writer.getContentUrl();
|
||||||
{
|
Pair<String, String> newCacheKey = new Pair<String, String>(instanceKey, newContentUrl);
|
||||||
throw new AlfrescoRuntimeException(
|
// Cache the store against the URL
|
||||||
"A write store was chosen that doesn't support writes: \n" +
|
storesCacheWriteLock.lock();
|
||||||
" Router: " + this + "\n" +
|
try
|
||||||
" Chose: " + store);
|
{
|
||||||
}
|
storesByContentUrl.put(newCacheKey, store);
|
||||||
ContentWriter writer = store.getWriter(context);
|
}
|
||||||
String newContentUrl = writer.getContentUrl();
|
finally
|
||||||
Pair<String, String> newCacheKey = new Pair<String, String>(instanceKey, newContentUrl);
|
{
|
||||||
// Cache the store against the URL
|
storesCacheWriteLock.unlock();
|
||||||
storesCacheWriteLock.lock();
|
}
|
||||||
try
|
// Done
|
||||||
{
|
if (logger.isDebugEnabled())
|
||||||
storesByContentUrl.put(newCacheKey, store);
|
{
|
||||||
}
|
logger.debug(
|
||||||
finally
|
"Got writer and cache URL from store: \n" +
|
||||||
{
|
" Context: " + context + "\n" +
|
||||||
storesCacheWriteLock.unlock();
|
" Writer: " + writer + "\n" +
|
||||||
}
|
" Store: " + store);
|
||||||
// Done
|
}
|
||||||
if (logger.isDebugEnabled())
|
return writer;
|
||||||
{
|
}
|
||||||
logger.debug(
|
|
||||||
"Got writer and cache URL from store: \n" +
|
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl) throws ContentIOException
|
||||||
" Context: " + context + "\n" +
|
{
|
||||||
" Writer: " + writer + "\n" +
|
return getWriter(new ContentContext(existingContentReader, newContentUrl));
|
||||||
" Store: " + store);
|
}
|
||||||
}
|
|
||||||
return writer;
|
/**
|
||||||
}
|
* This operation has to be performed on all the stores in order to maintain the {@link ContentStore#exists(String)} contract.
|
||||||
|
*/
|
||||||
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl) throws ContentIOException
|
public boolean delete(String contentUrl) throws ContentIOException
|
||||||
{
|
{
|
||||||
return getWriter(new ContentContext(existingContentReader, newContentUrl));
|
boolean deleted = true;
|
||||||
}
|
List<ContentStore> stores = getAllStores();
|
||||||
|
for (ContentStore store : stores)
|
||||||
/**
|
{
|
||||||
* This operation has to be performed on all the stores in order to maintain the
|
if (store.isWriteSupported())
|
||||||
* {@link ContentStore#exists(String)} contract.
|
{
|
||||||
*/
|
deleted &= store.delete(contentUrl);
|
||||||
public boolean delete(String contentUrl) throws ContentIOException
|
}
|
||||||
{
|
}
|
||||||
boolean deleted = true;
|
// Done
|
||||||
List<ContentStore> stores = getAllStores();
|
if (logger.isDebugEnabled())
|
||||||
for (ContentStore store : stores)
|
{
|
||||||
{
|
logger.debug("Deleted content URL from stores: \n" +
|
||||||
if (store.isWriteSupported())
|
" Stores: " + stores.size() + "\n" +
|
||||||
{
|
" Deleted: " + deleted);
|
||||||
deleted &= store.delete(contentUrl);
|
}
|
||||||
}
|
return deleted;
|
||||||
}
|
}
|
||||||
// Done
|
|
||||||
if (logger.isDebugEnabled())
|
/**
|
||||||
{
|
* {@inheritDoc}
|
||||||
logger.debug("Deleted content URL from stores: \n" +
|
*/
|
||||||
" Stores: " + stores.size() + "\n" +
|
@Override
|
||||||
" Deleted: " + deleted);
|
public Map<String, String> getStorageProperties(String contentUrl)
|
||||||
}
|
{
|
||||||
return deleted;
|
ContentStore contentStore = selectReadStore(contentUrl);
|
||||||
}
|
|
||||||
|
if (contentStore == null)
|
||||||
/**
|
{
|
||||||
* {@inheritDoc}
|
logNoContentStore(contentUrl);
|
||||||
*/
|
return Collections.emptyMap();
|
||||||
@Override
|
}
|
||||||
public Map<String, String> getStorageProperties(String contentUrl)
|
final String message = "Getting storage properties from store: ";
|
||||||
{
|
logExecution(contentUrl, contentStore, message);
|
||||||
ContentStore contentStore = selectReadStore(contentUrl);
|
|
||||||
|
return contentStore.getStorageProperties(contentUrl);
|
||||||
if (contentStore == null)
|
}
|
||||||
{
|
|
||||||
logNoContentStore(contentUrl);
|
/**
|
||||||
return Collections.emptyMap();
|
* {@inheritDoc}
|
||||||
}
|
*/
|
||||||
final String message = "Getting storage properties from store: ";
|
@Override
|
||||||
logExecution(contentUrl, contentStore, message);
|
public boolean requestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams)
|
||||||
|
{
|
||||||
return contentStore.getStorageProperties(contentUrl);
|
final ContentStore contentStore = selectReadStore(contentUrl);
|
||||||
}
|
if (contentStore == null)
|
||||||
|
{
|
||||||
/**
|
logNoContentStore(contentUrl);
|
||||||
* {@inheritDoc}
|
return ContentStore.super.requestSendContentToArchive(contentUrl, archiveParams);
|
||||||
*/
|
}
|
||||||
@Override
|
final String message = "Sending content to archive: ";
|
||||||
public boolean requestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams)
|
logExecution(contentUrl, contentStore, message);
|
||||||
{
|
return contentStore.requestSendContentToArchive(contentUrl, archiveParams);
|
||||||
final ContentStore contentStore = selectReadStore(contentUrl);
|
}
|
||||||
if (contentStore == null)
|
|
||||||
{
|
/**
|
||||||
logNoContentStore(contentUrl);
|
* {@inheritDoc}
|
||||||
return ContentStore.super.requestSendContentToArchive(contentUrl, archiveParams);
|
*/
|
||||||
}
|
@Override
|
||||||
final String message = "Sending content to archive: ";
|
public boolean requestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams)
|
||||||
logExecution(contentUrl, contentStore, message);
|
{
|
||||||
return contentStore.requestSendContentToArchive(contentUrl, archiveParams);
|
final ContentStore contentStore = selectReadStore(contentUrl);
|
||||||
}
|
if (contentStore == null)
|
||||||
|
{
|
||||||
/**
|
logNoContentStore(contentUrl);
|
||||||
* {@inheritDoc}
|
return ContentStore.super.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
||||||
*/
|
}
|
||||||
@Override
|
final String message = "Restoring content from archive: ";
|
||||||
public boolean requestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams)
|
logExecution(contentUrl, contentStore, message);
|
||||||
{
|
return contentStore.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
||||||
final ContentStore contentStore = selectReadStore(contentUrl);
|
}
|
||||||
if (contentStore == null)
|
|
||||||
{
|
private void logExecution(final String contentUrl, final ContentStore contentStore, final String message)
|
||||||
logNoContentStore(contentUrl);
|
{
|
||||||
return ContentStore.super.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
if (logger.isTraceEnabled())
|
||||||
}
|
{
|
||||||
final String message = "Restoring content from archive: ";
|
logger.trace(message + "\n" +
|
||||||
logExecution(contentUrl, contentStore, message);
|
" Content URL: " + contentUrl + "\n" +
|
||||||
return ContentStore.super.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
" Store: " + contentStore);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private void logExecution(final String contentUrl, final ContentStore contentStore, final String message)
|
|
||||||
{
|
private void logNoContentStore(String contentUrl)
|
||||||
if (logger.isTraceEnabled())
|
{
|
||||||
{
|
if (logger.isTraceEnabled())
|
||||||
logger.trace(message + "\n" +
|
{
|
||||||
" Content URL: " + contentUrl + "\n" +
|
logger.trace("Content Store not found for content URL: " + contentUrl);
|
||||||
" Store: " + contentStore);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logNoContentStore(String contentUrl)
|
|
||||||
{
|
|
||||||
if (logger.isTraceEnabled())
|
|
||||||
{
|
|
||||||
logger.trace("Content Store not found for content URL: " + contentUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,123 +1,117 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.repo.domain;
|
package org.alfresco.repo.domain;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.zip.CRC32;
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to calculate CRC values for string persistence.
|
* Helper class to calculate CRC values for string persistence.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public class CrcHelper
|
public class CrcHelper
|
||||||
{
|
{
|
||||||
public static final String EMPTY_STRING = ".empty";
|
public static final String EMPTY_STRING = ".empty";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate a persistable, unique pair of values that can be persisted in a database unique
|
* Calculate a persistable, unique pair of values that can be persisted in a database unique key and guarantee correct case-sensitivity.
|
||||||
* key and guarantee correct case-sensitivity.
|
* <p>
|
||||||
* <p>
|
* While the short-string version of the value is always lowercase, the CRC is calculated from the virgin string if case-sensitivity is enforced; in the case-insensitive case, the CRC is calculated from a lowercase version of the string.
|
||||||
* While the short-string version of the value is always lowercase, the CRC is
|
* <p>
|
||||||
* calculated from the virgin string if case-sensitivity is enforced; in the case-insensitive
|
* If the value is an empty string, then {@link #EMPTY_STRING} is used instead. This ensures that persisted values don't fall foul of the Oracle empty string comparison "behaviour" i.e you should never persist an empty string in Oracle as it equates to a SQL <b>NULL</b>.
|
||||||
* case, the CRC is calculated from a lowercase version of the string.
|
*
|
||||||
* <p>
|
* @param value
|
||||||
* If the value is an empty string, then {@link #EMPTY_STRING} is used instead. This ensures
|
* the raw value that will be persisted
|
||||||
* that persisted values don't fall foul of the Oracle empty string comparison "behaviour" i.e
|
* @param dataLength
|
||||||
* you should never persist an empty string in Oracle as it equates to a SQL <b>NULL</b>.
|
* the maximum number of characters that can be persisted
|
||||||
*
|
* @param useCharsFromStart
|
||||||
* @param value the raw value that will be persisted
|
* <tt>true</tt> if the shortened string value must be made from the first characters of the string or <tt>false</tt> to use characters from the end of the string.
|
||||||
* @param dataLength the maximum number of characters that can be persisted
|
* @param caseSensitive
|
||||||
* @param useCharsFromStart <tt>true</tt> if the shortened string value must be made from
|
* <tt>true</tt> if the resulting pair must be case-sensitive or <tt>false</tt> if the pair must be case-insensitive.
|
||||||
* the first characters of the string or <tt>false</tt> to use
|
* @return Return the persistable pair. The result will never be <tt>null</tt>, but the individual pair values will be <tt>null</tt> if the value given is <tt>null</tt>
|
||||||
* characters from the end of the string.
|
*/
|
||||||
* @param caseSensitive <tt>true</tt> if the resulting pair must be case-sensitive or
|
public static Pair<String, Long> getStringCrcPair(
|
||||||
* <tt>false</tt> if the pair must be case-insensitive.
|
String value,
|
||||||
* @return Return the persistable pair. The result will never be <tt>null</tt>,
|
int dataLength,
|
||||||
* but the individual pair values will be <tt>null</tt> if the
|
boolean useCharsFromStart,
|
||||||
* value given is <tt>null</tt>
|
boolean caseSensitive)
|
||||||
*/
|
{
|
||||||
public static Pair<String, Long> getStringCrcPair(
|
String valueLowerCase;
|
||||||
String value,
|
if (value == null)
|
||||||
int dataLength,
|
{
|
||||||
boolean useCharsFromStart,
|
return new Pair<String, Long>(null, null);
|
||||||
boolean caseSensitive)
|
}
|
||||||
{
|
else if (value.length() == 0)
|
||||||
String valueLowerCase;
|
{
|
||||||
if (value == null)
|
value = CrcHelper.EMPTY_STRING;
|
||||||
{
|
valueLowerCase = value;
|
||||||
return new Pair<String, Long>(null, null);
|
}
|
||||||
}
|
else
|
||||||
else if (value.length() == 0)
|
{
|
||||||
{
|
valueLowerCase = value.toLowerCase();
|
||||||
value = CrcHelper.EMPTY_STRING;
|
}
|
||||||
valueLowerCase = value;
|
Long valueCrc;
|
||||||
}
|
try
|
||||||
else
|
{
|
||||||
{
|
CRC32 crc = new CRC32();
|
||||||
valueLowerCase = value.toLowerCase();
|
if (caseSensitive)
|
||||||
}
|
{
|
||||||
Long valueCrc;
|
crc.update(value.getBytes("UTF-8"));
|
||||||
try
|
}
|
||||||
{
|
else
|
||||||
CRC32 crc = new CRC32();
|
{
|
||||||
if (caseSensitive)
|
crc.update(valueLowerCase.getBytes("UTF-8"));
|
||||||
{
|
}
|
||||||
crc.update(value.getBytes("UTF-8"));
|
valueCrc = crc.getValue();
|
||||||
}
|
}
|
||||||
else
|
catch (UnsupportedEncodingException e)
|
||||||
{
|
{
|
||||||
crc.update(valueLowerCase.getBytes("UTF-8"));
|
throw new RuntimeException("UTF-8 encoding is not supported");
|
||||||
}
|
|
||||||
valueCrc = crc.getValue();
|
}
|
||||||
}
|
// Get the short value (case-sensitive or not)
|
||||||
catch (UnsupportedEncodingException e)
|
String valueShort = null;
|
||||||
{
|
int valueLen = valueLowerCase.length();
|
||||||
throw new RuntimeException("UTF-8 encoding is not supported");
|
if (valueLen < dataLength)
|
||||||
}
|
{
|
||||||
// Crc Value will change based on the case-sensitive, So we need to get the short value based on case-sensitive
|
valueShort = valueLowerCase;
|
||||||
String valueShort = null;
|
}
|
||||||
String currentValue = caseSensitive ? value : valueLowerCase;
|
else if (useCharsFromStart)
|
||||||
int valueLen = currentValue.length();
|
{
|
||||||
if (valueLen < dataLength)
|
valueShort = valueLowerCase.substring(0, dataLength - 1);
|
||||||
{
|
}
|
||||||
valueShort = currentValue;
|
else
|
||||||
}
|
{
|
||||||
else if (useCharsFromStart)
|
valueShort = valueLowerCase.substring(valueLen - dataLength);
|
||||||
{
|
}
|
||||||
valueShort = currentValue.substring(0, dataLength - 1);
|
return new Pair<String, Long>(valueShort, valueCrc);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
valueShort = currentValue.substring(valueLen - dataLength);
|
|
||||||
}
|
|
||||||
return new Pair<String, Long>(valueShort, valueCrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,258 +1,285 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.domain.audit;
|
package org.alfresco.repo.domain.audit;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DAO services for <b>alf_audit_XXX</b> tables.
|
* DAO services for <b>alf_audit_XXX</b> tables.
|
||||||
* <p>
|
* <p>
|
||||||
* The older methods are supported by a different implementation and will eventually
|
* The older methods are supported by a different implementation and will eventually be deprecated and phased out.
|
||||||
* be deprecated and phased out.
|
*
|
||||||
*
|
* @author Derek Hulley
|
||||||
* @author Derek Hulley
|
* @since 3.2
|
||||||
* @since 3.2
|
*/
|
||||||
*/
|
public interface AuditDAO
|
||||||
public interface AuditDAO
|
{
|
||||||
{
|
/* V3.2 methods after here only, please */
|
||||||
/*
|
|
||||||
* V3.2 methods after here only, please
|
/**
|
||||||
*/
|
* Information about the audit application to be passed in an out of the interface.
|
||||||
|
*
|
||||||
/**
|
* @author Derek Hulley
|
||||||
* Information about the audit application to be passed in an out of the interface.
|
* @since 3.2
|
||||||
*
|
*/
|
||||||
* @author Derek Hulley
|
public static class AuditApplicationInfo
|
||||||
* @since 3.2
|
{
|
||||||
*/
|
private Long id;
|
||||||
public static class AuditApplicationInfo
|
private String name;
|
||||||
{
|
private Long modelId;
|
||||||
private Long id;
|
private Long disabledPathsId;
|
||||||
private String name;
|
|
||||||
private Long modelId;
|
@Override
|
||||||
private Long disabledPathsId;
|
public String toString()
|
||||||
|
{
|
||||||
@Override
|
StringBuilder sb = new StringBuilder();
|
||||||
public String toString()
|
sb.append("AuditApplicationInfo ")
|
||||||
{
|
.append("[ id=").append(id)
|
||||||
StringBuilder sb = new StringBuilder();
|
.append(", name=").append(name)
|
||||||
sb.append("AuditApplicationInfo ")
|
.append(", modelId=").append(modelId)
|
||||||
.append("[ id=").append(id)
|
.append(", disabledPathsId=").append(disabledPathsId)
|
||||||
.append(", name=").append(name)
|
.append("]");
|
||||||
.append(", modelId=").append(modelId)
|
return sb.toString();
|
||||||
.append(", disabledPathsId=").append(disabledPathsId)
|
}
|
||||||
.append("]");
|
|
||||||
return sb.toString();
|
public Long getId()
|
||||||
}
|
{
|
||||||
|
return id;
|
||||||
public Long getId()
|
}
|
||||||
{
|
|
||||||
return id;
|
public void setId(Long id)
|
||||||
}
|
{
|
||||||
public void setId(Long id)
|
this.id = id;
|
||||||
{
|
}
|
||||||
this.id = id;
|
|
||||||
}
|
public String getName()
|
||||||
public String getName()
|
{
|
||||||
{
|
return name;
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
public void setname(String name)
|
public void setname(String name)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
public Long getModelId()
|
|
||||||
{
|
public Long getModelId()
|
||||||
return modelId;
|
{
|
||||||
}
|
return modelId;
|
||||||
public void setModelId(Long modelId)
|
}
|
||||||
{
|
|
||||||
this.modelId = modelId;
|
public void setModelId(Long modelId)
|
||||||
}
|
{
|
||||||
public Long getDisabledPathsId()
|
this.modelId = modelId;
|
||||||
{
|
}
|
||||||
return disabledPathsId;
|
|
||||||
}
|
public Long getDisabledPathsId()
|
||||||
public void setDisabledPathsId(Long disabledPathsId)
|
{
|
||||||
{
|
return disabledPathsId;
|
||||||
this.disabledPathsId = disabledPathsId;
|
}
|
||||||
}
|
|
||||||
}
|
public void setDisabledPathsId(Long disabledPathsId)
|
||||||
|
{
|
||||||
/**
|
this.disabledPathsId = disabledPathsId;
|
||||||
* Creates a new audit model entry or finds an existing one
|
}
|
||||||
*
|
}
|
||||||
* @param url the URL of the configuration
|
|
||||||
* @return Returns the ID of the config matching the input stream and the
|
/**
|
||||||
* content storage details
|
* Creates a new audit model entry or finds an existing one
|
||||||
* @since 3.2
|
*
|
||||||
*/
|
* @param url
|
||||||
Pair<Long, ContentData> getOrCreateAuditModel(URL url);
|
* the URL of the configuration
|
||||||
|
* @return Returns the ID of the config matching the input stream and the content storage details
|
||||||
/**
|
* @since 3.2
|
||||||
* Get the audit application details.
|
*/
|
||||||
*
|
Pair<Long, ContentData> getOrCreateAuditModel(URL url);
|
||||||
* @param applicationName the name of the application
|
|
||||||
* @return Returns details of an existing application or <tt>null</tt> if it doesn't exist
|
/**
|
||||||
*
|
* Get the audit application details.
|
||||||
* @since 3.2
|
*
|
||||||
*/
|
* @param applicationName
|
||||||
AuditApplicationInfo getAuditApplication(String applicationName);
|
* the name of the application
|
||||||
|
* @return Returns details of an existing application or <tt>null</tt> if it doesn't exist
|
||||||
/**
|
*
|
||||||
* Creates a new audit application. The application name must be unique.
|
* @since 3.2
|
||||||
*
|
*/
|
||||||
* @param application the name of the application
|
AuditApplicationInfo getAuditApplication(String applicationName);
|
||||||
* @param modelId the ID of the model configuration
|
|
||||||
*
|
/**
|
||||||
* @since 3.2
|
* Creates a new audit application. The application name must be unique.
|
||||||
*/
|
*
|
||||||
AuditApplicationInfo createAuditApplication(String application, Long modelId);
|
* @param application
|
||||||
|
* the name of the application
|
||||||
/**
|
* @param modelId
|
||||||
* Update the audit application to refer to a new model.
|
* the ID of the model configuration
|
||||||
* If the model did not change, then nothing will be done.
|
*
|
||||||
*
|
* @since 3.2
|
||||||
* @param id the ID of the audit application
|
*/
|
||||||
* @param modelId the ID of the new model
|
AuditApplicationInfo createAuditApplication(String application, Long modelId);
|
||||||
*
|
|
||||||
* @since 3.2
|
/**
|
||||||
*/
|
* Update the audit application to refer to a new model. If the model did not change, then nothing will be done.
|
||||||
void updateAuditApplicationModel(Long id, Long modelId);
|
*
|
||||||
|
* @param id
|
||||||
/**
|
* the ID of the audit application
|
||||||
* Update the audit application to hold a new set of disabled paths.
|
* @param modelId
|
||||||
* If the value did not change, then nothing will be done.
|
* the ID of the new model
|
||||||
*
|
*
|
||||||
* @param id the ID of the audit application
|
* @since 3.2
|
||||||
* @param disabledPaths the new disabled paths
|
*/
|
||||||
*
|
void updateAuditApplicationModel(Long id, Long modelId);
|
||||||
* @since 3.2
|
|
||||||
*/
|
/**
|
||||||
void updateAuditApplicationDisabledPaths(Long id, Set<String> disabledPaths);
|
* Update the audit application to hold a new set of disabled paths. If the value did not change, then nothing will be done.
|
||||||
|
*
|
||||||
/**
|
* @param id
|
||||||
* Delete audit entries for the application, possibly limiting the time range.
|
* the ID of the audit application
|
||||||
*
|
* @param disabledPaths
|
||||||
* @param applicationId an existing audit application ID
|
* the new disabled paths
|
||||||
* @param fromTime the minimum entry time (inclusive, optional)
|
*
|
||||||
* @param toTime the maximum entry time (exclusive, optional)
|
* @since 3.2
|
||||||
* @return Returns the number of entries deleted
|
*/
|
||||||
*
|
void updateAuditApplicationDisabledPaths(Long id, Set<String> disabledPaths);
|
||||||
* @since 3.2
|
|
||||||
*/
|
/**
|
||||||
int deleteAuditEntries(Long applicationId, Long fromTime, Long toTime);
|
* Delete audit entries for the application, possibly limiting the time range.
|
||||||
|
*
|
||||||
/**
|
* @param applicationId
|
||||||
* Delete audit entries for the application for given id range.
|
* an existing audit application ID
|
||||||
*
|
* @param fromTime
|
||||||
* @param applicationId an existing audit application ID
|
* the minimum entry time (inclusive, optional)
|
||||||
* @param fromId the minimum fromId (inclusive, optional)
|
* @param toTime
|
||||||
* @param toId the maximum toId (exclusive, optional)
|
* the maximum entry time (exclusive, optional)
|
||||||
* @return Returns the number of entries deleted
|
* @return Returns the number of entries deleted
|
||||||
*
|
*
|
||||||
* @since 5.2.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
int deleteAuditEntriesByIdRange(Long applicationId, Long fromId, Long toId);
|
int deleteAuditEntries(Long applicationId, Long fromTime, Long toTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a discrete list of audit entries. Duplicate entries are collapsed
|
* Delete audit entries for the application for given id range.
|
||||||
* and the number of entries deleted will match the count of unique IDs in
|
*
|
||||||
* the list; otherwise a concurrency condition has occured and an exception
|
* @param applicationId
|
||||||
* will be generated.
|
* an existing audit application ID
|
||||||
*
|
* @param fromId
|
||||||
* @param auditEntryIds the IDs of all audit entries to delete
|
* the minimum fromId (inclusive, optional)
|
||||||
* @return Returns the number of entries deleted
|
* @param toId
|
||||||
*/
|
* the maximum toId (exclusive, optional)
|
||||||
int deleteAuditEntries(List<Long> auditEntryIds);
|
* @return Returns the number of entries deleted
|
||||||
|
*
|
||||||
/**
|
* @since 5.2.2
|
||||||
* Create a new audit entry with the given map of values.
|
*/
|
||||||
*
|
int deleteAuditEntriesByIdRange(Long applicationId, Long fromId, Long toId);
|
||||||
* @param applicationId an existing audit application ID
|
|
||||||
* @param time the time (ms since epoch) to log the entry against
|
/**
|
||||||
* @param username the authenticated user (<tt>null</tt> if not present)
|
* Delete a discrete list of audit entries. Duplicate entries are collapsed and the number of entries deleted will match the count of unique IDs in the list; otherwise a concurrency condition has occured and an exception will be generated.
|
||||||
* @param values the values to record
|
*
|
||||||
* @return Returns the unique entry ID
|
* @param auditEntryIds
|
||||||
*
|
* the IDs of all audit entries to delete
|
||||||
* @since 3.2
|
* @return Returns the number of entries deleted
|
||||||
*/
|
*/
|
||||||
Long createAuditEntry(Long applicationId, long time, String username, Map<String, Serializable> values);
|
int deleteAuditEntries(List<Long> auditEntryIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find audit entries using the given parameters, any of which may be null
|
* Create a new audit entry with the given map of values.
|
||||||
*
|
*
|
||||||
* @param callback the data callback per entry
|
* @param applicationId
|
||||||
* @param parameters the parameters for the query (may not be <tt>null</tt>)
|
* an existing audit application ID
|
||||||
* @param maxResults the maximum number of results to retrieve (must be greater than 0)
|
* @param time
|
||||||
*
|
* the time (ms since epoch) to log the entry against
|
||||||
* @throws IllegalArgumentException if maxResults less or equal to zero
|
* @param username
|
||||||
*/
|
* the authenticated user (<tt>null</tt> if not present)
|
||||||
void findAuditEntries(
|
* @param values
|
||||||
AuditQueryCallback callback,
|
* the values to record
|
||||||
org.alfresco.service.cmr.audit.AuditQueryParameters parameters,
|
* @return Returns the unique entry ID
|
||||||
int maxResults);
|
*
|
||||||
|
* @since 3.2
|
||||||
/**
|
*/
|
||||||
* Issue an audit query to retrieve min / max audit record id for a given application.
|
Long createAuditEntry(Long applicationId, long time, String username, Map<String, Serializable> values);
|
||||||
*
|
|
||||||
* @param appId the database id of the application
|
/**
|
||||||
* @param extremes a list containing min/max or both
|
* Find audit entries using the given parameters, any of which may be null
|
||||||
* @return a map containing min/max and the associated value
|
*
|
||||||
*/
|
* @param callback
|
||||||
HashMap<String, Long> getAuditMinMaxByApp(long appId, List<String> extremes);
|
* the data callback per entry
|
||||||
|
* @param parameters
|
||||||
/**
|
* the parameters for the query (may not be <tt>null</tt>)
|
||||||
* Issue an audit query to retrieve count of records for a given application.
|
* @param maxResults
|
||||||
*
|
* the maximum number of results to retrieve (must be greater than 0)
|
||||||
* @param applicationId the database id of the application
|
*
|
||||||
* @return a map containing min/max and the associated value
|
* @throws IllegalArgumentException
|
||||||
*/
|
* if maxResults less or equal to zero
|
||||||
default int getAuditEntriesCountByApp(long applicationId)
|
*/
|
||||||
{
|
void findAuditEntries(
|
||||||
return -1;
|
AuditQueryCallback callback,
|
||||||
}
|
org.alfresco.service.cmr.audit.AuditQueryParameters parameters,
|
||||||
|
int maxResults);
|
||||||
/**
|
|
||||||
* Issue an audit query to retrieve count of records for a given application and properties
|
/**
|
||||||
*
|
* Issue an audit query to retrieve min / max audit record id for a given application.
|
||||||
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
*
|
||||||
* @return a map containing min/max and the associated value
|
* @param appId
|
||||||
*/
|
* the database id of the application
|
||||||
default int getAuditEntriesCountByAppAndProperties(org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
* @param extremes
|
||||||
{
|
* a list containing min/max or both
|
||||||
return -1;
|
* @return a map containing min/max and the associated value
|
||||||
}
|
*/
|
||||||
}
|
HashMap<String, Long> getAuditMinMaxByApp(long appId, List<String> extremes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Issue an audit query to retrieve count of records for a given application.
|
||||||
|
*
|
||||||
|
* @param applicationId
|
||||||
|
* the database id of the application
|
||||||
|
* @return a map containing min/max and the associated value
|
||||||
|
*/
|
||||||
|
default int getAuditEntriesCountByApp(long applicationId)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Issue an audit query to retrieve count of records for a given application and properties
|
||||||
|
*
|
||||||
|
* @param applicationName
|
||||||
|
* name of the application to be queried
|
||||||
|
* @param parameters
|
||||||
|
* audit parameters provided by the <code>where</code> clause on the ReST API
|
||||||
|
* @return a map containing min/max and the associated value
|
||||||
|
*/
|
||||||
|
default int getAuditEntriesCountByAppAndProperties(String applicationName, org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,316 +1,315 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.domain.audit.ibatis;
|
package org.alfresco.repo.domain.audit.ibatis;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.alfresco.repo.domain.audit.AbstractAuditDAOImpl;
|
import org.apache.ibatis.session.RowBounds;
|
||||||
import org.alfresco.repo.domain.audit.AuditApplicationEntity;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
import org.alfresco.repo.domain.audit.AuditDeleteParameters;
|
import org.springframework.dao.ConcurrencyFailureException;
|
||||||
import org.alfresco.repo.domain.audit.AuditEntryEntity;
|
|
||||||
import org.alfresco.repo.domain.audit.AuditModelEntity;
|
import org.alfresco.repo.domain.audit.AbstractAuditDAOImpl;
|
||||||
import org.alfresco.repo.domain.audit.AuditQueryParameters;
|
import org.alfresco.repo.domain.audit.AuditApplicationEntity;
|
||||||
import org.alfresco.repo.domain.audit.AuditQueryResult;
|
import org.alfresco.repo.domain.audit.AuditDeleteParameters;
|
||||||
import org.alfresco.repo.domain.propval.PropertyValueDAO.PropertyFinderCallback;
|
import org.alfresco.repo.domain.audit.AuditEntryEntity;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.repo.domain.audit.AuditModelEntity;
|
||||||
import org.apache.ibatis.session.RowBounds;
|
import org.alfresco.repo.domain.audit.AuditQueryParameters;
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.alfresco.repo.domain.audit.AuditQueryResult;
|
||||||
import org.springframework.dao.ConcurrencyFailureException;
|
import org.alfresco.repo.domain.propval.PropertyValueDAO.PropertyFinderCallback;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
/**
|
|
||||||
* iBatis-specific implementation of the DAO for <b>alf_audit_XXX</b> tables.
|
/**
|
||||||
*
|
* iBatis-specific implementation of the DAO for <b>alf_audit_XXX</b> tables.
|
||||||
* @author Derek Hulley
|
*
|
||||||
* @since 3.2
|
* @author Derek Hulley
|
||||||
*/
|
* @since 3.2
|
||||||
public class AuditDAOImpl extends AbstractAuditDAOImpl
|
*/
|
||||||
{
|
public class AuditDAOImpl extends AbstractAuditDAOImpl
|
||||||
private static final String SELECT_MODEL_BY_CRC = "alfresco.audit.select_AuditModelByCrc";
|
{
|
||||||
private static final String INSERT_MODEL = "alfresco.audit.insert.insert_AuditModel";
|
private static final String SELECT_MODEL_BY_CRC = "alfresco.audit.select_AuditModelByCrc";
|
||||||
|
private static final String INSERT_MODEL = "alfresco.audit.insert.insert_AuditModel";
|
||||||
private static final String SELECT_APPLICATION_BY_ID = "alfresco.audit.select_AuditApplicationById";
|
|
||||||
private static final String SELECT_APPLICATION_BY_NAME_ID = "alfresco.audit.select_AuditApplicationByNameId";
|
private static final String SELECT_APPLICATION_BY_ID = "alfresco.audit.select_AuditApplicationById";
|
||||||
private static final String INSERT_APPLICATION = "alfresco.audit.insert.insert_AuditApplication";
|
private static final String SELECT_APPLICATION_BY_NAME_ID = "alfresco.audit.select_AuditApplicationByNameId";
|
||||||
private static final String UPDATE_APPLICATION = "alfresco.audit.update_AuditApplication";
|
private static final String INSERT_APPLICATION = "alfresco.audit.insert.insert_AuditApplication";
|
||||||
|
private static final String UPDATE_APPLICATION = "alfresco.audit.update_AuditApplication";
|
||||||
private static final String DELETE_ENTRIES = "alfresco.audit.delete_AuditEntries";
|
|
||||||
private static final String DELETE_ENTRIES_BY_ID = "alfresco.audit.delete_AuditEntriesById";
|
private static final String DELETE_ENTRIES = "alfresco.audit.delete_AuditEntries";
|
||||||
private static final String INSERT_ENTRY = "alfresco.audit.insert.insert_AuditEntry";
|
private static final String DELETE_ENTRIES_BY_ID = "alfresco.audit.delete_AuditEntriesById";
|
||||||
private static final String SELECT_MINMAX_ENTRY_FOR_APP = "alfresco.audit.select_MinMaxAuditEntryId";
|
private static final String INSERT_ENTRY = "alfresco.audit.insert.insert_AuditEntry";
|
||||||
private static final String SELECT_COUNT_ENTRIES_FOR_APP = "alfresco.audit.select_CountAuditEntryId";
|
private static final String SELECT_MINMAX_ENTRY_FOR_APP = "alfresco.audit.select_MinMaxAuditEntryId";
|
||||||
private static final String SELECT_COUNT_ENTRIES_FOR_APP_WITH_PROPERTIES = "select_CountAuditEntryIdWithWhereClause";
|
private static final String SELECT_COUNT_ENTRIES_FOR_APP = "alfresco.audit.select_CountAuditEntryId";
|
||||||
|
private static final String SELECT_COUNT_ENTRIES_FOR_APP_WITH_PROPERTIES = "select_CountAuditEntryIdWithWhereClause";
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static final String SELECT_ENTRIES_SIMPLE = "alfresco.audit.select_AuditEntriesSimple";
|
@SuppressWarnings("unused")
|
||||||
private static final String SELECT_ENTRIES_WITH_VALUES = "alfresco.audit.select_AuditEntriesWithValues";
|
private static final String SELECT_ENTRIES_SIMPLE = "alfresco.audit.select_AuditEntriesSimple";
|
||||||
private static final String SELECT_ENTRIES_WITHOUT_VALUES = "alfresco.audit.select_AuditEntriesWithoutValues";
|
private static final String SELECT_ENTRIES_WITH_VALUES = "alfresco.audit.select_AuditEntriesWithValues";
|
||||||
|
private static final String SELECT_ENTRIES_WITHOUT_VALUES = "alfresco.audit.select_AuditEntriesWithoutValues";
|
||||||
private SqlSessionTemplate template;
|
|
||||||
|
private SqlSessionTemplate template;
|
||||||
public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)
|
|
||||||
{
|
public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)
|
||||||
this.template = sqlSessionTemplate;
|
{
|
||||||
}
|
this.template = sqlSessionTemplate;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditModelEntity getAuditModelByCrc(long crc)
|
@Override
|
||||||
{
|
protected AuditModelEntity getAuditModelByCrc(long crc)
|
||||||
AuditModelEntity entity = new AuditModelEntity();
|
{
|
||||||
entity.setContentCrc(crc);
|
AuditModelEntity entity = new AuditModelEntity();
|
||||||
entity = template.selectOne(
|
entity.setContentCrc(crc);
|
||||||
SELECT_MODEL_BY_CRC,
|
entity = template.selectOne(
|
||||||
entity);
|
SELECT_MODEL_BY_CRC,
|
||||||
// Done
|
entity);
|
||||||
return entity;
|
// Done
|
||||||
}
|
return entity;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditModelEntity createAuditModel(Long contentDataId, long crc)
|
@Override
|
||||||
{
|
protected AuditModelEntity createAuditModel(Long contentDataId, long crc)
|
||||||
AuditModelEntity entity = new AuditModelEntity();
|
{
|
||||||
entity.setContentDataId(contentDataId);
|
AuditModelEntity entity = new AuditModelEntity();
|
||||||
entity.setContentCrc(crc);
|
entity.setContentDataId(contentDataId);
|
||||||
template.insert(INSERT_MODEL, entity);
|
entity.setContentCrc(crc);
|
||||||
return entity;
|
template.insert(INSERT_MODEL, entity);
|
||||||
}
|
return entity;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditApplicationEntity getAuditApplicationById(Long id)
|
@Override
|
||||||
{
|
protected AuditApplicationEntity getAuditApplicationById(Long id)
|
||||||
Map<String, Object> params = new HashMap<String, Object>(11);
|
{
|
||||||
params.put("id", id);
|
Map<String, Object> params = new HashMap<String, Object>(11);
|
||||||
AuditApplicationEntity entity = template.selectOne(
|
params.put("id", id);
|
||||||
SELECT_APPLICATION_BY_ID,
|
AuditApplicationEntity entity = template.selectOne(
|
||||||
params);
|
SELECT_APPLICATION_BY_ID,
|
||||||
// Done
|
params);
|
||||||
if (logger.isDebugEnabled())
|
// Done
|
||||||
{
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Searched for audit application ID " + id + " and found: " + entity);
|
{
|
||||||
}
|
logger.debug("Searched for audit application ID " + id + " and found: " + entity);
|
||||||
return entity;
|
}
|
||||||
}
|
return entity;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditApplicationEntity getAuditApplicationByName(String appName)
|
@Override
|
||||||
{
|
protected AuditApplicationEntity getAuditApplicationByName(String appName)
|
||||||
// Resolve the name as a property ID
|
{
|
||||||
Pair<Long, Serializable> appNamePair = propertyValueDAO.getPropertyValue(appName);
|
// Resolve the name as a property ID
|
||||||
if (appNamePair == null)
|
Pair<Long, Serializable> appNamePair = propertyValueDAO.getPropertyValue(appName);
|
||||||
{
|
if (appNamePair == null)
|
||||||
// There will be no results
|
{
|
||||||
return null;
|
// There will be no results
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
Map<String, Object> params = new HashMap<String, Object>(11);
|
|
||||||
params.put("id", appNamePair.getFirst());
|
Map<String, Object> params = new HashMap<String, Object>(11);
|
||||||
AuditApplicationEntity entity = template.selectOne(
|
params.put("id", appNamePair.getFirst());
|
||||||
SELECT_APPLICATION_BY_NAME_ID,
|
AuditApplicationEntity entity = template.selectOne(
|
||||||
params);
|
SELECT_APPLICATION_BY_NAME_ID,
|
||||||
// Done
|
params);
|
||||||
if (logger.isDebugEnabled())
|
// Done
|
||||||
{
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Searched for audit application '" + appName + "' and found: " + entity);
|
{
|
||||||
}
|
logger.debug("Searched for audit application '" + appName + "' and found: " + entity);
|
||||||
return entity;
|
}
|
||||||
}
|
return entity;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditApplicationEntity createAuditApplication(Long appNameId, Long modelId, Long disabledPathsId)
|
@Override
|
||||||
{
|
protected AuditApplicationEntity createAuditApplication(Long appNameId, Long modelId, Long disabledPathsId)
|
||||||
AuditApplicationEntity entity = new AuditApplicationEntity();
|
{
|
||||||
entity.setVersion((short)0);
|
AuditApplicationEntity entity = new AuditApplicationEntity();
|
||||||
entity.setApplicationNameId(appNameId);
|
entity.setVersion((short) 0);
|
||||||
entity.setAuditModelId(modelId);
|
entity.setApplicationNameId(appNameId);
|
||||||
entity.setDisabledPathsId(disabledPathsId);
|
entity.setAuditModelId(modelId);
|
||||||
template.insert(INSERT_APPLICATION, entity);
|
entity.setDisabledPathsId(disabledPathsId);
|
||||||
return entity;
|
template.insert(INSERT_APPLICATION, entity);
|
||||||
}
|
return entity;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditApplicationEntity updateAuditApplication(AuditApplicationEntity entity)
|
@Override
|
||||||
{
|
protected AuditApplicationEntity updateAuditApplication(AuditApplicationEntity entity)
|
||||||
AuditApplicationEntity updateEntity = new AuditApplicationEntity();
|
{
|
||||||
updateEntity.setId(entity.getId());
|
AuditApplicationEntity updateEntity = new AuditApplicationEntity();
|
||||||
updateEntity.setVersion(entity.getVersion());
|
updateEntity.setId(entity.getId());
|
||||||
updateEntity.incrementVersion();
|
updateEntity.setVersion(entity.getVersion());
|
||||||
updateEntity.setApplicationNameId(entity.getApplicationNameId());
|
updateEntity.incrementVersion();
|
||||||
updateEntity.setAuditModelId(entity.getAuditModelId());
|
updateEntity.setApplicationNameId(entity.getApplicationNameId());
|
||||||
updateEntity.setDisabledPathsId(entity.getDisabledPathsId());
|
updateEntity.setAuditModelId(entity.getAuditModelId());
|
||||||
|
updateEntity.setDisabledPathsId(entity.getDisabledPathsId());
|
||||||
int updated = template.update(UPDATE_APPLICATION, updateEntity);
|
|
||||||
if (updated != 1)
|
int updated = template.update(UPDATE_APPLICATION, updateEntity);
|
||||||
{
|
if (updated != 1)
|
||||||
// unexpected number of rows affected
|
{
|
||||||
throw new ConcurrencyFailureException("Incorrect number of rows affected for updateAuditApplication: " + updateEntity + ": expected 1, actual " + updated);
|
// unexpected number of rows affected
|
||||||
}
|
throw new ConcurrencyFailureException("Incorrect number of rows affected for updateAuditApplication: " + updateEntity + ": expected 1, actual " + updated);
|
||||||
|
}
|
||||||
// Done
|
|
||||||
return updateEntity;
|
// Done
|
||||||
}
|
return updateEntity;
|
||||||
|
}
|
||||||
public int deleteAuditEntries(Long applicationId, Long from, Long to)
|
|
||||||
{
|
public int deleteAuditEntries(Long applicationId, Long from, Long to)
|
||||||
AuditDeleteParameters params = new AuditDeleteParameters();
|
{
|
||||||
params.setAuditApplicationId(applicationId);
|
AuditDeleteParameters params = new AuditDeleteParameters();
|
||||||
params.setAuditFromTime(from);
|
params.setAuditApplicationId(applicationId);
|
||||||
params.setAuditToTime(to);
|
params.setAuditFromTime(from);
|
||||||
return template.delete(DELETE_ENTRIES, params);
|
params.setAuditToTime(to);
|
||||||
}
|
return template.delete(DELETE_ENTRIES, params);
|
||||||
|
}
|
||||||
public int deleteAuditEntriesByIdRange(Long applicationId, Long fromId, Long toId)
|
|
||||||
{
|
public int deleteAuditEntriesByIdRange(Long applicationId, Long fromId, Long toId)
|
||||||
AuditDeleteParameters params = new AuditDeleteParameters();
|
{
|
||||||
params.setAuditApplicationId(applicationId);
|
AuditDeleteParameters params = new AuditDeleteParameters();
|
||||||
params.setAuditFromId(fromId);
|
params.setAuditApplicationId(applicationId);
|
||||||
params.setAuditToId(toId);
|
params.setAuditFromId(fromId);
|
||||||
return template.delete(DELETE_ENTRIES, params);
|
params.setAuditToId(toId);
|
||||||
}
|
return template.delete(DELETE_ENTRIES, params);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected int deleteAuditEntriesImpl(List<Long> auditEntryIds)
|
@Override
|
||||||
{
|
protected int deleteAuditEntriesImpl(List<Long> auditEntryIds)
|
||||||
AuditDeleteParameters params = new AuditDeleteParameters();
|
{
|
||||||
params.setAuditEntryIds(auditEntryIds);
|
AuditDeleteParameters params = new AuditDeleteParameters();
|
||||||
return template.delete(DELETE_ENTRIES_BY_ID, params);
|
params.setAuditEntryIds(auditEntryIds);
|
||||||
}
|
return template.delete(DELETE_ENTRIES_BY_ID, params);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected AuditEntryEntity createAuditEntry(Long applicationId, long time, Long usernameId, Long valuesId)
|
@Override
|
||||||
{
|
protected AuditEntryEntity createAuditEntry(Long applicationId, long time, Long usernameId, Long valuesId)
|
||||||
AuditEntryEntity entity = new AuditEntryEntity();
|
{
|
||||||
entity.setAuditApplicationId(applicationId);
|
AuditEntryEntity entity = new AuditEntryEntity();
|
||||||
entity.setAuditTime(time);
|
entity.setAuditApplicationId(applicationId);
|
||||||
entity.setAuditUserId(usernameId);
|
entity.setAuditTime(time);
|
||||||
entity.setAuditValuesId(valuesId);
|
entity.setAuditUserId(usernameId);
|
||||||
template.insert(INSERT_ENTRY, entity);
|
entity.setAuditValuesId(valuesId);
|
||||||
return entity;
|
template.insert(INSERT_ENTRY, entity);
|
||||||
}
|
return entity;
|
||||||
|
}
|
||||||
public HashMap<String, Long> getAuditMinMaxByApp(long appId, List<String> extremes)
|
|
||||||
{
|
public HashMap<String, Long> getAuditMinMaxByApp(long appId, List<String> extremes)
|
||||||
// Build parameters to be used in the query. Filter the duplicates when inserting into map
|
{
|
||||||
Map<String, Object> params = extremes.stream().collect(Collectors.toMap(s -> s, s -> Boolean.TRUE, (s1, s2) -> s1));
|
// Build parameters to be used in the query. Filter the duplicates when inserting into map
|
||||||
params.put("auditAppId", appId);
|
Map<String, Object> params = extremes.stream().collect(Collectors.toMap(s -> s, s -> Boolean.TRUE, (s1, s2) -> s1));
|
||||||
|
params.put("auditAppId", appId);
|
||||||
HashMap<String, Long> result = template.selectOne(SELECT_MINMAX_ENTRY_FOR_APP, params);
|
|
||||||
|
HashMap<String, Long> result = template.selectOne(SELECT_MINMAX_ENTRY_FOR_APP, params);
|
||||||
return result;
|
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public int getAuditEntriesCountByApp(long applicationId)
|
@Override
|
||||||
{
|
public int getAuditEntriesCountByApp(long applicationId)
|
||||||
Map<String, Object> params = new HashMap<>();
|
{
|
||||||
params.put("auditAppId", applicationId);
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("auditAppId", applicationId);
|
||||||
int result = template.selectOne(SELECT_COUNT_ENTRIES_FOR_APP, params);
|
|
||||||
|
int result = template.selectOne(SELECT_COUNT_ENTRIES_FOR_APP, params);
|
||||||
return result;
|
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public int getAuditEntriesCountByAppAndProperties(org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
@Override
|
||||||
{
|
public int getAuditEntriesCountByAppAndProperties(String applicationName, org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
||||||
AuditQueryParameters dbParameters = convertFromRestAuditQueryParameters(parameters);
|
{
|
||||||
|
AuditQueryParameters dbParameters = convertFromRestAuditQueryParameters(parameters);
|
||||||
int result = template.selectOne(SELECT_COUNT_ENTRIES_FOR_APP_WITH_PROPERTIES, dbParameters);
|
|
||||||
|
int result = template.selectOne(SELECT_COUNT_ENTRIES_FOR_APP_WITH_PROPERTIES, dbParameters);
|
||||||
return result;
|
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
protected void findAuditEntries(
|
@Override
|
||||||
final AuditQueryRowHandler rowHandler,
|
protected void findAuditEntries(
|
||||||
int maxResults,
|
final AuditQueryRowHandler rowHandler,
|
||||||
org.alfresco.service.cmr.audit.AuditQueryParameters restParameters)
|
int maxResults,
|
||||||
{
|
org.alfresco.service.cmr.audit.AuditQueryParameters restParameters)
|
||||||
AuditQueryParameters params = convertFromRestAuditQueryParameters(restParameters);
|
{
|
||||||
if (params==null)
|
AuditQueryParameters params = convertFromRestAuditQueryParameters(restParameters);
|
||||||
{
|
if (params == null)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (maxResults > 0)
|
|
||||||
{
|
if (maxResults > 0)
|
||||||
// Query without getting the values. We gather all the results and batch-fetch the audited
|
{
|
||||||
// values afterwards.
|
// Query without getting the values. We gather all the results and batch-fetch the audited
|
||||||
final Map<Long, AuditQueryResult> resultsByValueId = new HashMap<Long, AuditQueryResult>(173);
|
// values afterwards.
|
||||||
PropertyFinderCallback propertyFinderCallback = new PropertyFinderCallback()
|
final Map<Long, AuditQueryResult> resultsByValueId = new HashMap<Long, AuditQueryResult>(173);
|
||||||
{
|
PropertyFinderCallback propertyFinderCallback = new PropertyFinderCallback() {
|
||||||
public void handleProperty(Long id, Serializable value)
|
public void handleProperty(Long id, Serializable value)
|
||||||
{
|
{
|
||||||
// get the row
|
// get the row
|
||||||
AuditQueryResult row = resultsByValueId.get(id);
|
AuditQueryResult row = resultsByValueId.get(id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
row.setAuditValue((Map<String, Serializable>) value);
|
row.setAuditValue((Map<String, Serializable>) value);
|
||||||
}
|
}
|
||||||
catch (ClassCastException e)
|
catch (ClassCastException e)
|
||||||
{
|
{
|
||||||
// The handler will deal with the entry
|
// The handler will deal with the entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
List<AuditQueryResult> rows = template.selectList(SELECT_ENTRIES_WITHOUT_VALUES, params, new RowBounds(0, maxResults));
|
List<AuditQueryResult> rows = template.selectList(SELECT_ENTRIES_WITHOUT_VALUES, params, new RowBounds(0, maxResults));
|
||||||
for (AuditQueryResult row : rows)
|
for (AuditQueryResult row : rows)
|
||||||
{
|
{
|
||||||
resultsByValueId.put(row.getAuditValuesId(), row);
|
resultsByValueId.put(row.getAuditValuesId(), row);
|
||||||
if (resultsByValueId.size() >= 100)
|
if (resultsByValueId.size() >= 100)
|
||||||
{
|
{
|
||||||
// Fetch values for the results. The treemap is ordered.
|
// Fetch values for the results. The treemap is ordered.
|
||||||
List<Long> valueIds = new ArrayList<Long>(resultsByValueId.keySet());
|
List<Long> valueIds = new ArrayList<Long>(resultsByValueId.keySet());
|
||||||
propertyValueDAO.getPropertiesByIds(valueIds, propertyFinderCallback);
|
propertyValueDAO.getPropertiesByIds(valueIds, propertyFinderCallback);
|
||||||
// Clear and continue
|
// Clear and continue
|
||||||
resultsByValueId.clear();
|
resultsByValueId.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Process any remaining results
|
// Process any remaining results
|
||||||
if (resultsByValueId.size() > 0)
|
if (resultsByValueId.size() > 0)
|
||||||
{
|
{
|
||||||
// Fetch values for the results. The treemap is ordered.
|
// Fetch values for the results. The treemap is ordered.
|
||||||
List<Long> valueIds = new ArrayList<Long>(resultsByValueId.keySet());
|
List<Long> valueIds = new ArrayList<Long>(resultsByValueId.keySet());
|
||||||
propertyValueDAO.getPropertiesByIds(valueIds, propertyFinderCallback);
|
propertyValueDAO.getPropertiesByIds(valueIds, propertyFinderCallback);
|
||||||
}
|
}
|
||||||
// Now pass the filled-out results to the row handler (order-preserved)
|
// Now pass the filled-out results to the row handler (order-preserved)
|
||||||
for (AuditQueryResult row : rows)
|
for (AuditQueryResult row : rows)
|
||||||
{
|
{
|
||||||
rowHandler.processResult(row);
|
rowHandler.processResult(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("maxResults must be greater than 0");
|
throw new IllegalArgumentException("maxResults must be greater than 0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,173 +1,159 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.domain.propval;
|
package org.alfresco.repo.domain.propval;
|
||||||
|
|
||||||
import org.alfresco.repo.domain.CrcHelper;
|
import org.alfresco.repo.domain.CrcHelper;
|
||||||
import org.alfresco.util.EqualsHelper;
|
import org.alfresco.util.EqualsHelper;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity bean for <b>alf_prop_string_value</b> table.
|
* Entity bean for <b>alf_prop_string_value</b> table.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public class PropertyStringValueEntity
|
public class PropertyStringValueEntity
|
||||||
{
|
{
|
||||||
public static final String EMPTY_STRING = "";
|
public static final String EMPTY_STRING = "";
|
||||||
public static final String EMPTY_STRING_REPLACEMENT = ".empty";
|
public static final String EMPTY_STRING_REPLACEMENT = ".empty";
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
private String stringValue;
|
private String stringValue;
|
||||||
private String stringEndLower;
|
private String stringEndLower;
|
||||||
private Long stringCrc;
|
private Long stringCrc;
|
||||||
private String stringLower;
|
|
||||||
|
public PropertyStringValueEntity()
|
||||||
public PropertyStringValueEntity()
|
{}
|
||||||
{
|
|
||||||
}
|
@Override
|
||||||
|
public int hashCode()
|
||||||
@Override
|
{
|
||||||
public int hashCode()
|
return (stringValue == null ? 0 : stringValue.hashCode());
|
||||||
{
|
}
|
||||||
return (stringValue == null ? 0 : stringValue.hashCode());
|
|
||||||
}
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
@Override
|
{
|
||||||
public boolean equals(Object obj)
|
if (this == obj)
|
||||||
{
|
{
|
||||||
if (this == obj)
|
return true;
|
||||||
{
|
}
|
||||||
return true;
|
else if (obj != null && obj instanceof PropertyStringValueEntity)
|
||||||
}
|
{
|
||||||
else if (obj != null && obj instanceof PropertyStringValueEntity)
|
PropertyStringValueEntity that = (PropertyStringValueEntity) obj;
|
||||||
{
|
return EqualsHelper.nullSafeEquals(this.stringValue, that.stringValue);
|
||||||
PropertyStringValueEntity that = (PropertyStringValueEntity) obj;
|
}
|
||||||
return EqualsHelper.nullSafeEquals(this.stringValue, that.stringValue);
|
else
|
||||||
}
|
{
|
||||||
else
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
|
public String toString()
|
||||||
@Override
|
{
|
||||||
public String toString()
|
StringBuilder sb = new StringBuilder(512);
|
||||||
{
|
sb.append("PropertyStringValueEntity")
|
||||||
StringBuilder sb = new StringBuilder(512);
|
.append("[ ID=").append(id)
|
||||||
sb.append("PropertyStringValueEntity")
|
.append(", stringValue=").append(stringValue)
|
||||||
.append("[ ID=").append(id)
|
.append("]");
|
||||||
.append(", stringValue=").append(stringValue)
|
return sb.toString();
|
||||||
.append("]");
|
}
|
||||||
return sb.toString();
|
|
||||||
}
|
public Pair<Long, String> getEntityPair()
|
||||||
|
{
|
||||||
public Pair<Long, String> getEntityPair()
|
if (stringValue != null && stringValue.equals(PropertyStringValueEntity.EMPTY_STRING_REPLACEMENT))
|
||||||
{
|
{
|
||||||
if (stringValue != null && stringValue.equals(PropertyStringValueEntity.EMPTY_STRING_REPLACEMENT))
|
return new Pair<Long, String>(id, PropertyStringValueEntity.EMPTY_STRING);
|
||||||
{
|
}
|
||||||
return new Pair<Long, String>(id, PropertyStringValueEntity.EMPTY_STRING);
|
else
|
||||||
}
|
{
|
||||||
else
|
return new Pair<Long, String>(id, stringValue);
|
||||||
{
|
}
|
||||||
return new Pair<Long, String>(id, stringValue);
|
}
|
||||||
}
|
|
||||||
}
|
/**
|
||||||
|
* Set the string and string-end values
|
||||||
/**
|
*/
|
||||||
* Set the string and string-end values
|
public void setValue(String value)
|
||||||
*/
|
{
|
||||||
public void setValue(String value)
|
if (value == null)
|
||||||
{
|
{
|
||||||
if (value == null)
|
throw new IllegalArgumentException("Null strings cannot be persisted");
|
||||||
{
|
}
|
||||||
throw new IllegalArgumentException("Null strings cannot be persisted");
|
if (value != null && value.equals(PropertyStringValueEntity.EMPTY_STRING))
|
||||||
}
|
{
|
||||||
if (value != null && value.equals(PropertyStringValueEntity.EMPTY_STRING))
|
// Oracle: We can't insert empty strings into the column.
|
||||||
{
|
value = PropertyStringValueEntity.EMPTY_STRING_REPLACEMENT;
|
||||||
// Oracle: We can't insert empty strings into the column.
|
}
|
||||||
value = PropertyStringValueEntity.EMPTY_STRING_REPLACEMENT;
|
stringValue = value;
|
||||||
}
|
// Calculate the crc value from the original value
|
||||||
stringValue = value;
|
Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(value, 16, false, true);
|
||||||
// Calculate the crc value from the original value
|
stringEndLower = crcPair.getFirst();
|
||||||
Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(value, 16, false, true);
|
stringCrc = crcPair.getSecond();
|
||||||
stringEndLower = crcPair.getFirst();
|
|
||||||
stringCrc = crcPair.getSecond();
|
}
|
||||||
// Calculate the crc value with case-insensitive
|
|
||||||
Pair<String, Long> crcPairWithCaseInSensitive = CrcHelper.getStringCrcPair(value, 16, false, false);
|
public Long getId()
|
||||||
stringLower = crcPairWithCaseInSensitive.getFirst();
|
{
|
||||||
}
|
return id;
|
||||||
|
}
|
||||||
public Long getId()
|
|
||||||
{
|
public void setId(Long id)
|
||||||
return id;
|
{
|
||||||
}
|
this.id = id;
|
||||||
|
}
|
||||||
public void setId(Long id)
|
|
||||||
{
|
public String getStringValue()
|
||||||
this.id = id;
|
{
|
||||||
}
|
return stringValue;
|
||||||
|
}
|
||||||
public String getStringValue()
|
|
||||||
{
|
public void setStringValue(String stringValue)
|
||||||
return stringValue;
|
{
|
||||||
}
|
this.stringValue = stringValue;
|
||||||
|
}
|
||||||
public void setStringValue(String stringValue)
|
|
||||||
{
|
public String getStringEndLower()
|
||||||
this.stringValue = stringValue;
|
{
|
||||||
}
|
return stringEndLower;
|
||||||
|
}
|
||||||
public String getStringEndLower()
|
|
||||||
{
|
public void setStringEndLower(String stringEndLower)
|
||||||
return stringEndLower;
|
{
|
||||||
}
|
this.stringEndLower = stringEndLower;
|
||||||
|
}
|
||||||
public void setStringEndLower(String stringEndLower)
|
|
||||||
{
|
public Long getStringCrc()
|
||||||
this.stringEndLower = stringEndLower;
|
{
|
||||||
}
|
return stringCrc;
|
||||||
|
}
|
||||||
public Long getStringCrc()
|
|
||||||
{
|
public void setStringCrc(Long stringCrc)
|
||||||
return stringCrc;
|
{
|
||||||
}
|
this.stringCrc = stringCrc;
|
||||||
|
}
|
||||||
public void setStringCrc(Long stringCrc)
|
}
|
||||||
{
|
|
||||||
this.stringCrc = stringCrc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStringLower()
|
|
||||||
{
|
|
||||||
return stringLower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStringLower(String stringLower)
|
|
||||||
{
|
|
||||||
this.stringLower = stringLower;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,329 +1,344 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.download;
|
package org.alfresco.repo.download;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.file.attribute.FileTime;
|
import java.nio.file.attribute.FileTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy;
|
||||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
import org.slf4j.Logger;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.alfresco.service.cmr.download.DownloadStatus;
|
|
||||||
import org.alfresco.service.cmr.download.DownloadStatus.Status;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||||
import org.alfresco.service.cmr.view.ExporterContext;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.view.ExporterException;
|
import org.alfresco.service.cmr.download.DownloadStatus;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.cmr.download.DownloadStatus.Status;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy;
|
import org.alfresco.service.cmr.view.ExporterContext;
|
||||||
import org.slf4j.Logger;
|
import org.alfresco.service.cmr.view.ExporterException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for exporting node content to a ZIP file
|
* Handler for exporting node content to a ZIP file
|
||||||
*
|
*
|
||||||
* @author Alex Miller
|
* @author Alex Miller
|
||||||
*/
|
*/
|
||||||
public class ZipDownloadExporter extends BaseExporter
|
public class ZipDownloadExporter extends BaseExporter
|
||||||
{
|
{
|
||||||
private static Logger log = LoggerFactory.getLogger(ZipDownloadExporter.class);
|
private static Logger log = LoggerFactory.getLogger(ZipDownloadExporter.class);
|
||||||
|
|
||||||
private static final String PATH_SEPARATOR = "/";
|
private static final String PATH_SEPARATOR = "/";
|
||||||
|
|
||||||
protected ZipArchiveOutputStream zipStream;
|
protected ZipArchiveOutputStream zipStream;
|
||||||
|
|
||||||
private NodeRef downloadNodeRef;
|
private NodeRef downloadNodeRef;
|
||||||
private int sequenceNumber = 1;
|
private int sequenceNumber = 1;
|
||||||
private long total;
|
private long total;
|
||||||
private long done;
|
private long done;
|
||||||
private long totalFileCount;
|
private long totalFileCount;
|
||||||
private long filesAddedCount;
|
private long filesAddedCount;
|
||||||
|
|
||||||
private RetryingTransactionHelper transactionHelper;
|
private RetryingTransactionHelper transactionHelper;
|
||||||
private DownloadStorage downloadStorage;
|
private DownloadStorage downloadStorage;
|
||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
private DownloadStatusUpdateService updateService;
|
private DownloadStatusUpdateService updateService;
|
||||||
|
|
||||||
private Deque<Pair<String, NodeRef>> path = new LinkedList<Pair<String, NodeRef>>();
|
private Deque<Pair<String, NodeRef>> path = new LinkedList<Pair<String, NodeRef>>();
|
||||||
private String currentName;
|
private String currentName;
|
||||||
|
|
||||||
private OutputStream outputStream;
|
private OutputStream outputStream;
|
||||||
private Date zipTimestampCreated;
|
private Date zipTimestampCreated;
|
||||||
private Date zipTimestampModified;
|
private Date zipTimestampModified;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
*
|
*
|
||||||
* @param zipFile File
|
* @param zipFile
|
||||||
* @param checkOutCheckInService CheckOutCheckInService
|
* File
|
||||||
* @param nodeService NodeService
|
* @param checkOutCheckInService
|
||||||
* @param transactionHelper RetryingTransactionHelper
|
* CheckOutCheckInService
|
||||||
* @param updateService DownloadStatusUpdateService
|
* @param nodeService
|
||||||
* @param downloadStorage DownloadStorage
|
* NodeService
|
||||||
* @param dictionaryService DictionaryService
|
* @param transactionHelper
|
||||||
* @param downloadNodeRef NodeRef
|
* RetryingTransactionHelper
|
||||||
* @param total long
|
* @param updateService
|
||||||
* @param totalFileCount long
|
* DownloadStatusUpdateService
|
||||||
*/
|
* @param downloadStorage
|
||||||
public ZipDownloadExporter(File zipFile, CheckOutCheckInService checkOutCheckInService, NodeService nodeService, RetryingTransactionHelper transactionHelper, DownloadStatusUpdateService updateService, DownloadStorage downloadStorage, DictionaryService dictionaryService, NodeRef downloadNodeRef, long total, long totalFileCount)
|
* DownloadStorage
|
||||||
{
|
* @param dictionaryService
|
||||||
super(checkOutCheckInService, nodeService);
|
* DictionaryService
|
||||||
try
|
* @param downloadNodeRef
|
||||||
{
|
* NodeRef
|
||||||
this.outputStream = new FileOutputStream(zipFile);
|
* @param total
|
||||||
this.updateService = updateService;
|
* long
|
||||||
this.transactionHelper = transactionHelper;
|
* @param totalFileCount
|
||||||
this.downloadStorage = downloadStorage;
|
* long
|
||||||
this.dictionaryService = dictionaryService;
|
*/
|
||||||
|
public ZipDownloadExporter(File zipFile, CheckOutCheckInService checkOutCheckInService, NodeService nodeService,
|
||||||
this.downloadNodeRef = downloadNodeRef;
|
RetryingTransactionHelper transactionHelper, DownloadStatusUpdateService updateService,
|
||||||
this.total = total;
|
DownloadStorage downloadStorage, DictionaryService dictionaryService,
|
||||||
this.totalFileCount = totalFileCount;
|
NodeRef downloadNodeRef, long total, long totalFileCount)
|
||||||
}
|
{
|
||||||
catch (FileNotFoundException e)
|
super(checkOutCheckInService, nodeService);
|
||||||
{
|
try
|
||||||
throw new ExporterException("Failed to create zip file", e);
|
{
|
||||||
}
|
this.outputStream = new FileOutputStream(zipFile);
|
||||||
}
|
this.updateService = updateService;
|
||||||
|
this.transactionHelper = transactionHelper;
|
||||||
@Override
|
this.downloadStorage = downloadStorage;
|
||||||
public void start(final ExporterContext context)
|
this.dictionaryService = dictionaryService;
|
||||||
{
|
|
||||||
zipStream = new ZipArchiveOutputStream(outputStream);
|
this.downloadNodeRef = downloadNodeRef;
|
||||||
// NOTE: This encoding allows us to workaround bug...
|
this.total = total;
|
||||||
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
|
this.totalFileCount = totalFileCount;
|
||||||
zipStream.setEncoding("UTF-8");
|
}
|
||||||
zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
|
catch (FileNotFoundException e)
|
||||||
zipStream.setUseLanguageEncodingFlag(true);
|
{
|
||||||
zipStream.setFallbackToUTF8(true);
|
throw new ExporterException("Failed to create zip file", e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void startNode(NodeRef nodeRef)
|
@Override
|
||||||
{
|
public void start(final ExporterContext context)
|
||||||
this.currentName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
{
|
||||||
this.zipTimestampCreated = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
|
zipStream = new ZipArchiveOutputStream(outputStream);
|
||||||
this.zipTimestampModified = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
// NOTE: This encoding allows us to workaround bug...
|
||||||
path.push(new Pair<String, NodeRef>(currentName, nodeRef));
|
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
|
||||||
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_FOLDER))
|
zipStream.setEncoding("UTF-8");
|
||||||
{
|
zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
|
||||||
String path = getPath() + PATH_SEPARATOR;
|
zipStream.setUseLanguageEncodingFlag(true);
|
||||||
ZipArchiveEntry archiveEntry = new ZipArchiveEntry(path);
|
zipStream.setFallbackToUTF8(true);
|
||||||
try
|
}
|
||||||
{
|
|
||||||
archiveEntry.setTime(zipTimestampCreated.getTime());
|
@Override
|
||||||
archiveEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
public void startNode(NodeRef nodeRef)
|
||||||
archiveEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
{
|
||||||
zipStream.putArchiveEntry(archiveEntry);
|
this.currentName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||||
zipStream.closeArchiveEntry();
|
this.zipTimestampCreated = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
|
||||||
}
|
this.zipTimestampModified = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||||
catch (IOException e)
|
path.push(new Pair<String, NodeRef>(currentName, nodeRef));
|
||||||
{
|
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_FOLDER))
|
||||||
throw new ExporterException("Unexpected IOException adding folder entry", e);
|
{
|
||||||
}
|
String path = getPath() + PATH_SEPARATOR;
|
||||||
}
|
ZipArchiveEntry archiveEntry = new ZipArchiveEntry(path);
|
||||||
}
|
try
|
||||||
|
{
|
||||||
@Override
|
archiveEntry.setTime(zipTimestampCreated.getTime());
|
||||||
public void contentImpl(NodeRef nodeRef, QName property, InputStream content, ContentData contentData, int index)
|
archiveEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
||||||
{
|
archiveEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
||||||
// if the content stream to output is empty, then just return content descriptor as is
|
zipStream.putArchiveEntry(archiveEntry);
|
||||||
if (content == null)
|
zipStream.closeArchiveEntry();
|
||||||
{
|
}
|
||||||
return;
|
catch (IOException e)
|
||||||
}
|
{
|
||||||
|
throw new ExporterException("Unexpected IOException adding folder entry", e);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
if (log.isDebugEnabled())
|
}
|
||||||
{
|
|
||||||
log.debug("Archiving content for nodeRef: "+nodeRef+" with contentURL: "+contentData.getContentUrl());
|
@Override
|
||||||
}
|
public void contentImpl(NodeRef nodeRef, QName property, InputStream content, ContentData contentData, int index)
|
||||||
// ALF-2016
|
{
|
||||||
ZipArchiveEntry zipEntry=new ZipArchiveEntry(getPath());
|
// if the content stream to output is empty, then just return content descriptor as is
|
||||||
zipEntry.setTime(zipTimestampCreated.getTime());
|
if (content == null)
|
||||||
zipEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
{
|
||||||
zipEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
log.info("Archiving content has been removed or modified for the specified NodeReference: " + nodeRef
|
||||||
zipStream.putArchiveEntry(zipEntry);
|
+ ", and the size of the content is " + contentData.getSize());
|
||||||
|
return;
|
||||||
// copy export stream to zip
|
}
|
||||||
copyStream(zipStream, content);
|
|
||||||
|
try
|
||||||
zipStream.closeArchiveEntry();
|
{
|
||||||
filesAddedCount = filesAddedCount + 1;
|
if (log.isDebugEnabled())
|
||||||
}
|
{
|
||||||
catch (IOException e)
|
log.debug("Archiving content for nodeRef: " + nodeRef + " with contentURL: "
|
||||||
{
|
+ contentData.getContentUrl());
|
||||||
throw new ExporterException("Failed to zip export stream", e);
|
}
|
||||||
}
|
// ALF-2016
|
||||||
}
|
ZipArchiveEntry zipEntry = new ZipArchiveEntry(getPath());
|
||||||
|
zipEntry.setTime(zipTimestampCreated.getTime());
|
||||||
@Override
|
zipEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
||||||
public void endNode(NodeRef nodeRef)
|
zipEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
||||||
{
|
zipStream.putArchiveEntry(zipEntry);
|
||||||
path.pop();
|
|
||||||
}
|
// copy export stream to zip
|
||||||
|
copyStream(zipStream, content);
|
||||||
@Override
|
|
||||||
public void end()
|
zipStream.closeArchiveEntry();
|
||||||
{
|
filesAddedCount = filesAddedCount + 1;
|
||||||
try
|
}
|
||||||
{
|
catch (IOException e)
|
||||||
zipStream.close();
|
{
|
||||||
}
|
throw new ExporterException("Failed to zip export stream", e);
|
||||||
catch (IOException error)
|
}
|
||||||
{
|
}
|
||||||
throw new ExporterException("Unexpected error closing zip stream!", error);
|
|
||||||
}
|
@Override
|
||||||
}
|
public void endNode(NodeRef nodeRef)
|
||||||
|
{
|
||||||
private String getPath()
|
path.pop();
|
||||||
{
|
}
|
||||||
if (path.size() < 1)
|
|
||||||
{
|
@Override
|
||||||
throw new IllegalStateException("No elements in path!");
|
public void end()
|
||||||
}
|
{
|
||||||
|
try
|
||||||
Iterator<Pair<String, NodeRef>> iter = path.descendingIterator();
|
{
|
||||||
StringBuilder pathBuilder = new StringBuilder();
|
zipStream.close();
|
||||||
|
}
|
||||||
while (iter.hasNext())
|
catch (IOException error)
|
||||||
{
|
{
|
||||||
Pair<String, NodeRef> element = iter.next();
|
throw new ExporterException("Unexpected error closing zip stream!", error);
|
||||||
|
}
|
||||||
pathBuilder.append(element.getFirst());
|
}
|
||||||
if (iter.hasNext())
|
|
||||||
{
|
private String getPath()
|
||||||
pathBuilder.append(PATH_SEPARATOR);
|
{
|
||||||
}
|
if (path.size() < 1)
|
||||||
}
|
{
|
||||||
|
throw new IllegalStateException("No elements in path!");
|
||||||
return pathBuilder.toString();
|
}
|
||||||
}
|
|
||||||
|
Iterator<Pair<String, NodeRef>> iter = path.descendingIterator();
|
||||||
/**
|
StringBuilder pathBuilder = new StringBuilder();
|
||||||
* Copy input stream to output stream
|
|
||||||
*
|
while (iter.hasNext())
|
||||||
* @param output output stream
|
{
|
||||||
* @param in input stream
|
Pair<String, NodeRef> element = iter.next();
|
||||||
* @throws IOException
|
|
||||||
*/
|
pathBuilder.append(element.getFirst());
|
||||||
private void copyStream(OutputStream output, InputStream in)
|
if (iter.hasNext())
|
||||||
throws IOException
|
{
|
||||||
{
|
pathBuilder.append(PATH_SEPARATOR);
|
||||||
byte[] buffer = new byte[2048 * 10];
|
}
|
||||||
int read = in.read(buffer, 0, 2048 *10);
|
}
|
||||||
int i = 0;
|
|
||||||
while (read != -1)
|
return pathBuilder.toString();
|
||||||
{
|
}
|
||||||
output.write(buffer, 0, read);
|
|
||||||
done = done + read;
|
/**
|
||||||
|
* Copy input stream to output stream
|
||||||
// ALF-16289 - only update the status every 10MB
|
*
|
||||||
if (i++%500 == 0)
|
* @param output
|
||||||
{
|
* output stream
|
||||||
updateStatus();
|
* @param in
|
||||||
checkCancelled();
|
* input stream
|
||||||
}
|
* @throws IOException
|
||||||
|
*/
|
||||||
read = in.read(buffer, 0, 2048 *10);
|
private void copyStream(OutputStream output, InputStream in) throws IOException
|
||||||
}
|
{
|
||||||
}
|
byte[] buffer = new byte[2048 * 10];
|
||||||
|
int read = in.read(buffer, 0, 2048 * 10);
|
||||||
private void checkCancelled()
|
int i = 0;
|
||||||
{
|
while (read != -1)
|
||||||
boolean downloadCancelled = transactionHelper.doInTransaction(new RetryingTransactionCallback<Boolean>()
|
{
|
||||||
{
|
output.write(buffer, 0, read);
|
||||||
@Override
|
done = done + read;
|
||||||
public Boolean execute() throws Throwable
|
|
||||||
{
|
// ALF-16289 - only update the status every 10MB
|
||||||
return downloadStorage.isCancelled(downloadNodeRef);
|
if (i++ % 500 == 0)
|
||||||
}
|
{
|
||||||
}, true, true);
|
updateStatus();
|
||||||
|
checkCancelled();
|
||||||
if ( downloadCancelled == true)
|
}
|
||||||
{
|
|
||||||
log.debug("Download cancelled");
|
read = in.read(buffer, 0, 2048 * 10);
|
||||||
throw new DownloadCancelledException();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void checkCancelled()
|
||||||
private void updateStatus()
|
{
|
||||||
{
|
boolean downloadCancelled = transactionHelper.doInTransaction(new RetryingTransactionCallback<Boolean>() {
|
||||||
transactionHelper.doInTransaction(new RetryingTransactionCallback<Object>()
|
@Override
|
||||||
{
|
public Boolean execute() throws Throwable
|
||||||
@Override
|
{
|
||||||
public Object execute() throws Throwable
|
return downloadStorage.isCancelled(downloadNodeRef);
|
||||||
{
|
}
|
||||||
DownloadStatus status = new DownloadStatus(Status.IN_PROGRESS, done, total, filesAddedCount, totalFileCount);
|
}, true, true);
|
||||||
|
|
||||||
updateService.update(downloadNodeRef, status, getNextSequenceNumber());
|
if (downloadCancelled == true)
|
||||||
return null;
|
{
|
||||||
}
|
log.debug("Download cancelled");
|
||||||
}, false, true);
|
throw new DownloadCancelledException();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public int getNextSequenceNumber()
|
|
||||||
{
|
private void updateStatus()
|
||||||
return sequenceNumber++;
|
{
|
||||||
}
|
transactionHelper.doInTransaction(new RetryingTransactionCallback<Object>() {
|
||||||
|
@Override
|
||||||
public long getDone()
|
public Object execute() throws Throwable
|
||||||
{
|
{
|
||||||
return done;
|
DownloadStatus status = new DownloadStatus(Status.IN_PROGRESS, done, total, filesAddedCount, totalFileCount);
|
||||||
}
|
|
||||||
|
updateService.update(downloadNodeRef, status, getNextSequenceNumber());
|
||||||
public long getTotal()
|
return null;
|
||||||
{
|
}
|
||||||
return total;
|
}, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getFilesAdded()
|
public int getNextSequenceNumber()
|
||||||
{
|
{
|
||||||
return filesAddedCount;
|
return sequenceNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTotalFiles()
|
public long getDone()
|
||||||
{
|
{
|
||||||
return totalFileCount;
|
return done;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public long getTotal()
|
||||||
|
{
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getFilesAdded()
|
||||||
|
{
|
||||||
|
return filesAddedCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTotalFiles()
|
||||||
|
{
|
||||||
|
return totalFileCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -25,14 +25,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.site;
|
package org.alfresco.repo.site;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.alfresco.api.AlfrescoPublicApi;
|
import org.alfresco.api.AlfrescoPublicApi;
|
||||||
import org.alfresco.query.CannedQuerySortDetails;
|
import org.alfresco.query.CannedQuerySortDetails;
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conveys information for a member of a site.
|
* Conveys information for a member of a site.
|
||||||
*
|
*
|
||||||
@@ -52,7 +53,7 @@ public class SiteMembership extends AbstractSiteMembership
|
|||||||
public SiteMembership(SiteInfo siteInfo, String id, String firstName, String lastName,
|
public SiteMembership(SiteInfo siteInfo, String id, String firstName, String lastName,
|
||||||
String role)
|
String role)
|
||||||
{
|
{
|
||||||
super(siteInfo,id, role);
|
super(siteInfo, id, role);
|
||||||
if (firstName == null)
|
if (firstName == null)
|
||||||
{
|
{
|
||||||
throw new java.lang.IllegalArgumentException(
|
throw new java.lang.IllegalArgumentException(
|
||||||
@@ -76,13 +77,8 @@ public class SiteMembership extends AbstractSiteMembership
|
|||||||
throw new java.lang.IllegalArgumentException(
|
throw new java.lang.IllegalArgumentException(
|
||||||
"FirstName required building site membership of " + siteInfo.getShortName());
|
"FirstName required building site membership of " + siteInfo.getShortName());
|
||||||
}
|
}
|
||||||
if (lastName == null)
|
|
||||||
{
|
|
||||||
throw new java.lang.IllegalArgumentException(
|
|
||||||
"LastName required building site membership of " + siteInfo.getShortName());
|
|
||||||
}
|
|
||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
this.lastName = lastName;
|
this.lastName = Optional.ofNullable(lastName).orElse("");
|
||||||
this.isMemberOfGroup = isMemberOfGroup;
|
this.isMemberOfGroup = isMemberOfGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +160,6 @@ public class SiteMembership extends AbstractSiteMembership
|
|||||||
", isMemberOfGroup = " + isMemberOfGroup + "]";
|
", isMemberOfGroup = " + isMemberOfGroup + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int compareTo(List<Pair<? extends Object, CannedQuerySortDetails.SortOrder>> sortPairs, SiteMembership o1, SiteMembership o2)
|
static int compareTo(List<Pair<? extends Object, CannedQuerySortDetails.SortOrder>> sortPairs, SiteMembership o1, SiteMembership o2)
|
||||||
{
|
{
|
||||||
String personId1 = o1.getPersonId();
|
String personId1 = o1.getPersonId();
|
||||||
|
|||||||
@@ -1,266 +1,299 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.service.cmr.audit;
|
package org.alfresco.service.cmr.audit;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The public API by which applications can query the audit logs and enable or disable auditing.
|
* The public API by which applications can query the audit logs and enable or disable auditing.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
public interface AuditService
|
public interface AuditService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return Returns <tt>true</tt> if auditing is globally enabled
|
* @return Returns <tt>true</tt> if auditing is globally enabled
|
||||||
*
|
*
|
||||||
* @since 3.4
|
* @since 3.4
|
||||||
*/
|
*/
|
||||||
boolean isAuditEnabled();
|
boolean isAuditEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable the global auditing state
|
* Enable or disable the global auditing state
|
||||||
*
|
*
|
||||||
* @param enable <tt>true</tt> to enable auditing globally or <tt>false</tt> to disable
|
* @param enable
|
||||||
*
|
* <tt>true</tt> to enable auditing globally or <tt>false</tt> to disable
|
||||||
* @since 3.4
|
*
|
||||||
*/
|
* @since 3.4
|
||||||
void setAuditEnabled(boolean enable);
|
*/
|
||||||
|
void setAuditEnabled(boolean enable);
|
||||||
/**
|
|
||||||
* Helper bean to carry information about an audit application.
|
/**
|
||||||
*
|
* Helper bean to carry information about an audit application.
|
||||||
* @author Derek Hulley
|
*
|
||||||
* @since 3.4
|
* @author Derek Hulley
|
||||||
*/
|
* @since 3.4
|
||||||
public static class AuditApplication
|
*/
|
||||||
{
|
public static class AuditApplication
|
||||||
private final String name;
|
{
|
||||||
private final String key;
|
private final String name;
|
||||||
private final boolean enabled;
|
private final String key;
|
||||||
/**
|
private final boolean enabled;
|
||||||
* Constructor for final variables
|
|
||||||
*/
|
/**
|
||||||
public AuditApplication(String name, String key, boolean enabled)
|
* Constructor for final variables
|
||||||
{
|
*/
|
||||||
this.name = name;
|
public AuditApplication(String name, String key, boolean enabled)
|
||||||
this.key = key;
|
{
|
||||||
this.enabled = enabled;
|
this.name = name;
|
||||||
}
|
this.key = key;
|
||||||
public String getName()
|
this.enabled = enabled;
|
||||||
{
|
}
|
||||||
return name;
|
|
||||||
}
|
public String getName()
|
||||||
public String getKey()
|
{
|
||||||
{
|
return name;
|
||||||
return key;
|
}
|
||||||
}
|
|
||||||
public boolean isEnabled()
|
public String getKey()
|
||||||
{
|
{
|
||||||
return enabled;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public boolean isEnabled()
|
||||||
/**
|
{
|
||||||
* Get all registered audit applications
|
return enabled;
|
||||||
*
|
}
|
||||||
* @return Returns a map of audit applications keyed by their name
|
}
|
||||||
*
|
|
||||||
* @since 3.4
|
/**
|
||||||
*/
|
* Get all registered audit applications
|
||||||
Map<String, AuditApplication> getAuditApplications();
|
*
|
||||||
|
* @return Returns a map of audit applications keyed by their name
|
||||||
/**
|
*
|
||||||
* @param applicationName the name of the application to check
|
* @since 3.4
|
||||||
* @param path the path to check
|
*/
|
||||||
* @return Returns <tt>true</tt> if auditing is enabled for the given path
|
Map<String, AuditApplication> getAuditApplications();
|
||||||
*
|
|
||||||
* @since 3.2
|
/**
|
||||||
*/
|
* @param applicationName
|
||||||
boolean isAuditEnabled(String applicationName, String path);
|
* the name of the application to check
|
||||||
|
* @param path
|
||||||
/**
|
* the path to check
|
||||||
* Enable auditing for an application path
|
* @return Returns <tt>true</tt> if auditing is enabled for the given path
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application to check
|
* @since 3.2
|
||||||
* @param path the path to enable
|
*/
|
||||||
*
|
boolean isAuditEnabled(String applicationName, String path);
|
||||||
* @since 3.2
|
|
||||||
*/
|
/**
|
||||||
void enableAudit(String applicationName, String path);
|
* Enable auditing for an application path
|
||||||
|
*
|
||||||
/**
|
* @param applicationName
|
||||||
* Disable auditing for an application path
|
* the name of the application to check
|
||||||
*
|
* @param path
|
||||||
* @param applicationName the name of the application to check
|
* the path to enable
|
||||||
* @param path the path to disable
|
*
|
||||||
*
|
* @since 3.2
|
||||||
* @since 3.2
|
*/
|
||||||
*/
|
void enableAudit(String applicationName, String path);
|
||||||
void disableAudit(String applicationName, String path);
|
|
||||||
|
/**
|
||||||
/**
|
* Disable auditing for an application path
|
||||||
* Remove all audit entries for the given application
|
*
|
||||||
*
|
* @param applicationName
|
||||||
* @param applicationName the name of the application for which to remove entries
|
* the name of the application to check
|
||||||
* @return Returns the number of audit entries deleted
|
* @param path
|
||||||
*
|
* the path to disable
|
||||||
* @since 3.2
|
*
|
||||||
*
|
* @since 3.2
|
||||||
* @deprecated Use {@link #clearAudit(String, Long, Long)}
|
*/
|
||||||
*/
|
void disableAudit(String applicationName, String path);
|
||||||
int clearAudit(String applicationName);
|
|
||||||
|
/**
|
||||||
/**
|
* Remove all audit entries for the given application
|
||||||
* Remove audit entries for the given application between the time ranges. If no start
|
*
|
||||||
* time is given then entries are deleted as far back as they exist. If no end time is
|
* @param applicationName
|
||||||
* given then entries are deleted up until the current time.
|
* the name of the application for which to remove entries
|
||||||
*
|
* @return Returns the number of audit entries deleted
|
||||||
* @param applicationName the name of the application for which to remove entries
|
*
|
||||||
* @param fromTime the start time of entries to remove (inclusive and optional)
|
* @since 3.2
|
||||||
* @param toTime the end time of entries to remove (exclusive and optional)
|
*
|
||||||
* @return Returns the number of audit entries deleted
|
* @deprecated Use {@link #clearAudit(String, Long, Long)}
|
||||||
*
|
*/
|
||||||
* @since 3.4
|
int clearAudit(String applicationName);
|
||||||
*/
|
|
||||||
int clearAudit(String applicationName, Long fromTime, Long toTime);
|
/**
|
||||||
|
* Remove audit entries for the given application between the time ranges. If no start time is given then entries are deleted as far back as they exist. If no end time is given then entries are deleted up until the current time.
|
||||||
/**
|
*
|
||||||
* Remove audit entries for the given application between the audit entry ids.
|
* @param applicationName
|
||||||
*
|
* the name of the application for which to remove entries
|
||||||
* @param applicationName the name of the application for which to remove entries
|
* @param fromTime
|
||||||
* @param fromId the start time of entries to remove (inclusive and optional)
|
* the start time of entries to remove (inclusive and optional)
|
||||||
* @param toId the end time of entries to remove (exclusive and optional)
|
* @param toTime
|
||||||
* @return Returns the number of audit entries deleted
|
* the end time of entries to remove (exclusive and optional)
|
||||||
*
|
* @return Returns the number of audit entries deleted
|
||||||
* @since 5.2.2
|
*
|
||||||
*/
|
* @since 3.4
|
||||||
int clearAuditByIdRange(String applicationName, Long fromId, Long toId);
|
*/
|
||||||
|
int clearAudit(String applicationName, Long fromTime, Long toTime);
|
||||||
/**
|
|
||||||
* Delete a discrete list of audit entries.
|
/**
|
||||||
* <p/>
|
* Remove audit entries for the given application between the audit entry ids.
|
||||||
* This method should not be called <i>while</i> processing
|
*
|
||||||
* {@link #auditQuery(AuditQueryCallback, AuditQueryParameters, int) query results}.
|
* @param applicationName
|
||||||
*
|
* the name of the application for which to remove entries
|
||||||
* @param auditEntryIds the IDs of all audit entries to delete
|
* @param fromId
|
||||||
* @return Returns the number of audit entries deleted
|
* the start time of entries to remove (inclusive and optional)
|
||||||
*
|
* @param toId
|
||||||
* @since 3.4
|
* the end time of entries to remove (exclusive and optional)
|
||||||
*/
|
* @return Returns the number of audit entries deleted
|
||||||
int clearAudit(List<Long> auditEntryIds);
|
*
|
||||||
|
* @since 5.2.2
|
||||||
/**
|
*/
|
||||||
* The interface that will be used to give query results to the calling code.
|
int clearAuditByIdRange(String applicationName, Long fromId, Long toId);
|
||||||
*
|
|
||||||
* @since 3.2
|
/**
|
||||||
*/
|
* Delete a discrete list of audit entries.
|
||||||
public static interface AuditQueryCallback
|
* <p/>
|
||||||
{
|
* This method should not be called <i>while</i> processing {@link #auditQuery(AuditQueryCallback, AuditQueryParameters, int) query results}.
|
||||||
/**
|
*
|
||||||
* Determines whether this callback requires the values argument to be populated when {@link #handleAuditEntry}
|
* @param auditEntryIds
|
||||||
* is called.
|
* the IDs of all audit entries to delete
|
||||||
*
|
* @return Returns the number of audit entries deleted
|
||||||
* @return <code>true</code> if this callback requires the values argument to be populated
|
*
|
||||||
*/
|
* @since 3.4
|
||||||
boolean valuesRequired();
|
*/
|
||||||
|
int clearAudit(List<Long> auditEntryIds);
|
||||||
/**
|
|
||||||
* Handle a row of audit entry data.
|
/**
|
||||||
*
|
* The interface that will be used to give query results to the calling code.
|
||||||
* @param entryId the unique audit entry ID
|
*
|
||||||
* @param applicationName the name of the application
|
* @since 3.2
|
||||||
* @param user the user that logged the entry
|
*/
|
||||||
* @param time the time of the entry
|
public static interface AuditQueryCallback
|
||||||
* @param values the values map as created
|
{
|
||||||
* @return Return <tt>true</tt> to continue processing rows or <tt>false</tt> to stop
|
/**
|
||||||
*/
|
* Determines whether this callback requires the values argument to be populated when {@link #handleAuditEntry} is called.
|
||||||
boolean handleAuditEntry(
|
*
|
||||||
Long entryId,
|
* @return <code>true</code> if this callback requires the values argument to be populated
|
||||||
String applicationName,
|
*/
|
||||||
String user,
|
boolean valuesRequired();
|
||||||
long time,
|
|
||||||
Map<String, Serializable> values);
|
/**
|
||||||
|
* Handle a row of audit entry data.
|
||||||
/**
|
*
|
||||||
* Handle audit entry failures
|
* @param entryId
|
||||||
*
|
* the unique audit entry ID
|
||||||
* @param entryId the entry ID
|
* @param applicationName
|
||||||
* @param errorMsg the error message
|
* the name of the application
|
||||||
* @param error the exception causing the error (may be <tt>null</tt>)
|
* @param user
|
||||||
* @return Return <tt>true</tt> to continue processing rows or <tt>false</tt> to stop
|
* the user that logged the entry
|
||||||
*/
|
* @param time
|
||||||
boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error);
|
* the time of the entry
|
||||||
}
|
* @param values
|
||||||
|
* the values map as created
|
||||||
/**
|
* @return Return <tt>true</tt> to continue processing rows or <tt>false</tt> to stop
|
||||||
* Issue an audit query using the given parameters and consuming results in the callback.
|
*/
|
||||||
* Results are returned in entry order, corresponding to time order.
|
boolean handleAuditEntry(
|
||||||
*
|
Long entryId,
|
||||||
* @param callback the callback that will handle results
|
String applicationName,
|
||||||
* @param parameters the parameters for the query (may not be <tt>null</tt>)
|
String user,
|
||||||
* @param maxResults the maximum number of results to retrieve (must be greater than 0)
|
long time,
|
||||||
*
|
Map<String, Serializable> values);
|
||||||
* @throws IllegalArgumentException if maxResults less or equal to zero
|
|
||||||
*
|
/**
|
||||||
* @since 3.3
|
* Handle audit entry failures
|
||||||
*/
|
*
|
||||||
void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults);
|
* @param entryId
|
||||||
|
* the entry ID
|
||||||
/**
|
* @param errorMsg
|
||||||
* Issue an audit query to retrieve min / max audit record id for a given application.
|
* the error message
|
||||||
*
|
* @param error
|
||||||
* @param applicationName the name of the application
|
* the exception causing the error (may be <tt>null</tt>)
|
||||||
* @param extremes a list containing min/max or both
|
* @return Return <tt>true</tt> to continue processing rows or <tt>false</tt> to stop
|
||||||
* @return a map containing min/max and the associated value
|
*/
|
||||||
*/
|
boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error);
|
||||||
HashMap<String, Long> getAuditMinMaxByApp(String applicationName, List<String> extremes);
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Issue an audit query to retrieve min / max audit record id for a given application.
|
* Issue an audit query using the given parameters and consuming results in the callback. Results are returned in entry order, corresponding to time order.
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application
|
* @param callback
|
||||||
* @return a map containing min/max and the associated value
|
* the callback that will handle results
|
||||||
*/
|
* @param parameters
|
||||||
default int getAuditEntriesCountByApp(String applicationName)
|
* the parameters for the query (may not be <tt>null</tt>)
|
||||||
{
|
* @param maxResults
|
||||||
return -1;
|
* the maximum number of results to retrieve (must be greater than 0)
|
||||||
}
|
*
|
||||||
|
* @throws IllegalArgumentException
|
||||||
/**
|
* if maxResults less or equal to zero
|
||||||
* Issue an audit query to retrieve min / max audit record id for a given application and properties
|
*
|
||||||
*
|
* @since 3.3
|
||||||
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
*/
|
||||||
* @return a map containing min/max and the associated value
|
void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults);
|
||||||
*/
|
|
||||||
default int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
/**
|
||||||
{
|
* Issue an audit query to retrieve min / max audit record id for a given application.
|
||||||
return -1;
|
*
|
||||||
}
|
* @param applicationName
|
||||||
}
|
* the name of the application
|
||||||
|
* @param extremes
|
||||||
|
* a list containing min/max or both
|
||||||
|
* @return a map containing min/max and the associated value
|
||||||
|
*/
|
||||||
|
HashMap<String, Long> getAuditMinMaxByApp(String applicationName, List<String> extremes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Issue an audit query to retrieve min / max audit record id for a given application.
|
||||||
|
*
|
||||||
|
* @param applicationName
|
||||||
|
* the name of the application
|
||||||
|
* @return a map containing min/max and the associated value
|
||||||
|
*/
|
||||||
|
default int getAuditEntriesCountByApp(String applicationName)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Issue an audit query to retrieve min / max audit record id for a given application and properties
|
||||||
|
*
|
||||||
|
* @param applicationName
|
||||||
|
* the name of the application
|
||||||
|
* @param parameters
|
||||||
|
* audit parameters provided by the <code>where</code> clause on the ReST API
|
||||||
|
* @return a map containing min/max and the associated value
|
||||||
|
*/
|
||||||
|
default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
repository.name=Main Repository
|
repository.name=Main Repository
|
||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
version.schema=19300
|
version.schema=20000
|
||||||
|
|
||||||
# Directory configuration
|
# Directory configuration
|
||||||
|
|
||||||
|
|||||||
@@ -1,136 +1,137 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.site;
|
package org.alfresco.repo.site;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.junit.Before;
|
||||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
import org.junit.Test;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
/**
|
|
||||||
* Test Membership constructor logs. Based on REPO-2520
|
/**
|
||||||
*
|
* Test Membership constructor logs. Based on REPO-2520
|
||||||
* @author Alexandru Epure
|
*
|
||||||
*/
|
* @author Alexandru Epure
|
||||||
public class SiteMembershipTest
|
*/
|
||||||
{
|
public class SiteMembershipTest
|
||||||
SiteInfo siteInfo;
|
{
|
||||||
SiteMembership siteMember;
|
SiteInfo siteInfo;
|
||||||
String personId = UUID.randomUUID().toString();
|
SiteMembership siteMember;
|
||||||
String firstName = UUID.randomUUID().toString();
|
String personId = UUID.randomUUID().toString();
|
||||||
String lastName = UUID.randomUUID().toString();
|
String firstName = UUID.randomUUID().toString();
|
||||||
String role = "Consumer";
|
String lastName = UUID.randomUUID().toString();
|
||||||
|
String role = "Consumer";
|
||||||
String idErrorMessage = "Id required building site membership";
|
|
||||||
String firstNameErrorMessage = "FirstName required building site membership of ";
|
String idErrorMessage = "Id required building site membership";
|
||||||
String lastNameErrorMessage = "LastName required building site membership of ";
|
String firstNameErrorMessage = "FirstName required building site membership of ";
|
||||||
String roleErrorMessage = "Role required building site membership";
|
String lastNameErrorMessage = "LastName required building site membership of ";
|
||||||
|
String roleErrorMessage = "Role required building site membership";
|
||||||
@Before
|
|
||||||
public void createSite()
|
@Before
|
||||||
{
|
public void createSite()
|
||||||
String sitePreset = "testSiteMembershipPreset";
|
{
|
||||||
String shortName = "testSiteMembershipShortName";
|
var sitePreset = "testSiteMembershipPreset";
|
||||||
String title = "testSiteMembershipTile";
|
var shortName = "testSiteMembershipShortName";
|
||||||
String description = "testSiteMembershipDescription";
|
var title = "testSiteMembershipTile";
|
||||||
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description,
|
var description = "testSiteMembershipDescription";
|
||||||
SiteVisibility.PUBLIC, null);
|
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description,
|
||||||
}
|
SiteVisibility.PUBLIC, null);
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testNullpersonInfo() throws Exception
|
@Test
|
||||||
{
|
public void testNullpersonInfo() throws Exception
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
siteMember = new SiteMembership(siteInfo, null, firstName, lastName, role);
|
{
|
||||||
}
|
siteMember = new SiteMembership(siteInfo, null, firstName, lastName, role);
|
||||||
catch (IllegalArgumentException e)
|
}
|
||||||
{
|
catch (IllegalArgumentException e)
|
||||||
assertEquals(idErrorMessage, e.getMessage());
|
{
|
||||||
}
|
assertEquals(idErrorMessage, e.getMessage());
|
||||||
|
}
|
||||||
try
|
|
||||||
{
|
try
|
||||||
siteMember = new SiteMembership(siteInfo, null, role);
|
{
|
||||||
}
|
siteMember = new SiteMembership(siteInfo, null, role);
|
||||||
catch (IllegalArgumentException e)
|
}
|
||||||
{
|
catch (IllegalArgumentException e)
|
||||||
assertEquals(idErrorMessage, e.getMessage());
|
{
|
||||||
}
|
assertEquals(idErrorMessage, e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testNullRole() throws Exception
|
@Test
|
||||||
{
|
public void testNullRole() throws Exception
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
siteMember = new SiteMembership(siteInfo, personId, firstName, lastName, null);
|
{
|
||||||
}
|
siteMember = new SiteMembership(siteInfo, personId, firstName, lastName, null);
|
||||||
catch (IllegalArgumentException e)
|
}
|
||||||
{
|
catch (IllegalArgumentException e)
|
||||||
assertEquals(roleErrorMessage, e.getMessage());
|
{
|
||||||
}
|
assertEquals(roleErrorMessage, e.getMessage());
|
||||||
|
}
|
||||||
try
|
|
||||||
{
|
try
|
||||||
siteMember = new SiteMembership(siteInfo, personId, null);
|
{
|
||||||
}
|
siteMember = new SiteMembership(siteInfo, personId, null);
|
||||||
catch (IllegalArgumentException e)
|
}
|
||||||
{
|
catch (IllegalArgumentException e)
|
||||||
assertEquals(roleErrorMessage, e.getMessage());
|
{
|
||||||
}
|
assertEquals(roleErrorMessage, e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testNullFirstName() throws Exception
|
@Test
|
||||||
{
|
public void testNullFirstName() throws Exception
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
siteMember = new SiteMembership(siteInfo, personId, null, lastName, role);
|
{
|
||||||
}
|
siteMember = new SiteMembership(siteInfo, personId, null, lastName, role);
|
||||||
catch (IllegalArgumentException e)
|
}
|
||||||
{
|
catch (IllegalArgumentException e)
|
||||||
assertEquals(firstNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
{
|
||||||
}
|
assertEquals(firstNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testNullLastName() throws Exception
|
@Test
|
||||||
{
|
public void testNullLastName() throws Exception
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
siteMember = new SiteMembership(siteInfo, personId, firstName, null, role);
|
{
|
||||||
}
|
siteMember = new SiteMembership(siteInfo, personId, firstName, null, role);
|
||||||
catch (IllegalArgumentException e)
|
}
|
||||||
{
|
catch (IllegalArgumentException e)
|
||||||
assertEquals(lastNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
{
|
||||||
}
|
assertEquals(lastNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ identity-service.enable-pkce=true
|
|||||||
identity-service.ignore-oauth-query-parameter=true
|
identity-service.ignore-oauth-query-parameter=true
|
||||||
identity-service.credentials.secret=
|
identity-service.credentials.secret=
|
||||||
identity-service.credentials.provider=secret
|
identity-service.credentials.provider=secret
|
||||||
identity-service.client-socket-timeout=1000
|
identity-service.client-socket-timeout=3000
|
||||||
identity-service.client-connection-timeout=3000
|
identity-service.client-connection-timeout=3000
|
||||||
identity-service.authentication.enable-username-password-authentication=true
|
identity-service.authentication.enable-username-password-authentication=true
|
||||||
|
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ services:
|
|||||||
CLIENT_SSL_TRUST_STORE_TYPE: "JCEKS"
|
CLIENT_SSL_TRUST_STORE_TYPE: "JCEKS"
|
||||||
keycloak:
|
keycloak:
|
||||||
profiles: ["with-sso"]
|
profiles: ["with-sso"]
|
||||||
image: quay.io/keycloak/keycloak:25.0.6
|
image: quay.io/keycloak/keycloak:26.0.7
|
||||||
environment:
|
environment:
|
||||||
- KEYCLOAK_ADMIN=admin
|
- KC_BOOTSTRAP_ADMIN_USERNAME=admin
|
||||||
- KEYCLOAK_ADMIN_PASSWORD=admin
|
- KC_BOOTSTRAP_ADMIN_PASSWORD=admin
|
||||||
- KC_DB=dev-mem
|
- KC_DB=dev-file
|
||||||
command: ["start-dev", "--import-realm", "--http-relative-path=/auth", "--hostname=localhost", "--http-enabled=true"]
|
command: ["start-dev", "--import-realm", "--http-relative-path=/auth", "--hostname=localhost", "--http-enabled=true"]
|
||||||
volumes:
|
volumes:
|
||||||
- ../../../repository/src/test/resources/realms/alfresco-realm.json:/opt/keycloak/data/import/alfresco-realm.json
|
- ../../../repository/src/test/resources/realms/alfresco-realm.json:/opt/keycloak/data/import/alfresco-realm.json
|
||||||
|
|||||||
Reference in New Issue
Block a user