diff --git a/pom-release.xml b/pom-release.xml deleted file mode 100644 index 41790ef..0000000 --- a/pom-release.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - 4.0.0 - - com.inteligr8.alfresco - acs-public-rest-api - 2.1-SNAPSHOT - pom - - Alfresco Content Services ReST API for Java - An ACS API library for building REST API clients that support both the CXF and Jersey frameworks - https://bitbucket.org/inteligr8/acs-public-rest-api - - - - GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 - https://www.gnu.org/licenses/lgpl-3.0.txt - - - - - scm:git:https://bitbucket.org/inteligr8/acs-public-rest-api.git - scm:git:git@bitbucket.org:inteligr8/acs-public-rest-api.git - https://bitbucket.org/inteligr8/acs-public-rest-api - - - Inteligr8 - https://www.inteligr8.com - - - - brian.long - Brian Long - brian@inteligr8.com - https://twitter.com/brianmlong - - - - - UTF-8 - - - - - - maven-invoker-plugin - 3.3.0 - - - clean - package - - ${basedir}/invoker-reports - pom.xml - true - - - - acs51 - package - run - - - v51 - - - - - acs52 - package - run - - - v52 - - - - - acs60 - package - run - - - v60 - - - - - acs61 - package - run - - - v61 - - - - - acs62 - package - run - - - v62 - - - - - acs70 - package - run - - - v70 - - - - - acs71 - package - run - - - v71 - - - - - acs72 - package - run - - - v72 - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.3.0 - - - attach-artifacts - package - attach-artifact - - - - ${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar - javadoc - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-sources.jar - sources - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs51.jar - acs51 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs52.jar - acs52 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs60.jar - acs60 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs61.jar - acs61 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs62.jar - acs62 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs70.jar - acs70 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs71.jar - acs71 - jar - - - ${project.build.directory}/${project.artifactId}-${project.version}-acs72.jar - acs72 - jar - - - - - - - - maven-install-plugin - - pom.xml - - - - - - - - ossrh-release - - - - maven-gpg-plugin - - - sign - verify - sign - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - - - - diff --git a/pom.xml b/pom.xml index 41a1678..c43c87b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,10 +5,10 @@ com.inteligr8.alfresco acs-public-rest-api - 2.1-SNAPSHOT + 2.1-SNAPSHOT-acs51 Alfresco Content Services ReST API for Java - An ACS API library for building REST API clients that support both the CXF and Jersey frameworks + A library for building ACS v5.1.x JAX-RS REST API clients https://bitbucket.org/inteligr8/acs-public-rest-api @@ -44,11 +44,7 @@ com.inteligr8.alfresco.acs - - false - false - false - false + 5.1.0 2.35 3.4.7 @@ -148,50 +144,6 @@ ${project.build.directory}/dependency/definitions/alfresco-core.yaml - - swagger-search-codegen - generate-sources - - generate - - - ${api.search.disabled} - ${project.build.directory}/dependency/definitions/alfresco-search.yaml - - - - swagger-auth-codegen - generate-sources - - generate - - - ${api.auth.disabled} - ${project.build.directory}/dependency/definitions/alfresco-auth.yaml - - - - swagger-discovery-codegen - generate-sources - - generate - - - ${api.discovery.disabled} - ${project.build.directory}/dependency/definitions/alfresco-discovery.yaml - - - - swagger-model-codegen - generate-sources - - generate - - - ${api.model.disabled} - ${project.build.directory}/dependency/definitions/alfresco-model.yaml - - @@ -305,360 +257,63 @@ - - maven-jar-plugin - - ${acs.platform.tag} - - - - maven-source-plugin - - - source - package - jar-no-fork - - - - - maven-javadoc-plugin - 3.3.2 - - - javadoc - package - jar - - public - -Xdoclint:none - - - - - acs51 - - - acs - v51 - - - - 5.1.0 - acs51 - true - true - true - true - - - - acs52 - - - acs - v52 - - - - 5.2.0 - acs52 - true - + ossrh-release - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 + maven-source-plugin - add-acs70+-src - initialize - - add-source - + source + package + jar-no-fork + + + + + maven-javadoc-plugin + 3.3.2 + + + javadoc + package + jar - - src/acs52+/java - + public + -Xdoclint:none - - - - - acs60 - - - acs - v60 - - - - 6.0.0-ea - acs60 - true - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 + maven-gpg-plugin - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - - + sign + verify + sign - - - - - acs61 - - - acs - v61 - - - - 6.1.0 - acs61 - true - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + + ossrh + https://s01.oss.sonatype.org/ + true + - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - src/acs61+/java - - - - - - - - - - acs62 - - - acs - v62 - - - - 6.2.0 - acs62 - true - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - src/acs61+/java - - - - - - - - - - acs70 - - - acs - v70 - - - - 7.0.0 - acs70 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - src/acs61+/java - src/acs70+/java - - - - - - - - - - acs71 - - - acs - v71 - - - - 7.1.0 - acs71 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - src/acs61+/java - src/acs70+/java - - - - - - - - - - acs72 - - - acs - v72 - - - - 7.2.0 - acs72 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - src/acs61+/java - src/acs70+/java - - - - - - - - - - acsDefault - - - !acs - - - - 7.2.0 - acs72 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - add-acs70+-src - initialize - - add-source - - - - src/acs52+/java - src/acs60+/java - src/acs61+/java - src/acs70+/java - - + ossrh-deploy + deploy + deploy diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestApi.java b/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestApi.java deleted file mode 100644 index 9ed18dd..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestApi.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs; - -import com.inteligr8.alfresco.acs.api.ActivitiesApi; -import com.inteligr8.alfresco.acs.api.AuthenticationApi; -import com.inteligr8.alfresco.acs.api.CommentsApi; -import com.inteligr8.alfresco.acs.api.DiscoveryApi; -import com.inteligr8.alfresco.acs.api.FavoritesApi; -import com.inteligr8.alfresco.acs.api.NetworksApi; -import com.inteligr8.alfresco.acs.api.NodesApi; -import com.inteligr8.alfresco.acs.api.PeopleApi; -import com.inteligr8.alfresco.acs.api.PreferencesApi; -import com.inteligr8.alfresco.acs.api.QueriesApi; -import com.inteligr8.alfresco.acs.api.RatingsApi; -import com.inteligr8.alfresco.acs.api.RenditionsApi; -import com.inteligr8.alfresco.acs.api.SearchApi; -import com.inteligr8.alfresco.acs.api.SharedLinksApi; -import com.inteligr8.alfresco.acs.api.SitesApi; -import com.inteligr8.alfresco.acs.api.TagsApi; -import com.inteligr8.alfresco.acs.api.TrashcanApi; -import com.inteligr8.alfresco.acs.api.V0Api; -import com.inteligr8.alfresco.acs.api.VersionsApi; - -/** - * This interface consolidates the JAX-RS APIs available in the ACS Public - * ReST API. - * - * @author brian@inteligr8.com - */ -public interface Acs52PublicRestApi extends Acs51PublicRestApi { - - T getApi(Class apiClass); - - default ActivitiesApi getActivitiesApi() { - return this.getApi(ActivitiesApi.class); - } - - default AuthenticationApi getAuthenticationApi() { - return this.getApi(AuthenticationApi.class); - } - - default CommentsApi getCommentsApi() { - return this.getApi(CommentsApi.class); - } - - default DiscoveryApi getDiscoveryApi() { - return this.getApi(DiscoveryApi.class); - } - - default FavoritesApi getFavoritesApi() { - return this.getApi(FavoritesApi.class); - } - - default NetworksApi getNetworksApi() { - return this.getApi(NetworksApi.class); - } - - default NodesApi getNodesApi() { - return this.getApi(NodesApi.class); - } - - default PeopleApi getPeopleApi() { - return this.getApi(PeopleApi.class); - } - - default PreferencesApi getPreferencesApi() { - return this.getApi(PreferencesApi.class); - } - - default QueriesApi getQueriesApi() { - return this.getApi(QueriesApi.class); - } - - default RatingsApi getRatingsApi() { - return this.getApi(RatingsApi.class); - } - - default RenditionsApi getRenditionsApi() { - return this.getApi(RenditionsApi.class); - } - - default SearchApi getSearchApi() { - return this.getApi(SearchApi.class); - } - - default SharedLinksApi getSharedLinksApi() { - return this.getApi(SharedLinksApi.class); - } - - default SitesApi getSitesApi() { - return this.getApi(SitesApi.class); - } - - default TagsApi getTagsApi() { - return this.getApi(TagsApi.class); - } - - default TrashcanApi getTrashcanApi() { - return this.getApi(TrashcanApi.class); - } - - default VersionsApi getVersionsApi() { - return this.getApi(VersionsApi.class); - } - - default V0Api getV0Api() { - return this.getApi(V0Api.class); - } - - default V0Api getLegacyApi() { - return this.getV0Api(); - } - -} diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestCxfApi.java b/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestCxfApi.java deleted file mode 100644 index fe339d8..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestCxfApi.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs; - -import com.inteligr8.alfresco.acs.api.NodesCxfApi; - -/** - * This interface appends Apache CXF implementation specific methods to the - * JAX-RS API of the ACS Public ReST API. This is due to a lack of multi-part - * in the JAX-RS specification. - * - * @author brian@inteligr8.com - */ -public interface Acs52PublicRestCxfApi extends Acs52PublicRestApi { - - default NodesCxfApi getNodesExtApi() { - return this.getApi(NodesCxfApi.class); - } - -} diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestJerseyApi.java b/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestJerseyApi.java deleted file mode 100644 index 599b808..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/Acs52PublicRestJerseyApi.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs; - -import com.inteligr8.alfresco.acs.api.NodesJerseyApi; - -/** - * This interface appends Jersey implementation specific methods to the - * JAX-RS API of the ACS Public ReST API. This is due to a lack of multi-part - * in the JAX-RS specification. - * - * @author brian@inteligr8.com - */ -public interface Acs52PublicRestJerseyApi extends Acs52PublicRestApi { - - default NodesJerseyApi getNodesExtApi() { - return this.getApi(NodesJerseyApi.class); - } - -} diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/api/NodesCxfApi.java b/src/acs52+/java/com/inteligr8/alfresco/acs/api/NodesCxfApi.java deleted file mode 100644 index b1e1043..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/api/NodesCxfApi.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs.api; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import com.inteligr8.alfresco.acs.model.Error; -import com.inteligr8.alfresco.acs.model.NodeBodyCreateMultipartCxf; -import com.inteligr8.alfresco.acs.model.NodeEntry; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -@Path("/api/-default-/public/alfresco/versions/1") -@Api(value = "/api/-default-/public/alfresco/versions/1", description = "") -public interface NodesCxfApi { - - @POST - @Path("/nodes/{nodeId}/children") - @Consumes({ MediaType.MULTIPART_FORM_DATA }) - @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a node", tags={ }) - @ApiResponses(value = { - @ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class), - @ApiResponse(code = 400, message = "Invalid parameter: **nodeId** is not a valid format or **nodeBodyCreate** is invalid "), - @ApiResponse(code = 401, message = "Authentication failed"), - @ApiResponse(code = 403, message = "Current user does not have permission to create children of **nodeId**"), - @ApiResponse(code = 404, message = "**nodeId** or **renditionId** does not exist "), - @ApiResponse(code = 409, message = "New name clashes with an existing node in the current parent folder"), - @ApiResponse(code = 413, message = "Content exceeds individual file size limit configured for the network or system"), - @ApiResponse(code = 415, message = "Content Type is not supported"), - @ApiResponse(code = 422, message = "Model integrity exception including a file name containing invalid characters"), - @ApiResponse(code = 507, message = "Content exceeds overall storage quota limit configured for the network or system"), - @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) }) - public NodeEntry createNode( - @PathParam("nodeId") String nodeId, - NodeBodyCreateMultipartCxf body); -/* - * This better impl doesn't work - * - @POST - @Path("/nodes/{nodeId}/children") - @Consumes({ MediaType.MULTIPART_FORM_DATA }) - @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a node", tags={ }) - @ApiResponses(value = { - @ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class), - @ApiResponse(code = 400, message = "Invalid parameter: **nodeId** is not a valid format or **nodeBodyCreate** is invalid "), - @ApiResponse(code = 401, message = "Authentication failed"), - @ApiResponse(code = 403, message = "Current user does not have permission to create children of **nodeId**"), - @ApiResponse(code = 404, message = "**nodeId** or **renditionId** does not exist "), - @ApiResponse(code = 409, message = "New name clashes with an existing node in the current parent folder"), - @ApiResponse(code = 413, message = "Content exceeds individual file size limit configured for the network or system"), - @ApiResponse(code = 415, message = "Content Type is not supported"), - @ApiResponse(code = 422, message = "Model integrity exception including a file name containing invalid characters"), - @ApiResponse(code = 507, message = "Content exceeds overall storage quota limit configured for the network or system"), - @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) }) - public NodeEntry createNode( - @PathParam("nodeId") String nodeId, - @Multipart("name") String name, - @Multipart("nodeType") String nodeType, - @Multipart("filedata") InputStream fileStream, - @Multipart("filedata") ContentDisposition disposition, - @Multipart(value = "autoRename", required = false) Boolean autoRename, - @Multipart(value = "majorVersion", required = false) Boolean majorVersion, - @Multipart(value = "versioningEnabled", required = false) Boolean versioningEnabled); -*/ -} diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/api/NodesJerseyApi.java b/src/acs52+/java/com/inteligr8/alfresco/acs/api/NodesJerseyApi.java deleted file mode 100644 index c4d7f0f..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/api/NodesJerseyApi.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs.api; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import com.inteligr8.alfresco.acs.model.Error; -import com.inteligr8.alfresco.acs.model.NodeBodyCreateMultipartJersey; -import com.inteligr8.alfresco.acs.model.NodeEntry; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -@Path("/api/-default-/public/alfresco/versions/1") -@Api(value = "/api/-default-/public/alfresco/versions/1", description = "") -public interface NodesJerseyApi { - - @POST - @Path("/nodes/{nodeId}/children") - @Consumes({ MediaType.MULTIPART_FORM_DATA }) - @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a node", tags={ }) - @ApiResponses(value = { - @ApiResponse(code = 201, message = "Successful response", response = NodeEntry.class), - @ApiResponse(code = 400, message = "Invalid parameter: **nodeId** is not a valid format or **nodeBodyCreate** is invalid "), - @ApiResponse(code = 401, message = "Authentication failed"), - @ApiResponse(code = 403, message = "Current user does not have permission to create children of **nodeId**"), - @ApiResponse(code = 404, message = "**nodeId** or **renditionId** does not exist "), - @ApiResponse(code = 409, message = "New name clashes with an existing node in the current parent folder"), - @ApiResponse(code = 413, message = "Content exceeds individual file size limit configured for the network or system"), - @ApiResponse(code = 415, message = "Content Type is not supported"), - @ApiResponse(code = 422, message = "Model integrity exception including a file name containing invalid characters"), - @ApiResponse(code = 507, message = "Content exceeds overall storage quota limit configured for the network or system"), - @ApiResponse(code = 200, message = "Unexpected error", response = Error.class) }) - public NodeEntry createNode( - @PathParam("nodeId") String nodeId, - NodeBodyCreateMultipartJersey file); - -} diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/model/NodeBodyCreateMultipartCxf.java b/src/acs52+/java/com/inteligr8/alfresco/acs/model/NodeBodyCreateMultipartCxf.java deleted file mode 100644 index ac9714d..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/model/NodeBodyCreateMultipartCxf.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs.model; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.ws.rs.core.MediaType; - -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.apache.cxf.jaxrs.ext.multipart.ContentDisposition; -import org.apache.cxf.jaxrs.ext.multipart.MultipartBody; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * A CXF utility implementation of the CXF MultipartBody. - * - * @author brian@inteligr8.com - */ -public class NodeBodyCreateMultipartCxf extends MultipartBody { - - private static final Logger logger = LoggerFactory.getLogger(NodeBodyCreateMultipartCxf.class); - private static final ObjectMapper om = new ObjectMapper(); - - public static NodeBodyCreateMultipartCxf from( - NodeBodyCreate nodeBody, String filename, InputStream istream, - Boolean autoRename, Boolean majorVersion, Boolean versioningEnabled) throws IOException { - List atts = new LinkedList<>(); - atts.addAll(toAttachments(nodeBody)); - if (autoRename != null) - atts.add(toAttachment("autoRename", String.valueOf(autoRename))); - if (majorVersion != null) - atts.add(toAttachment("majorVersion", String.valueOf(majorVersion))); - if (versioningEnabled != null) - atts.add(toAttachment("versioningEnabled", String.valueOf(versioningEnabled))); - atts.add(toAttachment(filename, istream)); - return new NodeBodyCreateMultipartCxf(atts, true); - } - - public NodeBodyCreateMultipartCxf(List atts) throws IOException { - super(atts); - } - - public NodeBodyCreateMultipartCxf(List atts, boolean outbound) throws IOException { - super(atts, outbound); - } - - public NodeBodyCreate getBody() throws IOException { - if (!MediaType.APPLICATION_JSON_TYPE.equals(this.getRootAttachment().getContentType())) - throw new IllegalStateException(); - - InputStream istream = this.getRootAttachment().getDataHandler().getInputStream(); - try { - return om.readValue(istream, NodeBodyCreate.class); - } finally { - istream.close(); - } - } - - public Attachment getFiledataAttachment() { - return this.getAttachment("filedata"); - } - - - - private static List toAttachments(NodeBodyCreate nodeBody) throws IOException { - List atts = new LinkedList<>(); - atts.add(toAttachment("name", nodeBody.getName())); - atts.add(toAttachment("nodeType", nodeBody.getNodeType())); - if (nodeBody.getAspectNames() != null && !nodeBody.getAspectNames().isEmpty()) - logger.warn("The ACS Public REST API does not support the explicit inclusion of aspects while creating content"); - if (nodeBody.getProperties() != null) { - Map props = (Map)nodeBody.getProperties(); - for (Entry prop : props.entrySet()) { - if (prop.getValue() != null) { - // FIXME convert dates as ACS would expect them to be formatted - atts.add(toAttachment(prop.getKey(), prop.getValue().toString())); - } - } - } - return atts; - } - - private static Attachment toAttachment(String name, String value) { - return new Attachment(name, new ByteArrayInputStream(value.getBytes()), new ContentDisposition("form-data; name=\"" + name + "\"")); - } - - private static Attachment toAttachment(String filename, InputStream istream) { - if (filename == null) { - return new Attachment("filedata", istream, new ContentDisposition("form-data; name=\"filedata\"")); - } else { - return new Attachment("filedata", istream, new ContentDisposition("form-data; name=\"filedata\"; filename=\"" + filename + "\"")); - } - } - -} diff --git a/src/acs52+/java/com/inteligr8/alfresco/acs/model/NodeBodyCreateMultipartJersey.java b/src/acs52+/java/com/inteligr8/alfresco/acs/model/NodeBodyCreateMultipartJersey.java deleted file mode 100644 index 7ce3c87..0000000 --- a/src/acs52+/java/com/inteligr8/alfresco/acs/model/NodeBodyCreateMultipartJersey.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs.model; - -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.ws.rs.core.MediaType; - -import org.glassfish.jersey.media.multipart.BodyPart; -import org.glassfish.jersey.media.multipart.FormDataBodyPart; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataMultiPart; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * A Jersey utility implementation of the Jersey FormDataMultiPart. - * - * @author brian@inteligr8.com - */ -public class NodeBodyCreateMultipartJersey extends FormDataMultiPart { - - private static final Logger logger = LoggerFactory.getLogger(NodeBodyCreateMultipartJersey.class); - private static final ObjectMapper om = new ObjectMapper(); - - public static NodeBodyCreateMultipartJersey from( - NodeBodyCreate nodeBody, String filename, InputStream istream, - Boolean autoRename, Boolean majorVersion, Boolean versioningEnabled) throws IOException, ParseException { - NodeBodyCreateMultipartJersey multipart = new NodeBodyCreateMultipartJersey(); - multipart.field("autoRename", String.valueOf(autoRename)) - .field("majorVersion", String.valueOf(majorVersion)) - .field("versioningEnabled", String.valueOf(versioningEnabled)) - .bodyPart(toBodyPart(filename, istream)) - .getBodyParts().addAll(toFields(nodeBody)); - return multipart; - } - - private NodeBodyCreateMultipartJersey() throws IOException { - } - - public NodeBodyCreate getBody() throws IOException { - BodyPart bodyPart = this.getField(""); - if (bodyPart == null) - throw new IllegalStateException(); - if (!MediaType.APPLICATION_JSON_TYPE.equals(bodyPart.getMediaType())) - throw new IllegalStateException(); - - InputStream istream = bodyPart.getEntityAs(InputStream.class); - try { - return om.readValue(istream, NodeBodyCreate.class); - } finally { - istream.close(); - } - } - - public FormDataBodyPart getFiledataAttachment() { - return this.getField("filedata"); - } - - - - private static List toFields(NodeBodyCreate nodeBody) throws IOException { - List fields = new LinkedList<>(); - fields.add(new FormDataBodyPart("name", nodeBody.getName())); - fields.add(new FormDataBodyPart("nodeType", nodeBody.getNodeType())); - if (nodeBody.getAspectNames() != null && !nodeBody.getAspectNames().isEmpty()) - logger.warn("The ACS Public REST API does not support the explicit inclusion of aspects while creating content"); - if (nodeBody.getProperties() != null) { - Map props = (Map)nodeBody.getProperties(); - for (Entry prop : props.entrySet()) { - if (prop.getValue() != null) { - // FIXME convert dates as ACS would expect them to be formatted - fields.add(new FormDataBodyPart(prop.getKey(), prop.getValue().toString())); - } - } - } - - return fields; - } - - private static BodyPart toBodyPart(String filename, InputStream istream) throws ParseException { - if (filename == null) { - return new FormDataBodyPart() - .contentDisposition(new FormDataContentDisposition("form-data; name=\"filedata\"")) - .entity(istream); - } else { - return new FormDataBodyPart() - .contentDisposition(new FormDataContentDisposition("form-data; name=\"filedata\"; filename=\"" + filename + "\"")) - .entity(istream); - } - } - -} diff --git a/src/acs60+/java/com/inteligr8/alfresco/acs/Acs60PublicRestApi.java b/src/acs60+/java/com/inteligr8/alfresco/acs/Acs60PublicRestApi.java deleted file mode 100644 index d0d8990..0000000 --- a/src/acs60+/java/com/inteligr8/alfresco/acs/Acs60PublicRestApi.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs; - -import com.inteligr8.alfresco.acs.api.AuditApi; -import com.inteligr8.alfresco.acs.api.DownloadsApi; -import com.inteligr8.alfresco.acs.api.GroupsApi; - -/** - * This interface consolidates the JAX-RS APIs available in the ACS Public - * ReST API. - * - * @author brian@inteligr8.com - */ -public interface Acs60PublicRestApi extends Acs52PublicRestApi { - - default AuditApi getAuditApi() { - return this.getApi(AuditApi.class); - } - - default DownloadsApi getDownloadsApi() { - return this.getApi(DownloadsApi.class); - } - - default GroupsApi getGroupsApi() { - return this.getApi(GroupsApi.class); - } - -} diff --git a/src/acs61+/java/com/inteligr8/alfresco/acs/Acs61PublicRestApi.java b/src/acs61+/java/com/inteligr8/alfresco/acs/Acs61PublicRestApi.java deleted file mode 100644 index a710dda..0000000 --- a/src/acs61+/java/com/inteligr8/alfresco/acs/Acs61PublicRestApi.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs; - -import com.inteligr8.alfresco.acs.api.ActionsApi; -import com.inteligr8.alfresco.acs.api.ProbesApi; - -/** - * This interface consolidates the JAX-RS APIs available in the ACS Public - * ReST API. - * - * @author brian@inteligr8.com - */ -public interface Acs61PublicRestApi extends Acs60PublicRestApi { - - default ActionsApi getActionsApi() { - return this.getApi(ActionsApi.class); - } - - default ProbesApi getProbesApi() { - return this.getApi(ProbesApi.class); - } - -} diff --git a/src/acs70+/java/com/inteligr8/alfresco/acs/Acs70PublicRestApi.java b/src/acs70+/java/com/inteligr8/alfresco/acs/Acs70PublicRestApi.java deleted file mode 100644 index ba52d44..0000000 --- a/src/acs70+/java/com/inteligr8/alfresco/acs/Acs70PublicRestApi.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This program 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. - * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ -package com.inteligr8.alfresco.acs; - -import com.inteligr8.alfresco.acs.api.AspectsApi; -import com.inteligr8.alfresco.acs.api.TypesApi; - -/** - * This interface consolidates the JAX-RS APIs available in the ACS Public - * ReST API. - * - * @author brian@inteligr8.com - */ -public interface Acs70PublicRestApi extends Acs61PublicRestApi { - - default AspectsApi getAspectsApi() { - return this.getApi(AspectsApi.class); - } - - default TypesApi getTypesApi() { - return this.getApi(TypesApi.class); - } - -} diff --git a/src/main/java/com/inteligr8/alfresco/acs/Acs51PublicRestApi.java b/src/main/java/com/inteligr8/alfresco/acs/AcsPublicRestApi.java similarity index 98% rename from src/main/java/com/inteligr8/alfresco/acs/Acs51PublicRestApi.java rename to src/main/java/com/inteligr8/alfresco/acs/AcsPublicRestApi.java index 64cc245..d66989a 100644 --- a/src/main/java/com/inteligr8/alfresco/acs/Acs51PublicRestApi.java +++ b/src/main/java/com/inteligr8/alfresco/acs/AcsPublicRestApi.java @@ -29,7 +29,7 @@ import com.inteligr8.alfresco.acs.api.V0Api; * * @author brian@inteligr8.com */ -public interface Acs51PublicRestApi { +public interface AcsPublicRestApi { T getApi(Class apiClass);