mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
291 Commits
tas-restap
...
tas-restap
Author | SHA1 | Date | |
---|---|---|---|
|
fcc1eef0f5 | ||
|
f757fb6be8 | ||
|
439c578b8d | ||
|
55c53a6789 | ||
|
ea1d13a5a6 | ||
|
0b0b89a1be | ||
|
3e7200d65f | ||
|
9ed945504f | ||
|
ab18be55a4 | ||
|
80548d0c3f | ||
|
11a8824fd3 | ||
|
a73610c143 | ||
|
d43872a4ab | ||
|
7a66b812bb | ||
|
732fa806e7 | ||
|
c9d115664b | ||
|
0f1f67230f | ||
|
5f303be26d | ||
|
9d27f2099a | ||
|
0588182c81 | ||
|
85cdad32d0 | ||
|
976670de8a | ||
|
a5dc3d767c | ||
|
42a42fd941 | ||
|
709ebd2e12 | ||
|
6e27433ac5 | ||
|
2d7697bf2c | ||
|
a47409268f | ||
|
db7f49afbd | ||
|
b324c07568 | ||
|
63a47002f9 | ||
|
31e557261e | ||
|
5eb54e9b0c | ||
|
f7642f99f2 | ||
|
c9f6f1bdd4 | ||
|
9c54707ad8 | ||
|
52e5b2bc8a | ||
|
62cc9419c6 | ||
|
8a0f3849ff | ||
|
55e6f1c9b1 | ||
|
d62b8b0942 | ||
|
b2c38d9bb0 | ||
|
d16d88cd22 | ||
|
c8a3ce3af5 | ||
|
fc4a47a71a | ||
|
d6a3d3db2a | ||
|
45b9f63351 | ||
|
84269b568f | ||
|
b9ee972ff2 | ||
|
c95be234a0 | ||
|
bcd304abab | ||
|
170e82ad75 | ||
|
8c6cebec1d | ||
|
d822a4d7ac | ||
|
a9d9daf6bb | ||
|
9bfbc3a623 | ||
|
7bd1efb1f0 | ||
|
6b1b240da7 | ||
|
e9ce710f3c | ||
|
26d29b0bc0 | ||
|
df8e315d48 | ||
|
458a8c17ff | ||
|
0cecb28903 | ||
|
19584814f0 | ||
|
4ac6cf4088 | ||
|
04225ce5ef | ||
|
c7464e7501 | ||
|
793ff892b7 | ||
|
7c6d35d38c | ||
|
b2dc3fa5cd | ||
|
54c91e8770 | ||
|
da2db2c339 | ||
|
84b62f2386 | ||
|
bcc3c30985 | ||
|
c457fafc1b | ||
|
fcf7d017b0 | ||
|
94be653375 | ||
|
d9c37d5f9f | ||
|
2555ff04f6 | ||
|
668e14182f | ||
|
e0e27f6448 | ||
|
0c7fe86cc0 | ||
|
c631cdba82 | ||
|
aabbcf449f | ||
|
ec4958a6e2 | ||
|
751643bac1 | ||
|
08b603cc33 | ||
|
410759bb37 | ||
|
29b25ea8ce | ||
|
cd6c38347f | ||
|
5ce6a774cc | ||
|
13529c0408 | ||
|
718968e77f | ||
|
2b59c3ad71 | ||
|
4c984b3b52 | ||
|
764e47b472 | ||
|
0c24c55296 | ||
|
5d74ca8323 | ||
|
a45137fc48 | ||
|
3595ffd7cf | ||
|
586f5f546c | ||
|
f129a47be0 | ||
|
f8287e59e2 | ||
|
79c7310a34 | ||
|
5039d4d0d0 | ||
|
f68299aa37 | ||
|
e63b0a8751 | ||
|
3d2b7a733a | ||
|
4bcffcd820 | ||
|
c552a7b660 | ||
|
3f41f8e4eb | ||
|
71ed6d1155 | ||
|
c04a83e3c2 | ||
|
e946bfcf71 | ||
|
1cee8f46bd | ||
|
dfb05bb00e | ||
|
c33dde8f41 | ||
|
f93d07d116 | ||
|
a88d0b07f2 | ||
|
da6e08b0e3 | ||
|
48c0546bd0 | ||
|
2c0fb3fe95 | ||
|
ea308c1c0a | ||
|
a02f0e7e2f | ||
|
9f32368582 | ||
|
b42b08559a | ||
|
95af4d6876 | ||
|
9c17870040 | ||
|
e93028c30e | ||
|
7741456b79 | ||
|
27f7b2ec33 | ||
|
078ae4cd32 | ||
|
ab3a0f00c4 | ||
|
829c7ef65d | ||
|
0d40d455b2 | ||
|
3d91bf154d | ||
|
d87532ce55 | ||
|
e6f97e979a | ||
|
b800d4b7e4 | ||
|
92bad68c5b | ||
|
d77e02f9a8 | ||
|
8a6584540f | ||
|
2dec33388e | ||
|
2c149b412e | ||
|
10b427209d | ||
|
a53eb13f9f | ||
|
c0a90dd32b | ||
|
d2a414f8a7 | ||
|
e484360980 | ||
|
691855bed2 | ||
|
e81a33d770 | ||
|
9dab62b490 | ||
|
44f602eee4 | ||
|
c04c149779 | ||
|
9cfa31ca63 | ||
|
a061d8d4df | ||
|
8052f7f299 | ||
|
962ce7a740 | ||
|
57603871d3 | ||
|
7d7cc446a4 | ||
|
2733ece40f | ||
|
f01204bf0a | ||
|
add073938a | ||
|
472becd973 | ||
|
d9293fff27 | ||
|
361e6b0221 | ||
|
3aec98cb92 | ||
|
cfd0dd388e | ||
|
8aadb2baf1 | ||
|
ca6b4cce24 | ||
|
eb2c76f600 | ||
|
fa910faea6 | ||
|
d428c542fc | ||
|
d0d5ce8d9d | ||
|
3e4a3a0a31 | ||
|
7d5f01f3d5 | ||
|
1ae1f87cdf | ||
|
a5ceb3df00 | ||
|
18dc254813 | ||
|
b737775fd3 | ||
|
175a525b64 | ||
|
8dba7f9468 | ||
|
838794f274 | ||
|
917961569d | ||
|
8e1c10aae0 | ||
|
580dda50e6 | ||
|
d0bc3f1ece | ||
|
a05f2eb20f | ||
|
51029868a9 | ||
|
e0b1c6f776 | ||
|
9930f18291 | ||
|
ca785cda74 | ||
|
308a60dcfa | ||
|
2518910fe1 | ||
|
4ddfb16bff | ||
|
ffb4df068b | ||
|
7fdb040b50 | ||
|
c2e587d640 | ||
|
bed12e40ca | ||
|
a53daf152f | ||
|
cc03aaf92f | ||
|
f9102eae0d | ||
|
8f252b69f1 | ||
|
50f884556c | ||
|
b1ad95a756 | ||
|
581f82f332 | ||
|
80fda4ed56 | ||
|
086ca9229e | ||
|
6d84baa34e | ||
|
d048054903 | ||
|
faf6cafe5a | ||
|
13a134da27 | ||
|
5e93e937f9 | ||
|
36c830ecdb | ||
|
013f3fac1c | ||
|
ec675d6123 | ||
|
e115c673e1 | ||
|
2453b3c9c7 | ||
|
761554ad83 | ||
|
20738f6ac5 | ||
|
1a90c129bc | ||
|
76ba1ce813 | ||
|
91bb8651d3 | ||
|
bbdc41555c | ||
|
1d77e2e852 | ||
|
8155132d69 | ||
|
d0e94e0d68 | ||
|
5c50dbef83 | ||
|
ef6d2531fb | ||
|
0c3c584ed9 | ||
|
516d15796f | ||
|
c2a2541a62 | ||
|
397979a4f9 | ||
|
ec85dd7e61 | ||
|
69ccd06cf2 | ||
|
6002440be5 | ||
|
1973a9d578 | ||
|
8d1e16e9c2 | ||
|
9e0b26f612 | ||
|
9080d3e0d9 | ||
|
f916a625d0 | ||
|
e0c278e277 | ||
|
bb64b05534 | ||
|
28be182040 | ||
|
ee88b0bf0c | ||
|
cd60067bbf | ||
|
bd64391527 | ||
|
126ece3dbe | ||
|
f7b7eeaf56 | ||
|
53937c963c | ||
|
671116b500 | ||
|
82369a3dcf | ||
|
9e9caec601 | ||
|
27caf48c79 | ||
|
e1b1e66e8d | ||
|
9186cead13 | ||
|
6c2d084209 | ||
|
81e0cb939d | ||
|
2bd64e48b5 | ||
|
3d6c34c8d6 | ||
|
506dd32b31 | ||
|
70ed927b3c | ||
|
3c818df7f1 | ||
|
612b65798e | ||
|
d0724a0a06 | ||
|
beea540ad0 | ||
|
099e1328c0 | ||
|
0f01dea5d2 | ||
|
38edaf79c2 | ||
|
d7e7545482 | ||
|
2cdcc7d5ce | ||
|
de7431b917 | ||
|
14e500cb1f | ||
|
4c37f4cda6 | ||
|
8470a1962b | ||
|
914ad394c3 | ||
|
1668baac05 | ||
|
17118db32f | ||
|
13f6aa2044 | ||
|
f6b3b62841 | ||
|
46c59e50f6 | ||
|
7870db5370 | ||
|
78a8d8d6cb | ||
|
60083c6145 | ||
|
c9a6c633ed | ||
|
1de92e61c4 | ||
|
e246eb31cf | ||
|
4261615fb4 | ||
|
6cc81beab5 | ||
|
9a77903d8c | ||
|
0049eefcdb |
22
packaging/tests/tas-restapi/.github/dependabot.yml
vendored
Normal file
22
packaging/tests/tas-restapi/.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
version: 2
|
||||
registries:
|
||||
maven-alfresco-internal:
|
||||
type: maven-repository
|
||||
url: https://artifacts.alfresco.com/nexus/content/groups/internal
|
||||
username: ${{secrets.NEXUS_USERNAME}}
|
||||
password: ${{secrets.NEXUS_PASSWORD}}
|
||||
updates:
|
||||
- package-ecosystem: maven
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "22:00"
|
||||
timezone: Europe/London
|
||||
open-pull-requests-limit: 99
|
||||
registries:
|
||||
- maven-alfresco-internal
|
||||
ignore:
|
||||
# httpclient 4.5.7 and above normalize URIs removing empty path params
|
||||
# check https://alfresco.atlassian.net/browse/ACS-3186 for more details
|
||||
- dependency-name: "org.apache.httpcomponents:httpclient-osgi"
|
||||
versions: ">= 4.5.7"
|
@@ -1,4 +1,4 @@
|
||||
dist: trusty
|
||||
dist: focal
|
||||
sudo: required
|
||||
language: java
|
||||
jdk:
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
include:
|
||||
- stage: test
|
||||
name: "Build and test"
|
||||
script: travis_retry mvn test
|
||||
script: travis_retry mvn test -Dtest=ModelAssertionTest
|
||||
- stage: release
|
||||
name: "Push to Nexus"
|
||||
if: fork = false AND branch = master AND type != pull_request AND commit_message !~ /\[no-release\]/
|
||||
@@ -31,5 +31,7 @@ jobs:
|
||||
script:
|
||||
# Use full history for release
|
||||
- git checkout -B "${TRAVIS_BRANCH}"
|
||||
# Add email to link commits to user
|
||||
- git config user.email "${GIT_EMAIL}"
|
||||
# Skip building of release commits
|
||||
- mvn --batch-mode -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform
|
||||
- mvn --batch-mode -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform
|
||||
|
@@ -20,7 +20,7 @@ Back to [TAS Master Documentation](https://git.alfresco.com/tas/alfresco-tas-uti
|
||||
* [Configuration](#configuration)
|
||||
* [How to enable Test Rail Integration?](#how-to-enable-test-rail-integration)
|
||||
* [Reference](#reference)
|
||||
* [Change Log](docs/CHANGELOG.md) :glowing_star:
|
||||
* [Change Log](docs/CHANGELOG.md) 🌟
|
||||
* [Contributors](#contributors)
|
||||
* [Releasing](#releasing)
|
||||
* [License](#license)
|
||||
|
@@ -4,11 +4,11 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>restapi</artifactId>
|
||||
<name>alfresco-tas-restapi</name>
|
||||
<version>1.5</version>
|
||||
<version>1.93</version>
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-super-pom</artifactId>
|
||||
<version>10</version>
|
||||
<version>12</version>
|
||||
</parent>
|
||||
|
||||
<organization>
|
||||
@@ -28,29 +28,45 @@
|
||||
<suiteXmlFile>src/main/resources/shared-resources/testCount.xml</suiteXmlFile>
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<tas.utility.version>2.0.25</tas.utility.version>
|
||||
<tas.utility.version>3.0.48</tas.utility.version>
|
||||
<rest-assured.version>3.3.0</rest-assured.version>
|
||||
<httpclient-osgi-version>4.5.2</httpclient-osgi-version>
|
||||
<httpclient-osgi-version>4.5.6</httpclient-osgi-version>
|
||||
<json-path.version>3.3.0</json-path.version>
|
||||
<xml-path.version>3.3.0</xml-path.version>
|
||||
<json-schema-validator.version>3.3.0</json-schema-validator.version>
|
||||
<jackson-databind.version>2.9.8</jackson-databind.version>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
<jackson-databind.version>2.13.3</jackson-databind.version>
|
||||
<maven-release.version>2.5.3</maven-release.version>
|
||||
<org.glassfish.version>1.0.4</org.glassfish.version>
|
||||
<maven-remote-resources.version>1.6.0</maven-remote-resources.version>
|
||||
<commons-lang3.version>3.8</commons-lang3.version>
|
||||
<scribejava-apis.version>6.5.1</scribejava-apis.version>
|
||||
<org.glassfish.version>1.1.4</org.glassfish.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<scribejava-apis.version>8.3.1</scribejava-apis.version>
|
||||
<test.exclude />
|
||||
<test.include />
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>rest-api-explorer-master</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<rest.api.explorer.branch>master</rest.api.explorer.branch>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>rest-api-explorer-52N</id>
|
||||
<properties>
|
||||
<rest.api.explorer.branch>5.2.N</rest.api.explorer.branch>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-tas-restapi.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-tas-restapi.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-tas-restapi</url>
|
||||
<tag>v1.5</tag>
|
||||
<tag>v1.93</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
@@ -95,39 +111,6 @@
|
||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-remote-resources-plugin</artifactId>
|
||||
<version>${maven-remote-resources.version}</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>shared-resources/**/*</include>
|
||||
</includes>
|
||||
<resourceBundles>
|
||||
<resourceBundle>org.alfresco.tas:utility:${tas.utility.version}</resourceBundle>
|
||||
</resourceBundles>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>process</goal>
|
||||
<goal>bundle</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
@@ -155,26 +138,14 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<arguments>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/5.2.N/src/main/webapp/definitions/alfresco-auth.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/5.2.N/src/main/webapp/definitions/alfresco-core.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/5.2.N/src/main/webapp/definitions/alfresco-discovery.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/5.2.N/src/main/webapp/definitions/alfresco-search.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/5.2.N/src/main/webapp/definitions/alfresco-workflow.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-auth.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-core.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-discovery.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-search.yaml</argument>
|
||||
<argument>https://raw.githubusercontent.com/Alfresco/rest-api-explorer/${rest.api.explorer.branch}/src/main/webapp/definitions/alfresco-workflow.yaml</argument>
|
||||
</arguments>
|
||||
<mainClass>org.alfresco.rest.core.swagger.Generator</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -196,14 +167,6 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>shared-resources/**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
@@ -212,7 +175,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -310,14 +273,14 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.36</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger parser -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-parser</artifactId>
|
||||
<version>1.0.23</version>
|
||||
<version>1.0.61</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
@@ -329,7 +292,7 @@
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--fixing java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap') -->
|
||||
@@ -337,14 +300,14 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>2.5.5</version>
|
||||
<version>3.0.11</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>2.5.5</version>
|
||||
<version>3.0.11</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
@@ -354,7 +317,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.4.0</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
|
@@ -14,7 +14,7 @@ public abstract class NetworkDataPrep extends RestTest
|
||||
protected static String tenantDomain;
|
||||
private static boolean isInitialized = false;
|
||||
|
||||
public void init() throws Exception
|
||||
public void init()
|
||||
{
|
||||
if(!isInitialized)
|
||||
{
|
||||
@@ -23,7 +23,7 @@ public abstract class NetworkDataPrep extends RestTest
|
||||
}
|
||||
}
|
||||
|
||||
public void initialization() throws Exception
|
||||
public void initialization()
|
||||
{
|
||||
adminUserModel = dataUser.getAdminUser();
|
||||
//create first tenant Admin User.
|
||||
|
@@ -64,9 +64,16 @@ public abstract class RestTest extends AbstractTestNGSpringContextTests
|
||||
protected SiteModel testSite;
|
||||
|
||||
@BeforeSuite(alwaysRun = true)
|
||||
public void checkServerHealth() throws Exception
|
||||
public void checkServerHealth()
|
||||
{
|
||||
super.springTestContextPrepareTestInstance();
|
||||
try
|
||||
{
|
||||
super.springTestContextPrepareTestInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new IllegalStateException("Error while preparing for test execution", e);
|
||||
}
|
||||
serverHealth.assertServerIsOnline();
|
||||
testSite = dataSite.createPublicRandomSite();
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import org.alfresco.dataprep.CMISUtil.Priority;
|
||||
import org.alfresco.rest.model.RestProcessVariableModel;
|
||||
import org.alfresco.rest.model.RestVariableModel;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.RepoTestModel;
|
||||
@@ -149,7 +150,7 @@ public class JsonBodyGenerator
|
||||
}
|
||||
|
||||
|
||||
public static String siteMember(UserModel userModel) throws Exception
|
||||
public static String siteMember(UserModel userModel)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(userModel.getUserRole(), "userModel.getUserRole()");
|
||||
JsonObject value = defineJSON()
|
||||
@@ -158,6 +159,15 @@ public class JsonBodyGenerator
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public static String siteGroup(String authorityId, UserRole role)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(authorityId, "authorityId");
|
||||
JsonObject value = defineJSON()
|
||||
.add("role", role.name())
|
||||
.add("id", authorityId).build();
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public static String siteMemberhipRequest(String message, SiteModel siteModel, String title)
|
||||
{
|
||||
JsonObject value = defineJSON()
|
||||
@@ -166,6 +176,19 @@ public class JsonBodyGenerator
|
||||
.add("title", title).build();
|
||||
return value.toString();
|
||||
}
|
||||
/**
|
||||
* Method to create a Json object for SiteBody with site title, description, visibility
|
||||
* @param siteModel
|
||||
* @return String
|
||||
*/
|
||||
public static String updateSiteRequest(SiteModel siteModel)
|
||||
{
|
||||
JsonObject value = defineJSON()
|
||||
.add("title", siteModel.getTitle())
|
||||
.add("description", siteModel.getDescription())
|
||||
.add("visibility", siteModel.getVisibility().toString()).build();
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public static String process(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority)
|
||||
{
|
||||
|
@@ -36,12 +36,14 @@ import org.alfresco.rest.requests.authAPI.RestAuthAPI;
|
||||
import org.alfresco.rest.requests.cmisAPI.RestCmisAPI;
|
||||
import org.alfresco.rest.requests.coreAPI.RestCoreAPI;
|
||||
import org.alfresco.rest.requests.discoveryAPI.RestDiscoveryAPI;
|
||||
import org.alfresco.rest.requests.modelAPI.RestModelAPI;
|
||||
import org.alfresco.rest.requests.privateAPI.RestPrivateAPI;
|
||||
import org.alfresco.rest.requests.search.SearchAPI;
|
||||
import org.alfresco.rest.requests.search.SearchSQLAPI;
|
||||
import org.alfresco.rest.requests.search.SearchSQLJDBC;
|
||||
import org.alfresco.rest.requests.search.ShardInfoAPI;
|
||||
import org.alfresco.rest.requests.search.SolrAPI;
|
||||
import org.alfresco.rest.requests.search.SolrAdminAPI;
|
||||
import org.alfresco.rest.requests.workflowAPI.RestWorkflowAPI;
|
||||
import org.alfresco.utility.LogFactory;
|
||||
import org.alfresco.utility.Utility;
|
||||
@@ -96,6 +98,23 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
private RequestSpecBuilder requestSpecBuilder = new RequestSpecBuilder();
|
||||
private Headers responseHeaders;
|
||||
private RestResponse response;
|
||||
private String serverURI;
|
||||
private int serverPort;
|
||||
|
||||
/**
|
||||
* After configuring {@link #setServerURI(String)} and {@link #setServerPort(int)} call {@link #configureServerEndpoint()}
|
||||
*
|
||||
* @param serverURI in format of "http://localhost", without port. Set port via {@link #setServerPort(int)}
|
||||
*/
|
||||
public void setServerURI(String serverURI)
|
||||
{
|
||||
this.serverURI = serverURI;
|
||||
}
|
||||
|
||||
public void setServerPort(int serverPort)
|
||||
{
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RestAisAuthentication aisAuthentication;
|
||||
@@ -131,11 +150,9 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
@PostConstruct
|
||||
public void initializeRequestSpecBuilder()
|
||||
{
|
||||
requestSpecBuilder = new RequestSpecBuilder();
|
||||
RestAssured.baseURI = restProperties.envProperty().getTestServerUrl();
|
||||
RestAssured.port = restProperties.envProperty().getPort();
|
||||
configureRequestSpec().setBaseUri(restProperties.envProperty().getTestServerUrl());
|
||||
configureRequestSpec().setPort(restProperties.envProperty().getPort());
|
||||
this.serverURI = restProperties.envProperty().getTestServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,28 +246,7 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
public <T> T processModels(Class<T> classz, RestRequest restRequest)
|
||||
throws EmptyJsonResponseException, JsonToModelConversionException
|
||||
{
|
||||
Response returnedResponse = sendRequest(restRequest);
|
||||
|
||||
setStatusCode(String.valueOf(returnedResponse.getStatusCode()));
|
||||
|
||||
boolean responseHasErrors = checkForJsonError(returnedResponse);
|
||||
boolean responseHasExceptions = checkForJsonStatusException(returnedResponse);
|
||||
|
||||
T models = null;
|
||||
|
||||
if (!responseHasExceptions && !responseHasErrors)
|
||||
{
|
||||
try
|
||||
{
|
||||
models = returnedResponse.jsonPath().getObject("list", classz);
|
||||
validateJsonModelSchema(classz, models);
|
||||
}
|
||||
catch (Exception processError)
|
||||
{
|
||||
processError.printStackTrace();
|
||||
throw new JsonToModelConversionException(classz, processError);
|
||||
}
|
||||
}
|
||||
T models = callAPIAndCreateModel(classz, restRequest, "list");
|
||||
|
||||
if (models == null)
|
||||
{
|
||||
@@ -276,27 +272,8 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
public <T> T processModel(Class<T> classz, RestRequest restRequest)
|
||||
throws EmptyJsonResponseException, JsonToModelConversionException
|
||||
{
|
||||
Response returnedResponse = sendRequest(restRequest);
|
||||
T model = callAPIAndCreateModel(classz, restRequest, "entry");
|
||||
|
||||
setStatusCode(String.valueOf(returnedResponse.getStatusCode()));
|
||||
|
||||
boolean responseHasErrors = checkForJsonError(returnedResponse);
|
||||
boolean responseHasExceptions = checkForJsonStatusException(returnedResponse);
|
||||
|
||||
T model = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (!responseHasExceptions && !responseHasErrors)
|
||||
{
|
||||
model = returnedResponse.jsonPath().getObject("entry", classz);
|
||||
validateJsonModelSchema(classz, model);
|
||||
}
|
||||
}
|
||||
catch (Exception processError)
|
||||
{
|
||||
throw new JsonToModelConversionException(classz, processError);
|
||||
}
|
||||
if (model == null)
|
||||
{
|
||||
try
|
||||
@@ -312,6 +289,41 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the request and convert the response to the appropriate model.
|
||||
*
|
||||
* @param classz The class of the model to create.
|
||||
* @param restRequest The request to send.
|
||||
* @param path The path to the part of the response from which the model should be populated.
|
||||
* @return The populated model object.
|
||||
*/
|
||||
private <T> T callAPIAndCreateModel(Class<T> classz, RestRequest restRequest, String path)
|
||||
{
|
||||
Response returnedResponse = sendRequest(restRequest);
|
||||
|
||||
setStatusCode(String.valueOf(returnedResponse.getStatusCode()));
|
||||
|
||||
boolean responseHasErrors = checkForJsonError(returnedResponse);
|
||||
boolean responseHasExceptions = checkForJsonStatusException(returnedResponse);
|
||||
|
||||
T models = null;
|
||||
|
||||
if (!responseHasExceptions && !responseHasErrors)
|
||||
{
|
||||
try
|
||||
{
|
||||
models = returnedResponse.jsonPath().getObject(path, classz);
|
||||
validateJsonModelSchema(classz, models);
|
||||
}
|
||||
catch (Exception processError)
|
||||
{
|
||||
processError.printStackTrace();
|
||||
throw new JsonToModelConversionException(classz, processError);
|
||||
}
|
||||
}
|
||||
return models;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process responses for a single model as {@link RestSiteModel}
|
||||
*
|
||||
@@ -348,10 +360,8 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
/**
|
||||
* Process responses for site relations models, such as {@link RestSiteModel, RestSiteContainerModelsCollection, RestSiteMemberModelsCollection}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Object> processRelationsJson(RestRequest restRequest) throws Exception
|
||||
public List<Object> processRelationsJson(RestRequest restRequest)
|
||||
{
|
||||
List<Object> jsonObjects = new ArrayList<Object>();
|
||||
Response returnedResponse = sendRequest(restRequest);
|
||||
@@ -401,10 +411,8 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
/**
|
||||
* Process responses for site relations models, such as {@link RestSiteModel, RestSiteContainerModelsCollection, RestSiteMemberModelsCollection}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<List<Object>> processSitesRelationsJson(RestRequest restRequest) throws Exception
|
||||
public List<List<Object>> processSitesRelationsJson(RestRequest restRequest)
|
||||
{
|
||||
List<List<Object>> allObjects = new ArrayList<List<Object>>();
|
||||
List<Object> sitesList = new ArrayList<Object>();
|
||||
@@ -621,7 +629,7 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
logResponseInformation(restRequest, returnedResponse);
|
||||
|
||||
initializeRequestSpecBuilder();
|
||||
configureServerEndpoint();
|
||||
response = new RestResponse(returnedResponse);
|
||||
return returnedResponse;
|
||||
}
|
||||
@@ -920,6 +928,11 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
return new RestAuthAPI(this);
|
||||
}
|
||||
|
||||
public RestModelAPI withModelAPI()
|
||||
{
|
||||
return new RestModelAPI(this);
|
||||
}
|
||||
|
||||
public SearchAPI withSearchAPI()
|
||||
{
|
||||
return new SearchAPI(this);
|
||||
@@ -944,6 +957,11 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
{
|
||||
return new SolrAPI(this);
|
||||
}
|
||||
|
||||
public SolrAdminAPI withSolrAdminAPI()
|
||||
{
|
||||
return new SolrAdminAPI(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link RestDiscoveryAPI} using the rest Discovery API as prefix: {@link /alfresco/api/discovery}
|
||||
@@ -1096,17 +1114,56 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
||||
|
||||
public void configureSyncServiceEndPoint()
|
||||
{
|
||||
RestAssured.baseURI = restProperties.envProperty().getSyncServerUrl();
|
||||
RestAssured.port = restProperties.envProperty().getSyncPort();
|
||||
configureRequestSpec().setBaseUri(restProperties.envProperty().getSyncServerUrl());
|
||||
configureRequestSpec().setPort(restProperties.envProperty().getSyncPort());
|
||||
this.serverURI = restProperties.envProperty().getSyncServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getSyncPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
|
||||
public void configureSolrEndPoint()
|
||||
{
|
||||
RestAssured.baseURI = restProperties.envProperty().getSolrServerUrl();
|
||||
RestAssured.port = restProperties.envProperty().getSolrPort();
|
||||
configureRequestSpec().setBaseUri(restProperties.envProperty().getSolrServerUrl());
|
||||
configureRequestSpec().setPort(restProperties.envProperty().getSolrPort());
|
||||
this.serverURI = restProperties.envProperty().getSolrServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getSolrPort();
|
||||
configureServerEndpoint();
|
||||
configureSecretHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the secret Solr header if it has been set
|
||||
*/
|
||||
private void configureSecretHeader()
|
||||
{
|
||||
String solrSecret = restProperties.envProperty().getSolrSecret();
|
||||
if(!solrSecret.isEmpty())
|
||||
{
|
||||
String solrSecretName = restProperties.envProperty().getSolrSecretName();
|
||||
configureRequestSpec().addHeader(solrSecretName, solrSecret);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link #setServerURI(String)} and {@link #setServerPort(int)}
|
||||
*/
|
||||
public void configureServerEndpoint()
|
||||
{
|
||||
requestSpecBuilder = new RequestSpecBuilder();
|
||||
|
||||
// use static variables for logs, etc
|
||||
// the request spec is built from data set via setters, see RestWrapper#onRequest
|
||||
RestAssured.baseURI = this.serverURI;
|
||||
RestAssured.port = this.serverPort;
|
||||
|
||||
configureRequestSpec().setBaseUri(this.serverURI);
|
||||
configureRequestSpec().setPort(this.serverPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding new method to configure Alfresco Endpoint.
|
||||
* Reconfiguration is required when restClient is used to executed apis on different <host>:<port> e.g. solr api followed by search api
|
||||
*/
|
||||
public void configureAlfrescoEndpoint()
|
||||
{
|
||||
this.serverURI = restProperties.envProperty().getTestServerUrl();
|
||||
this.serverPort = restProperties.envProperty().getPort();
|
||||
configureServerEndpoint();
|
||||
}
|
||||
}
|
@@ -70,7 +70,7 @@ public class ModelAssertion<T>
|
||||
return new AssertionVerbs(model, fieldValue, fieldName);
|
||||
}
|
||||
|
||||
public AssertionItemVerbs fieldsCount() throws Exception
|
||||
public AssertionItemVerbs fieldsCount()
|
||||
{
|
||||
|
||||
int actualSize = 0;
|
||||
@@ -80,7 +80,15 @@ public class ModelAssertion<T>
|
||||
{
|
||||
|
||||
field.setAccessible(true);
|
||||
Object fieldValue = field.get(model);
|
||||
Object fieldValue = null;
|
||||
try
|
||||
{
|
||||
fieldValue = field.get(model);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
throw new IllegalStateException("Unable to load model using reflection.", e);
|
||||
}
|
||||
if (fieldValue != null)
|
||||
actualSize++;
|
||||
}
|
||||
@@ -317,7 +325,7 @@ public class ModelAssertion<T>
|
||||
private Object model;
|
||||
private Object actual;
|
||||
|
||||
public AssertionItemVerbs(Object model, Object actual) throws Exception
|
||||
public AssertionItemVerbs(Object model, Object actual)
|
||||
{
|
||||
this.model = model;
|
||||
this.actual = actual;
|
||||
|
@@ -2,6 +2,7 @@ package org.alfresco.rest.core.assertion;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -12,6 +13,7 @@ import org.alfresco.utility.model.Model;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.testng.Assert;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Ordering;
|
||||
import io.restassured.path.json.JsonPath;
|
||||
@@ -65,14 +67,13 @@ public class ModelsCollectionAssertion<C>
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListContains(String key, String value) throws Exception
|
||||
public C entriesListContains(String key, String value)
|
||||
{
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
String fieldValue = "";
|
||||
for (Model m : modelEntries) {
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
Object model = method.invoke(m, new Object[] {});
|
||||
try {
|
||||
Object model = loadModel(m);
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jsonInString = mapper.writeValueAsString(model);
|
||||
fieldValue = JsonPath.with(jsonInString).get(key);
|
||||
@@ -91,15 +92,14 @@ public class ModelsCollectionAssertion<C>
|
||||
return (C) modelCollection;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListDoesNotContain(String key, String value) throws Exception
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListDoesNotContain(String key, String value)
|
||||
{
|
||||
boolean exist = false;
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
for (Model m : modelEntries) {
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
Object model = method.invoke(m, new Object[] {});
|
||||
String fieldValue = "";
|
||||
Object model = loadModel(m);
|
||||
String fieldValue = "";
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jsonInString = mapper.writeValueAsString(model);
|
||||
@@ -117,55 +117,54 @@ public class ModelsCollectionAssertion<C>
|
||||
|
||||
return (C) modelCollection;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListDoesNotContain(String key) throws Exception
|
||||
public C entriesListDoesNotContain(String key)
|
||||
{
|
||||
boolean exist = false;
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
for (Model m : modelEntries) {
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
Object model = method.invoke(m, new Object[] {});
|
||||
String fieldValue = "";
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jsonInString = mapper.writeValueAsString(model);
|
||||
fieldValue = JsonPath.with(jsonInString).get(key);
|
||||
if (fieldValue != null) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean exist = modelInList(key);
|
||||
Assert.assertFalse(exist,
|
||||
String.format("Entry list contains key: %s", key));
|
||||
|
||||
return (C) modelCollection;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListContains(String key) throws Exception
|
||||
public C entriesListContains(String key)
|
||||
{
|
||||
boolean exist = false;
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
for (Model m : modelEntries) {
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
Object model = method.invoke(m, new Object[] {});
|
||||
Object fieldValue = null;
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jsonInString = mapper.writeValueAsString(model);
|
||||
fieldValue = JsonPath.with(jsonInString).get(key);
|
||||
if (fieldValue != null) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean exist = modelInList(key);
|
||||
Assert.assertTrue(exist,
|
||||
String.format("Entry list doesn't contain key: %s", key));
|
||||
String.format("Entry list doesn't contain key: %s", key));
|
||||
|
||||
return (C) modelCollection;
|
||||
}
|
||||
|
||||
private boolean modelInList(String key)
|
||||
{
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
for (Model m : modelEntries)
|
||||
{
|
||||
Object model = loadModel(m);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jsonInString;
|
||||
try
|
||||
{
|
||||
jsonInString = mapper.writeValueAsString(model);
|
||||
}
|
||||
catch (JsonProcessingException e)
|
||||
{
|
||||
throw new IllegalStateException("Failed to convert model to string.", e);
|
||||
}
|
||||
Object fieldValue = JsonPath.with(jsonInString).get(key);
|
||||
if (fieldValue != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public C paginationExist()
|
||||
public C paginationExist()
|
||||
{
|
||||
STEP("REST API: Assert that response has pagination");
|
||||
Assert.assertNotNull(modelCollection.getPagination(), "Pagination is was not found in the response");
|
||||
@@ -174,73 +173,82 @@ public class ModelsCollectionAssertion<C>
|
||||
|
||||
/**
|
||||
* Check one field from pagination json body
|
||||
*
|
||||
*
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public PaginationAssertionVerbs paginationField(String field)
|
||||
public PaginationAssertionVerbs paginationField(String field)
|
||||
{
|
||||
return new PaginationAssertionVerbs<C>(modelCollection, field, modelCollection.getPagination());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check is the entries are ordered ASC by a specific field
|
||||
*
|
||||
*
|
||||
* @param field from json response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListIsSortedAscBy(String field) throws Exception
|
||||
public C entriesListIsSortedAscBy(String field)
|
||||
{
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
List<String> fieldValues = new ArrayList<String>();
|
||||
for(Model m: modelEntries)
|
||||
{
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
Object model = method.invoke(m, new Object[] {});
|
||||
Object model = loadModel(m);
|
||||
String fieldValue = "";
|
||||
try {
|
||||
fieldValue = BeanUtils.getProperty(model, field);
|
||||
fieldValues.add(fieldValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Assert.assertTrue(Ordering.natural().isOrdered(fieldValues), String.format("Entries are not ordered ASC by %s", field));
|
||||
return (C) modelCollection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check is the entries are ordered DESC by a specific field
|
||||
*
|
||||
*
|
||||
* @param field from json response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public C entriesListIsSortedDescBy(String field) throws Exception
|
||||
public C entriesListIsSortedDescBy(String field)
|
||||
{
|
||||
List<Model> modelEntries = modelCollection.getEntries();
|
||||
List<String> fieldValues = new ArrayList<String>();
|
||||
for(Model m: modelEntries)
|
||||
{
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
Object model = method.invoke(m, new Object[] {});
|
||||
Object model = loadModel(m);
|
||||
String fieldValue = "";
|
||||
try {
|
||||
fieldValue = BeanUtils.getProperty(model, field);
|
||||
fieldValues.add(fieldValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Assert.assertTrue(Ordering.natural().reverse().isOrdered(fieldValues), String.format("Entries are not ordered DESC by %s", field));
|
||||
return (C) modelCollection;
|
||||
}
|
||||
|
||||
private Object loadModel(Model m)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method method = m.getClass().getMethod("onModel", new Class[] {});
|
||||
return method.invoke(m, new Object[] {});
|
||||
}
|
||||
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e)
|
||||
{
|
||||
throw new IllegalStateException("Failed to load model using reflection.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,9 +25,8 @@ public class PaginationAssertionVerbs<C> {
|
||||
|
||||
/**
|
||||
* @return the value of the field
|
||||
* @throws Exception
|
||||
*/
|
||||
private String getFieldValue() throws Exception {
|
||||
private String getFieldValue() {
|
||||
String value = "";
|
||||
try {
|
||||
value = BeanUtils.getProperty(pagination, fieldName);
|
||||
@@ -46,34 +45,34 @@ public class PaginationAssertionVerbs<C> {
|
||||
modelCollection.getClass().getCanonicalName(), info);
|
||||
}
|
||||
|
||||
public C is(String expected) throws Exception {
|
||||
public C is(String expected) {
|
||||
|
||||
Assert.assertEquals(getFieldValue(), expected, errorMessage("is NOT correct,"));
|
||||
return modelCollection;
|
||||
}
|
||||
|
||||
public C isNot(Object expected) throws Exception {
|
||||
public C isNot(Object expected) {
|
||||
|
||||
Assert.assertNotEquals(getFieldValue(), expected, errorMessage("is correct,"));
|
||||
return modelCollection;
|
||||
}
|
||||
|
||||
public C isNotEmpty() throws Exception {
|
||||
public C isNotEmpty() {
|
||||
Assert.assertNotEquals(getFieldValue(), "", errorMessage("is empty,"));
|
||||
return modelCollection;
|
||||
}
|
||||
|
||||
public C isNotNull() throws Exception {
|
||||
public C isNotNull() {
|
||||
Assert.assertNotNull(getFieldValue(), errorMessage("is null,"));
|
||||
return modelCollection;
|
||||
}
|
||||
|
||||
public C isNotPresent() throws Exception {
|
||||
public C isNotPresent() {
|
||||
Assert.assertNull(getFieldValue(), errorMessage("is present,"));
|
||||
return modelCollection;
|
||||
}
|
||||
|
||||
public C isEmpty() throws Exception {
|
||||
public C isEmpty() {
|
||||
Assert.assertEquals(getFieldValue(), "", errorMessage("is NOT empty,"));
|
||||
return modelCollection;
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ public class Generator
|
||||
{
|
||||
public static String line = "********\n------------------------------------------------------------------------";
|
||||
|
||||
public static void main(String[] args) throws Exception
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
if (!System.getProperties().containsKey("coverage") && !System.getProperties().containsKey("models") || System.getProperties().containsKey("help") )
|
||||
|
@@ -2,6 +2,7 @@ package org.alfresco.rest.core.swagger;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Console;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
@@ -34,21 +35,28 @@ public class SwaggerDefinitions
|
||||
modelsPath = Paths.get(Paths.get(".").toAbsolutePath().normalize().toFile().getPath(), "src/main/java/org/alfresco/rest/model");
|
||||
}
|
||||
|
||||
public void generateMissingDefinitions() throws Exception
|
||||
public void generateMissingDefinitions()
|
||||
{
|
||||
/*
|
||||
* read the content of ignore-moldels file
|
||||
*/
|
||||
List<String> ignoreModel = new ArrayList<String>();
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(Paths.get(modelsPath.toFile().getPath(), "ignore-models").toFile())))
|
||||
try
|
||||
{
|
||||
String line;
|
||||
while ((line = br.readLine()) != null)
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(Paths.get(modelsPath.toFile().getPath(), "ignore-models").toFile())))
|
||||
{
|
||||
if (!line.startsWith("#") && !line.equals(""))
|
||||
ignoreModel.add(line);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null)
|
||||
{
|
||||
if (!line.startsWith("#") && !line.equals(""))
|
||||
ignoreModel.add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new IllegalStateException("Exception while generating missing definitions.", e);
|
||||
}
|
||||
|
||||
/*
|
||||
* filter all models, ignoring the ones from ignore-model or the ones that are already created locally
|
||||
@@ -121,8 +129,8 @@ public class SwaggerDefinitions
|
||||
{
|
||||
System.out.println("\nStart generating all models...");
|
||||
for (SwaggerModel swaggerModel : missingSwaggerModels)
|
||||
{
|
||||
swaggerModel.generate();
|
||||
{
|
||||
generateModel(swaggerModel);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -147,27 +155,26 @@ public class SwaggerDefinitions
|
||||
* Generate the model based on the ID provided
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
private void generateSelectedSwaggerModel(String id) throws Exception
|
||||
private void generateSelectedSwaggerModel(String id)
|
||||
{
|
||||
int choise = Integer.parseInt(id);
|
||||
if ((choise - 1) >= missingSwaggerModels.size())
|
||||
int choice = Integer.parseInt(id);
|
||||
if ((choice - 1) >= missingSwaggerModels.size())
|
||||
{
|
||||
throw new TestConfigurationException(
|
||||
"You specified a wrong ID: [" + id + "] please select one value from the list displayed above. Run the command again!");
|
||||
}
|
||||
missingSwaggerModels.get(choise - 1).generate();
|
||||
generateModel(missingSwaggerModels.get(choice - 1));
|
||||
}
|
||||
|
||||
public boolean generateDefinition(String modelParamValue) throws IOException, TemplateException
|
||||
public boolean generateDefinition(String modelParamValue)
|
||||
{
|
||||
for (Entry<String, Model> model : swagger.getDefinitions().entrySet())
|
||||
{
|
||||
SwaggerModel swaggerModel = new SwaggerModel(model, swagger);
|
||||
if (swaggerModel.getName().equals(modelParamValue))
|
||||
{
|
||||
swaggerModel.generate();
|
||||
generateModel(swaggerModel);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -175,4 +182,16 @@ public class SwaggerDefinitions
|
||||
System.err.printf("Model [%s] not found in Swagger file: %s\n", modelParamValue, swagger.getBasePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
private void generateModel(SwaggerModel swaggerModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
swaggerModel.generate();
|
||||
}
|
||||
catch (IOException | TemplateException e)
|
||||
{
|
||||
throw new IllegalStateException("Exception while generating model definition.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,51 +47,55 @@ public class SwaggerPaths
|
||||
/**
|
||||
* Compare requests that exist in swagger yaml file vs request implemented in your code
|
||||
* any findings are saved to a missing-request txt file.
|
||||
* @throws Exception
|
||||
*
|
||||
*
|
||||
* @throws TestConfigurationException
|
||||
*/
|
||||
public void computeCoverage() throws Exception
|
||||
public void computeCoverage()
|
||||
{
|
||||
System.out.println("Start computing the coverage of TAS vs Swagger file. Stand by...");
|
||||
File missingReq = new File(String.format("missing-requests-%s.txt", FilenameUtils.getBaseName(swaggerFilePath)));
|
||||
missingReq.delete();
|
||||
fileWithMissingRequests = new BufferedWriter(new FileWriter(missingReq));
|
||||
fileWithMissingRequests.write(String.format("BasePath: {%s}", swagger.getBasePath()));
|
||||
fileWithMissingRequests.newLine();
|
||||
fileWithMissingRequests.write("These requests generated should be analyzed and modified according to your needs.");
|
||||
fileWithMissingRequests.newLine();
|
||||
fileWithMissingRequests.write("PLEASE UPDATE your 'RestReturnedModel' name with the appropiate returned model by your request.");
|
||||
fileWithMissingRequests.newLine();
|
||||
fileWithMissingRequests.newLine();
|
||||
|
||||
File implReq = new File(String.format("implemented-requests-%s.txt", FilenameUtils.getBaseName(swaggerFilePath)));
|
||||
implReq.delete();
|
||||
fileWithImplementedRequests = new BufferedWriter(new FileWriter(implReq));
|
||||
|
||||
for (Entry<String, io.swagger.models.Path> path : swagger.getPaths().entrySet())
|
||||
try
|
||||
{
|
||||
for (Map.Entry<HttpMethod, Operation> operation : path.getValue().getOperationMap().entrySet())
|
||||
{
|
||||
searchPattern(path.getKey(),operation);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(toString());
|
||||
|
||||
fileWithImplementedRequests.close();
|
||||
fileWithMissingRequests.close();
|
||||
|
||||
if (missingRequestCount > 0)
|
||||
{
|
||||
System.out.println("[ERROR] PLEASE ANALYSE THE GENERATED <missing-requests> file(s), it seems some request were NOT implemented!");
|
||||
}
|
||||
else
|
||||
System.out.println("Start computing the coverage of TAS vs Swagger file. Stand by...");
|
||||
File missingReq = new File(String.format("missing-requests-%s.txt", FilenameUtils.getBaseName(swaggerFilePath)));
|
||||
missingReq.delete();
|
||||
fileWithMissingRequests = new BufferedWriter(new FileWriter(missingReq));
|
||||
fileWithMissingRequests.write(String.format("BasePath: {%s}", swagger.getBasePath()));
|
||||
fileWithMissingRequests.newLine();
|
||||
fileWithMissingRequests.write("These requests generated should be analyzed and modified according to your needs.");
|
||||
fileWithMissingRequests.newLine();
|
||||
fileWithMissingRequests.write("PLEASE UPDATE your 'RestReturnedModel' name with the appropiate returned model by your request.");
|
||||
fileWithMissingRequests.newLine();
|
||||
fileWithMissingRequests.newLine();
|
||||
|
||||
System.out.println("ALSO ANALYZE <implemented-requests.txt> for current implementation, take a look at duplicated requests if any!");
|
||||
File implReq = new File(String.format("implemented-requests-%s.txt", FilenameUtils.getBaseName(swaggerFilePath)));
|
||||
implReq.delete();
|
||||
fileWithImplementedRequests = new BufferedWriter(new FileWriter(implReq));
|
||||
|
||||
for (Entry<String, io.swagger.models.Path> path : swagger.getPaths().entrySet())
|
||||
{
|
||||
for (Map.Entry<HttpMethod, Operation> operation : path.getValue().getOperationMap().entrySet())
|
||||
{
|
||||
searchPattern(path.getKey(), operation);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(toString());
|
||||
|
||||
fileWithImplementedRequests.close();
|
||||
fileWithMissingRequests.close();
|
||||
|
||||
if (missingRequestCount > 0)
|
||||
{
|
||||
System.out.println("[ERROR] PLEASE ANALYSE THE GENERATED <missing-requests> file(s), it seems some request were NOT implemented!");
|
||||
}
|
||||
else
|
||||
missingReq.delete();
|
||||
|
||||
System.out.println("ALSO ANALYZE <implemented-requests.txt> for current implementation, take a look at duplicated requests if any!");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new RuntimeException("Exception while trying to create coverage report.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,9 +104,8 @@ public class SwaggerPaths
|
||||
* @param httpMethod
|
||||
* @param pathUrl
|
||||
* @param methodName
|
||||
* @throws Exception
|
||||
*/
|
||||
private void searchPattern(String pathUrl, Entry<HttpMethod, Operation> operation) throws Exception
|
||||
private void searchPattern(String pathUrl, Entry<HttpMethod, Operation> operation)
|
||||
{
|
||||
String originalPathUrl = pathUrl;
|
||||
String httpMethod = operation.getKey().name();
|
||||
|
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import io.swagger.models.Operation;
|
||||
|
||||
public class SwaggerRequest
|
||||
@@ -18,12 +19,19 @@ public class SwaggerRequest
|
||||
private String httpMethod;
|
||||
private String pathUrl;
|
||||
|
||||
private Configuration getConfig() throws IOException
|
||||
private Configuration getConfig()
|
||||
{
|
||||
if (cfg == null)
|
||||
{
|
||||
cfg = new Configuration(Configuration.VERSION_2_3_23);
|
||||
cfg.setDirectoryForTemplateLoading(new File("src/main/resources"));
|
||||
try
|
||||
{
|
||||
cfg.setDirectoryForTemplateLoading(new File("src/main/resources"));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new IllegalStateException("Exception while configuring Freemarker template directory.", e);
|
||||
}
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
@@ -35,18 +43,25 @@ public class SwaggerRequest
|
||||
this.pathUrl = pathUrl;
|
||||
}
|
||||
|
||||
public String getRequestSample() throws Exception
|
||||
public String getRequestSample()
|
||||
{
|
||||
Template template = getConfig().getTemplate("rest-request.ftl");
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
data.put("operationId", swaggerRequest.getOperationId());
|
||||
data.put("httpMethod", httpMethod);
|
||||
data.put("pathUrl", pathUrl);
|
||||
|
||||
Writer append = new StringWriter();
|
||||
template.process(data, append);
|
||||
|
||||
append.close();
|
||||
return append.toString();
|
||||
try
|
||||
{
|
||||
Template template = getConfig().getTemplate("rest-request.ftl");
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
data.put("operationId", swaggerRequest.getOperationId());
|
||||
data.put("httpMethod", httpMethod);
|
||||
data.put("pathUrl", pathUrl);
|
||||
|
||||
Writer append = new StringWriter();
|
||||
template.process(data, append);
|
||||
|
||||
append.close();
|
||||
return append.toString();
|
||||
}
|
||||
catch (IOException | TemplateException e)
|
||||
{
|
||||
throw new IllegalStateException("Exception while loading sample request.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,12 +26,12 @@ public class SwaggerYamlParser
|
||||
|
||||
}
|
||||
|
||||
public void computeCoverage() throws Exception
|
||||
public void computeCoverage()
|
||||
{
|
||||
new SwaggerPaths(swagger, this.swaggerFilePath).computeCoverage();
|
||||
}
|
||||
|
||||
public void generateMissingModules() throws Exception
|
||||
public void generateMissingModules()
|
||||
{
|
||||
String modelParamValue = System.getProperty("models");
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package org.alfresco.rest.exception;
|
||||
|
||||
public class ModelToJsonConversionException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public <T> ModelToJsonConversionException(Class<T> classz, Exception e)
|
||||
{
|
||||
super(String.format("Could not convert model for [%s] to JSON", classz.getName()), e);
|
||||
}
|
||||
}
|
@@ -0,0 +1,158 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RestAbstractClassModel extends TestModel implements IRestModel<RestAbstractClassModel>
|
||||
{
|
||||
@JsonProperty(value = "entry")
|
||||
RestAbstractClassModel model;
|
||||
|
||||
@Override
|
||||
public RestAbstractClassModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public String id;
|
||||
public String title;
|
||||
public String description;
|
||||
public String parentId;
|
||||
public Boolean isContainer = null;
|
||||
public Boolean isArchive = null;
|
||||
public Boolean includedInSupertypeQuery = null;
|
||||
public List<String> mandatoryAspects = null;
|
||||
public List<RestClassAssociationModel> associations = null;
|
||||
public List <RestPropertyDefinitionModel> properties = null;
|
||||
|
||||
@JsonProperty(value = "model")
|
||||
public RestClassModel modelInfo;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Boolean getContainer()
|
||||
{
|
||||
return isContainer;
|
||||
}
|
||||
|
||||
public void setContainer(Boolean container)
|
||||
{
|
||||
isContainer = container;
|
||||
}
|
||||
|
||||
public Boolean getArchive()
|
||||
{
|
||||
return isArchive;
|
||||
}
|
||||
|
||||
public void setArchive(Boolean archive)
|
||||
{
|
||||
isArchive = archive;
|
||||
}
|
||||
|
||||
public Boolean getIncludedInSupertypeQuery()
|
||||
{
|
||||
return includedInSupertypeQuery;
|
||||
}
|
||||
|
||||
public void setIncludedInSupertypeQuery(Boolean includedInSupertypeQuery)
|
||||
{
|
||||
this.includedInSupertypeQuery = includedInSupertypeQuery;
|
||||
}
|
||||
|
||||
public List<String> getMandatoryAspects()
|
||||
{
|
||||
return mandatoryAspects;
|
||||
}
|
||||
|
||||
public void setMandatoryAspects(List<String> mandatoryAspects)
|
||||
{
|
||||
this.mandatoryAspects = mandatoryAspects;
|
||||
}
|
||||
|
||||
public List<RestClassAssociationModel> getAssociations()
|
||||
{
|
||||
return associations;
|
||||
}
|
||||
|
||||
public void setAssociations(List<RestClassAssociationModel> associations)
|
||||
{
|
||||
this.associations = associations;
|
||||
}
|
||||
|
||||
public List<RestPropertyDefinitionModel> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<RestPropertyDefinitionModel> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public RestClassModel getModelInfo()
|
||||
{
|
||||
return modelInfo;
|
||||
}
|
||||
|
||||
public void setModelInfo(RestClassModel modelInfo)
|
||||
{
|
||||
this.modelInfo = modelInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* DSL for assertion on this rest model
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAssertion<RestAbstractClassModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestAbstractClassModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestAbstractClassModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-14 13:22' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestActionBodyExecTemplateModel extends TestModel implements IRestModel<RestActionBodyExecTemplateModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestActionBodyExecTemplateModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestActionBodyExecTemplateModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestActionBodyExecTemplateModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestActionBodyExecTemplateModel model;
|
||||
|
||||
@Override
|
||||
public RestActionBodyExecTemplateModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String actionDefinitionId;
|
||||
|
||||
private Object params;
|
||||
|
||||
public String getActionDefinitionId()
|
||||
{
|
||||
return this.actionDefinitionId;
|
||||
}
|
||||
|
||||
public void setActionDefinitionId(String actionDefinitionId)
|
||||
{
|
||||
this.actionDefinitionId = actionDefinitionId;
|
||||
}
|
||||
|
||||
public Object getParams()
|
||||
{
|
||||
return this.params;
|
||||
}
|
||||
|
||||
public void setParams(Object params)
|
||||
{
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2021 Alfresco Software, Ltd. All rights reserved.
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'dedwards' on '2021-12-16 08:32' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestArchiveContentRequestModel extends TestModel implements IRestModel<RestArchiveContentRequestModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestArchiveContentRequestModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestArchiveContentRequestModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestArchiveContentRequestModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestArchiveContentRequestModel model;
|
||||
|
||||
@Override
|
||||
public RestArchiveContentRequestModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
A map (String-String) of archive request properties for given content.
|
||||
|
||||
*/
|
||||
|
||||
private Object archiveProperties;
|
||||
|
||||
public Object getArchiveProperties()
|
||||
{
|
||||
return this.archiveProperties;
|
||||
}
|
||||
|
||||
public void setArchiveProperties(Object archiveProperties)
|
||||
{
|
||||
this.archiveProperties = archiveProperties;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,5 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
public class RestAspectModel extends RestAbstractClassModel
|
||||
{
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
public class RestAspectsCollection extends RestModels<RestAspectModel, RestAspectsCollection>
|
||||
{
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestClassAssociationDefinitionModel extends TestModel
|
||||
{
|
||||
public String role = null;
|
||||
public String cls = null;
|
||||
public Boolean isMany = null;
|
||||
public Boolean isMandatory = null;
|
||||
public Boolean isMandatoryEnforced = null;
|
||||
|
||||
public String getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role)
|
||||
{
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getCls()
|
||||
{
|
||||
return cls;
|
||||
}
|
||||
|
||||
public void setCls(String cls)
|
||||
{
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
public Boolean getMany()
|
||||
{
|
||||
return isMany;
|
||||
}
|
||||
|
||||
public void setMany(Boolean many)
|
||||
{
|
||||
isMany = many;
|
||||
}
|
||||
|
||||
public Boolean getMandatory()
|
||||
{
|
||||
return isMandatory;
|
||||
}
|
||||
|
||||
public void setMandatory(Boolean mandatory)
|
||||
{
|
||||
isMandatory = mandatory;
|
||||
}
|
||||
|
||||
public Boolean getMandatoryEnforced()
|
||||
{
|
||||
return isMandatoryEnforced;
|
||||
}
|
||||
|
||||
public void setMandatoryEnforced(Boolean mandatoryEnforced)
|
||||
{
|
||||
isMandatoryEnforced = mandatoryEnforced;
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestClassAssociationModel extends TestModel
|
||||
{
|
||||
public String id;
|
||||
public String title;
|
||||
public String description;
|
||||
public Boolean isChild;
|
||||
public Boolean isProtected;
|
||||
public RestClassAssociationDefinitionModel source = null;
|
||||
public RestClassAssociationDefinitionModel target = null;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Boolean getChild()
|
||||
{
|
||||
return isChild;
|
||||
}
|
||||
|
||||
public void setIsChild(Boolean isChild)
|
||||
{
|
||||
this.isChild = isChild;
|
||||
}
|
||||
|
||||
public Boolean getIsProtected()
|
||||
{
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public void setIsProtected(Boolean isProtected)
|
||||
{
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public RestClassAssociationDefinitionModel getSource()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(RestClassAssociationDefinitionModel source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public RestClassAssociationDefinitionModel getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(RestClassAssociationDefinitionModel target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,62 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestClassModel extends TestModel
|
||||
{
|
||||
public String id;
|
||||
public String author;
|
||||
public String description;
|
||||
public String namespaceUri;
|
||||
public String namespacePrefix;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getNamespaceUri()
|
||||
{
|
||||
return namespaceUri;
|
||||
}
|
||||
|
||||
public void setNamespaceUri(String namespaceUri)
|
||||
{
|
||||
this.namespaceUri = namespaceUri;
|
||||
}
|
||||
|
||||
public String getNamespacePrefix()
|
||||
{
|
||||
return namespacePrefix;
|
||||
}
|
||||
|
||||
public void setNamespacePrefix(String namespacePrefix)
|
||||
{
|
||||
this.namespacePrefix = namespacePrefix;
|
||||
}
|
||||
}
|
@@ -0,0 +1,100 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestCompositeConditionDefinitionModel extends TestModel implements IRestModel<RestCompositeConditionDefinitionModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestCompositeConditionDefinitionModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestCompositeConditionDefinitionModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestCompositeConditionDefinitionModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestCompositeConditionDefinitionModel model;
|
||||
|
||||
@Override
|
||||
public RestCompositeConditionDefinitionModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Whether to invert the logic for this condition (if true then "not" is applied to the whole condition)
|
||||
*/
|
||||
|
||||
private boolean inverted;
|
||||
/**
|
||||
How to combine the clauses of this condition ("and" or "or")
|
||||
*/
|
||||
|
||||
private String booleanMode;
|
||||
/**
|
||||
Nested list of composite clauses in this condition
|
||||
*/
|
||||
|
||||
private List<RestCompositeConditionDefinitionModel> compositeConditions;
|
||||
/**
|
||||
Nested list of simple (per field) conditions.
|
||||
*/
|
||||
|
||||
private List<RestSimpleConditionDefinitionModel> simpleConditions;
|
||||
|
||||
public boolean getInverted()
|
||||
{
|
||||
return this.inverted;
|
||||
}
|
||||
|
||||
public void setInverted(boolean inverted)
|
||||
{
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
public String getBooleanMode()
|
||||
{
|
||||
return this.booleanMode;
|
||||
}
|
||||
|
||||
public void setBooleanMode(String booleanMode)
|
||||
{
|
||||
this.booleanMode = booleanMode;
|
||||
}
|
||||
|
||||
public List<RestCompositeConditionDefinitionModel> getCompositeConditions()
|
||||
{
|
||||
return this.compositeConditions;
|
||||
}
|
||||
|
||||
public void setCompositeConditions(List<RestCompositeConditionDefinitionModel> compositeConditions)
|
||||
{
|
||||
this.compositeConditions = compositeConditions;
|
||||
}
|
||||
|
||||
public List<RestSimpleConditionDefinitionModel> getSimpleConditions()
|
||||
{
|
||||
return this.simpleConditions;
|
||||
}
|
||||
|
||||
public void setSimpleConditions(List<RestSimpleConditionDefinitionModel> simpleConditions)
|
||||
{
|
||||
this.simpleConditions = simpleConditions;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,62 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RestConstraintDefinitionModel
|
||||
{
|
||||
private String id;
|
||||
private String type;
|
||||
private String title;
|
||||
private String description;
|
||||
private Map<String, Object> parameters;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParameters()
|
||||
{
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(Map<String, Object> parameters)
|
||||
{
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@ package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 11/11/2016.
|
||||
*/
|
||||
@@ -11,6 +13,7 @@ public class RestContentModel extends TestModel
|
||||
private String mimeTypeName;
|
||||
private String mimeType;
|
||||
private String encoding;
|
||||
private Set<String> storageClasses;
|
||||
|
||||
public int getSizeInBytes()
|
||||
{
|
||||
@@ -51,4 +54,14 @@ public class RestContentModel extends TestModel
|
||||
{
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public Set<String> getStorageClasses()
|
||||
{
|
||||
return storageClasses;
|
||||
}
|
||||
|
||||
public void setStorageClasses(Set<String> storageClasses)
|
||||
{
|
||||
this.storageClasses = storageClasses;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2021 Alfresco Software, Ltd. All rights reserved.
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'dedwards' on '2021-12-16 08:32' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestContentStorageInfoModel extends TestModel implements IRestModel<RestContentStorageInfoModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestContentStorageInfoModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestContentStorageInfoModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestContentStorageInfoModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestContentStorageInfoModel model;
|
||||
|
||||
@Override
|
||||
public RestContentStorageInfoModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Content type property identifier (e.g. cm:content). Inside this object only colon (':') delimiter for namespace-prefix will be used.
|
||||
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String id;
|
||||
/**
|
||||
A map (String-String) of storage properties for given content.
|
||||
|
||||
*/
|
||||
|
||||
private Map<String, String> storageProperties;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Map<String, String> getStorageProperties()
|
||||
{
|
||||
return this.storageProperties;
|
||||
}
|
||||
|
||||
public void setStorageProperties(Map<String, String> storageProperties)
|
||||
{
|
||||
this.storageProperties = storageProperties;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,120 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
public class RestCustomTypeModel extends TestModel implements IRestModel<RestCustomTypeModel>
|
||||
{
|
||||
@JsonProperty(value = "entry")
|
||||
RestCustomTypeModel model;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String name;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String parentName;
|
||||
|
||||
@JsonProperty
|
||||
private String title;
|
||||
|
||||
@JsonProperty
|
||||
private String description;
|
||||
|
||||
@JsonProperty
|
||||
private List<CustomAspectPropertiesModel> properties;
|
||||
|
||||
public RestCustomTypeModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RestCustomTypeModel(String name, String parentName)
|
||||
{
|
||||
this.name = name;
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public RestCustomTypeModel(String name, String parentName, String title)
|
||||
{
|
||||
this.name = name;
|
||||
this.parentName = parentName;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestCustomTypeModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestCustomTypeModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestCustomTypeModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestCustomTypeModel>(this);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<CustomAspectPropertiesModel> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<CustomAspectPropertiesModel> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
}
|
@@ -32,7 +32,7 @@ public class RestHtmlResponse
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public void assertResponseContainsImage() throws Exception
|
||||
public void assertResponseContainsImage()
|
||||
{
|
||||
STEP("REST API: Assert that response has an image.");
|
||||
Utility.checkObjectIsInitialized(headers, "Headers");
|
||||
|
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2020 Alfresco Software, Ltd. All rights reserved.
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
public class RestIdentityServiceConfigurationModel extends TestModel{
|
||||
|
||||
public RestIdentityServiceConfigurationModel() {
|
||||
|
||||
}
|
||||
|
||||
private String authenticationChain;
|
||||
|
||||
private String authenticationEnabled;
|
||||
|
||||
private String enableBasicAuth;
|
||||
|
||||
private String authServerUrl;
|
||||
|
||||
private String realm;
|
||||
|
||||
private String resource;
|
||||
|
||||
private String publicClient;
|
||||
|
||||
private String sslRequired;
|
||||
|
||||
private String enablePkce;
|
||||
|
||||
private String credentialsSecret;
|
||||
|
||||
private String credentialsProvider;
|
||||
|
||||
public String getAuthenticationChain() {
|
||||
return authenticationChain;
|
||||
}
|
||||
|
||||
public void setAuthenticationChain(String authenticationChain) {
|
||||
this.authenticationChain = authenticationChain;
|
||||
}
|
||||
|
||||
public String getAuthenticationEnabled() {
|
||||
return authenticationEnabled;
|
||||
}
|
||||
|
||||
public void setAuthenticationEnabled(String authenticationEnabled) {
|
||||
this.authenticationEnabled = authenticationEnabled;
|
||||
}
|
||||
|
||||
public String getEnableBasicAuth() {
|
||||
return enableBasicAuth;
|
||||
}
|
||||
|
||||
public void setEnableBasicAuth(String enableBasicAuth) {
|
||||
this.enableBasicAuth = enableBasicAuth;
|
||||
}
|
||||
|
||||
public String getAuthServerUrl() {
|
||||
return authServerUrl;
|
||||
}
|
||||
|
||||
public void setAuthServerUrl(String authServerUrl) {
|
||||
this.authServerUrl = authServerUrl;
|
||||
}
|
||||
|
||||
public String getRealm() {
|
||||
return realm;
|
||||
}
|
||||
|
||||
public void setRealm(String realm) {
|
||||
this.realm = realm;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public String getPublicClient() {
|
||||
return publicClient;
|
||||
}
|
||||
|
||||
public void setPublicClient(String publicClient) {
|
||||
this.publicClient = publicClient;
|
||||
}
|
||||
|
||||
public String getSslRequired() {
|
||||
return sslRequired;
|
||||
}
|
||||
|
||||
public void setSslRequired(String sslRequired) {
|
||||
this.sslRequired = sslRequired;
|
||||
}
|
||||
|
||||
public String getEnablePkce() {
|
||||
return enablePkce;
|
||||
}
|
||||
|
||||
public void setEnablePkce(String enablePkce) {
|
||||
this.enablePkce = enablePkce;
|
||||
}
|
||||
|
||||
public String getCredentialsSecret() {
|
||||
return credentialsSecret;
|
||||
}
|
||||
|
||||
public void setCredentialsSecret(String credentialsSecret) {
|
||||
this.credentialsSecret = credentialsSecret;
|
||||
}
|
||||
|
||||
public String getCredentialsProvider() {
|
||||
return credentialsProvider;
|
||||
}
|
||||
|
||||
public void setCredentialsProvider(String credentialsProvider) {
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestLinkedRuleSetBodyCreateModel extends TestModel implements IRestModel<RestLinkedRuleSetBodyCreateModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestLinkedRuleSetBodyCreateModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestLinkedRuleSetBodyCreateModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestLinkedRuleSetBodyCreateModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestLinkedRuleSetBodyCreateModel model;
|
||||
|
||||
@Override
|
||||
public RestLinkedRuleSetBodyCreateModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Identifier for either the folder or the rule set
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String id;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,10 @@ public class RestPaginationModel extends TestModel implements IModelAssertion<Re
|
||||
{
|
||||
private int count;
|
||||
private boolean hasMoreItems;
|
||||
/**
|
||||
* {code}totalItems{code} is optional and some endpoints don't include it e.g. GET sites/{siteId}/members
|
||||
* See the section entitled "The list object" in https://ts.alfresco.com/share/page/site/prodman/document-details?nodeRef=workspace://SpacesStore/17eacc65-28e5-40bb-8113-edb8c21d57a5
|
||||
*/
|
||||
private Integer totalItems;
|
||||
private int skipCount;
|
||||
private int maxItems;
|
||||
@@ -44,6 +48,11 @@ public class RestPaginationModel extends TestModel implements IModelAssertion<Re
|
||||
this.hasMoreItems = hasMoreItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the totalItems.
|
||||
*
|
||||
* @return The total number of items, or null if it was not included in the response.
|
||||
*/
|
||||
public Integer getTotalItems()
|
||||
{
|
||||
return totalItems;
|
||||
@@ -75,14 +84,14 @@ public class RestPaginationModel extends TestModel implements IModelAssertion<Re
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestPaginationModel> assertThat()
|
||||
public ModelAssertion<RestPaginationModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestPaginationModel>(this);
|
||||
}
|
||||
|
||||
return new ModelAssertion<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestPaginationModel> and()
|
||||
public ModelAssertion<RestPaginationModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
}
|
||||
}
|
@@ -71,6 +71,8 @@ public class RestPersonModel extends TestModel implements IModelAssertion<RestPe
|
||||
private String userStatus;
|
||||
private String password;
|
||||
private Object properties;
|
||||
private String quotaUsed;
|
||||
private String quota;
|
||||
private Map<String, Boolean> capabilities;
|
||||
|
||||
public RestPersonModel()
|
||||
@@ -319,14 +321,31 @@ public class RestPersonModel extends TestModel implements IModelAssertion<RestPe
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
public String getQuotaUsed() {
|
||||
return quotaUsed;
|
||||
}
|
||||
|
||||
|
||||
public void setQuotaUsed(String quotaUsed) {
|
||||
this.quotaUsed = quotaUsed;
|
||||
}
|
||||
|
||||
public String getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public void setQuota(String quota) {
|
||||
this.quota = quota;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a PersonModel with random values for all existing fields excluding fields specified as ingnoredFields
|
||||
*
|
||||
* @param ignoredFields field to be excluded when generating a random model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static RestPersonModel getRandomPersonModel(String... ignoredFields) throws Exception
|
||||
public static RestPersonModel getRandomPersonModel(String... ignoredFields)
|
||||
{
|
||||
RestPersonModel personModel = new RestPersonModel();
|
||||
setRandomValuesForAllFields(personModel, ignoredFields);
|
||||
|
@@ -0,0 +1,117 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RestPropertyDefinitionModel
|
||||
{
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private String defaultValue;
|
||||
private String dataType;
|
||||
private Boolean isMultiValued;
|
||||
private Boolean isMandatory;
|
||||
private Boolean isMandatoryEnforced;
|
||||
private Boolean isProtected;
|
||||
private List<RestConstraintDefinitionModel> constraints;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDefaultValue()
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType)
|
||||
{
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public boolean getIsProtected()
|
||||
{
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public void setIsProtected(boolean isProtected)
|
||||
{
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public List<RestConstraintDefinitionModel> getConstraints()
|
||||
{
|
||||
return constraints;
|
||||
}
|
||||
|
||||
public void setConstraints(List<RestConstraintDefinitionModel> constraints)
|
||||
{
|
||||
this.constraints = constraints;
|
||||
}
|
||||
|
||||
public boolean getIsMultiValued()
|
||||
{
|
||||
return isMultiValued;
|
||||
}
|
||||
|
||||
public void setIsMultiValued(boolean isMultiValued)
|
||||
{
|
||||
this.isMultiValued = isMultiValued;
|
||||
}
|
||||
|
||||
public boolean getIsMandatory()
|
||||
{
|
||||
return isMandatory;
|
||||
}
|
||||
|
||||
public void setIsMandatory(boolean isMandatory)
|
||||
{
|
||||
this.isMandatory = isMandatory;
|
||||
}
|
||||
|
||||
public boolean getIsMandatoryEnforced()
|
||||
{
|
||||
return isMandatoryEnforced;
|
||||
}
|
||||
|
||||
public void setIsMandatoryEnforced(boolean isMandatoryEnforced)
|
||||
{
|
||||
this.isMandatoryEnforced = isMandatoryEnforced;
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2021 Alfresco Software, Ltd. All rights reserved.
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'dedwards' on '2021-12-16 08:32' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestRestoreArchivedContentRequestModel extends TestModel implements IRestModel<RestRestoreArchivedContentRequestModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestRestoreArchivedContentRequestModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestRestoreArchivedContentRequestModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestRestoreArchivedContentRequestModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestRestoreArchivedContentRequestModel model;
|
||||
|
||||
@Override
|
||||
public RestRestoreArchivedContentRequestModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Restore from archive priority (Standard/High - to be mapped to Storage Provider specific values in Cloud Connectors)
|
||||
*/
|
||||
|
||||
private String restorePriority;
|
||||
|
||||
public String getRestorePriority()
|
||||
{
|
||||
return this.restorePriority;
|
||||
}
|
||||
|
||||
public void setRestorePriority(String restorePriority)
|
||||
{
|
||||
this.restorePriority = restorePriority;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,186 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestRuleBodyModel extends TestModel implements IRestModel<RestRuleBodyModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestRuleBodyModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestRuleBodyModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestRuleBodyModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestRuleBodyModel model;
|
||||
|
||||
@Override
|
||||
public RestRuleBodyModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Name of the rule
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String name;
|
||||
/**
|
||||
Description of the rule
|
||||
*/
|
||||
|
||||
private String description;
|
||||
/**
|
||||
Whether the rule is enabled
|
||||
*/
|
||||
|
||||
private boolean enabled;
|
||||
/**
|
||||
Whether the rule also applies to subfolders
|
||||
*/
|
||||
|
||||
private boolean cascade;
|
||||
/**
|
||||
Whether the rule should be run in the background
|
||||
*/
|
||||
|
||||
private boolean asynchronous;
|
||||
/**
|
||||
If the rule should be run in the background then an optional error script can be referenced
|
||||
*/
|
||||
|
||||
private String errorScript;
|
||||
/**
|
||||
The set of triggers that cause the rule to be activated.
|
||||
* inbound - The rule should be activated when an item enters the folder
|
||||
* update - The rule should be activated when an item within the folder is updated
|
||||
* outbound - The rule should be activated when an item leaves the folder or is deleted
|
||||
|
||||
*/
|
||||
|
||||
private List<String> triggers;
|
||||
/**
|
||||
The conditions that determine whether the actions will be executed for a rule.
|
||||
|
||||
A condition should contain at least one entry in compositeConditions or simpleConditions.
|
||||
|
||||
If the field is omitted then the rule will apply to all nodes.
|
||||
|
||||
*/
|
||||
|
||||
private RestCompositeConditionDefinitionModel conditions;
|
||||
/**
|
||||
The actions for the rule
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private List<RestActionBodyExecTemplateModel> actions;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean getEnabled()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean getCascade()
|
||||
{
|
||||
return this.cascade;
|
||||
}
|
||||
|
||||
public void setCascade(boolean cascade)
|
||||
{
|
||||
this.cascade = cascade;
|
||||
}
|
||||
|
||||
public boolean getAsynchronous()
|
||||
{
|
||||
return this.asynchronous;
|
||||
}
|
||||
|
||||
public void setAsynchronous(boolean asynchronous)
|
||||
{
|
||||
this.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
public String getErrorScript()
|
||||
{
|
||||
return this.errorScript;
|
||||
}
|
||||
|
||||
public void setErrorScript(String errorScript)
|
||||
{
|
||||
this.errorScript = errorScript;
|
||||
}
|
||||
|
||||
public List<String> getTriggers()
|
||||
{
|
||||
return this.triggers;
|
||||
}
|
||||
|
||||
public void setTriggers(List<String> triggers)
|
||||
{
|
||||
this.triggers = triggers;
|
||||
}
|
||||
|
||||
public RestCompositeConditionDefinitionModel getConditions()
|
||||
{
|
||||
return this.conditions;
|
||||
}
|
||||
|
||||
public void setConditions(RestCompositeConditionDefinitionModel conditions)
|
||||
{
|
||||
this.conditions = conditions;
|
||||
}
|
||||
|
||||
public List<RestActionBodyExecTemplateModel> getActions()
|
||||
{
|
||||
return this.actions;
|
||||
}
|
||||
|
||||
public void setActions(List<RestActionBodyExecTemplateModel> actions)
|
||||
{
|
||||
this.actions = actions;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,218 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestRuleModel extends TestModel implements IRestModel<RestRuleModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestRuleModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestRuleModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestRuleModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestRuleModel model;
|
||||
|
||||
@Override
|
||||
public RestRuleModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Identifier for the rule
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String id;
|
||||
/**
|
||||
Name of the rule
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String name;
|
||||
/**
|
||||
Description of the rule
|
||||
*/
|
||||
|
||||
private String description;
|
||||
/**
|
||||
Whether the rule is enabled
|
||||
*/
|
||||
|
||||
private boolean enabled;
|
||||
/**
|
||||
Whether the rule also applies to subfolders
|
||||
*/
|
||||
|
||||
private boolean cascade;
|
||||
/**
|
||||
Whether the rule should be run in the background
|
||||
*/
|
||||
|
||||
private boolean asynchronous;
|
||||
/**
|
||||
If the rule should be run in the background then an optional error script can be referenced
|
||||
*/
|
||||
|
||||
private String errorScript;
|
||||
/**
|
||||
Whether the rule has been shared with more than one folder
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private boolean shared;
|
||||
/**
|
||||
The set of triggers that cause the rule to be activated.
|
||||
* inbound - The rule should be activated when an item enters the folder
|
||||
* update - The rule should be activated when an item within the folder is updated
|
||||
* outbound - The rule should be activated when an item leaves the folder or is deleted
|
||||
|
||||
*/
|
||||
|
||||
private List<String> triggers;
|
||||
/**
|
||||
The conditions that determine whether the actions will be executed for a rule.
|
||||
|
||||
A condition should contain at least one entry in compositeConditions or simpleConditions.
|
||||
|
||||
If the field is omitted then the rule will apply to all nodes.
|
||||
|
||||
*/
|
||||
|
||||
private RestCompositeConditionDefinitionModel conditions;
|
||||
/**
|
||||
The actions for the rule
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private List<RestActionBodyExecTemplateModel> actions;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean getEnabled()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean getCascade()
|
||||
{
|
||||
return this.cascade;
|
||||
}
|
||||
|
||||
public void setCascade(boolean cascade)
|
||||
{
|
||||
this.cascade = cascade;
|
||||
}
|
||||
|
||||
public boolean getAsynchronous()
|
||||
{
|
||||
return this.asynchronous;
|
||||
}
|
||||
|
||||
public void setAsynchronous(boolean asynchronous)
|
||||
{
|
||||
this.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
public String getErrorScript()
|
||||
{
|
||||
return this.errorScript;
|
||||
}
|
||||
|
||||
public void setErrorScript(String errorScript)
|
||||
{
|
||||
this.errorScript = errorScript;
|
||||
}
|
||||
|
||||
public boolean getShared()
|
||||
{
|
||||
return this.shared;
|
||||
}
|
||||
|
||||
public void setShared(boolean shared)
|
||||
{
|
||||
this.shared = shared;
|
||||
}
|
||||
|
||||
public List<String> getTriggers()
|
||||
{
|
||||
return this.triggers;
|
||||
}
|
||||
|
||||
public void setTriggers(List<String> triggers)
|
||||
{
|
||||
this.triggers = triggers;
|
||||
}
|
||||
|
||||
public RestCompositeConditionDefinitionModel getConditions()
|
||||
{
|
||||
return this.conditions;
|
||||
}
|
||||
|
||||
public void setConditions(RestCompositeConditionDefinitionModel conditions)
|
||||
{
|
||||
this.conditions = conditions;
|
||||
}
|
||||
|
||||
public List<RestActionBodyExecTemplateModel> getActions()
|
||||
{
|
||||
return this.actions;
|
||||
}
|
||||
|
||||
public void setActions(List<RestActionBodyExecTemplateModel> actions)
|
||||
{
|
||||
this.actions = actions;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,8 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
public class RestRuleModelsCollection extends RestModels<RestRuleModel, RestRuleModelsCollection>
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestRuleSetBodyUpdateModel extends TestModel implements IRestModel<RestRuleSetBodyUpdateModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestRuleSetBodyUpdateModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestRuleSetBodyUpdateModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestRuleSetBodyUpdateModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestRuleSetBodyUpdateModel model;
|
||||
|
||||
@Override
|
||||
public RestRuleSetBodyUpdateModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
An ordered list of the rule ids within the rule set.
|
||||
|
||||
Rules may not be added or removed from the rule set using this endpoint.
|
||||
|
||||
If this field is omitted then there is no change to the rule ordering.
|
||||
|
||||
*/
|
||||
|
||||
private List<String> ruleIds;
|
||||
|
||||
public List<String> getRuleIds()
|
||||
{
|
||||
return this.ruleIds;
|
||||
}
|
||||
|
||||
public void setRuleIds(List<String> ruleIds)
|
||||
{
|
||||
this.ruleIds = ruleIds;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,105 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestRuleSetModel extends TestModel implements IRestModel<RestRuleSetModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestRuleSetModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestRuleSetModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestRuleSetModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestRuleSetModel model;
|
||||
|
||||
@Override
|
||||
public RestRuleSetModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
Identifier for the rule set
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String id;
|
||||
/**
|
||||
True if the rule set is shared to at least one folder
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private boolean shared;
|
||||
/**
|
||||
List of folder identifiers which use the rule set.
|
||||
|
||||
Note that any folders the user does not have access to will not appear in this list. Use **shared** instead to check existence of any link.
|
||||
|
||||
*/
|
||||
|
||||
private List<String> usedBy;
|
||||
/**
|
||||
An ordered list of the rule ids within the rule set
|
||||
*/
|
||||
|
||||
private List<String> ruleIds;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean getShared()
|
||||
{
|
||||
return this.shared;
|
||||
}
|
||||
|
||||
public void setShared(boolean shared)
|
||||
{
|
||||
this.shared = shared;
|
||||
}
|
||||
|
||||
public List<String> getUsedBy()
|
||||
{
|
||||
return this.usedBy;
|
||||
}
|
||||
|
||||
public void setUsedBy(List<String> usedBy)
|
||||
{
|
||||
this.usedBy = usedBy;
|
||||
}
|
||||
|
||||
public List<String> getRuleIds()
|
||||
{
|
||||
return this.ruleIds;
|
||||
}
|
||||
|
||||
public void setRuleIds(List<String> ruleIds)
|
||||
{
|
||||
this.ruleIds = ruleIds;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,8 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
public class RestRuleSetModelsCollection extends RestModels<RestRuleSetModel, RestRuleSetModelsCollection>
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'Kristian.Dimitrov@hyland.com' on '2022-07-13 15:53' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
|
||||
*/
|
||||
public class RestSimpleConditionDefinitionModel extends TestModel implements IRestModel<RestSimpleConditionDefinitionModel>
|
||||
{
|
||||
@Override
|
||||
public ModelAssertion<RestSimpleConditionDefinitionModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestSimpleConditionDefinitionModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestSimpleConditionDefinitionModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
|
||||
@JsonProperty(value = "entry")
|
||||
RestSimpleConditionDefinitionModel model;
|
||||
|
||||
@Override
|
||||
public RestSimpleConditionDefinitionModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
The name of the property to compare.
|
||||
|
||||
This should be either a property (e.g. "cm:name") or one of the keywords from this list:
|
||||
* size (the size of the content for a node)
|
||||
* mimetype (the mimetype of the content for a node)
|
||||
* encoding (the encoding of the content for a node)
|
||||
* category (a category for the node)
|
||||
* tag (a tag that the node has)
|
||||
* aspect (an aspect that the node has)
|
||||
|
||||
For multi-valued properties the condition is satisfied if any of the values match the condition.
|
||||
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String field;
|
||||
/**
|
||||
The method to compare the property against the parameter.
|
||||
|
||||
Depending on the type of the property then different comparators are available:
|
||||
* All types: equals
|
||||
* text: contains, startsWith, endsWith
|
||||
* int/long/float/double/date: greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual
|
||||
* type: instanceOf
|
||||
|
||||
Where a property is multivalued then the condition is true if it is satisfied by any of the values.
|
||||
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String comparator;
|
||||
/**
|
||||
The value to compare the field against
|
||||
*/
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String parameter;
|
||||
|
||||
public String getField()
|
||||
{
|
||||
return this.field;
|
||||
}
|
||||
|
||||
public void setField(String field)
|
||||
{
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public String getComparator()
|
||||
{
|
||||
return this.comparator;
|
||||
}
|
||||
|
||||
public void setComparator(String comparator)
|
||||
{
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
public String getParameter()
|
||||
{
|
||||
return this.parameter;
|
||||
}
|
||||
|
||||
public void setParameter(String parameter)
|
||||
{
|
||||
this.parameter = parameter;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,78 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
import org.testng.Assert;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
public class RestSiteGroupModel extends TestModel implements IRestModel<RestSiteGroupModel>
|
||||
{
|
||||
@JsonProperty(value = "entry")
|
||||
RestSiteGroupModel model;
|
||||
|
||||
@Override
|
||||
public RestSiteGroupModel onModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
private UserRole role;
|
||||
private String id = "no-id";
|
||||
private RestGroupsModel group;
|
||||
|
||||
public UserRole getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(UserRole role)
|
||||
{
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public RestGroupsModel getGroup()
|
||||
{
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(RestGroupsModel group)
|
||||
{
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public RestSiteGroupModel assertSiteGroupHasRole(UserRole role) {
|
||||
STEP(String.format("REST API: Assert that site group role is '%s'", role));
|
||||
Assert.assertEquals(getRole(), role, "Site group role is not as expected.");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* DSL for assertion on this rest model
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAssertion<RestSiteGroupModel> assertThat()
|
||||
{
|
||||
return new ModelAssertion<RestSiteGroupModel>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAssertion<RestSiteGroupModel> and()
|
||||
{
|
||||
return assertThat();
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
|
||||
public class RestSiteGroupModelsCollection extends RestModels<RestSiteGroupModel, RestSiteGroupModelsCollection>
|
||||
{
|
||||
|
||||
/**
|
||||
* Get groups from site groups list
|
||||
*/
|
||||
public RestSiteGroupModel getSiteGroups(String groupId)
|
||||
{
|
||||
STEP(String.format("REST API: Get site group with id '%s'", groupId));
|
||||
RestSiteGroupModel siteGroupEntry = null;
|
||||
List<RestSiteGroupModel> siteGroups = getEntries();
|
||||
|
||||
for (int i = 1; i < siteGroups.size(); i++)
|
||||
{
|
||||
if (siteGroups.get(i).onModel().getId().equals(groupId))
|
||||
{
|
||||
siteGroupEntry = siteGroups.get(i).onModel();
|
||||
}
|
||||
}
|
||||
|
||||
return siteGroupEntry;
|
||||
}
|
||||
|
||||
}
|
@@ -23,7 +23,8 @@ public class RestSiteMemberModel extends TestModel implements IRestModel<RestSit
|
||||
|
||||
private UserRole role;
|
||||
private String id = "no-id";
|
||||
|
||||
private boolean isMemberOfGroup;
|
||||
|
||||
private RestPersonModel person;
|
||||
|
||||
public UserRole getRole()
|
||||
@@ -51,6 +52,16 @@ public class RestSiteMemberModel extends TestModel implements IRestModel<RestSit
|
||||
return person;
|
||||
}
|
||||
|
||||
public boolean getIsMemberOfGroup()
|
||||
{
|
||||
return isMemberOfGroup;
|
||||
}
|
||||
|
||||
public void setIsMemberOfGroup(boolean memberOfGroup)
|
||||
{
|
||||
isMemberOfGroup = memberOfGroup;
|
||||
}
|
||||
|
||||
public void setPerson(RestPersonModel person)
|
||||
{
|
||||
this.person = person;
|
||||
|
@@ -22,6 +22,7 @@ import org.alfresco.rest.core.RestModels;
|
||||
* {
|
||||
* "entry": {
|
||||
* "role": "SiteManager",
|
||||
* "isMemberOfGroup": false,
|
||||
* "person": {
|
||||
* "firstName": "Administrator",
|
||||
* "emailNotificationsEnabled": true,
|
||||
@@ -36,6 +37,7 @@ import org.alfresco.rest.core.RestModels;
|
||||
* {
|
||||
* "entry": {
|
||||
* "role": "SiteConsumer",
|
||||
* "isMemberOfGroup": false,
|
||||
* "person": {
|
||||
* "firstName": "CqeKxvPHBd FirstName",
|
||||
* "lastName": "LN-CqeKxvPHBd",
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
@@ -7,7 +9,7 @@ import org.alfresco.utility.model.TestModel;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generated by 'aforascu' on '2018-01-10 16:02' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated by 'tsalvado' on '2021-08-18 21:15' from 'Alfresco Content Services REST API' swagger file
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api}
|
||||
*/
|
||||
@@ -47,6 +49,9 @@ public class RestStatusInfoModel extends TestModel implements IRestModel<RestSta
|
||||
@JsonProperty(required = true)
|
||||
private boolean isThumbnailGenerationEnabled;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private boolean isDirectAccessUrlEnabled;
|
||||
|
||||
public boolean getIsReadOnly()
|
||||
{
|
||||
return this.isReadOnly;
|
||||
@@ -86,5 +91,15 @@ public class RestStatusInfoModel extends TestModel implements IRestModel<RestSta
|
||||
{
|
||||
this.isThumbnailGenerationEnabled = isThumbnailGenerationEnabled;
|
||||
}
|
||||
|
||||
public boolean getIsDirectAccessUrlEnabled()
|
||||
{
|
||||
return this.isDirectAccessUrlEnabled;
|
||||
}
|
||||
|
||||
public void setIsDirectAccessUrlEnabled(boolean isDirectAccessUrlEnabled)
|
||||
{
|
||||
this.isDirectAccessUrlEnabled = isDirectAccessUrlEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,12 @@ public class RestSyncServiceComponentModel extends TestModel
|
||||
@JsonProperty
|
||||
private String message;
|
||||
|
||||
@JsonProperty
|
||||
private int duration;
|
||||
|
||||
@JsonProperty
|
||||
private String timestamp;
|
||||
|
||||
public Boolean getHealthy()
|
||||
{
|
||||
return healthy;
|
||||
@@ -46,4 +52,14 @@ public class RestSyncServiceComponentModel extends TestModel
|
||||
return message;
|
||||
}
|
||||
|
||||
public int getDuration()
|
||||
{
|
||||
return duration;
|
||||
}
|
||||
|
||||
public String getTimestamp()
|
||||
{
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -63,6 +63,8 @@ public class RestSyncServiceConfigModel extends TestModel
|
||||
@JsonProperty(required = true)
|
||||
private RestSyncServiceRepoInfoModel repoInfo;
|
||||
|
||||
private RestIdentityServiceConfigurationModel identityServiceConfig;
|
||||
|
||||
public String getDsyncClientVersionMin()
|
||||
{
|
||||
return dsyncClientVersionMin;
|
||||
@@ -77,5 +79,8 @@ public class RestSyncServiceConfigModel extends TestModel
|
||||
{
|
||||
return repoInfo;
|
||||
}
|
||||
|
||||
|
||||
public RestIdentityServiceConfigurationModel getIdentityServiceConfig() {
|
||||
return identityServiceConfig;
|
||||
}
|
||||
}
|
||||
|
@@ -67,6 +67,8 @@ public class RestSyncServiceModel extends TestModel
|
||||
@JsonProperty(required = true)
|
||||
private RestSyncServiceConfigModel config;
|
||||
|
||||
private RestIdentityServiceConfigurationModel identityServiceConfig;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
@@ -81,5 +83,12 @@ public class RestSyncServiceModel extends TestModel
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
public RestIdentityServiceConfigurationModel getIdentityServiceConfig() {
|
||||
return identityServiceConfig;
|
||||
}
|
||||
|
||||
public void setIdentityServiceConfig(RestIdentityServiceConfigurationModel identityServiceConfig) {
|
||||
this.identityServiceConfig = identityServiceConfig;
|
||||
}
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
"async": false,
|
||||
"authority": null,
|
||||
"cascade": false
|
||||
"folderChange": false
|
||||
}
|
||||
]
|
||||
*/
|
||||
@@ -147,6 +148,9 @@ public class RestSyncSetChangesModel extends TestModel
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private int numberOfSecondaryAssocs;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private boolean folderChange;
|
||||
|
||||
|
||||
|
||||
@@ -294,4 +298,12 @@ public class RestSyncSetChangesModel extends TestModel
|
||||
{
|
||||
this.numberOfSecondaryAssocs = numberOfSecondaryAssocs;
|
||||
}
|
||||
|
||||
public boolean isFolderChange() {
|
||||
return folderChange;
|
||||
}
|
||||
|
||||
public void setFolderChange(boolean folderChange) {
|
||||
this.folderChange = folderChange;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,5 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
public class RestTypeModel extends RestAbstractClassModel
|
||||
{
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package org.alfresco.rest.model;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
public class RestTypesCollection extends RestModels<RestTypeModel, RestTypesCollection>
|
||||
{
|
||||
}
|
@@ -61,7 +61,7 @@ public class NodesBuilder
|
||||
this.lastNode = repoModel;
|
||||
}
|
||||
|
||||
public NodeDetail folder(String prefix) throws Exception
|
||||
public NodeDetail folder(String prefix)
|
||||
{
|
||||
NodeDetail n = new NodeDetail(prefix, lastNode.getNodeRef(), "cm:folder");
|
||||
nodes.add(n);
|
||||
@@ -81,7 +81,7 @@ public class NodesBuilder
|
||||
cm.setNodeRef(getId());
|
||||
return cm;
|
||||
}
|
||||
public NodeDetail(String prefix, String parentId, String nodeType) throws Exception
|
||||
public NodeDetail(String prefix, String parentId, String nodeType)
|
||||
{
|
||||
this.prefix = prefix;
|
||||
this.name = RandomData.getRandomName(prefix);
|
||||
@@ -108,14 +108,14 @@ public class NodesBuilder
|
||||
|
||||
}
|
||||
|
||||
public NodeDetail folder(String prefix) throws Exception
|
||||
public NodeDetail folder(String prefix)
|
||||
{
|
||||
NodeDetail n = new NodeDetail(prefix, parentNodeModel.getId(), "cm:folder");
|
||||
nodes.add(n);
|
||||
return n;
|
||||
}
|
||||
|
||||
public NodeDetail file(String prefix) throws Exception
|
||||
public NodeDetail file(String prefix)
|
||||
{
|
||||
NodeDetail n = new NodeDetail(prefix, parentNodeModel.getId(), "cm:content");
|
||||
nodes.add(n);
|
||||
|
@@ -21,7 +21,7 @@ public class Actions extends ModelRequest<Actions>
|
||||
/**
|
||||
* List available actions using GET on '/action-definitions'
|
||||
*/
|
||||
public RestActionDefinitionModelsCollection listActionDefinitions() throws Exception
|
||||
public RestActionDefinitionModelsCollection listActionDefinitions()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "action-definitions?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestActionDefinitionModelsCollection.class, request);
|
||||
@@ -30,7 +30,7 @@ public class Actions extends ModelRequest<Actions>
|
||||
/**
|
||||
* Execute action with parameters using POST on '/action-executions'
|
||||
*/
|
||||
public JSONObject executeAction(String actionDefinitionId, RepoTestModel targetNode, Map<String, String> params) throws Exception
|
||||
public JSONObject executeAction(String actionDefinitionId, RepoTestModel targetNode, Map<String, String> params)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.executeActionPostBody(actionDefinitionId, targetNode, params);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "action-executions");
|
||||
@@ -40,7 +40,7 @@ public class Actions extends ModelRequest<Actions>
|
||||
/**
|
||||
* Execute action without parameters using POST on '/action-executions'
|
||||
*/
|
||||
public JSONObject executeAction(String actionDefinitionId, RepoTestModel targetNode) throws Exception
|
||||
public JSONObject executeAction(String actionDefinitionId, RepoTestModel targetNode)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.executeActionPostBody(actionDefinitionId, targetNode);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "action-executions");
|
||||
@@ -50,7 +50,7 @@ public class Actions extends ModelRequest<Actions>
|
||||
/**
|
||||
* Get specific action definition using GET on '/action-definitions/{actionDefinitionId}'
|
||||
*/
|
||||
public RestActionDefinitionModel getActionDefinitionById(String actionDefinitionId) throws Exception
|
||||
public RestActionDefinitionModel getActionDefinitionById(String actionDefinitionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "action-definitions/".concat(actionDefinitionId));
|
||||
return restWrapper.processModel(RestActionDefinitionModel.class, request);
|
||||
|
@@ -18,7 +18,7 @@ import org.springframework.http.HttpMethod;
|
||||
public class Audit extends ModelRequest<Audit>
|
||||
{
|
||||
|
||||
public Audit(RestWrapper restWrapper) throws Exception
|
||||
public Audit(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class Audit extends ModelRequest<Audit>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestAuditAppModelsCollection getAuditApplications() throws Exception
|
||||
public RestAuditAppModelsCollection getAuditApplications() throws JsonToModelConversionException
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "audit-applications?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestAuditAppModelsCollection.class, request);
|
||||
@@ -41,9 +41,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
*
|
||||
* @param auditApplicationId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestAuditAppModel getAuditApp(RestAuditAppModel restAuditAppModel) throws Exception
|
||||
public RestAuditAppModel getAuditApp(RestAuditAppModel restAuditAppModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "audit-applications/{auditApplicationId}?{parameters}", restAuditAppModel.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestAuditAppModel.class, request);
|
||||
@@ -54,9 +53,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
*
|
||||
* @param auditApplicationId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestAuditEntryModelsCollection listAuditEntriesForAnAuditApplication(String auditApplicationId) throws Exception
|
||||
public RestAuditEntryModelsCollection listAuditEntriesForAnAuditApplication(String auditApplicationId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "audit-applications/{auditApplicationId}/audit-entries?{parameters}", auditApplicationId, restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestAuditEntryModelsCollection.class, request);
|
||||
@@ -69,9 +67,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestAuditAppModel updateAuditApp(RestAuditAppModel restAuditAppModel, String key, String value) throws Exception
|
||||
public RestAuditAppModel updateAuditApp(RestAuditAppModel restAuditAppModel, String key, String value)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson(key, value);
|
||||
|
||||
@@ -85,9 +82,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
* @param auditApplicationId
|
||||
* @param auditEntryId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestAuditEntryModel getAuditEntryForAnAuditApplication(String auditApplicationId, String auditEntryId) throws Exception
|
||||
public RestAuditEntryModel getAuditEntryForAnAuditApplication(String auditApplicationId, String auditEntryId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "audit-applications/{auditApplicationId}/audit-entries/{auditEntryId}?{parameters}", auditApplicationId, auditEntryId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestAuditEntryModel.class, request);
|
||||
@@ -99,9 +95,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
* @param auditApplicationId
|
||||
* @param auditEntryId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAuditEntryForAnAuditApplication(String auditApplicationId, String auditEntryId) throws Exception
|
||||
public void deleteAuditEntryForAnAuditApplication(String auditApplicationId, String auditEntryId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "audit-applications/{auditApplicationId}/audit-entries/{auditEntryId}", auditApplicationId, auditEntryId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -112,9 +107,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
*
|
||||
* @param auditApplicationId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAuditEntriesForAnAuditApplication(String auditApplicationId) throws Exception
|
||||
public void deleteAuditEntriesForAnAuditApplication(String auditApplicationId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "audit-applications/{auditApplicationId}/audit-entries?{parameters}", auditApplicationId, restWrapper.getParameters());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -125,9 +119,8 @@ public class Audit extends ModelRequest<Audit>
|
||||
*
|
||||
* @param nodeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestAuditEntryModelsCollection listAuditEntriesForNode(String nodeId) throws Exception
|
||||
public RestAuditEntryModelsCollection listAuditEntriesForNode(String nodeId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/audit-entries?{parameters}", nodeId, restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestAuditEntryModelsCollection.class, request);
|
||||
|
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Copyright 2021 Alfresco Software, Ltd. All rights reserved.
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestArchiveContentRequestModel;
|
||||
import org.alfresco.rest.model.RestContentStorageInfoModel;
|
||||
import org.alfresco.rest.model.RestRestoreArchivedContentRequestModel;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
public class ContentStorageInformation extends ModelRequest<ContentStorageInformation>
|
||||
{
|
||||
private static final String BASE_PATH = "nodes/{nodeId}/storage-info/{contentPropName}";
|
||||
private static final String VERSIONS_BASE_PATH = "nodes/{nodeId}/versions/{versionId}/storage-info/{contentPropName}";
|
||||
private static final String ARCHIVE_PATH_SUFFIX = "/archive";
|
||||
private static final String ARCHIVE_RESTORE_PATH_SUFFIX = "/archive-restore";
|
||||
|
||||
private String nodeId;
|
||||
private String contentPropName;
|
||||
private String versionId;
|
||||
|
||||
public ContentStorageInformation(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
|
||||
public ContentStorageInformation withNodeId(String nodeId)
|
||||
{
|
||||
this.nodeId = nodeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContentStorageInformation withContentPropName(String contentPropName)
|
||||
{
|
||||
this.contentPropName = contentPropName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContentStorageInformation withVersionId(String versionId)
|
||||
{
|
||||
this.versionId = versionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Content Storage Properties using GET call on "nodes/{nodeId}/storage-info/{contentPropName}"
|
||||
* @return
|
||||
*/
|
||||
public RestContentStorageInfoModel getStorageInfo()
|
||||
{
|
||||
return getStorageInfo(nodeId, contentPropName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Content Version Storage Properties using GET call on "nodes/{nodeId}/versions/{versionId}/storage-info/{contentPropName}"
|
||||
* @return
|
||||
*/
|
||||
public RestContentStorageInfoModel getVersionStorageInfo()
|
||||
{
|
||||
return getVersionStorageInfo(nodeId, versionId, contentPropName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Content Storage Properties using GET call on "nodes/{nodeId}/storage-info/{contentPropName}"
|
||||
* @param nodeId The nodeId
|
||||
* @param contentPropName The content property QNAME ie. "cm:content"
|
||||
* @return
|
||||
*/
|
||||
public RestContentStorageInfoModel getStorageInfo(String nodeId, String contentPropName)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, BASE_PATH, nodeId, contentPropName);
|
||||
return restWrapper.processModel(RestContentStorageInfoModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Content Version Storage Properties using GET call on "nodes/{nodeId}/versions/{versionId}/storage-info/{contentPropName}"
|
||||
* @param nodeId The nodeId
|
||||
* @param versionId The versionId
|
||||
* @param contentPropName The content property QNAME ie. "cm:content"
|
||||
* @return object of {@link RestContentStorageInfoModel}
|
||||
*/
|
||||
public RestContentStorageInfoModel getVersionStorageInfo(String nodeId, String versionId, String contentPropName)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, VERSIONS_BASE_PATH, nodeId, versionId, contentPropName);
|
||||
return restWrapper.processModel(RestContentStorageInfoModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send content to archive using POST call on "nodes/{nodeId}/storage-info/{contentPropName}/archive"
|
||||
*
|
||||
* @param archiveContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestArchiveContent(RestArchiveContentRequestModel archiveContentRequest)
|
||||
{
|
||||
return requestArchiveContent(nodeId, contentPropName, archiveContentRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send version content to archive using POST call on "nodes/{nodeId}/versions/{versionId}/storage-info/{contentPropName}/archive"
|
||||
*
|
||||
* @param archiveContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestArchiveVersionContent(RestArchiveContentRequestModel archiveContentRequest)
|
||||
{
|
||||
return requestArchiveVersionContent(nodeId, contentPropName, versionId, archiveContentRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send content to archive using POST call on "nodes/{nodeId}/storage-info/{contentPropName}/archive"
|
||||
*
|
||||
* @param nodeId The nodeId
|
||||
* @param contentPropName The content property QNAME ie. "cm:content"
|
||||
* @param archiveContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestArchiveContent(String nodeId, String contentPropName, RestArchiveContentRequestModel archiveContentRequest)
|
||||
{
|
||||
RestRequest request = createRestRequestWithBody(HttpMethod.POST, archiveContentRequest, BASE_PATH + ARCHIVE_PATH_SUFFIX, nodeId, contentPropName);
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send version content to archive using POST call on "nodes/{nodeId}/versions/{versionId}/storage-info/{contentPropName}/archive"
|
||||
*
|
||||
* @param nodeId The nodeId
|
||||
* @param contentPropName The content property QNAME ie. "cm:content"
|
||||
* @param versionId The versionId
|
||||
* @param archiveContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestArchiveVersionContent(String nodeId, String contentPropName, String versionId, RestArchiveContentRequestModel archiveContentRequest)
|
||||
{
|
||||
RestRequest request = createRestRequestWithBody(HttpMethod.POST, archiveContentRequest, VERSIONS_BASE_PATH + ARCHIVE_PATH_SUFFIX, nodeId, versionId, contentPropName);
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore content from archive using POST call on "nodes/{nodeId}/storage-info/{contentPropName}/archive-restore"
|
||||
*
|
||||
* @param restoreArchivedContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestRestoreContentFromArchive(RestRestoreArchivedContentRequestModel restoreArchivedContentRequest)
|
||||
{
|
||||
return requestRestoreContentFromArchive(nodeId, contentPropName, restoreArchivedContentRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore version content from archive using POST call on "nodes/{nodeId}/storage-info/versions/{versionId}/{contentPropName}/archive-restore"
|
||||
*
|
||||
* @param restoreArchivedContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestRestoreVersionContentFromArchive(RestRestoreArchivedContentRequestModel restoreArchivedContentRequest)
|
||||
{
|
||||
return requestRestoreVersionContentFromArchive(nodeId, contentPropName, versionId, restoreArchivedContentRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore content from archive using POST call on "nodes/{nodeId}/storage-info/{contentPropName}/archive-restore"
|
||||
*
|
||||
* @param nodeId The nodeId
|
||||
* @param contentPropName The content property QNAME ie. "cm:content"
|
||||
* @param restoreArchivedContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestRestoreContentFromArchive(String nodeId, String contentPropName, RestRestoreArchivedContentRequestModel restoreArchivedContentRequest)
|
||||
{
|
||||
RestRequest request = createRestRequestWithBody(HttpMethod.POST, restoreArchivedContentRequest, BASE_PATH +
|
||||
ARCHIVE_RESTORE_PATH_SUFFIX, nodeId, contentPropName);
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore version content from archive using POST call on "nodes/{nodeId}/storage-info/{contentPropName}/archive-restore"
|
||||
*
|
||||
* @param nodeId The nodeId
|
||||
* @param contentPropName The content property QNAME ie. "cm:content"
|
||||
* @param versionId The versionId
|
||||
* @param restoreArchivedContentRequest The request body
|
||||
* @return
|
||||
*/
|
||||
public RestResponse requestRestoreVersionContentFromArchive(String nodeId, String contentPropName, String versionId,
|
||||
RestRestoreArchivedContentRequestModel restoreArchivedContentRequest)
|
||||
{
|
||||
RestRequest request = createRestRequestWithBody(HttpMethod.POST, restoreArchivedContentRequest, VERSIONS_BASE_PATH +
|
||||
ARCHIVE_RESTORE_PATH_SUFFIX, nodeId, versionId, contentPropName);
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
private RestRequest createRestRequestWithBody(HttpMethod httpMethod, TestModel request, String path, String... pathParams)
|
||||
{
|
||||
if (request != null)
|
||||
{
|
||||
return RestRequest.requestWithBody(httpMethod, request.toJson(), path, pathParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
return RestRequest.simpleRequest(httpMethod, path, pathParams);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,5 @@
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import javax.json.JsonArrayBuilder;
|
||||
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
@@ -18,7 +16,9 @@ public class CustomAspectModelManager extends ModelRequest<CustomAspectModelMana
|
||||
{
|
||||
private CustomContentModel customContentModel;
|
||||
private CustomAspectModel customAspectModel;
|
||||
|
||||
private CustomModelProperties customProperties = new CustomModelProperties(restWrapper);
|
||||
|
||||
|
||||
public CustomAspectModelManager(CustomContentModel customContentModel, CustomAspectModel aspectModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
@@ -29,41 +29,58 @@ public class CustomAspectModelManager extends ModelRequest<CustomAspectModelMana
|
||||
public RestCustomAspectModel getAspect()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "cmm/{modelName}/aspects/{aspectName}?{parameters}",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName(), restWrapper.getParameters());
|
||||
this.customContentModel.getName(), this.customAspectModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomAspectModel.class, request);
|
||||
}
|
||||
|
||||
public void addProperty(CustomAspectPropertiesModel propertyModel)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
array.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", propertyModel.getName())
|
||||
.add("title", propertyModel.getTitle())
|
||||
.add("description", propertyModel.getDescription())
|
||||
.add("dataType", propertyModel.getDataType())
|
||||
.add("multiValued", propertyModel.isMultiValued())
|
||||
.add("mandatory", propertyModel.isMandatory())
|
||||
.add("mandatoryEnforced", propertyModel.isMandatoryEnforced()));
|
||||
|
||||
String body = JsonBodyGenerator.defineJSON().add("name", this.customAspectModel.getName()).add("properties", array).build().toString();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, "cmm/{modelName}/aspects/{aspectName}?select=props",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true,
|
||||
this.customAspectModel.getName(), false, null);
|
||||
}
|
||||
|
||||
|
||||
public void addPropertyWithMinMaxValueConstraint(CustomAspectPropertiesModel propertyModel, int minValue, int maxValue)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createMinMaxValueConstraintArray(minValue, maxValue));
|
||||
}
|
||||
|
||||
public void addPropertyWithMinMaxLengthConstraint(CustomAspectPropertiesModel propertyModel, int minLength, int maxLength)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createMinMaxLengthConstraint(minLength, maxLength));
|
||||
}
|
||||
|
||||
public void addPropertyWithListOfValues(CustomAspectPropertiesModel propertyModel, boolean sorted, String... listOfValues)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createListOfValuesConstraint(sorted, listOfValues));
|
||||
}
|
||||
|
||||
public void addPropertyWithRegularExpression(CustomAspectPropertiesModel propertyModel, String regex)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, true, this.customAspectModel.getName(),
|
||||
true, customProperties.createRegexConstraint(regex));
|
||||
}
|
||||
|
||||
public void deleteAspectProperty(CustomAspectPropertiesModel propertyModel)
|
||||
{
|
||||
String body = JsonBodyGenerator.defineJSON()
|
||||
.add("name", this.customAspectModel.getName()).build().toString();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, "cmm/{modelName}/aspects/{aspectName}?select=props&delete={propertyName}",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName(), propertyModel.getName());
|
||||
.add("name", this.customAspectModel.getName()).build().toString();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body,
|
||||
"cmm/{modelName}/aspects/{aspectName}?select=props&delete={propertyName}",
|
||||
this.customContentModel.getName(),
|
||||
this.customAspectModel.getName(),
|
||||
propertyModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
public void deleteAspect()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "cmm/{modelName}/aspects/{aspectName}",
|
||||
this.customContentModel.getName(), this.customAspectModel.getName());
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE,
|
||||
"cmm/{modelName}/aspects/{aspectName}",
|
||||
this.customContentModel.getName(),
|
||||
this.customAspectModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
||||
|
@@ -3,10 +3,19 @@ package org.alfresco.rest.requests;
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestCustomAspectModel;
|
||||
import org.alfresco.rest.model.RestCustomModel;
|
||||
import org.alfresco.rest.model.RestCustomTypeModel;
|
||||
import org.alfresco.rest.model.RestGroupsModelsCollection;
|
||||
import org.alfresco.utility.model.CustomAspectModel;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.CustomContentModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonArrayBuilder;
|
||||
import javax.json.JsonObject;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
@@ -14,12 +23,30 @@ public class CustomModelManager extends ModelRequest<CustomModelManager>
|
||||
{
|
||||
private CustomContentModel customContentModel;
|
||||
|
||||
public CustomModelManager(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
public CustomModelManager(CustomContentModel customContentModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.customContentModel = customContentModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new custom model
|
||||
*
|
||||
* @param customContentModel
|
||||
* @return {@link RestCustomModel}
|
||||
*/
|
||||
public RestCustomModel createCustomModel(CustomContentModel customContentModel)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, customContentModel.toJson(),
|
||||
"cmm?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve one model using GET call on "cmm/{modelName}"
|
||||
*
|
||||
@@ -51,4 +78,18 @@ public class CustomModelManager extends ModelRequest<CustomModelManager>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "cmm/{modelName}", this.customContentModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
public RestCustomAspectModel createAspect(CustomAspectModel aspectModel)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, aspectModel.toJson(),
|
||||
"cmm/{modelName}/aspects?{parameters}", this.customContentModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomAspectModel.class, request);
|
||||
}
|
||||
|
||||
public RestCustomTypeModel createCustomType(RestCustomTypeModel customType)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, customType.toJson(),
|
||||
"cmm/{modelName}/types?{parameters}", this.customContentModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomTypeModel.class, request);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,164 @@
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.CustomContentModel;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import javax.json.JsonArrayBuilder;
|
||||
import javax.json.JsonObjectBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
public class CustomModelProperties extends ModelRequest<CustomModelProperties>
|
||||
{
|
||||
public CustomModelProperties(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
public void addProperty(CustomAspectPropertiesModel propertyModel,
|
||||
CustomContentModel customContentModel,
|
||||
boolean isAspect,
|
||||
String aspectOrTypeName,
|
||||
boolean hasConstraints,
|
||||
JsonArrayBuilder constraintsArray)
|
||||
{
|
||||
JsonArrayBuilder array;
|
||||
if(hasConstraints)
|
||||
{
|
||||
array = getPropertiesArray(propertyModel, true, constraintsArray);
|
||||
}
|
||||
else
|
||||
{
|
||||
array = getPropertiesArray(propertyModel, false, null);
|
||||
}
|
||||
|
||||
String body = JsonBodyGenerator.defineJSON()
|
||||
.add("name", aspectOrTypeName)
|
||||
.add("properties", array).build().toString();
|
||||
String urlPath;
|
||||
if(isAspect)
|
||||
{
|
||||
urlPath = "cmm/{modelName}/aspects/{aspectName}?select=props";
|
||||
}
|
||||
else
|
||||
{
|
||||
urlPath = "cmm/{modelName}/types/{typeName}?select=props";
|
||||
}
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, urlPath,
|
||||
customContentModel.getName(), aspectOrTypeName);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
private JsonArrayBuilder getPropertiesArray(CustomAspectPropertiesModel propertyModel, boolean hasConstraints, JsonArrayBuilder constraintsArray)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();;
|
||||
if(hasConstraints)
|
||||
{
|
||||
array.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", propertyModel.getName())
|
||||
.add("title", propertyModel.getTitle())
|
||||
.add("description", propertyModel.getDescription())
|
||||
.add("dataType", propertyModel.getDataType())
|
||||
.add("multiValued", propertyModel.isMultiValued())
|
||||
.add("mandatory", propertyModel.isMandatory())
|
||||
.add("mandatoryEnforced", propertyModel.isMandatoryEnforced())
|
||||
.add("constraints", constraintsArray));
|
||||
}
|
||||
else
|
||||
{
|
||||
array.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", propertyModel.getName())
|
||||
.add("title", propertyModel.getTitle())
|
||||
.add("description", propertyModel.getDescription())
|
||||
.add("dataType", propertyModel.getDataType())
|
||||
.add("multiValued", propertyModel.isMultiValued())
|
||||
.add("mandatory", propertyModel.isMandatory())
|
||||
.add("mandatoryEnforced", propertyModel.isMandatoryEnforced()));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createMinMaxValueConstraintArray(int minValue, int maxValue)
|
||||
{
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "minValue")
|
||||
.add("simpleValue", Integer.valueOf(minValue));
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "maxValue")
|
||||
.add("simpleValue", Integer.valueOf(maxValue));
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "MINMAX_" + UUID.randomUUID())
|
||||
.add("type", "MINMAX")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createMinMaxLengthConstraint(int minLength, int maxLength)
|
||||
{
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "minLength")
|
||||
.add("simpleValue", Integer.valueOf(minLength));
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "maxLength")
|
||||
.add("simpleValue", Integer.valueOf(maxLength));
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "LENGTH_" + UUID.randomUUID())
|
||||
.add("type", "LENGTH")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createListOfValuesConstraint(boolean sorted, String... listOfValues)
|
||||
{
|
||||
JsonArrayBuilder valuesArray = JsonBodyGenerator.defineJSONArray();
|
||||
Arrays.stream(listOfValues).forEach(valuesArray::add);
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "allowedValues")
|
||||
.add("listValue", valuesArray);
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "sorted")
|
||||
.add("simpleValue", Boolean.valueOf(sorted));
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "LIST_" + UUID.randomUUID())
|
||||
.add("type", "LIST")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
|
||||
public JsonArrayBuilder createRegexConstraint(String regex)
|
||||
{
|
||||
JsonArrayBuilder constraintsArray = JsonBodyGenerator.defineJSONArray();
|
||||
JsonObjectBuilder param1 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "expression")
|
||||
.add("simpleValue", regex);
|
||||
JsonObjectBuilder param2 = JsonBodyGenerator.defineJSON()
|
||||
.add("name", "requiresMatch")
|
||||
.add("simpleValue", true);
|
||||
JsonArrayBuilder parameters = JsonBodyGenerator.defineJSONArray();
|
||||
parameters.add(0, param1).add(1, param2);
|
||||
constraintsArray.add(JsonBodyGenerator.defineJSON()
|
||||
.add("name", "REGEX_" + UUID.randomUUID())
|
||||
.add("type", "REGEX")
|
||||
.add("parameters", parameters));
|
||||
return constraintsArray;
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestCustomTypeModel;
|
||||
import org.alfresco.utility.model.CustomAspectPropertiesModel;
|
||||
import org.alfresco.utility.model.CustomContentModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
/**
|
||||
* @author Bogdan Bocancea
|
||||
*/
|
||||
public class CustomTypeManager extends ModelRequest<CustomTypeManager>
|
||||
{
|
||||
private CustomContentModel customContentModel;
|
||||
private RestCustomTypeModel customTypeModel;
|
||||
private CustomModelProperties customProperties = new CustomModelProperties(restWrapper);
|
||||
|
||||
public CustomTypeManager(CustomContentModel customContentModel, RestCustomTypeModel customTypeModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.customContentModel = customContentModel;
|
||||
this.customTypeModel = customTypeModel;
|
||||
}
|
||||
|
||||
public RestCustomTypeModel getCustomType()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "cmm/{modelName}/types/{typeName}?{parameters}",
|
||||
this.customContentModel.getName(), this.customTypeModel.getName(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestCustomTypeModel.class, request);
|
||||
}
|
||||
|
||||
public void addProperty(CustomAspectPropertiesModel propertyModel)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false,
|
||||
this.customTypeModel.getName(), false, null);
|
||||
}
|
||||
|
||||
public void addPropertyWithMinMaxValueConstraint(CustomAspectPropertiesModel propertyModel, int minValue, int maxValue)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false, this.customTypeModel.getName(),
|
||||
true, customProperties.createMinMaxValueConstraintArray(minValue, maxValue));
|
||||
}
|
||||
|
||||
public void addPropertyWithMinMaxLengthConstraint(CustomAspectPropertiesModel propertyModel, int minLength, int maxLength)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false, this.customTypeModel.getName(),
|
||||
true, customProperties.createMinMaxLengthConstraint(minLength, maxLength));
|
||||
}
|
||||
|
||||
public void addPropertyWithListOfValues(CustomAspectPropertiesModel propertyModel, boolean sorted, String... listOfValues)
|
||||
{
|
||||
customProperties.addProperty(propertyModel, this.customContentModel, false, this.customTypeModel.getName(),
|
||||
true, customProperties.createListOfValuesConstraint(sorted, listOfValues));
|
||||
}
|
||||
|
||||
public void deleteCustomType()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE,
|
||||
"cmm/{modelName}/types/{typeName}",
|
||||
this.customContentModel.getName(),
|
||||
this.customTypeModel.getName());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
@@ -31,7 +31,7 @@ public class Deployments extends ModelRequest<Deployments>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestDeploymentModelsCollection getDeployments() throws Exception
|
||||
public RestDeploymentModelsCollection getDeployments()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deployments?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestDeploymentModelsCollection.class, request);
|
||||
@@ -43,7 +43,7 @@ public class Deployments extends ModelRequest<Deployments>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public void deleteDeployment() throws Exception
|
||||
public void deleteDeployment()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "deployments/{deploymentId}", deployment.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -55,7 +55,7 @@ public class Deployments extends ModelRequest<Deployments>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestDeploymentModel getDeployment() throws Exception
|
||||
public RestDeploymentModel getDeployment()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deployments/{deploymentId}?{parameters}",
|
||||
deployment.getId(), restWrapper.getParameters());
|
||||
|
@@ -19,7 +19,7 @@ public class Downloads extends ModelRequest<Downloads> {
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
public Downloads(RestDownloadsModel downloadsModel, RestWrapper restWrapper) throws Exception
|
||||
public Downloads(RestDownloadsModel downloadsModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.downloadsModel = downloadsModel;
|
||||
@@ -28,7 +28,7 @@ public class Downloads extends ModelRequest<Downloads> {
|
||||
/**
|
||||
* Get download details using POST call on "downloads"
|
||||
*/
|
||||
public RestDownloadsModel createDownload(String postBody) throws Exception
|
||||
public RestDownloadsModel createDownload(String postBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "downloads");
|
||||
return restWrapper.processModel(RestDownloadsModel.class, request);
|
||||
@@ -37,7 +37,7 @@ public class Downloads extends ModelRequest<Downloads> {
|
||||
/**
|
||||
* Get download details using GET call on "downloads/{downloadId}"
|
||||
*/
|
||||
public RestDownloadsModel getDownload() throws Exception
|
||||
public RestDownloadsModel getDownload()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "downloads/{downloadId}", downloadsModel.getId());
|
||||
return restWrapper.processModel(RestDownloadsModel.class, request);
|
||||
@@ -46,7 +46,7 @@ public class Downloads extends ModelRequest<Downloads> {
|
||||
/**
|
||||
* Cancel download using DELETE call on "downloads/{downloadId}"
|
||||
*/
|
||||
public void cancelDownload() throws Exception
|
||||
public void cancelDownload()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "downloads/{downloadId}", downloadsModel.getId());
|
||||
restWrapper.processEmptyModel(request);;
|
||||
|
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2022 Alfresco Software, Ltd. All rights reserved.
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestRuleModel;
|
||||
import org.alfresco.rest.model.RestRuleModelsCollection;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
public class FolderRules extends ModelRequest<FolderRules>
|
||||
{
|
||||
private static final String BASE_PATH = "nodes/{nodeId}/rule-sets/{ruleSetId}/rules";
|
||||
|
||||
private String nodeId;
|
||||
private String ruleSetId;
|
||||
|
||||
public FolderRules withNodeId(String nodeId)
|
||||
{
|
||||
this.nodeId = nodeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FolderRules withRuleSetId(String ruleSetId)
|
||||
{
|
||||
this.ruleSetId = ruleSetId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FolderRules(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of rules for the folder node using GET call on "nodes/{nodeId}/rule-sets/{ruleSetId}/rules"
|
||||
* @return
|
||||
*/
|
||||
public RestRuleModelsCollection getListOfRules()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, BASE_PATH, nodeId, ruleSetId);
|
||||
return restWrapper.processModels(RestRuleModelsCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single rule definition for the folder node using GET call on "nodes/{nodeId}/rule-sets/{ruleSetId}/rules/{ruleId}"
|
||||
* @return
|
||||
*/
|
||||
public RestRuleModel getSingleRule(String ruleId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, BASE_PATH + "/{ruleId}", nodeId, ruleSetId, ruleId);
|
||||
return restWrapper.processModel(RestRuleModel.class, request);
|
||||
}
|
||||
}
|
@@ -19,7 +19,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* List existing groups using GET on '/groups
|
||||
*/
|
||||
public RestGroupsModelsCollection listGroups() throws Exception
|
||||
public RestGroupsModelsCollection listGroups()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "groups?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestGroupsModelsCollection.class, request);
|
||||
@@ -28,7 +28,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* Create a group using POST on '/groups
|
||||
*/
|
||||
public RestGroupsModel createGroup(String groupBodyCreate) throws Exception
|
||||
public RestGroupsModel createGroup(String groupBodyCreate)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, groupBodyCreate, "groups?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestGroupsModel.class, request);
|
||||
@@ -37,7 +37,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* Retrieve group details using GET on '/groups/{groupId}
|
||||
*/
|
||||
public RestGroupsModel getGroupDetail(String groupId) throws Exception
|
||||
public RestGroupsModel getGroupDetail(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "groups/{groupId}?{parameters}", groupId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestGroupsModel.class, request);
|
||||
@@ -46,7 +46,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* Delete a group using DELETE on '/groups/{groupId}
|
||||
*/
|
||||
public void deleteGroup(String groupId) throws Exception
|
||||
public void deleteGroup(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "groups/{groupId}?{parameters}", groupId, restWrapper.getParameters());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -55,7 +55,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* Update group details using PUT on '/groups/{groupId}
|
||||
*/
|
||||
public RestGroupsModel updateGroupDetails(String groupId, String groupBodyUpdate) throws Exception
|
||||
public RestGroupsModel updateGroupDetails(String groupId, String groupBodyUpdate)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, groupBodyUpdate, "groups/{groupId}?{parameters}", groupId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestGroupsModel.class, request);
|
||||
@@ -64,7 +64,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* List memberships of a group using GET on '/groups/{groupId}/members
|
||||
*/
|
||||
public RestGroupMemberModelsCollection listGroupMemberships(String groupId) throws Exception
|
||||
public RestGroupMemberModelsCollection listGroupMemberships(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "groups/{groupId}/members?{parameters}", groupId, restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestGroupMemberModelsCollection.class, request);
|
||||
@@ -73,7 +73,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* Create a group membership using POST on '/groups/{groupId}/members
|
||||
*/
|
||||
public RestGroupMember createGroupMembership (String groupId, String groupMembershipBodyCreate) throws Exception
|
||||
public RestGroupMember createGroupMembership (String groupId, String groupMembershipBodyCreate)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, groupMembershipBodyCreate, "groups/{groupId}/members?{parameters}", groupId,
|
||||
restWrapper.getParameters());
|
||||
@@ -83,7 +83,7 @@ public class Groups extends ModelRequest<Groups>
|
||||
/**
|
||||
* Delete a group membership using DELETE on '/groups/{groupId}/members/{groupMemberId}
|
||||
*/
|
||||
public void deleteGroupMembership(String groupId, String groupMemberId) throws Exception
|
||||
public void deleteGroupMembership(String groupId, String groupMemberId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "groups/{groupId}/members/{groupMemberId}", groupId, groupMemberId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
|
@@ -23,9 +23,8 @@ public class Networks extends ModelRequest<Networks>
|
||||
* Retrieve details for the current user network using GET call on "networks/{networkId}"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNetworkModel getNetwork() throws Exception
|
||||
public RestNetworkModel getNetwork()
|
||||
{
|
||||
return getNetwork(restWrapper.getTestUser());
|
||||
}
|
||||
@@ -34,9 +33,8 @@ public class Networks extends ModelRequest<Networks>
|
||||
* Retrieve details of a specific network using GET call on "networks/{networkId}"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNetworkModel getNetwork(UserModel tenant) throws Exception
|
||||
public RestNetworkModel getNetwork(UserModel tenant)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(tenant.getDomain(), "tenant.getDomain()");
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "networks/{networkId}", tenant.getDomain());
|
||||
@@ -47,9 +45,8 @@ public class Networks extends ModelRequest<Networks>
|
||||
* Retrieve details of a specific network using GET call with parameters on "networks/{networkId}?{parameters}"
|
||||
*
|
||||
* @return JSONObject
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject getNetworkWithParams(UserModel tenant) throws Exception
|
||||
public JSONObject getNetworkWithParams(UserModel tenant)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(tenant.getDomain(), "tenant.getDomain()");
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "networks/{networkId}?{parameters}", tenant.getDomain(), restWrapper.getParameters());
|
||||
|
@@ -18,6 +18,7 @@ import org.testng.reporters.Files;
|
||||
|
||||
import javax.json.JsonArrayBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Declares all Rest API under the /nodes path
|
||||
@@ -27,12 +28,12 @@ public class Node extends ModelRequest<Node>
|
||||
{
|
||||
private RepoTestModel repoModel;
|
||||
|
||||
public Node(RestWrapper restWrapper) throws Exception
|
||||
public Node(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
}
|
||||
|
||||
public Node(RepoTestModel repoModel, RestWrapper restWrapper) throws Exception
|
||||
public Node(RepoTestModel repoModel, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.repoModel = repoModel;
|
||||
@@ -46,7 +47,7 @@ public class Node extends ModelRequest<Node>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestNodeModel getNode() throws Exception
|
||||
public RestNodeModel getNode()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -59,7 +60,7 @@ public class Node extends ModelRequest<Node>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestCommentModelsCollection getNodeComments() throws Exception
|
||||
public RestCommentModelsCollection getNodeComments()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/comments?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestCommentModelsCollection.class, request);
|
||||
@@ -71,9 +72,8 @@ public class Node extends ModelRequest<Node>
|
||||
* @param node
|
||||
* @param commentContent
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestCommentModel addComment(String commentContent) throws Exception
|
||||
public RestCommentModel addComment(String commentContent)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("content", commentContent);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/comments", repoModel.getNodeRef());
|
||||
@@ -86,9 +86,8 @@ public class Node extends ModelRequest<Node>
|
||||
* @param contentModel
|
||||
* @param comments
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestCommentModelsCollection addComments(String... comments) throws Exception
|
||||
public RestCommentModelsCollection addComments(String... comments)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for(String comment: comments)
|
||||
@@ -109,7 +108,7 @@ public class Node extends ModelRequest<Node>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestCommentModel updateComment(RestCommentModel commentModel, String commentContent) throws Exception
|
||||
public RestCommentModel updateComment(RestCommentModel commentModel, String commentContent)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("content", commentContent);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, postBody, "nodes/{nodeId}/comments/{commentId}?{parameters}", repoModel.getNodeRef(), commentModel.getId(), restWrapper.getParameters());
|
||||
@@ -126,7 +125,7 @@ public class Node extends ModelRequest<Node>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public void deleteComment(RestCommentModel comment) throws Exception
|
||||
public void deleteComment(RestCommentModel comment)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/comments/{commentId}", repoModel.getNodeRef(), comment.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -136,15 +135,16 @@ public class Node extends ModelRequest<Node>
|
||||
* Like a document using POST call on "nodes/{nodeId}/ratings"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRatingModel likeDocument() throws Exception {
|
||||
public RestRatingModel likeDocument()
|
||||
{
|
||||
String postBody = JsonBodyGenerator.likeRating(true);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/ratings", repoModel.getNodeRef());
|
||||
return restWrapper.processModel(RestRatingModel.class, request);
|
||||
}
|
||||
|
||||
public RestRatingModel dislikeDocument() throws Exception {
|
||||
public RestRatingModel dislikeDocument()
|
||||
{
|
||||
String postBody = JsonBodyGenerator.likeRating(false);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/ratings", repoModel.getNodeRef());
|
||||
return restWrapper.processModel(RestRatingModel.class, request);
|
||||
@@ -154,9 +154,9 @@ public class Node extends ModelRequest<Node>
|
||||
* POST call on "nodes/{nodeId}/ratings" using an invalid rating body
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRatingModel addInvalidRating(String jsonBody) throws Exception {
|
||||
public RestRatingModel addInvalidRating(String jsonBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, jsonBody, "nodes/{nodeId}/ratings", repoModel.getNodeRef());
|
||||
return restWrapper.processModel(RestRatingModel.class, request);
|
||||
}
|
||||
@@ -168,9 +168,9 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param stars
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRatingModel rateStarsToDocument(int stars) throws Exception {
|
||||
public RestRatingModel rateStarsToDocument(int stars)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.fiveStarRating(stars);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/ratings", repoModel.getNodeRef());
|
||||
return restWrapper.processModel(RestRatingModel.class, request);
|
||||
@@ -180,9 +180,9 @@ public class Node extends ModelRequest<Node>
|
||||
* Retrieve node ratings using GET call on "nodes/{nodeId}/ratings"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRatingModelsCollection getRatings() throws Exception {
|
||||
public RestRatingModelsCollection getRatings()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/ratings?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestRatingModelsCollection.class, request);
|
||||
}
|
||||
@@ -191,9 +191,9 @@ public class Node extends ModelRequest<Node>
|
||||
* Delete like rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteLikeRating() throws Exception {
|
||||
public void deleteLikeRating()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/ratings/{ratingId}", repoModel.getNodeRef(), "likes");
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
@@ -202,9 +202,9 @@ public class Node extends ModelRequest<Node>
|
||||
* Try to delete invalid rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteInvalidRating(String rating) throws Exception {
|
||||
public void deleteInvalidRating(String rating)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/ratings/{ratingId}", repoModel.getNodeRef(), rating);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
@@ -213,7 +213,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* Get like rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"
|
||||
*/
|
||||
public RestRatingModel getLikeRating() throws Exception {
|
||||
public RestRatingModel getLikeRating()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/ratings/{ratingId}?{parameters}", repoModel.getNodeRef(), "likes", restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestRatingModel.class, request);
|
||||
}
|
||||
@@ -222,9 +223,9 @@ public class Node extends ModelRequest<Node>
|
||||
* Delete fivestar rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFiveStarRating() throws Exception {
|
||||
public void deleteFiveStarRating()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/ratings/{ratingId}", repoModel.getNodeRef(), "fiveStar");
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
@@ -233,9 +234,9 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* Get fivestar rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRatingModel getFiveStarRating() throws Exception {
|
||||
public RestRatingModel getFiveStarRating()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/ratings/{ratingId}?{parameters}", repoModel.getNodeRef(), "fiveStar", restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestRatingModel.class, request);
|
||||
}
|
||||
@@ -246,9 +247,8 @@ public class Node extends ModelRequest<Node>
|
||||
* @param contentModel
|
||||
* @param tag
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTagModel addTag(String tag) throws Exception
|
||||
public RestTagModel addTag(String tag)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("tag", tag);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/tags", repoModel.getNodeRef());
|
||||
@@ -261,9 +261,8 @@ public class Node extends ModelRequest<Node>
|
||||
* @param contentModel
|
||||
* @param tags
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTagModelsCollection addTags(String... tags) throws Exception
|
||||
public RestTagModelsCollection addTags(String... tags)
|
||||
{
|
||||
String postBody = "[";
|
||||
for(String tag: tags)
|
||||
@@ -285,7 +284,7 @@ public class Node extends ModelRequest<Node>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public void deleteTag(RestTagModel tag) throws Exception
|
||||
public void deleteTag(RestTagModel tag)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/tags/{tagId}", repoModel.getNodeRef(), tag.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -296,9 +295,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param tag
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTagModelsCollection getNodeTags() throws Exception
|
||||
public RestTagModelsCollection getNodeTags()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/tags?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestTagModelsCollection.class, request);
|
||||
@@ -308,10 +306,9 @@ public class Node extends ModelRequest<Node>
|
||||
* Create new nodes using POST call on 'nodes/{nodeId}/children
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @return
|
||||
*/
|
||||
public RestNodeModel createNode(RestNodeBodyModel node) throws Exception
|
||||
public RestNodeModel createNode(RestNodeBodyModel node)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, node.toJson(), "nodes/{nodeId}/children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -324,9 +321,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* <code>usingMultipartFile(new File("your-local-file.txt")).withCoreAPI().usingNode(ContentModel.my()).createNode();</code>
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel createNode() throws Exception
|
||||
public RestNodeModel createNode()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "nodes/{nodeId}/children", repoModel.getNodeRef());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -336,9 +332,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getNodeContent() throws Exception
|
||||
public RestResponse getNodeContent()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/content?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
@@ -349,9 +344,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @return
|
||||
* @param nodeId
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getNodeContent(String nodeId) throws Exception
|
||||
public RestResponse getNodeContent(String nodeId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/content?{parameters}", nodeId, restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
@@ -362,27 +356,41 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param renditionId id of rendition to be created
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void createNodeRendition(String renditionId) throws Exception
|
||||
public void createNodeRendition(String renditionId)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", renditionId);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/renditions", repoModel.getNodeRef());
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create node version rendition using POST call on '/nodes/{nodeId}/versions/{versionId}/renditions'
|
||||
*
|
||||
* @param renditionId id of rendition to be created
|
||||
* @param versionId version id of node
|
||||
* @return
|
||||
*/
|
||||
public void createNodeVersionRendition(String renditionId, String versionId)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", renditionId);
|
||||
RestRequest request = RestRequest
|
||||
.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/versions/{versionId}/renditions",
|
||||
repoModel.getNodeRef(), versionId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if specified rendition exists and if not
|
||||
* create node rendition using POST call on '/nodes/{nodeId}/renditions'
|
||||
*
|
||||
* @param renditionId id of rendition to be created
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void createNodeRenditionIfNotExists(String renditionId) throws Exception
|
||||
public void createNodeRenditionIfNotExists(String renditionId)
|
||||
{
|
||||
getNodeRendition(renditionId);
|
||||
if (HttpStatus.OK.toString().equals(restWrapper.getStatusCode()))
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", renditionId);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/renditions", repoModel.getNodeRef());
|
||||
@@ -395,27 +403,63 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param renditionId id of rendition to be retrieved
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModel getNodeRendition(String renditionId) throws Exception
|
||||
public RestRenditionInfoModel getNodeRendition(String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/renditions/{renditionId}", repoModel.getNodeRef(), renditionId);
|
||||
return restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node version rendition using GET call on '/nodes/{nodeId}/versions/{versionId}renditions/{renditionId}
|
||||
*
|
||||
* @param renditionId id of rendition to be retrieved
|
||||
* @param versionId versionId of the node
|
||||
* @return
|
||||
*/
|
||||
public RestRenditionInfoModel getNodeVersionRendition(String renditionId, String versionId)
|
||||
{
|
||||
RestRequest request = RestRequest
|
||||
.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}",
|
||||
repoModel.getNodeRef(), versionId, renditionId);
|
||||
return restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node rendition using GET call on 'nodes/{nodeId}/renditions/{renditionId} Please note that it retries to get
|
||||
* the renditions response several times because on the alfresco server the rendition can take a while to be created.
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModel getNodeRenditionUntilIsCreated(String renditionId) throws Exception
|
||||
public RestRenditionInfoModel getNodeRenditionUntilIsCreated(String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/renditions/{renditionId}",repoModel.getNodeRef(), renditionId);
|
||||
RestRenditionInfoModel renditions = restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
int retry = 0;
|
||||
if (restWrapper.getStatusCode().equals(HttpStatus.OK.toString()))
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
while (renditions.getStatus().equals("NOT_CREATED") && retry < Utility.retryCountSeconds - 8)
|
||||
{
|
||||
Utility.waitToLoopTime(1);
|
||||
renditions = restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
retry++;
|
||||
}
|
||||
}
|
||||
return renditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node version rendition using GET call on 'nodes/{nodeId}/versions/{versionId}/renditions/{renditionId} Please note that it retries to get
|
||||
* the renditions response several times because on the alfresco server the rendition can take a while to be created.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RestRenditionInfoModel getNodeVersionRenditionUntilIsCreated(String renditionId, String versionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}",repoModel.getNodeRef(), versionId, renditionId);
|
||||
RestRenditionInfoModel renditions = restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
int retry = 0;
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
while (renditions.getStatus().equals("NOT_CREATED") && retry < Utility.retryCountSeconds - 8)
|
||||
{
|
||||
@@ -434,15 +478,39 @@ public class Node extends ModelRequest<Node>
|
||||
* alfresco server the rendition can take a while to be created.
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getNodeRenditionContentUntilIsCreated(String renditionId) throws Exception
|
||||
public RestResponse getNodeRenditionContentUntilIsCreated(String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/renditions/{renditionId}/content", repoModel.getNodeRef(),
|
||||
renditionId);
|
||||
RestResponse response = restWrapper.process(request);
|
||||
int retry = 0;
|
||||
while (response.getStatusCode().equals(HttpStatus.NOT_FOUND.toString()) && retry < Utility.retryCountSeconds)
|
||||
//Multiplied by '4' because AI rendition test cases need more time (~30 seconds) - see ACS-2158
|
||||
while (Integer.valueOf(response.getStatusCode()).equals(HttpStatus.NOT_FOUND.value()) && retry < (4 * Utility.retryCountSeconds))
|
||||
{
|
||||
Utility.waitToLoopTime(1);
|
||||
response = restWrapper.process(request);
|
||||
retry++;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node version rendition content using GET call on
|
||||
* 'nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content Please note that it
|
||||
* retries to get the renditions response several times because on the
|
||||
* alfresco server the rendition can take a while to be created.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RestResponse getNodeVersionRenditionContentUntilIsCreated(String renditionId, String versionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content", repoModel.getNodeRef(),
|
||||
versionId, renditionId);
|
||||
RestResponse response = restWrapper.process(request);
|
||||
int retry = 0;
|
||||
while (Integer.valueOf(response.getStatusCode()).equals(HttpStatus.NOT_FOUND.value()) && retry < Utility.retryCountSeconds)
|
||||
{
|
||||
Utility.waitToLoopTime(1);
|
||||
response = restWrapper.process(request);
|
||||
@@ -457,35 +525,69 @@ public class Node extends ModelRequest<Node>
|
||||
* 'nodes/{nodeId}/renditions/{renditionId}/content
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getNodeRenditionContent(String renditionId) throws Exception
|
||||
public RestResponse getNodeRenditionContent(String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/renditions/{renditionId}/content", repoModel.getNodeRef(),
|
||||
renditionId);
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node version rendition content using GET call on
|
||||
* 'nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RestResponse getNodeVersionRenditionContent(String renditionId, String versionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content", repoModel.getNodeRef(),
|
||||
versionId, renditionId);
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rendition information for available renditions for the node using GET call on
|
||||
* 'nodes/{nodeId}/renditions'
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModelCollection getNodeRenditionsInfo() throws Exception
|
||||
public RestRenditionInfoModelCollection getNodeRenditionsInfo()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/renditions?{parameters}", repoModel.getNodeRef(),
|
||||
restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestRenditionInfoModelCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rendition information for available renditions for the node version using GET call on
|
||||
* 'nodes/{nodeId}/versions/{versionId}/renditions'
|
||||
* @return
|
||||
*/
|
||||
public RestRenditionInfoModelCollection getNodeVersionRenditionsInfo(String versionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/versions/{versionId}/renditions?{parameters}", repoModel.getNodeRef(),
|
||||
versionId, restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestRenditionInfoModelCollection.class, request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete the rendition identified by renditionId using DELETE call on "/nodes/{nodeId}/renditions/{renditionId}"
|
||||
*
|
||||
* @param renditionId id of rendition to delete
|
||||
*/
|
||||
public void deleteNodeRendition(String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/renditions/{renditionId}", repoModel.getNodeRef(), renditionId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a node's children using GET call 'nodes/{nodeId}/children
|
||||
*
|
||||
* @return a collection of nodes
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModelsCollection listChildren() throws Exception
|
||||
public RestNodeModelsCollection listChildren()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeModelsCollection.class, request);
|
||||
@@ -496,9 +598,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param moveBody a {@link RestNodeBodyMoveCopyModel} containing at least the target parent id
|
||||
* @return the moved node's new information
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel move(RestNodeBodyMoveCopyModel moveBody) throws Exception
|
||||
public RestNodeModel move(RestNodeBodyMoveCopyModel moveBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, moveBody.toJson(), "nodes/{nodeId}/move?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -509,9 +610,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param copyBody a {@link RestNodeBodyMoveCopyModel} containing at least the target parent id
|
||||
* @return the moved node's new information
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel copy(RestNodeBodyMoveCopyModel copyBody) throws Exception
|
||||
public RestNodeModel copy(RestNodeBodyMoveCopyModel copyBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, copyBody.toJson(),
|
||||
"nodes/{nodeId}/copy?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
@@ -523,9 +623,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Lock a specific node using POST call on "nodes/{nodeId}/lock"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel lockNode(RestNodeLockBodyModel lockBody) throws Exception
|
||||
public RestNodeModel lockNode(RestNodeLockBodyModel lockBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, lockBody.toJson(), "nodes/{nodeId}/lock?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -535,9 +634,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Unlock a specific node using POST call on "nodes/{nodeId}/unlock"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel unlockNode() throws Exception
|
||||
public RestNodeModel unlockNode()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "nodes/{nodeId}/unlock?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -556,9 +654,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param putBody
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel updateNode(String putBody) throws Exception
|
||||
public RestNodeModel updateNode(String putBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, putBody, "nodes/{nodeId}?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
request.setContentType("UTF-8");
|
||||
@@ -569,9 +666,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Retrieve targets for a specific node using GET call on "nodes/{nodeId}/targets
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeAssociationModelCollection getNodeTargets() throws Exception
|
||||
public RestNodeAssociationModelCollection getNodeTargets()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/targets?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeAssociationModelCollection.class, request);
|
||||
@@ -582,9 +678,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeAssocTargetModel createTargetForNode(RestNodeAssocTargetModel target) throws Exception
|
||||
public RestNodeAssocTargetModel createTargetForNode(RestNodeAssocTargetModel target)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, target.toJson(), "nodes/{nodeId}/targets?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeAssocTargetModel.class, request);
|
||||
@@ -595,9 +690,8 @@ public class Node extends ModelRequest<Node>
|
||||
* nodes/{nodeId}/targets/{targetId}
|
||||
*
|
||||
* @param target
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteTarget(RestNodeAssocTargetModel target) throws Exception
|
||||
public void deleteTarget(RestNodeAssocTargetModel target)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/targets/{targetId}", repoModel.getNodeRef(),
|
||||
target.getTargetId());
|
||||
@@ -608,9 +702,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Get sources for a specific node using GET call on GET /nodes/{nodeId}/sources
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeAssociationModelCollection getNodeSources() throws Exception
|
||||
public RestNodeAssociationModelCollection getNodeSources()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "/nodes/{nodeId}/sources?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeAssociationModelCollection.class, request);
|
||||
@@ -621,15 +714,22 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param nodeContent
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel updateNodeContent(File nodeContent) throws Exception
|
||||
public RestNodeModel updateNodeContent(File nodeContent)
|
||||
{
|
||||
restWrapper.usingContentType(ContentType.BINARY);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, Files.readFile(nodeContent), "nodes/{nodeId}/content?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
request.setContentType("UTF-8");
|
||||
restWrapper.usingContentType(ContentType.JSON);
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
try
|
||||
{
|
||||
restWrapper.usingContentType(ContentType.BINARY);
|
||||
String body = Files.readFile(nodeContent);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, body, "nodes/{nodeId}/content?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
request.setContentType("UTF-8");
|
||||
restWrapper.usingContentType(ContentType.JSON);
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new RuntimeException("Unexpected error when reading content file.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -648,9 +748,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Get a node's parents using GET call 'nodes/{nodeId}/parents
|
||||
*
|
||||
* @return a collection of nodes
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeAssociationModelCollection getParents() throws Exception
|
||||
public RestNodeAssociationModelCollection getParents()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/parents?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeAssociationModelCollection.class, request);
|
||||
@@ -660,9 +759,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Get a node's secondary children using GET call 'nodes/{nodeId}/secondary-children
|
||||
*
|
||||
* @return a collection of nodes
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeAssociationModelCollection getSecondaryChildren() throws Exception
|
||||
public RestNodeAssociationModelCollection getSecondaryChildren()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/secondary-children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeAssociationModelCollection.class, request);
|
||||
@@ -673,9 +771,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Use a list of secondary children nodes
|
||||
*
|
||||
* @return a collection of nodes
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeChildAssocModelCollection createSecondaryChildren(String secondaryChildren) throws Exception
|
||||
public RestNodeChildAssocModelCollection createSecondaryChildren(String secondaryChildren)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, secondaryChildren, "nodes/{nodeId}/secondary-children?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeChildAssocModelCollection.class, request);
|
||||
@@ -685,9 +782,8 @@ public class Node extends ModelRequest<Node>
|
||||
* Delete secondary children using DELETE call 'nodes/{nodeId}/secondary-children/{childId}
|
||||
*
|
||||
* @return a collection of nodes
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteSecondaryChild(RestNodeAssociationModel child) throws Exception
|
||||
public void deleteSecondaryChild(RestNodeAssociationModel child)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}/secondary-children/{childId}?{parameters}", repoModel.getNodeRef(), child.getId(), restWrapper.getParameters());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -757,9 +853,8 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param nodeModel
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteNode(RestNodeModel nodeModel) throws Exception
|
||||
public void deleteNode(RestNodeModel nodeModel)
|
||||
{
|
||||
deleteNode(nodeModel.getId());
|
||||
}
|
||||
@@ -770,19 +865,13 @@ public class Node extends ModelRequest<Node>
|
||||
*
|
||||
* @param nodeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteNode(String nodeId) throws Exception
|
||||
public void deleteNode(String nodeId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "nodes/{nodeId}", nodeId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*@param nodeId
|
||||
*@return
|
||||
*/
|
||||
public RestActionDefinitionModelsCollection getActionDefinitions()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "nodes/{nodeId}/action-definitions?{parameters}", repoModel.getNodeRef(), restWrapper.getParameters());
|
||||
@@ -790,4 +879,87 @@ public class Node extends ModelRequest<Node>
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Get Direct Access URL for a node
|
||||
* @param postBody
|
||||
* @return
|
||||
*/
|
||||
public RestResponse createDirectAccessURL(String postBody)
|
||||
{
|
||||
RestRequest request;
|
||||
if (postBody == null)
|
||||
{
|
||||
request = RestRequest.simpleRequest(HttpMethod.POST, "nodes/{nodeId}/request-direct-access-url", this.repoModel.getNodeRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "nodes/{nodeId}/request-direct-access-url", this.repoModel.getNodeRef());
|
||||
}
|
||||
|
||||
return this.restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Direct Access URL for a specific node rendition E.g "pdf"
|
||||
* @param renditionId
|
||||
* @return
|
||||
*/
|
||||
public RestResponse createDirectAccessURLforRendition(String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest
|
||||
.simpleRequest(HttpMethod.POST, "nodes/{nodeId}/renditions/{renditionId}/request-direct-access-url", this.repoModel.getNodeRef(), renditionId);
|
||||
return this.restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Direct Access URL for a specific node version. E.g "1.1"
|
||||
* @param versionId
|
||||
* @return
|
||||
*/
|
||||
public RestResponse createDirectAccessURLforVersion(String versionId)
|
||||
{
|
||||
RestRequest request = RestRequest
|
||||
.simpleRequest(HttpMethod.POST, "nodes/{nodeId}/versions/{versionId}/request-direct-access-url", this.repoModel.getNodeRef(), versionId);
|
||||
return this.restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Direct Access URL for a specific node version rendition. E.g ("1.1", "pdf")
|
||||
* @param versionId
|
||||
* @param renditionId
|
||||
* @return
|
||||
*/
|
||||
public RestResponse createDirectAccessURLforVersionAndRendition(String versionId, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest
|
||||
.simpleRequest(HttpMethod.POST, "nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/request-direct-access-url", this.repoModel.getNodeRef(), versionId, renditionId);
|
||||
return this.restWrapper.process(request);
|
||||
}
|
||||
|
||||
public ContentStorageInformation usingStorageInfo(String contentPropName)
|
||||
{
|
||||
return new ContentStorageInformation(restWrapper)
|
||||
.withNodeId(repoModel.getNodeRef())
|
||||
.withContentPropName(contentPropName);
|
||||
}
|
||||
|
||||
public ContentStorageInformation usingVersionStorageInfo(String contentPropName, String versionId)
|
||||
{
|
||||
return new ContentStorageInformation(restWrapper)
|
||||
.withNodeId(repoModel.getNodeRef())
|
||||
.withContentPropName(contentPropName)
|
||||
.withVersionId(versionId);
|
||||
}
|
||||
|
||||
public FolderRules usingDefaultRuleSet()
|
||||
{
|
||||
return usingRuleSet("-default-");
|
||||
}
|
||||
|
||||
public FolderRules usingRuleSet(String ruleSetId)
|
||||
{
|
||||
return new FolderRules(restWrapper)
|
||||
.withNodeId(repoModel.getNodeRef())
|
||||
.withRuleSetId(ruleSetId);
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ public class People extends ModelRequest<People>
|
||||
{
|
||||
UserModel person;
|
||||
|
||||
public People(UserModel person, RestWrapper restWrapper) throws Exception
|
||||
public People(UserModel person, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.person = person;
|
||||
@@ -56,7 +56,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve details of a specific person using GET call on "people/{personId}"
|
||||
*/
|
||||
public RestPersonModel getPerson() throws Exception
|
||||
public RestPersonModel getPerson()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestPersonModel.class, request);
|
||||
@@ -65,7 +65,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Update a person properties using PUT call on "people/{personId}"
|
||||
*/
|
||||
public RestPersonModel updatePerson(String putBody) throws Exception
|
||||
public RestPersonModel updatePerson(String putBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, putBody, "people/{personId}", this.person.getUsername());
|
||||
return restWrapper.processModel(RestPersonModel.class, request);
|
||||
@@ -76,12 +76,12 @@ public class People extends ModelRequest<People>
|
||||
* Please note that it retries to get the list of activities several times before returning the empty list. The list of activities are not displayed as
|
||||
* they are created.
|
||||
*/
|
||||
public RestActivityModelsCollection getPersonActivitiesUntilEntriesCountIs(int expectedNoOfEntries) throws Exception
|
||||
public RestActivityModelsCollection getPersonActivitiesUntilEntriesCountIs(int expectedNoOfEntries)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/activities?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
RestActivityModelsCollection activityCollection = restWrapper.processModels(RestActivityModelsCollection.class, request);
|
||||
int retry = 0;
|
||||
if (restWrapper.getStatusCode().equals(HttpStatus.OK.toString()))
|
||||
if (Integer.valueOf(restWrapper.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
while ((activityCollection.isEmpty() || activityCollection.getPagination().getCount() != expectedNoOfEntries) && retry < Utility.retryCountSeconds + 20)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve list of activities for a specific person using GET call on "people/{personId}/activities" without retry
|
||||
*/
|
||||
public RestActivityModelsCollection getPersonActivities() throws Exception
|
||||
public RestActivityModelsCollection getPersonActivities()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/activities?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestActivityModelsCollection.class, request);
|
||||
@@ -105,7 +105,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve preferences of a specific person using GET call on "people/{personId}/preferences"
|
||||
*/
|
||||
public RestPreferenceModelsCollection getPersonPreferences() throws Exception
|
||||
public RestPreferenceModelsCollection getPersonPreferences()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/preferences?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestPreferenceModelsCollection.class, request);
|
||||
@@ -114,7 +114,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve the current site membership requests for a specific person using GET call on "/people/{personId}/site-membership-requests"
|
||||
*/
|
||||
public RestSiteMembershipRequestModelsCollection getSiteMembershipRequests() throws Exception
|
||||
public RestSiteMembershipRequestModelsCollection getSiteMembershipRequests()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/site-membership-requests?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteMembershipRequestModelsCollection.class, request);
|
||||
@@ -123,7 +123,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve a specific person's favorite sites using GET call on "people/{personId}/favorite-sites"
|
||||
*/
|
||||
public RestSiteModelsCollection getFavoriteSites() throws Exception
|
||||
public RestSiteModelsCollection getFavoriteSites()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/favorite-sites?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteModelsCollection.class, request);
|
||||
@@ -132,7 +132,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add a favorite site for a specific person using POST call on "people/{personId}/favorite-sites"
|
||||
*/
|
||||
public RestFavoriteSiteModel addFavoriteSite(SiteModel site) throws Exception
|
||||
public RestFavoriteSiteModel addFavoriteSite(SiteModel site)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", site.getId());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "people/{personId}/favorite-sites", this.person.getUsername());
|
||||
@@ -142,7 +142,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve a specific preference of a specific person using GET call on "people/{personId}/preferences/{preferenceName}"
|
||||
*/
|
||||
public RestPreferenceModel getPersonPreferenceInformation(String preferenceName) throws Exception
|
||||
public RestPreferenceModel getPersonPreferenceInformation(String preferenceName)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/preferences/{preferenceName}?{parameters}", this.person.getUsername(), preferenceName, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestPreferenceModel.class, request);
|
||||
@@ -151,7 +151,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Remove a specific site from favorite sites list of a person using DELETE call on "people/{personId}/favorite-sites/{siteId}"
|
||||
*/
|
||||
public void removeFavoriteSite(SiteModel site) throws Exception
|
||||
public void removeFavoriteSite(SiteModel site)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "people/{personId}/favorite-sites/{siteId}", this.person.getUsername(), site.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -160,7 +160,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Returns information on favorite site siteId of person personId. GET call on "people/{personId}/favorite-sites/{siteId}"
|
||||
*/
|
||||
public RestSiteModel getFavoriteSite(SiteModel site) throws Exception
|
||||
public RestSiteModel getFavoriteSite(SiteModel site)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/favorite-sites/{siteId}?{parameters}", this.person.getUsername(), site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
@@ -169,7 +169,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Delete site member with DELETE call on "people/{personId}/sites/{siteId}"
|
||||
*/
|
||||
public void deleteSiteMember(SiteModel site) throws Exception
|
||||
public void deleteSiteMember(SiteModel site)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "people/{personId}/sites/{siteId}", person.getUsername(), site.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -178,7 +178,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add new site membership request using POST call on "people/{personId}/site-membership-requests"
|
||||
*/
|
||||
public RestSiteMembershipRequestModel addSiteMembershipRequest(String siteMembershipRequest) throws Exception
|
||||
public RestSiteMembershipRequestModel addSiteMembershipRequest(String siteMembershipRequest)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, siteMembershipRequest, "people/{personId}/site-membership-requests", this.person.getUsername());
|
||||
return restWrapper.processModel(RestSiteMembershipRequestModel.class, request);
|
||||
@@ -187,7 +187,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add new site membership request using POST call on "people/{personId}/site-membership-requests"
|
||||
*/
|
||||
public RestSiteMembershipRequestModel addSiteMembershipRequest(SiteModel siteModel) throws Exception
|
||||
public RestSiteMembershipRequestModel addSiteMembershipRequest(SiteModel siteModel)
|
||||
{
|
||||
String json = JsonBodyGenerator.siteMemberhipRequest("Please accept me", siteModel, "New request");
|
||||
return addSiteMembershipRequest(json);
|
||||
@@ -196,7 +196,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add new site membership request using POST call on "people/{personId}/site-membership-requests"
|
||||
*/
|
||||
public RestSiteMembershipRequestModel addSiteMembershipRequest(String message, SiteModel siteModel, String title) throws Exception
|
||||
public RestSiteMembershipRequestModel addSiteMembershipRequest(String message, SiteModel siteModel, String title)
|
||||
{
|
||||
String json = JsonBodyGenerator.siteMemberhipRequest(message, siteModel, title);
|
||||
return addSiteMembershipRequest(json);
|
||||
@@ -206,7 +206,7 @@ public class People extends ModelRequest<People>
|
||||
* Get site membership information using GET call on "/people/{personId}/sites"
|
||||
*/
|
||||
|
||||
public RestSiteMembershipModelsCollection getSitesMembershipInformation() throws Exception
|
||||
public RestSiteMembershipModelsCollection getSitesMembershipInformation()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/sites?{parameters}", person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteMembershipModelsCollection.class, request);
|
||||
@@ -215,7 +215,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve site membership information for a person using GET call on "people/{personId}/sites/{siteId}"
|
||||
*/
|
||||
public RestSiteEntry getSiteMembership(SiteModel site) throws Exception
|
||||
public RestSiteEntry getSiteMembership(SiteModel site)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/sites/{siteId}?{parameters}", person.getUsername(), site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteEntry.class, request);
|
||||
@@ -224,7 +224,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve site membership request details for a person/site using GET call on "people/{personId}/site-membership-requests/{siteId}"
|
||||
*/
|
||||
public RestSiteMembershipRequestModel getSiteMembershipRequest(SiteModel site) throws Exception
|
||||
public RestSiteMembershipRequestModel getSiteMembershipRequest(SiteModel site)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/site-membership-requests/{siteId}?{parameters}", person.getUsername(),
|
||||
site.getId(), restWrapper.getParameters());
|
||||
@@ -244,7 +244,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Update site membership request using PUT call on "people/{personId}/site-membership-requests/{siteId}"
|
||||
*/
|
||||
public RestSiteMembershipRequestModel updateSiteMembershipRequest(SiteModel siteModel, String message) throws Exception
|
||||
public RestSiteMembershipRequestModel updateSiteMembershipRequest(SiteModel siteModel, String message)
|
||||
{
|
||||
String json = JsonBodyGenerator.siteMemberhipRequest(message, siteModel, "New request");
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "people/{personId}/site-membership-requests/{siteId}", person.getUsername(),
|
||||
@@ -255,7 +255,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve favorite site for a specific user using GET call on "people/{personId}/favorites/{favoriteId}"
|
||||
*/
|
||||
public RestPersonFavoritesModel getFavorite(String favoriteId) throws Exception
|
||||
public RestPersonFavoritesModel getFavorite(String favoriteId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/favorites/{favoriteId}?{parameters}", this.person.getUsername(), favoriteId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestPersonFavoritesModel.class, request);
|
||||
@@ -264,7 +264,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve specific favorites for a specific user using GET call on "people/{personId}/favorites"
|
||||
*/
|
||||
public RestPersonFavoritesModelsCollection getFavorites() throws Exception
|
||||
public RestPersonFavoritesModelsCollection getFavorites()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/favorites?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestPersonFavoritesModelsCollection.class, request);
|
||||
@@ -273,7 +273,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add a folder to favorites for a specific user using POST call on "people/{personId}/favorites"
|
||||
*/
|
||||
public RestPersonFavoritesModel addFolderToFavorites(FolderModel folderModel) throws Exception
|
||||
public RestPersonFavoritesModel addFolderToFavorites(FolderModel folderModel)
|
||||
{
|
||||
String jsonPost = JsonBodyGenerator.targetFolderWithGuid(folderModel);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, jsonPost, "people/{personId}/favorites?{parameters}", this.person.getUsername(),
|
||||
@@ -284,7 +284,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add a folder to favorites for a specific user using POST call on "people/{personId}/favorites"
|
||||
*/
|
||||
public RestPersonFavoritesModel addFileToFavorites(FileModel fileModel) throws Exception
|
||||
public RestPersonFavoritesModel addFileToFavorites(FileModel fileModel)
|
||||
{
|
||||
String jsonPost = JsonBodyGenerator.targetFileWithGuid(fileModel);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, jsonPost, "people/{personId}/favorites?{parameters}", this.person.getUsername(),
|
||||
@@ -295,7 +295,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Add a site to favorites for a specific user using POST call on "people/{personId}/favorites"
|
||||
*/
|
||||
public RestPersonFavoritesModel addSiteToFavorites(SiteModel siteModel) throws Exception
|
||||
public RestPersonFavoritesModel addSiteToFavorites(SiteModel siteModel)
|
||||
{
|
||||
String jsonPost = JsonBodyGenerator.targetSiteWithGuid(siteModel);
|
||||
|
||||
@@ -307,7 +307,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Delete site from favorites for a specific user using DELETE call on "people/{personId}/favorites/{favoriteId}"
|
||||
*/
|
||||
public RestWrapper deleteSiteFromFavorites(SiteModel site) throws Exception
|
||||
public RestWrapper deleteSiteFromFavorites(SiteModel site)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "people/{personId}/favorites/{favoriteId}", this.person.getUsername(), site.getGuid());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -317,7 +317,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Delete a folder from favorites for a specific user using DELETE call on "people/{personId}/favorites/{favoriteId}"
|
||||
*/
|
||||
public RestWrapper deleteFolderFromFavorites(FolderModel folderModel) throws Exception
|
||||
public RestWrapper deleteFolderFromFavorites(FolderModel folderModel)
|
||||
{
|
||||
String jsonPost = JsonBodyGenerator.targetFolderWithGuid(folderModel);
|
||||
|
||||
@@ -330,7 +330,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Delete a file from favorites for a specific user using DELETE call on "people/{personId}/favorites/{favoriteId}"
|
||||
*/
|
||||
public RestWrapper deleteFileFromFavorites(FileModel fileModel) throws Exception
|
||||
public RestWrapper deleteFileFromFavorites(FileModel fileModel)
|
||||
{
|
||||
String jsonPost = JsonBodyGenerator.targetFileWithGuid(fileModel);
|
||||
|
||||
@@ -343,7 +343,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve details of the current user network using GET call on "people/{personId}/networks/{networkId}"
|
||||
*/
|
||||
public RestNetworkModel getNetwork() throws Exception
|
||||
public RestNetworkModel getNetwork()
|
||||
{
|
||||
return getNetwork(person);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve details of a specific network using GET call on "people/{personId}/networks/{networkId}"
|
||||
*/
|
||||
public RestNetworkModel getNetwork(UserModel tenant) throws Exception
|
||||
public RestNetworkModel getNetwork(UserModel tenant)
|
||||
{
|
||||
Utility.checkObjectIsInitialized(tenant.getDomain(), "tenant.getDomain()");
|
||||
String personId = tenant.getUsername().contains("-me-@")? "-me-" : tenant.getUsername();
|
||||
@@ -362,7 +362,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve details of all networks related to the current person using GET call on "people/{personId}/networks"
|
||||
*/
|
||||
public RestNetworkModelsCollection getNetworks() throws Exception
|
||||
public RestNetworkModelsCollection getNetworks()
|
||||
{
|
||||
return getNetworks(person);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Retrieve details of all networks related to a specific person using GET call on "people/{personId}/networks"
|
||||
*/
|
||||
public RestNetworkModelsCollection getNetworks(UserModel tenant) throws Exception
|
||||
public RestNetworkModelsCollection getNetworks(UserModel tenant)
|
||||
{
|
||||
String personId = tenant.getUsername().contains("-me-@") ? "-me-" : tenant.getUsername();
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/networks?{parameters}", personId, restWrapper.getParameters());
|
||||
@@ -380,7 +380,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Create new person with given newPerson details using POST call on "people"
|
||||
*/
|
||||
public RestPersonModel createPerson(RestPersonModel newPerson) throws Exception
|
||||
public RestPersonModel createPerson(RestPersonModel newPerson)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, newPerson.toJson(), "people");
|
||||
return restWrapper.processModel(RestPersonModel.class, request);
|
||||
@@ -390,7 +390,7 @@ public class People extends ModelRequest<People>
|
||||
* Get people avatar image using GET call on '/people/{personId}/avatar Please note that it retries to get the
|
||||
* renditions response several times because on the alfresco server the rendition can take a while to be created.
|
||||
*/
|
||||
public RestResponse downloadAvatarContent() throws Exception
|
||||
public RestResponse downloadAvatarContent()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/avatar?{parameters}",
|
||||
this.person.getUsername(), restWrapper.getParameters());
|
||||
@@ -409,7 +409,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* Update avatar image PUT call on 'people/{nodeId}/children
|
||||
*/
|
||||
public ValidatableResponse uploadAvatarContent(String fullServerUrL, File avatarFile) throws Exception
|
||||
public ValidatableResponse uploadAvatarContent(String fullServerUrL, File avatarFile)
|
||||
{
|
||||
return given().auth().preemptive().basic(person.getUsername(), person.getPassword()).contentType(ContentType.BINARY)
|
||||
.body(avatarFile).when()
|
||||
@@ -420,7 +420,7 @@ public class People extends ModelRequest<People>
|
||||
/**
|
||||
* List group memberships for a person using GET on '/people/{personId}/groups
|
||||
*/
|
||||
public RestGroupsModelsCollection listGroupMemberships() throws Exception
|
||||
public RestGroupsModelsCollection listGroupMemberships()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "people/{personId}/groups?{parameters}", this.person.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestGroupsModelsCollection.class, request);
|
||||
@@ -486,7 +486,7 @@ public class People extends ModelRequest<People>
|
||||
return this;
|
||||
}
|
||||
|
||||
public RestPersonFavoritesModelsCollection getFavorites() throws Exception
|
||||
public RestPersonFavoritesModelsCollection getFavorites()
|
||||
{
|
||||
restWrapper.withParams(String.format(whereClause, expression));
|
||||
return people.getFavorites();
|
||||
|
@@ -35,7 +35,7 @@ public class ProcessDefinitions extends ModelRequest<ProcessDefinitions>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestProcessDefinitionModelsCollection getAllProcessDefinitions() throws Exception
|
||||
public RestProcessDefinitionModelsCollection getAllProcessDefinitions()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "process-definitions?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestProcessDefinitionModelsCollection.class, request);
|
||||
@@ -45,9 +45,8 @@ public class ProcessDefinitions extends ModelRequest<ProcessDefinitions>
|
||||
* Retrieves a process definition using GET call on "/process-definitions/{processDefinitionId}"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestProcessDefinitionModel getProcessDefinition() throws Exception
|
||||
public RestProcessDefinitionModel getProcessDefinition()
|
||||
{
|
||||
Utility.checkObjectIsInitialized(processDefinition, "processDefinition");
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "process-definitions/{processDefinitionId}?{parameters}",
|
||||
@@ -59,9 +58,8 @@ public class ProcessDefinitions extends ModelRequest<ProcessDefinitions>
|
||||
* Retrieves an image that represents a single process definition using GET call on "/process-definitions/{processDefinitionId}/image"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestHtmlResponse getProcessDefinitionImage() throws Exception
|
||||
public RestHtmlResponse getProcessDefinitionImage()
|
||||
{
|
||||
Utility.checkObjectIsInitialized(processDefinition, "processDefinition");
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "process-definitions/{processDefinitionId}/image", processDefinition.getId());
|
||||
@@ -72,9 +70,8 @@ public class ProcessDefinitions extends ModelRequest<ProcessDefinitions>
|
||||
* Retrieves start form type definitions using GET call on "/process-definitions/{processDefinitionId}/start-form-model"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestFormModelsCollection getProcessDefinitionStartFormModel() throws Exception
|
||||
public RestFormModelsCollection getProcessDefinitionStartFormModel()
|
||||
{
|
||||
Utility.checkObjectIsInitialized(processDefinition, "processDefinition.onModel()");
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "process-definitions/{processDefinitionId}/start-form-model?{parameters}",
|
||||
|
@@ -42,7 +42,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestProcessModelsCollection getProcesses() throws Exception
|
||||
public RestProcessModelsCollection getProcesses()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "processes?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestProcessModelsCollection.class, request);
|
||||
@@ -54,7 +54,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestProcessVariableCollection getProcessVariables() throws Exception
|
||||
public RestProcessVariableCollection getProcessVariables()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "processes/{processId}/variables?{parameters}", processModel.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestProcessVariableCollection.class, request);
|
||||
@@ -63,9 +63,8 @@ public class Processes extends ModelRequest<Processes>
|
||||
/**
|
||||
* Retrieves the process identified by processId using GET /processes/{processId}
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestProcessModel getProcess() throws Exception
|
||||
public RestProcessModel getProcess()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "processes/{processId}?{parameters}", processModel.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestProcessModel.class, request);
|
||||
@@ -73,10 +72,8 @@ public class Processes extends ModelRequest<Processes>
|
||||
|
||||
/**
|
||||
* Delete a process using DELETE call on processes/{processId}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteProcess() throws Exception
|
||||
public void deleteProcess()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "processes/{processId}", processModel.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -90,9 +87,8 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @param sendEmailNotifications
|
||||
* @param priority
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestProcessModel addProcess(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority) throws Exception
|
||||
public RestProcessModel addProcess(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.process(processDefinitionKey, assignee, sendEmailNotifications, priority);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "processes");
|
||||
@@ -104,9 +100,8 @@ public class Processes extends ModelRequest<Processes>
|
||||
*
|
||||
* @param postBody
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestProcessModel addProcessWithBody(String postBody) throws Exception
|
||||
public RestProcessModel addProcessWithBody(String postBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "processes");
|
||||
return restWrapper.processModel(RestProcessModel.class, request);
|
||||
@@ -119,7 +114,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestProcessVariableModel addProcessVariable(RestProcessVariableModel variableModel) throws Exception
|
||||
public RestProcessVariableModel addProcessVariable(RestProcessVariableModel variableModel)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.processVariable(variableModel);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "processes/{processId}/variables", processModel.getId());
|
||||
@@ -133,7 +128,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestProcessVariableCollection addProcessVariables(RestProcessVariableModel... processVariablesModel) throws Exception
|
||||
public RestProcessVariableCollection addProcessVariables(RestProcessVariableModel... processVariablesModel)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for(RestProcessVariableModel processVariableModel: processVariablesModel)
|
||||
@@ -155,7 +150,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestItemModelsCollection getProcessItems() throws Exception
|
||||
public RestItemModelsCollection getProcessItems()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "processes/{processId}/items?{parameters}", processModel.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestItemModelsCollection.class, request);
|
||||
@@ -165,9 +160,8 @@ public class Processes extends ModelRequest<Processes>
|
||||
* Delete a process variable using DELETE call on processes/{processId}/variables/{variableName}
|
||||
*
|
||||
* @param variableModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteProcessVariable(RestProcessVariableModel variableModel) throws Exception
|
||||
public void deleteProcessVariable(RestProcessVariableModel variableModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "processes/{processId}/variables/{variableName}", processModel.getId(),
|
||||
variableModel.getName());
|
||||
@@ -181,7 +175,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestProcessVariableModel updateProcessVariable(RestProcessVariableModel variableModel) throws Exception
|
||||
public RestProcessVariableModel updateProcessVariable(RestProcessVariableModel variableModel)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.processVariable(variableModel);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, postBody, "processes/{processId}/variables/{variableName}", processModel.getId(),
|
||||
@@ -195,7 +189,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTaskModelsCollection getProcessTasks() throws Exception
|
||||
public RestTaskModelsCollection getProcessTasks()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "processes/{processId}/tasks?{parameters}", processModel.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestTaskModelsCollection.class, request);
|
||||
@@ -208,7 +202,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestItemModel addProcessItem(FileModel fileModel) throws Exception
|
||||
public RestItemModel addProcessItem(FileModel fileModel)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", fileModel.getNodeRefWithoutVersion());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "processes/{processId}/items", processModel.getId());
|
||||
@@ -222,7 +216,7 @@ public class Processes extends ModelRequest<Processes>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestItemModelsCollection addProcessItems(FileModel... fileModels) throws Exception
|
||||
public RestItemModelsCollection addProcessItems(FileModel... fileModels)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for(FileModel fileModel: fileModels)
|
||||
@@ -239,9 +233,8 @@ public class Processes extends ModelRequest<Processes>
|
||||
* Delete a process item using DELETE call on processes/{processId}/items/{itemId}
|
||||
*
|
||||
* @param itemModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteProcessItem(RestItemModel itemModel) throws Exception
|
||||
public void deleteProcessItem(RestItemModel itemModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "processes/{processId}/items/{itemId}", processModel.getId(), itemModel.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
|
@@ -19,9 +19,8 @@ public class Queries extends ModelRequest<Queries>
|
||||
* GET on queries/nodes
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModelsCollection findNodes() throws Exception
|
||||
public RestNodeModelsCollection findNodes()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "queries/nodes?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeModelsCollection.class, request);
|
||||
@@ -31,9 +30,8 @@ public class Queries extends ModelRequest<Queries>
|
||||
* GET on queries/people
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestPersonModelsCollection findPeople() throws Exception
|
||||
public RestPersonModelsCollection findPeople()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "queries/people?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestPersonModelsCollection.class, request);
|
||||
@@ -43,9 +41,8 @@ public class Queries extends ModelRequest<Queries>
|
||||
* GET on queries/people
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSiteModelsCollection findSites() throws Exception
|
||||
public RestSiteModelsCollection findSites()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "queries/sites?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteModelsCollection.class, request);
|
||||
|
@@ -34,7 +34,7 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @return RestSharedLinksModelCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSharedLinksModelCollection getSharedLinks() throws Exception
|
||||
public RestSharedLinksModelCollection getSharedLinks()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "shared-links?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSharedLinksModelCollection.class, request);
|
||||
@@ -47,7 +47,7 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @return RestSharedLinkModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSharedLinksModel getSharedLink(RestSharedLinksModel sharedLinksModel) throws Exception
|
||||
public RestSharedLinksModel getSharedLink(RestSharedLinksModel sharedLinksModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "shared-links/{sharedLinkId}?{parameters}", sharedLinksModel.getId(),
|
||||
restWrapper.getParameters());
|
||||
@@ -59,9 +59,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
*
|
||||
* @param sharedLinksModel
|
||||
* @return RestResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getSharedLinkContent(RestSharedLinksModel sharedLinksModel) throws Exception
|
||||
public RestResponse getSharedLinkContent(RestSharedLinksModel sharedLinksModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "shared-links/{sharedLinkId}/content?{parameters}", sharedLinksModel.getId(),
|
||||
restWrapper.getParameters());
|
||||
@@ -74,9 +73,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @param sharedLinksModel
|
||||
* @param postBody
|
||||
* @return RestResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse sendSharedLinkEmail(RestSharedLinksModel sharedLinksModel, String postBody) throws Exception
|
||||
public RestResponse sendSharedLinkEmail(RestSharedLinksModel sharedLinksModel, String postBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "shared-links/{sharedLinkId}/email?{parameters}", sharedLinksModel.getId(),
|
||||
restWrapper.getParameters());
|
||||
@@ -89,7 +87,7 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @return RestRenditionInfoModelCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestRenditionInfoModelCollection getSharedLinkRenditions(RestSharedLinksModel sharedLinksModel) throws Exception
|
||||
public RestRenditionInfoModelCollection getSharedLinkRenditions(RestSharedLinksModel sharedLinksModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "shared-links/{sharedLinkId}/renditions?{parameters}", sharedLinksModel.getId(),
|
||||
restWrapper.getParameters());
|
||||
@@ -104,7 +102,7 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @return RestRenditionInfoModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestRenditionInfoModel getSharedLinkRendition(RestSharedLinksModel sharedLinksModel, String renditionId) throws Exception
|
||||
public RestRenditionInfoModel getSharedLinkRendition(RestSharedLinksModel sharedLinksModel, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "shared-links/{sharedLinkId}/renditions/{renditionId}?{parameters}",
|
||||
sharedLinksModel.getId(), renditionId, restWrapper.getParameters());
|
||||
@@ -117,9 +115,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @param sharedLinksModel
|
||||
* @param renditionId
|
||||
* @return RestRenditionInfoModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getSharedLinkRenditionContent(RestSharedLinksModel sharedLinksModel, String renditionId) throws Exception
|
||||
public RestResponse getSharedLinkRenditionContent(RestSharedLinksModel sharedLinksModel, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "shared-links/{sharedLinkId}/renditions/{renditionId}/content?{parameters}",
|
||||
sharedLinksModel.getId(), renditionId, restWrapper.getParameters());
|
||||
@@ -131,9 +128,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
*
|
||||
* @param RestSharedLinksModel
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteSharedLink(RestSharedLinksModel sharedLinksModel) throws Exception
|
||||
public void deleteSharedLink(RestSharedLinksModel sharedLinksModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "shared-links/{sharedLinkId}", sharedLinksModel.getId());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -144,9 +140,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
*
|
||||
* @param file
|
||||
* @return RestSharedLinksModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSharedLinksModel createSharedLink(FileModel file) throws Exception
|
||||
public RestSharedLinksModel createSharedLink(FileModel file)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("nodeId", file.getNodeRefWithoutVersion());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "shared-links?{parameters}", restWrapper.getParameters());
|
||||
@@ -158,9 +153,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
*
|
||||
* @param file list
|
||||
* @return RestSharedLinksModelCollection
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSharedLinksModelCollection createSharedLinks(FileModel... files) throws Exception
|
||||
public RestSharedLinksModelCollection createSharedLinks(FileModel... files)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for (FileModel file : files)
|
||||
@@ -179,9 +173,8 @@ public class SharedLinks extends ModelRequest<SharedLinks>
|
||||
* @param file
|
||||
* @param expiryDate: format: "2027-03-23T23:00:00.000+0000";
|
||||
* @return RestSharedLinksModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSharedLinksModel createSharedLinkWithExpiryDate(FileModel file, String expiryDate) throws Exception
|
||||
public RestSharedLinksModel createSharedLinkWithExpiryDate(FileModel file, String expiryDate)
|
||||
{
|
||||
HashMap<String, String> body = new HashMap<String, String>();
|
||||
body.put("nodeId", file.getNodeRefWithoutVersion());
|
||||
|
@@ -11,9 +11,12 @@ import org.alfresco.rest.model.RestSiteContainerModel;
|
||||
import org.alfresco.rest.model.RestSiteContainerModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteMemberModel;
|
||||
import org.alfresco.rest.model.RestSiteMemberModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteGroupModel;
|
||||
import org.alfresco.rest.model.RestSiteGroupModelsCollection;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
import org.alfresco.rest.model.RestSiteModelsCollection;
|
||||
import org.alfresco.rest.model.RestSitePersonMembershipRequestModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -35,11 +38,10 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve one site using GET call on "sites/{siteId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteModel getSite() throws Exception
|
||||
public RestSiteModel getSite()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}?{parameters}", this.site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
@@ -48,11 +50,10 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve one site using GET call on "sites/{siteId}" along with relations parameter
|
||||
*
|
||||
* @param siteId
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public List<Object> getSiteWithRelations() throws Exception
|
||||
public List<Object> getSiteWithRelations()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}?{parameters}", this.site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processRelationsJson(request);
|
||||
@@ -64,7 +65,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteModelsCollection getSites() throws Exception
|
||||
public RestSiteModelsCollection getSites()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteModelsCollection.class, request);
|
||||
@@ -76,7 +77,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public List<List<Object>> getSitesWithRelations() throws Exception
|
||||
public List<List<Object>> getSitesWithRelations()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processSitesRelationsJson(request);
|
||||
@@ -87,10 +88,9 @@ public class Site extends ModelRequest<Site>
|
||||
*
|
||||
* @param person {@link UserModel}
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModel addPerson(UserModel person) throws Exception
|
||||
public RestSiteMemberModel addPerson(UserModel person)
|
||||
{
|
||||
String siteMemberBody = JsonBodyGenerator.siteMember(person);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, siteMemberBody, "sites/{siteId}/members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
@@ -103,7 +103,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModelsCollection getSiteMembers() throws Exception
|
||||
public RestSiteMemberModelsCollection getSiteMembers()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteMemberModelsCollection.class, request);
|
||||
@@ -112,12 +112,11 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve specific member of a site using GET call on "sites/{siteId}/members/{personId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @param personid
|
||||
* @param user A model containing the username to look for.
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModel getSiteMember(UserModel user) throws Exception
|
||||
public RestSiteMemberModel getSiteMember(UserModel user)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/members/{personId}?{parameters}", site.getId(), user.getUsername(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteMemberModel.class, request);
|
||||
@@ -129,7 +128,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteMemberModel updateSiteMember(UserModel siteMember) throws Exception
|
||||
public RestSiteMemberModel updateSiteMember(UserModel siteMember)
|
||||
{
|
||||
String json = JsonBodyGenerator.keyValueJson("role", siteMember.getUserRole().toString());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "sites/{siteId}/members/{personId}", site.getId(), siteMember.getUsername());
|
||||
@@ -139,9 +138,8 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Delete site member with DELETE call on "sites/{siteId}/members/{personId}"
|
||||
* @param person
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteSiteMember(UserModel person) throws Exception
|
||||
public void deleteSiteMember(UserModel person)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "sites/{siteId}/members/{personId}", site.getId(), person.getUsername());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -153,7 +151,7 @@ public class Site extends ModelRequest<Site>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteContainerModelsCollection getSiteContainers() throws Exception
|
||||
public RestSiteContainerModelsCollection getSiteContainers()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/containers?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteContainerModelsCollection.class, request);
|
||||
@@ -162,12 +160,11 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve specific container of a site using GET call on "sites/{siteId}/containers/{containerId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @param folderId
|
||||
* @param container A model containing the folderId to look for.
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteContainerModel getSiteContainer(RestSiteContainerModel container) throws Exception
|
||||
public RestSiteContainerModel getSiteContainer(RestSiteContainerModel container)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/containers/{containerId}?{parameters}", site.getId(), container.getFolderId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteContainerModel.class, request);
|
||||
@@ -176,12 +173,11 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Retrieve specific container of a site using GET call on "sites/{siteId}/containers/{containerId}"
|
||||
*
|
||||
* @param siteId
|
||||
* @param folderId
|
||||
* @param containerFolder The id of the container to look for.
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteContainerModel getSiteContainer(String containerFolder) throws Exception
|
||||
public RestSiteContainerModel getSiteContainer(String containerFolder)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/containers/{containerId}?{parameters}", site.getId(), containerFolder, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteContainerModel.class, request);
|
||||
@@ -190,23 +186,51 @@ public class Site extends ModelRequest<Site>
|
||||
/**
|
||||
* Create a collaboration site
|
||||
*
|
||||
* @param site information on the site to create
|
||||
* @return the properties of the created site
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSiteModel createSite() throws Exception
|
||||
public RestSiteModel createSite()
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, site.toJson(), "sites?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a site: Site title, description, visibility can be updated
|
||||
* Body:
|
||||
* {
|
||||
* "title": "string",
|
||||
* "description": "string",
|
||||
* "visibility": "PRIVATE"
|
||||
* }
|
||||
*
|
||||
* Response:
|
||||
* {
|
||||
* "entry": {
|
||||
* "id": "string",
|
||||
* "guid": "string",
|
||||
* "title": "string",
|
||||
* "description": "string",
|
||||
* "visibility": "PRIVATE",
|
||||
* "preset": "string",
|
||||
* "role": "SiteConsumer"
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @return the properties of an updated site
|
||||
*/
|
||||
public RestSiteModel updateSite(SiteModel site)
|
||||
{
|
||||
String siteBody = JsonBodyGenerator.updateSiteRequest(site);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, siteBody, "sites/{siteId}", site.getId());
|
||||
return restWrapper.processModel(RestSiteModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get site membership requests by using GET /site-membership-requests
|
||||
*
|
||||
* @return site memberships
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSitePersonMembershipRequestModelsCollection getSiteMemberships() throws Exception
|
||||
public RestSitePersonMembershipRequestModelsCollection getSiteMemberships()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "site-membership-requests?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSitePersonMembershipRequestModelsCollection.class, request);
|
||||
@@ -216,9 +240,8 @@ public class Site extends ModelRequest<Site>
|
||||
* Approve a site membership request by using POST call on /sites/{siteId}/site-membership-requests/{inviteeId}/approve
|
||||
*
|
||||
* @param siteMember
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse approveSiteMembership(UserModel siteMember) throws Exception
|
||||
public RestResponse approveSiteMembership(UserModel siteMember)
|
||||
{
|
||||
String json = JsonBodyGenerator.keyValueJson("role", siteMember.getUserRole().toString());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, json, "sites/{siteId}/site-membership-requests/{inviteeId}/approve", site.getId(), siteMember.getUsername());
|
||||
@@ -229,11 +252,72 @@ public class Site extends ModelRequest<Site>
|
||||
* Reject a site membership request by using POST call /sites/{siteId}/site-membership-requests/{inviteeId}/reject
|
||||
*
|
||||
* @param siteMember
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse rejectSiteMembership(UserModel siteMember) throws Exception
|
||||
public RestResponse rejectSiteMembership(UserModel siteMember)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "sites/{siteId}/site-membership-requests/{inviteeId}/reject", site.getId(), siteMember.getUsername());
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all group membership of a site using GET call on "sites/{siteId}/group-members"
|
||||
*
|
||||
* @return RestSiteGroupModelsCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteGroupModelsCollection getSiteGroups()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/group-members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSiteGroupModelsCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new site group membership using POST call on "sites/{siteId}/group-members"
|
||||
*
|
||||
* @param authorityId The authorityId of the group
|
||||
* @param role role to assign
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteGroupModel addSiteGroup(String authorityId, UserRole role)
|
||||
{
|
||||
String siteMemberBody = JsonBodyGenerator.siteGroup(authorityId, role);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, siteMemberBody, "sites/{siteId}/group-members?{parameters}", site.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestSiteGroupModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve specific group membership of a site using GET call on "sites/{siteId}/group-members/{groupId}"
|
||||
*
|
||||
* @param groupId
|
||||
* @return RestSiteGroupModel
|
||||
*/
|
||||
public RestSiteGroupModel getSiteGroup(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "sites/{siteId}/group-members/{groupId}", site.getId(), groupId);
|
||||
return restWrapper.processModel(RestSiteGroupModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update site group membership role with PUT call on "sites/{siteId}/group-members/{groupId}"
|
||||
* @param groupId
|
||||
* @return RestSiteGroupModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestSiteGroupModel updateSiteGroup(String groupId, UserRole role)
|
||||
{
|
||||
String json = JsonBodyGenerator.keyValueJson("role", role.toString());
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, json, "sites/{siteId}/group-members/{groupId}", site.getId(), groupId);
|
||||
return restWrapper.processModel(RestSiteGroupModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete site group membership with DELETE call on "sites/{siteId}/group-members/{groupId}"
|
||||
* @param groupId
|
||||
*/
|
||||
public void deleteSiteGroup(String groupId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "sites/{siteId}/group-members/{groupId}", site.getId(), groupId);
|
||||
restWrapper.processEmptyModel(request);
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ public class Tags extends ModelRequest<Tags>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTagModelsCollection getTags() throws Exception
|
||||
public RestTagModelsCollection getTags()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tags?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestTagModelsCollection.class, request);
|
||||
@@ -35,9 +35,8 @@ public class Tags extends ModelRequest<Tags>
|
||||
*
|
||||
* @param tag
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTagModel getTag() throws Exception
|
||||
public RestTagModel getTag()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tags/{tagId}?{parameters}", tag.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestTagModel.class, request);
|
||||
@@ -51,7 +50,7 @@ public class Tags extends ModelRequest<Tags>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTagModel update(String newTag) throws Exception
|
||||
public RestTagModel update(String newTag)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("tag", newTag);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, postBody, "tags/{tagId}", tag.getId());
|
||||
|
@@ -38,9 +38,8 @@ public class Task extends ModelRequest<Task>
|
||||
* Retrieve a list of tasks visible for the authenticated user using GET call on "/tasks"
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTaskModelsCollection getTasks() throws Exception
|
||||
public RestTaskModelsCollection getTasks()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tasks?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestTaskModelsCollection.class, request);
|
||||
@@ -51,9 +50,8 @@ public class Task extends ModelRequest<Task>
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTaskModel getTask() throws Exception
|
||||
public RestTaskModel getTask()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tasks/{taskId}?{parameters}", task.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestTaskModel.class, request);
|
||||
@@ -66,7 +64,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTaskModel updateTask(String newStateValue) throws Exception
|
||||
public RestTaskModel updateTask(String newStateValue)
|
||||
{
|
||||
return updateTask(JsonBodyGenerator.defineJSON().add("state", newStateValue).build());
|
||||
}
|
||||
@@ -76,9 +74,8 @@ public class Task extends ModelRequest<Task>
|
||||
*
|
||||
* @param inputJson the json used as input for PUT call
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestTaskModel updateTask(JsonObject inputJson) throws Exception
|
||||
public RestTaskModel updateTask(JsonObject inputJson)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, inputJson.toString(), "tasks/{taskId}?{parameters}", task.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestTaskModel.class, request);
|
||||
@@ -89,9 +86,8 @@ public class Task extends ModelRequest<Task>
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestVariableModelsCollection getTaskVariables() throws Exception
|
||||
public RestVariableModelsCollection getTaskVariables()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tasks/{taskId}/variables?{parameters}", task.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestVariableModelsCollection.class, request);
|
||||
@@ -105,7 +101,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestVariableModel updateTaskVariable(RestVariableModel variableModel) throws Exception
|
||||
public RestVariableModel updateTaskVariable(RestVariableModel variableModel)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.taskVariable(variableModel);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, postBody, "tasks/{taskId}/variables/{variableName}", task.getId(),
|
||||
@@ -120,7 +116,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestVariableModel addTaskVariable(RestVariableModel variableModel) throws Exception
|
||||
public RestVariableModel addTaskVariable(RestVariableModel variableModel)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.taskVariable(variableModel);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "tasks/{taskId}/variables", task.getId());
|
||||
@@ -134,7 +130,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestVariableModelsCollection addTaskVariables(RestVariableModel... taskVariablesModel) throws Exception
|
||||
public RestVariableModelsCollection addTaskVariables(RestVariableModel... taskVariablesModel)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for(RestVariableModel taskVariableModel: taskVariablesModel)
|
||||
@@ -156,7 +152,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public void deleteTaskVariable(RestVariableModel variableModel) throws Exception
|
||||
public void deleteTaskVariable(RestVariableModel variableModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "tasks/{taskId}/variables/{variableName} ", task.getId(),
|
||||
variableModel.getName());
|
||||
@@ -170,7 +166,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestItemModel addTaskItem(FileModel fileModel) throws Exception
|
||||
public RestItemModel addTaskItem(FileModel fileModel)
|
||||
{
|
||||
String postBody = JsonBodyGenerator.keyValueJson("id", fileModel.getNodeRef().split(";")[0]);
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, postBody, "tasks/{taskId}/items", task.getId());
|
||||
@@ -184,7 +180,7 @@ public class Task extends ModelRequest<Task>
|
||||
* @return
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestItemModelsCollection addTaskItems(FileModel... fileModels) throws Exception
|
||||
public RestItemModelsCollection addTaskItems(FileModel... fileModels)
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for(FileModel fileModel: fileModels)
|
||||
@@ -203,9 +199,8 @@ public class Task extends ModelRequest<Task>
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestItemModelsCollection getTaskItems() throws Exception
|
||||
public RestItemModelsCollection getTaskItems()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tasks/{taskId}/items?{parameters}", task.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestItemModelsCollection.class, request);
|
||||
@@ -215,9 +210,8 @@ public class Task extends ModelRequest<Task>
|
||||
* Retrieves models of the task form type definition
|
||||
* @param taskModel
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestFormModelsCollection getTaskFormModel() throws Exception
|
||||
public RestFormModelsCollection getTaskFormModel()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tasks/{taskId}/task-form-model?{parameters}", task.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestFormModelsCollection.class, request);
|
||||
@@ -228,10 +222,8 @@ public class Task extends ModelRequest<Task>
|
||||
*
|
||||
* @param taskId
|
||||
* @param itemId
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteTaskItem(RestItemModel itemModel) throws Exception
|
||||
public void deleteTaskItem(RestItemModel itemModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "tasks/{taskId}/items/{itemId}", task.getId(),
|
||||
itemModel.getId());
|
||||
@@ -243,9 +235,8 @@ public class Task extends ModelRequest<Task>
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestCandidateModelsCollection getTaskCandidates() throws Exception
|
||||
public RestCandidateModelsCollection getTaskCandidates()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "tasks/{taskId}/candidates?{parameters}", task.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestCandidateModelsCollection.class, request);
|
||||
|
@@ -32,10 +32,9 @@ public class Tenant extends ModelRequest<Tenant>
|
||||
*
|
||||
* @param userModel
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public void createTenant(UserModel userModel) throws Exception
|
||||
public void createTenant(UserModel userModel)
|
||||
{
|
||||
STEP(String.format("DATAPREP: Create new tenant %s", userModel.getDomain()));
|
||||
String json = String.format("{\"tenantDomain\": \"%s\", \"tenantAdminPassword\": \"%s\"}", userModel.getDomain(), DataUser.PASSWORD);
|
||||
@@ -43,9 +42,9 @@ public class Tenant extends ModelRequest<Tenant>
|
||||
.contentType(ContentType.JSON);
|
||||
Response returnedResponse = request.contentType(ContentType.JSON).body(json)
|
||||
.post(String.format("%s/%s", restProperties.envProperty().getFullServerUrl(), "alfresco/service/api/tenants")).andReturn();
|
||||
if (!String.valueOf(returnedResponse.getStatusCode()).equals(HttpStatus.OK.toString()))
|
||||
if (!Integer.valueOf(returnedResponse.getStatusCode()).equals(HttpStatus.OK.value()))
|
||||
{
|
||||
throw new Exception(String.format("Tenant is not created: %s", returnedResponse.asString()));
|
||||
throw new IllegalStateException(String.format("Tenant is not created: %s", returnedResponse.asString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,9 +21,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
* GET on deleted-nodes
|
||||
*
|
||||
* @return RestNodeModelsCollection
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModelsCollection findDeletedNodes() throws Exception
|
||||
public RestNodeModelsCollection findDeletedNodes()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestNodeModelsCollection.class, request);
|
||||
@@ -34,9 +33,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestNodeModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel findDeletedNode(RepoTestModel repoModel) throws Exception
|
||||
public RestNodeModel findDeletedNode(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -47,9 +45,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteNodeFromTrashcan(RepoTestModel repoModel) throws Exception
|
||||
public void deleteNodeFromTrashcan(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, "deleted-nodes/{nodeId}", repoModel.getNodeRefWithoutVersion());
|
||||
restWrapper.processEmptyModel(request);
|
||||
@@ -60,9 +57,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestNodeModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestNodeModel restoreNodeFromTrashcan(RepoTestModel repoModel) throws Exception
|
||||
public RestNodeModel restoreNodeFromTrashcan(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.POST, "deleted-nodes/{nodeId}/restore?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestNodeModel.class, request);
|
||||
@@ -73,9 +69,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getDeletedNodeContent(RepoTestModel repoModel) throws Exception
|
||||
public RestResponse getDeletedNodeContent(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/content?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
@@ -86,9 +81,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
*
|
||||
* @param repoModel
|
||||
* @return RestRenditionInfoModelCollection
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModelCollection getDeletedNodeRenditions(RepoTestModel repoModel) throws Exception
|
||||
public RestRenditionInfoModelCollection getDeletedNodeRenditions(RepoTestModel repoModel)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/renditions?{parameters}", repoModel.getNodeRefWithoutVersion(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestRenditionInfoModelCollection.class, request);
|
||||
@@ -100,9 +94,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
* @param repoModel
|
||||
* @param renditionId
|
||||
* @return RestRenditionInfoModel
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestRenditionInfoModel getDeletedNodeRendition(RepoTestModel repoModel, String renditionId) throws Exception
|
||||
public RestRenditionInfoModel getDeletedNodeRendition(RepoTestModel repoModel, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/renditions/{renditionId}?{parameters}", repoModel.getNodeRefWithoutVersion(), renditionId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestRenditionInfoModel.class, request);
|
||||
@@ -114,9 +107,8 @@ public class Trashcan extends ModelRequest<Trashcan>
|
||||
* @param repoModel
|
||||
* @param renditionId
|
||||
* @return RestResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestResponse getDeletedNodeRenditionContent(RepoTestModel repoModel, String renditionId) throws Exception
|
||||
public RestResponse getDeletedNodeRenditionContent(RepoTestModel repoModel, String renditionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "deleted-nodes/{nodeId}/renditions/{renditionId}/content?{parameters}", repoModel.getNodeRefWithoutVersion(), renditionId, restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
|
@@ -18,7 +18,7 @@ public class RestAuthAPI extends ModelRequest<RestAuthAPI>
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public RestTicketModel createTicket(RestTicketBodyModel ticketBody) throws Exception
|
||||
public RestTicketModel createTicket(RestTicketBodyModel ticketBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, ticketBody.toJson(), "tickets");
|
||||
return restWrapper.processModel(RestTicketModel.class, request);
|
||||
|
@@ -7,6 +7,7 @@ import org.alfresco.rest.model.RestTagModel;
|
||||
import org.alfresco.rest.model.RestTagModelsCollection;
|
||||
import org.alfresco.rest.requests.Actions;
|
||||
import org.alfresco.rest.requests.Audit;
|
||||
import org.alfresco.rest.requests.ContentStorageInformation;
|
||||
import org.alfresco.rest.requests.Downloads;
|
||||
import org.alfresco.rest.requests.Groups;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
@@ -63,9 +64,8 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
* Provides DSL on all REST calls under <code>/sites</code> API path
|
||||
*
|
||||
* @return {@link Site}
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSiteModelsCollection getSites() throws Exception
|
||||
public RestSiteModelsCollection getSites()
|
||||
{
|
||||
return new Site(null, restWrapper).getSites();
|
||||
}
|
||||
@@ -74,9 +74,8 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
* Provides DSL on all REST calls under <code>/nodes</code> API path
|
||||
*
|
||||
* @return {@link Node}
|
||||
* @throws Exception
|
||||
*/
|
||||
public Node usingResource(RepoTestModel node) throws Exception
|
||||
public Node usingResource(RepoTestModel node)
|
||||
{
|
||||
return new Node(node, restWrapper);
|
||||
}
|
||||
@@ -86,25 +85,28 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Node usingNode(RepoTestModel node) throws Exception
|
||||
public Node usingNode(RepoTestModel node)
|
||||
{
|
||||
return new Node(node, restWrapper);
|
||||
}
|
||||
|
||||
public Node usingNode() throws Exception
|
||||
public Node usingNode()
|
||||
{
|
||||
return new Node(restWrapper);
|
||||
}
|
||||
|
||||
public ContentStorageInformation usingStorageInfo()
|
||||
{
|
||||
return new ContentStorageInformation(restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL of all REST calls under <code>/people</code> API path
|
||||
*
|
||||
* @return {@link People}
|
||||
* @throws Exception
|
||||
*/
|
||||
public People usingUser(UserModel person) throws Exception
|
||||
public People usingUser(UserModel person)
|
||||
{
|
||||
return new People(person, restWrapper);
|
||||
}
|
||||
@@ -113,9 +115,8 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
* Make REST calls using current authenticated user, but using -me- instead of username
|
||||
*
|
||||
* @return {@link People}
|
||||
* @throws Exception
|
||||
*/
|
||||
public People usingMe() throws Exception
|
||||
public People usingMe()
|
||||
{
|
||||
UserModel userModel = new UserModel("-me-", restWrapper.getTestUser().getPassword());
|
||||
userModel.setDomain(restWrapper.getTestUser().getDomain());
|
||||
@@ -128,9 +129,8 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
* This is set on the {@link #authenticateUser(UserModel)} call
|
||||
*
|
||||
* @return {@link People}
|
||||
* @throws Exception
|
||||
*/
|
||||
public People usingAuthUser() throws Exception
|
||||
public People usingAuthUser()
|
||||
{
|
||||
return new People(restWrapper.getTestUser(), restWrapper);
|
||||
}
|
||||
@@ -150,12 +150,12 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
return new Tags(tag, restWrapper);
|
||||
}
|
||||
|
||||
public RestTagModelsCollection getTags() throws Exception
|
||||
public RestTagModelsCollection getTags()
|
||||
{
|
||||
return new Tags(null, restWrapper).getTags();
|
||||
}
|
||||
|
||||
public RestTagModel getTag(RestTagModel tag) throws Exception
|
||||
public RestTagModel getTag(RestTagModel tag)
|
||||
{
|
||||
return new Tags(tag, restWrapper).getTag();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
return new Queries(restWrapper);
|
||||
}
|
||||
|
||||
public Audit usingAudit() throws Exception
|
||||
public Audit usingAudit()
|
||||
{
|
||||
return new Audit(restWrapper);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public class RestCoreAPI extends ModelRequest<RestCoreAPI>
|
||||
return new Downloads(restWrapper);
|
||||
}
|
||||
|
||||
public Downloads usingDownloads(RestDownloadsModel downloadsModel) throws Exception
|
||||
public Downloads usingDownloads(RestDownloadsModel downloadsModel)
|
||||
{
|
||||
return new Downloads(downloadsModel, restWrapper);
|
||||
}
|
||||
|
@@ -0,0 +1,71 @@
|
||||
package org.alfresco.rest.requests.modelAPI;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.model.*;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
/**
|
||||
* Defines the entire Rest Model API
|
||||
* {@link https://api-explorer.alfresco.com/api-explorer/} select "Model API"
|
||||
*/
|
||||
public class RestModelAPI extends ModelRequest<RestModelAPI>
|
||||
{
|
||||
public RestModelAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
RestAssured.basePath = "alfresco/api/-default-/public/alfresco/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all aspects using GET call on "aspects"
|
||||
*
|
||||
* @return RestAspectsCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestAspectsCollection getAspects()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "aspects?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestAspectsCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve aspect by id using GET call on "aspects/{aspectId}"
|
||||
*
|
||||
* @return RestAspectModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestAspectModel getAspect(String aspectId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "aspects/{aspectId}?{parameters}", aspectId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestAspectModel.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all types using GET call on "types"
|
||||
*
|
||||
* @return RestTypesCollection
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTypesCollection getTypes()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "types?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestTypesCollection.class, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Type by id using GET call on "types/{typeId}"
|
||||
*
|
||||
* @return RestTypeModel
|
||||
* @throws JsonToModelConversionException
|
||||
*/
|
||||
public RestTypeModel getType(String typeId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "types/{typeId}?{parameters}", typeId, restWrapper.getParameters());
|
||||
return restWrapper.processModel(RestTypeModel.class, request);
|
||||
}
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
package org.alfresco.rest.requests.privateAPI;
|
||||
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.model.RestCustomTypeModel;
|
||||
import org.alfresco.rest.model.RestSubscriberModel;
|
||||
import org.alfresco.rest.model.RestSyncNodeSubscriptionModel;
|
||||
import org.alfresco.rest.requests.CustomAspectModelManager;
|
||||
import org.alfresco.rest.requests.CustomModelManager;
|
||||
import org.alfresco.rest.requests.CustomTypeManager;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.alfresco.rest.requests.syncServiceAPI.Healthcheck;
|
||||
import org.alfresco.rest.requests.syncServiceAPI.Subscribers;
|
||||
@@ -38,6 +40,11 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
return new CustomModelManager(customContentModel, restWrapper);
|
||||
}
|
||||
|
||||
public CustomModelManager usingCustomModel()
|
||||
{
|
||||
return new CustomModelManager(restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL on all REST calls under <code>cmm/{modelName}/aspects/{aspectName}...</code> API path
|
||||
*
|
||||
@@ -50,6 +57,18 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
return new CustomAspectModelManager(customContentModel, aspectModel, restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL on all REST calls under <code>cmm/{modelName}/types/{typeName}...</code> API path
|
||||
*
|
||||
* @param customContentModel {@link CustomContentModel}
|
||||
* @param customType {@link RestCustomTypeModel}
|
||||
* @return {@link CustomTypeManager}
|
||||
*/
|
||||
public CustomTypeManager usingCustomType(CustomContentModel customContentModel, RestCustomTypeModel customType)
|
||||
{
|
||||
return new CustomTypeManager(customContentModel, customType, restWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides DSL on all REST calls under <code>subscribers/</code> API path
|
||||
*
|
||||
@@ -65,7 +84,7 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
*
|
||||
* @return {@link Subscribers}
|
||||
*/
|
||||
public Subscriptions withSubscriber(RestSubscriberModel subscriber) throws Exception
|
||||
public Subscriptions withSubscriber(RestSubscriberModel subscriber)
|
||||
{
|
||||
return new Subscriptions(subscriber, restWrapper);
|
||||
}
|
||||
@@ -75,7 +94,7 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
*
|
||||
* @return {@link Subscribers}
|
||||
*/
|
||||
public Subscriptions withSubscriber(String subscriberID) throws Exception
|
||||
public Subscriptions withSubscriber(String subscriberID)
|
||||
{
|
||||
RestSubscriberModel s = new RestSubscriberModel();
|
||||
s.setId(subscriberID);
|
||||
@@ -87,7 +106,7 @@ public class RestPrivateAPI extends ModelRequest<RestPrivateAPI>
|
||||
*
|
||||
* @return {@link Subscribers}
|
||||
*/
|
||||
public Sync withSubscription(RestSyncNodeSubscriptionModel nodeSubscription) throws Exception
|
||||
public Sync withSubscription(RestSyncNodeSubscriptionModel nodeSubscription)
|
||||
{
|
||||
RestSubscriberModel s = new RestSubscriberModel();
|
||||
s.setId(nodeSubscription.getDeviceSubscriptionId());
|
||||
|
@@ -18,14 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.rest.requests.search;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.alfresco.rest.search.SearchRequest;
|
||||
import org.alfresco.rest.search.SearchResponse;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
/**
|
||||
* Wrapper for Search API.
|
||||
* @author Michael Suzuki
|
||||
@@ -36,11 +35,12 @@ public class SearchAPI extends ModelRequest<SearchAPI>
|
||||
public SearchAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureAlfrescoEndpoint();
|
||||
RestAssured.basePath = "alfresco/api/-default-/public/search/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public SearchResponse search(SearchRequest queryBody) throws Exception
|
||||
public SearchResponse search(SearchRequest queryBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, queryBody.toJson(), "search");
|
||||
return restWrapper.processModels(SearchResponse.class, request);
|
||||
|
@@ -127,11 +127,12 @@ public class SearchSQLAPI extends ModelRequest<SearchSQLAPI>
|
||||
public SearchSQLAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureAlfrescoEndpoint();
|
||||
RestAssured.basePath = "alfresco/api/-default-/public/search/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public RestResponse searchSql(SearchSqlRequest query) throws Exception
|
||||
public RestResponse searchSql(SearchSqlRequest query)
|
||||
{
|
||||
String stmt = (null == query.getSql() || query.getSql().isEmpty()) ? "" : query.getSql();
|
||||
|
||||
|
@@ -42,6 +42,7 @@ public class ShardInfoAPI extends ModelRequest<ShardInfoAPI>
|
||||
public ShardInfoAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureAlfrescoEndpoint();
|
||||
RestAssured.basePath = "alfresco/api/-default-/private/search/versions/1";
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
@@ -43,31 +43,42 @@ public class SolrAPI extends ModelRequest<SolrAPI>
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public RestTextResponse getConfig() throws Exception
|
||||
public RestTextResponse getConfig()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "config?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
public RestTextResponse getConfigOverlay() throws Exception
|
||||
public RestTextResponse getConfigOverlay()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "config/overlay?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
public RestTextResponse getConfigParams() throws Exception
|
||||
public RestTextResponse getConfigParams()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "config/params?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
public RestTextResponse postConfig(String queryBody) throws Exception
|
||||
public RestTextResponse postConfig(String queryBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, queryBody, "config");
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
public RestTextResponse getSelectQuery() throws Exception
|
||||
/**
|
||||
* Executes an action (like "delete") on SOLR alfresco core
|
||||
* @param urlActionPath some action name (like "delete")
|
||||
* @param queryBody parameters for the action
|
||||
*/
|
||||
public RestTextResponse postAction(String urlActionPath, String queryBody)
|
||||
{
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, queryBody, urlActionPath);
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
public RestTextResponse getSelectQuery()
|
||||
{
|
||||
List<Header> headers = new ArrayList<Header>();
|
||||
headers.add(new Header("Content-Type", "application/xml"));
|
||||
@@ -77,4 +88,19 @@ public class SolrAPI extends ModelRequest<SolrAPI>
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a query in SOLR using JSON format for the results
|
||||
*/
|
||||
public RestTextResponse getSelectQueryJson()
|
||||
{
|
||||
List<Header> headers = new ArrayList<Header>();
|
||||
headers.add(new Header("Content-Type", "application/json"));
|
||||
Headers header = new Headers(headers);
|
||||
restWrapper.setResponseHeaders(header);
|
||||
restWrapper.configureRequestSpec().setUrlEncodingEnabled(false);
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}&wt=json", restWrapper.getParameters());
|
||||
return restWrapper.processTextResponse(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Alfresco Software Limited.
|
||||
* This file is part of Alfresco
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.requests.search;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.rest.requests.ModelRequest;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.Header;
|
||||
import io.restassured.http.Headers;
|
||||
|
||||
/**
|
||||
* Wrapper for SOLR Admin REST API
|
||||
*
|
||||
* @author aborroy
|
||||
*
|
||||
*/
|
||||
public class SolrAdminAPI extends ModelRequest<SolrAdminAPI>
|
||||
{
|
||||
public SolrAdminAPI(RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
RestAssured.basePath = "solr/admin";
|
||||
|
||||
restWrapper.configureSolrEndPoint();
|
||||
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
public RestResponse getAction(String action)
|
||||
{
|
||||
List<Header> headers = new ArrayList<Header>();
|
||||
headers.add(new Header("Content-Type", "application/json"));
|
||||
Headers header = new Headers(headers);
|
||||
restWrapper.setResponseHeaders(header);
|
||||
restWrapper.configureRequestSpec().setUrlEncodingEnabled(false);
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
"cores?action=" + action + "&wt=json&{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.process(request);
|
||||
}
|
||||
}
|
@@ -24,9 +24,8 @@ public class Healthcheck extends ModelRequest<RestPrivateAPI>
|
||||
/**
|
||||
* Get Healthcheck using GET call on alfresco/healthcheck
|
||||
* @return {@link RestSyncServiceHealthCheckModel}
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSyncServiceHealthCheckModel getHealthcheck() throws Exception
|
||||
public RestSyncServiceHealthCheckModel getHealthcheck()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "healthcheck?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModelWithoutEntryObject(RestSyncServiceHealthCheckModel.class, request);
|
||||
|
@@ -26,9 +26,8 @@ public class Subscribers extends ModelRequest<RestPrivateAPI>
|
||||
/**
|
||||
* Get Subscription(s) using GET call on /subscribers
|
||||
* @return {@link RestSubscriberModelCollection}
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSubscriberModelCollection getSubscribers() throws Exception
|
||||
public RestSubscriberModelCollection getSubscribers()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "subscribers?{parameters}", restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSubscriberModelCollection.class, request);
|
||||
@@ -40,9 +39,8 @@ public class Subscribers extends ModelRequest<RestPrivateAPI>
|
||||
* @param deviceOS
|
||||
* @param clientVersion
|
||||
* @return {@link RestSubscriberModel}
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSubscriberModel registerDevice(String deviceOS, String clientVersion) throws Exception
|
||||
public RestSubscriberModel registerDevice(String deviceOS, String clientVersion)
|
||||
{
|
||||
HashMap<String, String> body = new HashMap<String, String>();
|
||||
body.put("deviceOS", deviceOS);
|
||||
|
@@ -32,7 +32,7 @@ public class Subscriptions extends ModelRequest<RestPrivateAPI>
|
||||
String nodeSubscriptionURL = subscriptionsURL + "/{nodeSubscriptionId}";
|
||||
String params = "?{parameters}";
|
||||
|
||||
public Subscriptions(RestSubscriberModel subscriber, RestWrapper restWrapper) throws Exception
|
||||
public Subscriptions(RestSubscriberModel subscriber, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
this.subscriber = subscriber;
|
||||
@@ -44,9 +44,9 @@ public class Subscriptions extends ModelRequest<RestPrivateAPI>
|
||||
*
|
||||
* @param targetNodeIds: one or more
|
||||
* @return RestSyncNodeSubscriptionModel
|
||||
* @throws Exception: EmptyJsonResponseException, JsonToModelConversionException
|
||||
* @throws EmptyJsonResponseException, JsonToModelConversionException
|
||||
*/
|
||||
public RestSyncNodeSubscriptionModelCollection subscribeToNodes(String... targetNodeIds) throws Exception
|
||||
public RestSyncNodeSubscriptionModelCollection subscribeToNodes(String... targetNodeIds)
|
||||
{
|
||||
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
@@ -86,9 +86,8 @@ public class Subscriptions extends ModelRequest<RestPrivateAPI>
|
||||
* Get NODE Subscription(s) using GET call on /subscribers/{deviceSubscriptionId}/subscriptions
|
||||
*
|
||||
* @return {@link RestSyncNodeSubscriptionModelCollection}
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSyncNodeSubscriptionModelCollection getSubscriptions() throws Exception
|
||||
public RestSyncNodeSubscriptionModelCollection getSubscriptions()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, subscriptionsURL + params, this.subscriber.getId(), restWrapper.getParameters());
|
||||
return restWrapper.processModels(RestSyncNodeSubscriptionModelCollection.class, request);
|
||||
@@ -98,9 +97,9 @@ public class Subscriptions extends ModelRequest<RestPrivateAPI>
|
||||
* Get NODE Subscription using GET call on /subscribers/{deviceSubscriptionId}/subscriptions/{nodeSubscriptionId}
|
||||
*
|
||||
* @return RestSyncNodeSubscriptionModelCollection
|
||||
* @throws Exception: EmptyJsonResponseException, JsonToModelConversionException
|
||||
* @throws EmptyJsonResponseException, JsonToModelConversionException
|
||||
*/
|
||||
public RestSyncNodeSubscriptionModel getSubscription(String nodeSubscriptionId) throws Exception
|
||||
public RestSyncNodeSubscriptionModel getSubscription(String nodeSubscriptionId)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, nodeSubscriptionURL + params, this.subscriber.getId(), nodeSubscriptionId,
|
||||
restWrapper.getParameters());
|
||||
|
@@ -31,7 +31,7 @@ public class Sync extends ModelRequest<RestPrivateAPI>
|
||||
String syncSetURL = requestSyncURL + "/{syncId}";
|
||||
String params = "?{parameters}";
|
||||
|
||||
public Sync(RestSyncNodeSubscriptionModel subscription, RestWrapper restWrapper) throws Exception
|
||||
public Sync(RestSyncNodeSubscriptionModel subscription, RestWrapper restWrapper)
|
||||
{
|
||||
super(restWrapper);
|
||||
restWrapper.configureSyncServiceEndPoint();
|
||||
@@ -46,10 +46,8 @@ public class Sync extends ModelRequest<RestPrivateAPI>
|
||||
* @param nodeSubscriptionId
|
||||
* @param clientChanges
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSyncSetRequestModel startSync(RestSyncNodeSubscriptionModel nodeSubscriptionModel, List<RestSyncSetChangesModel> clientChanges, String clientVersion)
|
||||
throws Exception
|
||||
{
|
||||
JsonArrayBuilder array = JsonBodyGenerator.defineJSONArray();
|
||||
for (RestSyncSetChangesModel change : clientChanges)
|
||||
@@ -69,7 +67,7 @@ public class Sync extends ModelRequest<RestPrivateAPI>
|
||||
return model;
|
||||
}
|
||||
|
||||
public RestWrapper endSync(RestSyncNodeSubscriptionModel nodeSubscriptionModel, RestSyncSetRequestModel sync) throws Exception
|
||||
public RestWrapper endSync(RestSyncNodeSubscriptionModel nodeSubscriptionModel, RestSyncSetRequestModel sync)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.DELETE, syncSetURL + params, this.subscriber, nodeSubscriptionModel.getId(),
|
||||
sync.getSyncId(), restWrapper.getParameters());
|
||||
@@ -85,9 +83,8 @@ public class Sync extends ModelRequest<RestPrivateAPI>
|
||||
*
|
||||
* @param syncRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public RestSyncSetGetModel getSync(RestSyncNodeSubscriptionModel nodeSubscriptionModel, RestSyncSetRequestModel sync) throws Exception
|
||||
public RestSyncSetGetModel getSync(RestSyncNodeSubscriptionModel nodeSubscriptionModel, RestSyncSetRequestModel sync)
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, syncSetURL + params, this.subscriber, nodeSubscriptionModel.getId(), sync.getSyncId(),
|
||||
restWrapper.getParameters());
|
||||
|
@@ -40,7 +40,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link RestProcessModel}
|
||||
*/
|
||||
public RestProcessModel addProcess(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority) throws Exception
|
||||
public RestProcessModel addProcess(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority)
|
||||
{
|
||||
return new Processes(restWrapper).addProcess(processDefinitionKey, assignee, sendEmailNotifications, priority);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link RestProcessModel}
|
||||
*/
|
||||
public RestProcessModel addProcessWithBody(JsonObject postBody) throws Exception
|
||||
public RestProcessModel addProcessWithBody(JsonObject postBody)
|
||||
{
|
||||
return new Processes(restWrapper).addProcessWithBody(postBody.toString());
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link RestProcessModelsCollection}
|
||||
*/
|
||||
public RestProcessModelsCollection getProcesses() throws Exception
|
||||
public RestProcessModelsCollection getProcesses()
|
||||
{
|
||||
return new Processes(restWrapper).getProcesses();
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link RestDeploymentModelsCollection}
|
||||
*/
|
||||
public RestDeploymentModelsCollection getDeployments() throws Exception
|
||||
public RestDeploymentModelsCollection getDeployments()
|
||||
{
|
||||
return new Deployments(restWrapper).getDeployments();
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link RestProcessDefinitionModelsCollection}
|
||||
*/
|
||||
public RestProcessDefinitionModelsCollection getAllProcessDefinitions() throws Exception
|
||||
public RestProcessDefinitionModelsCollection getAllProcessDefinitions()
|
||||
{
|
||||
return new ProcessDefinitions(restWrapper).getAllProcessDefinitions();
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link Processes}
|
||||
*/
|
||||
public Processes usingProcess(ProcessModel processModel) throws Exception
|
||||
public Processes usingProcess(ProcessModel processModel)
|
||||
{
|
||||
return new Processes(processModel, restWrapper);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class RestWorkflowAPI extends ModelRequest<RestWorkflowAPI>
|
||||
*
|
||||
* @return {@link RestTaskModelsCollection}
|
||||
*/
|
||||
public RestTaskModelsCollection getTasks() throws Exception
|
||||
public RestTaskModelsCollection getTasks()
|
||||
{
|
||||
return new Task(restWrapper, null).getTasks();
|
||||
}
|
||||
|
@@ -57,6 +57,9 @@ public class RestInstanceModel
|
||||
|
||||
/** Transactions remaining */
|
||||
private Long transactionsRemaining;
|
||||
|
||||
/** Sharding Parameters */
|
||||
private String shardParams;
|
||||
|
||||
/**
|
||||
* @return the baseUrl
|
||||
@@ -233,4 +236,21 @@ public class RestInstanceModel
|
||||
{
|
||||
this.transactionsRemaining = transactionsRemaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the shardParams
|
||||
*/
|
||||
public String getShardParams()
|
||||
{
|
||||
return this.shardParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param shardParams the shardParams to set
|
||||
*/
|
||||
public void setShardParams(String shardParams)
|
||||
{
|
||||
this.shardParams = shardParams;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.alfresco.rest.search;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
@@ -12,6 +13,16 @@ import java.util.List;
|
||||
* Generated from 'Alfresco Content Services REST API' swagger file
|
||||
* Base Path {@linkplain /alfresco/api/-default-/public/search/versions/1}
|
||||
*/
|
||||
|
||||
/*
|
||||
From Jackson 2.8 this annotation is required to make sure that defaults are read from the actual field values,
|
||||
as opposing to field type defaults. For example, the default for boolean primitive is "false",
|
||||
but the default for the "min" field in this class is "true".
|
||||
This configuration does not affect the product and is only related to test framework and how it serializes the request into JSON.
|
||||
See org.alfresco.utility.model.TestModel#toJson
|
||||
Note: This change was required for org.alfresco.test.search.functional.searchServices.search.StatsSearchTest
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
|
||||
public class RestRequestStatsModel extends TestModel implements IRestModel<RestRequestStatsModel>
|
||||
{
|
||||
@Override
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.rest.search;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.rest.core.IRestModel;
|
||||
import org.alfresco.rest.core.assertion.ModelAssertion;
|
||||
@@ -40,7 +41,10 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
|
||||
private boolean isFile;
|
||||
|
||||
@JsonProperty
|
||||
private boolean isLocked;
|
||||
private Boolean isLocked;
|
||||
|
||||
@JsonProperty
|
||||
private Map<String, Object> association;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String modifiedAt;
|
||||
@@ -56,7 +60,7 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
|
||||
|
||||
private String parentId;
|
||||
|
||||
private boolean isLink;
|
||||
private Boolean isLink;
|
||||
|
||||
private RestContentModel content;
|
||||
|
||||
@@ -73,6 +77,16 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
|
||||
|
||||
private String location;
|
||||
|
||||
public Map<String, Object> getAssociation()
|
||||
{
|
||||
return association;
|
||||
}
|
||||
|
||||
public void setAssociation(Map<String, Object> association)
|
||||
{
|
||||
this.association = association;
|
||||
}
|
||||
|
||||
public SearchScoreModel getSearch()
|
||||
{
|
||||
return search;
|
||||
@@ -161,12 +175,12 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
|
||||
this.isFile = isFile;
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
public Boolean isLocked()
|
||||
{
|
||||
return isLocked;
|
||||
}
|
||||
|
||||
public void setLocked(boolean isLocked)
|
||||
public void setLocked(Boolean isLocked)
|
||||
{
|
||||
this.isLocked = isLocked;
|
||||
}
|
||||
@@ -221,12 +235,12 @@ public class SearchNodeModel extends TestModel implements IRestModel<SearchNodeM
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public boolean isLink()
|
||||
public Boolean isLink()
|
||||
{
|
||||
return isLink;
|
||||
}
|
||||
|
||||
public void setLink(boolean isLink)
|
||||
public void setIsLink(Boolean isLink)
|
||||
{
|
||||
this.isLink = isLink;
|
||||
}
|
||||
|
@@ -34,16 +34,16 @@ public class SearchScoreModel extends TestModel implements IRestModel<SearchScor
|
||||
{
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private int score;
|
||||
private float score;
|
||||
|
||||
private List<ResponseHighLightModel> highlight;
|
||||
|
||||
public int getScore()
|
||||
public float getScore()
|
||||
{
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(int score)
|
||||
public void setScore(float score)
|
||||
{
|
||||
this.score = score;
|
||||
}
|
||||
|
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="REST API" parallel="false" preserve-order="true" thread-count="1">
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.report.HtmlReportListener"></listener>
|
||||
<listener class-name="org.alfresco.utility.testrail.TestRailExecutorListener"></listener>
|
||||
<listener class-name="org.alfresco.utility.testng.OSTestMethodSelector"></listener>
|
||||
</listeners>
|
||||
<test name="RestAPI">
|
||||
<method-selectors>
|
||||
<!-- -DincludeGroups=sanity,comments,people -DexcludeGroups=networks,othergroup -DrunBugs=true-->
|
||||
<method-selector>
|
||||
<script language="beanshell"><![CDATA[
|
||||
includedGroups = System.getProperty("includeGroups");
|
||||
excludedGroups = System.getProperty("excludeGroups");
|
||||
runBugs = System.getProperty("runBugs");
|
||||
|
||||
if((runBugs != null))
|
||||
{
|
||||
bugAnnotated = method.getAnnotation(org.alfresco.utility.report.Bug.class);
|
||||
|
||||
if (bugAnnotated != null && runBugs.equals("false") )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((includedGroups == null) || (includedGroups.isEmpty())) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
StringTokenizer includedGroupsList = new StringTokenizer(includedGroups, ",");
|
||||
|
||||
if ((excludedGroups != null)) {
|
||||
StringTokenizer excludedGroupsList = new StringTokenizer(excludedGroups, ",");
|
||||
while (excludedGroupsList.hasMoreTokens()) {
|
||||
exG = excludedGroupsList.nextToken();
|
||||
if (groups.containsKey(exG))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (includedGroupsList.hasMoreTokens()) {
|
||||
grp = includedGroupsList.nextToken();
|
||||
if ((groups.containsKey(grp)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</script>
|
||||
</method-selector>
|
||||
</method-selectors>
|
||||
<packages>
|
||||
<package name="org.alfresco.rest.*" />
|
||||
</packages>
|
||||
|
||||
</test> <!-- Test -->
|
||||
</suite> <!-- Suite -->
|
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="REST API">
|
||||
<listeners>
|
||||
<listener class-name="org.alfresco.utility.report.TestCountListener"></listener>
|
||||
</listeners>
|
||||
<test name="RestAPITests">
|
||||
<groups>
|
||||
<run>
|
||||
<exclude name="demo" />
|
||||
<exclude name="unit" />
|
||||
</run>
|
||||
</groups>
|
||||
<packages>
|
||||
<package name="org.alfresco.rest.*"></package>
|
||||
</packages>
|
||||
</test> <!-- Test -->
|
||||
</suite> <!-- Suite -->
|
@@ -1 +0,0 @@
|
||||
∮ E⋅da = Q
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user