mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,47 +1,47 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Base class for all action evaluators
|
||||
*
|
||||
* @author davidc
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractActionEvaluator implements CMISActionEvaluator
|
||||
{
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private Action action;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
*/
|
||||
protected AbstractActionEvaluator(ServiceRegistry serviceRegistry, Action action)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return service registry
|
||||
*/
|
||||
protected ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.opencmis.CMISActionEvaluator#getAction()
|
||||
*/
|
||||
public Action getAction()
|
||||
{
|
||||
return action;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Base class for all action evaluators
|
||||
*
|
||||
* @author davidc
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractActionEvaluator implements CMISActionEvaluator
|
||||
{
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private Action action;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
*/
|
||||
protected AbstractActionEvaluator(ServiceRegistry serviceRegistry, Action action)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return service registry
|
||||
*/
|
||||
protected ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.opencmis.CMISActionEvaluator#getAction()
|
||||
*/
|
||||
public Action getAction()
|
||||
{
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
@@ -1,142 +1,142 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Base class for all property accessors
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractProperty implements CMISPropertyAccessor
|
||||
{
|
||||
public static final String CONTENT_PROPERTY = "::content";
|
||||
|
||||
private ServiceRegistry serviceRegistry;
|
||||
protected CMISConnector connector;
|
||||
private String propertyName;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param propertyName String
|
||||
*/
|
||||
protected AbstractProperty(ServiceRegistry serviceRegistry, CMISConnector connector, String propertyName)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.connector = connector;
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
||||
protected String getGuid(String nodeId)
|
||||
{
|
||||
int idx = nodeId.lastIndexOf("/");
|
||||
if(idx != -1)
|
||||
{
|
||||
return nodeId.substring(idx+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nodeId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return service registry
|
||||
*/
|
||||
protected ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Serializable getValue(NodeRef nodeRef)
|
||||
{
|
||||
return getValue(createNodeInfo(nodeRef));
|
||||
}
|
||||
|
||||
public Serializable getValue(AssociationRef assocRef)
|
||||
{
|
||||
return getValue(createNodeInfo(assocRef));
|
||||
}
|
||||
|
||||
public Serializable getValue(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.containsPropertyValue(propertyName))
|
||||
{
|
||||
Serializable value = nodeInfo.getPropertyValue(propertyName);
|
||||
return value;
|
||||
} else
|
||||
{
|
||||
Serializable value = getValueInternal(nodeInfo);
|
||||
nodeInfo.putPropertyValue(propertyName, value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Serializable getValueInternal(CMISNodeInfo nodeInfo);
|
||||
|
||||
public CMISNodeInfo createNodeInfo(NodeRef nodeRef)
|
||||
{
|
||||
return connector.createNodeInfo(nodeRef);
|
||||
}
|
||||
|
||||
public CMISNodeInfo createNodeInfo(AssociationRef assocRef)
|
||||
{
|
||||
return connector.createNodeInfo(assocRef);
|
||||
}
|
||||
|
||||
protected ContentData getContentData(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (!nodeInfo.isDocument())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeInfo.containsPropertyValue(CONTENT_PROPERTY))
|
||||
{
|
||||
return (ContentData) nodeInfo.getPropertyValue(CONTENT_PROPERTY);
|
||||
} else
|
||||
{
|
||||
ContentData contentData = null;
|
||||
|
||||
Serializable value = nodeInfo.getNodeProps().get(ContentModel.PROP_CONTENT);
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
|
||||
}
|
||||
|
||||
nodeInfo.putPropertyValue(CONTENT_PROPERTY, contentData);
|
||||
return contentData;
|
||||
}
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Base class for all property accessors
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractProperty implements CMISPropertyAccessor
|
||||
{
|
||||
public static final String CONTENT_PROPERTY = "::content";
|
||||
|
||||
private ServiceRegistry serviceRegistry;
|
||||
protected CMISConnector connector;
|
||||
private String propertyName;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param propertyName String
|
||||
*/
|
||||
protected AbstractProperty(ServiceRegistry serviceRegistry, CMISConnector connector, String propertyName)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.connector = connector;
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
||||
protected String getGuid(String nodeId)
|
||||
{
|
||||
int idx = nodeId.lastIndexOf("/");
|
||||
if(idx != -1)
|
||||
{
|
||||
return nodeId.substring(idx+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nodeId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return service registry
|
||||
*/
|
||||
protected ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(NodeRef nodeRef, Serializable value)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Serializable getValue(NodeRef nodeRef)
|
||||
{
|
||||
return getValue(createNodeInfo(nodeRef));
|
||||
}
|
||||
|
||||
public Serializable getValue(AssociationRef assocRef)
|
||||
{
|
||||
return getValue(createNodeInfo(assocRef));
|
||||
}
|
||||
|
||||
public Serializable getValue(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.containsPropertyValue(propertyName))
|
||||
{
|
||||
Serializable value = nodeInfo.getPropertyValue(propertyName);
|
||||
return value;
|
||||
} else
|
||||
{
|
||||
Serializable value = getValueInternal(nodeInfo);
|
||||
nodeInfo.putPropertyValue(propertyName, value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Serializable getValueInternal(CMISNodeInfo nodeInfo);
|
||||
|
||||
public CMISNodeInfo createNodeInfo(NodeRef nodeRef)
|
||||
{
|
||||
return connector.createNodeInfo(nodeRef);
|
||||
}
|
||||
|
||||
public CMISNodeInfo createNodeInfo(AssociationRef assocRef)
|
||||
{
|
||||
return connector.createNodeInfo(assocRef);
|
||||
}
|
||||
|
||||
protected ContentData getContentData(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (!nodeInfo.isDocument())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeInfo.containsPropertyValue(CONTENT_PROPERTY))
|
||||
{
|
||||
return (ContentData) nodeInfo.getPropertyValue(CONTENT_PROPERTY);
|
||||
} else
|
||||
{
|
||||
ContentData contentData = null;
|
||||
|
||||
Serializable value = nodeInfo.getNodeProps().get(ContentModel.PROP_CONTENT);
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
|
||||
}
|
||||
|
||||
nodeInfo.putPropertyValue(CONTENT_PROPERTY, contentData);
|
||||
return contentData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,66 +1,66 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS allowedChildObjectTypeIds property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class AllowedChildObjectTypeIdsProperty extends AbstractProperty
|
||||
{
|
||||
private CMISMapping cmisMapping;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param cmisMapping CMISMapping
|
||||
*/
|
||||
public AllowedChildObjectTypeIdsProperty(ServiceRegistry serviceRegistry, CMISConnector connector,
|
||||
CMISMapping cmisMapping)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS);
|
||||
this.cmisMapping = cmisMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if(nodeInfo.getType() == null)
|
||||
{
|
||||
//If the type is null, we can't handle it so return an empty list
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
TypeDefinition type = getServiceRegistry().getDictionaryService()
|
||||
.getType(nodeInfo.getType().getAlfrescoClass());
|
||||
if ((type != null) && (type.getChildAssociations() != null) && (!type.getChildAssociations().isEmpty()))
|
||||
{
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
for (ChildAssociationDefinition cad : type.getChildAssociations().values())
|
||||
{
|
||||
String typeId = cmisMapping.getCmisTypeId(cad.getTargetClass().getName());
|
||||
if (typeId != null)
|
||||
{
|
||||
result.add(typeId);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS allowedChildObjectTypeIds property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class AllowedChildObjectTypeIdsProperty extends AbstractProperty
|
||||
{
|
||||
private CMISMapping cmisMapping;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param cmisMapping CMISMapping
|
||||
*/
|
||||
public AllowedChildObjectTypeIdsProperty(ServiceRegistry serviceRegistry, CMISConnector connector,
|
||||
CMISMapping cmisMapping)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS);
|
||||
this.cmisMapping = cmisMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if(nodeInfo.getType() == null)
|
||||
{
|
||||
//If the type is null, we can't handle it so return an empty list
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
TypeDefinition type = getServiceRegistry().getDictionaryService()
|
||||
.getType(nodeInfo.getType().getAlfrescoClass());
|
||||
if ((type != null) && (type.getChildAssociations() != null) && (!type.getChildAssociations().isEmpty()))
|
||||
{
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
for (ChildAssociationDefinition cad : type.getChildAssociations().values())
|
||||
{
|
||||
String typeId = cmisMapping.getCmisTypeId(cad.getTargetClass().getName());
|
||||
if (typeId != null)
|
||||
{
|
||||
result.add(typeId);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@@ -1,46 +1,46 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
|
||||
/**
|
||||
* Get the CMIS object type id property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class BaseTypeIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public BaseTypeIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.BASE_TYPE_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isFolder())
|
||||
{
|
||||
return BaseTypeId.CMIS_FOLDER.value();
|
||||
}
|
||||
else if (nodeInfo.isRelationship())
|
||||
{
|
||||
return BaseTypeId.CMIS_RELATIONSHIP.value();
|
||||
}
|
||||
else if(nodeInfo.isItem())
|
||||
{
|
||||
return BaseTypeId.CMIS_ITEM.value();
|
||||
}
|
||||
|
||||
return BaseTypeId.CMIS_DOCUMENT.value();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
|
||||
|
||||
/**
|
||||
* Get the CMIS object type id property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class BaseTypeIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public BaseTypeIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.BASE_TYPE_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isFolder())
|
||||
{
|
||||
return BaseTypeId.CMIS_FOLDER.value();
|
||||
}
|
||||
else if (nodeInfo.isRelationship())
|
||||
{
|
||||
return BaseTypeId.CMIS_RELATIONSHIP.value();
|
||||
}
|
||||
else if(nodeInfo.isItem())
|
||||
{
|
||||
return BaseTypeId.CMIS_ITEM.value();
|
||||
}
|
||||
|
||||
return BaseTypeId.CMIS_DOCUMENT.value();
|
||||
}
|
||||
}
|
||||
|
@@ -1,38 +1,38 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CanCancelCheckOutActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private PermissionActionEvaluator permissionEvaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
protected CanCancelCheckOutActionEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_CANCEL_CHECK_OUT);
|
||||
permissionEvaluator = new PermissionActionEvaluator(
|
||||
serviceRegistry,
|
||||
Action.CAN_CANCEL_CHECK_OUT,
|
||||
PermissionService.CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return permissionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CanCancelCheckOutActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private PermissionActionEvaluator permissionEvaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
protected CanCancelCheckOutActionEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_CANCEL_CHECK_OUT);
|
||||
permissionEvaluator = new PermissionActionEvaluator(
|
||||
serviceRegistry,
|
||||
Action.CAN_CANCEL_CHECK_OUT,
|
||||
PermissionService.CANCEL_CHECK_OUT);
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return permissionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -1,38 +1,38 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class CanCheckInActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private PermissionActionEvaluator permissionEvaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
protected CanCheckInActionEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_CHECK_IN);
|
||||
permissionEvaluator = new PermissionActionEvaluator(
|
||||
serviceRegistry,
|
||||
Action.CAN_CHECK_IN,
|
||||
PermissionService.CHECK_IN);
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return permissionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class CanCheckInActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private PermissionActionEvaluator permissionEvaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
protected CanCheckInActionEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_CHECK_IN);
|
||||
permissionEvaluator = new PermissionActionEvaluator(
|
||||
serviceRegistry,
|
||||
Action.CAN_CHECK_IN,
|
||||
PermissionService.CHECK_IN);
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return permissionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -1,47 +1,47 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CanCheckOutActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private PermissionActionEvaluator permissionEvaluator;
|
||||
private LockService lockService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
protected CanCheckOutActionEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_CHECK_OUT);
|
||||
permissionEvaluator = new PermissionActionEvaluator(
|
||||
serviceRegistry,
|
||||
Action.CAN_CHECK_OUT,
|
||||
PermissionService.CHECK_OUT);
|
||||
lockService = serviceRegistry.getLockService();
|
||||
}
|
||||
|
||||
/**
|
||||
* Node must be versionable, must not have a Private Working Copy and must not be locked.
|
||||
*/
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
if (nodeInfo.hasPWC() || lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return permissionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CanCheckOutActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private PermissionActionEvaluator permissionEvaluator;
|
||||
private LockService lockService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
protected CanCheckOutActionEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_CHECK_OUT);
|
||||
permissionEvaluator = new PermissionActionEvaluator(
|
||||
serviceRegistry,
|
||||
Action.CAN_CHECK_OUT,
|
||||
PermissionService.CHECK_OUT);
|
||||
lockService = serviceRegistry.getLockService();
|
||||
}
|
||||
|
||||
/**
|
||||
* Node must be versionable, must not have a Private Working Copy and must not be locked.
|
||||
*/
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
if (nodeInfo.hasPWC() || lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return permissionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
}
|
||||
|
@@ -1,42 +1,42 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
public class CanDeleteDocumentEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private CMISActionEvaluator currentVersionEvaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
*/
|
||||
protected CanDeleteDocumentEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_DELETE_OBJECT);
|
||||
this.currentVersionEvaluator = new PermissionActionEvaluator(serviceRegistry,
|
||||
Action.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE);
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
boolean isAllowed = true;
|
||||
|
||||
if(!nodeInfo.isCurrentVersion() || nodeInfo.hasPWC())
|
||||
{
|
||||
// not allowed if not current version or is checked out
|
||||
isAllowed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isAllowed = currentVersionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
|
||||
return isAllowed;
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
public class CanDeleteDocumentEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private CMISActionEvaluator currentVersionEvaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
*/
|
||||
protected CanDeleteDocumentEvaluator(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
super(serviceRegistry, Action.CAN_DELETE_OBJECT);
|
||||
this.currentVersionEvaluator = new PermissionActionEvaluator(serviceRegistry,
|
||||
Action.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE);
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
boolean isAllowed = true;
|
||||
|
||||
if(!nodeInfo.isCurrentVersion() || nodeInfo.hasPWC())
|
||||
{
|
||||
// not allowed if not current version or is checked out
|
||||
isAllowed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isAllowed = currentVersionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
|
||||
return isAllowed;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for the CMIS Checkin Comment
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CheckinCommentProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public CheckinCommentProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CHECKIN_COMMENT);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getCheckinComment();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for the CMIS Checkin Comment
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CheckinCommentProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public CheckinCommentProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CHECKIN_COMMENT);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getCheckinComment();
|
||||
}
|
||||
}
|
||||
|
@@ -1,39 +1,39 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS content stream property id
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ContentStreamIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ContentStreamIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
ContentData contentData = getContentData(nodeInfo);
|
||||
|
||||
if (contentData != null)
|
||||
{
|
||||
return contentData.getContentUrl();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS content stream property id
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ContentStreamIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ContentStreamIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
ContentData contentData = getContentData(nodeInfo);
|
||||
|
||||
if (contentData != null)
|
||||
{
|
||||
return contentData.getContentUrl();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,47 +1,47 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS content stream length property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ContentStreamLengthProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ContentStreamLengthProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_LENGTH);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
ContentData contentData = getContentData(nodeInfo);
|
||||
|
||||
if (contentData != null)
|
||||
{
|
||||
return contentData.getSize();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
// spoof
|
||||
return GetChildrenCannedQuery.SORT_QNAME_CONTENT_SIZE;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS content stream length property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ContentStreamLengthProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ContentStreamLengthProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_LENGTH);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
ContentData contentData = getContentData(nodeInfo);
|
||||
|
||||
if (contentData != null)
|
||||
{
|
||||
return contentData.getSize();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
// spoof
|
||||
return GetChildrenCannedQuery.SORT_QNAME_CONTENT_SIZE;
|
||||
}
|
||||
}
|
||||
|
@@ -1,77 +1,77 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
|
||||
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.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS content stream mimetype property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ContentStreamMimetypeProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ContentStreamMimetypeProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_MIME_TYPE);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
ContentData contentData = getContentData(nodeInfo);
|
||||
|
||||
if (contentData != null)
|
||||
{
|
||||
return contentData.getMimetype();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getLuceneFieldName()
|
||||
{
|
||||
StringBuilder field = new StringBuilder(128);
|
||||
field.append("@");
|
||||
field.append(ContentModel.PROP_CONTENT);
|
||||
field.append(".mimetype");
|
||||
return field.toString();
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
// spoof
|
||||
return GetChildrenCannedQuery.SORT_QNAME_CONTENT_MIMETYPE;
|
||||
}
|
||||
|
||||
protected String getValueAsString(Serializable value)
|
||||
{
|
||||
Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
|
||||
.getDataType(DataTypeDefinition.TEXT), value);
|
||||
String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
|
||||
return asString;
|
||||
}
|
||||
|
||||
protected QName getQNameForExists()
|
||||
{
|
||||
return ContentModel.PROP_CONTENT;
|
||||
}
|
||||
|
||||
protected DataTypeDefinition getInDataType()
|
||||
{
|
||||
return getServiceRegistry().getDictionaryService().getDataType(DataTypeDefinition.TEXT);
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
|
||||
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.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS content stream mimetype property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ContentStreamMimetypeProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ContentStreamMimetypeProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_MIME_TYPE);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
ContentData contentData = getContentData(nodeInfo);
|
||||
|
||||
if (contentData != null)
|
||||
{
|
||||
return contentData.getMimetype();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getLuceneFieldName()
|
||||
{
|
||||
StringBuilder field = new StringBuilder(128);
|
||||
field.append("@");
|
||||
field.append(ContentModel.PROP_CONTENT);
|
||||
field.append(".mimetype");
|
||||
return field.toString();
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
// spoof
|
||||
return GetChildrenCannedQuery.SORT_QNAME_CONTENT_MIMETYPE;
|
||||
}
|
||||
|
||||
protected String getValueAsString(Serializable value)
|
||||
{
|
||||
Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
|
||||
.getDataType(DataTypeDefinition.TEXT), value);
|
||||
String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
|
||||
return asString;
|
||||
}
|
||||
|
||||
protected QName getQNameForExists()
|
||||
{
|
||||
return ContentModel.PROP_CONTENT;
|
||||
}
|
||||
|
||||
protected DataTypeDefinition getInDataType()
|
||||
{
|
||||
return getServiceRegistry().getDictionaryService().getDataType(DataTypeDefinition.TEXT);
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object creation date property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CreationDateProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public CreationDateProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CREATION_DATE);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getCreationDate();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object creation date property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class CreationDateProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public CreationDateProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.CREATION_DATE);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getCreationDate();
|
||||
}
|
||||
}
|
||||
|
@@ -1,63 +1,63 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
public class CurrentVersionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private CMISActionEvaluator currentVersionEvaluator;
|
||||
private boolean currentVersionValue;
|
||||
private boolean nonCurrentVersionValue;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
* @param currentVersionValue boolean
|
||||
* @param nonCurrentVersionValue boolean
|
||||
*/
|
||||
protected CurrentVersionEvaluator(ServiceRegistry serviceRegistry, Action action, boolean currentVersionValue,
|
||||
boolean nonCurrentVersionValue)
|
||||
{
|
||||
super(serviceRegistry, action);
|
||||
this.currentVersionValue = currentVersionValue;
|
||||
this.nonCurrentVersionValue = nonCurrentVersionValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry
|
||||
*/
|
||||
protected CurrentVersionEvaluator(ServiceRegistry serviceRegistry, CMISActionEvaluator currentVersionEvaluator,
|
||||
boolean nonCurrentVersionValue)
|
||||
{
|
||||
super(serviceRegistry, currentVersionEvaluator.getAction());
|
||||
this.currentVersionEvaluator = currentVersionEvaluator;
|
||||
this.nonCurrentVersionValue = nonCurrentVersionValue;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if(nodeInfo.hasPWC())
|
||||
{
|
||||
if(!nodeInfo.isPWC())
|
||||
{
|
||||
return nonCurrentVersionValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!nodeInfo.isCurrentVersion())
|
||||
{
|
||||
return nonCurrentVersionValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currentVersionEvaluator == null ? currentVersionValue : currentVersionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
public class CurrentVersionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private CMISActionEvaluator currentVersionEvaluator;
|
||||
private boolean currentVersionValue;
|
||||
private boolean nonCurrentVersionValue;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
* @param currentVersionValue boolean
|
||||
* @param nonCurrentVersionValue boolean
|
||||
*/
|
||||
protected CurrentVersionEvaluator(ServiceRegistry serviceRegistry, Action action, boolean currentVersionValue,
|
||||
boolean nonCurrentVersionValue)
|
||||
{
|
||||
super(serviceRegistry, action);
|
||||
this.currentVersionValue = currentVersionValue;
|
||||
this.nonCurrentVersionValue = nonCurrentVersionValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry
|
||||
*/
|
||||
protected CurrentVersionEvaluator(ServiceRegistry serviceRegistry, CMISActionEvaluator currentVersionEvaluator,
|
||||
boolean nonCurrentVersionValue)
|
||||
{
|
||||
super(serviceRegistry, currentVersionEvaluator.getAction());
|
||||
this.currentVersionEvaluator = currentVersionEvaluator;
|
||||
this.nonCurrentVersionValue = nonCurrentVersionValue;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if(nodeInfo.hasPWC())
|
||||
{
|
||||
if(!nodeInfo.isPWC())
|
||||
{
|
||||
return nonCurrentVersionValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!nodeInfo.isCurrentVersion())
|
||||
{
|
||||
return nonCurrentVersionValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currentVersionEvaluator == null ? currentVersionValue : currentVersionEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
}
|
||||
|
@@ -1,76 +1,76 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.CMISNodeInfoImpl;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* A simple 1-1 property mapping from a CMIS property name to an alfresco property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class DirectProperty extends AbstractProperty
|
||||
{
|
||||
private QName alfrescoName;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public DirectProperty(ServiceRegistry serviceRegistry, CMISConnector connector, String propertyName,
|
||||
QName alfrescoName)
|
||||
{
|
||||
super(serviceRegistry, connector, propertyName);
|
||||
this.alfrescoName = alfrescoName;
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
return alfrescoName;
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.getType() == null)
|
||||
{
|
||||
// Invalid node
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeInfo.getNodeRef() != null)
|
||||
{
|
||||
Serializable result = nodeInfo.getNodeProps().get(alfrescoName);
|
||||
|
||||
/* MNT-10548 fix */
|
||||
if (result instanceof List)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> resultList = (List<Object>)result;
|
||||
for (int index = 0; index < resultList.size(); index++)
|
||||
{
|
||||
Object element = resultList.get(index);
|
||||
if (element instanceof NodeRef)
|
||||
{
|
||||
NodeRef nodeRef = (NodeRef)element;
|
||||
resultList.set(index, nodeRef.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else if (nodeInfo.getAssociationRef() != null)
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(
|
||||
nodeInfo.getAssociationRef().getSourceRef(),
|
||||
alfrescoName);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.CMISNodeInfoImpl;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* A simple 1-1 property mapping from a CMIS property name to an alfresco property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class DirectProperty extends AbstractProperty
|
||||
{
|
||||
private QName alfrescoName;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public DirectProperty(ServiceRegistry serviceRegistry, CMISConnector connector, String propertyName,
|
||||
QName alfrescoName)
|
||||
{
|
||||
super(serviceRegistry, connector, propertyName);
|
||||
this.alfrescoName = alfrescoName;
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
return alfrescoName;
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.getType() == null)
|
||||
{
|
||||
// Invalid node
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeInfo.getNodeRef() != null)
|
||||
{
|
||||
Serializable result = nodeInfo.getNodeProps().get(alfrescoName);
|
||||
|
||||
/* MNT-10548 fix */
|
||||
if (result instanceof List)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> resultList = (List<Object>)result;
|
||||
for (int index = 0; index < resultList.size(); index++)
|
||||
{
|
||||
Object element = resultList.get(index);
|
||||
if (element instanceof NodeRef)
|
||||
{
|
||||
NodeRef nodeRef = (NodeRef)element;
|
||||
resultList.set(index, nodeRef.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else if (nodeInfo.getAssociationRef() != null)
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(
|
||||
nodeInfo.getAssociationRef().getSourceRef(),
|
||||
alfrescoName);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,43 +1,43 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Action Evaluator whose evaluation is fixed
|
||||
*
|
||||
* @author florian.mueller
|
||||
*
|
||||
*/
|
||||
public class FixedValueActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private boolean allowed;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
* @param allowed boolean
|
||||
*/
|
||||
protected FixedValueActionEvaluator(ServiceRegistry serviceRegistry, Action action, boolean allowed)
|
||||
{
|
||||
super(serviceRegistry, action);
|
||||
this.allowed = allowed;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return allowed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("FixedValueActionEvaluator[action=").append(getAction());
|
||||
builder.append(", allowed=").append(allowed).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Action Evaluator whose evaluation is fixed
|
||||
*
|
||||
* @author florian.mueller
|
||||
*
|
||||
*/
|
||||
public class FixedValueActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private boolean allowed;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
* @param allowed boolean
|
||||
*/
|
||||
protected FixedValueActionEvaluator(ServiceRegistry serviceRegistry, Action action, boolean allowed)
|
||||
{
|
||||
super(serviceRegistry, action);
|
||||
this.allowed = allowed;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return allowed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("FixedValueActionEvaluator[action=").append(getAction());
|
||||
builder.append(", allowed=").append(allowed).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,37 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
* Property accessor for fixed value mapping (eg to null, true, etc)
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class FixedValueProperty extends AbstractProperty
|
||||
{
|
||||
private Serializable value;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param propertyName String
|
||||
* @param value Serializable
|
||||
*/
|
||||
public FixedValueProperty(ServiceRegistry serviceRegistry, CMISConnector connector, String propertyName,
|
||||
Serializable value)
|
||||
{
|
||||
super(serviceRegistry, connector, propertyName);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
* Property accessor for fixed value mapping (eg to null, true, etc)
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class FixedValueProperty extends AbstractProperty
|
||||
{
|
||||
private Serializable value;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param propertyName String
|
||||
* @param value Serializable
|
||||
*/
|
||||
public FixedValueProperty(ServiceRegistry serviceRegistry, CMISConnector connector, String propertyName,
|
||||
Serializable value)
|
||||
{
|
||||
super(serviceRegistry, connector, propertyName);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@@ -1,42 +1,42 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Property accessor for CMIS is immutable property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsImmutableProperty extends AbstractProperty
|
||||
{
|
||||
private LockService lockService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public IsImmutableProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_IMMUTABLE);
|
||||
lockService = serviceRegistry.getLockService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
if (nodeInfo.isVersion() || (nodeInfo.hasPWC() && !nodeInfo.isPWC()) || (lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockType;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Property accessor for CMIS is immutable property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsImmutableProperty extends AbstractProperty
|
||||
{
|
||||
private LockService lockService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public IsImmutableProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_IMMUTABLE);
|
||||
lockService = serviceRegistry.getLockService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
if (nodeInfo.isVersion() || (nodeInfo.hasPWC() && !nodeInfo.isPWC()) || (lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS is latest major version property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsLatestMajorVersionProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public IsLatestMajorVersionProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_LATEST_MAJOR_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.isLatestMajorVersion();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS is latest major version property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsLatestMajorVersionProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public IsLatestMajorVersionProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_LATEST_MAJOR_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.isLatestMajorVersion();
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,30 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accesser for CMIS is latest version property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsLatestVersionProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public IsLatestVersionProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_LATEST_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.isLatestVersion();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accesser for CMIS is latest version property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsLatestVersionProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public IsLatestVersionProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_LATEST_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.isLatestVersion();
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS is major version property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsMajorVersionProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public IsMajorVersionProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_MAJOR_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.isMajorVersion();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for CMIS is major version property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsMajorVersionProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public IsMajorVersionProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_MAJOR_VERSION);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.isMajorVersion();
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,30 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS version series checked out property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsVersionSeriesCheckedOutProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public IsVersionSeriesCheckedOutProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.hasPWC();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS version series checked out property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class IsVersionSeriesCheckedOutProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public IsVersionSeriesCheckedOutProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.hasPWC();
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object modification date property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ModificationDateProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ModificationDateProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.LAST_MODIFICATION_DATE);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getModificationDate();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object modification date property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ModificationDateProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ModificationDateProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.LAST_MODIFICATION_DATE);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getModificationDate();
|
||||
}
|
||||
}
|
||||
|
@@ -1,38 +1,38 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object name property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class NameProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
*/
|
||||
public NameProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.NAME);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getName();
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
return ContentModel.PROP_NAME;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object name property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class NameProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
*/
|
||||
public NameProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.NAME);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getName();
|
||||
}
|
||||
|
||||
public QName getMappedProperty()
|
||||
{
|
||||
return ContentModel.PROP_NAME;
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +1,45 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
* Get the CMIS object id property.
|
||||
*/
|
||||
public class NodeRefProperty extends AbstractProperty
|
||||
{
|
||||
public static final String NodeRefPropertyId = "alfcmis:nodeRef";
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
*/
|
||||
public NodeRefProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, NodeRefPropertyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.getNodeRef() != null)
|
||||
{
|
||||
if (nodeInfo.isCurrentVersion())
|
||||
{
|
||||
return nodeInfo.getCurrentNodeNodeRef().toString();
|
||||
} else
|
||||
{
|
||||
return nodeInfo.getNodeRef().toString();
|
||||
}
|
||||
} else if (nodeInfo.getAssociationRef() != null)
|
||||
{
|
||||
return nodeInfo.getAssociationRef().toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
* Get the CMIS object id property.
|
||||
*/
|
||||
public class NodeRefProperty extends AbstractProperty
|
||||
{
|
||||
public static final String NodeRefPropertyId = "alfcmis:nodeRef";
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
*/
|
||||
public NodeRefProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, NodeRefPropertyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.getNodeRef() != null)
|
||||
{
|
||||
if (nodeInfo.isCurrentVersion())
|
||||
{
|
||||
return nodeInfo.getCurrentNodeNodeRef().toString();
|
||||
} else
|
||||
{
|
||||
return nodeInfo.getNodeRef().toString();
|
||||
}
|
||||
} else if (nodeInfo.getAssociationRef() != null)
|
||||
{
|
||||
return nodeInfo.getAssociationRef().toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object id property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ObjectIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ObjectIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.OBJECT_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getObjectId();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object id property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ObjectIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ObjectIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.OBJECT_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getObjectId();
|
||||
}
|
||||
}
|
||||
|
@@ -1,41 +1,41 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object type id property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ObjectTypeIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param dictionaryService CMISDictionaryService
|
||||
*/
|
||||
public ObjectTypeIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector,
|
||||
CMISDictionaryService dictionaryService)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.OBJECT_TYPE_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if(nodeInfo.getType() == null)
|
||||
{
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
return nodeInfo.getType().getTypeId();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS object type id property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ObjectTypeIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
* @param dictionaryService CMISDictionaryService
|
||||
*/
|
||||
public ObjectTypeIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector,
|
||||
CMISDictionaryService dictionaryService)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.OBJECT_TYPE_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if(nodeInfo.getType() == null)
|
||||
{
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
return nodeInfo.getType().getTypeId();
|
||||
}
|
||||
}
|
||||
|
@@ -1,50 +1,50 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
|
||||
/**
|
||||
* Action Evaluator whose evaluation takes place on parent
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ParentActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private AbstractActionEvaluator evaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param evaluator AbstractActionEvaluator
|
||||
*/
|
||||
protected ParentActionEvaluator(AbstractActionEvaluator evaluator)
|
||||
{
|
||||
super(evaluator.getServiceRegistry(), evaluator.getAction());
|
||||
this.evaluator = evaluator;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isRootFolder())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<CMISNodeInfo> parents = nodeInfo.getParents();
|
||||
if (!parents.isEmpty())
|
||||
{
|
||||
return evaluator.isAllowed(parents.get(0));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ParentActionEvaluator[evaluator=").append(evaluator).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
|
||||
/**
|
||||
* Action Evaluator whose evaluation takes place on parent
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class ParentActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private AbstractActionEvaluator evaluator;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param evaluator AbstractActionEvaluator
|
||||
*/
|
||||
protected ParentActionEvaluator(AbstractActionEvaluator evaluator)
|
||||
{
|
||||
super(evaluator.getServiceRegistry(), evaluator.getAction());
|
||||
this.evaluator = evaluator;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isRootFolder())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<CMISNodeInfo> parents = nodeInfo.getParents();
|
||||
if (!parents.isEmpty())
|
||||
{
|
||||
return evaluator.isAllowed(parents.get(0));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ParentActionEvaluator[evaluator=").append(evaluator).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +1,45 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS parent property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*
|
||||
*/
|
||||
public class ParentProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ParentProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.PARENT_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isRootFolder())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<CMISNodeInfo> parents = nodeInfo.getParents();
|
||||
if (!parents.isEmpty())
|
||||
{
|
||||
return parents.get(0).getObjectId();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS parent property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*
|
||||
*/
|
||||
public class ParentProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public ParentProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.PARENT_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isRootFolder())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<CMISNodeInfo> parents = nodeInfo.getParents();
|
||||
if (!parents.isEmpty())
|
||||
{
|
||||
return parents.get(0).getObjectId();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS path property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class PathProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public PathProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.PATH);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getPath();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS path property.
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class PathProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public PathProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.PATH);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getPath();
|
||||
}
|
||||
}
|
||||
|
@@ -1,59 +1,59 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class PermissionActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private String[] permissions;
|
||||
private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
* @param permission String...
|
||||
*/
|
||||
protected PermissionActionEvaluator(ServiceRegistry serviceRegistry, Action action, String... permission)
|
||||
{
|
||||
super(serviceRegistry, action);
|
||||
this.permissions = permission;
|
||||
this.permissionService = serviceRegistry.getPermissionService();
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
for (String permission : permissions)
|
||||
{
|
||||
if (permissionService.hasPermission(nodeInfo.getNodeRef(), permission) == AccessStatus.DENIED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PermissionActionEvaluator[action=").append(getAction());
|
||||
builder.append(", permissions=");
|
||||
for (String permission : permissions)
|
||||
{
|
||||
builder.append(permission).append(",");
|
||||
}
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.Action;
|
||||
|
||||
/**
|
||||
* Alfresco Permission based Action Evaluator
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class PermissionActionEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private String[] permissions;
|
||||
private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param action Action
|
||||
* @param permission String...
|
||||
*/
|
||||
protected PermissionActionEvaluator(ServiceRegistry serviceRegistry, Action action, String... permission)
|
||||
{
|
||||
super(serviceRegistry, action);
|
||||
this.permissions = permission;
|
||||
this.permissionService = serviceRegistry.getPermissionService();
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
for (String permission : permissions)
|
||||
{
|
||||
if (permissionService.hasPermission(nodeInfo.getNodeRef(), permission) == AccessStatus.DENIED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PermissionActionEvaluator[action=").append(getAction());
|
||||
builder.append(", permissions=");
|
||||
for (String permission : permissions)
|
||||
{
|
||||
builder.append(permission).append(",");
|
||||
}
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,29 +1,29 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
public class RootFolderEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private CMISActionEvaluator folderEvaluator;
|
||||
private boolean rootFolderValue;
|
||||
|
||||
protected RootFolderEvaluator(ServiceRegistry serviceRegistry, CMISActionEvaluator folderEvaluator,
|
||||
boolean rootFolderValue)
|
||||
{
|
||||
super(serviceRegistry, folderEvaluator.getAction());
|
||||
this.folderEvaluator = folderEvaluator;
|
||||
this.rootFolderValue = rootFolderValue;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isRootFolder())
|
||||
{
|
||||
return rootFolderValue;
|
||||
}
|
||||
|
||||
return folderEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
public class RootFolderEvaluator extends AbstractActionEvaluator
|
||||
{
|
||||
private CMISActionEvaluator folderEvaluator;
|
||||
private boolean rootFolderValue;
|
||||
|
||||
protected RootFolderEvaluator(ServiceRegistry serviceRegistry, CMISActionEvaluator folderEvaluator,
|
||||
boolean rootFolderValue)
|
||||
{
|
||||
super(serviceRegistry, folderEvaluator.getAction());
|
||||
this.folderEvaluator = folderEvaluator;
|
||||
this.rootFolderValue = rootFolderValue;
|
||||
}
|
||||
|
||||
public boolean isAllowed(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (nodeInfo.isRootFolder())
|
||||
{
|
||||
return rootFolderValue;
|
||||
}
|
||||
|
||||
return folderEvaluator.isAllowed(nodeInfo);
|
||||
}
|
||||
}
|
||||
|
@@ -1,56 +1,56 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SecondaryTypesProperty extends AbstractProperty
|
||||
{
|
||||
private CMISMapping cmisMapping;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public SecondaryTypesProperty(ServiceRegistry serviceRegistry, CMISConnector connector, CMISMapping cmisMapping)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.SECONDARY_OBJECT_TYPE_IDS);
|
||||
this.cmisMapping = cmisMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
|
||||
if(nodeRef == null || nodeInfo.getType() == null)
|
||||
{
|
||||
// If the nodeRef or type is null, we can't handle it so return an empty list
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<QName> aspects = nodeInfo.getNodeAspects();
|
||||
ArrayList<String> results = new ArrayList<String>(aspects.size());
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
String typeId = cmisMapping.getCmisTypeId(aspect);
|
||||
if (typeId != null)
|
||||
{
|
||||
results.add(typeId);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SecondaryTypesProperty extends AbstractProperty
|
||||
{
|
||||
private CMISMapping cmisMapping;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public SecondaryTypesProperty(ServiceRegistry serviceRegistry, CMISConnector connector, CMISMapping cmisMapping)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.SECONDARY_OBJECT_TYPE_IDS);
|
||||
this.cmisMapping = cmisMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
|
||||
if(nodeRef == null || nodeInfo.getType() == null)
|
||||
{
|
||||
// If the nodeRef or type is null, we can't handle it so return an empty list
|
||||
return (Serializable) Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<QName> aspects = nodeInfo.getNodeAspects();
|
||||
ArrayList<String> results = new ArrayList<String>(aspects.size());
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
String typeId = cmisMapping.getCmisTypeId(aspect);
|
||||
if (typeId != null)
|
||||
{
|
||||
results.add(typeId);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for the Source Id (relationship)
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class SourceIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public SourceIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.SOURCE_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return createNodeInfo(nodeInfo.getAssociationRef().getSourceRef()).getObjectId();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for the Source Id (relationship)
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class SourceIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public SourceIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.SOURCE_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return createNodeInfo(nodeInfo.getAssociationRef().getSourceRef()).getObjectId();
|
||||
}
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for the Target Id (relationship)
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class TargetIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public TargetIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.TARGET_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef targetNodeRef = nodeInfo.getAssociationRef().getTargetRef();
|
||||
return createNodeInfo(targetNodeRef).getObjectId();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Accessor for the Target Id (relationship)
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class TargetIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public TargetIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.TARGET_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
NodeRef targetNodeRef = nodeInfo.getAssociationRef().getTargetRef();
|
||||
return createNodeInfo(targetNodeRef).getObjectId();
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,30 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionLabelProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public VersionLabelProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_LABEL);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getVersionLabel();
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionLabelProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public VersionLabelProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_LABEL);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return nodeInfo.getVersionLabel();
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +1,45 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS version series checked out by property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionSeriesCheckedOutByProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public VersionSeriesCheckedOutByProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_SERIES_CHECKED_OUT_BY);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (!nodeInfo.hasPWC())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return nodeInfo.getNodeProps().get(ContentModel.PROP_WORKING_COPY_OWNER);
|
||||
} else
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(nodeInfo.getCurrentNodeNodeRef(),
|
||||
ContentModel.PROP_LOCK_OWNER);
|
||||
}
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS version series checked out by property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionSeriesCheckedOutByProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public VersionSeriesCheckedOutByProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_SERIES_CHECKED_OUT_BY);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (!nodeInfo.hasPWC())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeInfo.isPWC())
|
||||
{
|
||||
return nodeInfo.getNodeProps().get(ContentModel.PROP_WORKING_COPY_OWNER);
|
||||
} else
|
||||
{
|
||||
return getServiceRegistry().getNodeService().getProperty(nodeInfo.getCurrentNodeNodeRef(),
|
||||
ContentModel.PROP_LOCK_OWNER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,37 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS version series checked out id property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionSeriesCheckedOutIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public VersionSeriesCheckedOutIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (!nodeInfo.hasPWC())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return connector.constructObjectId(nodeInfo.getCurrentNodeId(), CMISConnector.PWC_VERSION_LABEL);
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* Get the CMIS version series checked out id property
|
||||
*
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionSeriesCheckedOutIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param serviceRegistry ServiceRegistry
|
||||
* @param connector CMISConnector
|
||||
*/
|
||||
public VersionSeriesCheckedOutIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID);
|
||||
}
|
||||
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
if (!nodeInfo.hasPWC())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return connector.constructObjectId(nodeInfo.getCurrentNodeId(), CMISConnector.PWC_VERSION_LABEL);
|
||||
}
|
||||
}
|
||||
|
@@ -1,28 +1,28 @@
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionSeriesIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public VersionSeriesIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_SERIES_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return connector.constructObjectId(nodeInfo.getCurrentNodeId(), null);
|
||||
}
|
||||
}
|
||||
package org.alfresco.opencmis.mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.opencmis.CMISConnector;
|
||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
|
||||
/**
|
||||
* @author florian.mueller
|
||||
*/
|
||||
public class VersionSeriesIdProperty extends AbstractProperty
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public VersionSeriesIdProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
|
||||
{
|
||||
super(serviceRegistry, connector, PropertyIds.VERSION_SERIES_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
|
||||
{
|
||||
return connector.constructObjectId(nodeInfo.getCurrentNodeId(), null);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user