Class AlfrescoUtils


  • public class AlfrescoUtils
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> List<T> checkProperty​(org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<T> propertyDefinition, Object value)
      Checks a property value.
      static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectPropertiesExtension​(List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> propertiesChildren)
      Creates an aspectsToAdd extension element.
      static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectPropertyExtension​(org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<?> propertyDefinition, Object value)
      Creates a property extension element.
      static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectsToAddExtension​(org.apache.chemistry.opencmis.client.api.ObjectType aspectType)
      Creates an aspectsToAdd extension element.
      static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectsToRemoveExtension​(org.apache.chemistry.opencmis.client.api.ObjectType aspectType)
      Creates an aspectsToRemove extension element.
      static String createObjectTypeIdValue​(org.apache.chemistry.opencmis.client.api.ObjectType type, Collection<org.apache.chemistry.opencmis.client.api.ObjectType> aspectTypes)  
      static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createSetAspectsExtension​(List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> setAspectsChildren)
      Creates a setAspects extension element.
      static List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> findAlfrescoExtensions​(List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> extensions)
      Finds the Alfresco extensions within the given extensions.
      static org.apache.chemistry.opencmis.client.api.ObjectType findAspect​(Collection<org.apache.chemistry.opencmis.client.api.ObjectType> aspectTypes, String propertyId)
      Finds the aspect type that contains the given property id.
      static Collection<org.apache.chemistry.opencmis.client.api.ObjectType> getAspectTypes​(org.apache.chemistry.opencmis.client.api.Session session, List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> alfrescoExtensions)
      Returns the aspect types from the Alfresco extensions.
      static List<String> getMandatoryAspects​(org.apache.chemistry.opencmis.commons.data.ExtensionsData object)  
      static Map<String,​?> preparePropertiesForUpdate​(Map<String,​?> properties, org.apache.chemistry.opencmis.client.api.ObjectType type, Collection<org.apache.chemistry.opencmis.client.api.ObjectType> aspectTypes)
      Adds object type and aspect types to properties.
      static String updateAspects​(org.apache.chemistry.opencmis.client.api.Session session, org.apache.chemistry.opencmis.client.api.CmisObject object, org.apache.chemistry.opencmis.client.api.ObjectType[] addAspectIds, org.apache.chemistry.opencmis.client.api.ObjectType[] removeAspectIds, Map<String,​?> properties)
      Adds and removes aspects.
    • Method Detail

      • findAlfrescoExtensions

        public static List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> findAlfrescoExtensions​(List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> extensions)
        Finds the Alfresco extensions within the given extensions.
        Parameters:
        extensions - List of extensions (List<CmisExtensionElement>)
        Returns:
        The Alfresco extensions
      • getAspectTypes

        public static Collection<org.apache.chemistry.opencmis.client.api.ObjectType> getAspectTypes​(org.apache.chemistry.opencmis.client.api.Session session,
                                                                                                     List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> alfrescoExtensions)
        Returns the aspect types from the Alfresco extensions.
        Parameters:
        session - session
        alfrescoExtensions - List of Alfesco extensions
        Returns:
        A collection of aspectTypes
      • findAspect

        public static org.apache.chemistry.opencmis.client.api.ObjectType findAspect​(Collection<org.apache.chemistry.opencmis.client.api.ObjectType> aspectTypes,
                                                                                     String propertyId)
        Finds the aspect type that contains the given property id.
        Parameters:
        aspectTypes - The aspects to search
        propertyId - The desired property ID of the aspect.
        Returns:
        The ObjectType of the aspect if found, otherwise returns null
      • createSetAspectsExtension

        public static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createSetAspectsExtension​(List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> setAspectsChildren)
        Creates a setAspects extension element.
        Parameters:
        setAspectsChildren - children
        Returns:
        setAspects extension element
      • createAspectsToAddExtension

        public static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectsToAddExtension​(org.apache.chemistry.opencmis.client.api.ObjectType aspectType)
        Creates an aspectsToAdd extension element.
        Parameters:
        aspectType - aspect type
        Returns:
        new aspectsToAdd extension element
      • createAspectsToRemoveExtension

        public static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectsToRemoveExtension​(org.apache.chemistry.opencmis.client.api.ObjectType aspectType)
        Creates an aspectsToRemove extension element.
        Parameters:
        aspectType - aspect type
        Returns:
        new aspectsToRemove extension element
      • createAspectPropertiesExtension

        public static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectPropertiesExtension​(List<org.apache.chemistry.opencmis.commons.data.CmisExtensionElement> propertiesChildren)
        Creates an aspectsToAdd extension element.
        Parameters:
        propertiesChildren - children
        Returns:
        new aspectsToAdd extension element
      • createAspectPropertyExtension

        public static org.apache.chemistry.opencmis.commons.data.CmisExtensionElement createAspectPropertyExtension​(org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<?> propertyDefinition,
                                                                                                                    Object value)
        Creates a property extension element.
        Parameters:
        propertyDefinition - propertyDefinition
        value - value
        Returns:
        new property extension element
      • checkProperty

        public static <T> List<T> checkProperty​(org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<T> propertyDefinition,
                                                Object value)
        Checks a property value.
        Type Parameters:
        T - Todo: provide definition
        Parameters:
        propertyDefinition - propertyDefinition
        value - value
        Returns:
        List
      • preparePropertiesForUpdate

        public static Map<String,​?> preparePropertiesForUpdate​(Map<String,​?> properties,
                                                                     org.apache.chemistry.opencmis.client.api.ObjectType type,
                                                                     Collection<org.apache.chemistry.opencmis.client.api.ObjectType> aspectTypes)
        Adds object type and aspect types to properties.
        Parameters:
        properties - Properites to be added to
        type - the object tyoe
        aspectTypes - collection of aspect types
        Returns:
        The properties list with the new object and aspect types
      • createObjectTypeIdValue

        public static String createObjectTypeIdValue​(org.apache.chemistry.opencmis.client.api.ObjectType type,
                                                     Collection<org.apache.chemistry.opencmis.client.api.ObjectType> aspectTypes)
      • updateAspects

        public static String updateAspects​(org.apache.chemistry.opencmis.client.api.Session session,
                                           org.apache.chemistry.opencmis.client.api.CmisObject object,
                                           org.apache.chemistry.opencmis.client.api.ObjectType[] addAspectIds,
                                           org.apache.chemistry.opencmis.client.api.ObjectType[] removeAspectIds,
                                           Map<String,​?> properties)
        Adds and removes aspects.
        Parameters:
        session - session
        object - object
        addAspectIds - The aspect IDs to add
        removeAspectIds - The aspect IDs to remove
        properties - properties
        Returns:
        Object ID
      • getMandatoryAspects

        public static List<String> getMandatoryAspects​(org.apache.chemistry.opencmis.commons.data.ExtensionsData object)