mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-11-05 15:32:21 +00:00
Compare commits
21 Commits
25.3.0.4
...
fix/update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af8106bbe4 | ||
|
|
011a98f9a7 | ||
|
|
0b5211f7a9 | ||
|
|
1ad97022a2 | ||
|
|
567405dc1c | ||
|
|
8d6973a132 | ||
|
|
629c874bc8 | ||
|
|
19ec861873 | ||
|
|
7f8dd30305 | ||
|
|
40c7b5fd9f | ||
|
|
3f6a1c6880 | ||
|
|
b3f2cb95c8 | ||
|
|
d694959587 | ||
|
|
56aae78015 | ||
|
|
edba5b8754 | ||
|
|
5f8879feb7 | ||
|
|
ca575bc47e | ||
|
|
4fcb962a3c | ||
|
|
5397d88f4a | ||
|
|
448e49d8bb | ||
|
|
b825b5f18e |
805
.github/workflows/ci.yml
vendored
805
.github/workflows/ci.yml
vendored
File diff suppressed because it is too large
Load Diff
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@v8.16.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@v8.16.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@v8.16.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@v8.16.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@v8.16.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@v8.16.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@v8.16.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@v8.16.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 }}
|
||||||
|
|||||||
32
.github/workflows/precommit_formatter.yml
vendored
32
.github/workflows/precommit_formatter.yml
vendored
@@ -1,32 +0,0 @@
|
|||||||
name: Pre-Commit formatter
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- precommit/**
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
format-code:
|
|
||||||
name: "Reformat code"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: contains(github.event.head_commit.message, '[reformat code]')
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Set up Python ${{ inputs.python-version }}
|
|
||||||
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
|
||||||
with:
|
|
||||||
python-version: "3.9"
|
|
||||||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
extra_args: --all-files
|
|
||||||
- name: Update secrets baseline
|
|
||||||
run: pip install detect-secrets && detect-secrets scan --baseline .secrets.baseline
|
|
||||||
- uses: Alfresco/alfresco-build-tools/.github/actions/git-commit-changes@v8.16.0
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.BOT_GITHUB_USERNAME }}
|
|
||||||
add-options: -u
|
|
||||||
commit-message: "Apply Pre-Commit code formatting"
|
|
||||||
skip-if-no-changes: true
|
|
||||||
- name: Push changes
|
|
||||||
run: git push
|
|
||||||
@@ -127,6 +127,29 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"results": {
|
"results": {
|
||||||
|
".github/workflows/ci.yml": [
|
||||||
|
{
|
||||||
|
"type": "Secret Keyword",
|
||||||
|
"filename": ".github/workflows/ci.yml",
|
||||||
|
"hashed_secret": "b86dc2f033a63f2b7b9e7d270ab806d2910d7572",
|
||||||
|
"is_verified": false,
|
||||||
|
"line_number": 299
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Secret Keyword",
|
||||||
|
"filename": ".github/workflows/ci.yml",
|
||||||
|
"hashed_secret": "1bfb0e20f886150ba59b853bcd49dea893e00966",
|
||||||
|
"is_verified": false,
|
||||||
|
"line_number": 374
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Secret Keyword",
|
||||||
|
"filename": ".github/workflows/ci.yml",
|
||||||
|
"hashed_secret": "128f14373ccfaff49e3664045d3a11b50cbb7b39",
|
||||||
|
"is_verified": false,
|
||||||
|
"line_number": 908
|
||||||
|
}
|
||||||
|
],
|
||||||
".github/workflows/master_release.yml": [
|
".github/workflows/master_release.yml": [
|
||||||
{
|
{
|
||||||
"type": "Secret Keyword",
|
"type": "Secret Keyword",
|
||||||
@@ -224,7 +247,7 @@
|
|||||||
"filename": "core/src/main/java/org/alfresco/encryption/AlfrescoKeyStore.java",
|
"filename": "core/src/main/java/org/alfresco/encryption/AlfrescoKeyStore.java",
|
||||||
"hashed_secret": "a718763bca0f328b0e7ce2a98d9e79fc271bf827",
|
"hashed_secret": "a718763bca0f328b0e7ce2a98d9e79fc271bf827",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 34,
|
"line_number": 35,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -234,7 +257,7 @@
|
|||||||
"filename": "core/src/main/java/org/alfresco/httpclient/HttpClientFactory.java",
|
"filename": "core/src/main/java/org/alfresco/httpclient/HttpClientFactory.java",
|
||||||
"hashed_secret": "5d3c708390e5f51413e414393d4ad2a6d0e59a45",
|
"hashed_secret": "5d3c708390e5f51413e414393d4ad2a6d0e59a45",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 128,
|
"line_number": 126,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -400,7 +423,7 @@
|
|||||||
"filename": "packaging/tests/tas-cmis/src/main/java/org/alfresco/cmis/AuthParameterProviderFactory.java",
|
"filename": "packaging/tests/tas-cmis/src/main/java/org/alfresco/cmis/AuthParameterProviderFactory.java",
|
||||||
"hashed_secret": "a28cecdb5056cf30135809b921e38a84deb6c345",
|
"hashed_secret": "a28cecdb5056cf30135809b921e38a84deb6c345",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 100,
|
"line_number": 102,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -408,7 +431,7 @@
|
|||||||
"filename": "packaging/tests/tas-cmis/src/main/java/org/alfresco/cmis/AuthParameterProviderFactory.java",
|
"filename": "packaging/tests/tas-cmis/src/main/java/org/alfresco/cmis/AuthParameterProviderFactory.java",
|
||||||
"hashed_secret": "5e39d8e2991ef9705998de26b33f11be0f3cdcde",
|
"hashed_secret": "5e39d8e2991ef9705998de26b33f11be0f3cdcde",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 101,
|
"line_number": 103,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -516,7 +539,7 @@
|
|||||||
"filename": "packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestSitePersonMembershipRequestModelsCollection.java",
|
"filename": "packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestSitePersonMembershipRequestModelsCollection.java",
|
||||||
"hashed_secret": "8b30a14989d7b8093ac29462fe29423d836625b4",
|
"hashed_secret": "8b30a14989d7b8093ac29462fe29423d836625b4",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 33,
|
"line_number": 39,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -600,7 +623,7 @@
|
|||||||
"filename": "remote-api/src/main/java/org/alfresco/repo/web/scripts/tenant/AbstractTenantAdminWebScript.java",
|
"filename": "remote-api/src/main/java/org/alfresco/repo/web/scripts/tenant/AbstractTenantAdminWebScript.java",
|
||||||
"hashed_secret": "889d2688743fdce6115117a5ba7dbc5f33e0ce03",
|
"hashed_secret": "889d2688743fdce6115117a5ba7dbc5f33e0ce03",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 39,
|
"line_number": 38,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -610,7 +633,7 @@
|
|||||||
"filename": "remote-api/src/main/java/org/alfresco/web/app/servlet/AlfrescoX509ServletFilter.java",
|
"filename": "remote-api/src/main/java/org/alfresco/web/app/servlet/AlfrescoX509ServletFilter.java",
|
||||||
"hashed_secret": "43d52295ed5cb7e2b772f2b8be9695ddde971c49",
|
"hashed_secret": "43d52295ed5cb7e2b772f2b8be9695ddde971c49",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 60,
|
"line_number": 62,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -618,7 +641,7 @@
|
|||||||
"filename": "remote-api/src/main/java/org/alfresco/web/app/servlet/AlfrescoX509ServletFilter.java",
|
"filename": "remote-api/src/main/java/org/alfresco/web/app/servlet/AlfrescoX509ServletFilter.java",
|
||||||
"hashed_secret": "1bd5147ff91b8b1220d2f1ffde850ebabbc5ec8c",
|
"hashed_secret": "1bd5147ff91b8b1220d2f1ffde850ebabbc5ec8c",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 61,
|
"line_number": 63,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -648,7 +671,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/repo/remoteticket/RemoteAlfrescoTicketServiceTest.java",
|
"filename": "remote-api/src/test/java/org/alfresco/repo/remoteticket/RemoteAlfrescoTicketServiceTest.java",
|
||||||
"hashed_secret": "a926a50b320cea0d6c008a04322627400fe33f55",
|
"hashed_secret": "a926a50b320cea0d6c008a04322627400fe33f55",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 73,
|
"line_number": 74,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -658,7 +681,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/repo/web/scripts/node/NodeWebScripTest.java",
|
"filename": "remote-api/src/test/java/org/alfresco/repo/web/scripts/node/NodeWebScripTest.java",
|
||||||
"hashed_secret": "a926a50b320cea0d6c008a04322627400fe33f55",
|
"hashed_secret": "a926a50b320cea0d6c008a04322627400fe33f55",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 96,
|
"line_number": 95,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -668,7 +691,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/repo/web/scripts/servlet/RemoteAuthenticatorFactoryAdminConsoleAccessTest.java",
|
"filename": "remote-api/src/test/java/org/alfresco/repo/web/scripts/servlet/RemoteAuthenticatorFactoryAdminConsoleAccessTest.java",
|
||||||
"hashed_secret": "4ffa743f28fc949c19e65ab045d7906d0609a2c2",
|
"hashed_secret": "4ffa743f28fc949c19e65ab045d7906d0609a2c2",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 268,
|
"line_number": 269,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -678,7 +701,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/repo/web/scripts/solr/SOLRAuthenticationFilterTest.java",
|
"filename": "remote-api/src/test/java/org/alfresco/repo/web/scripts/solr/SOLRAuthenticationFilterTest.java",
|
||||||
"hashed_secret": "76ed0a056aa77060de25754586440cff390791d0",
|
"hashed_secret": "76ed0a056aa77060de25754586440cff390791d0",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 59,
|
"line_number": 63,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -688,7 +711,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/repo/webdav/LockMethodTest.java",
|
"filename": "remote-api/src/test/java/org/alfresco/repo/webdav/LockMethodTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 108,
|
"line_number": 109,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -718,7 +741,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/RepoService.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/RepoService.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 412,
|
"line_number": 418,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -728,7 +751,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestCMIS.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestCMIS.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 175,
|
"line_number": 182,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -738,7 +761,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
||||||
"hashed_secret": "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4",
|
"hashed_secret": "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 595,
|
"line_number": 592,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -746,7 +769,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
||||||
"hashed_secret": "53dad674827218e94c8fe9c1984c8dd9db512a17",
|
"hashed_secret": "53dad674827218e94c8fe9c1984c8dd9db512a17",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 731,
|
"line_number": 728,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -754,7 +777,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
||||||
"hashed_secret": "be66cf01c56d963de61462f37a43df2305367216",
|
"hashed_secret": "be66cf01c56d963de61462f37a43df2305367216",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 1434,
|
"line_number": 1429,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -762,7 +785,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
||||||
"hashed_secret": "283d47a9338ed1100b5fe2a5aff2d1f7c799bfd0",
|
"hashed_secret": "283d47a9338ed1100b5fe2a5aff2d1f7c799bfd0",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 1435,
|
"line_number": 1430,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -770,7 +793,7 @@
|
|||||||
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
"filename": "remote-api/src/test/java/org/alfresco/rest/api/tests/TestPeople.java",
|
||||||
"hashed_secret": "425a715491af2bbec1eef2def6fa8d79c3050401",
|
"hashed_secret": "425a715491af2bbec1eef2def6fa8d79c3050401",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 1457,
|
"line_number": 1452,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -860,7 +883,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/heartbeat/jobs/LockingJob.java",
|
"filename": "repository/src/main/java/org/alfresco/heartbeat/jobs/LockingJob.java",
|
||||||
"hashed_secret": "b003370e1497c5003e21f1ec5da89e3d2d819506",
|
"hashed_secret": "b003370e1497c5003e21f1ec5da89e3d2d819506",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 59,
|
"line_number": 60,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -868,7 +891,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/heartbeat/jobs/LockingJob.java",
|
"filename": "repository/src/main/java/org/alfresco/heartbeat/jobs/LockingJob.java",
|
||||||
"hashed_secret": "fc99e6a90240c45f46ed33a4d96a3dbecef41c60",
|
"hashed_secret": "fc99e6a90240c45f46ed33a4d96a3dbecef41c60",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 60,
|
"line_number": 61,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -878,7 +901,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/heartbeat/jobs/NonLockingJob.java",
|
"filename": "repository/src/main/java/org/alfresco/heartbeat/jobs/NonLockingJob.java",
|
||||||
"hashed_secret": "b003370e1497c5003e21f1ec5da89e3d2d819506",
|
"hashed_secret": "b003370e1497c5003e21f1ec5da89e3d2d819506",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 54,
|
"line_number": 52,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -888,7 +911,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/repo/admin/patch/impl/AdminUserPatch.java",
|
"filename": "repository/src/main/java/org/alfresco/repo/admin/patch/impl/AdminUserPatch.java",
|
||||||
"hashed_secret": "87a754b00f7ee047d496808125d6259104e9382a",
|
"hashed_secret": "87a754b00f7ee047d496808125d6259104e9382a",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 62,
|
"line_number": 60,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -908,7 +931,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/repo/remoteconnector/RemoteConnectorServiceImpl.java",
|
"filename": "repository/src/main/java/org/alfresco/repo/remoteconnector/RemoteConnectorServiceImpl.java",
|
||||||
"hashed_secret": "a172ffc990129fe6f68b50f6037c54a1894ee3fd",
|
"hashed_secret": "a172ffc990129fe6f68b50f6037c54a1894ee3fd",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 205,
|
"line_number": 204,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -916,7 +939,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/repo/remoteconnector/RemoteConnectorServiceImpl.java",
|
"filename": "repository/src/main/java/org/alfresco/repo/remoteconnector/RemoteConnectorServiceImpl.java",
|
||||||
"hashed_secret": "a172ffc990129fe6f68b50f6037c54a1894ee3fd",
|
"hashed_secret": "a172ffc990129fe6f68b50f6037c54a1894ee3fd",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 205,
|
"line_number": 204,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -926,7 +949,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImpl.java",
|
"filename": "repository/src/main/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImpl.java",
|
||||||
"hashed_secret": "e25df0eeed8d8eb4e198c3464c7bf747bc26eff8",
|
"hashed_secret": "e25df0eeed8d8eb4e198c3464c7bf747bc26eff8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 91,
|
"line_number": 92,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -936,7 +959,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/repo/security/authentication/SimpleAcceptOrRejectAllAuthenticationComponentImpl.java",
|
"filename": "repository/src/main/java/org/alfresco/repo/security/authentication/SimpleAcceptOrRejectAllAuthenticationComponentImpl.java",
|
||||||
"hashed_secret": "304de25a3d73b68ad408ca3843356b5cf67f6f14",
|
"hashed_secret": "304de25a3d73b68ad408ca3843356b5cf67f6f14",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 89,
|
"line_number": 93,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -946,7 +969,7 @@
|
|||||||
"filename": "repository/src/main/java/org/alfresco/repo/transfer/TransferServiceImpl2.java",
|
"filename": "repository/src/main/java/org/alfresco/repo/transfer/TransferServiceImpl2.java",
|
||||||
"hashed_secret": "9ae9f2be7702b726809545808a8a9ba2e5a38410",
|
"hashed_secret": "9ae9f2be7702b726809545808a8a9ba2e5a38410",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 129,
|
"line_number": 130,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1250,7 +1273,7 @@
|
|||||||
"filename": "repository/src/main/resources/alfresco/repository.properties",
|
"filename": "repository/src/main/resources/alfresco/repository.properties",
|
||||||
"hashed_secret": "84551ae5442affc9f1a2d3b4c86ae8b24860149d",
|
"hashed_secret": "84551ae5442affc9f1a2d3b4c86ae8b24860149d",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 771,
|
"line_number": 770,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1280,7 +1303,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 86,
|
"line_number": 88,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1288,7 +1311,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
||||||
"hashed_secret": "c464af817287343305cbd6493c593885695df531",
|
"hashed_secret": "c464af817287343305cbd6493c593885695df531",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 90,
|
"line_number": 92,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1296,7 +1319,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
||||||
"hashed_secret": "8ad8572a0b3fc4cb3afc1baaebc97a2cae58eb8c",
|
"hashed_secret": "8ad8572a0b3fc4cb3afc1baaebc97a2cae58eb8c",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 91,
|
"line_number": 93,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1304,7 +1327,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
"filename": "repository/src/test/java/org/alfresco/filesys/FTPServerTest.java",
|
||||||
"hashed_secret": "915692b4d7465b0084354173d552ac90145dc315",
|
"hashed_secret": "915692b4d7465b0084354173d552ac90145dc315",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 92,
|
"line_number": 94,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1314,7 +1337,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/filesys/repo/ContentDiskDriverTest.java",
|
"filename": "repository/src/test/java/org/alfresco/filesys/repo/ContentDiskDriverTest.java",
|
||||||
"hashed_secret": "8c85434f6f339a24b808810bd95629d0f5856355",
|
"hashed_secret": "8c85434f6f339a24b808810bd95629d0f5856355",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 1257,
|
"line_number": 1280,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1324,7 +1347,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/opencmis/CMISTest.java",
|
"filename": "repository/src/test/java/org/alfresco/opencmis/CMISTest.java",
|
||||||
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
|
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 4001,
|
"line_number": 4134,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1334,7 +1357,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 141,
|
"line_number": 140,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1344,7 +1367,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/i18n/MessageServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/i18n/MessageServiceImplTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 101,
|
"line_number": 102,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1354,7 +1377,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapMessageTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapMessageTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 116,
|
"line_number": 118,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1364,7 +1387,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapServiceImplCacheTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapServiceImplCacheTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 66,
|
"line_number": 68,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1374,7 +1397,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 111,
|
"line_number": 116,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1384,7 +1407,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/imap/LoadTester.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/imap/LoadTester.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 79,
|
"line_number": 80,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1394,7 +1417,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/imap/RemoteLoadTester.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/imap/RemoteLoadTester.java",
|
||||||
"hashed_secret": "678721c0433c8cf5c9069a0e70784cf1839e866b",
|
"hashed_secret": "678721c0433c8cf5c9069a0e70784cf1839e866b",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 55,
|
"line_number": 58,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1404,7 +1427,27 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/invitation/site/InviteSenderTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/invitation/site/InviteSenderTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 108,
|
"line_number": 109,
|
||||||
|
"is_secret": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository/src/test/java/org/alfresco/repo/lock/LockBehaviourImplTest.java": [
|
||||||
|
{
|
||||||
|
"type": "Secret Keyword",
|
||||||
|
"filename": "repository/src/test/java/org/alfresco/repo/lock/LockBehaviourImplTest.java",
|
||||||
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
|
"is_verified": false,
|
||||||
|
"line_number": 112,
|
||||||
|
"is_secret": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository/src/test/java/org/alfresco/repo/lock/LockServiceImplTest.java": [
|
||||||
|
{
|
||||||
|
"type": "Secret Keyword",
|
||||||
|
"filename": "repository/src/test/java/org/alfresco/repo/lock/LockServiceImplTest.java",
|
||||||
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
|
"is_verified": false,
|
||||||
|
"line_number": 103,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1440,7 +1483,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/model/filefolder/FileFolderServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/model/filefolder/FileFolderServiceImplTest.java",
|
||||||
"hashed_secret": "9e10e28cb9c3e381c13d13fa97dd97148982cdaa",
|
"hashed_secret": "9e10e28cb9c3e381c13d13fa97dd97148982cdaa",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 590,
|
"line_number": 595,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1450,7 +1493,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/notification/NotificationServiceImplSystemTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/notification/NotificationServiceImplSystemTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 75,
|
"line_number": 74,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1460,7 +1503,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceTest.java",
|
||||||
"hashed_secret": "c60646de4c4893cf860a12ecb7ba4f5317b1a1d0",
|
"hashed_secret": "c60646de4c4893cf860a12ecb7ba4f5317b1a1d0",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 62,
|
"line_number": 61,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1468,7 +1511,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceTest.java",
|
||||||
"hashed_secret": "c60646de4c4893cf860a12ecb7ba4f5317b1a1d0",
|
"hashed_secret": "c60646de4c4893cf860a12ecb7ba4f5317b1a1d0",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 62,
|
"line_number": 61,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1476,7 +1519,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceTest.java",
|
||||||
"hashed_secret": "ad8a621976e9a19cc78af501a84638a04fca9b83",
|
"hashed_secret": "ad8a621976e9a19cc78af501a84638a04fca9b83",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 66,
|
"line_number": 65,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1486,7 +1529,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/oauth2/OAuth2CredentialsStoreServiceTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/oauth2/OAuth2CredentialsStoreServiceTest.java",
|
||||||
"hashed_secret": "c60646de4c4893cf860a12ecb7ba4f5317b1a1d0",
|
"hashed_secret": "c60646de4c4893cf860a12ecb7ba4f5317b1a1d0",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 64,
|
"line_number": 70,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1496,7 +1539,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/rendition2/AbstractRenditionIntegrationTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/rendition2/AbstractRenditionIntegrationTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 130,
|
"line_number": 127,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1506,7 +1549,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/replication/ReplicationServiceIntegrationTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/replication/ReplicationServiceIntegrationTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 1317,
|
"line_number": 1328,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1516,7 +1559,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/AuthenticationServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/AuthenticationServiceImplTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 69,
|
"line_number": 68,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1526,7 +1569,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/AuthenticationTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/AuthenticationTest.java",
|
||||||
"hashed_secret": "607e729c2f77c4e821e68e26b4c1f5a4398624e9",
|
"hashed_secret": "607e729c2f77c4e821e68e26b4c1f5a4398624e9",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 2121,
|
"line_number": 2129,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1536,7 +1579,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/AuthorizationTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/AuthorizationTest.java",
|
||||||
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
|
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 36,
|
"line_number": 37,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1546,7 +1589,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/CompositePasswordEncoderTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/CompositePasswordEncoderTest.java",
|
||||||
"hashed_secret": "4360136f24381dcec1d35d79fbf7dac4b54dfe97",
|
"hashed_secret": "4360136f24381dcec1d35d79fbf7dac4b54dfe97",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 310,
|
"line_number": 301,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1574,7 +1617,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/identityservice/LazyInstantiatingIdentityServiceFacadeUnitTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/identityservice/LazyInstantiatingIdentityServiceFacadeUnitTest.java",
|
||||||
"hashed_secret": "12e59296b0d17c1ceb345a7adca98574c835ba24",
|
"hashed_secret": "12e59296b0d17c1ceb345a7adca98574c835ba24",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 46,
|
"line_number": 45,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1584,7 +1627,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/identityservice/SpringBasedIdentityServiceFacadeUnitTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/security/authentication/identityservice/SpringBasedIdentityServiceFacadeUnitTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 48,
|
"line_number": 47,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1604,7 +1647,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/HttpClientTransmitterImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/HttpClientTransmitterImplTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 73,
|
"line_number": 75,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1614,7 +1657,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceCallbackTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceCallbackTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 658,
|
"line_number": 664,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1624,7 +1667,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceImplTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 202,
|
"line_number": 203,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1632,7 +1675,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceImplTest.java",
|
||||||
"hashed_secret": "ad782ecdac770fc6eb9a62e44f90873fb97fb26b",
|
"hashed_secret": "ad782ecdac770fc6eb9a62e44f90873fb97fb26b",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 512,
|
"line_number": 513,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1640,7 +1683,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceImplTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 3593,
|
"line_number": 3687,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1650,7 +1693,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceToBeRefactoredTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceToBeRefactoredTest.java",
|
||||||
"hashed_secret": "8be3c943b1609fffbfc51aad666d0a04adf83c9d",
|
"hashed_secret": "8be3c943b1609fffbfc51aad666d0a04adf83c9d",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 2510,
|
"line_number": 2682,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1658,7 +1701,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceToBeRefactoredTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/TransferServiceToBeRefactoredTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 3517,
|
"line_number": 3772,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1668,7 +1711,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/manifest/ManifestIntegrationTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/manifest/ManifestIntegrationTest.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 114,
|
"line_number": 115,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1678,7 +1721,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/transfer/manifest/TransferManifestTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/transfer/manifest/TransferManifestTest.java",
|
||||||
"hashed_secret": "5395ebfd174b0a5617e6f409dfbb3e064e3fdf0a",
|
"hashed_secret": "5395ebfd174b0a5617e6f409dfbb3e064e3fdf0a",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 126,
|
"line_number": 127,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1688,7 +1731,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/version/BaseVersionStoreTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/version/BaseVersionStoreTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 144,
|
"line_number": 149,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1708,7 +1751,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/version/VersionServiceImplTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/version/VersionServiceImplTest.java",
|
||||||
"hashed_secret": "dee17075a8c96d9c57c15d56b1f64e5abc1caf0b",
|
"hashed_secret": "dee17075a8c96d9c57c15d56b1f64e5abc1caf0b",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 121,
|
"line_number": 122,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1718,7 +1761,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/util/test/junitrules/AlfrescoTenant.java",
|
"filename": "repository/src/test/java/org/alfresco/util/test/junitrules/AlfrescoTenant.java",
|
||||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 73,
|
"line_number": 67,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1728,7 +1771,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/util/test/testusers/TestUserComponentImpl.java",
|
"filename": "repository/src/test/java/org/alfresco/util/test/testusers/TestUserComponentImpl.java",
|
||||||
"hashed_secret": "f73e110427648014568f7144031a6d48060eab0a",
|
"hashed_secret": "f73e110427648014568f7144031a6d48060eab0a",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 63,
|
"line_number": 55,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1845,5 +1888,5 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"generated_at": "2025-06-09T16:43:14Z"
|
"generated_at": "2025-01-07T10:56:22Z"
|
||||||
}
|
}
|
||||||
@@ -10,9 +10,7 @@ pre-commit install
|
|||||||
When you make a commit then these hooks will run and check the modified files. If it makes changes then you can review them and then `git commit` again to accept the changes.
|
When you make a commit then these hooks will run and check the modified files. If it makes changes then you can review them and then `git commit` again to accept the changes.
|
||||||
|
|
||||||
#### Code Quality
|
#### Code Quality
|
||||||
This project uses `spotless` that enforces `alfresco-formatter.xml` to ensure code quality.
|
This project uses `spotless` that enforces `alfresco-formatter.xml` to ensure code quality.
|
||||||
The code style definition file is taken always form the `master` branch of `alfresco-community-repo`.
|
|
||||||
All downstream projects use this code style definition file as well.
|
|
||||||
|
|
||||||
To check code-style violations you can use:
|
To check code-style violations you can use:
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -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>25.3.0.4</version>
|
<version>25.1.0.21-SNAPSHOT</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>25.3.0.4</version>
|
<version>25.1.0.21-SNAPSHOT</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>25.3.0.4</version>
|
<version>25.1.0.21-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -74,6 +74,16 @@
|
|||||||
<artifactId>alfresco-testng</artifactId>
|
<artifactId>alfresco-testng</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.epam.reportportal</groupId>
|
||||||
|
<artifactId>agent-java-testng</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.awaitility</groupId>
|
<groupId>org.awaitility</groupId>
|
||||||
<artifactId>awaitility</artifactId>
|
<artifactId>awaitility</artifactId>
|
||||||
@@ -83,7 +93,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-collections4</artifactId>
|
<artifactId>commons-collections4</artifactId>
|
||||||
<version>4.5.0</version>
|
<version>4.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.docker-java</groupId>
|
<groupId>com.github.docker-java</groupId>
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
package org.alfresco.rest.rm.community.model;
|
|
||||||
|
|
||||||
public record CapabilityModel(String name, String title, String description, GroupModel group, int index)
|
|
||||||
{}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
package org.alfresco.rest.rm.community.model;
|
|
||||||
|
|
||||||
public record GroupModel(String id, String title)
|
|
||||||
{}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*-
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
package org.alfresco.rest.rm.community.model.role;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.model.CapabilityModel;
|
|
||||||
import org.alfresco.utility.model.TestModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POJO for role
|
|
||||||
*/
|
|
||||||
@Builder
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class Role extends TestModel
|
|
||||||
{
|
|
||||||
|
|
||||||
@JsonProperty(required = true)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@JsonProperty(required = true)
|
|
||||||
private List<CapabilityModel> capabilities;
|
|
||||||
|
|
||||||
@JsonProperty(required = true)
|
|
||||||
private String displayLabel;
|
|
||||||
|
|
||||||
@JsonProperty(required = true)
|
|
||||||
private String groupShortName;
|
|
||||||
|
|
||||||
private List<String> assignedUsers;
|
|
||||||
|
|
||||||
private List<String> assignedGroups;
|
|
||||||
|
|
||||||
private String roleGroupName;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o)
|
|
||||||
{
|
|
||||||
if (this == o)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (o == null || getClass() != o.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Role role = (Role) o;
|
|
||||||
return Objects.equals(name, role.name) && Objects.equals(capabilities, role.capabilities)
|
|
||||||
&& Objects.equals(displayLabel, role.displayLabel) && Objects.equals(groupShortName, role.groupShortName) && Objects.equals(assignedUsers, role.assignedUsers)
|
|
||||||
&& Objects.equals(assignedGroups, role.assignedGroups) && Objects.equals(roleGroupName, role.roleGroupName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hash(name, capabilities, displayLabel, groupShortName, assignedUsers, assignedGroups, roleGroupName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*-
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
package org.alfresco.rest.rm.community.model.role;
|
|
||||||
|
|
||||||
import org.alfresco.rest.core.RestModels;
|
|
||||||
|
|
||||||
public class RoleCollection extends RestModels<RoleEntry, RoleCollection>
|
|
||||||
{}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*-
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
package org.alfresco.rest.rm.community.model.role;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import org.alfresco.rest.core.RestModels;
|
|
||||||
|
|
||||||
@Builder
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class RoleEntry extends RestModels<Role, RoleEntry>
|
|
||||||
{
|
|
||||||
@JsonProperty
|
|
||||||
private Role entry;
|
|
||||||
}
|
|
||||||
@@ -35,7 +35,7 @@ package org.alfresco.rest.rm.community.model.user;
|
|||||||
*/
|
*/
|
||||||
public enum UserRoles
|
public enum UserRoles
|
||||||
{
|
{
|
||||||
IN_PLACE_WRITERS("ExtendedWriters", "In-Place Writers"), ROLE_RM_ADMIN("Administrator", "Records Management Administrator"), ROLE_RM_MANAGER("RecordsManager", "Records Management Manager"), ROLE_RM_POWER_USER("PowerUser", "Records Management Power User"), ROLE_RM_SECURITY_OFFICER("SecurityOfficer", "Records Management Security Officer"), ROLE_RM_USER("User", "Records Management User"), IN_PLACE_READERS("ExtendedReaders", "In-Place Readers");
|
IN_PLACE_WRITERS("ExtendedWriters", "In-Place Writers"), ROLE_RM_ADMIN("Administrator", "Records Management Administrator"), ROLE_RM_MANAGER("RecordsManager", "Records Management Manager"), ROLE_RM_POWER_USER("PowerUser", "Records Management Power User"), ROLE_RM_SECURITY_OFFICER("SecurityOfficer", "Records Management Security Officer"), ROLE_RM_USER("User", "Records Management User");
|
||||||
|
|
||||||
public final String roleId;
|
public final String roleId;
|
||||||
public final String displayName;
|
public final String displayName;
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import org.alfresco.rest.rm.community.model.hold.Hold;
|
|||||||
import org.alfresco.rest.rm.community.model.hold.HoldCollection;
|
import org.alfresco.rest.rm.community.model.hold.HoldCollection;
|
||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection;
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection;
|
||||||
import org.alfresco.rest.rm.community.model.role.RoleCollection;
|
|
||||||
import org.alfresco.rest.rm.community.requests.RMModelRequest;
|
import org.alfresco.rest.rm.community.requests.RMModelRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -304,39 +303,4 @@ public class FilePlanAPI extends RMModelRequest
|
|||||||
{
|
{
|
||||||
return getHolds(filePlanId, EMPTY);
|
return getHolds(filePlanId, EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the roles of a file plan.
|
|
||||||
*
|
|
||||||
* @param filePlanId
|
|
||||||
* The identifier of a file plan
|
|
||||||
* @param parameters
|
|
||||||
* The URL parameters to add
|
|
||||||
* @return The {Pagination and RoleModel Entries} for the given {@code filePlanId}
|
|
||||||
* @throws RuntimeException
|
|
||||||
* for the following cases:
|
|
||||||
* <ul>
|
|
||||||
* <li>authentication fails</li>
|
|
||||||
* <li>current user does not have permission to read {@code filePlanId}</li>
|
|
||||||
* <li>{@code filePlanId} does not exist</li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public RoleCollection getFilePlanRoles(String filePlanId, String parameters)
|
|
||||||
{
|
|
||||||
mandatoryString("filePlanId", filePlanId);
|
|
||||||
return getRmRestWrapper().processModels(RoleCollection.class, simpleRequest(
|
|
||||||
GET,
|
|
||||||
"file-plans/{filePlanId}/roles?{parameters}",
|
|
||||||
filePlanId,
|
|
||||||
parameters));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See {@link #getFilePlanRoles(String, String)}
|
|
||||||
*/
|
|
||||||
public RoleCollection getFilePlanRoles(String filePlanId)
|
|
||||||
{
|
|
||||||
return getFilePlanRoles(filePlanId, EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
|
|||||||
import org.alfresco.rest.search.RestRequestQueryModel;
|
import org.alfresco.rest.search.RestRequestQueryModel;
|
||||||
import org.alfresco.rest.search.SearchNodeModel;
|
import org.alfresco.rest.search.SearchNodeModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.v0.RMRolesAndActionsAPI;
|
|
||||||
import org.alfresco.rest.v0.SearchAPI;
|
import org.alfresco.rest.v0.SearchAPI;
|
||||||
import org.alfresco.utility.Utility;
|
import org.alfresco.utility.Utility;
|
||||||
import org.alfresco.utility.data.DataUserAIS;
|
import org.alfresco.utility.data.DataUserAIS;
|
||||||
@@ -128,10 +127,6 @@ public class BaseRMRestTest extends RestTest
|
|||||||
@Getter(value = PROTECTED)
|
@Getter(value = PROTECTED)
|
||||||
private SearchAPI searchApi;
|
private SearchAPI searchApi;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
@Getter(PROTECTED)
|
|
||||||
private RMRolesAndActionsAPI rmRolesAndActionsV0API;
|
|
||||||
|
|
||||||
protected static final String iso8601_DateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
protected static final String iso8601_DateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ package org.alfresco.rest.rm.community.fileplans;
|
|||||||
|
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
import static com.google.common.collect.Sets.newHashSet;
|
|
||||||
import static org.springframework.http.HttpStatus.CONFLICT;
|
import static org.springframework.http.HttpStatus.CONFLICT;
|
||||||
import static org.springframework.http.HttpStatus.CREATED;
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
||||||
@@ -57,27 +56,19 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
|||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
|
import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.IN_PLACE_READERS;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.IN_PLACE_WRITERS;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_ADMIN;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
|
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_SECURITY_OFFICER;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER;
|
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomName;
|
import static org.alfresco.utility.data.RandomData.getRandomName;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
||||||
import org.alfresco.rest.rm.community.base.DataProviderClass;
|
import org.alfresco.rest.rm.community.base.DataProviderClass;
|
||||||
import org.alfresco.rest.rm.community.model.CapabilityModel;
|
|
||||||
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
|
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
|
||||||
import org.alfresco.rest.rm.community.model.fileplan.FilePlanProperties;
|
import org.alfresco.rest.rm.community.model.fileplan.FilePlanProperties;
|
||||||
import org.alfresco.rest.rm.community.model.hold.Hold;
|
import org.alfresco.rest.rm.community.model.hold.Hold;
|
||||||
@@ -85,9 +76,6 @@ import org.alfresco.rest.rm.community.model.hold.HoldCollection;
|
|||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection;
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection;
|
||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryProperties;
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryProperties;
|
||||||
import org.alfresco.rest.rm.community.model.role.Role;
|
|
||||||
import org.alfresco.rest.rm.community.model.role.RoleCollection;
|
|
||||||
import org.alfresco.rest.rm.community.model.user.UserCapabilities;
|
|
||||||
import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
|
import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
|
||||||
import org.alfresco.utility.constants.ContainerName;
|
import org.alfresco.utility.constants.ContainerName;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
@@ -99,7 +87,6 @@ import org.alfresco.utility.report.Bug;
|
|||||||
* @author Rodica Sutu
|
* @author Rodica Sutu
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
|
|
||||||
public class FilePlanTests extends BaseRMRestTest
|
public class FilePlanTests extends BaseRMRestTest
|
||||||
{
|
{
|
||||||
// ** Number of children (for children creation test) */
|
// ** Number of children (for children creation test) */
|
||||||
@@ -279,7 +266,7 @@ public class FilePlanTests extends BaseRMRestTest
|
|||||||
* When I ask the API to create a root record category
|
* When I ask the API to create a root record category
|
||||||
* Then it is created as a root record category
|
* Then it is created as a root record category
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given that a file plan exists
|
* Given that a file plan exists
|
||||||
* When I use the API to create a folder (cm:folder type) into the fileplan
|
* When I use the API to create a folder (cm:folder type) into the fileplan
|
||||||
@@ -327,7 +314,7 @@ public class FilePlanTests extends BaseRMRestTest
|
|||||||
* When I ask the API to create a root category having the same name
|
* When I ask the API to create a root category having the same name
|
||||||
* Then the response code received is 409 - name clashes with an existing node
|
* Then the response code received is 409 - name clashes with an existing node
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given a root category
|
* Given a root category
|
||||||
* When I ask the API to create a root category having the same name with autoRename parameter on true
|
* When I ask the API to create a root category having the same name with autoRename parameter on true
|
||||||
@@ -607,171 +594,4 @@ public class FilePlanTests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When rmAdmin user ask the API for roles
|
|
||||||
* It provides list of all default roles
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void listFilePlanAllDefaultRoles()
|
|
||||||
{
|
|
||||||
List<String> defaultRolesDisplayNames = asList(IN_PLACE_READERS.displayName, ROLE_RM_ADMIN.displayName, ROLE_RM_MANAGER.displayName, ROLE_RM_POWER_USER.displayName, ROLE_RM_USER.displayName, IN_PLACE_WRITERS.displayName, ROLE_RM_SECURITY_OFFICER.displayName);
|
|
||||||
// Call to new API to get the roles and capabilities
|
|
||||||
RoleCollection roleCollection = getRestAPIFactory().getFilePlansAPI().getFilePlanRoles(FILE_PLAN_ALIAS);
|
|
||||||
assertStatusCode(OK);
|
|
||||||
roleCollection.getEntries().forEach(roleModelEntry -> {
|
|
||||||
Role role = roleModelEntry.getEntry();
|
|
||||||
assertTrue(defaultRolesDisplayNames.contains(role.getDisplayLabel()));
|
|
||||||
assertNotNull(role.getCapabilities());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When rmAdmin user ask the API for roles with SystemRoles as false
|
|
||||||
* It provides list of all roles excluding SystemRoles
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void listFilePlanAllRolesExcludeSystemRoles()
|
|
||||||
{
|
|
||||||
String parameters = "where=(systemRoles=false)";
|
|
||||||
List<String> systemRolesDisplayNames = asList(IN_PLACE_WRITERS.displayName, IN_PLACE_READERS.displayName);
|
|
||||||
// Call to new API to get the roles and capabilities
|
|
||||||
RoleCollection roleCollection = getRestAPIFactory().getFilePlansAPI().getFilePlanRoles(FILE_PLAN_ALIAS, parameters);
|
|
||||||
assertStatusCode(OK);
|
|
||||||
roleCollection.getEntries().forEach(roleModelEntry -> {
|
|
||||||
Role role = roleModelEntry.getEntry();
|
|
||||||
assertFalse(systemRolesDisplayNames.contains(role.getDisplayLabel()));
|
|
||||||
assertNotNull(role.getCapabilities());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When a non-RM user asks the API for the roles
|
|
||||||
* Then the status code 403 (Permission denied) is return
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void nonRmUserFilePlanRoles()
|
|
||||||
{
|
|
||||||
// Create a random user
|
|
||||||
UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
|
|
||||||
// Call to new API to get the roles and capabilities
|
|
||||||
getRestAPIFactory().getFilePlansAPI(nonRMuser).getFilePlanRoles(FILE_PLAN_ALIAS);
|
|
||||||
assertStatusCode(FORBIDDEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When a RM_Manager user asks the API for the roles
|
|
||||||
* returns the RM_Manager role and capabilities
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void rmManagerFilePlanRolesAndCapabilities()
|
|
||||||
{
|
|
||||||
// Create a random user
|
|
||||||
UserModel managerUser = getDataUser().createRandomTestUser("managerUser");
|
|
||||||
// Assign RecordsManager role to user
|
|
||||||
getRestAPIFactory().getRMUserAPI().assignRoleToUser(managerUser.getUsername(), ROLE_RM_MANAGER.roleId);
|
|
||||||
String parameters = "where=(personId='" + managerUser.getUsername() + "')";
|
|
||||||
// Call to new API to get the roles and capabilities
|
|
||||||
RoleCollection roleCollection = getRestAPIFactory().getFilePlansAPI(managerUser).getFilePlanRoles(FILE_PLAN_ALIAS, parameters);
|
|
||||||
roleCollection.getEntries().forEach(roleModelEntry -> {
|
|
||||||
Role role = roleModelEntry.getEntry();
|
|
||||||
assertEquals(ROLE_RM_MANAGER.displayName, role.getDisplayLabel());
|
|
||||||
assertNotNull(role.getCapabilities());
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When a User with more than one role asks the API for the roles and relation
|
|
||||||
* returns the roles and capabilities
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void multipleRoleUserFilePlanRolesAndCapabilities()
|
|
||||||
{
|
|
||||||
// Create a random user
|
|
||||||
UserModel rmUser = getDataUser().createRandomTestUser("rmUser");
|
|
||||||
// Assign rmUser role to user
|
|
||||||
getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), ROLE_RM_USER.roleId);
|
|
||||||
getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), ROLE_RM_POWER_USER.roleId);
|
|
||||||
String parameters = "where=(personId='" + rmUser.getUsername() + "')";
|
|
||||||
// Call to new API to get the roles and capabilities
|
|
||||||
RoleCollection roleCollection = getRestAPIFactory().getFilePlansAPI(rmUser).getFilePlanRoles(FILE_PLAN_ALIAS, parameters);
|
|
||||||
assertStatusCode(OK);
|
|
||||||
assertEquals(roleCollection.getEntries().size(), 2);
|
|
||||||
roleCollection.getEntries().forEach(roleModelEntry -> {
|
|
||||||
Role role = roleModelEntry.getEntry();
|
|
||||||
assertTrue(role.getDisplayLabel().equals(ROLE_RM_USER.displayName) || role.getDisplayLabel().equals(ROLE_RM_POWER_USER.displayName));
|
|
||||||
assertNotNull(role.getCapabilities());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When a new user with a new role asks the API for the roles and relation
|
|
||||||
* returns the new role and new capabilities
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void newRoleUserFilePlanRolesAndCapabilities()
|
|
||||||
{
|
|
||||||
/** A list of capabilities. */
|
|
||||||
Set<String> newCapabilities = newHashSet(UserCapabilities.VIEW_RECORDS_CAP, UserCapabilities.DECLARE_RECORDS_CAP);
|
|
||||||
// Create a new role using old API
|
|
||||||
getRmRolesAndActionsV0API().createRole(getAdminUser().getUsername(), getAdminUser().getPassword(), "NewTestRole",
|
|
||||||
"New Role Label", newCapabilities);
|
|
||||||
// Create a random user
|
|
||||||
UserModel rmNewUser = getDataUser().createRandomTestUser("rmPowerUser");
|
|
||||||
// Assign New role to user
|
|
||||||
getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmNewUser.getUsername(), "NewTestRole");
|
|
||||||
String parameters = "where=(personId='" + rmNewUser.getUsername() + "')";
|
|
||||||
// Call to new API to get the roles and capabilities
|
|
||||||
RoleCollection roleCollection = getRestAPIFactory().getFilePlansAPI(rmNewUser).getFilePlanRoles(FILE_PLAN_ALIAS, parameters);
|
|
||||||
assertStatusCode(OK);
|
|
||||||
assertEquals(roleCollection.getEntries().size(), 1);
|
|
||||||
roleCollection.getEntries().forEach(roleModelEntry -> {
|
|
||||||
List<CapabilityModel> capabilities = roleModelEntry.getEntry().getCapabilities();
|
|
||||||
capabilities.forEach(capabilityModel -> {
|
|
||||||
assertTrue(newCapabilities.contains(capabilityModel.name()));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* Given that a file plan exists
|
|
||||||
* When API call happens with Capability filter
|
|
||||||
* returns roles associated with the capability
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void filePlanRolesAndCapabilitiesFilter()
|
|
||||||
{
|
|
||||||
String parameters = "where=(systemRoles=true and capabilityName in ('ManageRules'))";
|
|
||||||
// Call to new API to get the roles and capabilities, filter by capability, include assigned users
|
|
||||||
RoleCollection roleCollection = getRestAPIFactory().getFilePlansAPI().getFilePlanRoles(FILE_PLAN_ALIAS, parameters);
|
|
||||||
assertStatusCode(OK);
|
|
||||||
assertEquals(roleCollection.getEntries().size(), 1);
|
|
||||||
roleCollection.getEntries().forEach(roleModelEntry -> {
|
|
||||||
Role role = roleModelEntry.getEntry();
|
|
||||||
assertEquals(ROLE_RM_ADMIN.displayName, role.getDisplayLabel());
|
|
||||||
assertNotNull(role.getCapabilities());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,16 +134,6 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
.until(() -> getRestAPIFactory().getSearchAPI(null).search(searchRequest).getPagination()
|
.until(() -> getRestAPIFactory().getSearchAPI(null).search(searchRequest).getPagination()
|
||||||
.getTotalItems() == NUMBER_OF_FILES);
|
.getTotalItems() == NUMBER_OF_FILES);
|
||||||
|
|
||||||
RestRequestQueryModel ancestorReq = getContentFromFolderAndAllSubfoldersQuery(rootFolder.getNodeRefWithoutVersion());
|
|
||||||
SearchRequest ancestorSearchRequest = new SearchRequest();
|
|
||||||
ancestorSearchRequest.setQuery(ancestorReq);
|
|
||||||
|
|
||||||
STEP("Wait until paths are indexed.");
|
|
||||||
// to improve stability on CI - seems that sometimes during big load we need to wait longer for the condition
|
|
||||||
await().atMost(120, TimeUnit.SECONDS)
|
|
||||||
.until(() -> getRestAPIFactory().getSearchAPI(null).search(ancestorSearchRequest).getPagination()
|
|
||||||
.getTotalItems() == NUMBER_OF_FILES);
|
|
||||||
|
|
||||||
holdBulkOperation = HoldBulkOperation.builder()
|
holdBulkOperation = HoldBulkOperation.builder()
|
||||||
.query(queryReq)
|
.query(queryReq)
|
||||||
.op(HoldBulkOperationType.ADD).build();
|
.op(HoldBulkOperationType.ADD).build();
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
com.epam.reportportal.testng.ReportPortalTestNGListener
|
||||||
@@ -23,7 +23,7 @@ Recorded content can be explicitly destroyed whilst maintaining the original nod
|
|||||||
* License: Alfresco Community
|
* License: Alfresco Community
|
||||||
* Issue Tracker Link: [JIRA RM](https://issues.alfresco.com/jira/projects/RM/summary)
|
* Issue Tracker Link: [JIRA RM](https://issues.alfresco.com/jira/projects/RM/summary)
|
||||||
* Contribution Model: Alfresco Closed Source
|
* Contribution Model: Alfresco Closed Source
|
||||||
* Documentation: [docs.alfresco.com (Records Management)](https://support.hyland.com/access?dita:id=job1721300866386&vrm_version=25.1&component=Alfresco%20Governance%20Services%20Community%20Edition)
|
* Documentation: [docs.alfresco.com (Records Management)](http://docs.alfresco.com/rm2.4/concepts/welcome-rm.html)
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
|
|||||||
@@ -21,18 +21,18 @@ RM is split into two main parts - a repository integration and a Share integrati
|
|||||||
* [Community License](../LICENSE.txt)
|
* [Community License](../LICENSE.txt)
|
||||||
* [Enterprise License](../../rm-enterprise/LICENSE.txt) (this file will only be present in clones of the Enterprise repository)
|
* [Enterprise License](../../rm-enterprise/LICENSE.txt) (this file will only be present in clones of the Enterprise repository)
|
||||||
* [Issue Tracker Link](https://issues.alfresco.com/jira/projects/RM)
|
* [Issue Tracker Link](https://issues.alfresco.com/jira/projects/RM)
|
||||||
* [Community Documentation Link](https://support.hyland.com/access?dita:id=job1721300866386&vrm_version=25.1&component=Alfresco%20Governance%20Services%20Community%20Edition)
|
* [Community Documentation Link](http://docs.alfresco.com/rm-community/concepts/welcome-rm.html)
|
||||||
* [Enterprise Documentation Link](https://support.hyland.com/access?dita:id=job1721300866386&vrm_version=25.1)
|
* [Enterprise Documentation Link](http://docs.alfresco.com/rm/concepts/welcome-rm.html)
|
||||||
* [Contribution Model](../../CONTRIBUTING.md)
|
* [Contribution Model](../../CONTRIBUTING.md)
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
### Prerequisite Knowledge
|
### Prerequisite Knowledge
|
||||||
An understanding of Alfresco Content Services is assumed. The following pages from the [developer documentation](https://support.hyland.com/access?dita:id=lsl1724405261585&vrm_version=25.2&component=Alfresco%20Content%20Services%20Community%20Edition) give useful background information:
|
An understanding of Alfresco Content Services is assumed. The following pages from the [developer documentation](http://docs.alfresco.com/5.2/concepts/dev-for-developers.html) give useful background information:
|
||||||
|
|
||||||
* [ACS Architecture](https://support.hyland.com/access?dita:id=lfo1719554691023&vrm_version=25.2)
|
* [ACS Architecture](http://docs.alfresco.com/5.2/concepts/dev-arch-overview.html)
|
||||||
* [Platform Extensions](https://support.hyland.com/access?dita:id=ifr1720080387005&vrm_version=25.2)
|
* [Platform Extensions](http://docs.alfresco.com/5.2/concepts/dev-platform-extensions.html)
|
||||||
* [Share Extensions](https://support.hyland.com/access?dita:id=wqu1720687386891&vrm_version=25.2)
|
* [Share Extensions](http://docs.alfresco.com/5.2/concepts/dev-extensions-share.html)
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
@@ -44,12 +44,12 @@ The RM Share module communicates with the repository module via REST APIs. Inter
|
|||||||
* A DAO layer responsible for CRUD operations against the database.
|
* A DAO layer responsible for CRUD operations against the database.
|
||||||
|
|
||||||
#### REST API
|
#### REST API
|
||||||
The REST API endpoints fall into two main types - v0 (Webscripts) and v1. The [v0 API](https://support.hyland.com/access?dita:id=fga1720080409048&vrm_version=25.2) is older and not recommended for integrations. The [v1 API](https://support.hyland.com/access?dita:id=cmm1721136574006&vrm_version=25.2) is newer but isn't yet feature complete. If you are running RM locally then the GS API Explorer will be available at [this link](http://localhost:8080/gs-api-explorer/).
|
The REST API endpoints fall into two main types - v0 (Webscripts) and v1. The [v0 API](http://docs.alfresco.com/5.2/references/dev-extension-points-webscripts.html) is older and not recommended for integrations. The [v1 API](http://docs.alfresco.com/5.1/pra/1/topics/pra-welcome-aara.html) is newer but isn't yet feature complete. If you are running RM locally then the GS API Explorer will be available at [this link](http://localhost:8080/gs-api-explorer/).
|
||||||
|
|
||||||
Internally the GS v1 REST API is built on the [Alfresco v1 REST API framework](https://community.alfresco.com/community/ecm/blog/2016/10/11/v1-rest-api-part-1-introduction). It aims to be consistent with this in terms of behaviour and naming.
|
Internally the GS v1 REST API is built on the [Alfresco v1 REST API framework](https://community.alfresco.com/community/ecm/blog/2016/10/11/v1-rest-api-part-1-introduction). It aims to be consistent with this in terms of behaviour and naming.
|
||||||
|
|
||||||
#### Java Public API
|
#### Java Public API
|
||||||
The Java service layer is fronted by a [Java Public API](https://support.hyland.com/access?dita:id=lol1721390191517&vrm_version=25.2), which we will ensure backward compatible with previous releases. Before we remove any methods there will first be a release containing that method deprecated to allow third party integrations to migrate to a new method. The Java Public API also includes a set of POJO objects which are needed to communicate with the services. It is easy to identify classes that are part of the Java Public API as they are annotated `@AlfrescoPublicApi`.
|
The Java service layer is fronted by a [Java Public API](http://docs.alfresco.com/5.2/concepts/java-public-api-list.html), which we will ensure backward compatible with previous releases. Before we remove any methods there will first be a release containing that method deprecated to allow third party integrations to migrate to a new method. The Java Public API also includes a set of POJO objects which are needed to communicate with the services. It is easy to identify classes that are part of the Java Public API as they are annotated `@AlfrescoPublicApi`.
|
||||||
|
|
||||||
Each Java service will have at least four beans defined for it:
|
Each Java service will have at least four beans defined for it:
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ Each Java service will have at least four beans defined for it:
|
|||||||
#### DAOs
|
#### DAOs
|
||||||
The DAOs are not part of the Java Public API, but handle CRUD operations against RM stored data. We have some custom queries to improve performance for particularly heavy operations.
|
The DAOs are not part of the Java Public API, but handle CRUD operations against RM stored data. We have some custom queries to improve performance for particularly heavy operations.
|
||||||
|
|
||||||
We use standard Alfresco [data modelling](https://support.hyland.com/access?dita:id=ekx1720080373621&vrm_version=25.2) to store RM metadata. We extend the [Alfresco patching mechanism](https://support.hyland.com/access?dita:id=ato1720080396825&vrm_version=25.2) to provide community and enterprise schema upgrades.
|
We use standard Alfresco [data modelling](http://docs.alfresco.com/5.2/references/dev-extension-points-content-model.html) to store RM metadata. We extend the [Alfresco patching mechanism](http://docs.alfresco.com/5.2/references/dev-extension-points-patch.html) to provide community and enterprise schema upgrades.
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
|
|||||||
@@ -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>25.3.0.4</version>
|
<version>25.1.0.21-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
SOLR6_TAG=2.0.16
|
SOLR6_TAG=2.0.13
|
||||||
POSTGRES_TAG=16.6
|
POSTGRES_TAG=15.4
|
||||||
ACTIVEMQ_TAG=5.18.3-jre17-rockylinux8
|
ACTIVEMQ_TAG=5.18.3-jre17-rockylinux8
|
||||||
|
|||||||
@@ -33,8 +33,5 @@
|
|||||||
|
|
||||||
<!-- content cleanser -->
|
<!-- content cleanser -->
|
||||||
<bean id="contentCleanser.522022M" class="org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser522022M"/>
|
<bean id="contentCleanser.522022M" class="org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser522022M"/>
|
||||||
|
|
||||||
<!-- content cleanser -->
|
|
||||||
<bean id="contentCleanser.SevenPass" class="org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanserSevenPass"/>
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@@ -78,12 +78,6 @@
|
|||||||
<property name="transactionService" ref="transactionService" />
|
<property name="transactionService" ref="transactionService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean class="org.alfresco.rm.rest.api.fileplans.FilePlanRolesRelation">
|
|
||||||
<property name="apiUtils" ref="apiUtils" />
|
|
||||||
<property name="rmRoles" ref="rm.roles" />
|
|
||||||
<property name="filePlanService" ref="FilePlanService" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean class="org.alfresco.rm.rest.api.holds.HoldsEntityResource" >
|
<bean class="org.alfresco.rm.rest.api.holds.HoldsEntityResource" >
|
||||||
<property name="holdService" ref="HoldService" />
|
<property name="holdService" ref="HoldService" />
|
||||||
<property name="apiUtils" ref="apiUtils" />
|
<property name="apiUtils" ref="apiUtils" />
|
||||||
@@ -234,11 +228,6 @@
|
|||||||
<property name="siteSurfConfig" ref="rm.siteSurfConfig" />
|
<property name="siteSurfConfig" ref="rm.siteSurfConfig" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="rm.roles" class="org.alfresco.rm.rest.api.impl.RMRolesImpl">
|
|
||||||
<property name="nodesModelFactory" ref="nodesModelFactory" />
|
|
||||||
<property name="filePlanRoleService" ref="FilePlanRoleService"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="rm.siteSurfConfig" class="org.alfresco.rest.api.impl.SiteSurfConfig">
|
<bean id="rm.siteSurfConfig" class="org.alfresco.rest.api.impl.SiteSurfConfig">
|
||||||
<property name="configPath" value="alfresco/module/org_alfresco_module_rm/bootstrap/site"/>
|
<property name="configPath" value="alfresco/module/org_alfresco_module_rm/bootstrap/site"/>
|
||||||
</bean>
|
</bean>
|
||||||
@@ -291,4 +280,4 @@
|
|||||||
<property name="beanName" value="restJsonModule" />
|
<property name="beanName" value="restJsonModule" />
|
||||||
<property name="extendingBeanName" value="rm.restJsonModule" />
|
<property name="extendingBeanName" value="rm.restJsonModule" />
|
||||||
</bean>
|
</bean>
|
||||||
</beans>
|
</beans>
|
||||||
@@ -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>25.3.0.4</version>
|
<version>25.1.0.21-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -84,6 +84,11 @@
|
|||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.epam.reportportal</groupId>
|
||||||
|
<artifactId>agent-java-testng</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
@@ -422,7 +427,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<images>
|
<images>
|
||||||
<image>
|
<image>
|
||||||
<name>postgres:16.6</name>
|
<name>postgres:15.4</name>
|
||||||
<run>
|
<run>
|
||||||
<ports>
|
<ports>
|
||||||
<port>${postgresql.tests.port}:${postgresql.port}</port>
|
<port>${postgresql.tests.port}:${postgresql.port}</port>
|
||||||
|
|||||||
@@ -30,12 +30,11 @@ package org.alfresco.module.org_alfresco_module_dod5015.caveat;
|
|||||||
/**
|
/**
|
||||||
* Compatibility Implementation.
|
* Compatibility Implementation.
|
||||||
* <p>
|
* <p>
|
||||||
* Used as a compatibility implementation when migrating from V1.0 to V2.0. RMCustom model still references
|
* Used as a compatibility implementation when migrating from V1.0 to V2.0. RMCustom model still references this class implementation, but package has been changed.
|
||||||
* this class implementation, but package has been changed.
|
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class RMListOfValuesConstraint extends org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint
|
public class RMListOfValuesConstraint extends org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint
|
||||||
{
|
{
|
||||||
// No implementation
|
// No implementation
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm;
|
package org.alfresco.module.org_alfresco_module_rm;
|
||||||
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException}
|
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException}
|
||||||
*/
|
*/
|
||||||
@@ -37,9 +38,9 @@ public class CannotApplyConstraintMetadataException extends CustomMetadataExcept
|
|||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6194867814140009959L;
|
private static final long serialVersionUID = -6194867814140009959L;
|
||||||
public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint";
|
public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint";
|
||||||
|
|
||||||
public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType)
|
public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType)
|
||||||
{
|
{
|
||||||
super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType));
|
super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ package org.alfresco.module.org_alfresco_module_rm;
|
|||||||
public abstract class CustomMetadataException extends Exception
|
public abstract class CustomMetadataException extends Exception
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6676112294794381360L;
|
private static final long serialVersionUID = -6676112294794381360L;
|
||||||
|
|
||||||
public CustomMetadataException(String msg)
|
public CustomMetadataException(String msg)
|
||||||
{
|
{
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm;
|
package org.alfresco.module.org_alfresco_module_rm;
|
||||||
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException}
|
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException}
|
||||||
*/
|
*/
|
||||||
@@ -37,9 +38,9 @@ public class InvalidCustomAspectMetadataException extends CustomMetadataExceptio
|
|||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6194867814140009959L;
|
private static final long serialVersionUID = -6194867814140009959L;
|
||||||
public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect";
|
public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect";
|
||||||
|
|
||||||
public InvalidCustomAspectMetadataException(QName customAspect, String aspectName)
|
public InvalidCustomAspectMetadataException(QName customAspect, String aspectName)
|
||||||
{
|
{
|
||||||
super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName));
|
super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ public class NotCustomisableMetadataException extends CustomMetadataException
|
|||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6194867814140009959L;
|
private static final long serialVersionUID = -6194867814140009959L;
|
||||||
public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable";
|
public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable";
|
||||||
|
|
||||||
public NotCustomisableMetadataException(String aspectName)
|
public NotCustomisableMetadataException(String aspectName)
|
||||||
{
|
{
|
||||||
super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName));
|
super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ public class PropertyAlreadyExistsMetadataException extends CustomMetadataExcept
|
|||||||
private static final long serialVersionUID = -6194867814140009959L;
|
private static final long serialVersionUID = -6194867814140009959L;
|
||||||
|
|
||||||
public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists";
|
public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists";
|
||||||
|
|
||||||
public PropertyAlreadyExistsMetadataException(String propIdAsString)
|
public PropertyAlreadyExistsMetadataException(String propIdAsString)
|
||||||
{
|
{
|
||||||
super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString));
|
super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ package org.alfresco.module.org_alfresco_module_rm;
|
|||||||
/**
|
/**
|
||||||
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService}
|
* @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService}
|
||||||
*/
|
*/
|
||||||
public interface RecordsManagementAdminService
|
public interface RecordsManagementAdminService
|
||||||
extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService
|
extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,4 +305,4 @@ public interface RecordsManagementService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
boolean isRecord(NodeRef nodeRef);
|
boolean isRecord(NodeRef nodeRef);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ import org.alfresco.service.namespace.QName;
|
|||||||
* @deprecated as of 2.2
|
* @deprecated as of 2.2
|
||||||
*/
|
*/
|
||||||
public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
||||||
implements RecordsManagementService,
|
implements RecordsManagementService,
|
||||||
RecordsManagementModel
|
RecordsManagementModel
|
||||||
{
|
{
|
||||||
/** Store that the RM roots are contained within */
|
/** Store that the RM roots are contained within */
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private StoreRef defaultStoreRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
|
private StoreRef defaultStoreRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
|
||||||
@@ -67,7 +67,8 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Set the service registry service
|
* Set the service registry service
|
||||||
*
|
*
|
||||||
* @param serviceRegistry service registry
|
* @param serviceRegistry
|
||||||
|
* service registry
|
||||||
*/
|
*/
|
||||||
public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry)
|
public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry)
|
||||||
{
|
{
|
||||||
@@ -78,7 +79,9 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default RM store reference
|
* Sets the default RM store reference
|
||||||
* @param defaultStoreRef store reference
|
*
|
||||||
|
* @param defaultStoreRef
|
||||||
|
* store reference
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setDefaultStoreRef(StoreRef defaultStoreRef)
|
public void setDefaultStoreRef(StoreRef defaultStoreRef)
|
||||||
@@ -91,7 +94,7 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
|||||||
*/
|
*/
|
||||||
private FilePlanService getFilePlanService()
|
private FilePlanService getFilePlanService()
|
||||||
{
|
{
|
||||||
return serviceRegistry.getFilePlanService();
|
return serviceRegistry.getFilePlanService();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -425,7 +428,7 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
|||||||
* @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map)}
|
* @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map)}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public NodeRef createRecordFolder(NodeRef parent, String name, Map<QName, Serializable> properties)
|
public NodeRef createRecordFolder(NodeRef parent, String name, Map<QName, Serializable> properties)
|
||||||
{
|
{
|
||||||
return getRecordFolderService().createRecordFolder(parent, name, properties);
|
return getRecordFolderService().createRecordFolder(parent, name, properties);
|
||||||
}
|
}
|
||||||
@@ -501,4 +504,4 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
|
|||||||
{
|
{
|
||||||
return getRecordService().isRecord(nodeRef);
|
return getRecordService().isRecord(nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,4 +80,4 @@ public interface RecordsManagementAuditServiceDeprecated
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
void auditRMAction(RecordsManagementAction action, NodeRef nodeRef, Map<String, Serializable> parameters);
|
void auditRMAction(RecordsManagementAction action, NodeRef nodeRef, Map<String, Serializable> parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
for (Map.Entry<String, List<String>> entry : source.entrySet())
|
for (Map.Entry<String, List<String>> entry : source.entrySet())
|
||||||
{
|
{
|
||||||
List<String>values = entry.getValue();
|
List<String> values = entry.getValue();
|
||||||
for (String value : values)
|
for (String value : values)
|
||||||
{
|
{
|
||||||
String authority = entry.getKey();
|
String authority = entry.getKey();
|
||||||
@@ -54,7 +54,7 @@ import java.util.Map;
|
|||||||
{
|
{
|
||||||
// already exists
|
// already exists
|
||||||
List<String> list = pivot.get(value);
|
List<String> list = pivot.get(value);
|
||||||
list.add(authority );
|
list.add(authority);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -68,4 +68,4 @@ import java.util.Map;
|
|||||||
|
|
||||||
return pivot;
|
return pivot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ public interface RMCaveatConfigComponent
|
|||||||
/**
|
/**
|
||||||
* Get RM constraint list
|
* Get RM constraint list
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
*/
|
*/
|
||||||
RMConstraintInfo getRMConstraint(String listName);
|
RMConstraintInfo getRMConstraint(String listName);
|
||||||
|
|
||||||
@@ -82,12 +83,12 @@ public interface RMCaveatConfigComponent
|
|||||||
/**
|
/**
|
||||||
* Update RM constraint values for given authority
|
* Update RM constraint values for given authority
|
||||||
*/
|
*/
|
||||||
void updateRMConstraintListAuthority(String listName, String authorityName, List<String>values);
|
void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update RM constraint authorities for given value
|
* Update RM constraint authorities for given value
|
||||||
*/
|
*/
|
||||||
void updateRMConstraintListValue(String listName, String valueName, List<String>authorities);
|
void updateRMConstraintListValue(String listName, String valueName, List<String> authorities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove RM constraint value (all authorities)
|
* Remove RM constraint value (all authorities)
|
||||||
@@ -102,12 +103,14 @@ public interface RMCaveatConfigComponent
|
|||||||
/**
|
/**
|
||||||
* Delete RM Constraint
|
* Delete RM Constraint
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
*/
|
*/
|
||||||
void deleteRMConstraint(String listName);
|
void deleteRMConstraint(String listName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the details of a caveat list
|
* Get the details of a caveat list
|
||||||
|
*
|
||||||
* @param listName
|
* @param listName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -118,4 +121,4 @@ public interface RMCaveatConfigComponent
|
|||||||
NodeRef updateOrCreateCaveatConfig(String jsonString);
|
NodeRef updateOrCreateCaveatConfig(String jsonString);
|
||||||
|
|
||||||
NodeRef updateOrCreateCaveatConfig(InputStream is);
|
NodeRef updateOrCreateCaveatConfig(InputStream is);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ import java.util.concurrent.locks.ReadWriteLock;
|
|||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
import net.sf.acegisecurity.AccessDeniedException;
|
import net.sf.acegisecurity.AccessDeniedException;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic;
|
import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic;
|
||||||
@@ -77,10 +82,6 @@ import org.alfresco.service.cmr.security.PersonService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.JSONtoFmModel;
|
import org.alfresco.util.JSONtoFmModel;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RM Caveat Config component impl
|
* RM Caveat Config component impl
|
||||||
@@ -89,9 +90,9 @@ import org.json.JSONObject;
|
|||||||
*/
|
*/
|
||||||
@BehaviourBean(defaultType = "rma:caveatConfig")
|
@BehaviourBean(defaultType = "rma:caveatConfig")
|
||||||
public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnContentUpdatePolicy,
|
public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnContentUpdatePolicy,
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||||
NodeServicePolicies.OnCreateNodePolicy,
|
NodeServicePolicies.OnCreateNodePolicy,
|
||||||
RMCaveatConfigComponent
|
RMCaveatConfigComponent
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(RMCaveatConfigComponentImpl.class);
|
private static Log logger = LogFactory.getLog(RMCaveatConfigComponentImpl.class);
|
||||||
|
|
||||||
@@ -122,12 +123,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
private Lock readLock = lock.readLock();
|
private Lock readLock = lock.readLock();
|
||||||
private Lock writeLock = lock.writeLock();
|
private Lock writeLock = lock.writeLock();
|
||||||
|
|
||||||
/*
|
/* Caveat Config (Shared) config first string is property name second string is authority name (user or group full name) third string is list of values of property */
|
||||||
* Caveat Config (Shared) config
|
|
||||||
* first string is property name
|
|
||||||
* second string is authority name (user or group full name)
|
|
||||||
* third string is list of values of property
|
|
||||||
*/
|
|
||||||
private SimpleCache<String, Map<String, List<String>>> caveatConfig;
|
private SimpleCache<String, Map<String, List<String>>> caveatConfig;
|
||||||
|
|
||||||
public void setCaveatConfig(SimpleCache<String, Map<String, List<String>>> caveatConfig)
|
public void setCaveatConfig(SimpleCache<String, Map<String, List<String>>> caveatConfig)
|
||||||
@@ -194,7 +190,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.info("Caveat aspects configured "+caveatAspectQNames);
|
logger.info("Caveat aspects configured " + caveatAspectQNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -211,7 +207,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.info("Caveat models configured "+caveatModelQNames);
|
logger.info("Caveat models configured " + caveatModelQNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -227,20 +223,17 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean)
|
* @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted
|
||||||
* RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Behaviour
|
@Behaviour(
|
||||||
(
|
kind = BehaviourKind.CLASS,
|
||||||
kind = BehaviourKind.CLASS,
|
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT)
|
||||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
|
||||||
)
|
|
||||||
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
|
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.info("onContentUpdate: "+nodeRef+", "+newContent);
|
logger.info("onContentUpdate: " + nodeRef + ", " + newContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateAndReset(nodeRef);
|
validateAndReset(nodeRef);
|
||||||
@@ -255,7 +248,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.info("beforeDeleteNode: "+nodeRef);
|
logger.info("beforeDeleteNode: " + nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateAndReset(nodeRef);
|
validateAndReset(nodeRef);
|
||||||
@@ -270,7 +263,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.info("onCreateNode: "+childAssocRef);
|
logger.info("onCreateNode: " + childAssocRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateAndReset(childAssocRef.getChildRef());
|
validateAndReset(childAssocRef.getChildRef());
|
||||||
@@ -279,8 +272,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
/**
|
/**
|
||||||
* Validate the caveat config and optionally update the cache.
|
* Validate the caveat config and optionally update the cache.
|
||||||
*
|
*
|
||||||
* @param nodeRef The nodeRef of the config
|
* @param nodeRef
|
||||||
*/
|
* The nodeRef of the config
|
||||||
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected void validateAndReset(NodeRef nodeRef)
|
protected void validateAndReset(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -294,9 +288,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
if (caveatConfigData != null)
|
if (caveatConfigData != null)
|
||||||
{
|
{
|
||||||
NodeRef existing = getCaveatConfigNode();
|
NodeRef existing = getCaveatConfigNode();
|
||||||
if ((existing != null && (! existing.equals(nodeRef))))
|
if ((existing != null && (!existing.equals(nodeRef))))
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing="+existing+", new="+nodeRef+")");
|
throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing=" + existing + ", new=" + nodeRef + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -321,7 +315,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
if (logger.isTraceEnabled())
|
if (logger.isTraceEnabled())
|
||||||
{
|
{
|
||||||
logger.trace("validateAndReset: models to check "+models);
|
logger.trace("validateAndReset: models to check " + models);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QName model : models)
|
for (QName model : models)
|
||||||
@@ -338,7 +332,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
if (logger.isTraceEnabled())
|
if (logger.isTraceEnabled())
|
||||||
{
|
{
|
||||||
logger.trace("validateAndReset: properties to check "+props);
|
logger.trace("validateAndReset: properties to check " + props);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,12 +355,12 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! prefixFound)
|
if (!prefixFound)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unexpected prefix: "+ conPrefix + " (" + conStr +") expected one of "+expectedPrefixes+")");
|
throw new AlfrescoRuntimeException("Unexpected prefix: " + conPrefix + " (" + conStr + ") expected one of " + expectedPrefixes + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<String>> caveatMap = (Map<String, List<String>>)conEntry.getValue();
|
Map<String, List<String>> caveatMap = (Map<String, List<String>>) conEntry.getValue();
|
||||||
|
|
||||||
List<String> allowedValues = null;
|
List<String> allowedValues = null;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -381,15 +375,14 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
final Constraint con = conDef.getConstraint();
|
final Constraint con = conDef.getConstraint();
|
||||||
if (con instanceof RMListOfValuesConstraint)
|
if (con instanceof RMListOfValuesConstraint)
|
||||||
{
|
{
|
||||||
String conName = ((RMListOfValuesConstraint)con).getShortName();
|
String conName = ((RMListOfValuesConstraint) con).getShortName();
|
||||||
if (conName.equals(conStr))
|
if (conName.equals(conStr))
|
||||||
{
|
{
|
||||||
// note: assumes only one caveat/LOV against a given property
|
// note: assumes only one caveat/LOV against a given property
|
||||||
allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
|
allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
|
||||||
{
|
|
||||||
public List<String> doWork()
|
public List<String> doWork()
|
||||||
{
|
{
|
||||||
return ((RMListOfValuesConstraint)con).getAllowedValues();
|
return ((RMListOfValuesConstraint) con).getAllowedValues();
|
||||||
}
|
}
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
@@ -404,7 +397,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
logger.info("Processing constraint: "+conQName);
|
logger.info("Processing constraint: " + conQName);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<String, List<String>> caveatEntry : caveatMap.entrySet())
|
for (Map.Entry<String, List<String>> caveatEntry : caveatMap.entrySet())
|
||||||
@@ -413,20 +406,20 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
List<String> caveatList = caveatEntry.getValue();
|
List<String> caveatList = caveatEntry.getValue();
|
||||||
|
|
||||||
// validate authority (user or group) - note: groups are configured with fullname (ie. GROUP_xxx)
|
// validate authority (user or group) - note: groups are configured with fullname (ie. GROUP_xxx)
|
||||||
if ((! authorityService.authorityExists(authorityName) && ! personService.personExists(authorityName)))
|
if ((!authorityService.authorityExists(authorityName) && !personService.personExists(authorityName)))
|
||||||
{
|
{
|
||||||
// TODO - review warnings (& I18N)
|
// TODO - review warnings (& I18N)
|
||||||
String msg = "User/group does not exist: "+authorityName+" (constraint="+conStr+")";
|
String msg = "User/group does not exist: " + authorityName + " (constraint=" + conStr + ")";
|
||||||
logger.warn(msg);
|
logger.warn(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate caveat list
|
// validate caveat list
|
||||||
for (String value : caveatList)
|
for (String value : caveatList)
|
||||||
{
|
{
|
||||||
if (! allowedValues.contains(value))
|
if (!allowedValues.contains(value))
|
||||||
{
|
{
|
||||||
// TODO - review warnings (& add I18N)
|
// TODO - review warnings (& add I18N)
|
||||||
String msg = "Invalid value in list: "+value+" (authority="+authorityName+", constraint="+conStr+")";
|
String msg = "Invalid value in list: " + value + " (authority=" + authorityName + ", constraint=" + conStr + ")";
|
||||||
logger.warn(msg);
|
logger.warn(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,7 +437,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
for (Map.Entry<String, Object> conEntry : caveatConfigMap.entrySet())
|
for (Map.Entry<String, Object> conEntry : caveatConfigMap.entrySet())
|
||||||
{
|
{
|
||||||
String conStr = conEntry.getKey();
|
String conStr = conEntry.getKey();
|
||||||
Map<String, List<String>> caveatMap = (Map<String, List<String>>)conEntry.getValue();
|
Map<String, List<String>> caveatMap = (Map<String, List<String>>) conEntry.getValue();
|
||||||
|
|
||||||
Map<String, List<String>> cacheValue = caveatConfig.get(conStr);
|
Map<String, List<String>> cacheValue = caveatConfig.get(conStr);
|
||||||
if (cacheValue == null || !cacheValue.equals(caveatMap))
|
if (cacheValue == null || !cacheValue.equals(caveatMap))
|
||||||
@@ -461,7 +454,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
}
|
}
|
||||||
catch (JSONException e)
|
catch (JSONException e)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Invalid caveat config syntax: "+e);
|
throw new AlfrescoRuntimeException("Invalid caveat config syntax: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -473,7 +466,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_CAVEAT_CONFIG, CAVEAT_CONFIG_NAME);
|
return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_CAVEAT_CONFIG, CAVEAT_CONFIG_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public NodeRef updateOrCreateCaveatConfig(InputStream is)
|
public NodeRef updateOrCreateCaveatConfig(InputStream is)
|
||||||
{
|
{
|
||||||
NodeRef caveatConfig = getOrCreateCaveatConfig();
|
NodeRef caveatConfig = getOrCreateCaveatConfig();
|
||||||
@@ -523,9 +515,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
// Create caveat config
|
// Create caveat config
|
||||||
caveatConfig = nodeService.createNode(rootNode,
|
caveatConfig = nodeService.createNode(rootNode,
|
||||||
RecordsManagementModel.ASSOC_CAVEAT_CONFIG,
|
RecordsManagementModel.ASSOC_CAVEAT_CONFIG,
|
||||||
QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME),
|
QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME),
|
||||||
RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef();
|
RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef();
|
||||||
|
|
||||||
nodeService.setProperty(caveatConfig, ContentModel.PROP_NAME, CAVEAT_CONFIG_NAME);
|
nodeService.setProperty(caveatConfig, ContentModel.PROP_NAME, CAVEAT_CONFIG_NAME);
|
||||||
}
|
}
|
||||||
@@ -569,7 +561,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
private List<String> getRMAllowedValues(String userName, Set<String> userGroupFullNames, String constraintName)
|
private List<String> getRMAllowedValues(String userName, Set<String> userGroupFullNames, String constraintName)
|
||||||
{
|
{
|
||||||
Set<String>allowedValues = new HashSet<>();
|
Set<String> allowedValues = new HashSet<>();
|
||||||
|
|
||||||
// note: userName and userGroupNames must not be null
|
// note: userName and userGroupNames must not be null
|
||||||
Map<String, List<String>> caveatConstraintDef = null;
|
Map<String, List<String>> caveatConstraintDef = null;
|
||||||
@@ -586,22 +578,22 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
if (caveatConstraintDef != null)
|
if (caveatConstraintDef != null)
|
||||||
{
|
{
|
||||||
List<String> direct = caveatConstraintDef.get(userName);
|
List<String> direct = caveatConstraintDef.get(userName);
|
||||||
if(direct != null)
|
if (direct != null)
|
||||||
{
|
{
|
||||||
allowedValues.addAll(direct);
|
allowedValues.addAll(direct);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String group : userGroupFullNames)
|
for (String group : userGroupFullNames)
|
||||||
{
|
{
|
||||||
List<String> values = caveatConstraintDef.get(group);
|
List<String> values = caveatConstraintDef.get(group);
|
||||||
if(values != null)
|
if (values != null)
|
||||||
{
|
{
|
||||||
allowedValues.addAll(values);
|
allowedValues.addAll(values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String>ret = new ArrayList<>();
|
List<String> ret = new ArrayList<>();
|
||||||
ret.addAll(allowedValues);
|
ret.addAll(allowedValues);
|
||||||
return Collections.unmodifiableList(ret);
|
return Collections.unmodifiableList(ret);
|
||||||
}
|
}
|
||||||
@@ -617,7 +609,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ((! nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0))
|
if ((!nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -632,7 +624,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! found)
|
if (!found)
|
||||||
{
|
{
|
||||||
// no caveat aspect
|
// no caveat aspect
|
||||||
return true;
|
return true;
|
||||||
@@ -658,7 +650,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
Constraint con = conDef.getConstraint();
|
Constraint con = conDef.getConstraint();
|
||||||
if (con instanceof RMListOfValuesConstraint)
|
if (con instanceof RMListOfValuesConstraint)
|
||||||
{
|
{
|
||||||
RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint)con);
|
RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint) con);
|
||||||
String conName = rmCon.getShortName();
|
String conName = rmCon.getShortName();
|
||||||
MatchLogic matchLogic = rmCon.getMatchLogicEnum();
|
MatchLogic matchLogic = rmCon.getMatchLogicEnum();
|
||||||
Map<String, List<String>> caveatConstraintDef = caveatConfig.get(conName);
|
Map<String, List<String>> caveatConstraintDef = caveatConfig.get(conName);
|
||||||
@@ -676,18 +668,18 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
if (val instanceof String)
|
if (val instanceof String)
|
||||||
{
|
{
|
||||||
propValues = new ArrayList<>(1);
|
propValues = new ArrayList<>(1);
|
||||||
propValues.add((String)val);
|
propValues.add((String) val);
|
||||||
}
|
}
|
||||||
else if (val instanceof List)
|
else if (val instanceof List)
|
||||||
{
|
{
|
||||||
propValues = (List<String>)val;
|
propValues = (List<String>) val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propValues != null && !isAllowed(propValues, allowedValues, matchLogic))
|
if (propValues != null && !isAllowed(propValues, allowedValues, matchLogic))
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Veto access: caveat="+conName+", userName="+userName+", nodeRef="+nodeRef+", propName="+propName+", propValues="+propValues+", allowedValues="+allowedValues);
|
logger.debug("Veto access: caveat=" + conName + ", userName=" + userName + ", nodeRef=" + nodeRef + ", propName=" + propName + ", propValues=" + propValues + ", allowedValues=" + allowedValues);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -714,11 +706,11 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
// check user/group values match all values on node
|
// check user/group values match all values on node
|
||||||
for (String propValue : propValues)
|
for (String propValue : propValues)
|
||||||
{
|
{
|
||||||
if (! userGroupValues.contains(propValue))
|
if (!userGroupValues.contains(propValue))
|
||||||
{
|
{
|
||||||
if (logger.isTraceEnabled())
|
if (logger.isTraceEnabled())
|
||||||
{
|
{
|
||||||
logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic);
|
logger.trace("Not allowed: " + propValues + ", " + userGroupValues + ", " + matchLogic);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -740,23 +732,25 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
if (logger.isTraceEnabled())
|
if (logger.isTraceEnabled())
|
||||||
{
|
{
|
||||||
logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic);
|
logger.trace("Not allowed: " + propValues + ", " + userGroupValues + ", " + matchLogic);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.error("Unexpected match logic type: "+matchLogic);
|
logger.error("Unexpected match logic type: " + matchLogic);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a single value to an authority in a list. The existing values of the list remain.
|
* Add a single value to an authority in a list. The existing values of the list remain.
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
* @param value
|
* @param value
|
||||||
* @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
|
* @throws AlfrescoRuntimeException
|
||||||
|
* if either the list or the authority do not already exist.
|
||||||
*/
|
*/
|
||||||
public void addRMConstraintListValue(String listName, String authorityName, String value)
|
public void addRMConstraintListValue(String listName, String authorityName, String value)
|
||||||
{
|
{
|
||||||
@@ -765,9 +759,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
readLock.lock();
|
readLock.lock();
|
||||||
members = caveatConfig.get(listName);
|
members = caveatConfig.get(listName);
|
||||||
if(members == null)
|
if (members == null)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName);
|
throw new AlfrescoRuntimeException("unable to add to list, list not defined:" + listName);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -776,15 +770,15 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
// check again
|
// check again
|
||||||
members = caveatConfig.get(listName);
|
members = caveatConfig.get(listName);
|
||||||
if(members == null)
|
if (members == null)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName);
|
throw new AlfrescoRuntimeException("unable to add to list, list not defined:" + listName);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> values = members.get(authorityName);
|
List<String> values = members.get(authorityName);
|
||||||
if(values == null)
|
if (values == null)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: "+ listName + " authorityName:" +authorityName);
|
throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: " + listName + " authorityName:" + authorityName);
|
||||||
}
|
}
|
||||||
values.add(value);
|
values.add(value);
|
||||||
|
|
||||||
@@ -806,6 +800,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the member details of the specified list
|
* Get the member details of the specified list
|
||||||
|
*
|
||||||
* @param listName
|
* @param listName
|
||||||
* @return the details of the specified list
|
* @return the details of the specified list
|
||||||
*/
|
*/
|
||||||
@@ -837,23 +832,23 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the values for an authority in a list.
|
* Replace the values for an authority in a list. The existing values are removed.
|
||||||
* The existing values are removed.
|
|
||||||
*
|
*
|
||||||
* If the authority does not already exist in the list, it will be added
|
* If the authority does not already exist in the list, it will be added
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
* @param values
|
* @param values
|
||||||
*/
|
*/
|
||||||
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String>values)
|
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values)
|
||||||
{
|
{
|
||||||
Map<String, List<String>> members = null;
|
Map<String, List<String>> members = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
members = caveatConfig.get(listName);
|
members = caveatConfig.get(listName);
|
||||||
if(members == null)
|
if (members == null)
|
||||||
{
|
{
|
||||||
// Create the new list, with the authority name
|
// Create the new list, with the authority name
|
||||||
Map<String, List<String>> constraint = new HashMap<>(0);
|
Map<String, List<String>> constraint = new HashMap<>(0);
|
||||||
@@ -881,7 +876,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
* @param valueName
|
* @param valueName
|
||||||
* @param authorities
|
* @param authorities
|
||||||
*/
|
*/
|
||||||
public void updateRMConstraintListValue(String listName, String valueName, List<String>authorities)
|
public void updateRMConstraintListValue(String listName, String valueName, List<String> authorities)
|
||||||
{
|
{
|
||||||
|
|
||||||
Map<String, List<String>> members = caveatConfig.get(listName);
|
Map<String, List<String>> members = caveatConfig.get(listName);
|
||||||
@@ -889,7 +884,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
|
|
||||||
if(members == null)
|
if (members == null)
|
||||||
{
|
{
|
||||||
// Members List does not exist
|
// Members List does not exist
|
||||||
Map<String, List<String>> emptyConstraint = new HashMap<>(0);
|
Map<String, List<String>> emptyConstraint = new HashMap<>(0);
|
||||||
@@ -903,21 +898,21 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
// remove all authorities which have this value
|
// remove all authorities which have this value
|
||||||
List<String> existingAuthorities = pivot.get(valueName);
|
List<String> existingAuthorities = pivot.get(valueName);
|
||||||
if(existingAuthorities != null)
|
if (existingAuthorities != null)
|
||||||
{
|
{
|
||||||
for(String authority : existingAuthorities)
|
for (String authority : existingAuthorities)
|
||||||
{
|
{
|
||||||
List<String> vals = members.get(authority);
|
List<String> vals = members.get(authority);
|
||||||
vals.remove(valueName);
|
vals.remove(valueName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add the new authorities for this value
|
// add the new authorities for this value
|
||||||
for(String authority : authorities)
|
for (String authority : authorities)
|
||||||
{
|
{
|
||||||
List<String> vals = members.get(authority);
|
List<String> vals = members.get(authority);
|
||||||
if(vals == null)
|
if (vals == null)
|
||||||
{
|
{
|
||||||
vals= new ArrayList<>();
|
vals = new ArrayList<>();
|
||||||
members.put(authority, vals);
|
members.put(authority, vals);
|
||||||
}
|
}
|
||||||
vals.add(valueName);
|
vals.add(valueName);
|
||||||
@@ -955,9 +950,9 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
// remove all authorities which have this value
|
// remove all authorities which have this value
|
||||||
List<String> existingAuthorities = pivot.get(valueName);
|
List<String> existingAuthorities = pivot.get(valueName);
|
||||||
if(existingAuthorities != null)
|
if (existingAuthorities != null)
|
||||||
{
|
{
|
||||||
for(String authority : existingAuthorities)
|
for (String authority : existingAuthorities)
|
||||||
{
|
{
|
||||||
List<String> vals = members.get(authority);
|
List<String> vals = members.get(authority);
|
||||||
vals.remove(valueName);
|
vals.remove(valueName);
|
||||||
@@ -984,7 +979,8 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
/**
|
/**
|
||||||
* Remove an authority from a list
|
* Remove an authority from a list
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
*/
|
*/
|
||||||
public void removeRMConstraintListAuthority(String listName, String authorityName)
|
public void removeRMConstraintListAuthority(String listName, String authorityName)
|
||||||
@@ -994,7 +990,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
members = caveatConfig.get(listName);
|
members = caveatConfig.get(listName);
|
||||||
if(members != null)
|
if (members != null)
|
||||||
{
|
{
|
||||||
members.remove(listName);
|
members.remove(listName);
|
||||||
}
|
}
|
||||||
@@ -1007,10 +1003,11 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
{
|
{
|
||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param config the configuration to convert
|
* @param config
|
||||||
|
* the configuration to convert
|
||||||
* @return a String containing the JSON representation of the configuration.
|
* @return a String containing the JSON representation of the configuration.
|
||||||
*/
|
*/
|
||||||
private String convertToJSONString(SimpleCache<String, Map<String, List<String>>> config)
|
private String convertToJSONString(SimpleCache<String, Map<String, List<String>>> config)
|
||||||
@@ -1070,24 +1067,24 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an RMConstraintInfo
|
* Get an RMConstraintInfo
|
||||||
|
*
|
||||||
* @param listQName
|
* @param listQName
|
||||||
* @return the constraint or null if it does not exist
|
* @return the constraint or null if it does not exist
|
||||||
*/
|
*/
|
||||||
public RMConstraintInfo getRMConstraint(QName listQName)
|
public RMConstraintInfo getRMConstraint(QName listQName)
|
||||||
{
|
{
|
||||||
ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName);
|
ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName);
|
||||||
if(dictionaryDef != null)
|
if (dictionaryDef != null)
|
||||||
{
|
{
|
||||||
Constraint con = dictionaryDef.getConstraint();
|
Constraint con = dictionaryDef.getConstraint();
|
||||||
if (con instanceof RMListOfValuesConstraint)
|
if (con instanceof RMListOfValuesConstraint)
|
||||||
{
|
{
|
||||||
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
|
final RMListOfValuesConstraint def = (RMListOfValuesConstraint) con;
|
||||||
|
|
||||||
RMConstraintInfo info = new RMConstraintInfo();
|
RMConstraintInfo info = new RMConstraintInfo();
|
||||||
info.setName(listQName.toPrefixString());
|
info.setName(listQName.toPrefixString());
|
||||||
info.setTitle(con.getTitle());
|
info.setTitle(con.getTitle());
|
||||||
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
|
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
|
||||||
{
|
|
||||||
public List<String> doWork()
|
public List<String> doWork()
|
||||||
{
|
{
|
||||||
return def.getAllowedValues();
|
return def.getAllowedValues();
|
||||||
@@ -1141,4 +1138,4 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
|||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public interface RMCaveatConfigService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get allowed values for given caveat list (for current user)
|
* Get allowed values for given caveat list (for current user)
|
||||||
|
*
|
||||||
* @param constraintName
|
* @param constraintName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -55,18 +56,15 @@ public interface RMCaveatConfigService
|
|||||||
*/
|
*/
|
||||||
boolean hasAccess(NodeRef nodeRef);
|
boolean hasAccess(NodeRef nodeRef);
|
||||||
|
|
||||||
/*
|
/* Get a single RM constraint */
|
||||||
* Get a single RM constraint
|
|
||||||
*/
|
|
||||||
RMConstraintInfo getRMConstraint(String listName);
|
RMConstraintInfo getRMConstraint(String listName);
|
||||||
|
|
||||||
/*
|
/* Get the names of all the caveat lists */
|
||||||
* Get the names of all the caveat lists
|
|
||||||
*/
|
|
||||||
Set<RMConstraintInfo> getAllRMConstraints();
|
Set<RMConstraintInfo> getAllRMConstraints();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the details of a caveat list
|
* Get the details of a caveat list
|
||||||
|
*
|
||||||
* @param listName
|
* @param listName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -80,80 +78,91 @@ public interface RMCaveatConfigService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* add RM constraint list
|
* add RM constraint list
|
||||||
* @param listName the name of the RMConstraintList
|
*
|
||||||
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param listTitle
|
* @param listTitle
|
||||||
*/
|
*/
|
||||||
RMConstraintInfo addRMConstraint(String listName, String listTitle, String[] allowedValues);
|
RMConstraintInfo addRMConstraint(String listName, String listTitle, String[] allowedValues);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update RM constraint list allowed values
|
* update RM constraint list allowed values
|
||||||
* @param listName the name of the RMConstraintList - can not be changed
|
*
|
||||||
|
* @param listName
|
||||||
|
* the name of the RMConstraintList - can not be changed
|
||||||
* @param allowedValues
|
* @param allowedValues
|
||||||
*/
|
*/
|
||||||
RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues);
|
RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update RM constraint Title
|
* update RM constraint Title
|
||||||
* @param listName the name of the RMConstraintList - can not be changed
|
*
|
||||||
* @param newTitle the new value for the title constraint
|
* @param listName
|
||||||
|
* the name of the RMConstraintList - can not be changed
|
||||||
|
* @param newTitle
|
||||||
|
* the new value for the title constraint
|
||||||
*/
|
*/
|
||||||
RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle);
|
RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete RM Constraint
|
* delete RM Constraint
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
*/
|
*/
|
||||||
void deleteRMConstraint(String listName);
|
void deleteRMConstraint(String listName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a single value to an authority in a list. The existing values of the list remain.
|
* Add a single value to an authority in a list. The existing values of the list remain.
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
* @param value
|
* @param value
|
||||||
* @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
|
* @throws AlfrescoRuntimeException
|
||||||
|
* if either the list or the authority do not already exist.
|
||||||
*/
|
*/
|
||||||
void addRMConstraintListValue(String listName, String authorityName, String value);
|
void addRMConstraintListValue(String listName, String authorityName, String value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the values for an authority in a list.
|
* Replace the values for an authority in a list. The existing values are removed.
|
||||||
* The existing values are removed.
|
|
||||||
*
|
*
|
||||||
* If the authority does not already exist in the list, it will be added
|
* If the authority does not already exist in the list, it will be added
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
* @param values
|
* @param values
|
||||||
*/
|
*/
|
||||||
void updateRMConstraintListAuthority(String listName, String authorityName, List<String>values);
|
void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an authority from a list
|
* Remove an authority from a list
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
*/
|
*/
|
||||||
void removeRMConstraintListAuthority(String listName, String authorityName);
|
void removeRMConstraintListAuthority(String listName, String authorityName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the values for an authority in a list.
|
* Replace the values for an authority in a list. The existing values are removed.
|
||||||
* The existing values are removed.
|
|
||||||
*
|
*
|
||||||
* If the authority does not already exist in the list, it will be added
|
* If the authority does not already exist in the list, it will be added
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param value
|
* @param value
|
||||||
* @param authorities
|
* @param authorities
|
||||||
*/
|
*/
|
||||||
void updateRMConstraintListValue(String listName, String value, List<String>authorities);
|
void updateRMConstraintListValue(String listName, String value, List<String> authorities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an authority from a list
|
* Remove an authority from a list
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param valueName
|
* @param valueName
|
||||||
*/
|
*/
|
||||||
void removeRMConstraintListValue(String listName, String valueName);
|
void removeRMConstraintListValue(String listName, String valueName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic;
|
import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic;
|
||||||
@@ -48,8 +51,6 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RM Caveat Config Service impl
|
* RM Caveat Config Service impl
|
||||||
@@ -66,7 +67,6 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
private RMCaveatConfigComponent rmCaveatConfigComponent;
|
private RMCaveatConfigComponent rmCaveatConfigComponent;
|
||||||
private RecordsManagementAdminService recordsManagementAdminService;
|
private RecordsManagementAdminService recordsManagementAdminService;
|
||||||
|
|
||||||
|
|
||||||
public void setNamespaceService(NamespaceService namespaceService)
|
public void setNamespaceService(NamespaceService namespaceService)
|
||||||
{
|
{
|
||||||
this.namespaceService = namespaceService;
|
this.namespaceService = namespaceService;
|
||||||
@@ -131,7 +131,9 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* add RM constraint list
|
* add RM constraint list
|
||||||
* @param listName the name of the RMConstraintList
|
*
|
||||||
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
*/
|
*/
|
||||||
public RMConstraintInfo addRMConstraint(String listName, String title, String[] values)
|
public RMConstraintInfo addRMConstraint(String listName, String title, String[] values)
|
||||||
{
|
{
|
||||||
@@ -150,8 +152,8 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
listName = sb.toString();
|
listName = sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String>allowedValues = new ArrayList<>();
|
List<String> allowedValues = new ArrayList<>();
|
||||||
for(String value : values)
|
for (String value : values)
|
||||||
{
|
{
|
||||||
allowedValues.add(value);
|
allowedValues.add(value);
|
||||||
}
|
}
|
||||||
@@ -185,7 +187,8 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
/**
|
/**
|
||||||
* delete RM Constraint List
|
* delete RM Constraint List
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
*/
|
*/
|
||||||
public void deleteRMConstraint(String listName)
|
public void deleteRMConstraint(String listName)
|
||||||
{
|
{
|
||||||
@@ -197,12 +200,14 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a single value to an authority in a list. The existing values of the list remain.
|
* Add a single value to an authority in a list. The existing values of the list remain.
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
* @param value
|
* @param value
|
||||||
* @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
|
* @throws AlfrescoRuntimeException
|
||||||
|
* if either the list or the authority do not already exist.
|
||||||
*/
|
*/
|
||||||
public void addRMConstraintListValue(String listName, String authorityName, String value)
|
public void addRMConstraintListValue(String listName, String authorityName, String value)
|
||||||
{
|
{
|
||||||
@@ -211,6 +216,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the details of the specified list
|
* Get the details of the specified list
|
||||||
|
*
|
||||||
* @param listName
|
* @param listName
|
||||||
* @return the details of the specified list
|
* @return the details of the specified list
|
||||||
*/
|
*/
|
||||||
@@ -220,16 +226,16 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the values for an authority in a list.
|
* Replace the values for an authority in a list. The existing values are removed.
|
||||||
* The existing values are removed.
|
|
||||||
*
|
*
|
||||||
* If the authority does not already exist in the list, it will be added
|
* If the authority does not already exist in the list, it will be added
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
* @param values
|
* @param values
|
||||||
*/
|
*/
|
||||||
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String>values)
|
public void updateRMConstraintListAuthority(String listName, String authorityName, List<String> values)
|
||||||
{
|
{
|
||||||
rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values);
|
rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values);
|
||||||
}
|
}
|
||||||
@@ -241,7 +247,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
* @param valueName
|
* @param valueName
|
||||||
* @param authorities
|
* @param authorities
|
||||||
*/
|
*/
|
||||||
public void updateRMConstraintListValue(String listName, String valueName, List<String>authorities)
|
public void updateRMConstraintListValue(String listName, String valueName, List<String> authorities)
|
||||||
{
|
{
|
||||||
rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities);
|
rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities);
|
||||||
}
|
}
|
||||||
@@ -249,7 +255,8 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
/**
|
/**
|
||||||
* Remove an authority from a list
|
* Remove an authority from a list
|
||||||
*
|
*
|
||||||
* @param listName the name of the RMConstraintList
|
* @param listName
|
||||||
|
* the name of the RMConstraintList
|
||||||
* @param authorityName
|
* @param authorityName
|
||||||
*/
|
*/
|
||||||
public void removeRMConstraintListAuthority(String listName, String authorityName)
|
public void removeRMConstraintListAuthority(String listName, String authorityName)
|
||||||
@@ -270,19 +277,18 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName));
|
defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ConstraintDefinition dictionaryDef : defs)
|
for (ConstraintDefinition dictionaryDef : defs)
|
||||||
{
|
{
|
||||||
Constraint con = dictionaryDef.getConstraint();
|
Constraint con = dictionaryDef.getConstraint();
|
||||||
if (con instanceof RMListOfValuesConstraint)
|
if (con instanceof RMListOfValuesConstraint)
|
||||||
{
|
{
|
||||||
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
|
final RMListOfValuesConstraint def = (RMListOfValuesConstraint) con;
|
||||||
RMConstraintInfo i = new RMConstraintInfo();
|
RMConstraintInfo i = new RMConstraintInfo();
|
||||||
i.setName(def.getShortName());
|
i.setName(def.getShortName());
|
||||||
i.setTitle(def.getTitle());
|
i.setTitle(def.getTitle());
|
||||||
|
|
||||||
// note: assumes only one caveat/LOV against a given property
|
// note: assumes only one caveat/LOV against a given property
|
||||||
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
|
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
|
||||||
{
|
|
||||||
public List<String> doWork()
|
public List<String> doWork()
|
||||||
{
|
{
|
||||||
return def.getAllowedValues();
|
return def.getAllowedValues();
|
||||||
@@ -301,24 +307,24 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an RMConstraintInfo
|
* Get an RMConstraintInfo
|
||||||
|
*
|
||||||
* @param listQName
|
* @param listQName
|
||||||
* @return the constraint or null if it does not exist
|
* @return the constraint or null if it does not exist
|
||||||
*/
|
*/
|
||||||
public RMConstraintInfo getRMConstraint(QName listQName)
|
public RMConstraintInfo getRMConstraint(QName listQName)
|
||||||
{
|
{
|
||||||
ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName);
|
ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName);
|
||||||
if(dictionaryDef != null)
|
if (dictionaryDef != null)
|
||||||
{
|
{
|
||||||
Constraint con = dictionaryDef.getConstraint();
|
Constraint con = dictionaryDef.getConstraint();
|
||||||
if (con instanceof RMListOfValuesConstraint)
|
if (con instanceof RMListOfValuesConstraint)
|
||||||
{
|
{
|
||||||
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
|
final RMListOfValuesConstraint def = (RMListOfValuesConstraint) con;
|
||||||
|
|
||||||
RMConstraintInfo info = new RMConstraintInfo();
|
RMConstraintInfo info = new RMConstraintInfo();
|
||||||
info.setName(listQName.toPrefixString());
|
info.setName(listQName.toPrefixString());
|
||||||
info.setTitle(con.getTitle());
|
info.setTitle(con.getTitle());
|
||||||
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
|
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
|
||||||
{
|
|
||||||
public List<String> doWork()
|
public List<String> doWork()
|
||||||
{
|
{
|
||||||
return def.getAllowedValues();
|
return def.getAllowedValues();
|
||||||
@@ -348,18 +354,20 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
/**
|
/**
|
||||||
* Update The allowed values for an RM Constraint.
|
* Update The allowed values for an RM Constraint.
|
||||||
*
|
*
|
||||||
* @param listName The name of the list.
|
* @param listName
|
||||||
* @param allowedValues the new alowed values
|
* The name of the list.
|
||||||
|
* @param allowedValues
|
||||||
|
* the new alowed values
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues)
|
public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues)
|
||||||
{
|
{
|
||||||
QName listQName = QName.createQName(listName, namespaceService);
|
QName listQName = QName.createQName(listName, namespaceService);
|
||||||
|
|
||||||
if(allowedValues != null)
|
if (allowedValues != null)
|
||||||
{
|
{
|
||||||
List<String>allowedValueList = new ArrayList<>();
|
List<String> allowedValueList = new ArrayList<>();
|
||||||
for(String value : allowedValues)
|
for (String value : allowedValues)
|
||||||
{
|
{
|
||||||
allowedValueList.add(value);
|
allowedValueList.add(value);
|
||||||
}
|
}
|
||||||
@@ -368,21 +376,20 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
Constraint con = dictionaryDef.getConstraint();
|
Constraint con = dictionaryDef.getConstraint();
|
||||||
if (con instanceof RMListOfValuesConstraint)
|
if (con instanceof RMListOfValuesConstraint)
|
||||||
{
|
{
|
||||||
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
|
final RMListOfValuesConstraint def = (RMListOfValuesConstraint) con;
|
||||||
List<String> oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
|
List<String> oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() {
|
||||||
{
|
|
||||||
public List<String> doWork()
|
public List<String> doWork()
|
||||||
{
|
{
|
||||||
return def.getAllowedValues();
|
return def.getAllowedValues();
|
||||||
}
|
}
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deal with any additions
|
* Deal with any additions
|
||||||
*/
|
*/
|
||||||
for(String newValue : allowedValueList)
|
for (String newValue : allowedValueList)
|
||||||
{
|
{
|
||||||
if(!oldAllowedValues.contains(newValue) && logger.isDebugEnabled())
|
if (!oldAllowedValues.contains(newValue) && logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
// This is an addition
|
// This is an addition
|
||||||
logger.debug("value added to list:" + listQName + ":" + newValue);
|
logger.debug("value added to list:" + listQName + ":" + newValue);
|
||||||
@@ -392,12 +399,12 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
/**
|
/**
|
||||||
* Deal with any deletions
|
* Deal with any deletions
|
||||||
*/
|
*/
|
||||||
for(String oldValue : oldAllowedValues)
|
for (String oldValue : oldAllowedValues)
|
||||||
{
|
{
|
||||||
if(!allowedValueList.contains(oldValue))
|
if (!allowedValueList.contains(oldValue))
|
||||||
{
|
{
|
||||||
// This is a deletion
|
// This is a deletion
|
||||||
if(logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("value removed from list:" + listQName + ":" + oldValue);
|
logger.debug("value removed from list:" + listQName + ":" + oldValue);
|
||||||
}
|
}
|
||||||
@@ -417,7 +424,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
*/
|
*/
|
||||||
public void removeRMConstraintListValue(String listName, String valueName)
|
public void removeRMConstraintListValue(String listName, String valueName)
|
||||||
{
|
{
|
||||||
//TODO need to update the rm constraint definition
|
// TODO need to update the rm constraint definition
|
||||||
// recordsManagementAdminService.
|
// recordsManagementAdminService.
|
||||||
|
|
||||||
rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName);
|
rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName);
|
||||||
@@ -433,4 +440,4 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
|||||||
recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle);
|
recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle);
|
||||||
return getRMConstraint(listName);
|
return getRMConstraint(listName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,30 +40,37 @@ public class RMConstraintInfo
|
|||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title)
|
public void setTitle(String title)
|
||||||
{
|
{
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCaseSensitive(boolean caseSensitive)
|
public void setCaseSensitive(boolean caseSensitive)
|
||||||
{
|
{
|
||||||
this.caseSensitive = caseSensitive;
|
this.caseSensitive = caseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCaseSensitive()
|
public boolean isCaseSensitive()
|
||||||
{
|
{
|
||||||
return caseSensitive;
|
return caseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowedValues(String[] values)
|
public void setAllowedValues(String[] values)
|
||||||
{
|
{
|
||||||
this.allowedValues = values.clone();
|
this.allowedValues = values.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getAllowedValues()
|
public String[] getAllowedValues()
|
||||||
{
|
{
|
||||||
return allowedValues;
|
return allowedValues;
|
||||||
@@ -85,4 +92,4 @@ public class RMConstraintInfo
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,4 +36,4 @@ public class RMConstraintMessageKeys
|
|||||||
{
|
{
|
||||||
public static final String ERR_NON_STRING = "d_dictionary.constraint.string_length.non_string";
|
public static final String ERR_NON_STRING = "d_dictionary.constraint.string_length.non_string";
|
||||||
public static final String ERR_INVALID_VALUE = "d_dictionary.constraint.list_of_values.invalid_value";
|
public static final String ERR_INVALID_VALUE = "d_dictionary.constraint.list_of_values.invalid_value";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
|
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.dictionary.ConstraintException;
|
import org.alfresco.service.cmr.dictionary.ConstraintException;
|
||||||
import org.alfresco.service.cmr.i18n.MessageLookup;
|
import org.alfresco.service.cmr.i18n.MessageLookup;
|
||||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||||
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
|
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RM Constraint implementation that ensures the value is one of a constrained
|
* RM Constraint implementation that ensures the value is one of a constrained <i>list of values</i>. By default, this constraint is case-sensitive.
|
||||||
* <i>list of values</i>. By default, this constraint is case-sensitive.
|
|
||||||
*
|
*
|
||||||
* @see #setAllowedValues(List)
|
* @see #setAllowedValues(List)
|
||||||
* @see #setCaseSensitive(boolean)
|
* @see #setCaseSensitive(boolean)
|
||||||
@@ -63,7 +63,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
{
|
{
|
||||||
// closed marking - all values must match
|
// closed marking - all values must match
|
||||||
AND,
|
AND,
|
||||||
// open marking - at least one value must match
|
// open marking - at least one value must match
|
||||||
OR
|
OR
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,17 +75,16 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
RMListOfValuesConstraint.caveatConfigService = caveatConfigService;
|
RMListOfValuesConstraint.caveatConfigService = caveatConfigService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder(80);
|
StringBuilder sb = new StringBuilder(80);
|
||||||
sb.append("RMListOfValuesConstraint")
|
sb.append("RMListOfValuesConstraint")
|
||||||
.append("[allowedValues=").append(getAllowedValues())
|
.append("[allowedValues=").append(getAllowedValues())
|
||||||
.append(", caseSensitive=").append(isCaseSensitive())
|
.append(", caseSensitive=").append(isCaseSensitive())
|
||||||
.append(", sorted=").append(isSorted())
|
.append(", sorted=").append(isSorted())
|
||||||
.append(", matchLogic=").append(getMatchLogic())
|
.append(", matchLogic=").append(getMatchLogic())
|
||||||
.append("]");
|
.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +97,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the allowed values. Note that these are <tt>String</tt> instances, but may
|
* Get the allowed values. Note that these are <tt>String</tt> instances, but may represent non-<tt>String</tt> values. It is up to the caller to distinguish.
|
||||||
* represent non-<tt>String</tt> values. It is up to the caller to distinguish.
|
|
||||||
*
|
*
|
||||||
* @return Returns the values allowed
|
* @return Returns the values allowed
|
||||||
*/
|
*/
|
||||||
@@ -107,7 +105,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
public List<String> getRawAllowedValues()
|
public List<String> getRawAllowedValues()
|
||||||
{
|
{
|
||||||
String runAsUser = AuthenticationUtil.getRunAsUser();
|
String runAsUser = AuthenticationUtil.getRunAsUser();
|
||||||
if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
|
if ((runAsUser != null) && (!runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
|
||||||
{
|
{
|
||||||
// get allowed values for current user
|
// get allowed values for current user
|
||||||
List<String> allowedForUser = caveatConfigService.getRMAllowedValues(getShortName());
|
List<String> allowedForUser = caveatConfigService.getRMAllowedValues(getShortName());
|
||||||
@@ -148,7 +146,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
private List<String> getAllowedValuesUpper()
|
private List<String> getAllowedValuesUpper()
|
||||||
{
|
{
|
||||||
String runAsUser = AuthenticationUtil.getRunAsUser();
|
String runAsUser = AuthenticationUtil.getRunAsUser();
|
||||||
if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
|
if ((runAsUser != null) && (!runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
|
||||||
{
|
{
|
||||||
// get allowed values for current user
|
// get allowed values for current user
|
||||||
List<String> allowedForUser = caveatConfigService.getRMAllowedValues(getType());
|
List<String> allowedForUser = caveatConfigService.getRMAllowedValues(getType());
|
||||||
@@ -169,12 +167,14 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
return this.allowedValuesUpper;
|
return this.allowedValuesUpper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the values that are allowed by the constraint.
|
* Set the values that are allowed by the constraint.
|
||||||
*
|
*
|
||||||
* @param allowedValues a list of allowed values
|
* @param allowedValues
|
||||||
|
* a list of allowed values
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
public void setAllowedValues(List allowedValues)
|
public void setAllowedValues(List allowedValues)
|
||||||
{
|
{
|
||||||
@@ -256,4 +256,4 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.caveat;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
public class ScriptAuthority implements Serializable
|
public class ScriptAuthority implements Serializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -38,23 +37,25 @@ public class ScriptAuthority implements Serializable
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String authorityTitle;
|
private String authorityTitle;
|
||||||
private String authorityName;
|
private String authorityName;
|
||||||
|
|
||||||
public void setAuthorityName(String authorityName)
|
public void setAuthorityName(String authorityName)
|
||||||
{
|
{
|
||||||
this.authorityName = authorityName;
|
this.authorityName = authorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorityName()
|
public String getAuthorityName()
|
||||||
{
|
{
|
||||||
return authorityName;
|
return authorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorityTitle(String authorityName)
|
public void setAuthorityTitle(String authorityName)
|
||||||
{
|
{
|
||||||
this.authorityTitle = authorityName;
|
this.authorityTitle = authorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorityTitle()
|
public String getAuthorityTitle()
|
||||||
{
|
{
|
||||||
return authorityTitle;
|
return authorityTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,14 +35,15 @@ 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.security.AuthorityService;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
|
||||||
public class ScriptConstraint implements Serializable
|
public class ScriptConstraint implements Serializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -64,10 +65,12 @@ public class ScriptConstraint implements Serializable
|
|||||||
{
|
{
|
||||||
info.setTitle(title);
|
info.setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
return info.getTitle();
|
return info.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name)
|
||||||
{
|
{
|
||||||
info.setName(name);
|
info.setName(name);
|
||||||
@@ -90,22 +93,22 @@ public class ScriptConstraint implements Serializable
|
|||||||
|
|
||||||
public ScriptConstraintAuthority[] getAuthorities()
|
public ScriptConstraintAuthority[] getAuthorities()
|
||||||
{
|
{
|
||||||
Map<String, List<String>> values = rmCaveatconfigService.getListDetails(info.getName());
|
Map<String, List<String>> values = rmCaveatconfigService.getListDetails(info.getName());
|
||||||
|
|
||||||
if (values == null)
|
if (values == null)
|
||||||
{
|
{
|
||||||
return new ScriptConstraintAuthority[0];
|
return new ScriptConstraintAuthority[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ScriptConstraintAuthority> constraints = new ArrayList<>(values.size());
|
ArrayList<ScriptConstraintAuthority> constraints = new ArrayList<>(values.size());
|
||||||
for (Map.Entry<String, List<String>> entry : values.entrySet())
|
for (Map.Entry<String, List<String>> entry : values.entrySet())
|
||||||
{
|
{
|
||||||
ScriptConstraintAuthority constraint = new ScriptConstraintAuthority();
|
ScriptConstraintAuthority constraint = new ScriptConstraintAuthority();
|
||||||
constraint.setAuthorityName(entry.getKey());
|
constraint.setAuthorityName(entry.getKey());
|
||||||
constraint.setValues(entry.getValue());
|
constraint.setValues(entry.getValue());
|
||||||
constraints.add(constraint);
|
constraints.add(constraint);
|
||||||
}
|
}
|
||||||
return constraints.toArray(new ScriptConstraintAuthority[constraints.size()]);
|
return constraints.toArray(new ScriptConstraintAuthority[constraints.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +117,7 @@ public class ScriptConstraint implements Serializable
|
|||||||
public void updateTitle(String newTitle)
|
public void updateTitle(String newTitle)
|
||||||
{
|
{
|
||||||
info.setTitle(newTitle);
|
info.setTitle(newTitle);
|
||||||
rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle) ;
|
rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,18 +131,19 @@ public class ScriptConstraint implements Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a value
|
* Update a value
|
||||||
|
*
|
||||||
* @param bodge
|
* @param bodge
|
||||||
*/
|
*/
|
||||||
public void updateValues(JSONArray bodge) throws Exception
|
public void updateValues(JSONArray bodge) throws Exception
|
||||||
{
|
{
|
||||||
for(int i = 0; i < bodge.length(); i++)
|
for (int i = 0; i < bodge.length(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
JSONObject obj = bodge.getJSONObject(i);
|
JSONObject obj = bodge.getJSONObject(i);
|
||||||
String value = obj.getString("value");
|
String value = obj.getString("value");
|
||||||
JSONArray authorities = obj.getJSONArray("authorities");
|
JSONArray authorities = obj.getJSONArray("authorities");
|
||||||
List<String> aList = new ArrayList<>();
|
List<String> aList = new ArrayList<>();
|
||||||
for(int j = 0; j < authorities.length();j++)
|
for (int j = 0; j < authorities.length(); j++)
|
||||||
{
|
{
|
||||||
aList.add(authorities.getString(j));
|
aList.add(authorities.getString(j));
|
||||||
}
|
}
|
||||||
@@ -149,6 +153,7 @@ public class ScriptConstraint implements Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a value
|
* Update a value
|
||||||
|
*
|
||||||
* @param value
|
* @param value
|
||||||
* @param authorities
|
* @param authorities
|
||||||
*/
|
*/
|
||||||
@@ -160,25 +165,27 @@ public class ScriptConstraint implements Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cascade delete an authority
|
* Cascade delete an authority
|
||||||
|
*
|
||||||
* @param authority
|
* @param authority
|
||||||
*/
|
*/
|
||||||
public void deleteAuthority(String authority)
|
public void deleteAuthority(String authority)
|
||||||
{
|
{
|
||||||
//Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cascade delete a value
|
* Cascade delete a value
|
||||||
|
*
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
public void deleteValue(String value)
|
public void deleteValue(String value)
|
||||||
{
|
{
|
||||||
//Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a single value
|
* Get a single value
|
||||||
|
*
|
||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -186,9 +193,9 @@ public class ScriptConstraint implements Serializable
|
|||||||
{
|
{
|
||||||
ScriptConstraintValue[] values = getValues();
|
ScriptConstraintValue[] values = getValues();
|
||||||
|
|
||||||
for(ScriptConstraintValue val : values)
|
for (ScriptConstraintValue val : values)
|
||||||
{
|
{
|
||||||
if(val.getValueName().equalsIgnoreCase(value))
|
if (val.getValueName().equalsIgnoreCase(value))
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -212,39 +219,39 @@ public class ScriptConstraint implements Serializable
|
|||||||
ArrayList<ScriptConstraintValue> constraints = new ArrayList<>(pivot.size());
|
ArrayList<ScriptConstraintValue> constraints = new ArrayList<>(pivot.size());
|
||||||
for (Map.Entry<String, List<String>> entry : pivot.entrySet())
|
for (Map.Entry<String, List<String>> entry : pivot.entrySet())
|
||||||
{
|
{
|
||||||
ScriptConstraintValue constraint = new ScriptConstraintValue();
|
ScriptConstraintValue constraint = new ScriptConstraintValue();
|
||||||
constraint.setValueName(entry.getKey());
|
constraint.setValueName(entry.getKey());
|
||||||
constraint.setValueTitle(entry.getKey());
|
constraint.setValueTitle(entry.getKey());
|
||||||
|
|
||||||
List<String> authorities = entry.getValue();
|
List<String> authorities = entry.getValue();
|
||||||
List<ScriptAuthority> sauth = new ArrayList<>();
|
List<ScriptAuthority> sauth = new ArrayList<>();
|
||||||
for(String authority : authorities)
|
for (String authority : authorities)
|
||||||
{
|
{
|
||||||
ScriptAuthority a = new ScriptAuthority();
|
ScriptAuthority a = new ScriptAuthority();
|
||||||
a.setAuthorityName(authority);
|
a.setAuthorityName(authority);
|
||||||
|
|
||||||
String displayName = authorityService.getAuthorityDisplayName(authority);
|
String displayName = authorityService.getAuthorityDisplayName(authority);
|
||||||
if(StringUtils.isNotBlank(displayName))
|
if (StringUtils.isNotBlank(displayName))
|
||||||
{
|
{
|
||||||
a.setAuthorityTitle(displayName);
|
a.setAuthorityTitle(displayName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a.setAuthorityTitle(authority);
|
a.setAuthorityTitle(authority);
|
||||||
}
|
}
|
||||||
sauth.add(a);
|
sauth.add(a);
|
||||||
}
|
}
|
||||||
constraint.setAuthorities(sauth);
|
constraint.setAuthorities(sauth);
|
||||||
constraints.add(constraint);
|
constraints.add(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Now go through and add any "empty" values
|
* Now go through and add any "empty" values
|
||||||
*/
|
*/
|
||||||
Set<String> values = pivot.keySet();
|
Set<String> values = pivot.keySet();
|
||||||
for(String value : info.getAllowedValues())
|
for (String value : info.getAllowedValues())
|
||||||
{
|
{
|
||||||
if(!values.contains(value))
|
if (!values.contains(value))
|
||||||
{
|
{
|
||||||
ScriptConstraintValue constraint = new ScriptConstraintValue();
|
ScriptConstraintValue constraint = new ScriptConstraintValue();
|
||||||
constraint.setValueName(value);
|
constraint.setValueName(value);
|
||||||
@@ -258,4 +265,4 @@ public class ScriptConstraint implements Serializable
|
|||||||
return constraints.toArray(new ScriptConstraintValue[constraints.size()]);
|
return constraints.toArray(new ScriptConstraintValue[constraints.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,22 +37,25 @@ public class ScriptConstraintAuthority implements Serializable
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4659454215122271811L;
|
private static final long serialVersionUID = -4659454215122271811L;
|
||||||
private String authorityName;
|
private String authorityName;
|
||||||
private List<String>values;
|
private List<String> values;
|
||||||
|
|
||||||
public void setValues(List<String> values)
|
public void setValues(List<String> values)
|
||||||
{
|
{
|
||||||
this.values = values;
|
this.values = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getValues()
|
public List<String> getValues()
|
||||||
{
|
{
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorityName(String authorityName)
|
public void setAuthorityName(String authorityName)
|
||||||
{
|
{
|
||||||
this.authorityName = authorityName;
|
this.authorityName = authorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorityName()
|
public String getAuthorityName()
|
||||||
{
|
{
|
||||||
return authorityName;
|
return authorityName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,30 +37,35 @@ public class ScriptConstraintValue implements Serializable
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4659454215122271811L;
|
private static final long serialVersionUID = -4659454215122271811L;
|
||||||
private String value;
|
private String value;
|
||||||
private List<ScriptAuthority>authorities;
|
private List<ScriptAuthority> authorities;
|
||||||
|
|
||||||
public void setAuthorities(List<ScriptAuthority> values)
|
public void setAuthorities(List<ScriptAuthority> values)
|
||||||
{
|
{
|
||||||
this.authorities = values;
|
this.authorities = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ScriptAuthority> getAuthorities()
|
public List<ScriptAuthority> getAuthorities()
|
||||||
{
|
{
|
||||||
return authorities;
|
return authorities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValueName(String authorityName)
|
public void setValueName(String authorityName)
|
||||||
{
|
{
|
||||||
this.value = authorityName;
|
this.value = authorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueName()
|
public String getValueName()
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValueTitle(String authorityName)
|
public void setValueTitle(String authorityName)
|
||||||
{
|
{
|
||||||
this.value = authorityName;
|
this.value = authorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueTitle()
|
public String getValueTitle()
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
|||||||
|
|
||||||
public ScriptConstraint getConstraint(String listName)
|
public ScriptConstraint getConstraint(String listName)
|
||||||
{
|
{
|
||||||
//TODO Temporary conversion
|
// TODO Temporary conversion
|
||||||
String xxx = listName.replace("_", ":");
|
String xxx = listName.replace("_", ":");
|
||||||
|
|
||||||
RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx);
|
RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx);
|
||||||
|
|
||||||
if(info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
||||||
}
|
}
|
||||||
@@ -81,12 +81,12 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
|||||||
|
|
||||||
public ScriptConstraint[] getAllConstraints()
|
public ScriptConstraint[] getAllConstraints()
|
||||||
{
|
{
|
||||||
return getConstraints(true);
|
return getConstraints(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptConstraint[] getConstraintsWithoutEmptyList()
|
public ScriptConstraint[] getConstraintsWithoutEmptyList()
|
||||||
{
|
{
|
||||||
return getConstraints(false);
|
return getConstraints(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScriptConstraint[] getConstraints(boolean includeEmptyList)
|
private ScriptConstraint[] getConstraints(boolean includeEmptyList)
|
||||||
@@ -94,19 +94,19 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
|||||||
Set<RMConstraintInfo> values = caveatConfigService.getAllRMConstraints();
|
Set<RMConstraintInfo> values = caveatConfigService.getAllRMConstraints();
|
||||||
|
|
||||||
List<ScriptConstraint> vals = new ArrayList<>(values.size());
|
List<ScriptConstraint> vals = new ArrayList<>(values.size());
|
||||||
for(RMConstraintInfo value : values)
|
for (RMConstraintInfo value : values)
|
||||||
{
|
{
|
||||||
ScriptConstraint c = new ScriptConstraint(value, caveatConfigService, getAuthorityService());
|
ScriptConstraint c = new ScriptConstraint(value, caveatConfigService, getAuthorityService());
|
||||||
if (includeEmptyList)
|
if (includeEmptyList)
|
||||||
{
|
{
|
||||||
vals.add(c);
|
vals.add(c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (c.getValues().length > 0)
|
if (c.getValues().length > 0)
|
||||||
{
|
{
|
||||||
vals.add(c);
|
vals.add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,44 +115,43 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete list
|
* Delete list
|
||||||
|
*
|
||||||
* @param listName
|
* @param listName
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public void deleteConstraintList(String listName)
|
public void deleteConstraintList(String listName)
|
||||||
{
|
{
|
||||||
//TODO Temporary conversion
|
// TODO Temporary conversion
|
||||||
String xxx = listName.replace("_", ":");
|
String xxx = listName.replace("_", ":");
|
||||||
caveatConfigService.deleteRMConstraint(xxx);
|
caveatConfigService.deleteRMConstraint(xxx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update value
|
* Update value
|
||||||
*/
|
*/
|
||||||
public void updateConstraintValues(String listName, String authorityName, String[]values)
|
public void updateConstraintValues(String listName, String authorityName, String[] values)
|
||||||
{
|
{
|
||||||
List<String> vals = new ArrayList<>();
|
List<String> vals = new ArrayList<>();
|
||||||
caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals);
|
caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the constraint values. i.e remove an authority from a constraint list
|
* Delete the constraint values. i.e remove an authority from a constraint list
|
||||||
*/
|
*/
|
||||||
public void deleteRMConstraintListAuthority(String listName, String authorityName)
|
public void deleteRMConstraintListAuthority(String listName, String authorityName)
|
||||||
{
|
{
|
||||||
//TODO Temporary conversion
|
// TODO Temporary conversion
|
||||||
String xxx = listName.replace("_", ":");
|
String xxx = listName.replace("_", ":");
|
||||||
|
|
||||||
caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName);
|
caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the constraint values. i.e remove a value from a constraint list
|
* Delete the constraint values. i.e remove a value from a constraint list
|
||||||
*/
|
*/
|
||||||
public void deleteRMConstraintListValue(String listName, String valueName)
|
public void deleteRMConstraintListValue(String listName, String valueName)
|
||||||
{
|
{
|
||||||
//TODO Temporary conversion
|
// TODO Temporary conversion
|
||||||
String xxx = listName.replace("_", ":");
|
String xxx = listName.replace("_", ":");
|
||||||
|
|
||||||
caveatConfigService.removeRMConstraintListValue(xxx, valueName);
|
caveatConfigService.removeRMConstraintListValue(xxx, valueName);
|
||||||
@@ -161,8 +160,8 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
|||||||
|
|
||||||
public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues)
|
public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues)
|
||||||
{
|
{
|
||||||
//TODO Temporary conversion
|
// TODO Temporary conversion
|
||||||
if(listName != null)
|
if (listName != null)
|
||||||
{
|
{
|
||||||
listName = listName.replace("_", ":");
|
listName = listName.replace("_", ":");
|
||||||
}
|
}
|
||||||
@@ -171,4 +170,4 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
|||||||
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,4 +45,4 @@ public interface CompatibilityModel extends DOD5015Model
|
|||||||
String NAME_CUSTOM_RECORD_FOLDER_PROPERTIES = "customRecordFolderProperties";
|
String NAME_CUSTOM_RECORD_FOLDER_PROPERTIES = "customRecordFolderProperties";
|
||||||
String NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES = "customRecordCategoryProperties";
|
String NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES = "customRecordCategoryProperties";
|
||||||
String NAME_CUSTOM_RECORD_SERIES_PROPERTIES = "customRecordSeriesProperties";
|
String NAME_CUSTOM_RECORD_SERIES_PROPERTIES = "customRecordSeriesProperties";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ public interface DeprecatedExtendedSecurityService
|
|||||||
/**
|
/**
|
||||||
* Gets the set of authorities that are extended readers for the given node.
|
* Gets the set of authorities that are extended readers for the given node.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
|
* node reference
|
||||||
* @return {@link Set}<{@link String}> set of extended readers
|
* @return {@link Set}<{@link String}> set of extended readers
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, use {@link ExtendedSecurityService#getReaders(NodeRef)}
|
* @deprecated as of 2.5, use {@link ExtendedSecurityService#getReaders(NodeRef)}
|
||||||
@@ -51,98 +52,113 @@ public interface DeprecatedExtendedSecurityService
|
|||||||
/**
|
/**
|
||||||
* Get the set of authorities that are extended writers for the given node.
|
* Get the set of authorities that are extended writers for the given node.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @return {@link Set}<{@link String}> set of extended writers
|
* node reference
|
||||||
|
* @return {@link Set}<{@link String}> set of extended writers
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, use {@link ExtendedSecurityService#getWriters(NodeRef)}
|
* @deprecated as of 2.5, use {@link ExtendedSecurityService#getWriters(NodeRef)}
|
||||||
*/
|
*/
|
||||||
Set<String> getExtendedWriters(NodeRef nodeRef);
|
Set<String> getExtendedWriters(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add extended security for the specified authorities to a node.
|
* Add extended security for the specified authorities to a node.
|
||||||
*
|
*
|
||||||
* As of, 2.5 this method no longer applies the extended security to parents.
|
* As of, 2.5 this method no longer applies the extended security to parents.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param readers set of authorities to add extended read permissions
|
* node reference
|
||||||
* @param writers set of authorities to add extended write permissions
|
* @param readers
|
||||||
|
* set of authorities to add extended read permissions
|
||||||
|
* @param writers
|
||||||
|
* set of authorities to add extended write permissions
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, use {@link ExtendedSecurityService#set(NodeRef, Set, Set)}
|
* @deprecated as of 2.5, use {@link ExtendedSecurityService#set(NodeRef, Set, Set)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void addExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers);
|
void addExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add extended security for the specified authorities to a node.
|
* Add extended security for the specified authorities to a node.
|
||||||
* <p>
|
* <p>
|
||||||
* If specified, the read and write extended permissions are applied to all parents up to the file plan as
|
* If specified, the read and write extended permissions are applied to all parents up to the file plan as extended read. This ensures parental read, but not parental write.
|
||||||
* extended read. This ensures parental read, but not parental write.
|
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param readers set of authorities to add extended read permissions
|
* node reference
|
||||||
* @param writers set of authorities to add extended write permissions
|
* @param readers
|
||||||
* @param applyToParents true if extended security applied to parents (read only) false otherwise.
|
* set of authorities to add extended read permissions
|
||||||
|
* @param writers
|
||||||
|
* set of authorities to add extended write permissions
|
||||||
|
* @param applyToParents
|
||||||
|
* true if extended security applied to parents (read only) false otherwise.
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, because extended security is no longer applied to parents. Note that calling this method will
|
* @deprecated as of 2.5, because extended security is no longer applied to parents. Note that calling this method will only apply the extended security to the node and the applyToParents parameter value will be ignored.
|
||||||
* only apply the extended security to the node and the applyToParents parameter value will be ignored.
|
|
||||||
*
|
*
|
||||||
* @see ExtendedSecurityService#set(NodeRef, Set, Set)
|
* @see ExtendedSecurityService#set(NodeRef, Set, Set)
|
||||||
*/
|
*/
|
||||||
@Deprecated void addExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers, boolean applyToParents);
|
@Deprecated
|
||||||
|
void addExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers, boolean applyToParents);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all extended readers and writers from the given node reference.
|
* Remove all extended readers and writers from the given node reference.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
|
* node reference
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, see {@link ExtendedSecurityService#remove(NodeRef)}
|
* @deprecated as of 2.5, see {@link ExtendedSecurityService#remove(NodeRef)}
|
||||||
*/
|
*/
|
||||||
@Deprecated void removeAllExtendedSecurity(NodeRef nodeRef);
|
@Deprecated
|
||||||
|
void removeAllExtendedSecurity(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the extended security for the specified authorities from a node.
|
* Remove the extended security for the specified authorities from a node.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param readers set of authorities to remove as extended readers
|
* node reference
|
||||||
* @param writers set of authorities to remove as extended writers
|
* @param readers
|
||||||
|
* set of authorities to remove as extended readers
|
||||||
|
* @param writers
|
||||||
|
* set of authorities to remove as extended writers
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported.
|
* @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. Note that calling this method will now remove all extended security from the node and never applied to parents.
|
||||||
* Note that calling this method will now remove all extended security from the node and never applied to parents.
|
|
||||||
*
|
*
|
||||||
* @see {@link ExtendedSecurityService#remove(NodeRef)}
|
* @see {@link ExtendedSecurityService#remove(NodeRef)}
|
||||||
*/
|
*/
|
||||||
@Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers);
|
@Deprecated
|
||||||
|
void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the extended security for the specified authorities from a node.
|
* Remove the extended security for the specified authorities from a node.
|
||||||
* <p>
|
* <p>
|
||||||
* If specified, extended security will also be removed from the parent hierarchy.(read only). Note that
|
* If specified, extended security will also be removed from the parent hierarchy.(read only). Note that extended security is records as a reference count, so security will only be utterly removed from the parent hierarchy if all references to the authority are removed.
|
||||||
* extended security is records as a reference count, so security will only be utterly removed from the parent
|
|
||||||
* hierarchy if all references to the authority are removed.
|
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param readers set of authorities to remove as extended readers
|
* node reference
|
||||||
* @param writers set of authorities to remove as extedned writers
|
* @param readers
|
||||||
* @param applyToParents true if removal of extended security is applied to parent hierarchy (read only), false
|
* set of authorities to remove as extended readers
|
||||||
* otherwise
|
* @param writers
|
||||||
|
* set of authorities to remove as extedned writers
|
||||||
|
* @param applyToParents
|
||||||
|
* true if removal of extended security is applied to parent hierarchy (read only), false otherwise
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported.
|
* @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. Note that calling this method will now remove all extended security from the node and never applied to parents.
|
||||||
* Note that calling this method will now remove all extended security from the node and never applied to parents.
|
|
||||||
*
|
*
|
||||||
* @see {@link ExtendedSecurityService#remove(NodeRef)}
|
* @see {@link ExtendedSecurityService#remove(NodeRef)}
|
||||||
*/
|
*/
|
||||||
@Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers, boolean applyToParents);
|
@Deprecated
|
||||||
|
void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String> writers, boolean applyToParents);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all extended readers and writers from the given node reference.
|
* Remove all extended readers and writers from the given node reference.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param applyToParents if true then apply removal to parent hierarchy (read only) false otherwise.
|
* node reference
|
||||||
|
* @param applyToParents
|
||||||
|
* if true then apply removal to parent hierarchy (read only) false otherwise.
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported.
|
* @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. Note that calling this method will now remove all extended security from the node and never applied to parents.
|
||||||
* Note that calling this method will now remove all extended security from the node and never applied to parents.
|
|
||||||
*
|
*
|
||||||
* @see {@link ExtendedSecurityService#remove(NodeRef)}
|
* @see {@link ExtendedSecurityService#remove(NodeRef)}
|
||||||
*/
|
*/
|
||||||
@Deprecated void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents);
|
@Deprecated
|
||||||
}
|
void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents);
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ExtendedReaderDynamicAuthority extends ExtendedSecurityBaseDynamicA
|
|||||||
{
|
{
|
||||||
/** Extended reader role */
|
/** Extended reader role */
|
||||||
public static final String EXTENDED_READER = "ROLE_EXTENDED_READER";
|
public static final String EXTENDED_READER = "ROLE_EXTENDED_READER";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority()
|
* @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority()
|
||||||
*/
|
*/
|
||||||
@@ -54,7 +54,7 @@ public class ExtendedReaderDynamicAuthority extends ExtendedSecurityBaseDynamicA
|
|||||||
public String getAuthority()
|
public String getAuthority()
|
||||||
{
|
{
|
||||||
return EXTENDED_READER;
|
return EXTENDED_READER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor()
|
* @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor()
|
||||||
@@ -62,37 +62,37 @@ public class ExtendedReaderDynamicAuthority extends ExtendedSecurityBaseDynamicA
|
|||||||
@Override
|
@Override
|
||||||
public Set<PermissionReference> requiredFor()
|
public Set<PermissionReference> requiredFor()
|
||||||
{
|
{
|
||||||
if (requiredFor == null)
|
if (requiredFor == null)
|
||||||
{
|
{
|
||||||
requiredFor = Collections.singleton(getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS));
|
requiredFor = Collections.singleton(getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
return requiredFor;
|
return requiredFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected Set<String> getAuthorites(NodeRef nodeRef)
|
protected Set<String> getAuthorites(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
Set<String> result = null;
|
Set<String> result = null;
|
||||||
|
|
||||||
Map<String, Integer> readerMap = (Map<String, Integer>)getNodeService().getProperty(nodeRef, PROP_READERS);
|
Map<String, Integer> readerMap = (Map<String, Integer>) getNodeService().getProperty(nodeRef, PROP_READERS);
|
||||||
if (readerMap != null)
|
if (readerMap != null)
|
||||||
{
|
{
|
||||||
result = readerMap.keySet();
|
result = readerMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName()
|
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getTransactionCacheName()
|
protected String getTransactionCacheName()
|
||||||
{
|
{
|
||||||
return "rm.extendedreaderdynamicauthority";
|
return "rm.extendedreaderdynamicauthority";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ package org.alfresco.module.org_alfresco_module_rm.security;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.repo.security.permissions.DynamicAuthority;
|
import org.alfresco.repo.security.permissions.DynamicAuthority;
|
||||||
import org.alfresco.repo.security.permissions.PermissionReference;
|
import org.alfresco.repo.security.permissions.PermissionReference;
|
||||||
@@ -39,8 +42,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.context.ApplicationContextAware;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended readers dynamic authority implementation.
|
* Extended readers dynamic authority implementation.
|
||||||
@@ -50,8 +51,8 @@ import org.springframework.context.ApplicationContextAware;
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority,
|
public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority,
|
||||||
RecordsManagementModel,
|
RecordsManagementModel,
|
||||||
ApplicationContextAware
|
ApplicationContextAware
|
||||||
{
|
{
|
||||||
/** Authority service */
|
/** Authority service */
|
||||||
private AuthorityService authorityService;
|
private AuthorityService authorityService;
|
||||||
@@ -72,58 +73,58 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut
|
|||||||
protected Set<PermissionReference> requiredFor;
|
protected Set<PermissionReference> requiredFor;
|
||||||
|
|
||||||
// NOTE: we get the services directly from the application context in this way to avoid
|
// NOTE: we get the services directly from the application context in this way to avoid
|
||||||
// cyclic relationships and issues when loading the application context
|
// cyclic relationships and issues when loading the application context
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return authority service
|
* @return authority service
|
||||||
*/
|
*/
|
||||||
protected AuthorityService getAuthorityService()
|
protected AuthorityService getAuthorityService()
|
||||||
{
|
{
|
||||||
if (authorityService == null)
|
if (authorityService == null)
|
||||||
{
|
{
|
||||||
authorityService = (AuthorityService)applicationContext.getBean("authorityService");
|
authorityService = (AuthorityService) applicationContext.getBean("authorityService");
|
||||||
}
|
}
|
||||||
return authorityService;
|
return authorityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return extended security service
|
* @return extended security service
|
||||||
*/
|
*/
|
||||||
protected ExtendedSecurityService getExtendedSecurityService()
|
protected ExtendedSecurityService getExtendedSecurityService()
|
||||||
{
|
{
|
||||||
if (extendedSecurityService == null)
|
if (extendedSecurityService == null)
|
||||||
{
|
{
|
||||||
extendedSecurityService = (ExtendedSecurityService)applicationContext.getBean("extendedSecurityService");
|
extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("extendedSecurityService");
|
||||||
}
|
}
|
||||||
return extendedSecurityService;
|
return extendedSecurityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return node service
|
* @return node service
|
||||||
*/
|
*/
|
||||||
protected NodeService getNodeService()
|
protected NodeService getNodeService()
|
||||||
{
|
{
|
||||||
if (nodeService == null)
|
if (nodeService == null)
|
||||||
{
|
{
|
||||||
nodeService = (NodeService)applicationContext.getBean("dbNodeService");
|
nodeService = (NodeService) applicationContext.getBean("dbNodeService");
|
||||||
}
|
}
|
||||||
return nodeService;
|
return nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return model DAO
|
* @return model DAO
|
||||||
*/
|
*/
|
||||||
protected ModelDAO getModelDAO()
|
protected ModelDAO getModelDAO()
|
||||||
{
|
{
|
||||||
if (modelDAO == null)
|
if (modelDAO == null)
|
||||||
{
|
{
|
||||||
modelDAO = (ModelDAO)applicationContext.getBean("permissionsModelDAO");
|
modelDAO = (ModelDAO) applicationContext.getBean("permissionsModelDAO");
|
||||||
}
|
}
|
||||||
return modelDAO;
|
return modelDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return String transaction cache name
|
* @return String transaction cache name
|
||||||
*/
|
*/
|
||||||
protected abstract String getTransactionCacheName();
|
protected abstract String getTransactionCacheName();
|
||||||
|
|
||||||
@@ -137,8 +138,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of the authorities from the extended security aspect that this dynamic
|
* Gets a list of the authorities from the extended security aspect that this dynamic authority is checking against.
|
||||||
* authority is checking against.
|
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef
|
||||||
* @return
|
* @return
|
||||||
@@ -162,31 +162,31 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY))
|
if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY))
|
||||||
{
|
{
|
||||||
Set<String> authorities = getAuthorites(nodeRef);
|
Set<String> authorities = getAuthorites(nodeRef);
|
||||||
if (authorities != null)
|
if (authorities != null)
|
||||||
{
|
{
|
||||||
// check for everyone or the user
|
// check for everyone or the user
|
||||||
if (authorities.contains("GROUP_EVEYONE") ||
|
if (authorities.contains("GROUP_EVEYONE") ||
|
||||||
authorities.contains(userName))
|
authorities.contains(userName))
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// determine whether any of the users groups are in the extended security
|
// determine whether any of the users groups are in the extended security
|
||||||
Set<String> contained = getAuthorityService().getAuthoritiesForUser(userName);
|
Set<String> contained = getAuthorityService().getAuthoritiesForUser(userName);
|
||||||
authorities.retainAll(contained);
|
authorities.retainAll(contained);
|
||||||
result = (authorities.size() != 0);
|
result = (authorities.size() != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cache result
|
// cache result
|
||||||
transactionCache.put(key, result);
|
transactionCache.put(key, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class ExtendedWriterDynamicAuthority extends ExtendedSecurityBaseDynamicA
|
|||||||
{
|
{
|
||||||
/** Extended writer role */
|
/** Extended writer role */
|
||||||
public static final String EXTENDED_WRITER = "ROLE_EXTENDED_WRITER";
|
public static final String EXTENDED_WRITER = "ROLE_EXTENDED_WRITER";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority()
|
* @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority()
|
||||||
*/
|
*/
|
||||||
@@ -56,48 +56,48 @@ public class ExtendedWriterDynamicAuthority extends ExtendedSecurityBaseDynamicA
|
|||||||
{
|
{
|
||||||
return EXTENDED_WRITER;
|
return EXTENDED_WRITER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor()
|
* @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<PermissionReference> requiredFor()
|
public Set<PermissionReference> requiredFor()
|
||||||
{
|
{
|
||||||
if (requiredFor == null)
|
if (requiredFor == null)
|
||||||
{
|
{
|
||||||
requiredFor = new HashSet<>(3);
|
requiredFor = new HashSet<>(3);
|
||||||
Collections.addAll(requiredFor,
|
Collections.addAll(requiredFor,
|
||||||
getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS),
|
getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS),
|
||||||
getModelDAO().getPermissionReference(null, RMPermissionModel.FILING),
|
getModelDAO().getPermissionReference(null, RMPermissionModel.FILING),
|
||||||
getModelDAO().getPermissionReference(null, RMPermissionModel.FILE_RECORDS));
|
getModelDAO().getPermissionReference(null, RMPermissionModel.FILE_RECORDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
return requiredFor;
|
return requiredFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected Set<String> getAuthorites(NodeRef nodeRef)
|
protected Set<String> getAuthorites(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
Set<String> result = null;
|
Set<String> result = null;
|
||||||
|
|
||||||
Map<String, Integer> map = (Map<String, Integer>)getNodeService().getProperty(nodeRef, PROP_WRITERS);
|
Map<String, Integer> map = (Map<String, Integer>) getNodeService().getProperty(nodeRef, PROP_WRITERS);
|
||||||
if (map != null)
|
if (map != null)
|
||||||
{
|
{
|
||||||
result = map.keySet();
|
result = map.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName()
|
* @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getTransactionCacheName()
|
protected String getTransactionCacheName()
|
||||||
{
|
{
|
||||||
return "rm.extendedwriterdynamicauthority";
|
return "rm.extendedwriterdynamicauthority";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
|||||||
public interface FilePlanAuthenticationService
|
public interface FilePlanAuthenticationService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return rm admin user name
|
* @return rm admin user name
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.2, use {@link AuthenticationUtil#getAdminUserName()}
|
* @deprecated as of 2.2, use {@link AuthenticationUtil#getAdminUserName()}
|
||||||
*/
|
*/
|
||||||
@@ -49,14 +49,16 @@ public interface FilePlanAuthenticationService
|
|||||||
/**
|
/**
|
||||||
* Run provided work as the global rm admin user.
|
* Run provided work as the global rm admin user.
|
||||||
*
|
*
|
||||||
* @param <R> return type
|
* @param <R>
|
||||||
* @param runAsWork work to execute as the rm admin user
|
* return type
|
||||||
* @return R result of work execution
|
* @param runAsWork
|
||||||
|
* work to execute as the rm admin user
|
||||||
|
* @return R result of work execution
|
||||||
*
|
*
|
||||||
* @deprecated as of 2.2, use
|
* @deprecated as of 2.2, use
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* {@link AuthenticationUtil#runAs(RunAsWork, String)}
|
* {@link AuthenticationUtil#runAs(RunAsWork, String)}
|
||||||
*/
|
*/
|
||||||
<R> R runAsRmAdmin(RunAsWork<R> runAsWork);
|
<R> R runAsRmAdmin(RunAsWork<R> runAsWork);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,4 +60,4 @@ public class FilePlanAuthenticationServiceImpl implements FilePlanAuthentication
|
|||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName());
|
return AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,40 +43,42 @@ import org.alfresco.service.namespace.QName;
|
|||||||
* @deprecated As of release 2.1, replaced by {@link ModelSecurityService}, {@link FilePlanRoleService} and {@link FilePlanPermissionService}
|
* @deprecated As of release 2.1, replaced by {@link ModelSecurityService}, {@link FilePlanRoleService} and {@link FilePlanPermissionService}
|
||||||
*/
|
*/
|
||||||
public interface RecordsManagementSecurityService
|
public interface RecordsManagementSecurityService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates the initial set of default roles for a root records management node
|
* Creates the initial set of default roles for a root records management node
|
||||||
*
|
*
|
||||||
* @param rmRootNode root node
|
* @param rmRootNode
|
||||||
|
* root node
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, operation no longer supported
|
* @deprecated As of release 2.1, operation no longer supported
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void bootstrapDefaultRoles(NodeRef rmRootNode);
|
void bootstrapDefaultRoles(NodeRef rmRootNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the container group for all roles of a specified file
|
* Returns the name of the container group for all roles of a specified file plan.
|
||||||
* plan.
|
|
||||||
*
|
*
|
||||||
* @param filePlan file plan node reference
|
* @param filePlan
|
||||||
* @return String group name
|
* file plan node reference
|
||||||
|
* @return String group name
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getAllRolesContainerGroup(NodeRef)}
|
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getAllRolesContainerGroup(NodeRef)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
String getAllRolesContainerGroup(NodeRef filePlan);
|
String getAllRolesContainerGroup(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the available roles for the given records management root node
|
* Get all the available roles for the given records management root node
|
||||||
*
|
*
|
||||||
* @param rmRootNode root node
|
* @param rmRootNode
|
||||||
* @return {@link Set}<{@link Role}> all roles for a given root node
|
* root node
|
||||||
|
* @return {@link Set}<{@link Role}> all roles for a given root node
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRoles(NodeRef)}
|
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRoles(NodeRef)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Set<Role> getRoles(NodeRef rmRootNode);
|
Set<Role> getRoles(NodeRef rmRootNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the roles for a given user
|
* Gets the roles for a given user
|
||||||
*
|
*
|
||||||
@@ -88,7 +90,7 @@ public interface RecordsManagementSecurityService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Set<Role> getRolesByUser(NodeRef rmRootNode, String user);
|
Set<Role> getRolesByUser(NodeRef rmRootNode, String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a role by name
|
* Get a role by name
|
||||||
*
|
*
|
||||||
@@ -99,10 +101,11 @@ public interface RecordsManagementSecurityService
|
|||||||
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRole(NodeRef, String)}
|
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRole(NodeRef, String)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Role getRole(NodeRef rmRootNode, String role);
|
Role getRole(NodeRef rmRootNode, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether a role exists for a given records management root node
|
* Indicate whether a role exists for a given records management root node
|
||||||
|
*
|
||||||
* @param rmRootNode
|
* @param rmRootNode
|
||||||
* @param role
|
* @param role
|
||||||
* @return
|
* @return
|
||||||
@@ -111,19 +114,21 @@ public interface RecordsManagementSecurityService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
boolean existsRole(NodeRef rmRootNode, String role);
|
boolean existsRole(NodeRef rmRootNode, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the given user has the RM Admin role
|
* Determines whether the given user has the RM Admin role
|
||||||
*
|
*
|
||||||
* @param rmRootNode RM root node
|
* @param rmRootNode
|
||||||
* @param user user name to check
|
* RM root node
|
||||||
|
* @param user
|
||||||
|
* user name to check
|
||||||
* @return true if the user has the RM Admin role, false otherwise
|
* @return true if the user has the RM Admin role, false otherwise
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#hasRMAdminRole(NodeRef, String)}
|
* @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#hasRMAdminRole(NodeRef, String)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
boolean hasRMAdminRole(NodeRef rmRootNode, String user);
|
boolean hasRMAdminRole(NodeRef rmRootNode, String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new role
|
* Create a new role
|
||||||
*
|
*
|
||||||
@@ -137,7 +142,7 @@ public interface RecordsManagementSecurityService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set<Capability> capabilities);
|
Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set<Capability> capabilities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an existing role
|
* Update an existing role
|
||||||
*
|
*
|
||||||
@@ -151,7 +156,7 @@ public interface RecordsManagementSecurityService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set<Capability> capabilities);
|
Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set<Capability> capabilities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a role
|
* Delete a role
|
||||||
*
|
*
|
||||||
@@ -162,7 +167,7 @@ public interface RecordsManagementSecurityService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void deleteRole(NodeRef rmRootNode, String role);
|
void deleteRole(NodeRef rmRootNode, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a role to an authority
|
* Assign a role to an authority
|
||||||
*
|
*
|
||||||
@@ -174,42 +179,47 @@ public interface RecordsManagementSecurityService
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName);
|
void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a permission on a RM object. Assumes allow is true. Cascades permission down to record folder.
|
* Sets a permission on a RM object. Assumes allow is true. Cascades permission down to record folder. Cascades ReadRecord up to file plan.
|
||||||
* Cascades ReadRecord up to file plan.
|
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param authority authority
|
* node reference
|
||||||
* @param permission permission
|
* @param authority
|
||||||
|
* authority
|
||||||
|
* @param permission
|
||||||
|
* permission
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#setPermission(NodeRef, String, String)}
|
* @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#setPermission(NodeRef, String, String)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void setPermission(NodeRef nodeRef, String authority, String permission);
|
void setPermission(NodeRef nodeRef, String authority, String permission);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a permission from a RM object. Cascades removal down to record folder.
|
* Deletes a permission from a RM object. Cascades removal down to record folder.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef
|
||||||
* @param authority authority
|
* node reference
|
||||||
* @param permission permission
|
* @param authority
|
||||||
|
* authority
|
||||||
|
* @param permission
|
||||||
|
* permission
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#deletePermission(NodeRef, String, String)}
|
* @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#deletePermission(NodeRef, String, String)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void deletePermission(NodeRef nodeRef, String authority, String permission);
|
void deletePermission(NodeRef nodeRef, String authority, String permission);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link Set}<{@link QName}> protected aspect names
|
* @return {@link Set}<{@link QName}> protected aspect names
|
||||||
* @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedAspects}
|
* @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedAspects}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Set<QName> getProtectedAspects();
|
Set<QName> getProtectedAspects();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link Set}<{@link QName}> protected properties
|
* @return {@link Set}<{@link QName}> protected properties
|
||||||
* @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedProperties}
|
* @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedProperties}
|
||||||
*/
|
*/
|
||||||
Set<QName> getProtectedProperties();
|
Set<QName> getProtectedProperties();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,27 +43,29 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class RecordsManagementSecurityServiceImpl implements RecordsManagementSecurityService,
|
public class RecordsManagementSecurityServiceImpl implements RecordsManagementSecurityService,
|
||||||
RecordsManagementModel
|
RecordsManagementModel
|
||||||
{
|
{
|
||||||
/** Model security service */
|
/** Model security service */
|
||||||
private ModelSecurityService modelSecurityService;
|
private ModelSecurityService modelSecurityService;
|
||||||
|
|
||||||
/** File plan role service */
|
/** File plan role service */
|
||||||
private FilePlanRoleService filePlanRoleService;
|
private FilePlanRoleService filePlanRoleService;
|
||||||
|
|
||||||
/** File plan permission service */
|
/** File plan permission service */
|
||||||
private FilePlanPermissionService filePlanPermissionService;
|
private FilePlanPermissionService filePlanPermissionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param modelSecurityService model security service
|
* @param modelSecurityService
|
||||||
|
* model security service
|
||||||
*/
|
*/
|
||||||
public void setModelSecurityService(ModelSecurityService modelSecurityService)
|
public void setModelSecurityService(ModelSecurityService modelSecurityService)
|
||||||
{
|
{
|
||||||
this.modelSecurityService = modelSecurityService;
|
this.modelSecurityService = modelSecurityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filePlanRoleService file plan role service
|
* @param filePlanRoleService
|
||||||
|
* file plan role service
|
||||||
*/
|
*/
|
||||||
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
|
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
|
||||||
{
|
{
|
||||||
@@ -71,13 +73,14 @@ public class RecordsManagementSecurityServiceImpl implements RecordsManagementSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filePlanPermissionService file plan permission service
|
* @param filePlanPermissionService
|
||||||
|
* file plan permission service
|
||||||
*/
|
*/
|
||||||
public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService)
|
public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService)
|
||||||
{
|
{
|
||||||
this.filePlanPermissionService = filePlanPermissionService;
|
this.filePlanPermissionService = filePlanPermissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedAspects()
|
* @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedAspects()
|
||||||
*/
|
*/
|
||||||
@@ -227,4 +230,4 @@ public class RecordsManagementSecurityServiceImpl implements RecordsManagementSe
|
|||||||
{
|
{
|
||||||
filePlanPermissionService.setPermission(nodeRef, authority, permission);
|
filePlanPermissionService.setPermission(nodeRef, authority, permission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class Role extends org.alfresco.module.org_alfresco_module_rm.role.Role
|
|||||||
{
|
{
|
||||||
return new Role(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName());
|
return new Role(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compatibility method
|
* Compatibility method
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +61,7 @@ public class Role extends org.alfresco.module.org_alfresco_module_rm.role.Role
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@@ -70,4 +70,4 @@ public class Role extends org.alfresco.module.org_alfresco_module_rm.role.Role
|
|||||||
{
|
{
|
||||||
super(name, displayLabel, capabilities, roleGroupName);
|
super(name, displayLabel, capabilities, roleGroupName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,12 +92,9 @@ public interface RecordsManagementPolicies
|
|||||||
interface OnRemoveReference extends ClassPolicy
|
interface OnRemoveReference extends ClassPolicy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param fromNodeRef
|
* @param fromNodeRef from node reference
|
||||||
* from node reference
|
* @param toNodeRef to node reference
|
||||||
* @param toNodeRef
|
* @param reference name of reference
|
||||||
* to node reference
|
|
||||||
* @param reference
|
|
||||||
* name of reference
|
|
||||||
*/
|
*/
|
||||||
void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference);
|
void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference);
|
||||||
}
|
}
|
||||||
@@ -113,8 +110,7 @@ public interface RecordsManagementPolicies
|
|||||||
QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordFile");
|
QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordFile");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
void beforeFileRecord(NodeRef nodeRef);
|
void beforeFileRecord(NodeRef nodeRef);
|
||||||
}
|
}
|
||||||
@@ -130,15 +126,13 @@ public interface RecordsManagementPolicies
|
|||||||
QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordFile");
|
QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordFile");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
void onFileRecord(NodeRef nodeRef);
|
void onFileRecord(NodeRef nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before record declaration
|
* Before record declaration
|
||||||
*
|
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
interface BeforeRecordDeclaration extends ClassPolicy
|
interface BeforeRecordDeclaration extends ClassPolicy
|
||||||
@@ -148,7 +142,6 @@ public interface RecordsManagementPolicies
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* On record declaration
|
* On record declaration
|
||||||
*
|
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
interface OnRecordDeclaration extends ClassPolicy
|
interface OnRecordDeclaration extends ClassPolicy
|
||||||
@@ -158,7 +151,6 @@ public interface RecordsManagementPolicies
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Before record rejection
|
* Before record rejection
|
||||||
*
|
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
interface BeforeRecordRejection extends ClassPolicy
|
interface BeforeRecordRejection extends ClassPolicy
|
||||||
@@ -168,11 +160,10 @@ public interface RecordsManagementPolicies
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* On record rejection
|
* On record rejection
|
||||||
*
|
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
interface OnRecordRejection extends ClassPolicy
|
interface OnRecordRejection extends ClassPolicy
|
||||||
{
|
{
|
||||||
void onRecordRejection(NodeRef nodeRef);
|
void onRecordRejection(NodeRef nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,14 +77,15 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService");
|
QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return records management service
|
* @return records management service
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordsManagementService getRecordsManagementService();
|
RecordsManagementService getRecordsManagementService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return record service
|
* @return record service
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordService getRecordService();
|
RecordService getRecordService();
|
||||||
@@ -96,25 +97,25 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
|
|||||||
DispositionService getDispositionService();
|
DispositionService getDispositionService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return records management admin service
|
* @return records management admin service
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordsManagementAdminService getRecordsManagementAdminService();
|
RecordsManagementAdminService getRecordsManagementAdminService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return records management action service
|
* @return records management action service
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordsManagementActionService getRecordsManagementActionService();
|
RecordsManagementActionService getRecordsManagementActionService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return records management event service
|
* @return records management event service
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordsManagementEventService getRecordsManagementEventService();
|
RecordsManagementEventService getRecordsManagementEventService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return records management security service
|
* @return records management security service
|
||||||
*
|
*
|
||||||
* @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService}
|
* @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService}
|
||||||
*/
|
*/
|
||||||
@@ -123,20 +124,20 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
|
|||||||
RecordsManagementSecurityService getRecordsManagementSecurityService();
|
RecordsManagementSecurityService getRecordsManagementSecurityService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return records management audit service
|
* @return records management audit service
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordsManagementAuditService getRecordsManagementAuditService();
|
RecordsManagementAuditService getRecordsManagementAuditService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return capability service
|
* @return capability service
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
CapabilityService getCapabilityService();
|
CapabilityService getCapabilityService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return freeze service
|
* @return freeze service
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
@@ -150,21 +151,21 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
|
|||||||
ExtendedSecurityService getExtendedSecurityService();
|
ExtendedSecurityService getExtendedSecurityService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return file plan service
|
* @return file plan service
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
FilePlanService getFilePlanService();
|
FilePlanService getFilePlanService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return file plan role service
|
* @return file plan role service
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
FilePlanRoleService getFilePlanRoleService();
|
FilePlanRoleService getFilePlanRoleService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return file plan permission service
|
* @return file plan permission service
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
@@ -177,16 +178,16 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
|
|||||||
IdentifierService getIdentifierService();
|
IdentifierService getIdentifierService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return record folder service
|
* @return record folder service
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
RecordFolderService getRecordFolderService();
|
RecordFolderService getRecordFolderService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return transfer service
|
* @return transfer service
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
TransferService getTransferService();
|
TransferService getTransferService();
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ import org.alfresco.repo.service.ServiceDescriptorRegistry;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry
|
public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry
|
||||||
implements RecordsManagementServiceRegistry
|
implements RecordsManagementServiceRegistry
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementActionService()
|
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementActionService()
|
||||||
@@ -205,4 +205,4 @@ public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegis
|
|||||||
{
|
{
|
||||||
return (TransferService) getService(TRANSFER_SERVICE);
|
return (TransferService) getService(TRANSFER_SERVICE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,10 +33,6 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
|
|
||||||
import org.alfresco.repo.batch.BatchProcessWorkProvider;
|
import org.alfresco.repo.batch.BatchProcessWorkProvider;
|
||||||
import org.alfresco.repo.batch.BatchProcessor;
|
import org.alfresco.repo.batch.BatchProcessor;
|
||||||
import org.alfresco.repo.batch.BatchProcessor.BatchProcessWorker;
|
import org.alfresco.repo.batch.BatchProcessor.BatchProcessWorker;
|
||||||
@@ -49,6 +45,9 @@ import org.alfresco.service.cmr.search.ResultSet;
|
|||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class for executing bulk operations on nodes based on search query results
|
* A base class for executing bulk operations on nodes based on search query results
|
||||||
@@ -80,10 +79,8 @@ public abstract class BulkBaseService<T> implements InitializingBean
|
|||||||
/**
|
/**
|
||||||
* Execute bulk operation on node based on the search query results
|
* Execute bulk operation on node based on the search query results
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
* @param bulkOperation bulk operation
|
||||||
* @param bulkOperation
|
|
||||||
* bulk operation
|
|
||||||
* @return bulk status
|
* @return bulk status
|
||||||
*/
|
*/
|
||||||
public T execute(NodeRef nodeRef, BulkOperation bulkOperation)
|
public T execute(NodeRef nodeRef, BulkOperation bulkOperation)
|
||||||
@@ -104,19 +101,19 @@ public abstract class BulkBaseService<T> implements InitializingBean
|
|||||||
bulkMonitor.registerProcess(nodeRef, processId, bulkOperation);
|
bulkMonitor.registerProcess(nodeRef, processId, bulkOperation);
|
||||||
|
|
||||||
BulkProgress bulkProgress = new BulkProgress(totalItems, processId, new AtomicBoolean(false),
|
BulkProgress bulkProgress = new BulkProgress(totalItems, processId, new AtomicBoolean(false),
|
||||||
new AtomicInteger(0));
|
new AtomicInteger(0));
|
||||||
BatchProcessWorker<NodeRef> batchProcessWorker = getWorkerProvider(nodeRef, bulkOperation, bulkProgress);
|
BatchProcessWorker<NodeRef> batchProcessWorker = getWorkerProvider(nodeRef, bulkOperation, bulkProgress);
|
||||||
BulkStatusUpdater bulkStatusUpdater = getBulkStatusUpdater();
|
BulkStatusUpdater bulkStatusUpdater = getBulkStatusUpdater();
|
||||||
|
|
||||||
BatchProcessor<NodeRef> batchProcessor = new BatchProcessor<>(
|
BatchProcessor<NodeRef> batchProcessor = new BatchProcessor<>(
|
||||||
processId,
|
processId,
|
||||||
transactionService.getRetryingTransactionHelper(),
|
transactionService.getRetryingTransactionHelper(),
|
||||||
getWorkProvider(bulkOperation, bulkStatusUpdater, bulkProgress),
|
getWorkProvider(bulkOperation, bulkStatusUpdater, bulkProgress),
|
||||||
threadCount,
|
threadCount,
|
||||||
itemsPerTransaction,
|
itemsPerTransaction,
|
||||||
bulkStatusUpdater,
|
bulkStatusUpdater,
|
||||||
LOG,
|
LOG,
|
||||||
loggingInterval);
|
loggingInterval);
|
||||||
|
|
||||||
runAsyncBatchProcessor(batchProcessor, batchProcessWorker, bulkStatusUpdater);
|
runAsyncBatchProcessor(batchProcessor, batchProcessWorker, bulkStatusUpdater);
|
||||||
return initBulkStatus;
|
return initBulkStatus;
|
||||||
@@ -126,7 +123,7 @@ public abstract class BulkBaseService<T> implements InitializingBean
|
|||||||
* Run batch processor
|
* Run batch processor
|
||||||
*/
|
*/
|
||||||
protected void runAsyncBatchProcessor(BatchProcessor<NodeRef> batchProcessor,
|
protected void runAsyncBatchProcessor(BatchProcessor<NodeRef> batchProcessor,
|
||||||
BatchProcessWorker<NodeRef> batchProcessWorker, BulkStatusUpdater bulkStatusUpdater)
|
BatchProcessWorker<NodeRef> batchProcessWorker, BulkStatusUpdater bulkStatusUpdater)
|
||||||
{
|
{
|
||||||
Runnable backgroundLogic = () -> {
|
Runnable backgroundLogic = () -> {
|
||||||
try
|
try
|
||||||
@@ -157,10 +154,8 @@ public abstract class BulkBaseService<T> implements InitializingBean
|
|||||||
/**
|
/**
|
||||||
* Get initial bulk status
|
* Get initial bulk status
|
||||||
*
|
*
|
||||||
* @param processId
|
* @param processId process id
|
||||||
* process id
|
* @param totalItems total items
|
||||||
* @param totalItems
|
|
||||||
* total items
|
|
||||||
* @return bulk status
|
* @return bulk status
|
||||||
*/
|
*/
|
||||||
protected abstract T getInitBulkStatus(String processId, long totalItems);
|
protected abstract T getInitBulkStatus(String processId, long totalItems);
|
||||||
@@ -175,38 +170,30 @@ public abstract class BulkBaseService<T> implements InitializingBean
|
|||||||
/**
|
/**
|
||||||
* Get work provider
|
* Get work provider
|
||||||
*
|
*
|
||||||
* @param bulkOperation
|
* @param bulkOperation bulk operation
|
||||||
* bulk operation
|
* @param bulkStatusUpdater bulk status updater
|
||||||
* @param bulkStatusUpdater
|
* @param bulkProgress bulk progress
|
||||||
* bulk status updater
|
|
||||||
* @param bulkProgress
|
|
||||||
* bulk progress
|
|
||||||
* @return work provider
|
* @return work provider
|
||||||
*/
|
*/
|
||||||
protected abstract BatchProcessWorkProvider<NodeRef> getWorkProvider(BulkOperation bulkOperation,
|
protected abstract BatchProcessWorkProvider<NodeRef> getWorkProvider(BulkOperation bulkOperation,
|
||||||
BulkStatusUpdater bulkStatusUpdater, BulkProgress bulkProgress);
|
BulkStatusUpdater bulkStatusUpdater, BulkProgress bulkProgress);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get worker provider
|
* Get worker provider
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
* @param bulkOperation bulk operation
|
||||||
* @param bulkOperation
|
* @param bulkProgress bulk progress
|
||||||
* bulk operation
|
|
||||||
* @param bulkProgress
|
|
||||||
* bulk progress
|
|
||||||
* @return worker provider
|
* @return worker provider
|
||||||
*/
|
*/
|
||||||
protected abstract BatchProcessWorker<NodeRef> getWorkerProvider(NodeRef nodeRef, BulkOperation bulkOperation,
|
protected abstract BatchProcessWorker<NodeRef> getWorkerProvider(NodeRef nodeRef, BulkOperation bulkOperation,
|
||||||
BulkProgress bulkProgress);
|
BulkProgress bulkProgress);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check permissions
|
* Check permissions
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
* @param bulkOperation bulk operation
|
||||||
* @param bulkOperation
|
|
||||||
* bulk operation
|
|
||||||
*/
|
*/
|
||||||
protected abstract void checkPermissions(NodeRef nodeRef, BulkOperation bulkOperation);
|
protected abstract void checkPermissions(NodeRef nodeRef, BulkOperation bulkOperation);
|
||||||
|
|
||||||
@@ -275,4 +262,4 @@ public abstract class BulkBaseService<T> implements InitializingBean
|
|||||||
{
|
{
|
||||||
this.maxParallelRequests = maxParallelRequests;
|
this.maxParallelRequests = maxParallelRequests;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,4 +30,5 @@ package org.alfresco.module.org_alfresco_module_rm.bulk;
|
|||||||
* An immutable POJO to represent a bulk cancellation request
|
* An immutable POJO to represent a bulk cancellation request
|
||||||
*/
|
*/
|
||||||
public record BulkCancellationRequest(String reason)
|
public record BulkCancellationRequest(String reason)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
@@ -36,28 +36,23 @@ public interface BulkMonitor<T>
|
|||||||
/**
|
/**
|
||||||
* Update the bulk status
|
* Update the bulk status
|
||||||
*
|
*
|
||||||
* @param bulkStatus
|
* @param bulkStatus the bulk status
|
||||||
* the bulk status
|
|
||||||
*/
|
*/
|
||||||
void updateBulkStatus(T bulkStatus);
|
void updateBulkStatus(T bulkStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a process
|
* Register a process
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef the node reference
|
||||||
* the node reference
|
* @param processId the process id
|
||||||
* @param processId
|
* @param bulkOperation the bulk operation
|
||||||
* the process id
|
|
||||||
* @param bulkOperation
|
|
||||||
* the bulk operation
|
|
||||||
*/
|
*/
|
||||||
void registerProcess(NodeRef nodeRef, String processId, BulkOperation bulkOperation);
|
void registerProcess(NodeRef nodeRef, String processId, BulkOperation bulkOperation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bulk status
|
* Get the bulk status
|
||||||
*
|
*
|
||||||
* @param bulkStatusId
|
* @param bulkStatusId the bulk status id
|
||||||
* the bulk status id
|
|
||||||
* @return the bulk status
|
* @return the bulk status
|
||||||
*/
|
*/
|
||||||
T getBulkStatus(String bulkStatusId);
|
T getBulkStatus(String bulkStatusId);
|
||||||
@@ -85,4 +80,4 @@ public interface BulkMonitor<T>
|
|||||||
* @return cancellation reason
|
* @return cancellation reason
|
||||||
*/
|
*/
|
||||||
BulkCancellationRequest getBulkCancellationRequest(String bulkStatusId);
|
BulkCancellationRequest getBulkCancellationRequest(String bulkStatusId);
|
||||||
}
|
}
|
||||||
@@ -42,4 +42,4 @@ public record BulkOperation(Query searchQuery, String operationType) implements
|
|||||||
throw new IllegalArgumentException("Operation type and search query must not be null");
|
throw new IllegalArgumentException("Operation type and search query must not be null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,4 +33,5 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
* An immutable POJO to represent the progress of a bulk operation
|
* An immutable POJO to represent the progress of a bulk operation
|
||||||
*/
|
*/
|
||||||
public record BulkProgress(long totalItems, String processId, AtomicBoolean cancelled, AtomicInteger currentNodeNumber)
|
public record BulkProgress(long totalItems, String processId, AtomicBoolean cancelled, AtomicInteger currentNodeNumber)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
@@ -37,4 +37,4 @@ public interface BulkStatusUpdater extends ApplicationEventPublisher
|
|||||||
* Update the bulk status
|
* Update the bulk status
|
||||||
*/
|
*/
|
||||||
void update();
|
void update();
|
||||||
}
|
}
|
||||||
@@ -33,14 +33,13 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
|
||||||
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkCancellationRequest;
|
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkCancellationRequest;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkOperation;
|
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkOperation;
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
import org.alfresco.repo.cache.SimpleCache;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default hold bulk monitor implementation
|
* Default hold bulk monitor implementation
|
||||||
@@ -63,7 +62,7 @@ public class DefaultHoldBulkMonitor extends AbstractLifecycleBean implements Hol
|
|||||||
if (holdRef != null && processId != null)
|
if (holdRef != null && processId != null)
|
||||||
{
|
{
|
||||||
holdProcessRegistry.put(new Pair<>(holdRef.getId(), processId),
|
holdProcessRegistry.put(new Pair<>(holdRef.getId(), processId),
|
||||||
new HoldBulkProcessDetails(processId, getCurrentInstanceDetails(), bulkOperation));
|
new HoldBulkProcessDetails(processId, getCurrentInstanceDetails(), bulkOperation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,22 +94,22 @@ public class DefaultHoldBulkMonitor extends AbstractLifecycleBean implements Hol
|
|||||||
public List<HoldBulkStatusAndProcessDetails> getBulkStatusesWithProcessDetails(String holdId)
|
public List<HoldBulkStatusAndProcessDetails> getBulkStatusesWithProcessDetails(String holdId)
|
||||||
{
|
{
|
||||||
return holdProcessRegistry.getKeys().stream()
|
return holdProcessRegistry.getKeys().stream()
|
||||||
.filter(holdIdAndBulkStatusId -> holdId.equals(holdIdAndBulkStatusId.getFirst()))
|
.filter(holdIdAndBulkStatusId -> holdId.equals(holdIdAndBulkStatusId.getFirst()))
|
||||||
.map(holdIdAndBulkStatusId -> holdProcessRegistry.get(holdIdAndBulkStatusId))
|
.map(holdIdAndBulkStatusId -> holdProcessRegistry.get(holdIdAndBulkStatusId))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.map(createHoldBulkStatusAndProcessDetails())
|
.map(createHoldBulkStatusAndProcessDetails())
|
||||||
.filter(statusAndProcess -> Objects.nonNull(statusAndProcess.holdBulkStatus()))
|
.filter(statusAndProcess -> Objects.nonNull(statusAndProcess.holdBulkStatus()))
|
||||||
.sorted(sortBulkStatuses())
|
.sorted(sortBulkStatuses())
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HoldBulkStatusAndProcessDetails getBulkStatusWithProcessDetails(String holdId, String bulkStatusId)
|
public HoldBulkStatusAndProcessDetails getBulkStatusWithProcessDetails(String holdId, String bulkStatusId)
|
||||||
{
|
{
|
||||||
return Optional.ofNullable(holdProcessRegistry.get(new Pair<>(holdId, bulkStatusId)))
|
return Optional.ofNullable(holdProcessRegistry.get(new Pair<>(holdId, bulkStatusId)))
|
||||||
.map(createHoldBulkStatusAndProcessDetails())
|
.map(createHoldBulkStatusAndProcessDetails())
|
||||||
.filter(statusAndProcess -> Objects.nonNull(statusAndProcess.holdBulkStatus()))
|
.filter(statusAndProcess -> Objects.nonNull(statusAndProcess.holdBulkStatus()))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getCurrentInstanceDetails()
|
protected String getCurrentInstanceDetails()
|
||||||
@@ -121,33 +120,33 @@ public class DefaultHoldBulkMonitor extends AbstractLifecycleBean implements Hol
|
|||||||
protected Function<HoldBulkProcessDetails, HoldBulkStatusAndProcessDetails> createHoldBulkStatusAndProcessDetails()
|
protected Function<HoldBulkProcessDetails, HoldBulkStatusAndProcessDetails> createHoldBulkStatusAndProcessDetails()
|
||||||
{
|
{
|
||||||
return bulkProcessDetails -> new HoldBulkStatusAndProcessDetails(
|
return bulkProcessDetails -> new HoldBulkStatusAndProcessDetails(
|
||||||
getBulkStatus(bulkProcessDetails.bulkStatusId()), bulkProcessDetails);
|
getBulkStatus(bulkProcessDetails.bulkStatusId()), bulkProcessDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Comparator<HoldBulkStatusAndProcessDetails> sortBulkStatuses()
|
protected static Comparator<HoldBulkStatusAndProcessDetails> sortBulkStatuses()
|
||||||
{
|
{
|
||||||
return Comparator.<HoldBulkStatusAndProcessDetails, Date> comparing(
|
return Comparator.<HoldBulkStatusAndProcessDetails, Date>comparing(
|
||||||
statusAndProcess -> statusAndProcess.holdBulkStatus().endTime(),
|
statusAndProcess -> statusAndProcess.holdBulkStatus().endTime(),
|
||||||
Comparator.nullsLast(Comparator.naturalOrder()))
|
Comparator.nullsLast(Comparator.naturalOrder()))
|
||||||
.thenComparing(statusAndProcess -> statusAndProcess.holdBulkStatus().startTime(),
|
.thenComparing(statusAndProcess -> statusAndProcess.holdBulkStatus().startTime(),
|
||||||
Comparator.nullsLast(Comparator.naturalOrder()))
|
Comparator.nullsLast(Comparator.naturalOrder()))
|
||||||
.reversed();
|
.reversed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHoldProgressCache(
|
public void setHoldProgressCache(
|
||||||
SimpleCache<String, HoldBulkStatus> holdProgressCache)
|
SimpleCache<String, HoldBulkStatus> holdProgressCache)
|
||||||
{
|
{
|
||||||
this.holdProgressCache = holdProgressCache;
|
this.holdProgressCache = holdProgressCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHoldProcessRegistry(
|
public void setHoldProcessRegistry(
|
||||||
SimpleCache<Pair<String, String>, HoldBulkProcessDetails> holdProcessRegistry)
|
SimpleCache<Pair<String, String>, HoldBulkProcessDetails> holdProcessRegistry)
|
||||||
{
|
{
|
||||||
this.holdProcessRegistry = holdProcessRegistry;
|
this.holdProcessRegistry = holdProcessRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBulkCancellationsCache(
|
public void setBulkCancellationsCache(
|
||||||
SimpleCache<String, BulkCancellationRequest> bulkCancellationsCache)
|
SimpleCache<String, BulkCancellationRequest> bulkCancellationsCache)
|
||||||
{
|
{
|
||||||
this.bulkCancellationsCache = bulkCancellationsCache;
|
this.bulkCancellationsCache = bulkCancellationsCache;
|
||||||
}
|
}
|
||||||
@@ -163,4 +162,4 @@ public class DefaultHoldBulkMonitor extends AbstractLifecycleBean implements Hol
|
|||||||
{
|
{
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,7 @@ public interface HoldBulkMonitor extends BulkMonitor<HoldBulkStatus>
|
|||||||
/**
|
/**
|
||||||
* Get the bulk statuses with process details for a hold
|
* Get the bulk statuses with process details for a hold
|
||||||
*
|
*
|
||||||
* @param holdId
|
* @param holdId the hold id
|
||||||
* the hold id
|
|
||||||
* @return the bulk statuses with process details
|
* @return the bulk statuses with process details
|
||||||
*/
|
*/
|
||||||
List<HoldBulkStatusAndProcessDetails> getBulkStatusesWithProcessDetails(String holdId);
|
List<HoldBulkStatusAndProcessDetails> getBulkStatusesWithProcessDetails(String holdId);
|
||||||
@@ -47,11 +46,9 @@ public interface HoldBulkMonitor extends BulkMonitor<HoldBulkStatus>
|
|||||||
/**
|
/**
|
||||||
* Get the bulk status with process details
|
* Get the bulk status with process details
|
||||||
*
|
*
|
||||||
* @param holdId
|
* @param holdId the hold id
|
||||||
* the hold id
|
* @param bulkStatusId the bulk status id
|
||||||
* @param bulkStatusId
|
|
||||||
* the bulk status id
|
|
||||||
* @return the bulk status with process details
|
* @return the bulk status with process details
|
||||||
*/
|
*/
|
||||||
HoldBulkStatusAndProcessDetails getBulkStatusWithProcessDetails(String holdId, String bulkStatusId);
|
HoldBulkStatusAndProcessDetails getBulkStatusWithProcessDetails(String holdId, String bulkStatusId);
|
||||||
}
|
}
|
||||||
@@ -34,4 +34,5 @@ import org.alfresco.module.org_alfresco_module_rm.bulk.BulkOperation;
|
|||||||
* A simple immutable POJO to hold the details of a bulk process
|
* A simple immutable POJO to hold the details of a bulk process
|
||||||
*/
|
*/
|
||||||
public record HoldBulkProcessDetails(String bulkStatusId, String creatorInstance, BulkOperation bulkOperation) implements Serializable
|
public record HoldBulkProcessDetails(String bulkStatusId, String creatorInstance, BulkOperation bulkOperation) implements Serializable
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
@@ -38,10 +38,8 @@ public interface HoldBulkService
|
|||||||
/**
|
/**
|
||||||
* Initiates a bulk operation on a hold.
|
* Initiates a bulk operation on a hold.
|
||||||
*
|
*
|
||||||
* @param holdRef
|
* @param holdRef The hold reference
|
||||||
* The hold reference
|
* @param bulkOperation The bulk operation
|
||||||
* @param bulkOperation
|
|
||||||
* The bulk operation
|
|
||||||
* @return The initial status of the bulk operation
|
* @return The initial status of the bulk operation
|
||||||
*/
|
*/
|
||||||
HoldBulkStatus execute(NodeRef holdRef, BulkOperation bulkOperation);
|
HoldBulkStatus execute(NodeRef holdRef, BulkOperation bulkOperation);
|
||||||
@@ -49,12 +47,9 @@ public interface HoldBulkService
|
|||||||
/**
|
/**
|
||||||
* Cancels a bulk operation.
|
* Cancels a bulk operation.
|
||||||
*
|
*
|
||||||
* @param holdRef
|
* @param holdRef The hold reference
|
||||||
* The hold reference
|
* @param bulkStatusId The bulk status id
|
||||||
* @param bulkStatusId
|
* @param bulkCancellationRequest The bulk cancellation request
|
||||||
* The bulk status id
|
|
||||||
* @param bulkCancellationRequest
|
|
||||||
* The bulk cancellation request
|
|
||||||
*/
|
*/
|
||||||
void cancelBulkOperation(NodeRef holdRef, String bulkStatusId, BulkCancellationRequest bulkCancellationRequest);
|
void cancelBulkOperation(NodeRef holdRef, String bulkStatusId, BulkCancellationRequest bulkCancellationRequest);
|
||||||
}
|
}
|
||||||
@@ -34,10 +34,6 @@ import java.util.Collections;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkBaseService;
|
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkBaseService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkCancellationRequest;
|
import org.alfresco.module.org_alfresco_module_rm.bulk.BulkCancellationRequest;
|
||||||
@@ -60,6 +56,9 @@ import org.alfresco.service.cmr.search.ResultSet;
|
|||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the {@link HoldBulkService} interface.
|
* Implementation of the {@link HoldBulkService} interface.
|
||||||
@@ -89,23 +88,23 @@ public class HoldBulkServiceImpl extends BulkBaseService<HoldBulkStatus> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BatchProcessWorkProvider<NodeRef> getWorkProvider(BulkOperation bulkOperation,
|
protected BatchProcessWorkProvider<NodeRef> getWorkProvider(BulkOperation bulkOperation,
|
||||||
BulkStatusUpdater bulkStatusUpdater, BulkProgress bulkProgress)
|
BulkStatusUpdater bulkStatusUpdater, BulkProgress bulkProgress)
|
||||||
{
|
{
|
||||||
return new AddToHoldWorkerProvider(bulkOperation, bulkStatusUpdater, bulkProgress,
|
return new AddToHoldWorkerProvider(bulkOperation, bulkStatusUpdater, bulkProgress,
|
||||||
(HoldBulkMonitor) bulkMonitor);
|
(HoldBulkMonitor) bulkMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BatchProcessWorker<NodeRef> getWorkerProvider(NodeRef nodeRef, BulkOperation bulkOperation,
|
protected BatchProcessWorker<NodeRef> getWorkerProvider(NodeRef nodeRef, BulkOperation bulkOperation,
|
||||||
BulkProgress bulkProgress)
|
BulkProgress bulkProgress)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HoldBulkOperationType holdBulkOperationType = HoldBulkOperationType.valueOf(bulkOperation.operationType()
|
HoldBulkOperationType holdBulkOperationType = HoldBulkOperationType.valueOf(bulkOperation.operationType()
|
||||||
.toUpperCase(Locale.ENGLISH));
|
.toUpperCase(Locale.ENGLISH));
|
||||||
return switch (holdBulkOperationType)
|
return switch (holdBulkOperationType)
|
||||||
{
|
{
|
||||||
case ADD -> new AddToHoldWorkerBatch(nodeRef, bulkProgress);
|
case ADD -> new AddToHoldWorkerBatch(nodeRef, bulkProgress);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e)
|
catch (IllegalArgumentException e)
|
||||||
@@ -128,8 +127,8 @@ public class HoldBulkServiceImpl extends BulkBaseService<HoldBulkStatus> impleme
|
|||||||
throw new InvalidArgumentException(I18NUtil.getMessage("rm.hold.not-hold", holdName), null);
|
throw new InvalidArgumentException(I18NUtil.getMessage("rm.hold.not-hold", holdName), null);
|
||||||
}
|
}
|
||||||
if (ADD.name().equals(bulkOperation.operationType()) && (!AccessStatus.ALLOWED.equals(
|
if (ADD.name().equals(bulkOperation.operationType()) && (!AccessStatus.ALLOWED.equals(
|
||||||
capabilityService.getCapabilityAccessState(holdRef, RMPermissionModel.ADD_TO_HOLD)) ||
|
capabilityService.getCapabilityAccessState(holdRef, RMPermissionModel.ADD_TO_HOLD)) ||
|
||||||
permissionService.hasPermission(holdRef, RMPermissionModel.FILING) == AccessStatus.DENIED))
|
permissionService.hasPermission(holdRef, RMPermissionModel.FILING) == AccessStatus.DENIED))
|
||||||
{
|
{
|
||||||
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED));
|
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED));
|
||||||
}
|
}
|
||||||
@@ -142,13 +141,13 @@ public class HoldBulkServiceImpl extends BulkBaseService<HoldBulkStatus> impleme
|
|||||||
if (bulkMonitor instanceof HoldBulkMonitor holdBulkMonitor)
|
if (bulkMonitor instanceof HoldBulkMonitor holdBulkMonitor)
|
||||||
{
|
{
|
||||||
HoldBulkStatusAndProcessDetails statusAndProcessDetails = holdBulkMonitor.getBulkStatusWithProcessDetails(
|
HoldBulkStatusAndProcessDetails statusAndProcessDetails = holdBulkMonitor.getBulkStatusWithProcessDetails(
|
||||||
holdRef.getId(), bulkStatusId);
|
holdRef.getId(), bulkStatusId);
|
||||||
|
|
||||||
Optional.ofNullable(statusAndProcessDetails).map(HoldBulkStatusAndProcessDetails::holdBulkProcessDetails)
|
Optional.ofNullable(statusAndProcessDetails).map(HoldBulkStatusAndProcessDetails::holdBulkProcessDetails)
|
||||||
.map(HoldBulkProcessDetails::bulkOperation).ifPresent(bulkOperation -> {
|
.map(HoldBulkProcessDetails::bulkOperation).ifPresent(bulkOperation -> {
|
||||||
checkPermissions(holdRef, bulkOperation);
|
checkPermissions(holdRef, bulkOperation);
|
||||||
holdBulkMonitor.cancelBulkOperation(bulkStatusId, cancellationRequest);
|
holdBulkMonitor.cancelBulkOperation(bulkStatusId, cancellationRequest);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +202,7 @@ public class HoldBulkServiceImpl extends BulkBaseService<HoldBulkStatus> impleme
|
|||||||
private final BulkStatusUpdater bulkStatusUpdater;
|
private final BulkStatusUpdater bulkStatusUpdater;
|
||||||
|
|
||||||
public AddToHoldWorkerProvider(BulkOperation bulkOperation,
|
public AddToHoldWorkerProvider(BulkOperation bulkOperation,
|
||||||
BulkStatusUpdater bulkStatusUpdater, BulkProgress bulkProgress, HoldBulkMonitor holdBulkMonitor)
|
BulkStatusUpdater bulkStatusUpdater, BulkProgress bulkProgress, HoldBulkMonitor holdBulkMonitor)
|
||||||
{
|
{
|
||||||
this.searchQuery = bulkOperation.searchQuery();
|
this.searchQuery = bulkOperation.searchQuery();
|
||||||
this.bulkProgress = bulkProgress;
|
this.bulkProgress = bulkProgress;
|
||||||
@@ -244,7 +243,7 @@ public class HoldBulkServiceImpl extends BulkBaseService<HoldBulkStatus> impleme
|
|||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
{
|
{
|
||||||
LOGGER.debug("Processing the next work for the batch processor, skipCount={}, size={}",
|
LOGGER.debug("Processing the next work for the batch processor, skipCount={}, size={}",
|
||||||
searchParams.getSkipCount(), result.getNumberFound());
|
searchParams.getSkipCount(), result.getNumberFound());
|
||||||
}
|
}
|
||||||
bulkProgress.currentNodeNumber().addAndGet(batchSize);
|
bulkProgress.currentNodeNumber().addAndGet(batchSize);
|
||||||
bulkStatusUpdater.update();
|
bulkStatusUpdater.update();
|
||||||
@@ -284,4 +283,4 @@ public class HoldBulkServiceImpl extends BulkBaseService<HoldBulkStatus> impleme
|
|||||||
{
|
{
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,12 +33,15 @@ import java.util.Date;
|
|||||||
* An immutable POJO that contains the status of a hold bulk operation
|
* An immutable POJO that contains the status of a hold bulk operation
|
||||||
*/
|
*/
|
||||||
public record HoldBulkStatus(String bulkStatusId, Date startTime, Date endTime, long processedItems, long errorsCount,
|
public record HoldBulkStatus(String bulkStatusId, Date startTime, Date endTime, long processedItems, long errorsCount,
|
||||||
long totalItems, String lastError, boolean isCancelled, String cancellationReason)
|
long totalItems, String lastError, boolean isCancelled, String cancellationReason)
|
||||||
implements Serializable
|
implements Serializable
|
||||||
{
|
{
|
||||||
public enum Status
|
public enum Status
|
||||||
{
|
{
|
||||||
PENDING("PENDING"), IN_PROGRESS("IN PROGRESS"), DONE("DONE"), CANCELLED("CANCELLED");
|
PENDING("PENDING"),
|
||||||
|
IN_PROGRESS("IN PROGRESS"),
|
||||||
|
DONE("DONE"),
|
||||||
|
CANCELLED("CANCELLED");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
@@ -72,4 +75,4 @@ public record HoldBulkStatus(String bulkStatusId, Date startTime, Date endTime,
|
|||||||
return Status.DONE.getValue();
|
return Status.DONE.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,5 +30,6 @@ package org.alfresco.module.org_alfresco_module_rm.bulk.hold;
|
|||||||
* An immutable POJO that contains the status of a hold bulk operation and the details of the process
|
* An immutable POJO that contains the status of a hold bulk operation and the details of the process
|
||||||
*/
|
*/
|
||||||
public record HoldBulkStatusAndProcessDetails(HoldBulkStatus holdBulkStatus,
|
public record HoldBulkStatusAndProcessDetails(HoldBulkStatus holdBulkStatus,
|
||||||
HoldBulkProcessDetails holdBulkProcessDetails)
|
HoldBulkProcessDetails holdBulkProcessDetails)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
@@ -44,17 +44,17 @@ public class HoldBulkStatusUpdater implements BulkStatusUpdater
|
|||||||
public HoldBulkStatusUpdater(HoldBulkMonitor holdBulkMonitor)
|
public HoldBulkStatusUpdater(HoldBulkMonitor holdBulkMonitor)
|
||||||
{
|
{
|
||||||
this.task = () -> holdBulkMonitor.updateBulkStatus(
|
this.task = () -> holdBulkMonitor.updateBulkStatus(
|
||||||
new HoldBulkStatus(batchMonitor.getProcessName(),
|
new HoldBulkStatus(batchMonitor.getProcessName(),
|
||||||
batchMonitor.getStartTime(),
|
batchMonitor.getStartTime(),
|
||||||
batchMonitor.getEndTime(),
|
batchMonitor.getEndTime(),
|
||||||
batchMonitor.getSuccessfullyProcessedEntriesLong() + batchMonitor.getTotalErrorsLong(),
|
batchMonitor.getSuccessfullyProcessedEntriesLong() + batchMonitor.getTotalErrorsLong(),
|
||||||
batchMonitor.getTotalErrorsLong(),
|
batchMonitor.getTotalErrorsLong(),
|
||||||
batchMonitor.getTotalResultsLong(),
|
batchMonitor.getTotalResultsLong(),
|
||||||
batchMonitor.getLastError(),
|
batchMonitor.getLastError(),
|
||||||
holdBulkMonitor.isCancelled(batchMonitor.getProcessName()),
|
holdBulkMonitor.isCancelled(batchMonitor.getProcessName()),
|
||||||
Optional.ofNullable(holdBulkMonitor.getBulkCancellationRequest(batchMonitor.getProcessName()))
|
Optional.ofNullable(holdBulkMonitor.getBulkCancellationRequest(batchMonitor.getProcessName()))
|
||||||
.map(BulkCancellationRequest::reason)
|
.map(BulkCancellationRequest::reason)
|
||||||
.orElse(null)));
|
.orElse(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,4 +74,4 @@ public class HoldBulkStatusUpdater implements BulkStatusUpdater
|
|||||||
batchMonitor = batchMonitorEvent.getBatchMonitor();
|
batchMonitor = batchMonitorEvent.getBatchMonitor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,10 +40,11 @@ import org.alfresco.rm.rest.api.model.HoldBulkStatusEntry;
|
|||||||
public final class HoldBulkUtils
|
public final class HoldBulkUtils
|
||||||
{
|
{
|
||||||
private HoldBulkUtils()
|
private HoldBulkUtils()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static HoldBulkStatusEntry toHoldBulkStatusEntry(
|
public static HoldBulkStatusEntry toHoldBulkStatusEntry(
|
||||||
HoldBulkStatusAndProcessDetails holdBulkStatusAndProcessDetails)
|
HoldBulkStatusAndProcessDetails holdBulkStatusAndProcessDetails)
|
||||||
{
|
{
|
||||||
HoldBulkStatus bulkStatus = holdBulkStatusAndProcessDetails.holdBulkStatus();
|
HoldBulkStatus bulkStatus = holdBulkStatusAndProcessDetails.holdBulkStatus();
|
||||||
BulkOperation bulkOperation = holdBulkStatusAndProcessDetails.holdBulkProcessDetails().bulkOperation();
|
BulkOperation bulkOperation = holdBulkStatusAndProcessDetails.holdBulkProcessDetails().bulkOperation();
|
||||||
@@ -51,13 +52,13 @@ public final class HoldBulkUtils
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
HoldBulkOperation holdBulkOperation = new HoldBulkOperation(
|
HoldBulkOperation holdBulkOperation = new HoldBulkOperation(
|
||||||
new Query(bulkOperation.searchQuery().getLanguage(),
|
new Query(bulkOperation.searchQuery().getLanguage(),
|
||||||
bulkOperation.searchQuery().getQuery(), bulkOperation.searchQuery().getUserQuery()),
|
bulkOperation.searchQuery().getQuery(), bulkOperation.searchQuery().getUserQuery()),
|
||||||
HoldBulkOperationType.valueOf(bulkOperation.operationType()));
|
HoldBulkOperationType.valueOf(bulkOperation.operationType()));
|
||||||
return new HoldBulkStatusEntry(bulkStatus.bulkStatusId(), bulkStatus.startTime(),
|
return new HoldBulkStatusEntry(bulkStatus.bulkStatusId(), bulkStatus.startTime(),
|
||||||
bulkStatus.endTime(), bulkStatus.processedItems(), bulkStatus.errorsCount(),
|
bulkStatus.endTime(), bulkStatus.processedItems(), bulkStatus.errorsCount(),
|
||||||
bulkStatus.totalItems(), bulkStatus.lastError(), bulkStatus.getStatus(),
|
bulkStatus.totalItems(), bulkStatus.lastError(), bulkStatus.getStatus(),
|
||||||
bulkStatus.cancellationReason(), holdBulkOperation);
|
bulkStatus.cancellationReason(), holdBulkOperation);
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e)
|
catch (IllegalArgumentException e)
|
||||||
{
|
{
|
||||||
@@ -65,4 +66,4 @@ public final class HoldBulkUtils
|
|||||||
throw new InvalidArgumentException(errorMsg + bulkOperation.operationType());
|
throw new InvalidArgumentException(errorMsg + bulkOperation.operationType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* #%L
|
|
||||||
* Alfresco Records Management Module
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
|
||||||
* %%
|
|
||||||
* This file is part of the Alfresco software.
|
|
||||||
* -
|
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
|
||||||
* provided under the following open source license terms:
|
|
||||||
* -
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
* -
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
* -
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.content.cleanser;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DoD 5220-22M Seven Pass data cleansing implementation.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ContentCleanserSevenPass extends ContentCleanser522022M
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void cleanse(File file)
|
|
||||||
{
|
|
||||||
super.cleanse(file);
|
|
||||||
overwrite(file, overwriteZeros);
|
|
||||||
overwrite(file, overwriteZeros);
|
|
||||||
overwrite(file, overwriteOnes);
|
|
||||||
overwrite(file, overwriteRandom);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -42,19 +42,18 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public interface HoldService
|
public interface HoldService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze reason.
|
* Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze
|
||||||
|
* reason.
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef hold node reference
|
||||||
* hold node reference
|
* @return boolean true if hold, false otherwise
|
||||||
* @return boolean true if hold, false otherwise
|
|
||||||
*/
|
*/
|
||||||
boolean isHold(NodeRef nodeRef);
|
boolean isHold(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of all the holds within the holds container in the given file plan
|
* Gets the list of all the holds within the holds container in the given file plan
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan The {@link NodeRef} of the file plan
|
||||||
* The {@link NodeRef} of the file plan
|
|
||||||
* @return List of hold node references
|
* @return List of hold node references
|
||||||
*/
|
*/
|
||||||
List<NodeRef> getHolds(NodeRef filePlan);
|
List<NodeRef> getHolds(NodeRef filePlan);
|
||||||
@@ -62,8 +61,7 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Gets the node reference for the hold with the given name in the given file plan
|
* Gets the node reference for the hold with the given name in the given file plan
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name {@link String} The name of the hold
|
||||||
* {@link String} The name of the hold
|
|
||||||
* @return {@link NodeRef} of the hold with the given name
|
* @return {@link NodeRef} of the hold with the given name
|
||||||
*/
|
*/
|
||||||
NodeRef getHold(NodeRef filePlan, String name);
|
NodeRef getHold(NodeRef filePlan, String name);
|
||||||
@@ -71,10 +69,9 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Gets the list of all the holds within the holds container for the given node reference
|
* Gets the list of all the holds within the holds container for the given node reference
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef The {@link NodeRef} of the record / record folder /active content
|
||||||
* The {@link NodeRef} of the record / record folder /active content
|
* @param includedInHold <code>true</code> to retrieve the list of hold node references which will include the node reference
|
||||||
* @param includedInHold
|
* <code>false</code> to get a list of node references which will not have the given node reference
|
||||||
* <code>true</code> to retrieve the list of hold node references which will include the node reference <code>false</code> to get a list of node references which will not have the given node reference
|
|
||||||
* @return List of hold node references
|
* @return List of hold node references
|
||||||
*/
|
*/
|
||||||
List<NodeRef> heldBy(NodeRef nodeRef, boolean includedInHold);
|
List<NodeRef> heldBy(NodeRef nodeRef, boolean includedInHold);
|
||||||
@@ -82,8 +79,7 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Gets the list of item node references which are in the given hold
|
* Gets the list of item node references which are in the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold {@link NodeRef} of the hold
|
||||||
* {@link NodeRef} of the hold
|
|
||||||
* @return Lost of item {@link NodeRef}s which are in the given hold
|
* @return Lost of item {@link NodeRef}s which are in the given hold
|
||||||
*/
|
*/
|
||||||
List<NodeRef> getHeld(NodeRef hold);
|
List<NodeRef> getHeld(NodeRef hold);
|
||||||
@@ -91,14 +87,10 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Creates a hold with the given name, reason and description for the given file plan
|
* Creates a hold with the given name, reason and description for the given file plan
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan The {@link NodeRef} of the file plan
|
||||||
* The {@link NodeRef} of the file plan
|
* @param name {@link String} The name of the hold
|
||||||
* @param name
|
* @param reason {@link String} The reason of the hold
|
||||||
* {@link String} The name of the hold
|
* @param description {@link String} The description of the hold
|
||||||
* @param reason
|
|
||||||
* {@link String} The reason of the hold
|
|
||||||
* @param description
|
|
||||||
* {@link String} The description of the hold
|
|
||||||
* @return The {@link NodeRef} of the created hold
|
* @return The {@link NodeRef} of the created hold
|
||||||
*/
|
*/
|
||||||
NodeRef createHold(NodeRef filePlan, String name, String reason, String description);
|
NodeRef createHold(NodeRef filePlan, String name, String reason, String description);
|
||||||
@@ -106,8 +98,7 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Gets the hold reason for the given hold node reference
|
* Gets the hold reason for the given hold node reference
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
|
||||||
* @return {@link String} The reason of the hold
|
* @return {@link String} The reason of the hold
|
||||||
*/
|
*/
|
||||||
String getHoldReason(NodeRef hold);
|
String getHoldReason(NodeRef hold);
|
||||||
@@ -115,138 +106,111 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Sets the hold reason
|
* Sets the hold reason
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
* @param reason {@link String} The reason for the hold
|
||||||
* @param reason
|
|
||||||
* {@link String} The reason for the hold
|
|
||||||
*/
|
*/
|
||||||
void setHoldReason(NodeRef hold, String reason);
|
void setHoldReason(NodeRef hold, String reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the reason for the hold deletion
|
* Sets the reason for the hold deletion
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
* @param reason {@link String} The reason for the hold
|
||||||
* @param reason
|
|
||||||
* {@link String} The reason for the hold
|
|
||||||
*/
|
*/
|
||||||
void setHoldDeletionReason(NodeRef hold, String reason);
|
void setHoldDeletionReason(NodeRef hold, String reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a hold with the given name, reason and description
|
* Updates a hold with the given name, reason and description
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
* @param name {@link String} The name of the hold
|
||||||
* @param name
|
* @param reason {@link String} The reason of the hold
|
||||||
* {@link String} The name of the hold
|
* @param description {@link String} The description of the hold
|
||||||
* @param reason
|
|
||||||
* {@link String} The reason of the hold
|
|
||||||
* @param description
|
|
||||||
* {@link String} The description of the hold
|
|
||||||
*/
|
*/
|
||||||
void updateHold(NodeRef hold, String name, String reason, String description);
|
void updateHold(NodeRef hold, String name, String reason, String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the hold
|
* Deletes the hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
|
||||||
*/
|
*/
|
||||||
void deleteHold(NodeRef hold);
|
void deleteHold(NodeRef hold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the item to the given hold
|
* Adds the item to the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
* @param nodeRef The {@link NodeRef} of the record / record folder / active content which will be added to the given hold
|
||||||
* @param nodeRef
|
|
||||||
* The {@link NodeRef} of the record / record folder / active content which will be added to the given hold
|
|
||||||
*/
|
*/
|
||||||
void addToHold(NodeRef hold, NodeRef nodeRef);
|
void addToHold(NodeRef hold, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the items to the the given hold
|
* Adds the items to the the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold to which the items will be added
|
||||||
* The {@link NodeRef} of the hold to which the items will be added
|
* @param nodeRefs The item {@link NodeRef}s which will be added to the hold
|
||||||
* @param nodeRefs
|
|
||||||
* The item {@link NodeRef}s which will be added to the hold
|
|
||||||
*/
|
*/
|
||||||
void addToHold(NodeRef hold, List<NodeRef> nodeRefs);
|
void addToHold(NodeRef hold, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the item to the given list of holds
|
* Adds the item to the given list of holds
|
||||||
*
|
*
|
||||||
* @param holds
|
* @param holds The list of {@link NodeRef}s of the holds
|
||||||
* The list of {@link NodeRef}s of the holds
|
* @param nodeRef The {@link NodeRef} of the record / record folder / active content which will be added to the given holds
|
||||||
* @param nodeRef
|
|
||||||
* The {@link NodeRef} of the record / record folder / active content which will be added to the given holds
|
|
||||||
*/
|
*/
|
||||||
void addToHolds(List<NodeRef> holds, NodeRef nodeRef);
|
void addToHolds(List<NodeRef> holds, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the given items to the given list of holds
|
* Adds the given items to the given list of holds
|
||||||
*
|
*
|
||||||
* @param holds
|
* @param holds List of holds to which the given items will be added
|
||||||
* List of holds to which the given items will be added
|
* @param nodeRefs The list of items which will be added to the given holds
|
||||||
* @param nodeRefs
|
|
||||||
* The list of items which will be added to the given holds
|
|
||||||
*/
|
*/
|
||||||
void addToHolds(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
void addToHolds(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the record from the given hold
|
* Removes the record from the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* The {@link NodeRef} of the hold
|
* @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given hold
|
||||||
* @param nodeRef
|
|
||||||
* The {@link NodeRef} of the record / record folder which will be removed from the given hold
|
|
||||||
*/
|
*/
|
||||||
void removeFromHold(NodeRef hold, NodeRef nodeRef);
|
void removeFromHold(NodeRef hold, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given items from the given hold
|
* Removes the given items from the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The hold {@link NodeRef} from which the given items will be removed
|
||||||
* The hold {@link NodeRef} from which the given items will be removed
|
* @param nodeRefs The list of items which will be removed from the given holds
|
||||||
* @param nodeRefs
|
|
||||||
* The list of items which will be removed from the given holds
|
|
||||||
*/
|
*/
|
||||||
void removeFromHold(NodeRef hold, List<NodeRef> nodeRefs);
|
void removeFromHold(NodeRef hold, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the item from the given list of hold
|
* Removes the item from the given list of hold
|
||||||
*
|
*
|
||||||
* @param holds
|
* @param holds The list {@link NodeRef}s of the holds
|
||||||
* The list {@link NodeRef}s of the holds
|
* @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given holds
|
||||||
* @param nodeRef
|
|
||||||
* The {@link NodeRef} of the record / record folder which will be removed from the given holds
|
|
||||||
*/
|
*/
|
||||||
void removeFromHolds(List<NodeRef> holds, NodeRef nodeRef);
|
void removeFromHolds(List<NodeRef> holds, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the items from the given holds
|
* Removes the items from the given holds
|
||||||
*
|
*
|
||||||
* @param holds
|
* @param holds List of hold {@link NodeRef}s from which the items will be removed
|
||||||
* List of hold {@link NodeRef}s from which the items will be removed
|
* @param nodeRefs List of item {@link NodeRef}s which will be removed from the given holds
|
||||||
* @param nodeRefs
|
|
||||||
* List of item {@link NodeRef}s which will be removed from the given holds
|
|
||||||
*/
|
*/
|
||||||
void removeFromHolds(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
void removeFromHolds(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given {@link NodeRef} from all the holds
|
* Removes the given {@link NodeRef} from all the holds
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef The {@link NodeRef} of item which will be removed from all the holds
|
||||||
* The {@link NodeRef} of item which will be removed from all the holds
|
|
||||||
*/
|
*/
|
||||||
void removeFromAllHolds(NodeRef nodeRef);
|
void removeFromAllHolds(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given list of {@link NodeRef}s from all the holds
|
* Removes the given list of {@link NodeRef}s from all the holds
|
||||||
*
|
*
|
||||||
* @param nodeRefs
|
* @param nodeRefs The list of item {@link NodeRef}s which will be removed from all the holds
|
||||||
* The list of item {@link NodeRef}s which will be removed from all the holds
|
|
||||||
*/
|
*/
|
||||||
void removeFromAllHolds(List<NodeRef> nodeRefs);
|
void removeFromAllHolds(List<NodeRef> nodeRefs);
|
||||||
}
|
}
|
||||||
@@ -43,12 +43,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.collections.ListUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||||
@@ -85,6 +79,11 @@ import org.alfresco.service.namespace.NamespaceService;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.collections.ListUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold service implementation
|
* Hold service implementation
|
||||||
@@ -94,9 +93,9 @@ import org.alfresco.util.ParameterCheck;
|
|||||||
*/
|
*/
|
||||||
@BehaviourBean
|
@BehaviourBean
|
||||||
public class HoldServiceImpl extends ServiceBaseImpl
|
public class HoldServiceImpl extends ServiceBaseImpl
|
||||||
implements HoldService,
|
implements HoldService,
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||||
RecordsManagementModel
|
RecordsManagementModel
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(HoldServiceImpl.class);
|
private static Log logger = LogFactory.getLog(HoldServiceImpl.class);
|
||||||
@@ -130,8 +129,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Set the file plan service
|
* Set the file plan service
|
||||||
*
|
*
|
||||||
* @param filePlanService
|
* @param filePlanService the file plan service
|
||||||
* the file plan service
|
|
||||||
*/
|
*/
|
||||||
public void setFilePlanService(FilePlanService filePlanService)
|
public void setFilePlanService(FilePlanService filePlanService)
|
||||||
{
|
{
|
||||||
@@ -141,8 +139,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Set the record service
|
* Set the record service
|
||||||
*
|
*
|
||||||
* @param recordService
|
* @param recordService the record service
|
||||||
* the record service
|
|
||||||
*/
|
*/
|
||||||
public void setRecordService(RecordService recordService)
|
public void setRecordService(RecordService recordService)
|
||||||
{
|
{
|
||||||
@@ -152,8 +149,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Set the record folder service
|
* Set the record folder service
|
||||||
*
|
*
|
||||||
* @param recordFolderService
|
* @param recordFolderService the record folder service
|
||||||
* the record folder service
|
|
||||||
*/
|
*/
|
||||||
public void setRecordFolderService(RecordFolderService recordFolderService)
|
public void setRecordFolderService(RecordFolderService recordFolderService)
|
||||||
{
|
{
|
||||||
@@ -163,17 +159,15 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Set the permission service
|
* Set the permission service
|
||||||
*
|
*
|
||||||
* @param permissionService
|
* @param permissionService the permission services
|
||||||
* the permission services
|
|
||||||
*/
|
*/
|
||||||
public void setPermissionService(PermissionService permissionService)
|
public void setPermissionService(PermissionService permissionService)
|
||||||
{
|
{
|
||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param capabilityService
|
* @param capabilityService capability service
|
||||||
* capability service
|
|
||||||
*/
|
*/
|
||||||
public void setCapabilityService(CapabilityService capabilityService)
|
public void setCapabilityService(CapabilityService capabilityService)
|
||||||
{
|
{
|
||||||
@@ -193,8 +187,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Sets the policy component instance
|
* Sets the policy component instance
|
||||||
*
|
*
|
||||||
* @param policyComponent
|
* @param policyComponent The policy component instance
|
||||||
* The policy component instance
|
|
||||||
*/
|
*/
|
||||||
public void setPolicyComponent(PolicyComponent policyComponent)
|
public void setPolicyComponent(PolicyComponent policyComponent)
|
||||||
{
|
{
|
||||||
@@ -235,7 +228,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
*
|
*
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@Behaviour(kind = BehaviourKind.CLASS, type = "rma:hold", notificationFrequency = NotificationFrequency.EVERY_EVENT)
|
@Behaviour(kind=BehaviourKind.CLASS, type="rma:hold", notificationFrequency=NotificationFrequency.EVERY_EVENT)
|
||||||
@Override
|
@Override
|
||||||
public void beforeDeleteNode(final NodeRef hold)
|
public void beforeDeleteNode(final NodeRef hold)
|
||||||
{
|
{
|
||||||
@@ -243,14 +236,15 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
{
|
{
|
||||||
checkPermissionsForDeleteHold(hold);
|
checkPermissionsForDeleteHold(hold);
|
||||||
|
|
||||||
RunAsWork<Void> work = new RunAsWork<Void>() {
|
RunAsWork<Void> work = new RunAsWork<Void>()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void doWork()
|
public Void doWork()
|
||||||
{
|
{
|
||||||
List<NodeRef> frozenNodes = getHeld(hold);
|
List<NodeRef> frozenNodes = getHeld(hold);
|
||||||
for (NodeRef frozenNode : frozenNodes)
|
for (NodeRef frozenNode : frozenNodes)
|
||||||
{
|
{
|
||||||
// set in transaction cache in order not to trigger update policy when removing the child association
|
//set in transaction cache in order not to trigger update policy when removing the child association
|
||||||
transactionalResourceHelper.getSet("frozen").add(frozenNode);
|
transactionalResourceHelper.getSet("frozen").add(frozenNode);
|
||||||
removeFreezeAspect(frozenNode, 1);
|
removeFreezeAspect(frozenNode, 1);
|
||||||
}
|
}
|
||||||
@@ -264,7 +258,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method removes the freeze aspect from the record and record folder if it is no longer in a hold.
|
* Helper method removes the freeze aspect from the record and record folder if it is no longer
|
||||||
|
* in a hold.
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef
|
||||||
*/
|
*/
|
||||||
@@ -276,7 +271,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
if (nodeService.hasAspect(nodeRef, ASPECT_FROZEN))
|
if (nodeService.hasAspect(nodeRef, ASPECT_FROZEN))
|
||||||
{
|
{
|
||||||
// remove the freeze aspect from the node
|
// remove the freeze aspect from the node
|
||||||
// set in transaction cache in order not to trigger update policy when removing the aspect
|
//set in transaction cache in order not to trigger update policy when removing the aspect
|
||||||
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
||||||
nodeService.removeAspect(nodeRef, ASPECT_FROZEN);
|
nodeService.removeAspect(nodeRef, ASPECT_FROZEN);
|
||||||
}
|
}
|
||||||
@@ -292,7 +287,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
if (recordsOtherHolds.size() == index)
|
if (recordsOtherHolds.size() == index)
|
||||||
{
|
{
|
||||||
// remove the freeze aspect from the node
|
// remove the freeze aspect from the node
|
||||||
// set in transaction cache in order not to trigger update policy when removing the aspect
|
//set in transaction cache in order not to trigger update policy when removing the aspect
|
||||||
transactionalResourceHelper.getSet("frozen").add(record);
|
transactionalResourceHelper.getSet("frozen").add(record);
|
||||||
nodeService.removeAspect(record, ASPECT_FROZEN);
|
nodeService.removeAspect(record, ASPECT_FROZEN);
|
||||||
}
|
}
|
||||||
@@ -364,7 +359,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
if (!CollectionUtils.isEmpty(filePlans))
|
if (!CollectionUtils.isEmpty(filePlans))
|
||||||
{
|
{
|
||||||
final List<NodeRef> holdsNotIncludingNodeRef = new ArrayList<>();
|
final List<NodeRef> holdsNotIncludingNodeRef = new ArrayList<>();
|
||||||
filePlans.forEach(filePlan -> {
|
filePlans.forEach(filePlan ->
|
||||||
|
{
|
||||||
// invert list to get list of holds that do not contain this node
|
// invert list to get list of holds that do not contain this node
|
||||||
final List<NodeRef> allHolds = getHolds(filePlan);
|
final List<NodeRef> allHolds = getHolds(filePlan);
|
||||||
holdsNotIncludingNodeRef.addAll(ListUtils.subtract(allHolds, new ArrayList<>(holdsIncludingNodeRef)));
|
holdsNotIncludingNodeRef.addAll(ListUtils.subtract(allHolds, new ArrayList<>(holdsIncludingNodeRef)));
|
||||||
@@ -383,8 +379,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Helper method to get holds that are direct parents of the given node.
|
* Helper method to get holds that are direct parents of the given node.
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
* @return Set<{@link NodeRef}> set of parent holds
|
* @return Set<{@link NodeRef}> set of parent holds
|
||||||
*/
|
*/
|
||||||
private Set<NodeRef> getParentHolds(NodeRef nodeRef)
|
private Set<NodeRef> getParentHolds(NodeRef nodeRef)
|
||||||
@@ -497,7 +492,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
if (nodeService.exists(hold) && isHold(hold))
|
if (nodeService.exists(hold) && isHold(hold))
|
||||||
{
|
{
|
||||||
// get the reason
|
// get the reason
|
||||||
reason = (String) nodeService.getProperty(hold, PROP_HOLD_REASON);
|
reason = (String)nodeService.getProperty(hold, PROP_HOLD_REASON);
|
||||||
}
|
}
|
||||||
|
|
||||||
return reason;
|
return reason;
|
||||||
@@ -578,8 +573,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Helper method to check if user has correct permissions to delete hold
|
* Helper method to check if user has correct permissions to delete hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold hold to be deleted
|
||||||
* hold to be deleted
|
|
||||||
*/
|
*/
|
||||||
private void checkPermissionsForDeleteHold(NodeRef hold)
|
private void checkPermissionsForDeleteHold(NodeRef hold)
|
||||||
{
|
{
|
||||||
@@ -598,7 +592,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permission = PermissionService.READ;
|
permission = PermissionService.READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permissionService.hasPermission(nodeRef, permission) == AccessStatus.DENIED)
|
if (permissionService.hasPermission(nodeRef, permission) == AccessStatus.DENIED)
|
||||||
@@ -675,7 +669,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!AccessStatus.ALLOWED.equals(
|
if (!AccessStatus.ALLOWED.equals(
|
||||||
capabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD)))
|
capabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD)))
|
||||||
{
|
{
|
||||||
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED));
|
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED));
|
||||||
}
|
}
|
||||||
@@ -686,7 +680,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
// fire before add to hold policy
|
// fire before add to hold policy
|
||||||
invokeBeforeAddToHold(hold, nodeRef);
|
invokeBeforeAddToHold(hold, nodeRef);
|
||||||
// run as system to ensure we have all the appropriate permissions to perform the manipulations we require
|
// run as system to ensure we have all the appropriate permissions to perform the manipulations we require
|
||||||
authenticationUtil.runAsSystem((RunAsWork<Void>) () -> {
|
authenticationUtil.runAsSystem((RunAsWork<Void>) () ->
|
||||||
|
{
|
||||||
// gather freeze properties
|
// gather freeze properties
|
||||||
final Map<QName, Serializable> props = new HashMap<>(2);
|
final Map<QName, Serializable> props = new HashMap<>(2);
|
||||||
props.put(PROP_FROZEN_AT, new Date());
|
props.put(PROP_FROZEN_AT, new Date());
|
||||||
@@ -695,7 +690,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
addFrozenAspect(nodeRef, props);
|
addFrozenAspect(nodeRef, props);
|
||||||
|
|
||||||
// Link the record to the hold
|
// Link the record to the hold
|
||||||
// set in transaction cache in order not to trigger update policy when adding the association
|
//set in transaction cache in order not to trigger update policy when adding the association
|
||||||
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
||||||
nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT);
|
nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT);
|
||||||
// get the documents primary parent assoc
|
// get the documents primary parent assoc
|
||||||
@@ -721,8 +716,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Check if the given node is eligible to be added into a hold
|
* Check if the given node is eligible to be added into a hold
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef the node to be checked
|
||||||
* the node to be checked
|
|
||||||
*/
|
*/
|
||||||
private void checkNodeCanBeAddedToHold(NodeRef nodeRef)
|
private void checkNodeCanBeAddedToHold(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -754,16 +748,14 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Add Frozen aspect only if node isn't already frozen
|
* Add Frozen aspect only if node isn't already frozen
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node on which aspect will be added
|
||||||
* node on which aspect will be added
|
* @param props aspect properties map
|
||||||
* @param props
|
|
||||||
* aspect properties map
|
|
||||||
*/
|
*/
|
||||||
private void addFrozenAspect(NodeRef nodeRef, Map<QName, Serializable> props)
|
private void addFrozenAspect(NodeRef nodeRef, Map<QName, Serializable> props)
|
||||||
{
|
{
|
||||||
if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN))
|
if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN))
|
||||||
{
|
{
|
||||||
// set in transaction cache in order not to trigger update policy when adding the aspect
|
//set in transaction cache in order not to trigger update policy when adding the aspect
|
||||||
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
||||||
// add freeze aspect
|
// add freeze aspect
|
||||||
nodeService.addAspect(nodeRef, ASPECT_FROZEN, props);
|
nodeService.addAspect(nodeRef, ASPECT_FROZEN, props);
|
||||||
@@ -853,9 +845,10 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
invokeBeforeRemoveFromHold(hold, nodeRef);
|
invokeBeforeRemoveFromHold(hold, nodeRef);
|
||||||
// run as system so we don't run into further permission issues
|
// run as system so we don't run into further permission issues
|
||||||
// we already know we have to have the correct capability to get here
|
// we already know we have to have the correct capability to get here
|
||||||
authenticationUtil.runAsSystem((RunAsWork<Void>) () -> {
|
authenticationUtil.runAsSystem((RunAsWork<Void>) () ->
|
||||||
|
{
|
||||||
// remove from hold
|
// remove from hold
|
||||||
// set in transaction cache in order not to trigger update policy when removing the child association
|
//set in transaction cache in order not to trigger update policy when removing the child association
|
||||||
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
transactionalResourceHelper.getSet("frozen").add(nodeRef);
|
||||||
nodeService.removeChild(hold, nodeRef);
|
nodeService.removeChild(hold, nodeRef);
|
||||||
|
|
||||||
@@ -866,7 +859,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// run as system as we can't be sure if have remove aspect rights on node
|
// run as system as we can't be sure if have remove aspect rights on node
|
||||||
authenticationUtil.runAsSystem((RunAsWork<Void>) () -> {
|
authenticationUtil.runAsSystem((RunAsWork<Void>) () ->
|
||||||
|
{
|
||||||
removeFreezeAspect(nodeRef, 0);
|
removeFreezeAspect(nodeRef, 0);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
@@ -927,12 +921,9 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke beforeCreateHold policy
|
* Invoke beforeCreateHold policy
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
* @param name hold name
|
||||||
* @param name
|
* @param reason hold reason
|
||||||
* hold name
|
|
||||||
* @param reason
|
|
||||||
* hold reason
|
|
||||||
*/
|
*/
|
||||||
protected void invokeBeforeCreateHold(NodeRef nodeRef, String name, String reason)
|
protected void invokeBeforeCreateHold(NodeRef nodeRef, String name, String reason)
|
||||||
{
|
{
|
||||||
@@ -944,8 +935,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke onCreateHold policy
|
* Invoke onCreateHold policy
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
protected void invokeOnCreateHold(NodeRef nodeRef)
|
protected void invokeOnCreateHold(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -956,8 +946,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke beforeDeleteHold policy
|
* Invoke beforeDeleteHold policy
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
protected void invokeBeforeDeleteHold(NodeRef nodeRef)
|
protected void invokeBeforeDeleteHold(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -968,10 +957,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke onDeleteHold policy
|
* Invoke onDeleteHold policy
|
||||||
*
|
*
|
||||||
* @param holdName
|
* @param holdName name of the hold
|
||||||
* name of the hold
|
* @param classQNames hold types and aspects
|
||||||
* @param classQNames
|
|
||||||
* hold types and aspects
|
|
||||||
*/
|
*/
|
||||||
protected void invokeOnDeleteHold(String holdName, Set<QName> classQNames)
|
protected void invokeOnDeleteHold(String holdName, Set<QName> classQNames)
|
||||||
{
|
{
|
||||||
@@ -984,10 +971,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke beforeAddToHold policy
|
* Invoke beforeAddToHold policy
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold hold node reference
|
||||||
* hold node reference
|
* @param contentNodeRef content node reference
|
||||||
* @param contentNodeRef
|
|
||||||
* content node reference
|
|
||||||
*/
|
*/
|
||||||
protected void invokeBeforeAddToHold(NodeRef hold, NodeRef contentNodeRef)
|
protected void invokeBeforeAddToHold(NodeRef hold, NodeRef contentNodeRef)
|
||||||
{
|
{
|
||||||
@@ -998,10 +983,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke onAddToHold policy
|
* Invoke onAddToHold policy
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold hold node reference
|
||||||
* hold node reference
|
* @param contentNodeRef content node reference
|
||||||
* @param contentNodeRef
|
|
||||||
* content node reference
|
|
||||||
*/
|
*/
|
||||||
protected void invokeOnAddToHold(NodeRef hold, NodeRef contentNodeRef)
|
protected void invokeOnAddToHold(NodeRef hold, NodeRef contentNodeRef)
|
||||||
{
|
{
|
||||||
@@ -1012,10 +995,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke beforeRemoveFromHold policy
|
* Invoke beforeRemoveFromHold policy
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold hold node reference
|
||||||
* hold node reference
|
* @param contentNodeRef content node reference
|
||||||
* @param contentNodeRef
|
|
||||||
* content node reference
|
|
||||||
*/
|
*/
|
||||||
protected void invokeBeforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef)
|
protected void invokeBeforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef)
|
||||||
{
|
{
|
||||||
@@ -1026,10 +1007,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Invoke onRemoveFromHold policy
|
* Invoke onRemoveFromHold policy
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold hold node reference
|
||||||
* hold node reference
|
* @param contentNodeRef content node reference
|
||||||
* @param contentNodeRef
|
|
||||||
* content node reference
|
|
||||||
*/
|
*/
|
||||||
protected void invokeOnRemoveFromHold(NodeRef hold, NodeRef contentNodeRef)
|
protected void invokeOnRemoveFromHold(NodeRef hold, NodeRef contentNodeRef)
|
||||||
{
|
{
|
||||||
@@ -1037,4 +1016,4 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
policy.onRemoveFromHold(hold, contentNodeRef);
|
policy.onRemoveFromHold(hold, contentNodeRef);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,14 +45,11 @@ public interface HoldServicePolicies
|
|||||||
interface BeforeCreateHoldPolicy extends ClassPolicy
|
interface BeforeCreateHoldPolicy extends ClassPolicy
|
||||||
{
|
{
|
||||||
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateHold");
|
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateHold");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a hold is created.
|
* Called before a hold is created.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name name of the hold to be created
|
||||||
* name of the hold to be created
|
* @param reason reason for the hold to be created
|
||||||
* @param reason
|
|
||||||
* reason for the hold to be created
|
|
||||||
*/
|
*/
|
||||||
void beforeCreateHold(String name, String reason);
|
void beforeCreateHold(String name, String reason);
|
||||||
}
|
}
|
||||||
@@ -60,12 +57,10 @@ public interface HoldServicePolicies
|
|||||||
interface OnCreateHoldPolicy extends ClassPolicy
|
interface OnCreateHoldPolicy extends ClassPolicy
|
||||||
{
|
{
|
||||||
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateHold");
|
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateHold");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a hold is created.
|
* Called when a hold is created.
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
void onCreateHold(NodeRef hold);
|
void onCreateHold(NodeRef hold);
|
||||||
}
|
}
|
||||||
@@ -73,12 +68,10 @@ public interface HoldServicePolicies
|
|||||||
interface BeforeDeleteHoldPolicy extends ClassPolicy
|
interface BeforeDeleteHoldPolicy extends ClassPolicy
|
||||||
{
|
{
|
||||||
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteHold");
|
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteHold");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a hold is deleted.
|
* Called before a hold is deleted.
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
void beforeDeleteHold(NodeRef hold);
|
void beforeDeleteHold(NodeRef hold);
|
||||||
}
|
}
|
||||||
@@ -90,8 +83,7 @@ public interface HoldServicePolicies
|
|||||||
/**
|
/**
|
||||||
* Called when a hold is deleted.
|
* Called when a hold is deleted.
|
||||||
*
|
*
|
||||||
* @param holdname
|
* @param holdname name of the deleted hold
|
||||||
* name of the deleted hold
|
|
||||||
*/
|
*/
|
||||||
void onDeleteHold(String holdname);
|
void onDeleteHold(String holdname);
|
||||||
}
|
}
|
||||||
@@ -103,10 +95,8 @@ public interface HoldServicePolicies
|
|||||||
/**
|
/**
|
||||||
* Called before adding content to hold.
|
* Called before adding content to hold.
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold the hold to be added into
|
||||||
* the hold to be added into
|
* @param contentNodeRef the item to be added to hold
|
||||||
* @param contentNodeRef
|
|
||||||
* the item to be added to hold
|
|
||||||
*/
|
*/
|
||||||
void beforeAddToHold(NodeRef hold, NodeRef contentNodeRef);
|
void beforeAddToHold(NodeRef hold, NodeRef contentNodeRef);
|
||||||
}
|
}
|
||||||
@@ -118,10 +108,8 @@ public interface HoldServicePolicies
|
|||||||
/**
|
/**
|
||||||
* Called when content is added to hold.
|
* Called when content is added to hold.
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold the hold to be added into
|
||||||
* the hold to be added into
|
* @param contentNodeRef the item to be added to hold
|
||||||
* @param contentNodeRef
|
|
||||||
* the item to be added to hold
|
|
||||||
*/
|
*/
|
||||||
void onAddToHold(NodeRef hold, NodeRef contentNodeRef);
|
void onAddToHold(NodeRef hold, NodeRef contentNodeRef);
|
||||||
}
|
}
|
||||||
@@ -133,10 +121,8 @@ public interface HoldServicePolicies
|
|||||||
/**
|
/**
|
||||||
* Called before removing content from hold.
|
* Called before removing content from hold.
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold the hold to be removed from
|
||||||
* the hold to be removed from
|
* @param contentNodeRef the item to be removed from hold
|
||||||
* @param contentNodeRef
|
|
||||||
* the item to be removed from hold
|
|
||||||
*/
|
*/
|
||||||
void beforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef);
|
void beforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef);
|
||||||
}
|
}
|
||||||
@@ -148,12 +134,10 @@ public interface HoldServicePolicies
|
|||||||
/**
|
/**
|
||||||
* Called when removing content from hold.
|
* Called when removing content from hold.
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold the hold to be removed from
|
||||||
* the hold to be removed from
|
* @param contentNodeRef the item to be removed from hold
|
||||||
* @param contentNodeRef
|
|
||||||
* the item to be removed from hold
|
|
||||||
*/
|
*/
|
||||||
void onRemoveFromHold(NodeRef hold, NodeRef contentNodeRef);
|
void onRemoveFromHold(NodeRef hold, NodeRef contentNodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,9 +36,9 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
|
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -50,8 +50,10 @@ import org.alfresco.service.cmr.search.SearchParameters;
|
|||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Disposition Lifecycle Job Finds all disposition action nodes which are for disposition actions specified Where asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records.
|
* The Disposition Lifecycle Job Finds all disposition action nodes which are for disposition actions specified Where
|
||||||
|
* asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records.
|
||||||
*
|
*
|
||||||
* @author mrogers
|
* @author mrogers
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
@@ -86,8 +88,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
private FreezeService freezeService;
|
private FreezeService freezeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param freezeService
|
* @param freezeService freeze service
|
||||||
* freeze service
|
|
||||||
*/
|
*/
|
||||||
public void setFreezeService(FreezeService freezeService)
|
public void setFreezeService(FreezeService freezeService)
|
||||||
{
|
{
|
||||||
@@ -97,8 +98,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
/**
|
/**
|
||||||
* List of disposition actions to automatically execute when eligible.
|
* List of disposition actions to automatically execute when eligible.
|
||||||
*
|
*
|
||||||
* @param dispositionActions
|
* @param dispositionActions disposition actions
|
||||||
* disposition actions
|
|
||||||
*/
|
*/
|
||||||
public void setDispositionActions(List<String> dispositionActions)
|
public void setDispositionActions(List<String> dispositionActions)
|
||||||
{
|
{
|
||||||
@@ -111,8 +111,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordsManagementActionService
|
* @param recordsManagementActionService records management action service
|
||||||
* records management action service
|
|
||||||
*/
|
*/
|
||||||
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService)
|
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService)
|
||||||
{
|
{
|
||||||
@@ -120,8 +119,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService
|
* @param nodeService node service
|
||||||
* node service
|
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
@@ -129,8 +127,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param searchService
|
* @param searchService search service
|
||||||
* search service
|
|
||||||
*/
|
*/
|
||||||
public void setSearchService(SearchService searchService)
|
public void setSearchService(SearchService searchService)
|
||||||
{
|
{
|
||||||
@@ -218,10 +215,13 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
|
|
||||||
// execute search
|
// execute search
|
||||||
ResultSet results = searchService.query(params);
|
ResultSet results = searchService.query(params);
|
||||||
if (results != null)
|
if(results != null)
|
||||||
{
|
{
|
||||||
// filtering out the hold/freezed cases from the result set
|
// filtering out the hold/freezed cases from the result set
|
||||||
resultNodes = results.getNodeRefs().stream().filter(node -> nodeService.getPrimaryParent(node) == null ? !freezeService.isFrozenOrHasFrozenChildren(node) : !freezeService.isFrozenOrHasFrozenChildren(nodeService.getPrimaryParent(node).getParentRef())).collect(Collectors.toList());
|
resultNodes =
|
||||||
|
results.getNodeRefs().stream().filter(node -> nodeService.getPrimaryParent(node) == null ?
|
||||||
|
!freezeService.isFrozenOrHasFrozenChildren(node) :
|
||||||
|
!freezeService.isFrozenOrHasFrozenChildren(nodeService.getPrimaryParent(node).getParentRef())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
hasMore = results.hasMore();
|
hasMore = results.hasMore();
|
||||||
skipCount += resultNodes.size(); // increase by page size
|
skipCount += resultNodes.size(); // increase by page size
|
||||||
@@ -246,8 +246,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
/**
|
/**
|
||||||
* Helper method that executes a disposition action
|
* Helper method that executes a disposition action
|
||||||
*
|
*
|
||||||
* @param actionNodes
|
* @param actionNodes - the disposition actions to execute
|
||||||
* - the disposition actions to execute
|
|
||||||
*/
|
*/
|
||||||
private void executeAction(final List<NodeRef> actionNodes)
|
private void executeAction(final List<NodeRef> actionNodes)
|
||||||
{
|
{
|
||||||
@@ -278,7 +277,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
{
|
{
|
||||||
// execute disposition action
|
// execute disposition action
|
||||||
recordsManagementActionService
|
recordsManagementActionService
|
||||||
.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
|
.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
|
||||||
|
|
||||||
log.debug("Processed action: " + dispAction + "on" + parent);
|
log.debug("Processed action: " + dispAction + "on" + parent);
|
||||||
|
|
||||||
@@ -303,4 +302,4 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
{
|
{
|
||||||
this.personService = personService;
|
this.personService = personService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,9 +30,6 @@ package org.alfresco.module.org_alfresco_module_rm.job;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor;
|
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry;
|
import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry;
|
||||||
@@ -45,9 +42,12 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.cmr.search.QueryConsistency;
|
||||||
import org.alfresco.service.cmr.search.ResultSet;
|
import org.alfresco.service.cmr.search.ResultSet;
|
||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job to publish any pending updates on marked node references.
|
* Job to publish any pending updates on marked node references.
|
||||||
@@ -75,8 +75,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
private BehaviourFilter behaviourFilter;
|
private BehaviourFilter behaviourFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService
|
* @param nodeService node service
|
||||||
* node service
|
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
@@ -84,8 +83,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param searchService
|
* @param searchService search service
|
||||||
* search service
|
|
||||||
*/
|
*/
|
||||||
public void setSearchService(SearchService searchService)
|
public void setSearchService(SearchService searchService)
|
||||||
{
|
{
|
||||||
@@ -93,8 +91,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param publishExecutorRegistry
|
* @param publishExecutorRegistry public executor registry
|
||||||
* public executor registry
|
|
||||||
*/
|
*/
|
||||||
public void setPublishExecutorRegistry(PublishExecutorRegistry publishExecutorRegistry)
|
public void setPublishExecutorRegistry(PublishExecutorRegistry publishExecutorRegistry)
|
||||||
{
|
{
|
||||||
@@ -102,8 +99,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param behaviourFilter
|
* @param behaviourFilter behaviour filter
|
||||||
* behaviour filter
|
|
||||||
*/
|
*/
|
||||||
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
||||||
{
|
{
|
||||||
@@ -111,8 +107,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dictionaryService
|
* @param dictionaryService dictionary service
|
||||||
* dictionary service
|
|
||||||
*/
|
*/
|
||||||
public void setDictionaryService(DictionaryService dictionaryService)
|
public void setDictionaryService(DictionaryService dictionaryService)
|
||||||
{
|
{
|
||||||
@@ -129,7 +124,8 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
logger.debug("Job Starting");
|
logger.debug("Job Starting");
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Object>() {
|
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||||
|
{
|
||||||
public Object doWork()
|
public Object doWork()
|
||||||
{
|
{
|
||||||
if (rmLoaded())
|
if (rmLoaded())
|
||||||
@@ -142,7 +138,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
{
|
{
|
||||||
if (nodeService.exists(nodeRef))
|
if (nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
boolean publishing = ((Boolean) nodeService.getProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS)).booleanValue();
|
boolean publishing = ((Boolean)nodeService.getProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS)).booleanValue();
|
||||||
if (!publishing)
|
if (!publishing)
|
||||||
{
|
{
|
||||||
// Mark the update node as publishing in progress
|
// Mark the update node as publishing in progress
|
||||||
@@ -160,6 +156,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
// Publish updates
|
// Publish updates
|
||||||
publishUpdates(nodeRef);
|
publishUpdates(nodeRef);
|
||||||
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
Date end = new Date();
|
Date end = new Date();
|
||||||
@@ -192,7 +189,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
/**
|
/**
|
||||||
* Helper method to determine whether the RM content model has been loaded yet.
|
* Helper method to determine whether the RM content model has been loaded yet.
|
||||||
*
|
*
|
||||||
* @return boolean true if RM content model loaded, false otherwise
|
* @return boolean true if RM content model loaded, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean rmLoaded()
|
private boolean rmLoaded()
|
||||||
{
|
{
|
||||||
@@ -200,7 +197,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
|
|
||||||
// ensure that the rm content model has been loaded
|
// ensure that the rm content model has been loaded
|
||||||
if (dictionaryService != null &&
|
if (dictionaryService != null &&
|
||||||
dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null)
|
dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
@@ -210,36 +207,37 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of the nodes with updates pending publish
|
* Get a list of the nodes with updates pending publish
|
||||||
*
|
* @return List<NodeRef> list of node refences with updates pending publication
|
||||||
* @return List<NodeRef> list of node refences with updates pending publication
|
|
||||||
*/
|
*/
|
||||||
private List<NodeRef> getUpdatedNodes()
|
private List<NodeRef> getUpdatedNodes()
|
||||||
{
|
{
|
||||||
RetryingTransactionCallback<List<NodeRef>> execution = new RetryingTransactionHelper.RetryingTransactionCallback<List<NodeRef>>() {
|
RetryingTransactionCallback<List<NodeRef>> execution =
|
||||||
@Override
|
new RetryingTransactionHelper.RetryingTransactionCallback<List<NodeRef>>()
|
||||||
public List<NodeRef> execute()
|
|
||||||
{
|
{
|
||||||
// Build the query string
|
@Override
|
||||||
StringBuilder sb = new StringBuilder();
|
public List<NodeRef> execute()
|
||||||
sb.append("ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\"");
|
|
||||||
String query = sb.toString();
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
{
|
||||||
logger.debug("Executing query " + query);
|
// Build the query string
|
||||||
}
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\"");
|
||||||
|
String query = sb.toString();
|
||||||
|
|
||||||
// Execute query to find updates awaiting publishing
|
if (logger.isDebugEnabled())
|
||||||
List<NodeRef> resultNodes = null;
|
{
|
||||||
|
logger.debug("Executing query " + query);
|
||||||
|
}
|
||||||
|
|
||||||
SearchParameters searchParameters = new SearchParameters();
|
// Execute query to find updates awaiting publishing
|
||||||
searchParameters.setQuery(query);
|
List<NodeRef> resultNodes = null;
|
||||||
searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
|
||||||
searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
|
||||||
|
|
||||||
try
|
SearchParameters searchParameters = new SearchParameters();
|
||||||
{
|
searchParameters.setQuery(query);
|
||||||
ResultSet results = searchService.query(searchParameters);
|
searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
|
searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ResultSet results = searchService.query(searchParameters);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resultNodes = results.getNodeRefs();
|
resultNodes = results.getNodeRefs();
|
||||||
@@ -248,169 +246,170 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
|
|||||||
{
|
{
|
||||||
results.close();
|
results.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AlfrescoRuntimeException exception)
|
catch (AlfrescoRuntimeException exception)
|
||||||
{
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Error executing query, " + exception.getMessage());
|
||||||
|
}
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Error executing query, " + exception.getMessage());
|
logger.debug("Found " + resultNodes.size() + " disposition action definitions updates awaiting publishing.");
|
||||||
}
|
}
|
||||||
throw exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
return resultNodes;
|
||||||
{
|
|
||||||
logger.debug("Found " + resultNodes.size() + " disposition action definitions updates awaiting publishing.");
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
return resultNodes;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return retryingTransactionHelper.doInTransaction(execution, true);
|
return retryingTransactionHelper.doInTransaction(execution, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the node as publish in progress. This is often used as a marker to prevent any further updates to a node.
|
* Mark the node as publish in progress. This is often used as a marker to prevent any further updates
|
||||||
*
|
* to a node.
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
private void markPublishInProgress(final NodeRef nodeRef)
|
private void markPublishInProgress(final NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution = new RetryingTransactionHelper.RetryingTransactionCallback<Void>() {
|
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
|
||||||
@Override
|
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||||
public Void execute()
|
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
@Override
|
||||||
|
public Void execute()
|
||||||
{
|
{
|
||||||
logger.debug("Marking updated node as publish in progress. (node=" + nodeRef.toString() + ")");
|
if (logger.isDebugEnabled())
|
||||||
}
|
|
||||||
|
|
||||||
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (nodeService.exists(nodeRef))
|
|
||||||
{
|
{
|
||||||
// Mark the node as publish in progress
|
logger.debug("Marking updated node as publish in progress. (node=" + nodeRef.toString() + ")");
|
||||||
nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (nodeService.exists(nodeRef))
|
||||||
|
{
|
||||||
|
// Mark the node as publish in progress
|
||||||
|
nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
};
|
||||||
{
|
|
||||||
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
retryingTransactionHelper.doInTransaction(execution);
|
retryingTransactionHelper.doInTransaction(execution);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish the updates made to the node.
|
* Publish the updates made to the node.
|
||||||
*
|
* @param nodeRef node reference
|
||||||
* @param nodeRef
|
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
private void publishUpdates(final NodeRef nodeRef)
|
private void publishUpdates(final NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution = new RetryingTransactionHelper.RetryingTransactionCallback<Void>() {
|
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
|
||||||
@Override
|
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||||
public Void execute()
|
|
||||||
{
|
{
|
||||||
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
@Override
|
||||||
try
|
public Void execute()
|
||||||
{
|
{
|
||||||
// Get the update to value for the node
|
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
||||||
String updateTo = (String) nodeService.getProperty(nodeRef, PROP_UPDATE_TO);
|
try
|
||||||
|
|
||||||
if (updateTo != null)
|
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
// Get the update to value for the node
|
||||||
{
|
String updateTo = (String)nodeService.getProperty(nodeRef, PROP_UPDATE_TO);
|
||||||
logger.debug("Node update to " + updateTo + " (noderef=" + nodeRef.toString() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the publish executor
|
if (updateTo != null)
|
||||||
PublishExecutor executor = publishExecutorRegistry.get(updateTo);
|
|
||||||
if (executor == null)
|
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")");
|
logger.debug("Node update to " + updateTo + " (noderef=" + nodeRef.toString() + ")");
|
||||||
}
|
}
|
||||||
throw new AlfrescoRuntimeException("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")");
|
|
||||||
|
// Get the publish executor
|
||||||
|
PublishExecutor executor = publishExecutorRegistry.get(updateTo);
|
||||||
|
if (executor == null)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")");
|
||||||
|
}
|
||||||
|
throw new AlfrescoRuntimeException("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Attempting to publish updates. (nodeRef=" + nodeRef.toString() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Publish
|
||||||
|
executor.publish(nodeRef);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Unable to publish, because publish executor is not set.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the unpublished update aspect
|
||||||
|
nodeService.removeAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Attempting to publish updates. (nodeRef=" + nodeRef.toString() + ")");
|
logger.debug("Publish updates complete. (nodeRef=" + nodeRef.toString() + ")");
|
||||||
}
|
|
||||||
|
|
||||||
// Publish
|
|
||||||
executor.publish(nodeRef);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("Unable to publish, because publish executor is not set.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
// Remove the unpublished update aspect
|
|
||||||
nodeService.removeAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE);
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
{
|
||||||
logger.debug("Publish updates complete. (nodeRef=" + nodeRef.toString() + ")");
|
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
retryingTransactionHelper.doInTransaction(execution);
|
retryingTransactionHelper.doInTransaction(execution);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmark node as publish in progress, assuming publish failed.
|
* Unmark node as publish in progress, assuming publish failed.
|
||||||
*
|
* @param nodeRef node reference
|
||||||
* @param nodeRef
|
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
private void unmarkPublishInProgress(final NodeRef nodeRef)
|
private void unmarkPublishInProgress(final NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution = new RetryingTransactionHelper.RetryingTransactionCallback<Void>() {
|
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
|
||||||
@Override
|
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||||
public Void execute()
|
|
||||||
{
|
{
|
||||||
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
@Override
|
||||||
try
|
public Void execute()
|
||||||
{
|
{
|
||||||
// Assuming the node still has unpublished information, then unmark it in progress
|
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
||||||
if (nodeService.exists(nodeRef) &&
|
try
|
||||||
nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE))
|
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
// Assuming the node still has unpublished information, then unmark it in progress
|
||||||
|
if (nodeService.exists(nodeRef) &&
|
||||||
|
nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE))
|
||||||
{
|
{
|
||||||
logger.debug("Removing publish in progress marker from updated node, because update was not successful. (node=" + nodeRef.toString() + ")");
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Removing publish in progress marker from updated node, because update was not successful. (node=" + nodeRef.toString() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, false);
|
|
||||||
}
|
}
|
||||||
}
|
finally
|
||||||
finally
|
{
|
||||||
{
|
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
||||||
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
retryingTransactionHelper.doInTransaction(execution);
|
retryingTransactionHelper.doInTransaction(execution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,12 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.job;
|
|||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.quartz.Job;
|
|
||||||
import org.quartz.JobExecutionContext;
|
|
||||||
import org.quartz.JobExecutionException;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.repo.lock.JobLockService;
|
import org.alfresco.repo.lock.JobLockService;
|
||||||
import org.alfresco.repo.lock.JobLockService.JobLockRefreshCallback;
|
import org.alfresco.repo.lock.JobLockService.JobLockRefreshCallback;
|
||||||
@@ -43,6 +37,11 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base records management job implementation.
|
* Base records management job implementation.
|
||||||
@@ -113,29 +112,20 @@ public class RecordsManagementJob implements Job
|
|||||||
|
|
||||||
// get the job lock service
|
// get the job lock service
|
||||||
jobLockService = (JobLockService) context.getJobDetail().getJobDataMap().get("jobLockService");
|
jobLockService = (JobLockService) context.getJobDetail().getJobDataMap().get("jobLockService");
|
||||||
if (jobLockService == null)
|
if (jobLockService == null) { throw new AlfrescoRuntimeException("Job lock service has not been specified."); }
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Job lock service has not been specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the job executer
|
// get the job executer
|
||||||
jobExecuter = (RecordsManagementJobExecuter) context.getJobDetail().getJobDataMap().get("jobExecuter");
|
jobExecuter = (RecordsManagementJobExecuter) context.getJobDetail().getJobDataMap().get("jobExecuter");
|
||||||
if (jobExecuter == null)
|
if (jobExecuter == null) { throw new AlfrescoRuntimeException("Job executer has not been specified."); }
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Job executer has not been specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the job name
|
// get the job name
|
||||||
jobName = (String) context.getJobDetail().getJobDataMap().get("jobName");
|
jobName = (String) context.getJobDetail().getJobDataMap().get("jobName");
|
||||||
|
|
||||||
if (jobName == null)
|
if (jobName == null) { throw new AlfrescoRuntimeException("Job name has not been specified."); }
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Job name has not been specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jobName.compareTo("dispositionLifecycle") == 0)
|
if (jobName.compareTo("dispositionLifecycle") == 0)
|
||||||
{
|
{
|
||||||
// RM-3293 - set user for audit
|
//RM-3293 - set user for audit
|
||||||
if (jobExecuter instanceof DispositionLifecycleJobExecuter)
|
if (jobExecuter instanceof DispositionLifecycleJobExecuter)
|
||||||
{
|
{
|
||||||
String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs");
|
String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs");
|
||||||
@@ -160,7 +150,8 @@ public class RecordsManagementJob implements Job
|
|||||||
|
|
||||||
final LockCallback lockCallback = new LockCallback();
|
final LockCallback lockCallback = new LockCallback();
|
||||||
|
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Void>() {
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
public Void doWork()
|
public Void doWork()
|
||||||
{
|
{
|
||||||
// try and get the lock
|
// try and get the lock
|
||||||
@@ -186,7 +177,7 @@ public class RecordsManagementJob implements Job
|
|||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "("
|
logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "("
|
||||||
+ e.getMessage() + ")");
|
+ e.getMessage() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,4 +200,4 @@ public class RecordsManagementJob implements Job
|
|||||||
this.runAuditAs = runAuditAs;
|
this.runAuditAs = runAuditAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -46,8 +46,7 @@ public abstract class RecordsManagementJobExecuter implements RecordsManagementM
|
|||||||
protected RepositoryState repositoryState;
|
protected RepositoryState repositoryState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param retryingTransactionHelper
|
* @param retryingTransactionHelper retrying transaction helper
|
||||||
* retrying transaction helper
|
|
||||||
*/
|
*/
|
||||||
public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
|
public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
|
||||||
{
|
{
|
||||||
@@ -55,8 +54,7 @@ public abstract class RecordsManagementJobExecuter implements RecordsManagementM
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param repositoryState
|
* @param repositoryState repository state helper component
|
||||||
* repository state helper component
|
|
||||||
*/
|
*/
|
||||||
public void setRepositoryState(RepositoryState repositoryState)
|
public void setRepositoryState(RepositoryState repositoryState)
|
||||||
{
|
{
|
||||||
@@ -82,4 +80,4 @@ public abstract class RecordsManagementJobExecuter implements RecordsManagementM
|
|||||||
* Jobs work implementation.
|
* Jobs work implementation.
|
||||||
*/
|
*/
|
||||||
public abstract void executeImpl();
|
public abstract void executeImpl();
|
||||||
}
|
}
|
||||||
@@ -36,23 +36,21 @@ public abstract class BasePublishExecutor implements PublishExecutor
|
|||||||
{
|
{
|
||||||
/** Publish executor registry */
|
/** Publish executor registry */
|
||||||
public PublishExecutorRegistry registry;
|
public PublishExecutorRegistry registry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set publish executor registry
|
* Set publish executor registry
|
||||||
*
|
* @param registry publish executor registry
|
||||||
* @param registry
|
|
||||||
* publish executor registry
|
|
||||||
*/
|
*/
|
||||||
public void setPublishExecutorRegistry(PublishExecutorRegistry registry)
|
public void setPublishExecutorRegistry(PublishExecutorRegistry registry)
|
||||||
{
|
{
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*/
|
*/
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
registry.register(this);
|
registry.register(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,9 +54,7 @@ public class DispositionActionDefinitionPublishExecutor extends BasePublishExecu
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set node service
|
* Set node service
|
||||||
*
|
* @param nodeService node service
|
||||||
* @param nodeService
|
|
||||||
* node service
|
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
@@ -65,9 +63,7 @@ public class DispositionActionDefinitionPublishExecutor extends BasePublishExecu
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set records management service
|
* Set records management service
|
||||||
*
|
* @param rmActionService records management service
|
||||||
* @param rmActionService
|
|
||||||
* records management service
|
|
||||||
*/
|
*/
|
||||||
public void setRmActionService(RecordsManagementActionService rmActionService)
|
public void setRmActionService(RecordsManagementActionService rmActionService)
|
||||||
{
|
{
|
||||||
@@ -90,12 +86,12 @@ public class DispositionActionDefinitionPublishExecutor extends BasePublishExecu
|
|||||||
@Override
|
@Override
|
||||||
public void publish(NodeRef nodeRef)
|
public void publish(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
List<QName> updatedProps = (List<QName>) nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_UPDATED_PROPERTIES);
|
List<QName> updatedProps = (List<QName>)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_UPDATED_PROPERTIES);
|
||||||
if (updatedProps != null)
|
if (updatedProps != null)
|
||||||
{
|
{
|
||||||
Map<String, Serializable> params = new HashMap<>();
|
Map<String, Serializable> params = new HashMap<>();
|
||||||
params.put(BroadcastDispositionActionDefinitionUpdateAction.CHANGED_PROPERTIES, (Serializable) updatedProps);
|
params.put(BroadcastDispositionActionDefinitionUpdateAction.CHANGED_PROPERTIES, (Serializable)updatedProps);
|
||||||
rmActionService.executeRecordsManagementAction(nodeRef, BroadcastDispositionActionDefinitionUpdateAction.NAME, params);
|
rmActionService.executeRecordsManagementAction(nodeRef, BroadcastDispositionActionDefinitionUpdateAction.NAME, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,15 +37,14 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public interface PublishExecutor
|
public interface PublishExecutor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return publish exector name
|
* @return publish exector name
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish changes to node.
|
* Publish changes to node.
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef node reference
|
||||||
* node reference
|
|
||||||
*/
|
*/
|
||||||
void publish(NodeRef nodeRef);
|
void publish(NodeRef nodeRef);
|
||||||
}
|
}
|
||||||
@@ -39,27 +39,25 @@ public class PublishExecutorRegistry
|
|||||||
{
|
{
|
||||||
/** Map of publish executors */
|
/** Map of publish executors */
|
||||||
private Map<String, PublishExecutor> publishExectors = new HashMap<>(3);
|
private Map<String, PublishExecutor> publishExectors = new HashMap<>(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a publish executor
|
* Register a publish executor
|
||||||
*
|
*
|
||||||
* @param publishExecutor
|
* @param publishExecutor publish executor
|
||||||
* publish executor
|
|
||||||
*/
|
*/
|
||||||
public void register(PublishExecutor publishExecutor)
|
public void register(PublishExecutor publishExecutor)
|
||||||
{
|
{
|
||||||
publishExectors.put(publishExecutor.getName(), publishExecutor);
|
publishExectors.put(publishExecutor.getName(), publishExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get registered publish executor by name.
|
* Get registered publish executor by name.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name name
|
||||||
* name
|
|
||||||
* @return {@link PublishExecutor}]
|
* @return {@link PublishExecutor}]
|
||||||
*/
|
*/
|
||||||
public PublishExecutor get(String name)
|
public PublishExecutor get(String name)
|
||||||
{
|
{
|
||||||
return publishExectors.get(name);
|
return publishExectors.get(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,84 +45,79 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public interface FilePlanRoleService
|
public interface FilePlanRoleService
|
||||||
{
|
{
|
||||||
/** Default role names */
|
/** Default role names */
|
||||||
String ROLE_USER = "User";
|
String ROLE_USER = "User";
|
||||||
String ROLE_POWER_USER = "PowerUser";
|
String ROLE_POWER_USER = "PowerUser";
|
||||||
String ROLE_SECURITY_OFFICER = "SecurityOfficer";
|
String ROLE_SECURITY_OFFICER = "SecurityOfficer";
|
||||||
String ROLE_RECORDS_MANAGER = "RecordsManager";
|
String ROLE_RECORDS_MANAGER = "RecordsManager";
|
||||||
String ROLE_ADMIN = "Administrator";
|
String ROLE_ADMIN = "Administrator";
|
||||||
String ROLE_EXTENDED_READERS = "ExtendedReaders";
|
String ROLE_EXTENDED_READERS = "ExtendedReaders";
|
||||||
String ROLE_EXTENDED_WRITERS = "ExtendedWriters";
|
String ROLE_EXTENDED_WRITERS = "ExtendedWriters";
|
||||||
|
|
||||||
/** System roles */
|
/** System roles */
|
||||||
List<String> SYSTEM_ROLES = Arrays.asList(
|
List<String> SYSTEM_ROLES = Arrays.asList(
|
||||||
ROLE_EXTENDED_READERS,
|
ROLE_EXTENDED_READERS,
|
||||||
ROLE_EXTENDED_WRITERS);
|
ROLE_EXTENDED_WRITERS
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the roles on a new file plan.
|
* Sets up the roles on a new file plan.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
|
||||||
*/
|
*/
|
||||||
void setupFilePlanRoles(NodeRef filePlan);
|
void setupFilePlanRoles(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tears down the roles on a file plan.
|
* Tears down the roles on a file plan.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
|
||||||
*/
|
*/
|
||||||
void tearDownFilePlanRoles(NodeRef filePlan);
|
void tearDownFilePlanRoles(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the container group for all roles of a specified file plan.
|
* Returns the name of the container group for all roles of a specified file
|
||||||
|
* plan.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan node reference
|
||||||
* file plan node reference
|
* @return String group name
|
||||||
* @return String group name
|
|
||||||
*/
|
*/
|
||||||
String getAllRolesContainerGroup(NodeRef filePlan);
|
String getAllRolesContainerGroup(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the available roles for the given records management root node (includes also the system roles)
|
* Get all the available roles for the given records management root node
|
||||||
|
* (includes also the system roles)
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<Role> getRoles(NodeRef filePlan);
|
Set<Role> getRoles(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the available roles for the given records management root node. System roles can be filtered
|
* Get all the available roles for the given records management root node.
|
||||||
|
* System roles can be filtered
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param includeSystemRoles system roles
|
||||||
* @param includeSystemRoles
|
|
||||||
* system roles
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<Role> getRoles(NodeRef filePlan, boolean includeSystemRoles);
|
Set<Role> getRoles(NodeRef filePlan, boolean includeSystemRoles);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the roles for a given user (includes also the system roles)
|
* Gets the roles for a given user
|
||||||
|
* (includes also the system roles)
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param user user
|
||||||
* @param user
|
|
||||||
* user
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<Role> getRolesByUser(NodeRef filePlan, String user);
|
Set<Role> getRolesByUser(NodeRef filePlan, String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the roles for a given user. System roles can be filtered
|
* Gets the roles for a given user.
|
||||||
|
* System roles can be filtered
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param user user
|
||||||
* @param user
|
* @param includeSystemRoles system roles
|
||||||
* user
|
|
||||||
* @param includeSystemRoles
|
|
||||||
* system roles
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<Role> getRolesByUser(NodeRef filePlan, String user, boolean includeSystemRoles);
|
Set<Role> getRolesByUser(NodeRef filePlan, String user, boolean includeSystemRoles);
|
||||||
@@ -130,21 +125,16 @@ public interface FilePlanRoleService
|
|||||||
/**
|
/**
|
||||||
* Get a role by name
|
* Get a role by name
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
|
||||||
* role
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Role getRole(NodeRef filePlan, String role);
|
Role getRole(NodeRef filePlan, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether a role exists for a given records management root node
|
* Indicate whether a role exists for a given records management root node
|
||||||
*
|
* @param filePlan file plan
|
||||||
* @param filePlan
|
* @param role role
|
||||||
* file plan
|
|
||||||
* @param role
|
|
||||||
* role
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean existsRole(NodeRef filePlan, String role);
|
boolean existsRole(NodeRef filePlan, String role);
|
||||||
@@ -152,10 +142,8 @@ public interface FilePlanRoleService
|
|||||||
/**
|
/**
|
||||||
* Determines whether the given user has the RM Admin role
|
* Determines whether the given user has the RM Admin role
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan filePlan
|
||||||
* filePlan
|
* @param user user name to check
|
||||||
* @param user
|
|
||||||
* user name to check
|
|
||||||
* @return true if the user has the RM Admin role, false otherwise
|
* @return true if the user has the RM Admin role, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean hasRMAdminRole(NodeRef filePlan, String user);
|
boolean hasRMAdminRole(NodeRef filePlan, String user);
|
||||||
@@ -163,8 +151,7 @@ public interface FilePlanRoleService
|
|||||||
/**
|
/**
|
||||||
* Create a new role
|
* Create a new role
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
|
||||||
* @param role
|
* @param role
|
||||||
* @param roleDisplayLabel
|
* @param roleDisplayLabel
|
||||||
* @param capabilities
|
* @param capabilities
|
||||||
@@ -175,8 +162,7 @@ public interface FilePlanRoleService
|
|||||||
/**
|
/**
|
||||||
* Update an existing role
|
* Update an existing role
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
|
||||||
* @param role
|
* @param role
|
||||||
* @param roleDisplayLabel
|
* @param roleDisplayLabel
|
||||||
* @param capabilities
|
* @param capabilities
|
||||||
@@ -187,67 +173,54 @@ public interface FilePlanRoleService
|
|||||||
/**
|
/**
|
||||||
* Delete a role
|
* Delete a role
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
|
||||||
* role
|
|
||||||
*/
|
*/
|
||||||
void deleteRole(NodeRef filePlan, String role);
|
void deleteRole(NodeRef filePlan, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the users that have been directly assigned to a role.
|
* Gets all the users that have been directly assigned to a role.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
* @return {@link Set}<{@link String}> set of users
|
||||||
* role
|
|
||||||
* @return {@link Set}<{@link String}> set of users
|
|
||||||
*/
|
*/
|
||||||
Set<String> getUsersAssignedToRole(NodeRef filePlan, String role);
|
Set<String> getUsersAssignedToRole(NodeRef filePlan, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the groups that have been directly assigned to a role.
|
* Gets all the groups that have been directly assigned to a role.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
* @return {@link Set}<{@link String}> set of groups
|
||||||
* role
|
|
||||||
* @return {@link Set}<{@link String}> set of groups
|
|
||||||
*/
|
*/
|
||||||
Set<String> getGroupsAssignedToRole(NodeRef filePlan, String role);
|
Set<String> getGroupsAssignedToRole(NodeRef filePlan, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the groups and users that have been directly assigned to a role.
|
* Gets all the groups and users that have been directly assigned to a role.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
* @return {@link Set}<{@link String}> set of groups and users
|
||||||
* role
|
|
||||||
* @return {@link Set}<{@link String}> set of groups and users
|
|
||||||
*/
|
*/
|
||||||
Set<String> getAllAssignedToRole(NodeRef filePlan, String role);
|
Set<String> getAllAssignedToRole(NodeRef filePlan, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a role to an authority
|
* Assign a role to an authority
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
* @param authorityName authority name
|
||||||
* role
|
|
||||||
* @param authorityName
|
|
||||||
* authority name
|
|
||||||
*/
|
*/
|
||||||
void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName);
|
void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unassign a role from an authority
|
* Unassign a role from an authority
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param role role
|
||||||
* @param role
|
* @param authorityName authority name
|
||||||
* role
|
|
||||||
* @param authorityName
|
|
||||||
* authority name
|
|
||||||
*/
|
*/
|
||||||
void unassignRoleFromAuthority(NodeRef filePlan, String role, String authorityName);
|
void unassignRoleFromAuthority(NodeRef filePlan, String role, String authorityName);
|
||||||
}
|
}
|
||||||
@@ -35,14 +35,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent;
|
import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
@@ -62,6 +54,13 @@ import org.alfresco.service.cmr.security.AuthorityService;
|
|||||||
import org.alfresco.service.cmr.security.AuthorityType;
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Role service implementation
|
* Role service implementation
|
||||||
@@ -70,7 +69,7 @@ import org.alfresco.util.ParameterCheck;
|
|||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
||||||
RecordsManagementModel
|
RecordsManagementModel
|
||||||
{
|
{
|
||||||
/** Logger for the class. */
|
/** Logger for the class. */
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(FilePlanRoleServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(FilePlanRoleServiceImpl.class);
|
||||||
@@ -110,8 +109,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
private static final String CONFIG_NODEID = "rm_config_folder";
|
private static final String CONFIG_NODEID = "rm_config_folder";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param capabilityService
|
* @param capabilityService capability service
|
||||||
* capability service
|
|
||||||
*/
|
*/
|
||||||
public void setCapabilityService(CapabilityService capabilityService)
|
public void setCapabilityService(CapabilityService capabilityService)
|
||||||
{
|
{
|
||||||
@@ -119,8 +117,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param authorityService
|
* @param authorityService authority service
|
||||||
* authority service
|
|
||||||
*/
|
*/
|
||||||
public void setAuthorityService(AuthorityService authorityService)
|
public void setAuthorityService(AuthorityService authorityService)
|
||||||
{
|
{
|
||||||
@@ -128,8 +125,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param permissionService
|
* @param permissionService permission service
|
||||||
* permission service
|
|
||||||
*/
|
*/
|
||||||
public void setPermissionService(PermissionService permissionService)
|
public void setPermissionService(PermissionService permissionService)
|
||||||
{
|
{
|
||||||
@@ -137,8 +133,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService
|
* @param nodeService node service
|
||||||
* node service
|
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
@@ -146,8 +141,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filePlanService
|
* @param filePlanService file plan service
|
||||||
* file plan service
|
|
||||||
*/
|
*/
|
||||||
public void setFilePlanService(FilePlanService filePlanService)
|
public void setFilePlanService(FilePlanService filePlanService)
|
||||||
{
|
{
|
||||||
@@ -170,7 +164,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
public void setupFilePlanRoles(final NodeRef filePlan)
|
public void setupFilePlanRoles(final NodeRef filePlan)
|
||||||
{
|
{
|
||||||
// Do not execute behaviour if this has been created in the archive store
|
// Do not execute behaviour if this has been created in the archive store
|
||||||
if (filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE))
|
if(filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE))
|
||||||
{
|
{
|
||||||
// This is not the spaces store - probably the archive store
|
// This is not the spaces store - probably the archive store
|
||||||
return;
|
return;
|
||||||
@@ -178,12 +172,13 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
|
|
||||||
if (nodeService.exists(filePlan))
|
if (nodeService.exists(filePlan))
|
||||||
{
|
{
|
||||||
List<NodeRef> systemContainers = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<List<NodeRef>>() {
|
List<NodeRef> systemContainers = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<List<NodeRef>>()
|
||||||
|
{
|
||||||
public List<NodeRef> doWork()
|
public List<NodeRef> doWork()
|
||||||
{
|
{
|
||||||
List<NodeRef> systemContainers = new ArrayList<>(3);
|
List<NodeRef> systemContainers = new ArrayList<>(3);
|
||||||
|
|
||||||
// In a multi tenant store we need to initialize the rm config if it has been done yet
|
//In a multi tenant store we need to initialize the rm config if it has been done yet
|
||||||
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
|
||||||
if (!nodeService.exists(nodeRef))
|
if (!nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
@@ -192,9 +187,9 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
|
|
||||||
// Create "all" role group for root node
|
// Create "all" role group for root node
|
||||||
String allRoles = authorityService.createAuthority(
|
String allRoles = authorityService.createAuthority(
|
||||||
AuthorityType.GROUP,
|
AuthorityType.GROUP,
|
||||||
getAllRolesGroupShortName(filePlan),
|
getAllRolesGroupShortName(filePlan),
|
||||||
I18NUtil.getMessage(MSG_ALL_ROLES),
|
I18NUtil.getMessage(MSG_ALL_ROLES),
|
||||||
new HashSet<>(Arrays.asList(RMAuthority.ZONE_APP_RM)));
|
new HashSet<>(Arrays.asList(RMAuthority.ZONE_APP_RM)));
|
||||||
|
|
||||||
// Set the permissions
|
// Set the permissions
|
||||||
@@ -223,7 +218,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
@Override
|
@Override
|
||||||
public void tearDownFilePlanRoles(final NodeRef filePlan)
|
public void tearDownFilePlanRoles(final NodeRef filePlan)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Object>() {
|
AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Object>()
|
||||||
|
{
|
||||||
public Object doWork()
|
public Object doWork()
|
||||||
{
|
{
|
||||||
// cascade delete the 'all' roles group for the site
|
// cascade delete the 'all' roles group for the site
|
||||||
@@ -255,14 +251,13 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
/**
|
/**
|
||||||
* Bootstraps the default roles
|
* Bootstraps the default roles
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param systemContainers system containers
|
||||||
* @param systemContainers
|
|
||||||
* system containers
|
|
||||||
*/
|
*/
|
||||||
private void bootstrapDefaultRoles(final NodeRef filePlan, final List<NodeRef> systemContainers)
|
private void bootstrapDefaultRoles(final NodeRef filePlan, final List<NodeRef> systemContainers)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||||
|
{
|
||||||
public Object doWork()
|
public Object doWork()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -272,7 +267,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
{
|
{
|
||||||
// Load up the default roles from JSON
|
// Load up the default roles from JSON
|
||||||
InputStream is = getClass().getClassLoader().getResourceAsStream(BOOTSTRAP_ROLE_JSON_LOCATION);
|
InputStream is = getClass().getClassLoader().getResourceAsStream(BOOTSTRAP_ROLE_JSON_LOCATION);
|
||||||
if (is == null)
|
if (is == null)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Could not load default bootstrap roles configuration");
|
throw new AlfrescoRuntimeException("Could not load default bootstrap roles configuration");
|
||||||
}
|
}
|
||||||
@@ -303,6 +298,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
throw new AlfrescoRuntimeException("No name given to default bootstrap role. Check json configuration file.");
|
throw new AlfrescoRuntimeException("No name given to default bootstrap role. Check json configuration file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get the role's display label
|
// Get the role's display label
|
||||||
String displayLabel = name;
|
String displayLabel = name;
|
||||||
if (object.has(JSON_DISPLAY_LABEL))
|
if (object.has(JSON_DISPLAY_LABEL))
|
||||||
@@ -375,8 +371,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
/**
|
/**
|
||||||
* Helper method to check whether the current authority is a system role or not
|
* Helper method to check whether the current authority is a system role or not
|
||||||
*
|
*
|
||||||
* @param roleAuthority
|
* @param roleAuthority The role to check
|
||||||
* The role to check
|
|
||||||
* @return Returns true if roleAuthority is a system role, false otherwise
|
* @return Returns true if roleAuthority is a system role, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean isSystemRole(String roleAuthority)
|
private boolean isSystemRole(String roleAuthority)
|
||||||
@@ -409,7 +404,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
@Override
|
@Override
|
||||||
public Set<Role> getRoles(final NodeRef rmRootNode, final boolean includeSystemRoles)
|
public Set<Role> getRoles(final NodeRef rmRootNode, final boolean includeSystemRoles)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Set<Role>>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Set<Role>>()
|
||||||
|
{
|
||||||
public Set<Role> doWork()
|
public Set<Role> doWork()
|
||||||
{
|
{
|
||||||
Set<Role> result = new HashSet<>(13);
|
Set<Role> result = new HashSet<>(13);
|
||||||
@@ -453,7 +449,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
@Override
|
@Override
|
||||||
public Set<Role> getRolesByUser(final NodeRef rmRootNode, final String user, final boolean includeSystemRoles)
|
public Set<Role> getRolesByUser(final NodeRef rmRootNode, final String user, final boolean includeSystemRoles)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Set<Role>>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Set<Role>>()
|
||||||
|
{
|
||||||
public Set<Role> doWork()
|
public Set<Role> doWork()
|
||||||
{
|
{
|
||||||
Set<Role> result = new HashSet<>(13);
|
Set<Role> result = new HashSet<>(13);
|
||||||
@@ -523,7 +520,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
*/
|
*/
|
||||||
public Role getRole(final NodeRef rmRootNode, final String role)
|
public Role getRole(final NodeRef rmRootNode, final String role)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Role>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Role>()
|
||||||
|
{
|
||||||
public Role doWork()
|
public Role doWork()
|
||||||
{
|
{
|
||||||
Role result = null;
|
Role result = null;
|
||||||
@@ -574,7 +572,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
*/
|
*/
|
||||||
public boolean existsRole(final NodeRef rmRootNode, final String role)
|
public boolean existsRole(final NodeRef rmRootNode, final String role)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Boolean>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Boolean>()
|
||||||
|
{
|
||||||
public Boolean doWork()
|
public Boolean doWork()
|
||||||
{
|
{
|
||||||
String fullRoleName = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode));
|
String fullRoleName = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode));
|
||||||
@@ -589,7 +588,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
||||||
*
|
*
|
||||||
* TODO .. change this to check a property of the role its self
|
* TODO .. change this to check a property of the role its self
|
||||||
*/
|
*/
|
||||||
public boolean hasRMAdminRole(NodeRef rmRootNode, String user)
|
public boolean hasRMAdminRole(NodeRef rmRootNode, String user)
|
||||||
{
|
{
|
||||||
@@ -616,7 +615,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
*/
|
*/
|
||||||
public Role createRole(final NodeRef filePlan, final String role, final String roleDisplayLabel, final Set<Capability> capabilities)
|
public Role createRole(final NodeRef filePlan, final String role, final String roleDisplayLabel, final Set<Capability> capabilities)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Role>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Role>()
|
||||||
|
{
|
||||||
public Role doWork()
|
public Role doWork()
|
||||||
{
|
{
|
||||||
String fullRoleName = getFullRoleName(role, filePlan);
|
String fullRoleName = getFullRoleName(role, filePlan);
|
||||||
@@ -650,7 +650,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO .. we should be creating a permission set containing all the capabilities and then assigning that
|
// TODO .. we should be creating a permission set containing all the capabilities and then assigning that
|
||||||
// single permission group to the file plan .. would be tidier
|
// single permission group to the file plan .. would be tidier
|
||||||
|
|
||||||
// Assign the various capabilities to the group on the root records management node
|
// Assign the various capabilities to the group on the root records management node
|
||||||
if (capabilities != null)
|
if (capabilities != null)
|
||||||
@@ -666,12 +666,15 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set)
|
* @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set)
|
||||||
*/
|
*/
|
||||||
public Role updateRole(final NodeRef rmRootNode, final String role, final String roleDisplayLabel, final Set<Capability> capabilities)
|
public Role updateRole(final NodeRef rmRootNode, final String role, final String roleDisplayLabel, final Set<Capability> capabilities)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Role>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Role>()
|
||||||
|
{
|
||||||
public Role doWork()
|
public Role doWork()
|
||||||
{
|
{
|
||||||
if (!existsRole(rmRootNode, role))
|
if (!existsRole(rmRootNode, role))
|
||||||
@@ -718,7 +721,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
throw new AlfrescoRuntimeException("'" + role + "' is a system role and cannot be deleted.");
|
throw new AlfrescoRuntimeException("'" + role + "' is a system role and cannot be deleted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||||
|
{
|
||||||
public Void doWork()
|
public Void doWork()
|
||||||
{
|
{
|
||||||
String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode));
|
String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode));
|
||||||
@@ -744,17 +748,15 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
/**
|
/**
|
||||||
* Gets all the authorities of a given type directly assigned to the given role in the file plan.
|
* Gets all the authorities of a given type directly assigned to the given role in the file plan.
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan file plan
|
||||||
* file plan
|
* @param roleName role name
|
||||||
* @param roleName
|
* @param authorityType authority type
|
||||||
* role name
|
* @return Set<String> directly assigned authorities
|
||||||
* @param authorityType
|
|
||||||
* authority type
|
|
||||||
* @return Set<String> directly assigned authorities
|
|
||||||
*/
|
*/
|
||||||
private Set<String> getAuthoritiesAssignedToRole(final NodeRef filePlan, final String roleName, final AuthorityType authorityType)
|
private Set<String> getAuthoritiesAssignedToRole(final NodeRef filePlan, final String roleName, final AuthorityType authorityType)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Set<String>>() {
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Set<String>>()
|
||||||
|
{
|
||||||
public Set<String> doWork()
|
public Set<String> doWork()
|
||||||
{
|
{
|
||||||
Role role = getRole(filePlan, roleName);
|
Role role = getRole(filePlan, roleName);
|
||||||
@@ -800,21 +802,22 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
*/
|
*/
|
||||||
public void assignRoleToAuthority(final NodeRef filePlan, final String role, final String authorityName)
|
public void assignRoleToAuthority(final NodeRef filePlan, final String role, final String authorityName)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
|
||||||
|
{
|
||||||
public Void doWork()
|
public Void doWork()
|
||||||
{
|
{
|
||||||
if (authorityService.authorityExists(authorityName) &&
|
if (authorityService.authorityExists(authorityName) &&
|
||||||
!getAllAssignedToRole(filePlan, role).contains(authorityName))
|
!getAllAssignedToRole(filePlan, role).contains(authorityName))
|
||||||
{
|
{
|
||||||
String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan));
|
String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
authorityService.addAuthority(roleAuthority, authorityName);
|
authorityService.addAuthority(roleAuthority, authorityName);
|
||||||
}
|
}
|
||||||
catch (DuplicateChildNodeNameException exception)
|
catch (DuplicateChildNodeNameException exception)
|
||||||
{
|
{
|
||||||
// ignore, because the work has already been performed
|
// ignore, because the work has already been performed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -828,7 +831,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
@Override
|
@Override
|
||||||
public void unassignRoleFromAuthority(final NodeRef filePlan, final String role, final String authorityName)
|
public void unassignRoleFromAuthority(final NodeRef filePlan, final String role, final String authorityName)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
|
||||||
|
{
|
||||||
public Void doWork()
|
public Void doWork()
|
||||||
{
|
{
|
||||||
String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan));
|
String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan));
|
||||||
@@ -847,4 +851,4 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
{
|
{
|
||||||
return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan));
|
return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,4 +122,4 @@ public class Role
|
|||||||
return this.groupShortName;
|
return this.groupShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ import org.alfresco.util.Pair;
|
|||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory
|
public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory
|
||||||
implements RecordsManagementModel
|
implements RecordsManagementModel
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public CannedQuery<NodeRef> getCannedQuery(NodeRef parentRef, String pattern, Set<QName> assocTypeQNames, Set<QName> childTypeQNames, List<FilterProp> filterProps, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest)
|
public CannedQuery<NodeRef> getCannedQuery(NodeRef parentRef, String pattern, Set<QName> assocTypeQNames, Set<QName> childTypeQNames, List<FilterProp> filterProps, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest)
|
||||||
@@ -54,4 +54,4 @@ public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchi
|
|||||||
childTypeQNames.add(TYPE_RM_SITE);
|
childTypeQNames.add(TYPE_RM_SITE);
|
||||||
return super.getCannedQuery(parentRef, pattern, assocTypeQNames, childTypeQNames, filterProps, sortProps, pagingRequest);
|
return super.getCannedQuery(parentRef, pattern, assocTypeQNames, childTypeQNames, filterProps, sortProps, pagingRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ public class AlfrescoTransactionSupport
|
|||||||
{
|
{
|
||||||
org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource(key, resource);
|
org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource(key, resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#unbindResource(Object)
|
* @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#unbindResource(Object)
|
||||||
*/
|
*/
|
||||||
@@ -60,4 +60,4 @@ public class AlfrescoTransactionSupport
|
|||||||
{
|
{
|
||||||
return org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(key);
|
return org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.util;
|
package org.alfresco.module.org_alfresco_module_rm.util;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO;
|
import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
@@ -36,9 +34,10 @@ import org.alfresco.service.cmr.repository.ContentService;
|
|||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class to duplicate the content of a node without triggering the audit or versioning behaviours
|
* Utility class to duplicate the content of a node without triggering the audit or versioning behaviours
|
||||||
*
|
|
||||||
* @author Ross Gale
|
* @author Ross Gale
|
||||||
* @since 2.7.2
|
* @since 2.7.2
|
||||||
*/
|
*/
|
||||||
@@ -59,9 +58,7 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for behaviour filter
|
* Setter for behaviour filter
|
||||||
*
|
* @param behaviourFilter BehaviourFilter
|
||||||
* @param behaviourFilter
|
|
||||||
* BehaviourFilter
|
|
||||||
*/
|
*/
|
||||||
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
||||||
{
|
{
|
||||||
@@ -70,9 +67,7 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for content service
|
* Setter for content service
|
||||||
*
|
* @param contentService ContentService
|
||||||
* @param contentService
|
|
||||||
* ContentService
|
|
||||||
*/
|
*/
|
||||||
public void setContentService(ContentService contentService)
|
public void setContentService(ContentService contentService)
|
||||||
{
|
{
|
||||||
@@ -82,8 +77,7 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Setter for the Records Management QueryDAO
|
* Setter for the Records Management QueryDAO
|
||||||
*
|
*
|
||||||
* @param recordsManagementQueryDAO
|
* @param recordsManagementQueryDAO The RM query DAO to set
|
||||||
* The RM query DAO to set
|
|
||||||
*/
|
*/
|
||||||
public void setRecordsManagementQueryDAO(RecordsManagementQueryDAO recordsManagementQueryDAO)
|
public void setRecordsManagementQueryDAO(RecordsManagementQueryDAO recordsManagementQueryDAO)
|
||||||
{
|
{
|
||||||
@@ -91,10 +85,9 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the bin file for a given node has at least one other reference to it Will return true if the binary exists and is referenced by at least one other node
|
* Determines whether the bin file for a given node has at least one other reference to it
|
||||||
*
|
* Will return true if the binary exists and is referenced by at least one other node
|
||||||
* @param nodeRef
|
* @param nodeRef Node with the binary in question
|
||||||
* Node with the binary in question
|
|
||||||
* @return boolean for if the bin has at least one other reference to it
|
* @return boolean for if the bin has at least one other reference to it
|
||||||
*/
|
*/
|
||||||
public boolean hasAtLeastOneOtherReference(NodeRef nodeRef)
|
public boolean hasAtLeastOneOtherReference(NodeRef nodeRef)
|
||||||
@@ -113,25 +106,24 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Duplicate the content of a node without triggering the audit or versioning behaviours
|
* Duplicate the content of a node without triggering the audit or versioning behaviours
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef The node with the content to duplicate
|
||||||
* The node with the content to duplicate
|
|
||||||
*/
|
*/
|
||||||
public void duplicate(NodeRef nodeRef)
|
public void duplicate(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
// Adding fix for RM-6788 where too many duplicates are being made this is a workaround waiting on a full
|
//Adding fix for RM-6788 where too many duplicates are being made this is a workaround waiting on a full
|
||||||
// solution
|
// solution
|
||||||
if (!nodeService.hasAspect(nodeRef, ASPECT_ARCHIVED))
|
if (!nodeService.hasAspect(nodeRef, ASPECT_ARCHIVED))
|
||||||
{
|
{
|
||||||
// disabling versioning and auditing
|
//disabling versioning and auditing
|
||||||
behaviourFilter.disableBehaviour();
|
behaviourFilter.disableBehaviour();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// create a new content URL for the copy/original node
|
//create a new content URL for the copy/original node
|
||||||
updateContentProperty(nodeRef);
|
updateContentProperty(nodeRef);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// enable versioning and auditing
|
//enable versioning and auditing
|
||||||
behaviourFilter.enableBehaviour();
|
behaviourFilter.enableBehaviour();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,8 +132,7 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
/**
|
/**
|
||||||
* Helper to update the content property for the node
|
* Helper to update the content property for the node
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef the node
|
||||||
* the node
|
|
||||||
*/
|
*/
|
||||||
private void updateContentProperty(NodeRef nodeRef)
|
private void updateContentProperty(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -152,4 +143,4 @@ public class ContentBinDuplicationUtility extends ServiceBaseImpl
|
|||||||
writer.putContent(reader);
|
writer.putContent(reader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,9 +43,8 @@ public class FileUtils
|
|||||||
/**
|
/**
|
||||||
* Helper method to convert a stream to a string.
|
* Helper method to convert a stream to a string.
|
||||||
*
|
*
|
||||||
* @param is
|
* @param is input stream
|
||||||
* input stream
|
* @return {@link String} string
|
||||||
* @return {@link String} string
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static String convertStreamToString(InputStream is) throws IOException
|
public static String convertStreamToString(InputStream is) throws IOException
|
||||||
@@ -62,4 +61,4 @@ public class FileUtils
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,7 @@ public class NodeTypeUtility
|
|||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dictionaryService
|
* @param dictionaryService dictionary service
|
||||||
* dictionary service
|
|
||||||
*/
|
*/
|
||||||
public void setDictionaryService(DictionaryService dictionaryService)
|
public void setDictionaryService(DictionaryService dictionaryService)
|
||||||
{
|
{
|
||||||
@@ -58,11 +57,9 @@ public class NodeTypeUtility
|
|||||||
/**
|
/**
|
||||||
* Utility method to quickly determine whether one class is equal to or sub of another.
|
* Utility method to quickly determine whether one class is equal to or sub of another.
|
||||||
*
|
*
|
||||||
* @param className
|
* @param className class name
|
||||||
* class name
|
* @param ofClassName class name to check against
|
||||||
* @param ofClassName
|
* @return boolean true if equal to or sub, false otherwise
|
||||||
* class name to check against
|
|
||||||
* @return boolean true if equal to or sub, false otherwise
|
|
||||||
*/
|
*/
|
||||||
public boolean instanceOf(QName className, QName ofClassName)
|
public boolean instanceOf(QName className, QName ofClassName)
|
||||||
{
|
{
|
||||||
@@ -70,6 +67,7 @@ public class NodeTypeUtility
|
|||||||
ParameterCheck.mandatory("ofClassName", ofClassName);
|
ParameterCheck.mandatory("ofClassName", ofClassName);
|
||||||
|
|
||||||
String key = className.toString() + "|" + ofClassName.toString();
|
String key = className.toString() + "|" + ofClassName.toString();
|
||||||
return instanceOfCache.computeIfAbsent(key, k -> (ofClassName.equals(className) || dictionaryService.isSubClass(className, ofClassName)));
|
return instanceOfCache.computeIfAbsent(key, k ->
|
||||||
|
(ofClassName.equals(className) || dictionaryService.isSubClass(className, ofClassName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,11 +54,13 @@ public final class PoliciesUtil
|
|||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef
|
||||||
* the node we are interested in
|
* the node we are interested in
|
||||||
* @return Returns a set of qualified names containing the node type and all the node aspects, or null if the node no longer exists
|
* @return Returns a set of qualified names containing the node type and all
|
||||||
|
* the node aspects, or null if the node no longer exists
|
||||||
*/
|
*/
|
||||||
public static Set<QName> getTypeAndAspectQNames(final NodeService nodeService, final NodeRef nodeRef)
|
public static Set<QName> getTypeAndAspectQNames(final NodeService nodeService, final NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Set<QName>>() {
|
return AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Set<QName>>()
|
||||||
|
{
|
||||||
public Set<QName> doWork()
|
public Set<QName> doWork()
|
||||||
{
|
{
|
||||||
Set<QName> qnames = null;
|
Set<QName> qnames = null;
|
||||||
@@ -81,4 +83,4 @@ public final class PoliciesUtil
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,8 +67,7 @@ public class PropertyModificationAllowedCheck
|
|||||||
/**
|
/**
|
||||||
* Setter for list of model URI's
|
* Setter for list of model URI's
|
||||||
*
|
*
|
||||||
* @param editableURIs
|
* @param editableURIs List<String>
|
||||||
* List<String>
|
|
||||||
*/
|
*/
|
||||||
public void setEditableURIs(List<String> editableURIs)
|
public void setEditableURIs(List<String> editableURIs)
|
||||||
{
|
{
|
||||||
@@ -78,8 +77,7 @@ public class PropertyModificationAllowedCheck
|
|||||||
/**
|
/**
|
||||||
* Setter for list of qnames
|
* Setter for list of qnames
|
||||||
*
|
*
|
||||||
* @param whiteList
|
* @param whiteList List<QName>
|
||||||
* List<QName>
|
|
||||||
*/
|
*/
|
||||||
public void setWhiteList(List<QName> whiteList)
|
public void setWhiteList(List<QName> whiteList)
|
||||||
{
|
{
|
||||||
@@ -90,11 +88,10 @@ public class PropertyModificationAllowedCheck
|
|||||||
/**
|
/**
|
||||||
* Compares the node properties with the requested update to make sure all potential updates are permitted
|
* Compares the node properties with the requested update to make sure all potential updates are permitted
|
||||||
*
|
*
|
||||||
* @param before
|
* @param before current node properties
|
||||||
* current node properties
|
* @param after updated properties for the node
|
||||||
* @param after
|
* @return true - if all modified property keys are in the whitelist or
|
||||||
* updated properties for the node
|
* in the list of model URI's for which the properties can be modified
|
||||||
* @return true - if all modified property keys are in the whitelist or in the list of model URI's for which the properties can be modified
|
|
||||||
*/
|
*/
|
||||||
public boolean check(Map<QName, Serializable> before, Map<QName, Serializable> after)
|
public boolean check(Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||||
{
|
{
|
||||||
@@ -104,13 +101,13 @@ public class PropertyModificationAllowedCheck
|
|||||||
{
|
{
|
||||||
final QName key = entry.getKey();
|
final QName key = entry.getKey();
|
||||||
final Serializable beforeValue = entry.getValue();
|
final Serializable beforeValue = entry.getValue();
|
||||||
// check if property has been updated
|
//check if property has been updated
|
||||||
final boolean modified = after.containsKey(key) && after.get(key) != null
|
final boolean modified = after.containsKey(key) && after.get(key) != null
|
||||||
&& !after.get(key).equals(beforeValue);
|
&& !after.get(key).equals(beforeValue);
|
||||||
|
|
||||||
// check if the property has been emptied or removed
|
//check if the property has been emptied or removed
|
||||||
final boolean propertyRemovedEmptied = (after.get(key) == null && beforeValue != null)
|
final boolean propertyRemovedEmptied = (after.get(key) == null && beforeValue != null)
|
||||||
|| !after.containsKey(key);
|
|| !after.containsKey(key);
|
||||||
if (modified || propertyRemovedEmptied)
|
if (modified || propertyRemovedEmptied)
|
||||||
{
|
{
|
||||||
proceed = allowPropertyUpdate(key);
|
proceed = allowPropertyUpdate(key);
|
||||||
@@ -138,8 +135,7 @@ public class PropertyModificationAllowedCheck
|
|||||||
/**
|
/**
|
||||||
* Determines whether the property should be allowed to be updated or not.
|
* Determines whether the property should be allowed to be updated or not.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key property
|
||||||
* property
|
|
||||||
* @return true if property update is allowed
|
* @return true if property update is allowed
|
||||||
*/
|
*/
|
||||||
private boolean allowPropertyUpdate(QName key)
|
private boolean allowPropertyUpdate(QName key)
|
||||||
@@ -147,4 +143,4 @@ public class PropertyModificationAllowedCheck
|
|||||||
return whiteList.contains(key) || getEditableURIs().contains(key.getNamespaceURI());
|
return whiteList.contains(key) || getEditableURIs().contains(key.getNamespaceURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -38,10 +38,12 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Various common helper methods for Collections. This class is probably only appropriate for use with relatively small collections as it has not been optimised for dealing with large collections.
|
* Various common helper methods for Collections. This class is probably only appropriate for use with relatively
|
||||||
|
* small collections as it has not been optimised for dealing with large collections.
|
||||||
*
|
*
|
||||||
* @author Neil Mc Erlean
|
* @author Neil Mc Erlean
|
||||||
* @since 2.4.a
|
* @since 2.4.a
|
||||||
@@ -49,29 +51,24 @@ import org.apache.commons.collections.CollectionUtils;
|
|||||||
// This class should all be moved to core Alfresco whenever possible and reused from there.
|
// This class should all be moved to core Alfresco whenever possible and reused from there.
|
||||||
public final class RMCollectionUtils
|
public final class RMCollectionUtils
|
||||||
{
|
{
|
||||||
private RMCollectionUtils()
|
private RMCollectionUtils() { /* Intentionally empty. */}
|
||||||
{ /* Intentionally empty. */}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of duplicate elements contained within the specified list, if any.
|
* Gets the list of duplicate elements contained within the specified list, if any.
|
||||||
*
|
* @param l the list in which to find duplicates.
|
||||||
* @param l
|
* @param <T> the element type of the list.
|
||||||
* the list in which to find duplicates.
|
* @return a list of duplicate elements. If there are no duplicates, returns an empty list.
|
||||||
* @param <T>
|
|
||||||
* the element type of the list.
|
|
||||||
* @return a list of duplicate elements. If there are no duplicates, returns an empty list.
|
|
||||||
*/
|
*/
|
||||||
public static <T> List<T> getDuplicateElements(List<T> l)
|
public static <T> List<T> getDuplicateElements(List<T> l)
|
||||||
{
|
{
|
||||||
final Set<T> uniqueElems = new HashSet<>();
|
final Set<T> uniqueElems = new HashSet<>();
|
||||||
final List<T> duplicateElems = new ArrayList<>();
|
final List<T> duplicateElems = new ArrayList<>();
|
||||||
|
|
||||||
for (T elem : l)
|
for (T elem: l)
|
||||||
{
|
{
|
||||||
if (uniqueElems.contains(elem))
|
if (uniqueElems.contains(elem))
|
||||||
{
|
{
|
||||||
if (!duplicateElems.contains(elem))
|
if (!duplicateElems.contains(elem)) duplicateElems.add(elem);
|
||||||
duplicateElems.add(elem);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -81,16 +78,12 @@ public final class RMCollectionUtils
|
|||||||
return duplicateElems;
|
return duplicateElems;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Returns the head (element at index 0) of the provided List.
|
||||||
* Returns the head (element at index 0) of the provided List.
|
|
||||||
*
|
*
|
||||||
* @param l
|
* @param l the list whose head is sought.
|
||||||
* the list whose head is sought.
|
* @param <T> the type of the List.
|
||||||
* @param <T>
|
|
||||||
* the type of the List.
|
|
||||||
* @return the head element or {@code null} for the empty list.
|
* @return the head element or {@code null} for the empty list.
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException if l is {@code null}
|
||||||
* if l is {@code null}
|
|
||||||
*/
|
*/
|
||||||
public static <T> T head(List<T> l)
|
public static <T> T head(List<T> l)
|
||||||
{
|
{
|
||||||
@@ -98,17 +91,14 @@ public final class RMCollectionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tail of the provided List i.e. the sublist which contains all elements of the given list except the {@link #head(List) head}.
|
* Returns the tail of the provided List i.e. the sublist which contains
|
||||||
|
* all elements of the given list except the {@link #head(List) head}.
|
||||||
*
|
*
|
||||||
* @param l
|
* @param l the list whose tail is sought.
|
||||||
* the list whose tail is sought.
|
* @param <T> the type of the List.
|
||||||
* @param <T>
|
|
||||||
* the type of the List.
|
|
||||||
* @return the tail sublist, which will be an empty list if the provided list had only a single element.
|
* @return the tail sublist, which will be an empty list if the provided list had only a single element.
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException if l is {@code null}
|
||||||
* if l is {@code null}
|
* @throws UnsupportedOperationException if the provided list was empty.
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
* if the provided list was empty.
|
|
||||||
*/
|
*/
|
||||||
public static <T> List<T> tail(List<T> l)
|
public static <T> List<T> tail(List<T> l)
|
||||||
{
|
{
|
||||||
@@ -125,17 +115,16 @@ public final class RMCollectionUtils
|
|||||||
/**
|
/**
|
||||||
* Returns a Serializable List containing all of the provided elements.
|
* Returns a Serializable List containing all of the provided elements.
|
||||||
*
|
*
|
||||||
* @param elements
|
* @param elements the elements to put in a list.
|
||||||
* the elements to put in a list.
|
* @param <T> the element type.
|
||||||
* @param <T>
|
* @return a Serializable List containing all the provided elements.
|
||||||
* the element type.
|
|
||||||
* @return a Serializable List containing all the provided elements.
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public static <T extends Serializable, LIST extends Serializable & List<T>> LIST asSerializableList(T... elements)
|
public static <T extends Serializable, LIST extends Serializable & List<T>>
|
||||||
|
LIST asSerializableList(T... elements)
|
||||||
{
|
{
|
||||||
final LIST l = (LIST) new ArrayList<T>(elements.length);
|
final LIST l = (LIST)new ArrayList<T>(elements.length);
|
||||||
for (T element : elements)
|
for (T element : elements)
|
||||||
{
|
{
|
||||||
l.add(element);
|
l.add(element);
|
||||||
@@ -144,13 +133,12 @@ public final class RMCollectionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Set containing all of the provided elements. Duplicate elements will be removed as per the {@code Set} contract.
|
* Returns a Set containing all of the provided elements. Duplicate elements will be removed as per the
|
||||||
|
* {@code Set} contract.
|
||||||
*
|
*
|
||||||
* @param elements
|
* @param elements the elements to put in a Set.
|
||||||
* the elements to put in a Set.
|
* @param <T> the element type.
|
||||||
* @param <T>
|
* @return a Set containing all the provided elements (without duplicates).
|
||||||
* the element type.
|
|
||||||
* @return a Set containing all the provided elements (without duplicates).
|
|
||||||
*/
|
*/
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public static <T> HashSet<T> asSet(T... elements)
|
public static <T> HashSet<T> asSet(T... elements)
|
||||||
@@ -164,13 +152,13 @@ public final class RMCollectionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Set containing all of the elements in the provided collection. Duplicate elements will be removed as per the {@code Set} contract.
|
* Returns a Set containing all of the elements in the provided collection.
|
||||||
|
* Duplicate elements will be removed as per the
|
||||||
|
* {@code Set} contract.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c the elements to put in a Set.
|
||||||
* the elements to put in a Set.
|
* @param <T> the element type.
|
||||||
* @param <T>
|
* @return a Set containing all the provided elements (without duplicates).
|
||||||
* the element type.
|
|
||||||
* @return a Set containing all the provided elements (without duplicates).
|
|
||||||
*/
|
*/
|
||||||
public static <T> HashSet<T> asSet(Collection<T> c)
|
public static <T> HashSet<T> asSet(Collection<T> c)
|
||||||
{
|
{
|
||||||
@@ -186,68 +174,43 @@ public final class RMCollectionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the change in a Map entry between two Maps. Note that both maps must have the same types of key-value pair.
|
* Determines the change in a Map entry between two Maps.
|
||||||
|
* Note that both maps must have the same types of key-value pair.
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from the first collection.
|
||||||
* the first collection.
|
* @param to the second collection.
|
||||||
* @param to
|
* @param key the key identifying the entry.
|
||||||
* the second collection.
|
* @param <K> the type of the key.
|
||||||
* @param key
|
* @param <V> the type of the value.
|
||||||
* the key identifying the entry.
|
|
||||||
* @param <K>
|
|
||||||
* the type of the key.
|
|
||||||
* @param <V>
|
|
||||||
* the type of the value.
|
|
||||||
* @return the {@link Difference}.
|
* @return the {@link Difference}.
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException if {@code key} is {@code null}.
|
||||||
* if {@code key} is {@code null}.
|
|
||||||
*/
|
*/
|
||||||
public static <K, V> Difference diffKey(Map<K, V> from, Map<K, V> to, K key)
|
public static <K, V> Difference diffKey(Map<K, V> from, Map<K, V> to, K key)
|
||||||
{
|
{
|
||||||
if (key == null)
|
if (key == null) { throw new IllegalArgumentException("Key cannot be null."); }
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("Key cannot be null.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (from.containsKey(key))
|
if (from.containsKey(key))
|
||||||
{
|
{
|
||||||
if (to.containsKey(key))
|
if (to.containsKey(key))
|
||||||
{
|
{
|
||||||
if (nullSafeEquals(from.get(key), to.get(key)))
|
if (nullSafeEquals(from.get(key), to.get(key))) { return Difference.UNCHANGED; }
|
||||||
{
|
else { return Difference.CHANGED; }
|
||||||
return Difference.UNCHANGED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Difference.CHANGED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Difference.REMOVED;
|
|
||||||
}
|
}
|
||||||
|
else { return Difference.REMOVED; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (to.containsKey(key))
|
if (to.containsKey(key)) { return Difference.ADDED; }
|
||||||
{
|
else { return Difference.UNCHANGED; }
|
||||||
return Difference.ADDED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Difference.UNCHANGED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a collection to an immutable set. Any instances of null in the original collection will be removed.
|
* Convert a collection to an immutable set. Any instances of null in the original collection will be removed.
|
||||||
*
|
*
|
||||||
* @param collection
|
* @param collection The original collection.
|
||||||
* The original collection.
|
* @param <T> The type of the object in the collection.
|
||||||
* @param <T>
|
|
||||||
* The type of the object in the collection.
|
|
||||||
* @return The immutable set.
|
* @return The immutable set.
|
||||||
*/
|
*/
|
||||||
public static <T> ImmutableSet<T> toImmutableSet(Collection<T> collection)
|
public static <T> ImmutableSet<T> toImmutableSet(Collection<T> collection)
|
||||||
@@ -267,10 +230,11 @@ public final class RMCollectionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a property is null or an empty collection. Note that this is the same as {org.apache.commons.collections.CollectionUtils.isEmpty(Collection)}, except that it takes a Serializable rather than a Collection. This avoids awkward casting exceptions when working with properties.
|
* Check if a property is null or an empty collection. Note that this is the same as
|
||||||
|
* {org.apache.commons.collections.CollectionUtils.isEmpty(Collection)}, except that it takes a Serializable rather
|
||||||
|
* than a Collection. This avoids awkward casting exceptions when working with properties.
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value The (probably Collection) value to check.
|
||||||
* The (probably Collection) value to check.
|
|
||||||
* @return true if the supplied value is null or an empty collection.
|
* @return true if the supplied value is null or an empty collection.
|
||||||
*/
|
*/
|
||||||
public static boolean isEmpty(Serializable value)
|
public static boolean isEmpty(Serializable value)
|
||||||
@@ -281,4 +245,4 @@ public final class RMCollectionUtils
|
|||||||
}
|
}
|
||||||
return (value == null);
|
return (value == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user