Commit 482d9446 authored by Brian Long's avatar Brian Long
Browse files

initial checkin

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+14 −0
Original line number Diff line number Diff line
# Maven
pom.xml.versionsBackup
target

# Eclipse
.project
.classpath
.settings

# Visual Studio Code
.factorypath

# Swagger Codegen
.swagger-Codegen

pom.xml

0 → 100644
+398 −0
Original line number Diff line number Diff line
<project xmlns="http://maven.apache.org/POM/4.0.0"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.inteligr8.alfresco</groupId>
	<artifactId>acs-public-rest-api</artifactId>
	<version>2.0.0-v1</version>
	<name>Alfresco Content Services ReST API Client for Java</name>

	<properties>
		<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
		<maven.compiler.release>11</maven.compiler.release>
		<maven.compiler.source>8</maven.compiler.source>

		<!-- If you want to build for your specific version, point to your own 
			installation -->
		<acs.baseUrl>https://api-explorer.alfresco.com/api-explorer</acs.baseUrl>
		<swagger.basePackage>com.inteligr8.alfresco.acs</swagger.basePackage>

		<junit.version>5.7.2</junit.version>
		<spring.version>5.2.14.RELEASE</spring.version>
		<jersey.version>2.34</jersey.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>io.swagger</groupId>
			<artifactId>swagger-jaxrs</artifactId>
			<version>1.6.2</version>
			<exclusions>
				<exclusion>
					<groupId>javax.ws.rs</groupId>
					<artifactId>jsr311-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.3.1</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.12.2</version>
		</dependency>
		<dependency>
			<groupId>jakarta.ws.rs</groupId>
			<artifactId>jakarta.ws.rs-api</artifactId>
			<version>2.1.6</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.core</groupId>
			<artifactId>jersey-client</artifactId>
			<version>${jersey.version}</version>
			<scope>test</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.glassfish.jersey.ext</groupId>
			<artifactId>jersey-proxy-client</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>
	</dependencies>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>3.2.0</version>
				<executions>
					<execution>
						<id>add-gensrc</id>
						<phase>initialize</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/gen/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</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>
				<groupId>io.repaint.maven</groupId>
				<artifactId>tiles-maven-plugin</artifactId>
				<version>2.21</version>
				<extensions>true</extensions>
				<configuration>
					<filtering>true</filtering>
					<tiles>
						<tile>com.inteligr8:maven-public-deploy-tile:[1.0.0,2.0.0)</tile>
					</tiles>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<!-- Implement when descriptor is available -->
		<profile>
			<id>swagger-codegen</id>
			<properties>
				<acs.defs.baseUrl>${acs.baseUrl}/definitions</acs.defs.baseUrl>
			</properties>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-clean-plugin</artifactId>
						<version>3.1.0</version>
						<configuration>
							<filesets>
								<fileset>
									<directory>src/gen/java</directory>
									<includes>
										<include>com/inteligr8/alfresco/acs/**/*</include>
									</includes>
								</fileset>
							</filesets>
						</configuration>
					</plugin>
					<plugin>
						<groupId>com.googlecode.maven-download-plugin</groupId>
						<artifactId>download-maven-plugin</artifactId>
						<version>1.6.3</version>
						<executions>
							<execution>
								<id>download-acs-core-defs</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>wget</goal>
								</goals>
								<configuration>
									<url>${acs.defs.baseUrl}/alfresco-core.yaml</url>
									<outputDirectory>${project.build.directory}/downloads</outputDirectory>
								</configuration>
							</execution>
							<execution>
								<id>download-acs-search-defs</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>wget</goal>
								</goals>
								<configuration>
									<url>${acs.defs.baseUrl}/alfresco-search.yaml</url>
									<outputDirectory>${project.build.directory}/downloads</outputDirectory>
								</configuration>
							</execution>
							<execution>
								<id>download-acs-auth-defs</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>wget</goal>
								</goals>
								<configuration>
									<url>${acs.defs.baseUrl}/alfresco-auth.yaml</url>
									<outputDirectory>${project.build.directory}/downloads</outputDirectory>
								</configuration>
							</execution>
							<execution>
								<id>download-acs-discovery-defs</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>wget</goal>
								</goals>
								<configuration>
									<url>${acs.defs.baseUrl}/alfresco-discovery.yaml</url>
									<outputDirectory>${project.build.directory}/downloads</outputDirectory>
								</configuration>
							</execution>
							<execution>
								<id>download-acs-model-defs</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>wget</goal>
								</goals>
								<configuration>
									<url>${acs.defs.baseUrl}/alfresco-model.yaml</url>
									<outputDirectory>${project.build.directory}/downloads</outputDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>io.swagger</groupId>
						<artifactId>swagger-codegen-maven-plugin</artifactId>
						<version>2.4.20</version>
						<configuration>
							<language>jaxrs-cxf-client</language>
							<output>${basedir}</output>
							<apiPackage>${swagger.basePackage}.api</apiPackage>
							<modelPackage>${swagger.basePackage}.model</modelPackage>
							<invokerPackage>${swagger.basePackage}.invoker</invokerPackage>
							<generateApiTests>false</generateApiTests>
							<generateApiDocumentation>false</generateApiDocumentation>
							<generateModelTests>false</generateModelTests>
							<generateModelDocumentation>false</generateModelDocumentation>
						</configuration>
						<executions>
							<execution>
								<id>swagger-core-codegen</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>generate</goal>
								</goals>
								<configuration>
									<inputSpec>${project.build.directory}/downloads/alfresco-core.yaml</inputSpec>
								</configuration>
							</execution>
							<execution>
								<id>swagger-search-codegen</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>generate</goal>
								</goals>
								<configuration>
									<inputSpec>${project.build.directory}/downloads/alfresco-search.yaml</inputSpec>
								</configuration>
							</execution>
							<execution>
								<id>swagger-auth-codegen</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>generate</goal>
								</goals>
								<configuration>
									<inputSpec>${project.build.directory}/downloads/alfresco-auth.yaml</inputSpec>
								</configuration>
							</execution>
							<execution>
								<id>swagger-discovery-codegen</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>generate</goal>
								</goals>
								<configuration>
									<inputSpec>${project.build.directory}/downloads/alfresco-discovery.yaml</inputSpec>
								</configuration>
							</execution>
							<execution>
								<id>swagger-model-codegen</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>generate</goal>
								</goals>
								<configuration>
									<inputSpec>${project.build.directory}/downloads/alfresco-model.yaml</inputSpec>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>com.inteligr8</groupId>
						<artifactId>regex-maven-plugin</artifactId>
						<version>1.0.3</version>
						<executions>
							<execution>
								<id>fix-baseUrl</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>replace-file</goal>
								</goals>
								<configuration>
									<filesets>
										<fileset>
											<directory>${basedir}/src/gen/java/com/inteligr8/alfresco/acs/api</directory>
											<outputDirectory>${basedir}/src/gen/java/com/inteligr8/alfresco/acs/api</outputDirectory>
										</fileset>
									</filesets>
									<allowMultiLineMatch>true</allowMultiLineMatch>
									<regexes>
										<regex>
											<pattern>import org\.apache\.cxf\.jaxrs\.ext\.multipart\.\*;.*</pattern>
											<replacement></replacement>
										</regex>
										<regex>
											<pattern>(\*\*Core API\*\*[^@]*)@Path\("/"\)([^@]*)@Api\(value = "/"</pattern>
											<replacement>$1@Path("/api/-default-/public/alfresco/versions/1")$2@Api(value = "/api/-default-/public/alfresco/versions/1"</replacement>
										</regex>
										<regex>
											<pattern>(\*\*Search API\*\*[^@]*)@Path\("/"\)([^@]*)@Api\(value = "/"</pattern>
											<replacement>$1@Path("/api/-default-/public/search/versions/1")$2@Api(value = "/api/-default-/public/search/versions/1"</replacement>
										</regex>
										<regex>
											<pattern>(\*\*Model API\*\*[^@]*)@Path\("/"\)([^@]*)@Api\(value = "/"</pattern>
											<replacement>$1@Path("/api/-default-/public/alfresco/versions/1")$2@Api(value = "/api/-default-/public/alfresco/versions/1"</replacement>
										</regex>
										<regex>
											<pattern>(\*\*Authentication API\*\*[^@]*)@Path\("/"\)([^@]*)@Api\(value = "/"</pattern>
											<replacement>$1@Path("/api/-default-/public/authentication/versions/1")$2@Api(value = "/api/-default-/public/authentication/versions/1"</replacement>
										</regex>
										<regex>
											<pattern>(\*\*Discovery API\*\*[^@]*)@Path\("/"\)([^@]*)@Api\(value = "/"</pattern>
											<replacement>$1@Path("/api")$2@Api(value = "/api"</replacement>
										</regex>
									</regexes>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>net.revelc.code</groupId>
						<artifactId>impsort-maven-plugin</artifactId>
						<version>1.6.2</version>
						<executions>
							<execution>
								<id>organize-imports</id>
								<phase>process-sources</phase>
								<goals><goal>sort</goal></goals>
								<configuration>
									<directories>
										<directory>${basedir}/src/gen/java</directory>
									</directories>
									<includes>
										<include>**/*.java</include>
									</includes>
									<removeUnused>true</removeUnused>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
	
	<repositories>
		<repository>
			<id>inteligr8-releases</id>
			<url>http://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
		</repository>
	</repositories>
	
	<pluginRepositories>
		<pluginRepository>
			<id>mulesoft-releases</id>
			<url>https://repository.mulesoft.org/releases</url>
		</pluginRepository>
		<pluginRepository>
			<id>inteligr8-releases</id>
			<url>http://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
		</pluginRepository>
	</pluginRepositories>
</project>
 No newline at end of file
+99 −0
Original line number Diff line number Diff line
package com.inteligr8.alfresco.acs.api;

import com.inteligr8.alfresco.acs.model.ActionBodyExec;
import com.inteligr8.alfresco.acs.model.ActionDefinitionEntry;
import com.inteligr8.alfresco.acs.model.ActionDefinitionList;
import com.inteligr8.alfresco.acs.model.ActionExecResultEntry;
import com.inteligr8.alfresco.acs.model.Error;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.List;
import javax.ws.rs.*;

/**
 * Alfresco Content Services REST API
 *
 * <p>**Core API**  Provides access to the core features of Alfresco Content Services. 
 *
 */
@Path("/api/-default-/public/alfresco/versions/1")
@Api(value = "/api/-default-/public/alfresco/versions/1", description = "")
public interface ActionsApi  {

    /**
     * Retrieve the details of an action definition
     *
     * **Note:** this endpoint is available in Alfresco 5.2 and newer versions.  Retrieve the details of the action denoted by **actionDefinitionId**. 
     *
     */
    @GET
    @Path("/action-definitions/{actionDefinitionId}")
    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @ApiOperation(value = "Retrieve the details of an action definition", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "Successful response", response = ActionDefinitionEntry.class),
        @ApiResponse(code = 401, message = "Authentication failed"),
        @ApiResponse(code = 404, message = "**actionDefinitionId** does not exist "),
        @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
    public ActionDefinitionEntry actionDetails(@PathParam("actionDefinitionId") String actionDefinitionId);

    /**
     * Execute an action
     *
     * **Note:** this endpoint is available in Alfresco 5.2 and newer versions.  Executes an action  An action may be executed against a node specified by **targetId**. For example:  &#x60;&#x60;&#x60; {   \&quot;actionDefinitionId\&quot;: \&quot;copy\&quot;,   \&quot;targetId\&quot;: \&quot;4c4b3c43-f18b-43ff-af84-751f16f1ddfd\&quot;,   \&quot;params\&quot;: {    \&quot;destination-folder\&quot;: \&quot;34219f79-66fa-4ebf-b371-118598af898c\&quot;   } } &#x60;&#x60;&#x60;  Performing a POST with the request body shown above will result in the node identified by &#x60;&#x60;&#x60;targetId&#x60;&#x60;&#x60; being copied to the destination folder specified in the &#x60;&#x60;&#x60;params&#x60;&#x60;&#x60; object by the key &#x60;&#x60;&#x60;destination-folder&#x60;&#x60;&#x60;.  **targetId** is optional, however, currently **targetId** must be a valid node ID. In the future, actions may be executed against different entity types or executed without the need for the context of an entity.   Parameters supplied to the action within the &#x60;&#x60;&#x60;params&#x60;&#x60;&#x60; object will be converted to the expected type, where possible using the DefaultTypeConverter class. In addition:  * Node IDs may be supplied in their short form (implicit workspace://SpacesStore prefix) * Aspect names may be supplied using their short form, e.g. cm:versionable or cm:auditable  In this example, we add the aspect &#x60;&#x60;&#x60;cm:versionable&#x60;&#x60;&#x60; to a node using the QName resolution mentioned above:  &#x60;&#x60;&#x60; {   \&quot;actionDefinitionId\&quot;: \&quot;add-features\&quot;,   \&quot;targetId\&quot;: \&quot;16349e3f-2977-44d1-93f2-73c12b8083b5\&quot;,   \&quot;params\&quot;: {    \&quot;aspect-name\&quot;: \&quot;cm:versionable\&quot;   } } &#x60;&#x60;&#x60;  The &#x60;&#x60;&#x60;actionDefinitionId&#x60;&#x60;&#x60; is the &#x60;&#x60;&#x60;id&#x60;&#x60;&#x60; of an action definition as returned by the _list actions_ operations (e.g. GET /action-definitions).  The action will be executed **asynchronously** with a &#x60;202&#x60; HTTP response signifying that the request has been accepted successfully. The response body contains the unique ID of the action pending execution. The ID may be used, for example to correlate an execution with output in the server logs. 
     *
     */
    @POST
    @Path("/action-executions")
    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @ApiOperation(value = "Execute an action", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 202, message = "Action execution request accepted and pending execution. ", response = ActionExecResultEntry.class),
        @ApiResponse(code = 400, message = "Invalid parameter: **actionDefinitionId** missing but required by the action "),
        @ApiResponse(code = 401, message = "Authentication failed"),
        @ApiResponse(code = 404, message = "**actionDefinitionId** or **targetId** does not exist "),
        @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
    public ActionExecResultEntry actionExec(ActionBodyExec actionBodyExec);

    /**
     * Retrieve list of available actions
     *
     * **Note:** this endpoint is available in Alfresco 5.2.2 and newer versions.  Gets a list of all available actions  The default sort order for the returned list is for actions to be sorted by ascending name. You can override the default by using the **orderBy** parameter.  You can use any of the following fields to order the results: * name * title 
     *
     */
    @GET
    @Path("/action-definitions")
    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @ApiOperation(value = "Retrieve list of available actions", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "Successful response", response = ActionDefinitionList.class),
        @ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems**, **skipCount** or **orderBy** is invalid "),
        @ApiResponse(code = 401, message = "Authentication failed"),
        @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
    public ActionDefinitionList listActions(@QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("orderBy")List<String> orderBy, @QueryParam("fields")List<String> fields);

    /**
     * Retrieve actions for a node
     *
     * **Note:** this endpoint is available in Alfresco 5.2 and newer versions.  Retrieve the list of actions that may be executed against the given **nodeId**.  The default sort order for the returned list is for actions to be sorted by ascending name. You can override the default by using the **orderBy** parameter.  You can use any of the following fields to order the results: * name * title 
     *
     */
    @GET
    @Path("/nodes/{nodeId}/action-definitions")
    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @ApiOperation(value = "Retrieve actions for a node", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "Successful response", response = ActionDefinitionList.class),
        @ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems**, **skipCount** or **orderBy** is invalid "),
        @ApiResponse(code = 401, message = "Authentication failed"),
        @ApiResponse(code = 404, message = "**nodeId** does not exist "),
        @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
    public ActionDefinitionList nodeActions(@PathParam("nodeId") String nodeId, @QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("orderBy")List<String> orderBy, @QueryParam("fields")List<String> fields);
}
+42 −0
Original line number Diff line number Diff line
package com.inteligr8.alfresco.acs.api;

import com.inteligr8.alfresco.acs.model.ActivityPaging;
import com.inteligr8.alfresco.acs.model.Error;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.List;
import javax.ws.rs.*;

/**
 * Alfresco Content Services REST API
 *
 * <p>**Core API**  Provides access to the core features of Alfresco Content Services. 
 *
 */
@Path("/api/-default-/public/alfresco/versions/1")
@Api(value = "/api/-default-/public/alfresco/versions/1", description = "")
public interface ActivitiesApi  {

    /**
     * List activities
     *
     * Gets a list of activities for person **personId**.  You can use the &#x60;-me-&#x60; string in place of &#x60;&lt;personId&gt;&#x60; to specify the currently authenticated user. 
     *
     */
    @GET
    @Path("/people/{personId}/activities")
    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @ApiOperation(value = "List activities", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "Successful response", response = ActivityPaging.class),
        @ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems**, **skipCount**, or **who** is invalid "),
        @ApiResponse(code = 401, message = "Authentication failed"),
        @ApiResponse(code = 403, message = "Current user does not have access to the activities for **personId**"),
        @ApiResponse(code = 404, message = "**personId** or **siteId** does not exist "),
        @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
    public ActivityPaging listActivitiesForPerson(@PathParam("personId") String personId, @QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("who")String who, @QueryParam("siteId")String siteId, @QueryParam("fields")List<String> fields);
}
+59 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading