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

123112 jvonka: Nodes (FileFolder) API - version options when updating/uploading (overwriting) existing content
   - add tests .. for now check version label only (pending future "list version history" + "get version" etc)
   RA-690


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126528 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 11:21:08 +00:00
parent c43cc28a2a
commit ee3a942fc7
3 changed files with 359 additions and 11 deletions

View File

@@ -1626,15 +1626,17 @@ public class NodesImpl implements Nodes
// Ensure the file is versionable (autoVersion = true, autoVersionProps = false)
ensureVersioningEnabled(nodeRef, true, false);
}
Map<String, Serializable> versionProperties = new HashMap<>(2);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, versionType);
if (reason != null)
else
{
versionProperties.put(VersionModel.PROP_DESCRIPTION, reason);
}
Map<String, Serializable> versionProperties = new HashMap<>(2);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, versionType);
if (reason != null)
{
versionProperties.put(VersionModel.PROP_DESCRIPTION, reason);
}
versionService.createVersion(nodeRef, versionProperties);
versionService.createVersion(nodeRef, versionProperties);
}
}
private void setWriterContentType(ContentWriter writer, ContentInfoWrapper contentInfo, NodeRef nodeRef, boolean guessEncodingIfNull)
@@ -1754,6 +1756,11 @@ public class NodesImpl implements Nodes
throw new InvalidArgumentException("Required parameters are missing");
}
if (autoRename && overwrite)
{
throw new InvalidArgumentException("Both 'overwrite' and 'autoRename' should not be true when uploading a file");
}
try
{
// Map the given properties, if any.
@@ -1768,8 +1775,6 @@ public class NodesImpl implements Nodes
NodeRef existingFile = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, fileName);
if (existingFile != null)
{
// TODO throw 400 error if both autoRename and overwrite are true ?
// File already exists, decide what to do
if (autoRename)
{