Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
debfb8d998 | |||
2c77100246 | |||
3521365f86 | |||
bca4ea6db0 | |||
5d2fb8e47b | |||
9d4c8b5cbf | |||
e5cb8e7517 | |||
94f3de6386 | |||
a3ab8a5c08 | |||
78f006849f | |||
3d0cb56680 | |||
6dbb73fa17 | |||
7c0dfe919e | |||
8c31f098d4 | |||
fe41dbef76 | |||
4fe407de0f | |||
f7ad93797e | |||
aad2ed6406 | |||
6125c6b92e | |||
d81322dd33 |
4
pom.xml
4
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.inteligr8.alfresco</groupId>
|
||||
<artifactId>aps-public-rest-api</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<version>1.2.0</version>
|
||||
<name>Alfresco Process Services ReST API Client for Java</name>
|
||||
|
||||
<properties>
|
||||
@@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>com.inteligr8</groupId>
|
||||
<artifactId>common-rest-api</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext</groupId>
|
||||
|
@@ -1,51 +1,51 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.AppDefinitionRepresentation;
|
||||
import com.inteligr8.alfresco.activiti.model.AppDefinitionUpdateResultRepresentation;
|
||||
import com.inteligr8.alfresco.activiti.model.FileMultipartCxf;
|
||||
|
||||
@Path("/api/enterprise/app-definitions")
|
||||
public interface AppDefinitionsCxfApi {
|
||||
|
||||
@POST
|
||||
@Path("import")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionRepresentation import_(
|
||||
FileMultipartCxf body,
|
||||
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
|
||||
List<Attachment> attachments);
|
||||
|
||||
@POST
|
||||
@Path("{modelId}/import")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionRepresentation import_(
|
||||
@PathParam("modelId") Long appId,
|
||||
FileMultipartCxf body,
|
||||
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
|
||||
List<Attachment> attachments);
|
||||
|
||||
@POST
|
||||
@Path("publish-app")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionUpdateResultRepresentation publishApp(
|
||||
FileMultipartCxf body);
|
||||
List<Attachment> attachments);
|
||||
|
||||
@POST
|
||||
@Path("{modelId}/publish-app")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionUpdateResultRepresentation publishApp(
|
||||
@PathParam("modelId") Long appId,
|
||||
FileMultipartCxf body);
|
||||
List<Attachment> attachments);
|
||||
|
||||
}
|
||||
|
@@ -1,51 +1,56 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
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.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.AppDefinitionRepresentation;
|
||||
import com.inteligr8.alfresco.activiti.model.AppDefinitionUpdateResultRepresentation;
|
||||
import com.inteligr8.alfresco.activiti.model.FileMultipartJersey;
|
||||
|
||||
@Path("/api/enterprise/app-definitions")
|
||||
public interface AppDefinitionsJerseyApi {
|
||||
|
||||
@POST
|
||||
@Path("import")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionRepresentation importApp(
|
||||
FileMultipartJersey file,
|
||||
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
|
||||
AppDefinitionRepresentation import_(
|
||||
@FormDataParam("file") InputStream filedataStream,
|
||||
@FormDataParam("file") FormDataContentDisposition filedataDisposition);
|
||||
|
||||
@POST
|
||||
@Path("{modelId}/import")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionRepresentation importApp(
|
||||
AppDefinitionRepresentation import_(
|
||||
@PathParam("modelId") Long appId,
|
||||
FileMultipartJersey file,
|
||||
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
|
||||
@FormDataParam("file") InputStream filedataStream,
|
||||
@FormDataParam("file") FormDataContentDisposition filedataDisposition);
|
||||
|
||||
@POST
|
||||
@Path("publish-app")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionUpdateResultRepresentation publishApp(
|
||||
FileMultipartJersey file);
|
||||
@FormDataParam("file") InputStream filedataStream,
|
||||
@FormDataParam("file") FormDataContentDisposition filedataDisposition);
|
||||
|
||||
@POST
|
||||
@Path("{modelId}/publish-app")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, "application/zip", MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
AppDefinitionUpdateResultRepresentation publishApp(
|
||||
@PathParam("modelId") Long appId,
|
||||
FileMultipartJersey file);
|
||||
@FormDataParam("file") InputStream filedataStream,
|
||||
@FormDataParam("file") FormDataContentDisposition filedataDisposition);
|
||||
|
||||
}
|
||||
|
@@ -1,38 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.ContentDisposition;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
|
||||
|
||||
public class FileMultipartCxf extends MultipartBody {
|
||||
|
||||
public static FileMultipartCxf from(String filename, InputStream istream) throws IOException {
|
||||
return new FileMultipartCxf(Arrays.asList(toAttachment(filename, istream)));
|
||||
}
|
||||
|
||||
public FileMultipartCxf(List<Attachment> atts) throws IOException {
|
||||
super(atts);
|
||||
}
|
||||
|
||||
public FileMultipartCxf(List<Attachment> atts, boolean outbound) {
|
||||
super(atts, outbound);
|
||||
}
|
||||
|
||||
public Attachment getFileAttachment() {
|
||||
return this.getAttachment("file");
|
||||
}
|
||||
|
||||
private static Attachment toAttachment(String filename, InputStream istream) {
|
||||
if (filename == null) {
|
||||
return new Attachment("file", istream, new ContentDisposition("form-data; name=\"file\""));
|
||||
} else {
|
||||
return new Attachment("file", istream, new ContentDisposition("form-data; name=\"file\"; filename=\"" + filename + "\""));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti.model;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.text.ParseException;
|
||||
|
||||
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;
|
||||
|
||||
public class FileMultipartJersey extends FormDataMultiPart {
|
||||
|
||||
public static FileMultipartJersey from(String filename, InputStream istream) throws ParseException {
|
||||
FileMultipartJersey multipart = new FileMultipartJersey();
|
||||
multipart.bodyPart(toBodyPart(filename, istream));
|
||||
return multipart;
|
||||
}
|
||||
|
||||
private FileMultipartJersey() {
|
||||
}
|
||||
|
||||
public FormDataBodyPart getFileAttachment() {
|
||||
return this.getField("file");
|
||||
}
|
||||
|
||||
private static BodyPart toBodyPart(String filename, InputStream istream) throws ParseException {
|
||||
if (filename == null) {
|
||||
return new FormDataBodyPart()
|
||||
.contentDisposition(new FormDataContentDisposition("form-data; name=\"file\""))
|
||||
.entity(istream);
|
||||
} else {
|
||||
return new FormDataBodyPart()
|
||||
.contentDisposition(new FormDataContentDisposition("form-data; name=\"file\"; filename=\"" + filename + "\""))
|
||||
.entity(istream);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user