Interface CustomModelService
public interface CustomModelService
Custom model service configuration API.
- Author:
- Jamal Kaabi-Mofrad
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activateCustomModel
(String modelFileName) Activates custom modelcompileModel
(M2Model m2Model) Compiles theM2Model
.createCustomModel
(M2Model m2Model, boolean activate) Creates custom modelcreateDownloadNode
(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.getAllCustomAspects
(PagingRequest pagingRequest) Get a paged list of custom aspectsgetAllCustomTypes
(PagingRequest pagingRequest) Gets a paged list of custom typesgetCustomAspect
(QName name) Gets custom aspectgetCustomConstraint
(QName name) Gets custom constraintgetCustomModel
(String modelFileName) Gets custom modelgetCustomModelByUri
(String namespaceUri) Gets custom modelgetCustomModels
(PagingRequest pagingRequest) Gets a paged list of custom modelsGets custom models' information.getCustomType
(QName name) Gets custom typegetM2Model
(NodeRef modelNodeRef) Gets custom modelGets custom models' namespace URI and prefixgetModelNodeRef
(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
isNamespacePrefixExists
(NodeRef modelNodeRef) boolean
isNamespaceUriExists
(String modelNamespaceUri) Whether the given URI has already been used or notupdateCustomModel
(String modelFileName, M2Model m2Model, boolean activate) Updates custom modelvoid
validateModelNamespacePrefix
(String prefix) Validates the custom models' namespace prefixvoid
validateModelNamespacePrefix
(NodeRef modelNodeRef) Validates the custom models' namespace prefix
-
Method Details
-
getCustomModel
Gets custom model- Parameters:
modelFileName
- the name of the custom model to retrieve- Returns:
- the
CustomModelDefinition
(or null, if it doesn't exist)
-
getCustomModelByUri
Gets custom model- Parameters:
namespaceUri
- the namespace URI defined within the model- Returns:
- the
ModelDefinition
(or null, if it doesn't exist)
-
getCustomModels
Gets a paged list of custom models- Parameters:
pagingRequest
- paging request- Returns:
- paged list of
CustomModelDefinition
-
getCustomAspect
Gets custom aspect- Parameters:
name
- the name of the custom aspect to retrieve- Returns:
- the
AspectDefinition
(or null, if it doesn't exist)
-
getAllCustomAspects
Get a paged list of custom aspects- Parameters:
pagingRequest
- paging request- Returns:
- paged list of
AspectDefinition
-
getCustomType
Gets custom type- Parameters:
name
- the name of the custom type to retrieve- Returns:
- the
TypeDefinition
(or null, if it doesn't exist)
-
getAllCustomTypes
Gets a paged list of custom types- Parameters:
pagingRequest
- paging request- Returns:
- paged list of
TypeDefinition
-
getModelNodeRef
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)
-
getM2Model
Gets custom model- Parameters:
modelNodeRef
- theNodeRef
of the custom model- Returns:
- m2Model the
M2Model
object
-
createCustomModel
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
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
Activates custom model- Parameters:
modelFileName
- the name of the custom model
-
deactivateCustomModel
Deactivates custom model- Parameters:
modelFileName
- the name of the custom model
-
updateCustomModel
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
Deletes custom model.The model can only be deleted if it is inactive
- Parameters:
modelFileName
- the model name
-
isNamespaceUriExists
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
-
isNamespacePrefixExists
-
isModelExists
Whether a model with the given name exists or not- Parameters:
modelFileName
- the model name- Returns:
- true if the model exists, false otherwise
-
getModelNamespaceUriPrefix
Gets custom models' namespace URI and prefix- Parameters:
model
- theM2Model
object- Returns:
- the custom model URI and prefix as a
Pair<String, String
- Throws:
CustomModelException
- if no namespace or more than one namespace exists
-
validateModelNamespacePrefix
Validates the custom models' namespace prefix- Parameters:
prefix
- the namespace prefixString
- Throws:
CustomModelException
- if the namespace prefix is already in use by another model
-
validateModelNamespacePrefix
Validates the custom models' namespace prefix- Parameters:
modelNodeRef
- the nodeRef of the model whose namespace prefix is to be validatedNodeRef
- Throws:
CustomModelException
- if the namespace prefix is already in use by another model
-
isNamespacePrefixExists
Whether the given namespace prefix has already been used or not- Parameters:
modelNamespacePrefix
- the model namespace prefix- Returns:
- true if the prefix has been used, false otherwise
-
getCustomConstraint
Gets custom constraint- Parameters:
name
- the name of the custom constraint to retrieve- Returns:
- the
ConstraintDefinition
(or null, if it doesn't exist)
-
createDownloadNode
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
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
-