Merged HEAD (5.2) to 5.2.N (5.2.1)

126528 jkaabimofrad: 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/BRANCHES/DEV/5.2.N/root@126872 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 12:00:33 +00:00
parent 064da30e67
commit 601aa347e9
3 changed files with 359 additions and 11 deletions

View File

@@ -1633,15 +1633,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)
@@ -1761,6 +1763,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.
@@ -1775,8 +1782,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)
{