mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merging /BRANCHES/DEV/BELARUS/HEAD-2010_03_09/ to HEAD:
19162: Bug related to properties receiving in PropertyUtil was fixed. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19164 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -37,6 +37,7 @@ import org.alfresco.cmis.CMISInvalidArgumentException;
|
||||
import org.alfresco.cmis.CMISRenditionKind;
|
||||
import org.alfresco.cmis.CMISScope;
|
||||
import org.alfresco.cmis.CMISServiceException;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.cmis.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.CMISVersioningStateEnum;
|
||||
import org.alfresco.repo.cmis.PropertyFilter;
|
||||
@@ -48,6 +49,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.FileTypeImageSize;
|
||||
@@ -320,8 +322,8 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
{
|
||||
throw ExceptionUtil.createCmisException("Target object type isn't allowed as target type", EnumServiceException.CONSTRAINT);
|
||||
}
|
||||
String createdId = nodeService.createAssociation(sourceNodeRef, targetNodeRef, relationshipTypeQName).toString();
|
||||
objectId.value = createdId;
|
||||
AssociationRef assocRef = nodeService.createAssociation(sourceNodeRef, targetNodeRef, relationshipTypeQName);
|
||||
objectId.value = CMISServices.ASSOC_ID_PREFIX + assocRef.getId();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -428,7 +430,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
|
||||
try
|
||||
{
|
||||
NodeRef object = cmisService.getReadableObject(objectId, NodeRef.class);
|
||||
Object object = cmisService.getReadableObject(objectId, Object.class);
|
||||
PropertyFilter propertyFilter = createPropertyFilter(filter);
|
||||
CmisObjectType cmisObject = createCmisObject(object, propertyFilter, includeRelationships,
|
||||
includeAllowableActions, renditionFilter);
|
||||
|
@@ -471,14 +471,14 @@ public class PropertyUtil
|
||||
aspectProperties.putAll(cmisService.getProperties((NodeRef)object, typeDef));
|
||||
}
|
||||
CmisPropertiesType aspectResult = new CmisPropertiesType();
|
||||
convertToCmisProperties(aspectProperties, filter, aspectResult);
|
||||
convertToCmisProperties(object, aspectProperties, filter, aspectResult);
|
||||
extension.setProperties(aspectResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
properties = createBaseRelationshipProperties((AssociationRef) object);
|
||||
}
|
||||
convertToCmisProperties(properties, filter, result);
|
||||
convertToCmisProperties(object, properties, filter, result);
|
||||
return result;
|
||||
}
|
||||
catch (CMISInvalidArgumentException e)
|
||||
@@ -491,7 +491,7 @@ public class PropertyUtil
|
||||
{
|
||||
Map<String, Serializable> result = new HashMap<String, Serializable>();
|
||||
result.put(CMISDictionaryModel.PROP_OBJECT_TYPE_ID, cmisDictionaryService.findTypeForClass(association.getTypeQName(), CMISScope.RELATIONSHIP).getTypeId());
|
||||
result.put(CMISDictionaryModel.PROP_OBJECT_ID, association.toString());
|
||||
result.put(CMISDictionaryModel.PROP_OBJECT_ID, CMISServices.ASSOC_ID_PREFIX + association.getId());
|
||||
result.put(BASE_TYPE_PROPERTY_NAME, CMISDictionaryModel.RELATIONSHIP_TYPE_ID.getId());
|
||||
result.put(CMISDictionaryModel.PROP_CREATED_BY, AuthenticationUtil.getFullyAuthenticatedUser());
|
||||
result.put(CMISDictionaryModel.PROP_CREATION_DATE, new Date());
|
||||
@@ -500,14 +500,36 @@ public class PropertyUtil
|
||||
return result;
|
||||
}
|
||||
|
||||
private void convertToCmisProperties(Map<String, Serializable> properties, PropertyFilter filter, CmisPropertiesType cmisProperties) throws CmisException
|
||||
private void convertToCmisProperties(Object object, Map<String, Serializable> properties, PropertyFilter filter, CmisPropertiesType cmisProperties) throws CmisException
|
||||
{
|
||||
String typeId = properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID) != null ? properties.get(CMISDictionaryModel.PROP_OBJECT_TYPE_ID).toString() : null;
|
||||
CMISTypeDefinition type = cmisDictionaryService.findType(typeId);
|
||||
CMISTypeDefinition type = null;
|
||||
if (object instanceof NodeRef)
|
||||
{
|
||||
try
|
||||
{
|
||||
type = cmisService.getTypeDefinition((NodeRef) object);
|
||||
}
|
||||
catch (CMISInvalidArgumentException e)
|
||||
{
|
||||
throw ExceptionUtil.createCmisException(e.getMessage(), EnumServiceException.INVALID_ARGUMENT);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
type = cmisService.getTypeDefinition((AssociationRef) object);
|
||||
}
|
||||
catch (CMISInvalidArgumentException e)
|
||||
{
|
||||
throw ExceptionUtil.createCmisException(e.getMessage(), EnumServiceException.INVALID_ARGUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
if (null == type)
|
||||
{
|
||||
throw ExceptionUtil.createCmisException(("Type with " + typeId + " typeId was not found"), EnumServiceException.RUNTIME);
|
||||
throw ExceptionUtil.createCmisException(("Type for object " + object + " was not found"), EnumServiceException.RUNTIME);
|
||||
}
|
||||
|
||||
for (String propertyName : properties.keySet())
|
||||
|
Reference in New Issue
Block a user