CMIS Web Services: Fix retrieval of content stream for sub-types of Content.

For AIIM demo.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13756 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-03-26 19:05:28 +00:00
parent 73bdb168c4
commit 2280b0ada7
2 changed files with 11 additions and 5 deletions

View File

@@ -117,6 +117,7 @@ public class CMISCustomTypeTest extends BaseCMISWebScriptTest
props.put(QName.createQName(TEST_NAMESPACE, "Title"), "createSubTypeTitle");
props.put(QName.createQName(TEST_NAMESPACE, "Authors"), (Serializable)Arrays.asList(new String[] { "Dave", "Fred" }));
nodeService.addProperties(file.getNodeRef(), props);
fileFolderService.getWriter(file.getNodeRef()).putContent("Some test content");
return null;
}
}, getDefaultRunAs());

View File

@@ -29,6 +29,8 @@ import java.util.List;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISScope;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.cmis.ws.EnumObjectType;
import org.alfresco.repo.cmis.ws.InvalidArgumentException;
@@ -135,7 +137,7 @@ public class CmisObjectsUtils
return result;
}
throw new InvalidArgumentException("Unexpected object type of the specified Object Identifier");
throw new InvalidArgumentException("Unexpected object type of the specified Object Identifier " + identifier);
}
public void deleteFolder(NodeRef folderNodeReference, boolean continueOnFailure, boolean totalDeletion, List<String> resultList)
@@ -352,13 +354,16 @@ public class CmisObjectsUtils
private AlfrescoObjectType determineActualObjectType(AlfrescoObjectType expectedType, QName objectType)
{
if (expectedType != AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT)
CMISTypeId typeId = cmisMapping.getCmisTypeId(objectType);
if ((expectedType == AlfrescoObjectType.DOCUMENT_OBJECT || expectedType == AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT)
&& typeId.getScope() == CMISScope.DOCUMENT)
{
return AlfrescoObjectType.fromValue(objectType.toString());
return expectedType;
}
else if (DOCUMENT_AND_FOLDER_TYPES.contains(objectType))
if ((expectedType == AlfrescoObjectType.FOLDER_OBJECT || expectedType == AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT)
&& typeId.getScope() == CMISScope.FOLDER)
{
return AlfrescoObjectType.DOCUMENT_OR_FOLDER_OBJECT;
return expectedType;
}
return AlfrescoObjectType.ANY_OBJECT;
}