Class CustomModelServiceImpl

  • All Implemented Interfaces:
    org.alfresco.service.cmr.dictionary.CustomModelService

    public class CustomModelServiceImpl
    extends java.lang.Object
    implements org.alfresco.service.cmr.dictionary.CustomModelService
    Custom Model Service Implementation
    Author:
    Jamal Kaabi-Mofrad
    • Field Detail

      • DEFAULT_CUSTOM_MODEL_ASPECT

        public static final java.lang.String DEFAULT_CUSTOM_MODEL_ASPECT
        See Also:
        Constant Field Values
      • ASPECT_CUSTOM_MODEL

        public static final org.alfresco.service.namespace.QName ASPECT_CUSTOM_MODEL
      • ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY

        public static final java.lang.String ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY
        See Also:
        Constant Field Values
      • GROUP_ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY

        public static final java.lang.String GROUP_ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY
        See Also:
        Constant Field Values
      • SHARE_EXT_MODULE_SUFFIX

        public static final java.lang.String SHARE_EXT_MODULE_SUFFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • CustomModelServiceImpl

        public CustomModelServiceImpl()
    • Method Detail

      • setNodeService

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

        public void setDictionaryDAO​(org.alfresco.repo.dictionary.DictionaryDAOImpl dictionaryDAO)
      • setContentService

        public void setContentService​(ContentService contentService)
      • setSearchService

        public void setSearchService​(org.alfresco.service.cmr.search.SearchService searchService)
      • setRepositoryModelsLocation

        public void setRepositoryModelsLocation​(RepositoryLocation repoModelsLocation)
      • setDictionaryService

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

        public void setNamespaceDAO​(org.alfresco.repo.dictionary.NamespaceDAO namespaceDAO)
      • setRetryingTransactionHelper

        public void setRetryingTransactionHelper​(RetryingTransactionHelper retryingTransactionHelper)
      • setRepoAdminService

        public void setRepoAdminService​(RepoAdminService repoAdminService)
      • setAuthorityService

        public void setAuthorityService​(AuthorityService authorityService)
      • setHiddenAspect

        public void setHiddenAspect​(HiddenAspect hiddenAspect)
      • setDownloadService

        public void setDownloadService​(DownloadService downloadSerivce)
      • setDownloadStorage

        public void setDownloadStorage​(DownloadStorage downloadStorage)
      • setShareExtModulePath

        public void setShareExtModulePath​(java.lang.String shareExtModulePath)
      • init

        public void init()
        Checks that all necessary properties and services have been provided.
      • getModelNodeRef

        public org.alfresco.service.cmr.repository.NodeRef getModelNodeRef​(java.lang.String modelName)
        Specified by:
        getModelNodeRef in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getCustomModel

        public org.alfresco.service.cmr.dictionary.CustomModelDefinition getCustomModel​(java.lang.String modelName)
        Specified by:
        getCustomModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getCustomModelByUri

        public org.alfresco.service.cmr.dictionary.ModelDefinition getCustomModelByUri​(java.lang.String namespaceUri)
        Specified by:
        getCustomModelByUri in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getCustomCompiledModel

        protected org.alfresco.util.Pair<org.alfresco.repo.dictionary.CompiledModel,​java.lang.Boolean> getCustomCompiledModel​(java.lang.String modelName)
        Returns compiled custom model and whether the model is active or not as a Pair object
        Parameters:
        modelName - the name of the custom model to retrieve
        Returns:
        the Pair<CompiledModel, Boolean> (or null, if it doesn't exist)
      • getCustomModels

        public org.alfresco.query.PagingResults<org.alfresco.service.cmr.dictionary.CustomModelDefinition> getCustomModels​(org.alfresco.query.PagingRequest pagingRequest)
        Specified by:
        getCustomModels in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getAllCustomModels

        protected java.util.List<org.alfresco.service.cmr.dictionary.CustomModelDefinition> getAllCustomModels()
      • getCustomAspect

        public org.alfresco.service.cmr.dictionary.AspectDefinition getCustomAspect​(org.alfresco.service.namespace.QName name)
        Specified by:
        getCustomAspect in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getAllCustomAspects

        public org.alfresco.query.PagingResults<org.alfresco.service.cmr.dictionary.AspectDefinition> getAllCustomAspects​(org.alfresco.query.PagingRequest pagingRequest)
        Specified by:
        getAllCustomAspects in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getCustomType

        public org.alfresco.service.cmr.dictionary.TypeDefinition getCustomType​(org.alfresco.service.namespace.QName name)
        Specified by:
        getCustomType in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getAllCustomTypes

        public org.alfresco.query.PagingResults<org.alfresco.service.cmr.dictionary.TypeDefinition> getAllCustomTypes​(org.alfresco.query.PagingRequest pagingRequest)
        Specified by:
        getAllCustomTypes in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • getCustomConstraint

        public org.alfresco.service.cmr.dictionary.ConstraintDefinition getCustomConstraint​(org.alfresco.service.namespace.QName name)
        Specified by:
        getCustomConstraint in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • createCustomModel

        public org.alfresco.service.cmr.dictionary.CustomModelDefinition createCustomModel​(org.alfresco.repo.dictionary.M2Model m2Model,
                                                                                           boolean activate)
        Specified by:
        createCustomModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • updateCustomModel

        public org.alfresco.service.cmr.dictionary.CustomModelDefinition updateCustomModel​(java.lang.String modelFileName,
                                                                                           org.alfresco.repo.dictionary.M2Model m2Model,
                                                                                           boolean activate)
        Specified by:
        updateCustomModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • compileModel

        public org.alfresco.repo.dictionary.CompiledModel compileModel​(org.alfresco.repo.dictionary.M2Model m2Model)
        Specified by:
        compileModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • wrapResult

        protected <T> org.alfresco.query.PagingResults<T> wrapResult​(org.alfresco.query.PagingRequest pagingRequest,
                                                                     java.util.List<T> result)
      • isModelAdmin

        public boolean isModelAdmin​(java.lang.String userName)
        Specified by:
        isModelAdmin in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • activateCustomModel

        public void activateCustomModel​(java.lang.String modelName)
        Specified by:
        activateCustomModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • deactivateCustomModel

        public void deactivateCustomModel​(java.lang.String modelName)
        Specified by:
        deactivateCustomModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • deleteCustomModel

        public void deleteCustomModel​(java.lang.String modelName)
        Specified by:
        deleteCustomModel in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • isNamespaceUriExists

        public boolean isNamespaceUriExists​(java.lang.String modelNamespaceUri)
        Specified by:
        isNamespaceUriExists in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • isNamespacePrefixExists

        public boolean isNamespacePrefixExists​(java.lang.String modelNamespacePrefix)
        Specified by:
        isNamespacePrefixExists in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • isModelExists

        public boolean isModelExists​(java.lang.String modelFileName)
        Specified by:
        isModelExists in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • createDownloadNode

        public org.alfresco.service.cmr.repository.NodeRef createDownloadNode​(java.lang.String modelFileName,
                                                                              boolean withAssociatedForm)
        Specified by:
        createDownloadNode in interface org.alfresco.service.cmr.dictionary.CustomModelService
      • createCustomModelShareExtModuleRef

        protected org.alfresco.service.cmr.repository.NodeRef createCustomModelShareExtModuleRef​(java.lang.String modelName)
        Finds the module element within the Share persisted-extension XML file and then writes the XML fragment as the content of a newly created node.
        Parameters:
        modelName - the model name
        Returns:
        the created nodeRef
      • getShareExtModule

        protected org.alfresco.service.cmr.repository.NodeRef getShareExtModule()
        Gets Share persisted-extension nodeRef
      • createCustomModelCopy

        protected org.alfresco.service.cmr.repository.NodeRef createCustomModelCopy​(java.lang.String newName,
                                                                                    org.alfresco.service.cmr.repository.NodeRef modelNodeRef)
        Creates a copy of the custom model where the created node will be a child of download container.
        Parameters:
        newName - the model new name
        modelNodeRef - existing model nodeRef
        Returns:
        the created nodeRef
      • getCustomModelsInfo

        public org.alfresco.repo.dictionary.CustomModelsInfo getCustomModelsInfo()
        Specified by:
        getCustomModelsInfo in interface org.alfresco.service.cmr.dictionary.CustomModelService