mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
MOB-378 (AtomPub binding) Support for sub-types (and properties)
- 1st pass at creation of document / folder sub-types - 1st pass at setting / updating custom properties - Existing AtomPub CMIS Tests passing git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13707 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package org.alfresco.cmis.property;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* Base class for generic property accessors
|
||||
@@ -34,5 +37,9 @@ package org.alfresco.cmis.property;
|
||||
public abstract class AbstractGenericPropertyAccessor extends AbstractPropertyAccessor implements GenericPropertyAccessor
|
||||
{
|
||||
|
||||
protected AbstractGenericPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,7 +24,9 @@
|
||||
*/
|
||||
package org.alfresco.cmis.property;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
* Base class for named property accessors
|
||||
@@ -35,26 +37,24 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
public abstract class AbstractNamedPropertyAccessor extends AbstractPropertyAccessor implements NamedPropertyAccessor
|
||||
{
|
||||
private String propertyName;
|
||||
|
||||
private CMISScope scope;
|
||||
|
||||
public String getPropertyName()
|
||||
{
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
public void setPropertyName(String propertyName)
|
||||
protected AbstractNamedPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, CMISScope scope, String propertyName)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry);
|
||||
this.scope = scope;
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
||||
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(CMISScope scope)
|
||||
public String getPropertyName()
|
||||
{
|
||||
this.scope = scope;
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -38,25 +38,19 @@ public abstract class AbstractPropertyAccessor
|
||||
private CMISMapping cmisMapping;
|
||||
private ServiceRegistry serviceRegistry;
|
||||
|
||||
/**
|
||||
* @param cmisMapping
|
||||
*/
|
||||
public void setCMISMapping(CMISMapping cmisMapping)
|
||||
|
||||
protected AbstractPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.cmisMapping = cmisMapping;
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
|
||||
public ServiceRegistry getServiceRegistry()
|
||||
protected ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
public CMISMapping getCMISMapping()
|
||||
protected CMISMapping getCMISMapping()
|
||||
{
|
||||
return cmisMapping;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Public API to get and set CMIS properties
|
||||
@@ -38,6 +39,14 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
*/
|
||||
public interface CMISPropertyService
|
||||
{
|
||||
/**
|
||||
* Map CMIS Property name to Alfresco property name (only for direct 1 to 1 mappings)
|
||||
*
|
||||
* @param propertyName CMIS property name
|
||||
* @return Alfresco property name (or null, if there's no mapping)
|
||||
*/
|
||||
public QName mapPropertyName(String propertyName);
|
||||
|
||||
/**
|
||||
* Set a single property
|
||||
* @param nodeRef
|
||||
@@ -66,7 +75,7 @@ public interface CMISPropertyService
|
||||
* @param nodeRef
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Serializable> getProperties(NodeRef nodeRef);
|
||||
public Map<String, Serializable> getProperties(NodeRef nodeRef);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -30,10 +30,11 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISService;
|
||||
import org.alfresco.cmis.CMISContentStreamAllowedEnum;
|
||||
import org.alfresco.cmis.CMISService;
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
@@ -105,6 +106,17 @@ public class CMISPropertyServiceImpl implements CMISPropertyService, Initializin
|
||||
this.strict = strict;
|
||||
}
|
||||
|
||||
public QName mapPropertyName(String propertyName)
|
||||
{
|
||||
NamedPropertyAccessor accessor = namedPropertyAccessors.get(propertyName);
|
||||
if (accessor != null && !(accessor instanceof SimplePropertyAccessor))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return cmisMapping.getPropertyQName(propertyName);
|
||||
}
|
||||
|
||||
public Map<String, Serializable> getProperties(NodeRef nodeRef)
|
||||
{
|
||||
// Map
|
||||
@@ -153,7 +165,6 @@ public class CMISPropertyServiceImpl implements CMISPropertyService, Initializin
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef, String propertyName)
|
||||
{
|
||||
|
||||
QName typeQName = cmisMapping.getCmisType(serviceRegistry.getNodeService().getType(nodeRef));
|
||||
CMISScope scope;
|
||||
if (cmisMapping.isValidCmisDocument(typeQName))
|
||||
@@ -197,7 +208,6 @@ public class CMISPropertyServiceImpl implements CMISPropertyService, Initializin
|
||||
return genericPropertyAccessor.getProperty(nodeRef, propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setProperties(NodeRef nodeRef, Map<String, Serializable> values)
|
||||
@@ -207,15 +217,43 @@ public class CMISPropertyServiceImpl implements CMISPropertyService, Initializin
|
||||
|
||||
public void setProperty(NodeRef nodeRef, String propertyName, Serializable value)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
QName typeQName = cmisMapping.getCmisType(serviceRegistry.getNodeService().getType(nodeRef));
|
||||
CMISScope scope;
|
||||
if (cmisMapping.isValidCmisDocument(typeQName))
|
||||
{
|
||||
scope = CMISScope.DOCUMENT;
|
||||
}
|
||||
else if (cmisMapping.isValidCmisFolder(typeQName))
|
||||
{
|
||||
scope = CMISScope.FOLDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Node type " + typeQName + " is not a valid CMIS document or folder");
|
||||
}
|
||||
|
||||
NamedPropertyAccessor accessor = namedPropertyAccessors.get(propertyName);
|
||||
if (accessor != null)
|
||||
{
|
||||
if ((accessor.getScope() == CMISScope.OBJECT) || accessor.getScope().equals(scope))
|
||||
{
|
||||
accessor.setProperty(nodeRef, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Property " + propertyName + " is not applicable for type " + typeQName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
genericPropertyAccessor.setProperty(nodeRef, propertyName, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
// Generic Alfresco mappings
|
||||
genericPropertyAccessor = new MappingPropertyAccessor();
|
||||
genericPropertyAccessor.setServiceRegistry(serviceRegistry);
|
||||
genericPropertyAccessor.setCMISMapping(cmisMapping);
|
||||
genericPropertyAccessor = new MappingPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
|
||||
// CMIS Object
|
||||
addNamedPropertyAccessor(getObjectIdPropertyAccessor());
|
||||
@@ -254,160 +292,94 @@ public class CMISPropertyServiceImpl implements CMISPropertyService, Initializin
|
||||
|
||||
public void addNamedPropertyAccessor(NamedPropertyAccessor namedPropertyAccessor)
|
||||
{
|
||||
|
||||
namedPropertyAccessors.put(namedPropertyAccessor.getPropertyName(), namedPropertyAccessor);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getSimplePropertyAccessor(String propertyName, QName to, CMISScope scope)
|
||||
{
|
||||
SimplePropertyAccessor accessor = new SimplePropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
accessor.setPropertyName(propertyName);
|
||||
accessor.setMapping(to.toString());
|
||||
accessor.setScope(scope);
|
||||
try
|
||||
{
|
||||
accessor.afterPropertiesSet();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return accessor;
|
||||
return new SimplePropertyAccessor(cmisMapping, serviceRegistry, scope, propertyName, to);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getObjectIdPropertyAccessor()
|
||||
{
|
||||
ObjectIdPropertyAccessor accessor = new ObjectIdPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new ObjectIdPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getFixedValuePropertyAccessor(String propertyName, Serializable fixedValue, CMISScope scope)
|
||||
{
|
||||
FixedValuePropertyAccessor accessor = new FixedValuePropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
accessor.setPropertyName(propertyName);
|
||||
FixedValuePropertyAccessor accessor = new FixedValuePropertyAccessor(cmisMapping, serviceRegistry, scope, propertyName);
|
||||
accessor.setFixedValue(fixedValue);
|
||||
accessor.setScope(scope);
|
||||
return accessor;
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getObjectTypeIdPropertyAccessor()
|
||||
{
|
||||
ObjectTypeIdPropertyAccessor accessor = new ObjectTypeIdPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new ObjectTypeIdPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getIsImmutablePropertyAccessor()
|
||||
{
|
||||
IsImmutablePropertyAccessor accessor = new IsImmutablePropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new IsImmutablePropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getIsLatestVersionPropertyAccessor()
|
||||
{
|
||||
IsLatestVersionPropertyAccessor accessor = new IsLatestVersionPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new IsLatestVersionPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getIsMajorVersionPropertyAccessor()
|
||||
{
|
||||
IsMajorVersionPropertyAccessor accessor = new IsMajorVersionPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new IsMajorVersionPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getIsLatestMajorVersionPropertyAccessor()
|
||||
{
|
||||
IsLatestMajorVersionPropertyAccessor accessor = new IsLatestMajorVersionPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new IsLatestMajorVersionPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getVersionSeriesIdPropertyAccessor()
|
||||
{
|
||||
VersionSeriesIdPropertyAccessor accessor = new VersionSeriesIdPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new VersionSeriesIdPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getVersionSeriesIsCheckedOutPropertyAccessor()
|
||||
{
|
||||
IsVersionSeriesCheckedOutPropertyAccessor accessor = new IsVersionSeriesCheckedOutPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new IsVersionSeriesCheckedOutPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getVersionSeriesCheckedOutByPropertyAccessor()
|
||||
{
|
||||
VersionSeriesCheckedOutByPropertyAccessor accessor = new VersionSeriesCheckedOutByPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new VersionSeriesCheckedOutByPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getVersionSeriesCheckedOutIdPropertyAccessor()
|
||||
{
|
||||
VersionSeriesCheckedOutIdPropertyAccessor accessor = new VersionSeriesCheckedOutIdPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new VersionSeriesCheckedOutIdPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getCheckinCommentPropertyAccessor()
|
||||
{
|
||||
CheckinCommentPropertyAccessor accessor = new CheckinCommentPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new CheckinCommentPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getContentStreamLengthPropertyAccessor()
|
||||
{
|
||||
ContentStreamLengthPropertyAccessor accessor = new ContentStreamLengthPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new ContentStreamLengthPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getContentStreamMimetypePropertyAccessor()
|
||||
{
|
||||
ContentStreamMimetypePropertyAccessor accessor = new ContentStreamMimetypePropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new ContentStreamMimetypePropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getContentStreamUriPropertyAccessor()
|
||||
{
|
||||
ContentStreamUriPropertyAccessor accessor = new ContentStreamUriPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
return accessor;
|
||||
return new ContentStreamUriPropertyAccessor(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public NamedPropertyAccessor getParentPropertyAccessor()
|
||||
{
|
||||
ParentPropertyAccessor accessor = new ParentPropertyAccessor();
|
||||
accessor.setServiceRegistry(serviceRegistry);
|
||||
accessor.setCMISMapping(cmisMapping);
|
||||
accessor.setCMISService(cmisService);
|
||||
return accessor;
|
||||
return new ParentPropertyAccessor(cmisMapping, serviceRegistry, cmisService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -31,6 +31,7 @@ import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.apache.lucene.search.Query;
|
||||
@@ -42,6 +43,11 @@ import org.apache.lucene.search.Query;
|
||||
*/
|
||||
public class CheckinCommentPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
protected CheckinCommentPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CHECKIN_COMMENT);
|
||||
}
|
||||
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
@@ -56,18 +62,13 @@ public class CheckinCommentPropertyAccessor extends AbstractNamedPropertyAccesso
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_CHECKIN_COMMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -176,4 +177,5 @@ public class CheckinCommentPropertyAccessor extends AbstractNamedPropertyAccesso
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -52,6 +53,11 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
||||
public class ContentStreamLengthPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected ContentStreamLengthPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CONTENT_STREAM_LENGTH);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
Serializable value = getServiceRegistry().getNodeService().getProperty(nodeRef, ContentModel.PROP_CONTENT);
|
||||
@@ -67,16 +73,9 @@ public class ContentStreamLengthPropertyAccessor extends AbstractNamedPropertyAc
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_CONTENT_STREAM_LENGTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private String getLuceneFieldName()
|
||||
@@ -271,4 +270,5 @@ public class ContentStreamLengthPropertyAccessor extends AbstractNamedPropertyAc
|
||||
{
|
||||
return getLuceneFieldName();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -52,6 +53,11 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
||||
public class ContentStreamMimetypePropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected ContentStreamMimetypePropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
Serializable value = getServiceRegistry().getNodeService().getProperty(nodeRef, ContentModel.PROP_CONTENT);
|
||||
@@ -64,19 +70,11 @@ public class ContentStreamMimetypePropertyAccessor extends AbstractNamedProperty
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_CONTENT_STREAM_MIME_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private String getLuceneFieldName()
|
||||
@@ -271,4 +269,5 @@ public class ContentStreamMimetypePropertyAccessor extends AbstractNamedProperty
|
||||
{
|
||||
return getLuceneFieldName();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
import org.apache.lucene.search.Query;
|
||||
@@ -44,6 +45,11 @@ import org.apache.lucene.search.Query;
|
||||
public class ContentStreamUriPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected ContentStreamUriPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_CONTENT_STREAM_URI);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -58,16 +64,9 @@ public class ContentStreamUriPropertyAccessor extends AbstractNamedPropertyAcces
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_CONTENT_STREAM_URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -29,9 +29,11 @@ import java.util.Collection;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
@@ -49,6 +51,12 @@ import org.apache.lucene.search.TermQuery;
|
||||
*/
|
||||
public class FixedValuePropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected FixedValuePropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, CMISScope scope, String propertyName)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, scope, propertyName);
|
||||
}
|
||||
|
||||
Serializable fixedValue;
|
||||
|
||||
public Serializable getFixedValue()
|
||||
@@ -66,6 +74,11 @@ public class FixedValuePropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
return fixedValue;
|
||||
}
|
||||
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@@ -48,6 +48,15 @@ public interface GenericPropertyAccessor
|
||||
* @return
|
||||
*/
|
||||
public Serializable getProperty(NodeRef nodeRef, String propertyName);
|
||||
|
||||
/**
|
||||
* Set the property value
|
||||
*
|
||||
* @param nodeRef
|
||||
* @param propertyName
|
||||
* @Param value
|
||||
*/
|
||||
public void setProperty(NodeRef nodeRef, String propertyName, Serializable value);
|
||||
|
||||
public Query buildLuceneEquality(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException;
|
||||
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
@@ -46,6 +47,11 @@ import org.apache.lucene.search.Query;
|
||||
public class IsImmutablePropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected IsImmutablePropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_IMMUTABLE);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
LockType type = getServiceRegistry().getLockService().getLockType(nodeRef);
|
||||
@@ -63,19 +69,11 @@ public class IsImmutablePropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
}
|
||||
}
|
||||
return Boolean.valueOf(false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_IS_IMMUTABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -24,19 +24,166 @@
|
||||
*/
|
||||
package org.alfresco.cmis.property;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionType;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
import org.apache.lucene.search.Query;
|
||||
|
||||
/**
|
||||
* Property accessor for CMIS is latest major version
|
||||
* Accessor for CMIS is latest major version property
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public class IsLatestMajorVersionPropertyAccessor extends IsMajorVersionPropertyAccessor
|
||||
public class IsLatestMajorVersionPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
|
||||
protected IsLatestMajorVersionPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
return CMISMapping.PROP_IS_LATEST_MAJOR_VERSION;
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_LATEST_MAJOR_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
if (getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Version version = getServiceRegistry().getVersionService().getCurrentVersion(nodeRef);
|
||||
if (version != null)
|
||||
{
|
||||
return (version.getVersionType() == VersionType.MAJOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneEquality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneEquality(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneExists(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.lang.Boolean)
|
||||
*/
|
||||
public Query buildLuceneExists(LuceneQueryParser lqp, String propertyName, Boolean not) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneGreaterThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneGreaterThan(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneGreaterThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneIn(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.util.Collection, java.lang.Boolean,
|
||||
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneIn(LuceneQueryParser lqp, String propertyName, Collection<Serializable> values, Boolean not, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneInequality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneInequality(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneLessThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneLessThan(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneLessThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
|
||||
*/
|
||||
public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, String propertyName, Serializable value, PredicateMode mode) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneLike(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
|
||||
* java.lang.String, java.io.Serializable, java.lang.Boolean)
|
||||
*/
|
||||
public Query buildLuceneLike(LuceneQueryParser lqp, String propertyName, Serializable value, Boolean not) throws ParseException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.property.NamedPropertyAccessor#getLuceneSortField(java.lang.String)
|
||||
*/
|
||||
public String getLuceneSortField(String propertyName)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
import org.apache.lucene.search.Query;
|
||||
@@ -44,21 +45,19 @@ import org.apache.lucene.search.Query;
|
||||
public class IsLatestVersionPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected IsLatestVersionPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_LATEST_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
return !getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_IS_LATEST_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionType;
|
||||
@@ -46,6 +47,11 @@ import org.apache.lucene.search.Query;
|
||||
public class IsMajorVersionPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected IsMajorVersionPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_MAJOR_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
if (getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
|
||||
@@ -66,18 +72,12 @@ public class IsMajorVersionPropertyAccessor extends AbstractNamedPropertyAccesso
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_IS_MAJOR_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
@@ -45,6 +46,11 @@ import org.apache.lucene.search.Query;
|
||||
public class IsVersionSeriesCheckedOutPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected IsVersionSeriesCheckedOutPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
if (getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
|
||||
@@ -66,16 +72,9 @@ public class IsVersionSeriesCheckedOutPropertyAccessor extends AbstractNamedProp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_IS_VERSION_SERIES_CHECKED_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -27,8 +27,10 @@ package org.alfresco.cmis.property;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
@@ -48,13 +50,23 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
||||
*/
|
||||
public class MappingPropertyAccessor extends AbstractGenericPropertyAccessor
|
||||
{
|
||||
|
||||
protected MappingPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef, String propertyName)
|
||||
{
|
||||
QName propertyQname = getCMISMapping().getPropertyQName(propertyName);
|
||||
return getServiceRegistry().getNodeService().getProperty(nodeRef, propertyQname);
|
||||
}
|
||||
|
||||
|
||||
public void setProperty(NodeRef nodeRef, String propertyName, Serializable value)
|
||||
{
|
||||
QName propertyQname = getCMISMapping().getPropertyQName(propertyName);
|
||||
getServiceRegistry().getNodeService().setProperty(nodeRef, propertyQname, value);
|
||||
}
|
||||
|
||||
|
||||
private String getLuceneFieldName(QName propertyQname)
|
||||
@@ -277,6 +289,6 @@ public class MappingPropertyAccessor extends AbstractGenericPropertyAccessor
|
||||
QName propertyQname = getCMISMapping().getPropertyQName(propertyName);
|
||||
return getLuceneFieldName(propertyQname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -55,6 +55,14 @@ public interface NamedPropertyAccessor
|
||||
* @return
|
||||
*/
|
||||
public Serializable getProperty(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Set the property value
|
||||
*
|
||||
* @param nodeRef
|
||||
* @Param value
|
||||
*/
|
||||
public void setProperty(NodeRef nodeRef, Serializable value);
|
||||
|
||||
/**
|
||||
* To what types of objects does this property apply?
|
||||
|
@@ -33,6 +33,7 @@ import org.alfresco.cmis.search.CMISQueryException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
@@ -52,6 +53,11 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
||||
public class ObjectIdPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected ObjectIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.OBJECT, CMISMapping.PROP_OBJECT_ID);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
if (getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
|
||||
@@ -73,18 +79,10 @@ public class ObjectIdPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_OBJECT_ID;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.OBJECT;
|
||||
}
|
||||
|
||||
|
||||
private String getLuceneFieldName()
|
||||
{
|
||||
|
@@ -34,7 +34,7 @@ import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.cmis.search.CMISQueryException;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -53,6 +53,10 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
||||
*/
|
||||
public class ObjectTypeIdPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
protected ObjectTypeIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.OBJECT, CMISMapping.PROP_OBJECT_TYPE_ID);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
@@ -73,16 +77,9 @@ public class ObjectTypeIdPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
return getCMISMapping().getCmisTypeId(scope, typeQName).getTypeId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_OBJECT_TYPE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.OBJECT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private String getLuceneFieldName()
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -53,17 +54,13 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
||||
public class ParentPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
private CMISService cmisService;
|
||||
|
||||
|
||||
/**
|
||||
* @param cmisService
|
||||
*/
|
||||
public void setCMISService(CMISService cmisService)
|
||||
|
||||
protected ParentPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, CMISService cmisService)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.FOLDER, CMISMapping.PROP_PARENT_ID);
|
||||
this.cmisService = cmisService;
|
||||
}
|
||||
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
if (nodeRef.equals(cmisService.getDefaultRootNodeRef()))
|
||||
@@ -82,20 +79,11 @@ public class ParentPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_PARENT_ID;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.FOLDER;
|
||||
}
|
||||
|
||||
private String getLuceneFieldName()
|
||||
{
|
||||
return "PARENT";
|
||||
|
@@ -27,8 +27,11 @@ package org.alfresco.cmis.property;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
@@ -40,22 +43,20 @@ import org.apache.lucene.search.MatchAllDocsQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.search.BooleanClause.Occur;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* A simple 1-1 property mapping from a CMIS property name to an alfresco property
|
||||
*
|
||||
* @author andyh
|
||||
*/
|
||||
public class SimplePropertyAccessor extends AbstractNamedPropertyAccessor implements InitializingBean
|
||||
public class SimplePropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
private QName propertyQname;
|
||||
|
||||
private String mapping;
|
||||
|
||||
public void setMapping(String mapping)
|
||||
protected SimplePropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, CMISScope scope, String propertyName, QName mapping)
|
||||
{
|
||||
this.mapping = mapping;
|
||||
super(cmisMapping, serviceRegistry, scope, propertyName);
|
||||
propertyQname = mapping;
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
@@ -63,11 +64,11 @@ public class SimplePropertyAccessor extends AbstractNamedPropertyAccessor implem
|
||||
return getServiceRegistry().getNodeService().getProperty(nodeRef, propertyQname);
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
propertyQname = QName.resolveToQName(getServiceRegistry().getNamespaceService(), mapping);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
private String getLuceneFieldName()
|
||||
{
|
||||
StringBuilder field = new StringBuilder(64);
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
@@ -45,6 +46,11 @@ import org.apache.lucene.search.Query;
|
||||
public class VersionSeriesCheckedOutByPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
|
||||
protected VersionSeriesCheckedOutByPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
if (getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
|
||||
@@ -72,17 +78,10 @@ public class VersionSeriesCheckedOutByPropertyAccessor extends AbstractNamedProp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
@@ -44,6 +45,10 @@ import org.apache.lucene.search.Query;
|
||||
*/
|
||||
public class VersionSeriesCheckedOutIdPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
protected VersionSeriesCheckedOutIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID);
|
||||
}
|
||||
|
||||
public Serializable getProperty(NodeRef nodeRef)
|
||||
{
|
||||
@@ -64,21 +69,14 @@ public class VersionSeriesCheckedOutIdPropertyAccessor extends AbstractNamedProp
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_ID;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
import org.apache.lucene.search.Query;
|
||||
@@ -41,6 +42,10 @@ import org.apache.lucene.search.Query;
|
||||
*/
|
||||
public class VersionSeriesIdPropertyAccessor extends AbstractNamedPropertyAccessor
|
||||
{
|
||||
protected VersionSeriesIdPropertyAccessor(CMISMapping cmisMapping, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(cmisMapping, serviceRegistry, CMISScope.DOCUMENT, CMISMapping.PROP_VERSION_SERIES_ID);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -57,16 +62,9 @@ public class VersionSeriesIdPropertyAccessor extends AbstractNamedPropertyAccess
|
||||
return nodeRef.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName()
|
||||
public void setProperty(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
return CMISMapping.PROP_VERSION_SERIES_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CMISScope getScope()
|
||||
{
|
||||
return CMISScope.DOCUMENT;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -176,5 +174,4 @@ public class VersionSeriesIdPropertyAccessor extends AbstractNamedPropertyAccess
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user