minor CMIS bug fixes and improvements

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30034 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Florian Mü
2011-08-24 15:44:55 +00:00
parent 6dbcb98f3c
commit 44aa5689bd
2 changed files with 16 additions and 8 deletions

View File

@@ -1142,7 +1142,7 @@ public class AlfrescoCmisService extends AbstractCmisService
final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Folder"); final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Folder");
// get name and type // get name and type
final String name = connector.getNameProperty(properties); final String name = connector.getNameProperty(properties, null);
final String objectTypeId = connector.getObjectTypeIdProperty(properties); final String objectTypeId = connector.getObjectTypeIdProperty(properties);
final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_FOLDER); final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_FOLDER);
@@ -1194,7 +1194,7 @@ public class AlfrescoCmisService extends AbstractCmisService
final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Parent folder"); final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Parent folder");
// get name and type // get name and type
final String name = connector.getNameProperty(properties); final String name = connector.getNameProperty(properties, null);
final String objectTypeId = connector.getObjectTypeIdProperty(properties); final String objectTypeId = connector.getObjectTypeIdProperty(properties);
final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_DOCUMENT); final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_DOCUMENT);
@@ -1288,9 +1288,6 @@ public class AlfrescoCmisService extends AbstractCmisService
// get the parent folder node ref // get the parent folder node ref
final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Parent folder"); final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Parent folder");
// get name and type
final String name = connector.getNameProperty(properties);
// get source // get source
CMISNodeInfo info = getOrCreateNodeInfo(sourceId, "Source"); CMISNodeInfo info = getOrCreateNodeInfo(sourceId, "Source");
@@ -1306,6 +1303,9 @@ public class AlfrescoCmisService extends AbstractCmisService
throw new CmisConstraintException("Source object is not a document!"); throw new CmisConstraintException("Source object is not a document!");
} }
// get name and type
final String name = connector.getNameProperty(properties, info.getName());
final TypeDefinitionWrapper type = info.getType(); final TypeDefinitionWrapper type = info.getType();
connector.checkChildObjectType(parentInfo, type.getTypeId()); connector.checkChildObjectType(parentInfo, type.getTypeId());
@@ -2005,7 +2005,9 @@ public class AlfrescoCmisService extends AbstractCmisService
try try
{ {
NodeRef pwcNodeRef = connector.getCheckOutCheckInService().checkout(nodeRef); NodeRef pwcNodeRef = connector.getCheckOutCheckInService().checkout(nodeRef);
objectId.setValue(pwcNodeRef.toString()); CMISNodeInfo pwcNodeInfo = createNodeInfo(pwcNodeRef);
objectId.setValue(pwcNodeInfo.getObjectId());
if (contentCopied != null) if (contentCopied != null)
{ {
contentCopied.setValue(connector.getFileFolderService().getReader(pwcNodeRef) != null); contentCopied.setValue(connector.getFileFolderService().getReader(pwcNodeRef) != null);

View File

@@ -2478,12 +2478,18 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
return ((PropertyId) property).getFirstValue(); return ((PropertyId) property).getFirstValue();
} }
public String getNameProperty(Properties properties) public String getNameProperty(Properties properties, String fallback)
{ {
String name = getStringProperty(properties, PropertyIds.NAME); String name = getStringProperty(properties, PropertyIds.NAME);
if ((name == null) || (name.trim().length() == 0)) if ((name == null) || (name.trim().length() == 0))
{
if (fallback == null)
{ {
throw new CmisInvalidArgumentException("Property " + PropertyIds.NAME + " must be set!"); throw new CmisInvalidArgumentException("Property " + PropertyIds.NAME + " must be set!");
} else
{
name = fallback;
}
} }
return name; return name;