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.DeclarativeWebScriptBase class for Dictionary web scripts- Author:
- Saravanan Sellathurai
-
-
Field Summary
Fields Modifier and Type Field Description protected org.alfresco.service.cmr.dictionary.DictionaryServicedictionaryserviceDictionary serviceprotected static StringMODEL_PROP_KEY_MESSAGE_LOOKUPprotected org.alfresco.service.namespace.NamespaceServicenamespaceServiceNamespace service
-
Constructor Summary
Constructors Constructor Description DictionaryWebServiceBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.alfresco.service.namespace.QNamecreateClassQName(String className)protected org.alfresco.service.namespace.QNamecreateClassQName(String prefix, String shortName)StringgetFullNamespaceURI(String classname)StringgetFullNamespaceURI(String prefix, String shorname)StringgetNamespaceURIfromQname(org.alfresco.service.namespace.QName qname)StringgetPrefix(String classname)StringgetPrefixFromModelName(String modelname)StringgetShortName(String classname)StringgetValidInput(String input)booleanisValidAssociationFilter(String af)booleanisValidClassFilter(String classfilter)booleanisValidClassname(String classname)booleanisValidClassname(String prefix, String shorname)Checks whether the classname is validbooleanisValidModelName(String modelname)booleanisValidTypeorAspect(String classname)booleanisValidTypeorAspect(String prefix, String shorname)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 definitionsvoidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)Set the dictionaryService property.voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceservice)Set the namespaceService property.-
Methods inherited from class org.springframework.extensions.webscripts.DeclarativeWebScript
execute, executeFinallyImpl, executeImpl, executeImpl, executeImpl, getTemplateModel, renderFormatTemplate
-
Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
-
-
-
-
Field Detail
-
MODEL_PROP_KEY_MESSAGE_LOOKUP
protected static final String MODEL_PROP_KEY_MESSAGE_LOOKUP
- See Also:
- Constant Field Values
-
namespaceService
protected org.alfresco.service.namespace.NamespaceService namespaceService
Namespace service
-
dictionaryservice
protected org.alfresco.service.cmr.dictionary.DictionaryService dictionaryservice
Dictionary service
-
-
Method Detail
-
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 nameshortName- - 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 cmshorname- 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 cmshorname- - 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 inputshorname- 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 definitionsdependent- - collections that depend on class definitions- Returns:
- collection of dependent values
-
-