Compare commits

...

7 Commits

4 changed files with 50 additions and 15 deletions

16
pom.xml
View File

@@ -5,10 +5,10 @@
<groupId>com.inteligr8.alfresco</groupId>
<artifactId>acs-public-rest-api</artifactId>
<version>2.1-SNAPSHOT-acs52</version>
<version>2.1-SNAPSHOT-acs60</version>
<name>Alfresco Content Services ReST API for Java</name>
<description>A library for building ACS v5.2.x JAX-RS REST API clients</description>
<description>A library for building ACS v6.0.x JAX-RS REST API clients</description>
<url>https://bitbucket.org/inteligr8/acs-public-rest-api</url>
<licenses>
@@ -44,7 +44,7 @@
<swagger.basePackage>com.inteligr8.alfresco.acs</swagger.basePackage>
<alfresco.platform.version>5.2.0</alfresco.platform.version>
<alfresco.platform.version>6.0.0-ea</alfresco.platform.version>
<jersey.version>2.39.1</jersey.version>
<cxf.version>3.5.6</cxf.version>
@@ -225,23 +225,23 @@
<previousPattern>/\*\*</previousPattern>
</regex>
<regex>
<pattern>(\* Alfresco Core REST API[^@]*)@Path\("/"\)</pattern>
<pattern>(\*\*Core API\*\*[^@]*)@Path\("/"\)</pattern>
<replacement>$1@Path("/api/-default-/public/alfresco/versions/1")</replacement>
</regex>
<regex>
<pattern>(\* Alfresco Workflow REST API[^@]*)@Path\("/"\)</pattern>
<pattern>(\*\*Workflow API\*\*[^@]*)@Path\("/"\)</pattern>
<replacement>$1@Path("/api/-default-/public/workflow/versions/1")</replacement>
</regex>
<regex>
<pattern>(\* Alfresco Authentication REST API[^@]*)@Path\("/"\)</pattern>
<pattern>(\*\*Authentication API\*\*[^@]*)@Path\("/"\)</pattern>
<replacement>$1@Path("/api/-default-/public/authentication/versions/1")</replacement>
</regex>
<regex>
<pattern>(\* Alfresco Discovery REST API[^@]*)@Path\("/"\)</pattern>
<pattern>(\*\*Discovery API\*\*[^@]*)@Path\("/"\)</pattern>
<replacement>$1@Path("/api")</replacement>
</regex>
<regex>
<pattern>(\* Alfresco Search REST API[^@]*)@Path\("/"\)</pattern>
<pattern>(\*\*Search API\*\*[^@]*)@Path\("/"\)</pattern>
<replacement>$1@Path("/api/-default-/public/search/versions/1")</replacement>
</regex>
</regexes>

View File

@@ -15,11 +15,14 @@
package com.inteligr8.alfresco.acs;
import com.inteligr8.alfresco.acs.api.ActivitiesApi;
import com.inteligr8.alfresco.acs.api.AuditApi;
import com.inteligr8.alfresco.acs.api.AuthenticationApi;
import com.inteligr8.alfresco.acs.api.CommentsApi;
import com.inteligr8.alfresco.acs.api.DeploymentsApi;
import com.inteligr8.alfresco.acs.api.DiscoveryApi;
import com.inteligr8.alfresco.acs.api.DownloadsApi;
import com.inteligr8.alfresco.acs.api.FavoritesApi;
import com.inteligr8.alfresco.acs.api.GroupsApi;
import com.inteligr8.alfresco.acs.api.NetworksApi;
import com.inteligr8.alfresco.acs.api.NodesApi;
import com.inteligr8.alfresco.acs.api.PeopleApi;
@@ -51,6 +54,10 @@ public interface AcsPublicRestApi {
default ActivitiesApi getActivitiesApi() {
return this.getApi(ActivitiesApi.class);
}
default AuditApi getAuditApi() {
return this.getApi(AuditApi.class);
}
default AuthenticationApi getAuthenticationApi() {
return this.getApi(AuthenticationApi.class);
@@ -68,10 +75,18 @@ public interface AcsPublicRestApi {
return this.getApi(DiscoveryApi.class);
}
default DownloadsApi getDownloadsApi() {
return this.getApi(DownloadsApi.class);
}
default FavoritesApi getFavoritesApi() {
return this.getApi(FavoritesApi.class);
}
default GroupsApi getGroupsApi() {
return this.getApi(GroupsApi.class);
}
default NetworksApi getNetworksApi() {
return this.getApi(NetworksApi.class);
}

View File

@@ -17,6 +17,7 @@ package com.inteligr8.alfresco.acs.model;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -90,9 +91,18 @@ public class NodeBodyCreateMultipartCxf extends MultipartBody {
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<String, ?> props = (Map<String, ?>)nodeBody.getProperties();
@SuppressWarnings("unchecked")
Map<String, ?> props = (Map<String, ?>)nodeBody.getProperties();
for (Entry<String, ?> prop : props.entrySet()) {
if (prop.getValue() != null) {
if (prop.getValue() instanceof Collection<?>) {
for (Object value : (Collection<?>)prop.getValue())
if (value != null)
atts.add(toAttachment(prop.getKey(), value.toString()));
} else if (prop.getValue() instanceof Object[]) {
for (Object value : (Object[])prop.getValue())
if (value != null)
atts.add(toAttachment(prop.getKey(), value.toString()));
} else if (prop.getValue() != null) {
// FIXME convert dates as ACS would expect them to be formatted
atts.add(toAttachment(prop.getKey(), prop.getValue().toString()));
}

View File

@@ -17,6 +17,7 @@ package com.inteligr8.alfresco.acs.model;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -86,12 +87,21 @@ public class NodeBodyCreateMultipartJersey extends FormDataMultiPart {
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<String, ?> props = (Map<String, ?>)nodeBody.getProperties();
@SuppressWarnings("unchecked")
Map<String, ?> props = (Map<String, ?>)nodeBody.getProperties();
for (Entry<String, ?> 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()));
}
if (prop.getValue() instanceof Collection<?>) {
for (Object value : (Collection<?>)prop.getValue())
if (value != null)
fields.add(new FormDataBodyPart(prop.getKey(), value.toString()));
} else if (prop.getValue() instanceof Object[]) {
for (Object value : (Object[])prop.getValue())
if (value != null)
fields.add(new FormDataBodyPart(prop.getKey(), value.toString()));
} else if (prop.getValue() != null) {
// FIXME convert dates as ACS would expect them to be formatted
fields.add(new FormDataBodyPart(prop.getKey(), prop.getValue().toString()));
}
}
}