Compare commits

..

4 Commits

Author SHA1 Message Date
alfresco-build
5dc0d39287 [maven-release-plugin] prepare release V2.6.0.1 2019-10-10 13:19:11 +01:00
Tom Page
5f87a5cd92 Update license headers. 2019-10-02 14:58:48 +01:00
Tom Page
5f6c135b7f RM-6363 Use internal-releases credentials for all deployment repos.
(cherry picked from commit 7840703706)
2018-06-15 11:42:51 +01:00
Tom Page
3698f57469 RM-6363 Add correct destinations for released artifacts.
(cherry picked from commit f47875c100)
2018-06-15 11:42:48 +01:00
1153 changed files with 1859 additions and 8735 deletions

View File

@@ -1,73 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at katalin.zanaty@alfresco.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org

140
README.md
View File

@@ -1,140 +0,0 @@
# Records Management: README
## Contributing
Please refer to our [How to contribute](/CONTRIBUTING.md) guide and our [Contributor Covenant Code of Conduct](/CODE_OF_CONDUCT.md).
## Configuring and starting Alfresco/Share
* Clone the project (e.g. `git clone git@gitlab.alfresco.com:records-management/records-management.git`)
* Import the project as a maven project
* Start the Alfresco/Share instances with the following commands:
```
mvn clean install -Pstart-repo
mvn clean install -Pstart-share
```
(these commands work best if run from the specific directories, e.g. start Share from
rm-community/rm-community-share/ or rm-enterprise/rm-enterprise-share/ )
## Configuring a different DB other than H2 (e.g. MySQL or PostgreSQL)
* Create a file called _local.properties_ under src/main/resources in alfresco-rm-enterprise-repo
* Add the following properties in this new file
```
my.db.name -> The name of the database schema
my.db.port -> The port number for your database (default port number for postgres is 5432 and for mysql it is 3306)
```
* Run the following commands to start your Alfresco instance:
to start Alfresco (using Postgres):
```
mvn clean install -Pstart-repo,use-postgres
```
to start Alfresco (using MySQL):
```
mvn clean install -Pstart-repo,use-mysql
```
## Technical documentation
Technical documentation is available at [rm-community/documentation/README.md](/rm-community/documentation/README.md) and [rm-enterprise/documentation/README.md](/rm-enterprise/documentation/README.md). This should be particularly useful for anyone wanting to integrate with or extend RM.
## Running integration test
In order to execute the integration tests run the following command (unit tests will be executed every time before you start Alfresco/Share):
```
mvn clean install -Dskip.integrationtests=false
```
## Running UI Automation tests
To run the automated UI tests, change to the rm-automation directory and run:
```
mvn clean install -Dskip.automationtests=false
```
Note: due to Selenium Firefox driver changes, the highest supported Firefox version for UI tests is 43.0.4 (with Selenium 2.52.0).
It is possible to have multiple versions of Firefox installed onto your workstation (e.g. one for running the UI tests and the other, kept
up to date, for everyday browsing) but beware Firefox auto-updates. In this scenario the best approach is to create a non-default profile
(default profiles will be shared between your Firefox installations!) for which auto-updates are disabled and forcing the use of this
profile in your tests (`-Dwebdriver.firefox.profile="ProfileName"`). If your Firefox 43 install isn't in your path, you can use the
`-Dwebdriver.firefox.profile` option set to the full path of its "firefox-bin" executable.
MacOS X Sierra users: if you experience by order of magnitude slower performance when connected to a WiFi network (e.g. office WiFi)
add your workstation to your local /etc/hosts file as described on https://github.com/SeleniumHQ/selenium/issues/2824.
To use Chrome instead of Firefox:
1. copy webdriver.properties from https://github.com/AlfrescoTestAutomation/selenium-grid/tree/master/src/main/resources
2. put it under src/test/resource in rm-automation-ui project
3. download the chrome driver from http://chromedriver.storage.googleapis.com and extract it
4. change the following properties in webdriver.properties: webdriver.browser (Chrome) and webdriver.chrome.server.path (path/to/chrome/driver)
5. run the tests as usual
## Updating License Headers
In order to refesh out of date license source headers run the following command:
```
mvn clean install -Dlicense.update.dryrun=false
```
## Running tests against latest Aikau snapshot
The latest Aikau snapshot can be pulled by running the following command in rm-community:
```
mvn clean install -DskipTests -Dalfresco.aikau.version=LATEST -U
```
Thereafter start the Share instance and run automation tests as described above.
## Configuring Outlook Integration
To download and run RM with the Outlook Integration AMPs installed on the repo and Share use the following commands:
```
mvn clean install -Pstart-repo,outlook-integration
mvn clean install -Pstart-share,outlook-integration
```
Follow these instructions to install licence and Outlook plugin:
* http://docs.alfresco.com/outlook2.1/tasks/Outlook-license.html
* http://docs.alfresco.com/outlook2.1/tasks/Outlook-install_v2.html
## SNAPSHOT dependencies
If you're building Enterprise RM, the base project (Community) is pulled in via a snapshot dependency configured in maven.
This dependency will either be loaded from your local .m2 cache, or from Nexus if the version in your .m2 doesn't exist or is old
('old' in maven terms is anything over 24 hours old). If maven fetches community dependencies from Nexus, then it's unlikely to contain your changes.
You want to always use the version in your local cache - this means either doing a daily build at the root project level
that pushes a new copy of the correct version into your cache, or alternatively you could run mvn with the
`--no-snapshot-dependency` (or `-nsu`) option, which won't try to download a newer version.
## Code Formatting
This project follows the usual Alfresco Coding Standards. If you use Eclipse or IntelliJ, there are settings inside the ide-config directory for you to import.
## Surf build errors
If you get:
```
[ERROR] Failed to execute goal on project alfresco-rm-community-share: Could not resolve dependencies for project org.alfresco:alfresco-rm-community-share:amp:2.6-SNAPSHOT: Failed to collect dependencies at org.alfresco.surf:spring-surf-api:jar:6.3 -> org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Failed to read artifact descriptor for org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Could not transfer artifact org.alfresco.surf:spring-surf:pom:${dependency.surf.version} from/to alfresco-internal (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
```
then please re-run with `-Ddependency.surf.version=6.3`
## Install lombok plugin for IDEs
To allow automation and benchmark projects to be built within an IDE the lombok 'plugin' needs to be installed.
Execute lombok.jar (doubleclick it, or run `java -jar lombok.jar`). Follow the instructions.
## Use Solr 6 with Alfresco 5.2.x
In alfresco-global.properties (depending on the RM edition `/records-management/rm-community/rm-community-repo/src/test/properties/local` or `/records-management/rm-enterprise/rm-enterprise-repo/src/test/properties/local`)
change the value for "index.subsystem.name" from "solr4" to "solr6".
Add also the following property "solr.port=8983".
Download the latest Alfresco Search Services from
[https://nexus.alfresco.com/nexus/#nexus-search;gav\~\~alfresco-search-services\~\~\~](https://nexus.alfresco.com/nexus/#nexus-search;gav~~alfresco-search-services~~~)
Currently it's 1.0.0 (alfresco-search-services-1.0.0.zip)
Unzip it and change to the "solr" folder within it. Start the Solr server using the following command:
```
solr start -a "-Dcreate.alfresco.defaults=alfresco,archive"
```
Start your repository

155
README.txt Normal file
View File

@@ -0,0 +1,155 @@
Configuring and starting Alfresco/Share:
----------------------------------------
- Clone the project (e.g. git clone git@gitlab.alfresco.com:records-management/records-management.git)
- Import the project as a maven project
- Start the Alfresco/Share instances with the following commands:
mvn clean install -Pstart-repo
mvn clean install -Pstart-share
(these commands work best if run from the specific directories, e.g. start share from
rm-enterprise/rm-enterprise-share/ or rm-community/rm-community-share/ )
Configuring a different DB other than H2 (e.g. MySQL or PostgreSQL):
--------------------------------------------------------------------
- Create a file called "local.properties" under src/main/resources in alfresco-rm-enterprise-repo
- Add the following properties in this new file
my.db.name -> The name of the database schema
my.db.port -> The port number for your database (default port number for postgres is 5432 and for mysql it is 3306)
- Run the following commands to start your Alfresco instance:
to start Alfresco (using Postgres):
mvn clean install -Pstart-repo,use-postgres
to start Alfresco (using MySQL):
mvn clean install -Pstart-repo,use-mysql
Technical documentation:
------------------------
Technical documentation is available at rm-community/documentation/README.md and rm-enterprise/documentation/README.md.
This should be particularly useful for anyone wanting to integrate with or extend RM.
Running integration test:
-------------------------
In order to execute the integration tests run the following command (unit tests will be executed every time before you start Alfresco/Share):
mvn clean install -Dskip.integrationtests=false
Running UI Automation tests:
----------------------------
To run the automated UI tests, change to the rm-automation directory and run:
mvn clean install -Dskip.automationtests=false
Note: due to Selenium Firefox driver changes, the highest supported Firefox version for UI tests is 43.0.4 (with Selenium 2.52.0).
It is possible to have multiple versions of Firefox installed onto your workstation (e.g. one for running the UI tests and the other, kept
up to date, for everyday browsing) but beware Firefox auto-updates. In this scenario the best approach is to create a non-default profile
(default profiles will be shared between your Firefox installations!) for which auto-updates are disabled and forcing the use of this
profile in your tests (-Dwebdriver.firefox.profile="ProfileName"). If your Firefox 43 install isn't in your path, you can use the
-Dwebdriver.firefox.profile option set to the full path of its "firefox-bin" executable.
MacOS X Sierra users: if you experience by order of magnitude slower performance when connected to a WiFi network (e.g. office WiFi)
add your workstation to your local /etc/hosts file as described on https://github.com/SeleniumHQ/selenium/issues/2824.
To use Chrome instead of Firefox:
- copy webdriver.properties from https://github.com/AlfrescoTestAutomation/selenium-grid/tree/master/src/main/resources
- put it under src/test/resource in rm-automation-ui project
- download the chrome driver from http://chromedriver.storage.googleapis.com/ and extract it
- change the following properties in webdriver.properties: webdriver.browser (Chrome) and webdriver.chrome.server.path (path/to/chrome/driver)
- run the tests as usual
Updating License Headers:
-------------------------
In order to refesh out of date license source headers run the following command:
mvn clean install -Dlicense.update.dryrun=false
Running tests against latest Aikau snapshot:
--------------------------------------------
The latest Aikau snapshot can be pulled by running the following command in rm-community:
mvn clean install -DskipTests -Dalfresco.aikau.version=LATEST -U
Thereafter start the Share instance and run automation tests as described above.
Configuring Outlook Integration:
-------------------------------
To download and run RM with the Outlook Integration AMPs installed on the repo and Share use the following commands:
mvn clean install -Pstart-repo,outlook-integration
mvn clean install -Pstart-share,outlook-integration
Follow these instructions install licence and Outlook plugin:
- http://docs.alfresco.com/outlook2.1/tasks/Outlook-license.html
- http://docs.alfresco.com/outlook2.1/tasks/Outlook-install_v2.html
SNAPSHOT dependencies:
----------------------
If you're building Enterprise RM, the base project (Community) is pulled in via a snapshot dependency configured in maven.
This dependency will either be loaded from your local .m2 cache or from Nexus if the version in your .m2 doesn't exist or is old
(Old in maven terms is anything over 24hrs old). If maven fetches it from Nexus, your code it's unlikely to be the correct version.
You want to always use the version in your local cache - this means either doing a daily build at the root project level
that pushes a new copy of the correct version into your cache, or alternatively you could run mvn with the
--no-snapshot-dependency (or -nsu) option, which won't try to download a newer version.
Code Formatting:
----------------
This project follows the usual Alfresco Coding Standards. If you use Eclipse or IntelliJ, there are settings inside the ide-config directory for you to import.
Surf build errors:
------------------
If you get:
[ERROR] Failed to execute goal on project alfresco-rm-community-share: Could not resolve dependencies for project org.alfresco:alfresco-rm-community-share:amp:2.6-SNAPSHOT: Failed to collect dependencies at org.alfresco.surf:spring-surf-api:jar:6.3 -> org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Failed to read artifact descriptor for org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Could not transfer artifact org.alfresco.surf:spring-surf:pom:${dependency.surf.version} from/to alfresco-internal (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
then please re-run with -Ddependency.surf.version=6.3
Install lombok plugin for IDEs:
-------------------------------
To allow automation and benchmark projects to be built within an IDE the lombok 'plugin' needs to be installed.
Execute lombok.jar (doubleclick it, or run java -jar lombok.jar). Follow instructions.
Use Solr 6 with Alfresco 5.2.x:
-------------------------------
In alfresco-global.properties (depending on the RM edition /records-management/rm-community/rm-community-repo/src/test/properties/local or /records-management/rm-enterprise/rm-enterprise-repo/src/test/properties/local)
change the value for "index.subsystem.name" from "solr4" to "solr6".
Add also the following property "solr.port=8983".
Download the latest Alfresco Search Services from
https://nexus.alfresco.com/nexus/#nexus-search;gav~~alfresco-search-services~~~
Currently it's 1.0.0 (alfresco-search-services-1.0.0.zip)
Unzip it and change to the "solr" folder within it. Start the Solr server using the following command:
solr start -a "-Dcreate.alfresco.defaults=alfresco,archive"
Start your repository

20
pom.xml
View File

@@ -4,7 +4,7 @@
<groupId>org.alfresco</groupId>
<artifactId>alfresco-rm</artifactId>
<packaging>pom</packaging>
<version>2.7.0.2</version>
<version>2.6.0.1</version>
<name>Alfresco Records Management</name>
<parent>
@@ -21,10 +21,10 @@
</organization>
<scm>
<connection>scm:git:ssh://git@github.com/Alfresco/governance-services.git</connection>
<developerConnection>scm:git:ssh://git@github.com/Alfresco/governance-services.git</developerConnection>
<url>scm:git:ssh://git@github.com/Alfresco/governance-services.git</url>
<tag>V2.7.0.2</tag>
<connection>scm:git:https://git.alfresco.com/records-management/records-management.git</connection>
<developerConnection>scm:git:https://git.alfresco.com/records-management/records-management.git</developerConnection>
<url>https://git.alfresco.com/records-management/records-management</url>
<tag>V2.6.0.1</tag>
</scm>
<issueManagement>
@@ -200,16 +200,6 @@
<license.verbose>false</license.verbose>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-rm</artifactId>
<version>2.7.0.2</version>
<version>2.6.0.1</version>
</parent>
<licenses>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-automation</artifactId>
<version>2.7.0.2</version>
<version>2.6.0.1</version>
</parent>
<properties>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -73,7 +73,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public abstract class BaseAPI
{
// logger
protected static final Logger LOGGER = LoggerFactory.getLogger(BaseAPI.class);
private static final Logger LOGGER = LoggerFactory.getLogger(BaseAPI.class);
/** exception key in JSON response body */
private static final String EXCEPTION_KEY = "exception";
@@ -121,37 +121,6 @@ public abstract class BaseAPI
return results;
}
/**
* Helper method to extract the property value for the given nodeRef and property name
*
* @param result
* @param nodeRef
* @param propertyName
* @return
*/
protected String getPropertyValue(JSONObject result, String nodeRef, String propertyName)
{
String propertyValue = "";
try
{
JSONArray items = result.getJSONArray("items");
for (int i = 0; i < items.length(); i++)
{
JSONObject item = items.getJSONObject(i);
if(nodeRef.equals(item.getString("nodeRef")))
{
propertyValue = item.getJSONObject("properties").getString(propertyName);
}
}
}
catch (JSONException error)
{
throw new RuntimeException("Unable to parse result", error);
}
return propertyValue;
}
/**
* Helper method to extract property values from request result and put them in map as a list that corresponds to a unique property value.
*
@@ -247,7 +216,6 @@ public abstract class BaseAPI
client.getAlfrescoUrl(),
URLEncodedUtils.format(parameters, "UTF-8"));
}
LOGGER.info("On GET {}, received following response: ", requestURL);
client.close();
return doGetRequest(username, password, requestURL);
}
@@ -341,78 +309,6 @@ public abstract class BaseAPI
}
}
/**
* Helper method for PUT requests
*
* @param adminUser user with administrative privileges
* @param adminPassword password for adminUser
* @param expectedStatusCode The expected return status code.
* @param requestParams zero or more endpoint specific request parameters
* @param urlTemplate request URL template
* @param urlTemplateParams zero or more parameters used with <i>urlTemplate</i>
*/
protected HttpResponse doPutJsonRequest(String adminUser,
String adminPassword,
int expectedStatusCode,
JSONObject requestParams,
String urlTemplate,
String... urlTemplateParams)
{
AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
return doPutJsonRequest(adminUser, adminPassword, expectedStatusCode, client.getApiUrl(), requestParams, urlTemplate, urlTemplateParams);
}
/**
* Helper method for PUT requests
*
* @param adminUser user with administrative privileges
* @param adminPassword password for adminUser
* @param expectedStatusCode The expected return status code.
* @param urlStart the start of the URL (for example "alfresco/s/slingshot").
* @param requestParams zero or more endpoint specific request parameters
* @param urlTemplate request URL template
* @param urlTemplateParams zero or more parameters used with <i>urlTemplate</i>
* @throws AssertionError if the returned status code is not as expected.
*/
private HttpResponse doPutJsonRequest(String adminUser,
String adminPassword,
int expectedStatusCode,
String urlStart,
JSONObject requestParams,
String urlTemplate,
String... urlTemplateParams)
{
String requestUrl = formatRequestUrl(urlStart, urlTemplate, urlTemplateParams);
try
{
HttpResponse httpResponse = doRequestJson(HttpPut.class, requestUrl, adminUser, adminPassword, requestParams);
assertEquals("PUT request to " + requestUrl + " was not successful.", expectedStatusCode, httpResponse.getStatusLine().getStatusCode());
return httpResponse;
}
catch (InstantiationException | IllegalAccessException error)
{
throw new IllegalArgumentException("doPutRequest failed", error);
}
}
/**
* Fill in the parameters for a URL template.
*
* @param urlStart The start of the URL.
* @param urlTemplate The template.
* @param urlTemplateParams Any parameters that need to be filled into the URL template.
* @return The resultant URL.
*/
private String formatRequestUrl(String urlStart, String urlTemplate, String[] urlTemplateParams)
{
if (urlTemplateParams.length == 1)
{
// The format method needs some help to know not to use the whole array object.
return MessageFormat.format(urlTemplate, urlStart, urlTemplateParams[0]);
}
return MessageFormat.format(urlTemplate, urlStart, urlTemplateParams);
}
/**
* Helper method for POST requests
* @param adminUser user with administrative privileges
@@ -506,12 +402,15 @@ public abstract class BaseAPI
String urlTemplate,
String... urlTemplateParams)
{
String requestUrl;
requestUrl = formatRequestUrl(urlStart, urlTemplate, urlTemplateParams);
// Ensure the host is part of the request URL.
String requestUrl = MessageFormat.format(
urlTemplate,
urlStart,
urlTemplateParams);
try
{
HttpResponse httpResponse = doRequestJson(HttpPost.class, requestUrl, adminUser, adminPassword, requestParams);
assertEquals("POST request to " + requestUrl + " was not successful.", expectedStatusCode, httpResponse.getStatusLine().getStatusCode());
assertEquals("POST request to " + requestUrl + " was not successful.", httpResponse.getStatusLine().getStatusCode(), expectedStatusCode);
return httpResponse;
}
catch (InstantiationException | IllegalAccessException error)
@@ -553,10 +452,7 @@ public abstract class BaseAPI
{
((HttpEntityEnclosingRequestBase) request).setEntity(new StringEntity(requestParams.toString()));
}
LOGGER.info("Sending {} request to {}", requestType.getSimpleName(), requestUrl);
LOGGER.info("Request body: {}", requestParams);
response = client.execute(adminUser, adminPassword, request);
LOGGER.info("Response: {}", response.getStatusLine());
try
{
@@ -676,9 +572,6 @@ public abstract class BaseAPI
SHELF,
BOX,
FILE,
ORIGINATOR,
ORIGINATING_ORGANIZATION,
PUBLICATION_DATE
}
public enum RETENTION_SCHEDULE
@@ -693,7 +586,7 @@ public abstract class BaseAPI
RETENTION_GHOST,
RETENTION_ELIGIBLE_FIRST_EVENT,
RETENTION_EVENTS,
COMBINE_DISPOSITION_STEP_CONDITIONS
}
/**
@@ -705,8 +598,6 @@ public abstract class BaseAPI
CUT_OFF("cutoff"),
UNDO_CUT_OFF("undoCutoff"),
TRANSFER("transfer"),
COMPLETE_EVENT("completeEvent"),
UNDO_EVENT("undoEvent"),
DESTROY("destroy");
String action;

View File

@@ -1,49 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.core.v0;
public enum RMEvents
{
ABOLISHED("abolished"),
ALL_ALLOWANCES_GRANTED_ARE_TERMINATED("all_allowances_granted_are_terminated"),
CASE_CLOSED("case_closed"),
DECLASSIFICATION_REVIEW("declassification_review"),
OBSOLETE("obsolete"),
NO_LONGER_NEEDED("no_longer_needed"),
STUDY_COMPLETE("study_complete");
private String eventName;
RMEvents(String eventName)
{
this.eventName = eventName;
}
public String getEventName()
{
return eventName;
}
}

View File

@@ -1,89 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.audit;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.alfresco.utility.model.TestModel;
/**
* POJO for audit entry
*
* @author Rodica Sutu
* @since 2.7
*/
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties (ignoreUnknown = true)
public class AuditEntry extends TestModel
{
@JsonProperty (required = true)
private String nodeName;
@JsonProperty (required = true)
private List<Object> changedValues;
@JsonProperty (required = true)
private String identifier;
@JsonProperty (required = true)
private String path;
@JsonProperty (required = true)
private String nodeRef;
@JsonProperty (required = true)
private String fullName;
@JsonProperty
private String createPerson;
@JsonProperty (required = true)
private String userName;
@JsonProperty (required = true)
private String userRole;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String event;
@JsonProperty (required = true)
private String timestamp;
}

View File

@@ -1,57 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.audit;
/**
* Enumerates the list of events audited
*
* @author Rodica Sutu
* @since 2.7
*
*/
public enum AuditEvents
{
CREATE_PERSON("Create Person", "Create User"),
DELETE_PERSON("Delete Person", "Delete User"),
CREATE_USER_GROUP("Create User Group", "Create User Group"),
DELETE_USER_GROUP("Delete User Group", "Delete User Group"),
ADD_TO_USER_GROUP("Add To User Group", "Add To User Group"),
REMOVE_FROM_USER_GROUP("Remove From User Group", "Remove From User Group"),
LOGIN_UNSUCCESSFUL("Login.Failure", "Login Unsuccessful");
/** event audited */
public final String event;
/** display name for the event audited */
public final String eventDisplayName;
AuditEvents(String event, String displayName)
{
this.event = event;
this.eventDisplayName = displayName;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -58,8 +58,6 @@ public class FilePlanComponentFields
public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME = "rma:recordSearchDispositionActionName";
public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE = "rma:recordSearchDispositionEventsEligible";
public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS = "rma:recordSearchDispositionInstructions";
public static final String PROPERTIES_DECLASSIFICATION_REVIEW_COMPLETED_BY = "rma:declassificationReviewCompletedBy";
public static final String PROPERTIES_DECLASSIFICATION_REVIEW_COMPLETED_AT = "rma:declassificationReviewCompletedAt";
/** File plan properties */
@@ -76,9 +74,7 @@ public class FilePlanComponentFields
public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD = "rma:recordSearchVitalRecordReviewPeriod";
public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = "rma:recordSearchVitalRecordReviewPeriodExpression";
/**
* Record properties
*/
/** Record properties */
public static final String PROPERTIES_CLASSIFICATION = "sc:classification";
public static final String PROPERTIES_DATE_FILED = "rma:dateFiled";
public static final String PROPERTIES_ORIGINAL_NAME = "rma:origionalName";

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,6 +42,7 @@ import lombok.NoArgsConstructor;
* @author Rodica Sutu
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@@ -50,13 +51,4 @@ public class RMSite extends RestSiteModel
{
@JsonProperty (required = true)
private RMSiteCompliance compliance;
/** Private constructor allowing Lombok to include superclass fields in the builder. */
@Builder
private RMSite(String title, String description, RMSiteCompliance compliance)
{
this.setTitle(title);
this.setDescription(description);
this.compliance = compliance;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -1,42 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.user;
/**
* Constants for RM user capabilities
*
* @author Rodica Sutu
* @since 2.7
*/
public class UserCapabilities
{
/** The id of the view records capability. */
public static final String VIEW_RECORDS_CAP = "ViewRecords";
/** The id of the declare records capability. */
public static final String DECLARE_RECORDS_CAP = "DeclareRecords";
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -24,32 +24,19 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.user;
/**
* Constants for RM user roles
*
*
* @author Kristijan Conkas
* @since 2.6
*/
public enum UserRoles
public class UserRoles
{
IN_PLACE_WRITERS("ExtendedWriters", "In-Place Writers"),
ROLE_RM_ADMIN("Administrator", "Records Management Administrator"),
ROLE_RM_MANAGER("RecordsManager", "Records Management Manager"),
ROLE_RM_POWER_USER("PowerUser", "Records Management Power User"),
ROLE_RM_SECURITY_OFFICER("SecurityOfficer", "Records Management Security Officer"),
ROLE_RM_USER("User", "Records Management User");
public final String roleId;
public final String displayName;
UserRoles(String roleId, String displayName)
{
this.roleId = roleId;
this.displayName = displayName;
}
public static final String ROLE_RM_ADMIN = "Administrator";
public static final String ROLE_RM_MANAGER = "RecordsManager";
public static final String ROLE_RM_POWER_USER = "PowerUser";
public static final String ROLE_RM_SECURITY_OFFICER = "SecurityOfficer";
public static final String ROLE_RM_USER = "User";
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -28,18 +28,9 @@ package org.alfresco.rest.rm.community.util;
import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject;
import java.io.IOException;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Utility class for creating the json object
@@ -49,11 +40,6 @@ import org.slf4j.LoggerFactory;
*/
public class PojoUtility
{
/**
* Logger for the class.
*/
private static final Logger LOGGER = LoggerFactory.getLogger(PojoUtility.class);
/**
* see {@link #toJson(Object, Class, Class)}
*/
@@ -99,64 +85,4 @@ public class PojoUtility
return error.toString();
}
}
/**
* Converting json to java object
*
* @param json The json object to convert
* @param classz Class for the java object
* @return The converted java object
* @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model
*/
public static <T> T jsonToObject(JSONObject json, Class<T> classz)
{
mandatoryObject("model", classz);
mandatoryObject("jsonObject", json);
ObjectMapper mapper = new ObjectMapper();
T obj = null;
try
{
obj = mapper.readValue(json.toString(), classz);
}
catch (IOException e)
{
LOGGER.error("Unable to convert the json into a java object.", e.toString());
}
return obj;
}
/**
* Converting json array into a list of java objects
*
* @param json The json array to convert
* @param classz Class for the java object
* @return The list of converted java objects
* @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model
*/
public static <T> List<T> jsonToObject(JSONArray json, Class<T> classz)
{
mandatoryObject("model", classz);
mandatoryObject("jsonObject", json);
ObjectMapper mapper = new ObjectMapper();
CollectionType collectionType = mapper.getTypeFactory().constructCollectionType(List.class, classz);
List<T> asList = null;
try
{
asList = mapper.readValue(json.toString(), collectionType);
}
catch (IOException e)
{
LOGGER.error("Unable to convert the json array into a java collection.", e.toString());
}
return asList;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -1,74 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.v0;
import java.text.MessageFormat;
import org.alfresco.dataprep.AlfrescoHttpClient;
import org.alfresco.dataprep.AlfrescoHttpClientFactory;
import org.alfresco.rest.core.v0.BaseAPI;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* The v0 REST API for nodes
*
* @author jcule
* @since 2.7EA1
*/
@Component
public class NodeAPI extends BaseAPI
{
/** Logger for the class. */
private static final Logger LOGGER = LoggerFactory.getLogger(NodeAPI.class);
/** The URI for the get node API. */
private static final String GET_NODE_API = "{0}alfresco/s/slingshot/doclib2/node/{1}";
@Autowired
private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
/**
* Get the node metadata using the using the node data webscript: Document List v2 Component
*
* @param username
* @param password
* @param nodeId
* @return
*/
public JSONObject getNode(String username, String password, String nodeId)
{
String requestURL;
AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
requestURL = MessageFormat.format(GET_NODE_API, client.getAlfrescoUrl(), NODE_PREFIX + nodeId);
client.close();
return doGetRequest(username, password, requestURL);
}
}

View File

@@ -1,104 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.v0;
import static org.testng.Assert.assertTrue;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.List;
import org.alfresco.rest.core.v0.BaseAPI;
import org.alfresco.rest.rm.community.model.audit.AuditEntry;
import org.alfresco.rest.rm.community.util.PojoUtility;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* The v0 REST API for rm audit logs
*
* @author Rodica Sutu
* @since 2.7
*/
@Component
public class RMAuditAPI extends BaseAPI
{
/** Logger for the class. */
private static final Logger LOGGER = LoggerFactory.getLogger(RMAuditAPI.class);
/** The URI for the audit API. */
private static final String RM_AUDIT_API = "{0}rma/admin/rmauditlog";
private static final String RM_AUDIT_LOG_API = RM_AUDIT_API + "?{1}";
/**
* Returns a list of rm audit entries .
*
* @param user The username of the user to use.
* @param password The password of the user.
* @param size Maximum number of log entries to return
* @param event The name of audit event to be retrieved
* @return return Only return log entries matching this event
*/
public List<AuditEntry> getRMAuditLog(String user, String password, final int size, final String event)
{
String parameters = null;
try
{
parameters = "size=" + size + (event != null ? "&event=" + URLEncoder.encode(event, "UTF-8"):"");
}
catch (UnsupportedEncodingException e)
{
LOGGER.error("Unable to encode the event name" + e.getMessage());
}
JSONArray auditEntries = doGetRequest(user, password,
MessageFormat.format(RM_AUDIT_LOG_API,"{0}", parameters)).getJSONObject("data").getJSONArray("entries");
return PojoUtility.jsonToObject(auditEntries, AuditEntry.class);
}
/**
* Clear the list of audit entries.
*
* @param username The username of the user to use.
* @param password The password of the user.
* @throws AssertionError If the API call didn't clear the audit log.
*/
public void clearAuditLog(String username, String password)
{
JSONObject deleteStatus = doDeleteRequest(username, password, RM_AUDIT_API);
assertTrue(deleteStatus != null
//audit clear and login events are returned
&& getRMAuditLog(username, password, 100, null).size() == 2);
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -35,19 +35,16 @@ import static org.testng.AssertJUnit.fail;
import java.io.IOException;
import java.text.MessageFormat;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import org.alfresco.dataprep.AlfrescoHttpClient;
import org.alfresco.dataprep.AlfrescoHttpClientFactory;
import org.alfresco.dataprep.ContentService;
import org.alfresco.dataprep.UserService;
import org.alfresco.rest.core.v0.BaseAPI;
import org.alfresco.rest.core.v0.RMEvents;
import org.apache.chemistry.opencmis.client.api.CmisObject;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.http.HttpResponse;
@@ -73,10 +70,6 @@ import org.springframework.stereotype.Component;
@Component
public class RMRolesAndActionsAPI extends BaseAPI
{
/** The URI to view the configured roles and capabilities. */
private static final String RM_ROLES = "{0}rma/admin/rmroles";
/** The URI for REST requests about a particular configured role. */
private static final String RM_ROLES_ROLE = RM_ROLES + "/{1}";
private static final String RM_ROLES_AUTHORITIES = "{0}rm/roles/{1}/authorities/{2}?alf_ticket={3}";
// logger
@@ -95,89 +88,6 @@ public class RMRolesAndActionsAPI extends BaseAPI
@Autowired
private ContentService contentService;
/**
* Get all the configured RM roles.
*
* @param adminUser The RM admin user.
* @param adminPassword The password of the user.
* @return The RM roles in the system (Note that this will be the internal names, not the display labels).
*/
public Set<String> getConfiguredRoles(String adminUser, String adminPassword)
{
// Using "is=true" includes the in-place readers and writers.
JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject("data");
return jsonObject.toMap().keySet();
}
/**
* Get the capabilities for a given role.
*
* @param adminUser The RM admin user.
* @param adminPassword The password of the user.
* @param role The role to get capabilities for.
* @return The set of system names for the capabilities.
*/
public Set<String> getCapabilitiesForRole(String adminUser, String adminPassword, String role)
{
JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject("data");
assertTrue("Could not find role '" + role + "' in " + jsonObject.keySet(), jsonObject.has(role));
return jsonObject.getJSONObject(role).getJSONObject("capabilities").keySet();
}
/**
* Create a new RM role.
*
* @param adminUser The username of the admin user.
* @param adminPassword The password for the admin user.
* @param roleName The name of the new role.
* @param roleDisplayLabel A human-readable label for the role.
* @param capabilities A list of capabilities for the role.
*/
public void createRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set<String> capabilities)
{
JSONObject requestBody = new JSONObject();
requestBody.put("name", roleName);
requestBody.put("displayLabel", roleDisplayLabel);
JSONArray capabilitiesArray = new JSONArray();
capabilities.forEach(capabilitiesArray::put);
requestBody.put("capabilities", capabilitiesArray);
doPostJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, requestBody, RM_ROLES);
}
/**
* Update an existing RM role.
*
* @param adminUser The username of the admin user.
* @param adminPassword The password for the admin user.
* @param roleName The name of the new role.
* @param roleDisplayLabel A human-readable label for the role.
* @param capabilities A list of capabilities for the role.
*/
public void updateRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set<String> capabilities)
{
JSONObject requestBody = new JSONObject();
requestBody.put("name", roleName);
requestBody.put("displayLabel", roleDisplayLabel);
JSONArray capabilitiesArray = new JSONArray();
capabilities.forEach(capabilitiesArray::put);
requestBody.put("capabilities", capabilitiesArray);
doPutJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, requestBody, RM_ROLES_ROLE, roleName);
}
/**
* Delete a created RM role.
*
* @param adminUser The username of the admin user.
* @param adminPassword The password for the admin user.
* @param roleName The name of the role to be deleted.
*/
public void deleteRole(String adminUser, String adminPassword, String roleName)
{
doDeleteRequest(adminUser, adminPassword, MessageFormat.format(RM_ROLES_ROLE, "{0}", roleName));
boolean success = !getConfiguredRoles(adminUser, adminPassword).contains(roleName);
assertTrue("Failed to delete role " + roleName + " with " + adminUser, success);
}
/**
* create user and assign to records management role
*/
@@ -327,9 +237,9 @@ public class RMRolesAndActionsAPI extends BaseAPI
/**
* Perform an action on the record folder
*
* @param user the user executing the action
* @param user the user closing the folder
* @param password the user's password
* @param contentName the content name
* @param contentName the record folder name
* @param date the date to be updated
* @return The HTTP response.
*/
@@ -351,56 +261,6 @@ public class RMRolesAndActionsAPI extends BaseAPI
return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API);
}
/**
* Complete an event on the record/record folder
*
* @param user the user executing the action
* @param password the user's password
* @param nodeName the node name
* @param event the event to be completed
* @param date the date to be updated
* @return The HTTP response.
*/
public HttpResponse completeEvent(String user, String password, String nodeName, RMEvents event, Instant date)
{
String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, nodeName);
JSONObject requestParams = new JSONObject();
requestParams.put("name", RM_ACTIONS.COMPLETE_EVENT.getAction());
requestParams.put("nodeRef", recNodeRef);
date = (date != null) ? date : Instant.now();
String formattedDate = DateTimeFormatter.ISO_INSTANT.format(date);
requestParams.put("params", new JSONObject()
.put("eventName", event.getEventName())
.put("eventCompletedBy", user)
.put("eventCompletedAt", new JSONObject()
.put("iso8601", formattedDate)
)
);
return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API);
}
/**
* Undo an event on the record/record folder
*
* @param user the user executing the action
* @param password the user's password
* @param contentName the content name
* @param event the event to be undone
* @return The HTTP response.
*/
public HttpResponse undoEvent(String user, String password, String contentName, RMEvents event)
{
String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName);
JSONObject requestParams = new JSONObject();
requestParams.put("name", RM_ACTIONS.UNDO_EVENT.getAction());
requestParams.put("nodeRef", recNodeRef);
requestParams.put("params", new JSONObject()
.put("eventName", event.getEventName()));
return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API);
}
/**
* Deletes every item in the given container
*
@@ -485,10 +345,6 @@ public class RMRolesAndActionsAPI extends BaseAPI
addPropertyToRequest(requestParams, "prop_cm_title", properties, RMProperty.TITLE);
addPropertyToRequest(requestParams, "prop_cm_description", properties, RMProperty.DESCRIPTION);
addPropertyToRequest(requestParams, "prop_cm_author", properties, RMProperty.AUTHOR);
addPropertyToRequest(requestParams, "prop_dod_originator", properties, RMProperty.ORIGINATOR);
addPropertyToRequest(requestParams, "prop_dod_originatingOrganization", properties, RMProperty
.ORIGINATING_ORGANIZATION);
addPropertyToRequest(requestParams, "prop_dod_publicationDate", properties, RMProperty.PUBLICATION_DATE);
return doPostJsonRequest(username, password, SC_OK, requestParams, MessageFormat.format(UPDATE_METADATA_API, "{0}", itemNodeRef));
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -51,8 +51,6 @@ public class RecordCategoriesAPI extends BaseAPI
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCategoriesAPI.class);
private static final String RM_ACTIONS_API = "{0}rma/actions/ExecutionQueue";
private static final String DISPOSITION_ACTIONS_API = "{0}node/{1}/dispositionschedule/dispositionactiondefinitions";
private static final String DISPOSITION_SCHEDULE_API = "{0}node/{1}/dispositionschedule";
/**
* Creates a retention schedule for the category given as parameter
@@ -73,21 +71,6 @@ public class RecordCategoriesAPI extends BaseAPI
return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API);
}
/**
* Get the disposition schedule nodeRef
*
* @param user
* @param password
* @param categoryName
* @return the disposition schedule nodeRef
*/
public String getDispositionScheduleNodeRef(String user, String password, String categoryName)
{
String catNodeRef = NODE_PREFIX + getItemNodeRef(user, password, "/" + categoryName);
JSONObject dispositionSchedule = doGetRequest(user, password, MessageFormat.format(DISPOSITION_SCHEDULE_API, "{0}", catNodeRef));
return dispositionSchedule.getJSONObject("data").getString("nodeRef").replace(getNodeRefSpacesStore(), "");
}
/**
* Sets retention schedule authority and instructions, also if it is applied to records or folders
*
@@ -125,12 +108,7 @@ public class RecordCategoriesAPI extends BaseAPI
addPropertyToRequest(requestParams, "period", properties, RETENTION_SCHEDULE.RETENTION_PERIOD);
addPropertyToRequest(requestParams, "ghostOnDestroy", properties, RETENTION_SCHEDULE.RETENTION_GHOST);
addPropertyToRequest(requestParams, "periodProperty", properties, RETENTION_SCHEDULE.RETENTION_PERIOD_PROPERTY);
String events = getPropertyValue(properties, RETENTION_SCHEDULE.RETENTION_EVENTS);
if(!events.equals(""))
{
requestParams.append("events", events);
}
addPropertyToRequest(requestParams, "combineDispositionStepConditions", properties, RETENTION_SCHEDULE.COMBINE_DISPOSITION_STEP_CONDITIONS);
addPropertyToRequest(requestParams, "events", properties, RETENTION_SCHEDULE.RETENTION_EVENTS);
addPropertyToRequest(requestParams, "eligibleOnFirstCompleteEvent", properties, RETENTION_SCHEDULE.RETENTION_ELIGIBLE_FIRST_EVENT);
return doPostJsonRequest(user, password, SC_OK, requestParams, MessageFormat.format(DISPOSITION_ACTIONS_API, "{0}", catNodeRef));

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -36,7 +36,6 @@ import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.dataprep.ContentService;
import org.alfresco.rest.core.v0.BaseAPI;
import org.apache.chemistry.opencmis.client.api.CmisObject;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.http.HttpResponse;
import org.json.JSONException;
import org.json.JSONObject;
@@ -45,6 +44,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javafx.util.Pair;
/**
* Methods to make API requests using v0 API on records
*
@@ -321,13 +322,13 @@ public class RecordsAPI extends BaseAPI
{
if (response.has("sharedId"))
{
return Pair.of(true, response.getString("sharedId"));
return new Pair<>(true, response.getString("sharedId"));
}
} catch (JSONException e)
{
LOGGER.info("Unable to extract response parameter", e);
}
return Pair.of(false, String.valueOf(response.getJSONObject("status").getInt("code")));
return new Pair<>(false, String.valueOf(response.getJSONObject("status").getInt("code")));
}
/**
@@ -349,17 +350,4 @@ public class RecordsAPI extends BaseAPI
return doPostJsonRequest(user, password, SC_OK, requestParams, ACTIONS_API);
}
/**
* Retrieves the record's nodeRef
*
* @param username the user's username
* @param password its password
* @param recordName the record full name
* @param recordPath the String with which the record name starts
* @return the record nodeRef in case it exists, empty string otherwise
*/
public String getRecordNodeRef(String username, String password, String recordName, String recordPath)
{
return getNodeRefSpacesStore() + getItemNodeRef(username, password, recordPath + "/" + recordName);
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -36,7 +36,6 @@ import org.alfresco.rest.core.v0.BaseAPI;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -57,15 +56,12 @@ public class SearchAPI extends BaseAPI
/** faceted search API endpoint */
private static final String FACETED_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/faceted/rmsearch?{1}";
/** share live search API endpoint */
private static final String SHARE_LIVE_SEARCH_DOCS_ENDPOINT = "{0}alfresco/s/slingshot/live-search-docs?{1}";
/** RM search URL template */
private static final String RM_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/{1}?{2}";
/** RM all nodes search filters */
private static final String RM_DEFAULT_NODES_FILTERS =
"records/true,undeclared/true,vital/false,folders/{0},categories/{1},frozen/false,cutoff/false";
/** RM document search filters */
private static final String RM_DEFAULT_RECORD_FILTERS =
"records/true,undeclared/true,vital/false,folders/false,categories/false,frozen/false,cutoff/false";
/**
* Perform search request on search endpoint as a user.
@@ -91,7 +87,6 @@ public class SearchAPI extends BaseAPI
* @param site
* @param query
* @param filters
* @param sortby
* @return search results (see API reference for more details), null for any errors
*/
public JSONObject rmSearch(
@@ -99,16 +94,11 @@ public class SearchAPI extends BaseAPI
String password,
String site,
String query,
String filters,
String sortby)
String filters)
{
List<BasicNameValuePair> searchParameters = new ArrayList<BasicNameValuePair>();
searchParameters.add(new BasicNameValuePair("query", query));
searchParameters.add(new BasicNameValuePair("filters", filters));
if (sortby != null)
{
searchParameters.add(new BasicNameValuePair("sortby", sortby));
}
String requestURL = MessageFormat.format(
RM_SEARCH_ENDPOINT,
@@ -120,44 +110,22 @@ public class SearchAPI extends BaseAPI
}
/**
* Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted
* by sortby
* Search as a user for records on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS
* <br>
*
* If more fine-grained control of search parameters is required, use rmSearch() directly.
* @param username
* @param password
* @param query
* @param sortby
* @return list of node names
* @return list of record names
*/
public List<String> searchForNodeNamesAsUser(String username, String password, String query, String sortby,
boolean includeCategories, boolean includeFolders)
public List<String> searchForRecordsAsUser(
String username,
String password,
String query)
{
String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_NODES_FILTERS, Boolean.toString(includeFolders),
Boolean.toString(includeCategories));
return getItemNames(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby));
return getItemNames(rmSearch(username, password, "rm", query, RM_DEFAULT_RECORD_FILTERS));
}
/**
* Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted
* by sortby and returns the property value for the given nodeRef and property name
*
* @param username
* @param password
* @param query
* @param sortby
* @param includeCategories
* @param includeFolders
* @return list of node properties
*/
public String searchForNodePropertyAsUser(String username, String password, String nodeRef, String propertyName, String query, String sortby,
boolean includeCategories, boolean includeFolders)
{
String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_NODES_FILTERS, Boolean.toString(includeFolders),
Boolean.toString(includeCategories));
return getItemProperty(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby), nodeRef, propertyName);
}
/**
* Generic faceted search.
* @param username
@@ -170,20 +138,6 @@ public class SearchAPI extends BaseAPI
return facetedRequest(username, password, parameters, FACETED_SEARCH_ENDPOINT);
}
/**
* Execute share live search for documents.
*
* @param searchUser
* @param searchPassword
* @param searchTerm
* @return search results (see API reference for more details)
*/
public JSONObject liveSearchForDocuments(String searchUser, String searchPassword, String searchTerm)
{
return facetedRequest(searchUser, searchPassword, Arrays.asList(new BasicNameValuePair("t", searchTerm)),
SHARE_LIVE_SEARCH_DOCS_ENDPOINT);
}
/**
* Execute faceted search for term.
* @param searchUser
@@ -211,51 +165,14 @@ public class SearchAPI extends BaseAPI
return getItemNames(facetedSearchForTerm(username, password, term));
}
/**
* Helper method to search for documents as a user using share live search.
* @param username to search as
* @param password for username
* @param term search term
* @return list of document names found
*/
public List<String> liveSearchForDocumentsAsUser(String username, String password, String term) throws JSONException
{
JSONObject searchResult = liveSearchForDocuments(username, password, term);
LOGGER.info(searchResult.toString(3));
return getItemNames(searchResult);
}
/**
* Helper method to extract list of names from search result.
*
* @param searchResult
* @return list of document or record names in search result
* @throws FileNotFoundException
* @throws JsonSyntaxException
* @throws JsonIOException
* @throws RuntimeException for malformed search response
*/
/**
* Helper method to extract list of names from search result.
*
* @param searchResult
* @param getProperties
* @return
*/
private List<String> getItemNames(JSONObject searchResult)
{
return getPropertyValues(searchResult, "name");
}
/**
* Helper method to extract list of property values from search result for the given nodeRef.
*
* @param searchResult
* @param getProperties
* @return
*/
private String getItemProperty(JSONObject searchResult, String nodeRef, String propertyName)
{
return getPropertyValue(searchResult, nodeRef, propertyName);
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -

View File

@@ -1,139 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.v0.service;
import java.util.HashMap;
import org.alfresco.rest.core.v0.BaseAPI;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
import org.alfresco.rest.v0.RecordCategoriesAPI;
import org.alfresco.utility.data.DataUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service for different disposition schedule actions
*
* @author jcule
* @since 2.7.0.1
*/
@Service
public class DispositionScheduleService extends BaseAPI
{
@Autowired
private RecordCategoriesAPI recordCategoriesAPI;
@Autowired
private DataUser dataUser;
/**
* Helper method for adding a cut off after period step
*
* @param categoryName the category in whose schedule the step will be added
* @param period
* @return
*/
public void addCutOffAfterPeriodStep(String categoryName, String period)
{
HashMap<RETENTION_SCHEDULE, String> cutOffStep = new HashMap<>();
cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff");
cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after a period step");
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), categoryName, cutOffStep);
}
/**
* Helper method for adding a cut off after an event occurs step
*
* @param categoryName the category in whose schedule the step will be added
* @param events
*/
public void addCutOffAfterEventStep(String categoryName, String events)
{
HashMap<RETENTION_SCHEDULE, String> cutOffStep = new HashMap<>();
cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff");
cutOffStep.put(RETENTION_SCHEDULE.RETENTION_EVENTS, events);
cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after event step");
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), categoryName, cutOffStep);
}
/**
* Helper method for adding an accession step
*
* @param timeOrEvent
* @param events
* @param period
* @param periodProperty
* @param combineConditions
* @return
*/
public void addAccessionStep(String categoryName, Boolean timeOrEvent, String events, String period, String
periodProperty, Boolean combineConditions)
{
HashMap<RETENTION_SCHEDULE, String> accessionStep = new HashMap<>();
accessionStep.put(RETENTION_SCHEDULE.NAME, "accession");
accessionStep.put(RETENTION_SCHEDULE.COMBINE_DISPOSITION_STEP_CONDITIONS, Boolean.toString(combineConditions));
accessionStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
accessionStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD_PROPERTY, periodProperty);
if (!timeOrEvent)
{
accessionStep.put(RETENTION_SCHEDULE.RETENTION_ELIGIBLE_FIRST_EVENT, Boolean.toString(timeOrEvent));
}
accessionStep.put(RETENTION_SCHEDULE.RETENTION_EVENTS, events);
accessionStep.put(RETENTION_SCHEDULE.DESCRIPTION,
"Accession step with time and event conditions.");
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), categoryName, accessionStep);
}
/**
* Helper method to create retention schedule with general fields for the given category as admin
* and apply it to the records
*
* @param categoryName
* @param appliedToRecords
*/
public void createCategoryRetentionSchedule(String categoryName, Boolean appliedToRecords)
{
recordCategoriesAPI.createRetentionSchedule(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), categoryName);
String retentionScheduleNodeRef = recordCategoriesAPI.getDispositionScheduleNodeRef(
dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), categoryName);
HashMap<RETENTION_SCHEDULE, String> retentionScheduleGeneralFields = new HashMap<>();
retentionScheduleGeneralFields.put(RETENTION_SCHEDULE.RETENTION_AUTHORITY, "Authority");
retentionScheduleGeneralFields.put(RETENTION_SCHEDULE.RETENTION_INSTRUCTIONS, "Instructions");
recordCategoriesAPI.setRetentionScheduleGeneralFields(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), retentionScheduleNodeRef, retentionScheduleGeneralFields,
appliedToRecords);
}
}

View File

@@ -1,84 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.v0.service;
import java.util.HashSet;
import java.util.Set;
import org.alfresco.rest.rm.community.model.user.UserRoles;
import org.alfresco.rest.v0.RMRolesAndActionsAPI;
import org.alfresco.utility.data.DataUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Produces processed results from roles API calls
*
* @author Rodica Sutu
* @since 2.6
*/
@Service
public class RoleService
{
@Autowired
private RMRolesAndActionsAPI rmRolesAndActionsAPI;
@Autowired
private DataUser dataUser;
/**
* Add capabilities to a role
*
* @param role role to be updated
* @param capabilities list of capabilities to be added
*/
public void addCapabilitiesToRole(UserRoles role, Set<String> capabilities)
{
Set<String> roleCapabilities = new HashSet<>();
roleCapabilities.addAll(rmRolesAndActionsAPI.getCapabilitiesForRole(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), role.roleId));
capabilities.stream().forEach(cap -> roleCapabilities.add(cap));
rmRolesAndActionsAPI.updateRole(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
role.roleId, role.displayName, roleCapabilities);
}
/**
* Remove capabilities from a role
*
* @param role role to be updated
* @param capabilities list of capabilities to be removed
*/
public void removeCapabilitiesFromRole(UserRoles role, Set<String> capabilities)
{
Set<String> roleCapabilities = rmRolesAndActionsAPI.getCapabilitiesForRole(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), role.roleId);
roleCapabilities.removeAll(capabilities);
rmRolesAndActionsAPI.updateRole(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
role.roleId, role.displayName, roleCapabilities);
}
}

View File

@@ -1,174 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General 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.audit;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_USER_GROUP;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_USER_GROUP;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.DELETE_USER_GROUP;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_USER_GROUP;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.testng.AssertJUnit.assertTrue;
import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.audit.AuditEntry;
import org.alfresco.rest.v0.RMAuditAPI;
import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.model.GroupModel;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* This class contains the tests that check the group events are audited
*
* @author Claudia Agache
* @since 2.7
*/
@AlfrescoTest (jira = "RM-5236")
public class AuditGroupEventsTests extends BaseRMRestTest
{
@Autowired
private RMAuditAPI rmAuditAPI;
private GroupModel testGroup;
private UserModel testUser;
@BeforeClass (alwaysRun = true)
public void cleanAuditLogs()
{
//clean audit logs
rmAuditAPI.clearAuditLog(getAdminUser().getUsername(), getAdminUser().getPassword());
}
/**
* Given I have created a new group
* When I view the RM audit
* Then there is an entry showing that I created a group
*/
@Test
public void createGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
STEP("Get the list of audit entries for the create group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, CREATE_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the created group.");
assertTrue("The list of events is not filtered by " + CREATE_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(CREATE_USER_GROUP.eventDisplayName)));
assertTrue("The group name for the new group created is not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(CREATE_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())));
}
/**
* Given I have added a user to a group
* When I view the RM audit
* Then there is an entry showing that I have added a user to a group
*/
@Test
public void addUserToGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
testUser = getDataUser().createRandomTestUser();
dataGroup.usingUser(testUser).addUserToGroup(testGroup);
STEP("Get the list of audit entries for the add user to group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, ADD_TO_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the add user to group event.");
assertTrue("The list of events is not filtered by " + ADD_TO_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(ADD_TO_USER_GROUP.eventDisplayName)));
assertTrue("The username and destination group are not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(ADD_TO_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", testUser.getUsername(), "previous", "", "name", "User Name"))
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", testGroup.getGroupIdentifier(), "previous", "", "name", "Parent Group"))));
}
/**
* Given I have removed a user from a group
* When I view the RM audit
* Then there is an entry showing that I have removed a user from a group
*/
@Test
public void removeUserFromGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
testUser = getDataUser().createRandomTestUser();
dataGroup.usingUser(testUser).addUserToGroup(testGroup);
dataGroup.removeUserFromGroup(testGroup, testUser);
STEP("Get the list of audit entries for the add user to group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, REMOVE_FROM_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the remove user from group event.");
assertTrue("The list of events is not filtered by " + REMOVE_FROM_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(REMOVE_FROM_USER_GROUP.eventDisplayName)));
assertTrue("The username and previous parent group are not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(REMOVE_FROM_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", "", "previous", testUser.getUsername(), "name", "User Name"))
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", "","previous", testGroup.getGroupIdentifier(), "name", "Parent Group"))));
}
/**
* Given I have deleted a group
* When I view the RM audit
* Then there is an entry showing that I have deleted a group
*/
@Test
public void deleteGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
dataGroup.deleteGroup(testGroup);
STEP("Get the list of audit entries for the delete group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, DELETE_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the created group.");
assertTrue("The list of events is not filtered by " + DELETE_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(DELETE_USER_GROUP.eventDisplayName)));
assertTrue("The group name for the deleted group is not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(DELETE_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", "", "previous", testGroup.getGroupIdentifier(), "name", "authorityDisplayName"))));
}
}

Some files were not shown because too many files have changed in this diff Show More