mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Refactor CMIS property accessors (value / lucene mappers).
- remove notion of generic property accessor; consolidated on named property accessor - build property accessors at time of CMIS Dictionary creation (cached, removes continuous creation of small objects); hooked into CMIS Property Definition - remove property service - lookup of property accessor quicker and constrained to properties in CMIS Dictionary - fixup fallout in CMIS AtomPub, Web Services and Query CMIS AtomPub, Web Services and Query tests pass. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13806 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,7 +26,7 @@ package org.alfresco.repo.cmis.rest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.cmis.property.CMISPropertyService;
|
||||
import org.alfresco.cmis.CMISService;
|
||||
import org.alfresco.repo.template.TemplateNode;
|
||||
|
||||
import freemarker.ext.beans.BeanModel;
|
||||
@@ -45,14 +45,14 @@ import freemarker.template.TemplateScalarModel;
|
||||
*/
|
||||
public final class CMISPropertyValueMethod implements TemplateMethodModelEx
|
||||
{
|
||||
private CMISPropertyService propertyService;
|
||||
private CMISService cmisService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public CMISPropertyValueMethod(CMISPropertyService propertyService)
|
||||
public CMISPropertyValueMethod(CMISService cmisService)
|
||||
{
|
||||
this.propertyService = propertyService;
|
||||
this.cmisService = cmisService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public final class CMISPropertyValueMethod implements TemplateMethodModelEx
|
||||
}
|
||||
|
||||
// retrieve property value
|
||||
result = propertyService.getProperty(node.getNodeRef(), propertyName);
|
||||
result = cmisService.getProperty(node.getNodeRef(), propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,9 +33,8 @@ import org.alfresco.cmis.CMISQueryEnum;
|
||||
import org.alfresco.cmis.CMISService;
|
||||
import org.alfresco.cmis.CMISTypesFilterEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.cmis.property.CMISPropertyService;
|
||||
import org.alfresco.cmis.search.CMISQueryOptions;
|
||||
import org.alfresco.cmis.search.CMISQueryService;
|
||||
import org.alfresco.cmis.search.CMISResultSet;
|
||||
@@ -63,7 +62,6 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
private Repository repository;
|
||||
private CMISService cmisService;
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
private CMISPropertyService cmisPropertyService;
|
||||
private CMISQueryService cmisQueryService;
|
||||
private Paging paging;
|
||||
|
||||
@@ -118,16 +116,6 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
this.cmisDictionaryService = cmisDictionaryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CMIS Property Service
|
||||
*
|
||||
* @param cmisPropertyService
|
||||
*/
|
||||
public void setCMISPropertyService(CMISPropertyService cmisPropertyService)
|
||||
{
|
||||
this.cmisPropertyService = cmisPropertyService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CMIS Query Service
|
||||
*
|
||||
@@ -416,22 +404,16 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Property Support
|
||||
//
|
||||
|
||||
/**
|
||||
* Map CMIS Property name to Alfresco property name (only for direct 1 to 1 mappings)
|
||||
* Query the Property Definition for the given Property
|
||||
*
|
||||
* @param propertyName CMIS property name
|
||||
* @return Alfresco property name (or null, if there's no mapping)
|
||||
* @param propertyName
|
||||
* @return
|
||||
*/
|
||||
public QName mapPropertyName(String propertyName)
|
||||
public CMISPropertyDefinition queryProperty(String propertyName)
|
||||
{
|
||||
return cmisPropertyService.mapPropertyName(propertyName);
|
||||
return cmisDictionaryService.findProperty(propertyName, null);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// SQL Query
|
||||
|
@@ -624,10 +624,14 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest
|
||||
protected NodeRef getNodeRef(Entry entry)
|
||||
{
|
||||
NodeRef nodeRef = null;
|
||||
Element element = entry.getFirstChild(new QName("http://www.alfresco.org", "noderef"));
|
||||
if (element != null)
|
||||
CMISObject object = entry.getExtension(CMISConstants.OBJECT);
|
||||
if (object != null)
|
||||
{
|
||||
nodeRef = new NodeRef(element.getText());
|
||||
String strNodeRef = object.getObjectId().getValue();
|
||||
if (strNodeRef != null)
|
||||
{
|
||||
nodeRef = new NodeRef(object.getObjectId().getValue());
|
||||
}
|
||||
}
|
||||
return nodeRef;
|
||||
}
|
||||
|
@@ -44,8 +44,6 @@ import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.cmis.property.CMISPropertyService;
|
||||
import org.alfresco.cmis.search.CMISQueryService;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.cmis.PropertyFilter;
|
||||
@@ -86,7 +84,6 @@ public class DMAbstractServicePort
|
||||
protected CMISDictionaryService cmisDictionaryService;
|
||||
protected CMISQueryService cmisQueryService;
|
||||
protected CMISService cmisService;
|
||||
protected CMISPropertyService cmisPropertyService;
|
||||
protected DescriptorService descriptorService;
|
||||
protected NodeService nodeService;
|
||||
protected VersionService versionService;
|
||||
@@ -101,11 +98,6 @@ public class DMAbstractServicePort
|
||||
this.cmisService = cmisService;
|
||||
}
|
||||
|
||||
public void setCmisPropertyService(CMISPropertyService cmisPropertyService)
|
||||
{
|
||||
this.cmisPropertyService = cmisPropertyService;
|
||||
}
|
||||
|
||||
public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService)
|
||||
{
|
||||
this.cmisDictionaryService = cmisDictionaryService;
|
||||
@@ -273,7 +265,7 @@ public class DMAbstractServicePort
|
||||
Map<String, Serializable> properties;
|
||||
if (NodeRef.isNodeRef(identifier))
|
||||
{
|
||||
properties = cmisPropertyService.getProperties(new NodeRef(identifier));
|
||||
properties = cmisService.getProperties(new NodeRef(identifier));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -37,7 +37,6 @@ import javax.xml.ws.Holder;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryModel;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.cmis.PropertyFilter;
|
||||
import org.alfresco.repo.cmis.ws.DeleteTreeResponse.FailedToDelete;
|
||||
@@ -165,7 +164,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
break;
|
||||
}
|
||||
|
||||
String versionLabel = (String) cmisPropertyService.getProperty(newDocumentNodeRef, CMISDictionaryModel.PROP_VERSION_LABEL);
|
||||
String versionLabel = (String) cmisService.getProperty(newDocumentNodeRef, CMISDictionaryModel.PROP_VERSION_LABEL);
|
||||
return versionLabel != null && versionLabel.contains(VERSION_DELIMETER) ?
|
||||
newDocumentNodeRef.toString() + CmisObjectsUtils.NODE_REFERENCE_ID_DELIMETER + versionLabel :
|
||||
newDocumentNodeRef.toString();
|
||||
@@ -214,7 +213,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
NodeRef newFolderNodeRef = fileFolderService.create(folderNodeRef, name, type.getTypeId().getQName()).getNodeRef();
|
||||
// TODO:
|
||||
// cmisPropertyService.setProperties(newFolderNodeRef, propertiesMap);
|
||||
return (String) cmisPropertyService.getProperty(newFolderNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
return (String) cmisService.getProperty(newFolderNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
}
|
||||
catch (FileExistsException e)
|
||||
{
|
||||
@@ -444,7 +443,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
|
||||
response.setLength(BigInteger.valueOf(reader.getSize()));
|
||||
response.setMimeType(reader.getMimetype());
|
||||
String filename = (String) cmisPropertyService.getProperty(nodeRef, CMISDictionaryModel.PROP_NAME);
|
||||
String filename = (String) cmisService.getProperty(nodeRef, CMISDictionaryModel.PROP_NAME);
|
||||
response.setFilename(filename);
|
||||
response.setStream(new DataHandler(new ContentReaderDataSource(reader, filename)));
|
||||
|
||||
@@ -561,7 +560,7 @@ public class DMObjectServicePort extends DMAbstractServicePort implements Object
|
||||
// TODO: change token
|
||||
|
||||
// no new version
|
||||
objectId.value = (String) cmisPropertyService.getProperty(objectNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
objectId.value = (String) cmisService.getProperty(objectNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -146,7 +146,7 @@ public class DMRepositoryServicePort extends DMAbstractServicePort implements Re
|
||||
repositoryInfoType.setRepositoryName(serverDescriptor.getName());
|
||||
repositoryInfoType.setRepositoryRelationship("self");
|
||||
repositoryInfoType.setRepositoryDescription("");
|
||||
repositoryInfoType.setRootFolderId((String) cmisPropertyService.getProperty(cmisService.getDefaultRootNodeRef(), CMISDictionaryModel.PROP_OBJECT_ID));
|
||||
repositoryInfoType.setRootFolderId((String) cmisService.getProperty(cmisService.getDefaultRootNodeRef(), CMISDictionaryModel.PROP_OBJECT_ID));
|
||||
repositoryInfoType.setVendorName("Alfresco");
|
||||
repositoryInfoType.setProductName("Alfresco Repository (" + serverDescriptor.getEdition() + ")");
|
||||
repositoryInfoType.setProductVersion(serverDescriptor.getVersion());
|
||||
|
@@ -125,7 +125,7 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve
|
||||
}
|
||||
|
||||
NodeRef nodeRef = checkOutCheckInService.checkin(workingCopyNodeRef, createVersionProperties(checkinComment, major != null && major ? VersionType.MAJOR : VersionType.MINOR));
|
||||
documentId.value = (String) cmisPropertyService.getProperty(nodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
documentId.value = (String) cmisService.getProperty(nodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ public class DMVersioningServicePort extends DMAbstractServicePort implements Ve
|
||||
}
|
||||
|
||||
NodeRef pwcNodeRef = checkoutNode(documentNodeRef);
|
||||
documentId.value = (String) cmisPropertyService.getProperty(pwcNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
documentId.value = (String) cmisService.getProperty(pwcNodeRef, CMISDictionaryModel.PROP_OBJECT_ID);
|
||||
contentCopied.value = true;
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ package org.alfresco.repo.cmis.ws.utils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.mapping.CMISMapping;
|
||||
import org.alfresco.model.ContentModel;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user