Class DictionaryWebServiceBase

java.lang.Object
org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.DeclarativeWebScript
org.alfresco.repo.web.scripts.dictionary.DictionaryWebServiceBase
All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
Direct Known Subclasses:
AbstractAssociationGet, AbstractAssociationsGet, AbstractClassesGet, AbstractClassGet, AbstractPropertiesGet, AbstractPropertyGet, AbstractSubClassesGet, DictionaryGet

public abstract class DictionaryWebServiceBase extends org.springframework.extensions.webscripts.DeclarativeWebScript
Base class for Dictionary web scripts
Author:
Saravanan Sellathurai
  • Field Details

    • MODEL_PROP_KEY_MESSAGE_LOOKUP

      protected static final String MODEL_PROP_KEY_MESSAGE_LOOKUP
      See Also:
    • namespaceService

      protected org.alfresco.service.namespace.NamespaceService namespaceService
      Namespace service
    • dictionaryservice

      protected org.alfresco.service.cmr.dictionary.DictionaryService dictionaryservice
      Dictionary service
  • Constructor Details

    • DictionaryWebServiceBase

      public DictionaryWebServiceBase()
  • Method Details

    • setNamespaceService

      public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceservice)
      Set the namespaceService property.
      Parameters:
      namespaceservice - The namespace service instance to set
    • setDictionaryService

      public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
      Set the dictionaryService property.
      Parameters:
      dictionaryService - The dictionary service instance to set
    • createClassQName

      protected org.alfresco.service.namespace.QName createClassQName(String className)
    • createClassQName

      protected org.alfresco.service.namespace.QName createClassQName(String prefix, String shortName)
      Parameters:
      prefix - - prefix for class name
      shortName - - short class name
      Returns:
      qualified name for class name
    • getNamespaceURIfromQname

      public String getNamespaceURIfromQname(org.alfresco.service.namespace.QName qname)
      Parameters:
      qname - QName
      Returns:
      the namespaceuri from a qname
    • getFullNamespaceURI

      public String getFullNamespaceURI(String classname)
      Parameters:
      classname - the class name as cm_person
      Returns:
      String the full name in the following format {namespaceuri}shorname
    • getFullNamespaceURI

      public String getFullNamespaceURI(String prefix, String shorname)
      Parameters:
      prefix - prefix for classname as cm
      shorname - the short class name as person
      Returns:
      String the full name in the following format {namespaceuri}shorname
    • isValidClassname

      public boolean isValidClassname(String classname)
      Parameters:
      classname - - checks whether the classname is valid , gets the classname as input e.g cm_person
      Returns:
      true - if the class is valid , false - if the class is invalid
    • isValidClassname

      public boolean isValidClassname(String prefix, String shorname)
      Checks whether the classname is valid
      Parameters:
      prefix - - gets the prefix as input e.g cm
      shorname - - gets the short classname as input e.g person
      Returns:
      true - if the class is valid , false - if the class is invalid
    • getPrefixFromModelName

      public String getPrefixFromModelName(String modelname)
      Parameters:
      modelname - String
      Returns:
      modelname from namespaceprefix - returns null if invalid namespaceprefix is given
    • isValidAssociationFilter

      public boolean isValidAssociationFilter(String af)
    • isValidTypeorAspect

      public boolean isValidTypeorAspect(String classname)
      Parameters:
      classname - as the input
      Returns:
      true if it is a aspect or false if it is a Type
    • isValidTypeorAspect

      public boolean isValidTypeorAspect(String prefix, String shorname)
      Parameters:
      prefix - as the input
      shorname - as the input
      Returns:
      true if it is a aspect or false if it is a Type
    • isValidModelName

      public boolean isValidModelName(String modelname)
      Parameters:
      modelname - - gets the modelname as the input (modelname is without prefix ie. cm:contentmodel => where modelname = contentmodel)
      Returns:
      true if valid or false
    • getPrefix

      public String getPrefix(String classname)
      Parameters:
      classname - - returns the prefix from the classname of the format namespaceprefix:name eg. cm_person
      Returns:
      prefix - returns the prefix of the classname
    • getShortName

      public String getShortName(String classname)
      Parameters:
      classname - String
      Returns:
      the shortname from the classname of the format cm_person here person represents the shortname
    • getValidInput

      public String getValidInput(String input)
      Parameters:
      input - -gets a string input and validates it
      Returns:
      null if invalid or the string itself if its valid
    • isValidClassFilter

      public boolean isValidClassFilter(String classfilter)
      Parameters:
      classfilter - =>valid class filters are all,apect or type
      Returns:
      true if valid or false if invalid
    • reorderedValues

      protected <T> Collection<T> reorderedValues(List<org.alfresco.service.cmr.dictionary.ClassDefinition> sortedClassDefs, Map<org.alfresco.service.namespace.QName,T> dependent)
      Returns dependent collections (properties or associations) in order that complies to order of class definitions
      Parameters:
      sortedClassDefs - - list of sorted class definitions
      dependent - - collections that depend on class definitions
      Returns:
      collection of dependent values