Class MapBasedQueryWalker
- java.lang.Object
-
- org.alfresco.rest.framework.resource.parameters.where.QueryHelper.WalkerCallbackAdapter
-
- org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker
-
- All Implemented Interfaces:
QueryHelper.WalkerCallback
- Direct Known Subclasses:
MapBasedQueryWalkerOrSupported
public class MapBasedQueryWalker extends QueryHelper.WalkerCallbackAdapter
Query walker that adds all properties for "equals" comparison to a map. If an unsupported property or comparison operation is encountered, anInvalidArgumentExceptionis thrown unless the methodhandleUnmatchedComparison(int, String, String)returns true (default implementation returns false).- Author:
- Frederik Heremans, Tijs Rademakers
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapBasedQueryWalker.QueryVariableHolder
-
Field Summary
-
Fields inherited from class org.alfresco.rest.framework.resource.parameters.where.QueryHelper.WalkerCallbackAdapter
UNSUPPORTED
-
-
Constructor Summary
Constructors Constructor Description MapBasedQueryWalker(java.util.Set<java.lang.String> supportedEqualsParameters, java.util.Set<java.lang.String> supportedMatchesParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidand()Called any time an AND is encountered.voidcomparison(int type, java.lang.String propertyName, java.lang.String propertyValue, boolean negated)One of EQUALS LESSTHAN GREATERTHAN LESSTHANOREQUALS GREATERTHANOREQUALS;voidenableVariablesSupport(org.alfresco.service.namespace.NamespaceService namespaceService, org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)java.lang.StringgetProperty(java.lang.String propertyName, int type)<T> TgetProperty(java.lang.String propertyName, int type, java.lang.Class<T> returnType)Get the property value, converted to the requested type.java.util.List<MapBasedQueryWalker.QueryVariableHolder>getVariableProperties()protected booleanhandleUnmatchedComparison(int type, java.lang.String propertyName, java.lang.String propertyValue)Called when unsupported property is encountered or comparison operator other than equals.voidmatches(java.lang.String property, java.lang.String value, boolean negated)Called any time a MATCHES clause is encountered.protected voidprocessVariable(java.lang.String propertyName, java.lang.String propertyValue, int type)voidsetSupportedGreaterThanOrEqualParameters(java.util.Set<java.lang.String> supportedGreaterThanOrEqualParameters)voidsetSupportedGreaterThanParameters(java.util.Set<java.lang.String> supportedGreaterThanParameters)voidsetSupportedLessThanOrEqualParameters(java.util.Set<java.lang.String> supportedLessThanOrEqualParameters)voidsetSupportedLessThanParameters(java.util.Set<java.lang.String> supportedLessThanParameters)-
Methods inherited from class org.alfresco.rest.framework.resource.parameters.where.QueryHelper.WalkerCallbackAdapter
between, exists, in, or
-
-
-
-
Method Detail
-
setSupportedGreaterThanParameters
public void setSupportedGreaterThanParameters(java.util.Set<java.lang.String> supportedGreaterThanParameters)
-
setSupportedGreaterThanOrEqualParameters
public void setSupportedGreaterThanOrEqualParameters(java.util.Set<java.lang.String> supportedGreaterThanOrEqualParameters)
-
setSupportedLessThanParameters
public void setSupportedLessThanParameters(java.util.Set<java.lang.String> supportedLessThanParameters)
-
setSupportedLessThanOrEqualParameters
public void setSupportedLessThanOrEqualParameters(java.util.Set<java.lang.String> supportedLessThanOrEqualParameters)
-
enableVariablesSupport
public void enableVariablesSupport(org.alfresco.service.namespace.NamespaceService namespaceService, org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
-
getVariableProperties
public java.util.List<MapBasedQueryWalker.QueryVariableHolder> getVariableProperties()
-
matches
public void matches(java.lang.String property, java.lang.String value, boolean negated)Description copied from interface:QueryHelper.WalkerCallbackCalled any time a MATCHES clause is encountered.- Specified by:
matchesin interfaceQueryHelper.WalkerCallback- Overrides:
matchesin classQueryHelper.WalkerCallbackAdapter- Parameters:
property- Name of the propertyvalue- Stringnegated- returns true if "NOT MATCHES" was used
-
comparison
public void comparison(int type, java.lang.String propertyName, java.lang.String propertyValue, boolean negated)Description copied from interface:QueryHelper.WalkerCallbackOne of EQUALS LESSTHAN GREATERTHAN LESSTHANOREQUALS GREATERTHANOREQUALS;- Specified by:
comparisonin interfaceQueryHelper.WalkerCallback- Overrides:
comparisonin classQueryHelper.WalkerCallbackAdapter
-
getProperty
public java.lang.String getProperty(java.lang.String propertyName, int type)
-
getProperty
public <T> T getProperty(java.lang.String propertyName, int type, java.lang.Class<T> returnType)Get the property value, converted to the requested type.- Parameters:
propertyName- name of the parametertype- intreturnType- type of object to return- Returns:
- the converted parameter value. Null, if the property has no value.
- Throws:
java.lang.IllegalArgumentException- when no conversion for the given returnType is available or if returnType is null.InvalidArgumentException- when conversion to the given type was not possible due to an error while converting
-
and
public void and()
Description copied from interface:QueryHelper.WalkerCallbackCalled any time an AND is encountered.- Specified by:
andin interfaceQueryHelper.WalkerCallback- Overrides:
andin classQueryHelper.WalkerCallbackAdapter
-
processVariable
protected void processVariable(java.lang.String propertyName, java.lang.String propertyValue, int type)
-
handleUnmatchedComparison
protected boolean handleUnmatchedComparison(int type, java.lang.String propertyName, java.lang.String propertyValue)Called when unsupported property is encountered or comparison operator other than equals.- Returns:
- true, if the comparison is handles successfully. False, if an exception should be thrown because the comparison can't be handled.
-
-