Package org.alfresco.repo.dictionary
Class CustomModelServiceImpl
- java.lang.Object
-
- org.alfresco.repo.dictionary.CustomModelServiceImpl
-
- All Implemented Interfaces:
CustomModelService
public class CustomModelServiceImpl extends Object implements CustomModelService
Custom Model Service Implementation- Author:
- Jamal Kaabi-Mofrad
-
-
Field Summary
Fields Modifier and Type Field Description static StringALFRESCO_MODEL_ADMINISTRATORS_AUTHORITYstatic QNameASPECT_CUSTOM_MODELstatic StringDEFAULT_CUSTOM_MODEL_ASPECTstatic StringGROUP_ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITYstatic StringSHARE_EXT_MODULE_SUFFIX
-
Constructor Summary
Constructors Constructor Description CustomModelServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateCustomModel(String modelName)CompiledModelcompileModel(M2Model m2Model)CustomModelDefinitioncreateCustomModel(M2Model m2Model, boolean activate)protected NodeRefcreateCustomModelCopy(String newName, NodeRef modelNodeRef)Creates a copy of the custom model where the created node will be a child of download container.protected NodeRefcreateCustomModelShareExtModuleRef(String modelName)Finds themoduleelement within the Share persisted-extension XML file and then writes the XML fragment as the content of a newly created node.NodeRefcreateDownloadNode(String modelFileName, boolean withAssociatedForm)voiddeactivateCustomModel(String modelName)voiddeleteCustomModel(String modelName)org.alfresco.query.PagingResults<AspectDefinition>getAllCustomAspects(org.alfresco.query.PagingRequest pagingRequest)protected List<CustomModelDefinition>getAllCustomModels()org.alfresco.query.PagingResults<TypeDefinition>getAllCustomTypes(org.alfresco.query.PagingRequest pagingRequest)AspectDefinitiongetCustomAspect(QName name)protected Pair<CompiledModel,Boolean>getCustomCompiledModel(String modelName)Returns compiled custom model and whether the model is active or not as aPairobjectConstraintDefinitiongetCustomConstraint(QName name)CustomModelDefinitiongetCustomModel(String modelName)ModelDefinitiongetCustomModelByUri(String namespaceUri)org.alfresco.query.PagingResults<CustomModelDefinition>getCustomModels(org.alfresco.query.PagingRequest pagingRequest)CustomModelsInfogetCustomModelsInfo()TypeDefinitiongetCustomType(QName name)M2ModelgetM2Model(NodeRef modelNodeRef)Pair<String,String>getModelNamespaceUriPrefix(M2Model model)NodeRefgetModelNodeRef(String modelName)protected NodeRefgetShareExtModule()Gets Share persisted-extension nodeRefvoidinit()Checks that all necessary properties and services have been provided.booleanisModelAdmin(String userName)booleanisModelExists(String modelFileName)booleanisNamespacePrefixExists(String modelNamespacePrefix)booleanisNamespacePrefixExists(NodeRef modelNodeRef)booleanisNamespaceUriExists(String modelNamespaceUri)voidsetAuthorityService(AuthorityService authorityService)voidsetContentService(ContentService contentService)voidsetDictionaryDAO(DictionaryDAOImpl dictionaryDAO)voidsetDictionaryService(DictionaryService dictionaryService)voidsetDownloadService(DownloadService downloadSerivce)voidsetDownloadStorage(DownloadStorage downloadStorage)voidsetHiddenAspect(HiddenAspect hiddenAspect)voidsetNamespaceDAO(NamespaceDAO namespaceDAO)voidsetNodeService(NodeService nodeService)voidsetRepoAdminService(RepoAdminService repoAdminService)voidsetRepositoryModelsLocation(RepositoryLocation repoModelsLocation)voidsetRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)voidsetSearchService(SearchService searchService)voidsetShareExtModulePath(String shareExtModulePath)CustomModelDefinitionupdateCustomModel(String modelFileName, M2Model m2Model, boolean activate)voidvalidateModelNamespacePrefix(String prefix)voidvalidateModelNamespacePrefix(NodeRef modelNodeRef)protected <T> org.alfresco.query.PagingResults<T>wrapResult(org.alfresco.query.PagingRequest pagingRequest, List<T> result)
-
-
-
Field Detail
-
DEFAULT_CUSTOM_MODEL_ASPECT
public static final String DEFAULT_CUSTOM_MODEL_ASPECT
- See Also:
- Constant Field Values
-
ASPECT_CUSTOM_MODEL
public static final QName ASPECT_CUSTOM_MODEL
-
ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY
public static final String ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY
- See Also:
- Constant Field Values
-
GROUP_ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY
public static final String GROUP_ALFRESCO_MODEL_ADMINISTRATORS_AUTHORITY
- See Also:
- Constant Field Values
-
SHARE_EXT_MODULE_SUFFIX
public static final String SHARE_EXT_MODULE_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
setNodeService
public void setNodeService(NodeService nodeService)
-
setDictionaryDAO
public void setDictionaryDAO(DictionaryDAOImpl dictionaryDAO)
-
setContentService
public void setContentService(ContentService contentService)
-
setSearchService
public void setSearchService(SearchService searchService)
-
setRepositoryModelsLocation
public void setRepositoryModelsLocation(RepositoryLocation repoModelsLocation)
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
-
setNamespaceDAO
public void setNamespaceDAO(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(String shareExtModulePath)
-
init
public void init()
Checks that all necessary properties and services have been provided.
-
getModelNodeRef
public NodeRef getModelNodeRef(String modelName)
- Specified by:
getModelNodeRefin interfaceCustomModelService
-
getM2Model
public M2Model getM2Model(NodeRef modelNodeRef)
- Specified by:
getM2Modelin interfaceCustomModelService
-
getCustomModel
public CustomModelDefinition getCustomModel(String modelName)
- Specified by:
getCustomModelin interfaceCustomModelService
-
getCustomModelByUri
public ModelDefinition getCustomModelByUri(String namespaceUri)
- Specified by:
getCustomModelByUriin interfaceCustomModelService
-
getCustomCompiledModel
protected Pair<CompiledModel,Boolean> getCustomCompiledModel(String modelName)
Returns compiled custom model and whether the model is active or not as aPairobject- 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<CustomModelDefinition> getCustomModels(org.alfresco.query.PagingRequest pagingRequest)
- Specified by:
getCustomModelsin interfaceCustomModelService
-
getAllCustomModels
protected List<CustomModelDefinition> getAllCustomModels()
-
getCustomAspect
public AspectDefinition getCustomAspect(QName name)
- Specified by:
getCustomAspectin interfaceCustomModelService
-
getAllCustomAspects
public org.alfresco.query.PagingResults<AspectDefinition> getAllCustomAspects(org.alfresco.query.PagingRequest pagingRequest)
- Specified by:
getAllCustomAspectsin interfaceCustomModelService
-
getCustomType
public TypeDefinition getCustomType(QName name)
- Specified by:
getCustomTypein interfaceCustomModelService
-
getAllCustomTypes
public org.alfresco.query.PagingResults<TypeDefinition> getAllCustomTypes(org.alfresco.query.PagingRequest pagingRequest)
- Specified by:
getAllCustomTypesin interfaceCustomModelService
-
getCustomConstraint
public ConstraintDefinition getCustomConstraint(QName name)
- Specified by:
getCustomConstraintin interfaceCustomModelService
-
createCustomModel
public CustomModelDefinition createCustomModel(M2Model m2Model, boolean activate)
- Specified by:
createCustomModelin interfaceCustomModelService
-
updateCustomModel
public CustomModelDefinition updateCustomModel(String modelFileName, M2Model m2Model, boolean activate)
- Specified by:
updateCustomModelin interfaceCustomModelService
-
compileModel
public CompiledModel compileModel(M2Model m2Model)
- Specified by:
compileModelin interfaceCustomModelService
-
wrapResult
protected <T> org.alfresco.query.PagingResults<T> wrapResult(org.alfresco.query.PagingRequest pagingRequest, List<T> result)
-
isModelAdmin
public boolean isModelAdmin(String userName)
- Specified by:
isModelAdminin interfaceCustomModelService
-
activateCustomModel
public void activateCustomModel(String modelName)
- Specified by:
activateCustomModelin interfaceCustomModelService
-
deactivateCustomModel
public void deactivateCustomModel(String modelName)
- Specified by:
deactivateCustomModelin interfaceCustomModelService
-
deleteCustomModel
public void deleteCustomModel(String modelName)
- Specified by:
deleteCustomModelin interfaceCustomModelService
-
isNamespaceUriExists
public boolean isNamespaceUriExists(String modelNamespaceUri)
- Specified by:
isNamespaceUriExistsin interfaceCustomModelService
-
isNamespacePrefixExists
public boolean isNamespacePrefixExists(String modelNamespacePrefix)
- Specified by:
isNamespacePrefixExistsin interfaceCustomModelService
-
isNamespacePrefixExists
public boolean isNamespacePrefixExists(NodeRef modelNodeRef)
- Specified by:
isNamespacePrefixExistsin interfaceCustomModelService
-
isModelExists
public boolean isModelExists(String modelFileName)
- Specified by:
isModelExistsin interfaceCustomModelService
-
getModelNamespaceUriPrefix
public Pair<String,String> getModelNamespaceUriPrefix(M2Model model)
- Specified by:
getModelNamespaceUriPrefixin interfaceCustomModelService
-
validateModelNamespacePrefix
public void validateModelNamespacePrefix(String prefix)
- Specified by:
validateModelNamespacePrefixin interfaceCustomModelService
-
validateModelNamespacePrefix
public void validateModelNamespacePrefix(NodeRef modelNodeRef)
- Specified by:
validateModelNamespacePrefixin interfaceCustomModelService
-
createDownloadNode
public NodeRef createDownloadNode(String modelFileName, boolean withAssociatedForm)
- Specified by:
createDownloadNodein interfaceCustomModelService
-
createCustomModelShareExtModuleRef
protected NodeRef createCustomModelShareExtModuleRef(String modelName)
Finds themoduleelement 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 NodeRef getShareExtModule()
Gets Share persisted-extension nodeRef
-
createCustomModelCopy
protected NodeRef createCustomModelCopy(String newName, 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 namemodelNodeRef- existing model nodeRef- Returns:
- the created nodeRef
-
getCustomModelsInfo
public CustomModelsInfo getCustomModelsInfo()
- Specified by:
getCustomModelsInfoin interfaceCustomModelService
-
-