Class CustomModelsImpl

  • All Implemented Interfaces:
    CustomModels

    public class CustomModelsImpl
    extends java.lang.Object
    implements CustomModels
    Author:
    Jamal Kaabi-Mofrad
    • Field Detail

      • NAME_PATTERN

        public static final java.util.regex.Pattern NAME_PATTERN
      • URI_PATTERN

        public static final java.util.regex.Pattern URI_PATTERN
      • MODEL_NAME_NULL_ERR

        public static final java.lang.String MODEL_NAME_NULL_ERR
        See Also:
        Constant Field Values
      • TYPE_NAME_NULL_ERR

        public static final java.lang.String TYPE_NAME_NULL_ERR
        See Also:
        Constant Field Values
      • ASPECT_NAME_NULL_ERR

        public static final java.lang.String ASPECT_NAME_NULL_ERR
        See Also:
        Constant Field Values
      • CONSTRAINT_NAME_NULL_ERR

        public static final java.lang.String CONSTRAINT_NAME_NULL_ERR
        See Also:
        Constant Field Values
      • customModelService

        protected org.alfresco.service.cmr.dictionary.CustomModelService customModelService
      • dictionaryService

        protected org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService
      • personService

        protected org.alfresco.service.cmr.security.PersonService personService
      • nodeService

        protected org.alfresco.service.cmr.repository.NodeService nodeService
      • namespaceService

        protected org.alfresco.service.namespace.NamespaceService namespaceService
      • valueDataTypeValidator

        protected org.alfresco.repo.dictionary.ValueDataTypeValidator valueDataTypeValidator
    • Constructor Detail

      • CustomModelsImpl

        public CustomModelsImpl()
    • Method Detail

      • setCustomModelService

        public void setCustomModelService​(org.alfresco.service.cmr.dictionary.CustomModelService customModelService)
      • setDictionaryService

        public void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
      • setPersonService

        public void setPersonService​(org.alfresco.service.cmr.security.PersonService personService)
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
      • setNamespaceService

        public void setNamespaceService​(org.alfresco.service.namespace.NamespaceService namespaceService)
      • setValueDataTypeValidator

        public void setValueDataTypeValidator​(org.alfresco.repo.dictionary.ValueDataTypeValidator valueDataTypeValidator)
      • getCustomModel

        public CustomModel getCustomModel​(java.lang.String modelName,
                                          Parameters parameters)
        Description copied from interface: CustomModels
        Gets the org.alfresco.rest.api.model.CustomModel representation for the given model
        Specified by:
        getCustomModel in interface CustomModels
        Parameters:
        modelName - the model name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomModel object
      • updateCustomModel

        public CustomModel updateCustomModel​(java.lang.String modelName,
                                             CustomModel model,
                                             Parameters parameters)
        Description copied from interface: CustomModels
        Updates or activates/deactivates the custom model
        Specified by:
        updateCustomModel in interface CustomModels
        Parameters:
        modelName - the model name
        model - the custom model to update (JSON payload)
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomModel object
      • deleteCustomModel

        public void deleteCustomModel​(java.lang.String modelName)
        Description copied from interface: CustomModels
        Deletes the custom model
        Specified by:
        deleteCustomModel in interface CustomModels
        Parameters:
        modelName - the model name
      • getCustomType

        public CustomType getCustomType​(java.lang.String modelName,
                                        java.lang.String typeName,
                                        Parameters parameters)
        Description copied from interface: CustomModels
        Gets the org.alfresco.rest.api.model.CustomType representation of the given model's type
        Specified by:
        getCustomType in interface CustomModels
        Parameters:
        modelName - the model name
        typeName - the model's type name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomType object
      • getCustomTypes

        public CollectionWithPagingInfo<CustomType> getCustomTypes​(java.lang.String modelName,
                                                                   Parameters parameters)
        Description copied from interface: CustomModels
        Gets a paged list of all the given custom model's types
        Specified by:
        getCustomTypes in interface CustomModels
        Parameters:
        modelName - the model name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        a paged list of org.alfresco.rest.api.model.CustomType objects
      • createCustomType

        public CustomType createCustomType​(java.lang.String modelName,
                                           CustomType type)
        Description copied from interface: CustomModels
        Creates custom model's type
        Specified by:
        createCustomType in interface CustomModels
        Parameters:
        modelName - the model name
        type - the custom type to create within the given model
        Returns:
        org.alfresco.rest.api.model.CustomType object
      • updateCustomType

        public CustomType updateCustomType​(java.lang.String modelName,
                                           CustomType type,
                                           Parameters parameters)
        Description copied from interface: CustomModels
        Updates the custom model's type
        Specified by:
        updateCustomType in interface CustomModels
        Parameters:
        modelName - the model name
        type - the custom model's type to update (JSON payload)
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomType object
      • deleteCustomType

        public void deleteCustomType​(java.lang.String modelName,
                                     java.lang.String typeName)
        Description copied from interface: CustomModels
        Deletes the custom model's type
        Specified by:
        deleteCustomType in interface CustomModels
        Parameters:
        modelName - the model name
        typeName - the model's type name
      • getCustomAspect

        public CustomAspect getCustomAspect​(java.lang.String modelName,
                                            java.lang.String aspectName,
                                            Parameters parameters)
        Description copied from interface: CustomModels
        Gets the org.alfresco.rest.api.model.CustomAspect representation of the given model's aspect
        Specified by:
        getCustomAspect in interface CustomModels
        Parameters:
        modelName - the model name
        aspectName - the model's aspect name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomAspect object
      • getCustomAspects

        public CollectionWithPagingInfo<CustomAspect> getCustomAspects​(java.lang.String modelName,
                                                                       Parameters parameters)
        Description copied from interface: CustomModels
        Gets a paged list of all the given custom model's aspects
        Specified by:
        getCustomAspects in interface CustomModels
        Parameters:
        modelName - the model name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        a paged list of org.alfresco.rest.api.model.CustomAspect objects
      • createCustomAspect

        public CustomAspect createCustomAspect​(java.lang.String modelName,
                                               CustomAspect aspect)
        Description copied from interface: CustomModels
        Creates custom model's aspect
        Specified by:
        createCustomAspect in interface CustomModels
        Parameters:
        modelName - the model name
        aspect - the custom aspect to create within the given model
        Returns:
        org.alfresco.rest.api.model.CustomAspect object
      • updateCustomAspect

        public CustomAspect updateCustomAspect​(java.lang.String modelName,
                                               CustomAspect aspect,
                                               Parameters parameters)
        Description copied from interface: CustomModels
        Updates the custom model's aspect
        Specified by:
        updateCustomAspect in interface CustomModels
        Parameters:
        modelName - the model name
        aspect - the custom model's aspect to update (JSON payload)
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomAspect object
      • deleteCustomAspect

        public void deleteCustomAspect​(java.lang.String modelName,
                                       java.lang.String aspectName)
        Description copied from interface: CustomModels
        Deletes the custom model's aspect
        Specified by:
        deleteCustomAspect in interface CustomModels
        Parameters:
        modelName - the model name
        aspectName - the model's aspect name
      • getCustomModelConstraint

        public CustomModelConstraint getCustomModelConstraint​(java.lang.String modelName,
                                                              java.lang.String constraintName,
                                                              Parameters parameters)
        Description copied from interface: CustomModels
        Gets the org.alfresco.rest.api.model.CustomModelConstraint representation of the given model's constraint
        Specified by:
        getCustomModelConstraint in interface CustomModels
        Parameters:
        modelName - the model name
        constraintName - the model's constraint name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomModelConstraint object
      • createCustomModelConstraint

        public CustomModelConstraint createCustomModelConstraint​(java.lang.String modelName,
                                                                 CustomModelConstraint constraint)
        Description copied from interface: CustomModels
        Creates custom model's constraint
        Specified by:
        createCustomModelConstraint in interface CustomModels
        Parameters:
        modelName - the model name
        constraint - the custom constraint to create within the given model
        Returns:
        org.alfresco.rest.api.model.CustomModelConstraint object
      • createDownload

        public CustomModelDownload createDownload​(java.lang.String modelName,
                                                  Parameters parameters)
        Description copied from interface: CustomModels
        Starts the creation of a downloadable archive file containing the custom model file and its associated Share extension module file (if requested).
        Specified by:
        createDownload in interface CustomModels
        Parameters:
        modelName - the model name
        parameters - the Parameters object to get the parameters passed into the request
        Returns:
        org.alfresco.rest.api.model.CustomModelDownload object containing the archive node reference
      • getCurrentUserFullName

        protected java.lang.String getCurrentUserFullName()
        Gets the fully authenticated user's full name
        Returns:
        user's full name or the user's id if the full name dose not exit
      • resolveToUriAndPrefix

        protected org.alfresco.util.Pair<java.lang.String,​java.lang.String> resolveToUriAndPrefix​(java.lang.String parentName)
        Gets the namespace URI and prefix from the parent's name, provided that the given name is of a valid format. The valid format consist of a namespace prefix, a colon and a name. E.g. sys:localized
        Parameters:
        parentName - the parent name
        Returns:
        a pair of namespace URI and prefix object
      • createCustomModel

        public CustomModel createCustomModel​(org.alfresco.repo.dictionary.M2Model m2Model)
        Description copied from interface: CustomModels
        Creates custom model from the imported M2Model.
        Specified by:
        createCustomModel in interface CustomModels
        Parameters:
        m2Model - the model
        Returns:
        org.alfresco.rest.api.model.CustomModel object