Merged CMIS063 to HEAD

16884: Check point for MOB-566: Update Query to 0.7
  16885: CMIS 0.7 upgrade checkpoint.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17242 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-10-29 18:23:03 +00:00
parent ec7bb80cf3
commit 93346e262e
3 changed files with 58 additions and 7 deletions

View File

@@ -24,12 +24,61 @@ script:
break script; break script;
} }
// is this a create or move?
var object = entry.getExtension(atom.names.cmisra_object);
var objectIdProp = (object !== null) ? object.objectId : null;
var objectId = (objectIdProp !== null) ? objectIdProp.nativeValue : null;
var node = null;
if (objectId == null)
{
// create node // create node
var node = createNode(model.parent, entry, slug); node = createNode(model.parent, entry, slug);
if (node == null) if (node == null)
{ {
break script; break script;
} }
}
else
{
// move node
var sourceFolderId = args[cmis.ARG_SOURCE_FOLDER_ID];
if (sourceFolderId == null)
{
status.code = 400;
status.message = "Move of object " + objectId + " requires sourceFolderId argument";
status.redirect = true;
break script;
}
// locate node and its source folder
node = search.findNode(objectId);
if (node == null)
{
status.code = 400;
status.message = "Object " + objectId + " does not exist";
status.redirect = true;
break script;
}
sourceFolder = search.findNode(sourceFolderId);
if (sourceFolder == null || !(sourceFolder.nodeRef.equals(node.parent.nodeRef)))
{
status.code = 400;
status.message = "Source Folder " + sourceFolderId + " is not valid for object " + objectId;
status.redirect = true;
break script;
}
// perform move
var success = node.move(model.parent);
if (!success)
{
status.code = 500;
status.message = "Failed to move object " + objectId + " from folder " + sourceFolderId + " to folder " + model.parent.nodeRef;
status.redirect = true;
break script;
}
}
// success // success
node.save(); node.save();

View File

@@ -41,8 +41,8 @@ If the to-be-created Folders Object Type is not one of the “Allowed_Child_O
Root folder can not be created using this service.<br> Root folder can not be created using this service.<br>
]]> ]]>
</description> </description>
<url>/api/node/{store_type}/{store_id}/{id}/children</url> <url>/api/node/{store_type}/{store_id}/{id}/children?sourceFolderId={sourceFolderId}</url>
<url>/api/path/{store_type}/{store_id}/{id}/children</url> <url>/api/path/{store_type}/{store_id}/{id}/children?sourceFolderId={sourceFolderId}</url>
<authentication>user</authentication> <authentication>user</authentication>
<format default="atomentry"/> <format default="atomentry"/>
<family>CMIS</family> <family>CMIS</family>

View File

@@ -96,6 +96,8 @@ public class CMISScript extends BaseScopableProcessorExtension
public static final String ARG_TYPES = "types"; public static final String ARG_TYPES = "types";
public static final String ARG_UNFILE_MULTIFILE_DOCUMENTS = "unfileMultiFiledDocuments"; public static final String ARG_UNFILE_MULTIFILE_DOCUMENTS = "unfileMultiFiledDocuments";
public static final String ARG_VERSIONING_STATE = "versioningState"; public static final String ARG_VERSIONING_STATE = "versioningState";
public static final String ARG_SOURCE_FOLDER_ID = "sourceFolderId";
// service dependencies // service dependencies
private ServiceRegistry services; private ServiceRegistry services;