Interface CustomModelService
-
public interface CustomModelService
Custom model service configuration API.- Author:
- Jamal Kaabi-Mofrad
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
activateCustomModel(String modelFileName)
Activates custom modelCompiledModel
compileModel(M2Model m2Model)
Compiles theM2Model
.CustomModelDefinition
createCustomModel(M2Model m2Model, boolean activate)
Creates custom modelNodeRef
createDownloadNode(String modelName, boolean withAssociatedForm)
Creates a downloadable archive file containing the custom model file and if specified, its associated Share extension module file.void
deactivateCustomModel(String modelFileName)
Deactivates custom modelvoid
deleteCustomModel(String modelFileName)
Deletes custom model.PagingResults<AspectDefinition>
getAllCustomAspects(PagingRequest pagingRequest)
Get a paged list of custom aspectsPagingResults<TypeDefinition>
getAllCustomTypes(PagingRequest pagingRequest)
Gets a paged list of custom typesAspectDefinition
getCustomAspect(QName name)
Gets custom aspectConstraintDefinition
getCustomConstraint(QName name)
Gets custom constraintCustomModelDefinition
getCustomModel(String modelFileName)
Gets custom modelModelDefinition
getCustomModelByUri(String namespaceUri)
Gets custom modelPagingResults<CustomModelDefinition>
getCustomModels(PagingRequest pagingRequest)
Gets a paged list of custom modelsCustomModelsInfo
getCustomModelsInfo()
Gets custom models' information.TypeDefinition
getCustomType(QName name)
Gets custom typeNodeRef
getModelNodeRef(String modelFileName)
Gets custom model node referenceboolean
isModelAdmin(String userName)
Indicates whether the specified user is a model-administrator or not.boolean
isModelExists(String modelFileName)
Whether a model with the given name exists or notboolean
isNamespacePrefixExists(String modelNamespacePrefix)
Whether the given namespace prefix has already been used or notboolean
isNamespaceUriExists(String modelNamespaceUri)
Whether the given URI has already been used or notCustomModelDefinition
updateCustomModel(String modelFileName, M2Model m2Model, boolean activate)
Updates custom model
-
-
-
Method Detail
-
getCustomModel
CustomModelDefinition getCustomModel(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(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
PagingResults<CustomModelDefinition> getCustomModels(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
PagingResults<AspectDefinition> getAllCustomAspects(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
PagingResults<TypeDefinition> getAllCustomTypes(PagingRequest pagingRequest)
Gets a paged list of custom types- Parameters:
pagingRequest
- paging request- Returns:
- paged list of
TypeDefinition
-
getModelNodeRef
NodeRef getModelNodeRef(String modelFileName)
Gets custom model node reference- Parameters:
modelFileName
- the name of the custom model to retrieve- Returns:
- the
NodeRef
of the custom model (or null, if it doesn't exist)
-
createCustomModel
CustomModelDefinition createCustomModel(M2Model m2Model, boolean activate)
Creates custom model- Parameters:
m2Model
- theM2Model
objectactivate
- whether the model should be activated or not- Returns:
- the created model definition as a
CustomModelDefinition
object
-
isModelAdmin
boolean isModelAdmin(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(String modelFileName)
Activates custom model- Parameters:
modelFileName
- the name of the custom model
-
deactivateCustomModel
void deactivateCustomModel(String modelFileName)
Deactivates custom model- Parameters:
modelFileName
- the name of the custom model
-
updateCustomModel
CustomModelDefinition updateCustomModel(String modelFileName, M2Model m2Model, boolean activate)
Updates custom model- Parameters:
modelFileName
- the model namem2Model
- theM2Model
objectactivate
- whether the model should be activated or not- Returns:
- the updated model definition as a
CustomModelDefinition
object
-
deleteCustomModel
void deleteCustomModel(String modelFileName)
Deletes custom model.The model can only be deleted if it is inactive
- Parameters:
modelFileName
- the model name
-
isNamespaceUriExists
boolean isNamespaceUriExists(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(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(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(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:
CustomModelConstraintException
InvalidCustomModelException
-
getCustomModelsInfo
CustomModelsInfo getCustomModelsInfo()
Gets custom models' information.- Returns:
CustomModelsInfo
containing:- number of active models
- number of active models' types
- number of active models' aspects
-
-