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 Summary
Fields Modifier and Type Field Description protected DictionaryService
dictionaryservice
Dictionary serviceprotected static String
MODEL_PROP_KEY_MESSAGE_LOOKUP
protected NamespaceService
namespaceService
Namespace service
-
Constructor Summary
Constructors Constructor Description DictionaryWebServiceBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected QName
createClassQName(String className)
protected QName
createClassQName(String prefix, String shortName)
String
getFullNamespaceURI(String classname)
String
getFullNamespaceURI(String prefix, String shorname)
String
getNamespaceURIfromQname(QName qname)
String
getPrefix(String classname)
String
getPrefixFromModelName(String modelname)
String
getShortName(String classname)
String
getValidInput(String input)
boolean
isValidAssociationFilter(String af)
boolean
isValidClassFilter(String classfilter)
boolean
isValidClassname(String classname)
boolean
isValidClassname(String prefix, String shorname)
Checks whether the classname is validboolean
isValidModelName(String modelname)
boolean
isValidTypeorAspect(String classname)
boolean
isValidTypeorAspect(String prefix, String shorname)
protected <T> Collection<T>
reorderedValues(List<ClassDefinition> sortedClassDefs, Map<QName,T> dependent)
Returns dependent collections (properties or associations) in order that complies to order of class definitionsvoid
setDictionaryService(DictionaryService dictionaryService)
Set the dictionaryService property.void
setNamespaceService(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 NamespaceService namespaceService
Namespace service
-
dictionaryservice
protected DictionaryService dictionaryservice
Dictionary service
-
-
Method Detail
-
setNamespaceService
public void setNamespaceService(NamespaceService namespaceservice)
Set the namespaceService property.- Parameters:
namespaceservice
- The namespace service instance to set
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
Set the dictionaryService property.- Parameters:
dictionaryService
- The dictionary service instance to set
-
createClassQName
protected 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(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<ClassDefinition> sortedClassDefs, Map<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
-
-