Interface CustomModelService


public interface CustomModelService
Custom model service configuration API.
Author:
Jamal Kaabi-Mofrad
  • Method Details

    • 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)
    • getM2Model

      M2Model getM2Model(NodeRef modelNodeRef)
      Gets custom model
      Parameters:
      modelNodeRef - the NodeRef of the custom model
      Returns:
      m2Model the M2Model object
    • createCustomModel

      CustomModelDefinition createCustomModel(M2Model m2Model, boolean activate)
      Creates custom model
      Parameters:
      m2Model - the M2Model object
      activate - 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 name
      m2Model - the M2Model object
      activate - 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
    • isNamespacePrefixExists

      boolean isNamespacePrefixExists(NodeRef modelNodeRef)
    • 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
    • getModelNamespaceUriPrefix

      Pair<String,String> getModelNamespaceUriPrefix(M2Model model)
      Gets custom models' namespace URI and prefix
      Parameters:
      model - the M2Model 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

      void validateModelNamespacePrefix(String prefix)
      Validates the custom models' namespace prefix
      Parameters:
      prefix - the namespace prefix String
      Throws:
      CustomModelException - if the namespace prefix is already in use by another model
    • validateModelNamespacePrefix

      void validateModelNamespacePrefix(NodeRef modelNodeRef)
      Validates the custom models' namespace prefix
      Parameters:
      modelNodeRef - the nodeRef of the model whose namespace prefix is to be validated NodeRef
      Throws:
      CustomModelException - if the namespace prefix is already in use by another model
    • isNamespacePrefixExists

      boolean isNamespacePrefixExists(String modelNamespacePrefix)
      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

      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 exported
      withAssociatedForm - 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 the M2Model.
      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