split API/client
This commit is contained in:
parent
06c8bf5f2f
commit
a14564c87f
104
pom.xml
104
pom.xml
@ -4,8 +4,8 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.inteligr8.alfresco</groupId>
|
||||
<artifactId>aps-public-rest-api</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<name>Alfresco Process Services ReST API Client for Java</name>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<name>Alfresco Process Services ReST API for Java</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||
@ -15,74 +15,34 @@
|
||||
|
||||
<!-- If you want to build for your specific version, point to your own
|
||||
installation -->
|
||||
<aps.baseUrl>http://localhost:8080</aps.baseUrl>
|
||||
<aps.app.tag>aps1</aps.app.tag>
|
||||
|
||||
<junit.version>5.7.2</junit.version>
|
||||
<spring.version>5.2.14.RELEASE</spring.version>
|
||||
<jersey.version>2.34</jersey.version>
|
||||
<cxf.version>3.3.2</cxf.version>
|
||||
<jersey.version>2.35</jersey.version>
|
||||
<cxf.version>3.4.7</cxf.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.inteligr8</groupId>
|
||||
<artifactId>common-rest-api</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<groupId>jakarta.ws.rs</groupId>
|
||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext</groupId>
|
||||
<artifactId>jersey-proxy-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.9</version>
|
||||
<scope>test</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -94,30 +54,9 @@
|
||||
<classifier>${aps.app.tag}</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>javadoc</id>
|
||||
@ -264,6 +203,21 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>inteligr8-releases</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>inteligr8-snapshots</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
|
||||
<releases><enabled>false</enabled></releases>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>mulesoft-releases</id>
|
||||
|
@ -1,165 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.inteligr8.rs.ClientCxfConfiguration;
|
||||
import com.inteligr8.rs.ClientJerseyConfiguration;
|
||||
|
||||
/**
|
||||
* This class provides a POJO & Spring-based implementation of the
|
||||
* ClientConfiguration interface. You can use it outside of the Spring
|
||||
* context, but you will need the spring-context and spring-beans libraries in
|
||||
* your non-Spring application.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
public class ApsClientConfiguration implements ClientCxfConfiguration, ClientJerseyConfiguration {
|
||||
|
||||
@Value("${process.service.baseUrl:http://localhost:8080/activiti-app}")
|
||||
private String baseUrl;
|
||||
|
||||
@Value("${process.service.security.basicAuth.username:admin@app.activiti.com}")
|
||||
private String basicAuthUsername;
|
||||
|
||||
@Value("${process.service.security.basicAuth.password:admin}")
|
||||
private String basicAuthPassword;
|
||||
|
||||
@Value("${process.service.security.bearerToken:#{null}}")
|
||||
private String bearerToken;
|
||||
|
||||
@Value("${process.service.security.oauth.tokenUrl:#{null}}")
|
||||
private String oAuthTokenUrl;
|
||||
|
||||
@Value("${process.service.security.oauth.clientId:#{null}}")
|
||||
private String oAuthClientId;
|
||||
|
||||
@Value("${process.service.security.oauth.clientSecret:#{null}}")
|
||||
private String oAuthClientSecret;
|
||||
|
||||
@Value("${process.service.security.oauth.authCode:#{null}}")
|
||||
private String oAuthAuthCode;
|
||||
|
||||
@Value("${process.service.security.oauth.authRedirectUri:#{null}}")
|
||||
private String oAuthAuthRedirectUri;
|
||||
|
||||
@Value("${process.service.security.oauth.grantUsername:#{null}}")
|
||||
private String oAuthUsername;
|
||||
|
||||
@Value("${process.service.security.oauth.grantPassword:#{null}}")
|
||||
private String oAuthPassword;
|
||||
|
||||
@Value("${process.service.cxf.defaultBusEnabled:true}")
|
||||
private boolean defaultBusEnabled;
|
||||
|
||||
@Value("${process.service.jersey.putBodyRequired:true}")
|
||||
private boolean putBodyRequired;
|
||||
|
||||
public String getBaseUrl() {
|
||||
return this.baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public String getBasicAuthUsername() {
|
||||
return this.basicAuthUsername;
|
||||
}
|
||||
|
||||
public void setBasicAuthUsername(String basicAuthUsername) {
|
||||
this.basicAuthUsername = basicAuthUsername;
|
||||
}
|
||||
|
||||
public String getBasicAuthPassword() {
|
||||
return this.basicAuthPassword;
|
||||
}
|
||||
|
||||
public void setBasicAuthPassword(String basicAuthPassword) {
|
||||
this.basicAuthPassword = basicAuthPassword;
|
||||
}
|
||||
|
||||
public String getBearerToken() {
|
||||
return this.bearerToken;
|
||||
}
|
||||
|
||||
public void setBearerToken(String bearerToken) {
|
||||
this.bearerToken = bearerToken;
|
||||
}
|
||||
|
||||
public String getOAuthTokenUrl() {
|
||||
return this.oAuthTokenUrl;
|
||||
}
|
||||
|
||||
public void setOAuthTokenUrl(String oAuthTokenUrl) {
|
||||
this.oAuthTokenUrl = oAuthTokenUrl;
|
||||
}
|
||||
|
||||
public String getOAuthClientId() {
|
||||
return this.oAuthClientId;
|
||||
}
|
||||
|
||||
public void setOAuthClientId(String oAuthClientId) {
|
||||
this.oAuthClientId = oAuthClientId;
|
||||
}
|
||||
|
||||
public String getOAuthClientSecret() {
|
||||
return this.oAuthClientSecret;
|
||||
}
|
||||
|
||||
public void setOAuthClientSecret(String oAuthClientSecret) {
|
||||
this.oAuthClientSecret = oAuthClientSecret;
|
||||
}
|
||||
|
||||
public String getOAuthAuthCode() {
|
||||
return this.oAuthAuthCode;
|
||||
}
|
||||
|
||||
public void setOAuthAuthCode(String oAuthAuthCode) {
|
||||
this.oAuthAuthCode = oAuthAuthCode;
|
||||
}
|
||||
|
||||
public String getOAuthAuthRedirectUri() {
|
||||
return this.oAuthAuthRedirectUri;
|
||||
}
|
||||
|
||||
public void setOAuthAuthRedirectUri(String oAuthAuthRedirectUri) {
|
||||
this.oAuthAuthRedirectUri = oAuthAuthRedirectUri;
|
||||
}
|
||||
|
||||
public String getOAuthUsername() {
|
||||
return this.oAuthUsername;
|
||||
}
|
||||
|
||||
public void setOAuthUsername(String oAuthUsername) {
|
||||
this.oAuthUsername = oAuthUsername;
|
||||
}
|
||||
|
||||
public String getOAuthPassword() {
|
||||
return this.oAuthPassword;
|
||||
}
|
||||
|
||||
public void setOAuthPassword(String oAuthPassword) {
|
||||
this.oAuthPassword = oAuthPassword;
|
||||
}
|
||||
|
||||
public boolean isDefaultBusEnabled() {
|
||||
return this.defaultBusEnabled;
|
||||
}
|
||||
|
||||
public void setDefaultBusEnabled(boolean defaultBusEnabled) {
|
||||
this.defaultBusEnabled = defaultBusEnabled;
|
||||
}
|
||||
|
||||
public boolean isPutBodyRequired() {
|
||||
return this.putBodyRequired;
|
||||
}
|
||||
|
||||
public void setPutBodyRequired(boolean putBodyRequired) {
|
||||
this.putBodyRequired = putBodyRequired;
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.inteligr8.rs.ClientCxfConfiguration;
|
||||
import com.inteligr8.rs.ClientCxfImpl;
|
||||
|
||||
/**
|
||||
* This class provides a POJO & Spring-based implementation of the Apache
|
||||
* CXF client. You can use it outside of the Spring context, but you will need
|
||||
* the spring-context and spring-beans libraries in your non-Spring
|
||||
* application.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@Component("aps.client.cxf")
|
||||
@Lazy
|
||||
public class ApsClientCxfImpl extends ClientCxfImpl {
|
||||
|
||||
@Autowired
|
||||
private ApsClientConfiguration config;
|
||||
|
||||
/**
|
||||
* This constructor is for Spring use
|
||||
*/
|
||||
protected ApsClientCxfImpl() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is for POJO use
|
||||
*/
|
||||
public ApsClientCxfImpl(ApsClientConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientCxfConfiguration getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.inteligr8.rs.ClientJerseyConfiguration;
|
||||
import com.inteligr8.rs.ClientJerseyImpl;
|
||||
|
||||
/**
|
||||
* This class provides a POJO & Spring-based implementation of the Apache
|
||||
* CXF client. You can use it outside of the Spring context, but you will need
|
||||
* the spring-context and spring-beans libraries in your non-Spring
|
||||
* application.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@Component("aps.client.jersey")
|
||||
@Lazy
|
||||
public class ApsClientJerseyImpl extends ClientJerseyImpl {
|
||||
|
||||
@Autowired
|
||||
private ApsClientConfiguration config;
|
||||
|
||||
/**
|
||||
* This constructor is for Spring use
|
||||
*/
|
||||
protected ApsClientJerseyImpl() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is for POJO use
|
||||
*/
|
||||
public ApsClientJerseyImpl(ApsClientConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientJerseyConfiguration getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
}
|
@ -7,84 +7,27 @@ import com.inteligr8.alfresco.activiti.api.ModelsApi;
|
||||
import com.inteligr8.alfresco.activiti.api.ProcessInstancesApi;
|
||||
import com.inteligr8.alfresco.activiti.api.ProfileApi;
|
||||
import com.inteligr8.alfresco.activiti.api.TasksApi;
|
||||
import com.inteligr8.rs.AuthorizationFilter;
|
||||
import com.inteligr8.rs.Client;
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
/**
|
||||
* This class serves as the base implementation for the JAX-RS API for the APS
|
||||
* Public ReST API.
|
||||
* This interface consolidates the JAX-RS APIs available in the APS Public
|
||||
* ReST API.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
public abstract class ApsPublicRestApi {
|
||||
public interface ApsPublicRestApi {
|
||||
|
||||
abstract ClientConfiguration getConfig();
|
||||
AdminApi getAdminApi();
|
||||
|
||||
abstract Client getClient();
|
||||
AppDefinitionsApi getAppDefinitionsApi();
|
||||
|
||||
protected final <T> T getApi(Class<T> apiClass) {
|
||||
return this.getApi(null, apiClass);
|
||||
}
|
||||
|
||||
protected <T> T getApi(AuthorizationFilter authFilter, Class<T> apiClass) {
|
||||
return this.getClient().getApi(authFilter, apiClass);
|
||||
}
|
||||
AppVersionApi getAppVersionApi();
|
||||
|
||||
public AdminApi getAdminApi() {
|
||||
return this.getApi(AdminApi.class);
|
||||
}
|
||||
ModelsApi getModelsApi();
|
||||
|
||||
public AdminApi getAdminApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, AdminApi.class);
|
||||
}
|
||||
ProcessInstancesApi getProcessInstancesApi();
|
||||
|
||||
public AppDefinitionsApi getAppDefinitionsApi() {
|
||||
return this.getApi(AppDefinitionsApi.class);
|
||||
}
|
||||
ProfileApi getProfileApi();
|
||||
|
||||
public AppDefinitionsApi getAppDefinitionsApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, AppDefinitionsApi.class);
|
||||
}
|
||||
|
||||
public AppVersionApi getAppVersionApi() {
|
||||
return this.getApi(AppVersionApi.class);
|
||||
}
|
||||
|
||||
public AppVersionApi getAppVersionApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, AppVersionApi.class);
|
||||
}
|
||||
|
||||
public ModelsApi getModelsApi() {
|
||||
return this.getApi(ModelsApi.class);
|
||||
}
|
||||
|
||||
public ModelsApi getModelsApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, ModelsApi.class);
|
||||
}
|
||||
|
||||
public ProcessInstancesApi getProcessInstancesApi() {
|
||||
return this.getApi(ProcessInstancesApi.class);
|
||||
}
|
||||
|
||||
public ProcessInstancesApi getProcessInstancesApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, ProcessInstancesApi.class);
|
||||
}
|
||||
|
||||
public ProfileApi getProfileApi() {
|
||||
return this.getApi(ProfileApi.class);
|
||||
}
|
||||
|
||||
public ProfileApi getProfileApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, ProfileApi.class);
|
||||
}
|
||||
|
||||
public TasksApi getTasksApi() {
|
||||
return this.getApi(TasksApi.class);
|
||||
}
|
||||
|
||||
public TasksApi getTasksApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, TasksApi.class);
|
||||
}
|
||||
TasksApi getTasksApi();
|
||||
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.api.AppDefinitionsCxfApi;
|
||||
import com.inteligr8.rs.AuthorizationFilter;
|
||||
import com.inteligr8.rs.Client;
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
/**
|
||||
* This class provides the Apache CXF client to the JAX-RS API for the APS
|
||||
* Public ReST API.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@Component("aps.api.cxf")
|
||||
@Lazy
|
||||
public class ApsPublicRestApiCxfImpl extends ApsPublicRestApi {
|
||||
|
||||
@Autowired
|
||||
private ApsClientCxfImpl client;
|
||||
|
||||
/**
|
||||
* This constructor is for Spring use
|
||||
*/
|
||||
protected ApsPublicRestApiCxfImpl() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is for POJO use
|
||||
*/
|
||||
public ApsPublicRestApiCxfImpl(ApsClientCxfImpl client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
ClientConfiguration getConfig() {
|
||||
return this.client.getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public AppDefinitionsCxfApi getAppDefinitionsCxfApi() {
|
||||
return this.getApi(AppDefinitionsCxfApi.class);
|
||||
}
|
||||
|
||||
public AppDefinitionsCxfApi getAppDefinitionsCxfApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, AppDefinitionsCxfApi.class);
|
||||
}
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.api.AppDefinitionsJerseyApi;
|
||||
import com.inteligr8.rs.AuthorizationFilter;
|
||||
import com.inteligr8.rs.Client;
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
/**
|
||||
* This class provides the Jersey client to the JAX-RS API for the APS Public
|
||||
* ReST API.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@Component("aps.api.jersey")
|
||||
@Lazy
|
||||
public class ApsPublicRestApiJerseyImpl extends ApsPublicRestApi {
|
||||
|
||||
@Autowired
|
||||
private ApsClientJerseyImpl client;
|
||||
|
||||
/**
|
||||
* This constructor is for Spring use
|
||||
*/
|
||||
protected ApsPublicRestApiJerseyImpl() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is for POJO use
|
||||
*/
|
||||
public ApsPublicRestApiJerseyImpl(ApsClientJerseyImpl client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
ClientConfiguration getConfig() {
|
||||
return this.client.getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public AppDefinitionsJerseyApi getAppDefinitionsJerseyApi() {
|
||||
return this.getApi(AppDefinitionsJerseyApi.class);
|
||||
}
|
||||
|
||||
public AppDefinitionsJerseyApi getAppDefinitionsJerseyApi(AuthorizationFilter authFilter) {
|
||||
return this.getApi(authFilter, AppDefinitionsJerseyApi.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.api.AppDefinitionsCxfApi;
|
||||
|
||||
/**
|
||||
* This interface appends Apache CXF implementation specific methods to the
|
||||
* JAX-RS API of the APS Public ReST API. This is due to a lack of multi-part
|
||||
* in the JAX-RS specification.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
public interface ApsPublicRestCxfApi extends ApsPublicRestApi {
|
||||
|
||||
AppDefinitionsCxfApi getAppDefinitionsCxfApi();
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.api.AppDefinitionsJerseyApi;
|
||||
|
||||
/**
|
||||
* This interface appends Jersey implementation specific methods to the JAX-RS
|
||||
* API of the APS Public ReST API. This is due to a lack of multi-part in the
|
||||
* JAX-RS specification.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
public interface ApsPublicRestJerseyApi extends ApsPublicRestApi {
|
||||
|
||||
AppDefinitionsJerseyApi getAppDefinitionsJerseyApi();
|
||||
|
||||
}
|
@ -3,28 +3,81 @@ package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.Group;
|
||||
import com.inteligr8.alfresco.activiti.model.GroupLight;
|
||||
import com.inteligr8.alfresco.activiti.model.ResultList;
|
||||
import com.inteligr8.alfresco.activiti.model.Tenant;
|
||||
import com.inteligr8.alfresco.activiti.model.UserLight;
|
||||
|
||||
@Path("/api/enterprise/admin")
|
||||
public interface AdminApi {
|
||||
|
||||
@GET
|
||||
@Path("/tenants")
|
||||
@Produces({ "application/json" })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public List<Tenant> getTenants();
|
||||
|
||||
@GET
|
||||
@Path("/groups")
|
||||
@Produces({ "application/json" })
|
||||
public List<Group> getGroups(
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public List<GroupLight> getGroups(
|
||||
@QueryParam("tenantId") Long tenantId,
|
||||
@QueryParam("functional") Boolean functional,
|
||||
@QueryParam("summary") Boolean summary);
|
||||
|
||||
@POST
|
||||
@Path("/groups")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public GroupLight createGroup(
|
||||
Group group);
|
||||
|
||||
@GET
|
||||
@Path("/groups/{groupId}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public Group getGroup(
|
||||
@PathParam("groupId") long groupId,
|
||||
@QueryParam("includeAllUsers") Boolean includeAllUsers,
|
||||
@QueryParam("summary") Boolean summary);
|
||||
|
||||
@GET
|
||||
@Path("/groups/${groupId}/related-groups")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public List<GroupLight> getRelatedGroups(
|
||||
@PathParam("groupId") long groupId);
|
||||
|
||||
@POST
|
||||
@Path("/groups/${groupId}/related-groups/${relatedGroupId}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public void addRelatedGroup(
|
||||
@PathParam("groupId") long groupId,
|
||||
@PathParam("relatedGroupId") long relatedGroupId,
|
||||
@PathParam("type") String type);
|
||||
|
||||
@DELETE
|
||||
@Path("/groups/${groupId}/related-groups/${relatedGroupId}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public void deleteRelatedGroup(
|
||||
@PathParam("groupId") long groupId,
|
||||
@PathParam("relatedGroupId") long relatedGroupId);
|
||||
|
||||
@GET
|
||||
@Path("groups/{groupId}/users")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
ResultList<UserLight> getMembers(
|
||||
@PathParam("groupId") long groupId,
|
||||
@QueryParam("filter") String filter,
|
||||
@QueryParam("page") Integer page,
|
||||
@QueryParam("pageSize") Integer pageSize);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.GroupLight;
|
||||
import com.inteligr8.alfresco.activiti.model.ResultList;
|
||||
import com.inteligr8.alfresco.activiti.model.UserLight;
|
||||
|
||||
@Path("/api/enterprise/groups")
|
||||
public interface GroupsApi {
|
||||
|
||||
@GET
|
||||
@Produces({ "application/json" })
|
||||
ResultList<GroupLight> query(
|
||||
@QueryParam("filter") String filter,
|
||||
@QueryParam("groupId") Long groupId,
|
||||
@QueryParam("externalId") String externalId,
|
||||
@QueryParam("externalIdCaseInsensitive") String externalIdCaseInsensitve,
|
||||
@QueryParam("tenantId") Long tenantId);
|
||||
|
||||
@GET
|
||||
@Path("{groupId}/users")
|
||||
@Produces({ "application/json" })
|
||||
ResultList<UserLight> queryMembers(
|
||||
@PathParam("groupId") long groupId);
|
||||
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -31,7 +30,7 @@ public class Group {
|
||||
@JsonProperty("externalId")
|
||||
private String externalId;
|
||||
@JsonProperty("groups")
|
||||
private List<Group> groups = new ArrayList<Group>();
|
||||
private List<GroupLight> groups = new ArrayList<GroupLight>();
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
@JsonProperty("lastSyncTimeStamp")
|
||||
@ -85,15 +84,15 @@ public class Group {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Group> getGroups() {
|
||||
public List<GroupLight> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void setGroups(List<Group> groups) {
|
||||
public void setGroups(List<GroupLight> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
public Group withGroups(List<Group> groups) {
|
||||
public Group withGroups(List<GroupLight> groups) {
|
||||
this.groups = groups;
|
||||
return this;
|
||||
}
|
||||
@ -229,3 +228,7 @@ public class Group {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,94 @@
|
||||
package com.inteligr8.alfresco.activiti.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GroupLight {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
@JsonProperty("externalId")
|
||||
private String externalId;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("parentGroupId")
|
||||
private Long parentGroupId;
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* No args constructor for use in serialization
|
||||
*/
|
||||
public GroupLight() {
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public GroupLight withId(Long id) {
|
||||
this.setId(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
public void setExternalId(String externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
public GroupLight withExternalId(String externalId) {
|
||||
this.setExternalId(externalId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public GroupLight withName(String name) {
|
||||
this.setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getParentGroupId() {
|
||||
return parentGroupId;
|
||||
}
|
||||
|
||||
public void setParentGroupId(Long parentGroupId) {
|
||||
this.parentGroupId = parentGroupId;
|
||||
}
|
||||
|
||||
public GroupLight withParentGroupId(Long parentGroupId) {
|
||||
this.setParentGroupId(parentGroupId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public GroupLight withStatus(String status) {
|
||||
this.setStatus(status);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ResultList<T> {
|
||||
|
||||
@JsonProperty("size")
|
||||
private Integer size;
|
||||
@JsonProperty("total")
|
||||
private Integer total;
|
||||
@JsonProperty("start")
|
||||
private Integer start;
|
||||
@JsonProperty("data")
|
||||
private List<T> data = new LinkedList<T>();
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(Integer start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public List<T> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<T> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIf;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.Tenant;
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsPublicRestApiJerseyImpl.class, ApsClientJerseyImpl.class})
|
||||
public class ArrayResponseUnitTest extends ConditionalIT {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("aps.api.jersey")
|
||||
private ApsPublicRestApi client;
|
||||
|
||||
@Override
|
||||
public ClientConfiguration getConfiguration() {
|
||||
return this.client.getConfig();
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testTenants() {
|
||||
List<Tenant> objs = this.client.getAdminApi().getTenants();
|
||||
|
||||
Assertions.assertNotNull(objs);
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.client.methods.RequestBuilder;
|
||||
import org.apache.http.impl.client.DefaultRedirectStrategy;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
public abstract class ConditionalIT {
|
||||
|
||||
public abstract ClientConfiguration getConfiguration();
|
||||
|
||||
public boolean hostExists() {
|
||||
String uri = this.getConfiguration().getBaseUrl();
|
||||
|
||||
HttpUriRequest request = RequestBuilder.get()
|
||||
.setUri(uri)
|
||||
.build();
|
||||
|
||||
HttpClient client = HttpClientBuilder.create()
|
||||
.setRedirectStrategy(DefaultRedirectStrategy.INSTANCE)
|
||||
.build();
|
||||
|
||||
try {
|
||||
HttpResponse response = client.execute(request);
|
||||
return response.getStatusLine().getStatusCode() < 300;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIf;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.AppVersion;
|
||||
import com.inteligr8.alfresco.activiti.model.CreateProcessInstance;
|
||||
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
|
||||
import com.inteligr8.alfresco.activiti.model.User;
|
||||
import com.inteligr8.alfresco.activiti.model.Variable;
|
||||
|
||||
public abstract class ConnectionClientIT extends ConditionalIT {
|
||||
|
||||
public abstract ApsPublicRestApi getClient();
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testAppVersion() {
|
||||
AppVersion obj = this.getClient().getAppVersionApi().get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("1", obj.getMajorVersion());
|
||||
Assertions.assertEquals("bpmSuite", obj.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testProfile() {
|
||||
User obj = this.getClient().getProfileApi().get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("admin@app.activiti.com", obj.getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testStartProcess() {
|
||||
CreateProcessInstance request = new CreateProcessInstance();
|
||||
request.setProcessDefinitionKey("qcDocument");
|
||||
request.setVariables(Arrays.asList(new Variable("acsNodeId", null, null, UUID.randomUUID().toString())));
|
||||
|
||||
ProcessInstance response = this.getClient().getProcessInstancesApi().create(request);
|
||||
|
||||
Assertions.assertNotNull(response);
|
||||
Assertions.assertNotNull(response.getId());
|
||||
Assertions.assertNotNull(response.getId().length() > 0);
|
||||
Assertions.assertEquals("qcDocument", response.getProcessDefinitionKey());
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
public class ConnectionCxfClientPojoIT extends ConnectionClientIT {
|
||||
|
||||
private static ApsPublicRestApi client;
|
||||
|
||||
@BeforeAll
|
||||
public static void initClient() {
|
||||
ApsClientConfiguration config = new ApsClientConfiguration();
|
||||
config.setBaseUrl("http://localhost:8080/activiti-app");
|
||||
config.setBasicAuthUsername("admin");
|
||||
config.setBasicAuthPassword("admin");
|
||||
|
||||
client = new ApsPublicRestApiCxfImpl(
|
||||
new ApsClientCxfImpl(config));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApsPublicRestApi getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientConfiguration getConfiguration() {
|
||||
return client.getConfig();
|
||||
}
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
@TestPropertySource(locations = {"/local-oauth.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsPublicRestApiCxfImpl.class, ApsClientCxfImpl.class})
|
||||
public class ConnectionCxfClientSpringIT extends ConnectionClientIT {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("aps.api.cxf")
|
||||
private ApsPublicRestApi client;
|
||||
|
||||
@Override
|
||||
public ApsPublicRestApi getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientConfiguration getConfiguration() {
|
||||
return this.client.getConfig();
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
public class ConnectionJerseyClientPojoIT extends ConnectionClientIT {
|
||||
|
||||
private static ApsPublicRestApi client;
|
||||
|
||||
@BeforeAll
|
||||
public static void initClient() {
|
||||
ApsClientConfiguration config = new ApsClientConfiguration();
|
||||
config.setBaseUrl("http://localhost:8080/activiti-app");
|
||||
config.setBasicAuthUsername("admin");
|
||||
config.setBasicAuthPassword("admin");
|
||||
|
||||
client = new ApsPublicRestApiJerseyImpl(
|
||||
new ApsClientJerseyImpl(config));
|
||||
}
|
||||
|
||||
public ApsPublicRestApi getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientConfiguration getConfiguration() {
|
||||
return client.getConfig();
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.inteligr8.rs.ClientConfiguration;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsPublicRestApiCxfImpl.class, ApsClientJerseyImpl.class})
|
||||
public class ConnectionJerseyClientSpringIT extends ConnectionClientIT {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("aps.api.jersey")
|
||||
private ApsPublicRestApi client;
|
||||
|
||||
public ApsPublicRestApi getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientConfiguration getConfiguration() {
|
||||
return this.client.getConfig();
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
process.service.baseUrl=http://localhost:8080/activiti-app
|
||||
process.service.security.oauth.tokenUrl=http://auth.example.org:8080/auth/realms/alfresco/protocol/openid-connect/token
|
||||
process.service.security.oauth.clientId=api
|
||||
process.service.security.oauth.grantUsername=admin
|
||||
process.service.security.oauth.grantPassword=admin
|
@ -1,3 +0,0 @@
|
||||
process.service.baseUrl=http://localhost:8080/activiti-app
|
||||
process.service.security.basicAuth.username=admin@app.activiti.com
|
||||
process.service.security.basicAuth.password=admin
|
Loading…
x
Reference in New Issue
Block a user