Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

124269 jvonka: RA-834: Optionally request generation of a rendition on content creation (eg. file upload)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126556 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 11:28:14 +00:00
parent d310207b05
commit c1d3421cc8
5 changed files with 244 additions and 29 deletions

View File

@@ -53,6 +53,7 @@ public class MultiPartBuilder
private Boolean overwrite;
private Boolean autoRename;
private String nodeType;
private List<String> renditionIds = Collections.emptyList(); // initially single rendition name/id (in the future we may support multiple)
private Map<String, String> properties = Collections.emptyMap();
private MultiPartBuilder()
@@ -71,6 +72,7 @@ public class MultiPartBuilder
this.overwrite = that.overwrite;
this.autoRename = that.autoRename;
this.nodeType = that.nodeType;
this.renditionIds = that.renditionIds;
this.properties = new HashMap<>(that.properties);
}
@@ -150,12 +152,18 @@ public class MultiPartBuilder
return this;
}
private String getAspects(List<String> aspects)
public MultiPartBuilder setRenditions(List<String> renditionIds)
{
if (!aspects.isEmpty())
this.renditionIds = renditionIds;
return this;
}
private String getCommaSeparated(List<String> names)
{
if (! names.isEmpty())
{
StringBuilder sb = new StringBuilder(aspects.size() * 2);
for (String str : aspects)
StringBuilder sb = new StringBuilder(names.size() * 2);
for (String str : names)
{
sb.append(str).append(',');
}
@@ -255,11 +263,12 @@ public class MultiPartBuilder
addPartIfNotNull(parts, "updatenoderef", updateNodeRef);
addPartIfNotNull(parts, "description", description);
addPartIfNotNull(parts, "contenttype", contentTypeQNameStr);
addPartIfNotNull(parts, "aspects", getAspects(aspects));
addPartIfNotNull(parts, "aspects", getCommaSeparated(aspects));
addPartIfNotNull(parts, "majorversion", majorVersion);
addPartIfNotNull(parts, "overwrite", overwrite);
addPartIfNotNull(parts, "autorename", autoRename);
addPartIfNotNull(parts, "nodetype", nodeType);
addPartIfNotNull(parts, "renditions", getCommaSeparated(renditionIds));
if (!properties.isEmpty())
{