Interface CustomModelService
-
public interface CustomModelServiceCustom model service configuration API.- Author:
- Jamal Kaabi-Mofrad
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidactivateCustomModel(java.lang.String modelFileName)Activates custom modelCompiledModelcompileModel(M2Model m2Model)Compiles theM2Model.CustomModelDefinitioncreateCustomModel(M2Model m2Model, boolean activate)Creates custom modelNodeRefcreateDownloadNode(java.lang.String modelName, boolean withAssociatedForm)Creates a downloadable archive file containing the custom model file and if specified, its associated Share extension module file.voiddeactivateCustomModel(java.lang.String modelFileName)Deactivates custom modelvoiddeleteCustomModel(java.lang.String modelFileName)Deletes custom model.org.alfresco.query.PagingResults<AspectDefinition>getAllCustomAspects(org.alfresco.query.PagingRequest pagingRequest)Get a paged list of custom aspectsorg.alfresco.query.PagingResults<TypeDefinition>getAllCustomTypes(org.alfresco.query.PagingRequest pagingRequest)Gets a paged list of custom typesAspectDefinitiongetCustomAspect(QName name)Gets custom aspectConstraintDefinitiongetCustomConstraint(QName name)Gets custom constraintCustomModelDefinitiongetCustomModel(java.lang.String modelFileName)Gets custom modelModelDefinitiongetCustomModelByUri(java.lang.String namespaceUri)Gets custom modelorg.alfresco.query.PagingResults<CustomModelDefinition>getCustomModels(org.alfresco.query.PagingRequest pagingRequest)Gets a paged list of custom modelsCustomModelsInfogetCustomModelsInfo()Gets custom models' information.TypeDefinitiongetCustomType(QName name)Gets custom typeNodeRefgetModelNodeRef(java.lang.String modelFileName)Gets custom model node referencebooleanisModelAdmin(java.lang.String userName)Indicates whether the specified user is a model-administrator or not.booleanisModelExists(java.lang.String modelFileName)Whether a model with the given name exists or notbooleanisNamespacePrefixExists(java.lang.String modelNamespacePrefix)Whether the given namespace prefix has already been used or notbooleanisNamespaceUriExists(java.lang.String modelNamespaceUri)Whether the given URI has already been used or notCustomModelDefinitionupdateCustomModel(java.lang.String modelFileName, M2Model m2Model, boolean activate)Updates custom model
-
-
-
Method Detail
-
getCustomModel
CustomModelDefinition getCustomModel(java.lang.String modelFileName)
Gets custom model- Parameters:
modelFileName- the name of the custom model to retrieve- Returns:
- the
CustomModelDefinition(or null, if it doesn't exist)
-
getCustomModelByUri
ModelDefinition getCustomModelByUri(java.lang.String namespaceUri)
Gets custom model- Parameters:
namespaceUri- the namespace URI defined within the model- Returns:
- the
ModelDefinition(or null, if it doesn't exist)
-
getCustomModels
org.alfresco.query.PagingResults<CustomModelDefinition> getCustomModels(org.alfresco.query.PagingRequest pagingRequest)
Gets a paged list of custom models- Parameters:
pagingRequest- paging request- Returns:
- paged list of
CustomModelDefinition
-
getCustomAspect
AspectDefinition getCustomAspect(QName name)
Gets custom aspect- Parameters:
name- the name of the custom aspect to retrieve- Returns:
- the
AspectDefinition(or null, if it doesn't exist)
-
getAllCustomAspects
org.alfresco.query.PagingResults<AspectDefinition> getAllCustomAspects(org.alfresco.query.PagingRequest pagingRequest)
Get a paged list of custom aspects- Parameters:
pagingRequest- paging request- Returns:
- paged list of
AspectDefinition
-
getCustomType
TypeDefinition getCustomType(QName name)
Gets custom type- Parameters:
name- the name of the custom type to retrieve- Returns:
- the
TypeDefinition(or null, if it doesn't exist)
-
getAllCustomTypes
org.alfresco.query.PagingResults<TypeDefinition> getAllCustomTypes(org.alfresco.query.PagingRequest pagingRequest)
Gets a paged list of custom types- Parameters:
pagingRequest- paging request- Returns:
- paged list of
TypeDefinition
-
getModelNodeRef
NodeRef getModelNodeRef(java.lang.String modelFileName)
Gets custom model node reference- Parameters:
modelFileName- the name of the custom model to retrieve- Returns:
- the
NodeRefof the custom model (or null, if it doesn't exist)
-
createCustomModel
CustomModelDefinition createCustomModel(M2Model m2Model, boolean activate)
Creates custom model- Parameters:
m2Model- theM2Modelobjectactivate- whether the model should be activated or not- Returns:
- the created model definition as a
CustomModelDefinitionobject
-
isModelAdmin
boolean isModelAdmin(java.lang.String userName)
Indicates whether the specified user is a model-administrator or not.Note: The super/repo admin is considered to be a model-administrator too.
- Parameters:
userName- The user name- Returns:
- true if the specified user is a model-administrator, false otherwise
-
activateCustomModel
void activateCustomModel(java.lang.String modelFileName)
Activates custom model- Parameters:
modelFileName- the name of the custom model
-
deactivateCustomModel
void deactivateCustomModel(java.lang.String modelFileName)
Deactivates custom model- Parameters:
modelFileName- the name of the custom model
-
updateCustomModel
CustomModelDefinition updateCustomModel(java.lang.String modelFileName, M2Model m2Model, boolean activate)
Updates custom model- Parameters:
modelFileName- the model namem2Model- theM2Modelobjectactivate- whether the model should be activated or not- Returns:
- the updated model definition as a
CustomModelDefinitionobject
-
deleteCustomModel
void deleteCustomModel(java.lang.String modelFileName)
Deletes custom model.The model can only be deleted if it is inactive
- Parameters:
modelFileName- the model name
-
isNamespaceUriExists
boolean isNamespaceUriExists(java.lang.String modelNamespaceUri)
Whether the given URI has already been used or not- Parameters:
modelNamespaceUri- the model namespace URI- Returns:
- true if the URI has been used, false otherwise
-
isModelExists
boolean isModelExists(java.lang.String modelFileName)
Whether a model with the given name exists or not- Parameters:
modelFileName- the model name- Returns:
- true if the model exists, false otherwise
-
isNamespacePrefixExists
boolean isNamespacePrefixExists(java.lang.String modelNamespacePrefix)
Whether the given namespace prefix has already been used or not- Parameters:
modelNamespaceUri- the model namespace prefix- Returns:
- true if the prefix has been used, false otherwise
-
getCustomConstraint
ConstraintDefinition getCustomConstraint(QName name)
Gets custom constraint- Parameters:
name- the name of the custom constraint to retrieve- Returns:
- the
ConstraintDefinition(or null, if it doesn't exist)
-
createDownloadNode
NodeRef createDownloadNode(java.lang.String modelName, boolean withAssociatedForm)
Creates a downloadable archive file containing the custom model file and if specified, its associated Share extension module file.- Parameters:
modelName- the model name to be exportedwithAssociatedForm- whether Share extension module file should be included or not- Returns:
- reference to the node which will contain the archive file
-
compileModel
CompiledModel compileModel(M2Model m2Model)
Compiles theM2Model.- Parameters:
m2Model- the model- Returns:
- the compiled model of the given m2model
- Throws:
CustomModelConstraintExceptionInvalidCustomModelException
-
getCustomModelsInfo
CustomModelsInfo getCustomModelsInfo()
Gets custom models' information.- Returns:
CustomModelsInfocontaining:- number of active models
- number of active models' types
- number of active models' aspects
-
-