org.mmbase.bridge.util
Class SearchUtil

java.lang.Object
  extended by org.mmbase.bridge.util.SearchUtil

public class SearchUtil
extends Object

This utility provides methods to easily create and execute queries in the bridge. These methods are replacements for frequently used code snippets which are present in code which uses the query objects in the mmbase bridge. The implementation of these methods can also be used as documentation how to use the search query api.

Version:
$Id: SearchUtil.java 34900 2009-05-01 16:29:42Z michiel $
Author:
Nico Klasens

Field Summary
static String DESTINATION
          A Search direction of relations in queries
static String SOURCE
          A Search direction of relations in queries
 
Method Summary
static void addConstraint(Query query, Constraint constraint)
          Add a constraint to the query.
static void addConstraint(Query query, Constraint constraint, int operator)
          Add a constraint to the query.
static void addDatetimeConstraint(NodeQuery query, Field field, long from, long to)
          Add a date and time constraint to a query
static void addDayConstraint(NodeQuery query, NodeManager manager, String fieldname, String daysToCompare)
          Add a date and time constraint to a query where the value is between now and the days passed in.
static void addEqualConstraint(NodeQuery query, Field field, Boolean value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, Field field, Integer value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, Field field, Object value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, Field field, String value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, Boolean value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, Integer value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, Object value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, String value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, Field field, Boolean value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, Field field, Integer value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, Field field, Object value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, Field field, String value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, NodeManager manager, String fieldname, Boolean value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, NodeManager manager, String fieldname, Integer value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, NodeManager manager, String fieldname, Object value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addEqualConstraint(Query query, NodeManager manager, String fieldname, String value)
          Add a constraint to a query The value is matched on equality (exact match).
static void addFeatures(NodeQuery query, Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection)
          Add constraints and sort orders to a query.
static void addFeatures(NodeQuery query, Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection, String searchdir)
          Add constraints and sort orders to a query.
static void addInConstraint(Query query, Field field, SortedSet<? extends Object> set)
          Add a constraint to the query which limits the values in the result based on the set
static void addLikeConstraint(NodeQuery query, Field field, String value)
          Add a constraint to a query The value is matched on likelihood (wildcard % match).
static void addLikeConstraint(Query query, Field field, String value)
          Add a constraint to a query The value is matched on likelihood (wildcard % match).
static void addLimitConstraint(NodeQuery query, int offset, int maxNumber)
          Limit the result set of the query.
static void addNodesConstraints(Query query, Field field, NodeList nodes)
          Add a constraint to the query which limits the nodes in the result based on the number
static void addORConstraint(Query query, Constraint constraint)
          Add a constraint to the query.
static Constraint addORConstraint(Query query, Constraint first, Constraint second)
          Create a OR composite constraint for the query
static void addRelationSortOrder(NodeQuery query, RelationManager role, String sortName, String sortDirection)
          Add a sort order to a query for a field of the relation manager.
static void addSortOrder(NodeQuery query, NodeManager manager, String sortName, String sortDirection)
          Add a sort order to a query for a field of the manager.
static void addSortOrder(NodeQuery query, StepField sf, String sortDirection)
          Add a sort order to a query for a field of the manager.
static void addTypeConstraints(NodeQuery query, List<String> types)
          Add a constraint to the query which limits the node types of the nodes in the result
static Constraint createANDConstraint(Query query, Constraint first, Constraint second)
          Create a AND composite constraint for the query
static FieldValueBetweenConstraint createDatetimeConstraint(NodeQuery query, Field field, long from, long to)
          Create a date and time constraint for a query The value is matched on likelihood (wildcard % match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, Field field, Boolean value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, Field field, Integer value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, Field field, Object value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, Field field, String value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, Field field, String value, boolean caseSensitive)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, Boolean value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, Integer value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, Object value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(NodeQuery query, NodeManager manager, String fieldname, String value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, Field field, Boolean value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, Field field, Integer value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, Field field, Object value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, Field field, String value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, Field field, String value, boolean caseSensitive)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, NodeManager manager, String fieldname, Boolean value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, NodeManager manager, String fieldname, Integer value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, NodeManager manager, String fieldname, Object value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueConstraint createEqualConstraint(Query query, NodeManager manager, String fieldname, String value)
          Create a constraint for a query The value is matched on equality (exact match).
static FieldValueInConstraint createInConstraint(Query query, Field field, SortedSet<? extends Object> set)
          Create a constraint for the query which limits the values in the result based on the set
static FieldValueConstraint createLikeConstraint(NodeQuery query, Field field, String value)
          Create a constraint for a query The value is matched on likelihood (wildcard % match).
static FieldValueConstraint createLikeConstraint(Query query, Field field, String value)
          Create a constraint for a query The value is matched on likelihood (wildcard % match).
static FieldValueConstraint createLikeConstraint(Query query, StepField stepField, String value)
          Create a constraint for a query The value is matched on likelihood (wildcard % match).
static CompositeConstraint createLogicalConstraint(Query query, Constraint first, Constraint second, int operator)
          Create a composite constraint for the query
static SortedSet<Integer> createNodesConstraints(NodeList nodes)
          Create a set with the node numbers of the list of nodes
static NodeQuery createRelatedNodeListQuery(NodeList parentNodes, String managerName, String role)
          Create a query for a list of nodes which are related to the parent node and contain a field value.
static NodeQuery createRelatedNodeListQuery(NodeList parentNodes, String managerName, String role, String searchdir)
          Create a query for a list of nodes which are related to the parent node and contain a field value.
static NodeQuery createRelatedNodeListQuery(Node parent, String managerName, String role)
          Create a query for a list of nodes which are related to the parent node and contain a field value.
static NodeQuery createRelatedNodeListQuery(Node parent, String managerName, String role, String searchdir)
          Create a query for a list of nodes which are related to the parent node and contain a field value.
static NodeQuery createRelatedNodeListQuery(Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection)
          Create a query for a list of nodes which are related to the parent node and contain a field value.
static NodeQuery createRelatedNodeListQuery(Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection, String searchdir)
          Create a query for a list of nodes which are related to the parent node and contain a field value.
static FieldValueInConstraint createTypeConstraints(NodeQuery query, List<String> types)
          Create a constraint for the query which limits the node types of the nodes in the result
static StepField findField(Query query, Field field)
          Find a step field in a query based on a bridge field
static Node findNode(Cloud cloud, String managerName, String fieldname, String value)
          Search for a node which contains a field value.
static Node findNode(Cloud cloud, String managerName, String fieldname, String value, String sortName)
          Search for a node which contains a field value.
static Node findNode(Cloud cloud, String managerName, String fieldname, String value, String sortName, String sortDirection)
          Search for a node which contains a field value.
static NodeList findNodeList(Cloud cloud, String managerName)
          Search for nodes which contain a field value.
static NodeList findNodeList(Cloud cloud, String managerName, String fieldname, Object value)
          Search for nodes which contain a field value.
static NodeList findNodeList(Cloud cloud, String managerName, String fieldname, Object value, String sortName)
          Search for nodes which contain a field value.
static NodeList findNodeList(Cloud cloud, String managerName, String fieldname, Object value, String sortName, String sortDirection)
          Retrieve nodes which contain a field value.
static Node findOrderedNode(Cloud cloud, String managerName, String sortName)
          Retrieve the first node based on the sort field
static Node findOrderedNode(Cloud cloud, String managerName, String sortName, String sortDirection)
          Retrieve the first node based on the sort field
static NodeList findOrderedNodeList(Cloud cloud, String managerName, String sortName)
          Retrieve nodes which are sorted on the field name
static NodeList findOrderedNodeList(Cloud cloud, String managerName, String sortName, String sortDirection)
          Retrieve nodes which are sorted on the field name
static Node findRelatedNode(Node parent, String managerName, String role)
          Search for a node which is related to the parent node.
static Node findRelatedNode(Node parent, String managerName, String role, String fieldname, Object value)
          Search for a node which is related to the parent node and contains a field value.
static Node findRelatedNode(Node parent, String managerName, String role, String fieldname, Object value, String sortName)
          Search for a node which is related to the parent node and contains a field value.
static Node findRelatedNode(Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection)
          Search for a node which is related to the parent node and contains a field value.
static NodeList findRelatedNodeList(Node parent, String managerName, String role)
          Search for nodes which are related to the parent node.
static NodeList findRelatedNodeList(Node parent, String managerName, String role, String fieldname, Object value)
          Search for nodes which are related to the parent node and contain a field value.
static NodeList findRelatedNodeList(Node parent, String managerName, String role, String fieldname, Object value, String sortName)
          Search for nodes which are related to the parent node and contain a field value.
static NodeList findRelatedNodeList(Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection)
          Search for nodes which are related to the parent node and contain a field value.
static NodeList findRelatedNodeList(Node parent, String managerName, String role, String fieldname, Object value, String sortName, String sortDirection, String searchdir)
          Search for nodes which are related to the parent node and contain a field value.
static Node findRelatedOrderedNode(Node parent, String managerName, String role, String sortName)
          Retrieve a node which is related to the parent node and is sorted in a field.
static Node findRelatedOrderedNode(Node parent, String managerName, String role, String sortName, String sortDirection)
          Retrieve a node which is related to the parent node and is sorted in a field.
static NodeList findRelatedOrderedNodeList(Node parent, String managerName, String role, String sortName)
          Search for nodes which are related to the parent node and contain a field value.
static NodeList findRelatedOrderedNodeList(Node parent, String managerName, String role, String sortName, String sortDirection)
          Search for nodes which are related to the parent node and contain a field value.
static RelationList findRelations(Node source, Node destination, String role, String searchdir)
          Finds the relation-nodes between two specified nodes
static RelationList findRelations(Node parent, String managerName, String role, String sortName, String sortDirection)
          Search for a list of relations which are related to the parent node.
static RelationList findRelations(Node parent, String managerName, String role, String sortName, String sortDirection, String searchdir)
          Search for a list of relations which are related to the parent node.
static boolean hasAllowedRelation(Node parent, String role, String searchdir)
          Check to see if a relation is allowed from the parent node
static boolean isEmptyOrWhitespace(String str)
          is Empty Or Whitespace.String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE

public static final String SOURCE
A Search direction of relations in queries

See Also:
Constant Field Values

DESTINATION

public static final String DESTINATION
A Search direction of relations in queries

See Also:
Constant Field Values
Method Detail

findNode

public static Node findNode(Cloud cloud,
                            String managerName,
                            String fieldname,
                            String value)
Search for a node which contains a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. If multiple nodes are found with the same value then the first node is returned

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
Single node which matches the field value

findNode

public static Node findNode(Cloud cloud,
                            String managerName,
                            String fieldname,
                            String value,
                            String sortName)
Search for a node which contains a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. If multiple nodes are found with the same value then the first node is returned

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
Returns:
Single node which matches the field value

findOrderedNode

public static Node findOrderedNode(Cloud cloud,
                                   String managerName,
                                   String sortName)
Retrieve the first node based on the sort field

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
sortName - - name of field to sort on.
Returns:
Single node

findOrderedNode

public static Node findOrderedNode(Cloud cloud,
                                   String managerName,
                                   String sortName,
                                   String sortDirection)
Retrieve the first node based on the sort field

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
Single node

findNode

public static Node findNode(Cloud cloud,
                            String managerName,
                            String fieldname,
                            String value,
                            String sortName,
                            String sortDirection)
Search for a node which contains a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. If multiple nodes are found with the same value then the first node is returned

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
Single node which matches the field value

findNodeList

public static NodeList findNodeList(Cloud cloud,
                                    String managerName)
Search for nodes which contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
Returns:
list of nodes

findNodeList

public static NodeList findNodeList(Cloud cloud,
                                    String managerName,
                                    String fieldname,
                                    Object value)
Search for nodes which contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
list of nodes which match the field value

findNodeList

public static NodeList findNodeList(Cloud cloud,
                                    String managerName,
                                    String fieldname,
                                    Object value,
                                    String sortName)
Search for nodes which contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
Returns:
list of nodes which match the field value

findOrderedNodeList

public static NodeList findOrderedNodeList(Cloud cloud,
                                           String managerName,
                                           String sortName)
Retrieve nodes which are sorted on the field name

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
sortName - - name of field to sort on.
Returns:
list of nodes

findOrderedNodeList

public static NodeList findOrderedNodeList(Cloud cloud,
                                           String managerName,
                                           String sortName,
                                           String sortDirection)
Retrieve nodes which are sorted on the field name

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
list of nodes

findNodeList

public static NodeList findNodeList(Cloud cloud,
                                    String managerName,
                                    String fieldname,
                                    Object value,
                                    String sortName,
                                    String sortDirection)
Retrieve nodes which contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
cloud - - user cloud to search in
managerName - - name of manager to search with
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
list of nodes which match the field value

findRelatedNode

public static Node findRelatedNode(Node parent,
                                   String managerName,
                                   String role)
Search for a node which is related to the parent node. If multiple nodes are found then the first node is returned

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
Returns:
Single node

findRelatedNode

public static Node findRelatedNode(Node parent,
                                   String managerName,
                                   String role,
                                   String fieldname,
                                   Object value)
Search for a node which is related to the parent node and contains a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. If multiple nodes are found with the same value then the first node is returned

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
Single node which matches the field value

findRelatedNode

public static Node findRelatedNode(Node parent,
                                   String managerName,
                                   String role,
                                   String fieldname,
                                   Object value,
                                   String sortName)
Search for a node which is related to the parent node and contains a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. If multiple nodes are found with the same value then the first node is returned

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
Returns:
Single node which matches the field value

findRelatedOrderedNode

public static Node findRelatedOrderedNode(Node parent,
                                          String managerName,
                                          String role,
                                          String sortName)
Retrieve a node which is related to the parent node and is sorted in a field. If multiple nodes are found with the same value then the first node is returned

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
sortName - - name of field to sort on.
Returns:
Single node

findRelatedOrderedNode

public static Node findRelatedOrderedNode(Node parent,
                                          String managerName,
                                          String role,
                                          String sortName,
                                          String sortDirection)
Retrieve a node which is related to the parent node and is sorted in a field. If multiple nodes are found with the same value then the first node is returned

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
Single node

findRelatedNode

public static Node findRelatedNode(Node parent,
                                   String managerName,
                                   String role,
                                   String fieldname,
                                   Object value,
                                   String sortName,
                                   String sortDirection)
Search for a node which is related to the parent node and contains a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. If multiple nodes are found with the same value then the first node is returned

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
Single node which matches the field value

findRelatedNodeList

public static NodeList findRelatedNodeList(Node parent,
                                           String managerName,
                                           String role)
Search for nodes which are related to the parent node.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
Returns:
a list of nodes

findRelatedNodeList

public static NodeList findRelatedNodeList(Node parent,
                                           String managerName,
                                           String role,
                                           String fieldname,
                                           Object value)
Search for nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
a list of nodes which match the field value

findRelatedNodeList

public static NodeList findRelatedNodeList(Node parent,
                                           String managerName,
                                           String role,
                                           String fieldname,
                                           Object value,
                                           String sortName)
Search for nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
Returns:
a list of nodes which match the field value

findRelatedOrderedNodeList

public static NodeList findRelatedOrderedNodeList(Node parent,
                                                  String managerName,
                                                  String role,
                                                  String sortName)
Search for nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
sortName - - name of field to sort on.
Returns:
a list of nodes

findRelatedOrderedNodeList

public static NodeList findRelatedOrderedNodeList(Node parent,
                                                  String managerName,
                                                  String role,
                                                  String sortName,
                                                  String sortDirection)
Search for nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
a list of nodes

findRelatedNodeList

public static NodeList findRelatedNodeList(Node parent,
                                           String managerName,
                                           String role,
                                           String fieldname,
                                           Object value,
                                           String sortName,
                                           String sortDirection)
Search for nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
a list of nodes which match the field value

findRelatedNodeList

public static NodeList findRelatedNodeList(Node parent,
                                           String managerName,
                                           String role,
                                           String fieldname,
                                           Object value,
                                           String sortName,
                                           String sortDirection,
                                           String searchdir)
Search for nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
searchdir - - direction of the relation (source, destination, both)
Returns:
a list of nodes which match the field value

createRelatedNodeListQuery

public static NodeQuery createRelatedNodeListQuery(Node parent,
                                                   String managerName,
                                                   String role,
                                                   String fieldname,
                                                   Object value,
                                                   String sortName,
                                                   String sortDirection)
Create a query for a list of nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive. Relation direction is destination

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
a query for a list of nodes which match the field value

createRelatedNodeListQuery

public static NodeQuery createRelatedNodeListQuery(Node parent,
                                                   String managerName,
                                                   String role,
                                                   String fieldname,
                                                   Object value,
                                                   String sortName,
                                                   String sortDirection,
                                                   String searchdir)
Create a query for a list of nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
searchdir - - direction of the relation (source, destination, both)
Returns:
a query for a list of nodes which match the field value

createRelatedNodeListQuery

public static NodeQuery createRelatedNodeListQuery(Node parent,
                                                   String managerName,
                                                   String role)
Create a query for a list of nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
Returns:
a query for a list of nodes

createRelatedNodeListQuery

public static NodeQuery createRelatedNodeListQuery(Node parent,
                                                   String managerName,
                                                   String role,
                                                   String searchdir)
Create a query for a list of nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
searchdir - - direction of the relation (source, destination, both)
Returns:
a query for a list of nodes

createRelatedNodeListQuery

public static NodeQuery createRelatedNodeListQuery(NodeList parentNodes,
                                                   String managerName,
                                                   String role)
Create a query for a list of nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parentNodes - - nodes to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
Returns:
a query for a list of nodes

createRelatedNodeListQuery

public static NodeQuery createRelatedNodeListQuery(NodeList parentNodes,
                                                   String managerName,
                                                   String role,
                                                   String searchdir)
Create a query for a list of nodes which are related to the parent node and contain a field value. The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
parentNodes - - nodes to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
searchdir - - direction of the relation (source, destination, both)
Returns:
a query for a list of nodes

findRelations

public static RelationList findRelations(Node parent,
                                         String managerName,
                                         String role,
                                         String sortName,
                                         String sortDirection)
Search for a list of relations which are related to the parent node.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
Returns:
a list of relations

findRelations

public static RelationList findRelations(Node parent,
                                         String managerName,
                                         String role,
                                         String sortName,
                                         String sortDirection,
                                         String searchdir)
Search for a list of relations which are related to the parent node.

Parameters:
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
searchdir - - direction of the relation (source, destination, both)
Returns:
a list of relations

findRelations

public static RelationList findRelations(Node source,
                                         Node destination,
                                         String role,
                                         String searchdir)
Finds the relation-nodes between two specified nodes

Parameters:
source - - source node
destination - - destination node
role - - name of relation (relation role in the mmbase system)
searchdir - - direction of the relation (source, destination, both)
Returns:
a list of relations
Since:
MMBase-1.8.5

addFeatures

public static void addFeatures(NodeQuery query,
                               Node parent,
                               String managerName,
                               String role,
                               String fieldname,
                               Object value,
                               String sortName,
                               String sortDirection)
Add constraints and sort orders to a query. The field value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constrains and sort orders to
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)

addFeatures

public static void addFeatures(NodeQuery query,
                               Node parent,
                               String managerName,
                               String role,
                               String fieldname,
                               Object value,
                               String sortName,
                               String sortDirection,
                               String searchdir)
Add constraints and sort orders to a query. The field value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constrains and sort orders to
parent - - node to start the search from
managerName - - name of manager to search with
role - - name of relation (relation role in the mmbase system)
fieldname - - name of field to search with
value - - value to search for in the field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)
searchdir - - direction of the relation (source, destination, both)

hasAllowedRelation

public static boolean hasAllowedRelation(Node parent,
                                         String role,
                                         String searchdir)
Check to see if a relation is allowed from the parent node

Parameters:
parent - - node to start from
role - - name of relation (relation role in the mmbase system)
searchdir - - direction of the relation (source, destination, both)
Returns:
true when relation is allowed

addSortOrder

public static void addSortOrder(NodeQuery query,
                                NodeManager manager,
                                String sortName,
                                String sortDirection)
Add a sort order to a query for a field of the manager.

Parameters:
query - - the query to add the sort order to
manager - - manager of the sort field
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)

addRelationSortOrder

public static void addRelationSortOrder(NodeQuery query,
                                        RelationManager role,
                                        String sortName,
                                        String sortDirection)
Add a sort order to a query for a field of the relation manager.

Parameters:
query - - the query to add the sort order to
role - - relation manager (relation role in the mmbase system)
sortName - - name of field to sort on.
sortDirection - - direction of the sort (UP, DOWN)

addSortOrder

public static void addSortOrder(NodeQuery query,
                                StepField sf,
                                String sortDirection)
Add a sort order to a query for a field of the manager.

Parameters:
query - - the query to add the sort order to
sf - - StepField of the sort order
sortDirection - - direction of the sort (UP, DOWN)

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      NodeManager manager,
                                      String fieldname,
                                      String value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      NodeManager manager,
                                      String fieldname,
                                      String value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         String value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         String value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      NodeManager manager,
                                      String fieldname,
                                      Integer value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      NodeManager manager,
                                      String fieldname,
                                      Integer value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         Integer value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         Integer value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      NodeManager manager,
                                      String fieldname,
                                      Boolean value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      NodeManager manager,
                                      String fieldname,
                                      Boolean value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         Boolean value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         Boolean value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      NodeManager manager,
                                      String fieldname,
                                      Object value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      NodeManager manager,
                                      String fieldname,
                                      Object value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         Object value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         NodeManager manager,
                                                         String fieldname,
                                                         Object value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
value - - value to search for in the field
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      Field field,
                                      String value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      Field field,
                                      String value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         Field field,
                                                         String value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         Field field,
                                                         String value,
                                                         boolean caseSensitive)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
caseSensitive - - case sensitivity of the value
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         Field field,
                                                         String value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         Field field,
                                                         String value,
                                                         boolean caseSensitive)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
caseSensitive - - case sensitivity of the value
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      Field field,
                                      Integer value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      Field field,
                                      Integer value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         Field field,
                                                         Integer value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         Field field,
                                                         Integer value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      Field field,
                                      Boolean value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      Field field,
                                      Boolean value)
Add a constraint to a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         Field field,
                                                         Boolean value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         Field field,
                                                         Boolean value)
Create a constraint for a query The value is matched on equality (exact match).

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

addEqualConstraint

public static void addEqualConstraint(NodeQuery query,
                                      Field field,
                                      Object value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

addEqualConstraint

public static void addEqualConstraint(Query query,
                                      Field field,
                                      Object value)
Add a constraint to a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(NodeQuery query,
                                                         Field field,
                                                         Object value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

createEqualConstraint

public static FieldValueConstraint createEqualConstraint(Query query,
                                                         Field field,
                                                         Object value)
Create a constraint for a query The value is matched on equality (exact match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

findField

public static StepField findField(Query query,
                                  Field field)
Find a step field in a query based on a bridge field

Parameters:
query - - the query
field - - the bridge field which belongs to a node manager
Returns:
a step field in the query

addLikeConstraint

public static void addLikeConstraint(NodeQuery query,
                                     Field field,
                                     String value)
Add a constraint to a query The value is matched on likelihood (wildcard % match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

createLikeConstraint

public static FieldValueConstraint createLikeConstraint(NodeQuery query,
                                                        Field field,
                                                        String value)
Create a constraint for a query The value is matched on likelihood (wildcard % match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

addLikeConstraint

public static void addLikeConstraint(Query query,
                                     Field field,
                                     String value)
Add a constraint to a query The value is matched on likelihood (wildcard % match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field

createLikeConstraint

public static FieldValueConstraint createLikeConstraint(Query query,
                                                        Field field,
                                                        String value)
Create a constraint for a query The value is matched on likelihood (wildcard % match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

createLikeConstraint

public static FieldValueConstraint createLikeConstraint(Query query,
                                                        StepField stepField,
                                                        String value)
Create a constraint for a query The value is matched on likelihood (wildcard % match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
stepField - - the constraint field
value - - value to search for in the field
Returns:
constraint which matches a field value

addDayConstraint

public static void addDayConstraint(NodeQuery query,
                                    NodeManager manager,
                                    String fieldname,
                                    String daysToCompare)
Add a date and time constraint to a query where the value is between now and the days passed in. The days can be a negative number.

Parameters:
query - - the query to add the constraint to
manager - - manager of the constraint field
fieldname - - name of field to search with
daysToCompare - - value to search for in the field

addDatetimeConstraint

public static void addDatetimeConstraint(NodeQuery query,
                                         Field field,
                                         long from,
                                         long to)
Add a date and time constraint to a query

Parameters:
query - - the query to add the constraint to
field - - the constraint field
from - - from value to search for in the field
to - - to value to search for in the field

createDatetimeConstraint

public static FieldValueBetweenConstraint createDatetimeConstraint(NodeQuery query,
                                                                   Field field,
                                                                   long from,
                                                                   long to)
Create a date and time constraint for a query The value is matched on likelihood (wildcard % match). For a string field type the match is case-insensitive.

Parameters:
query - - the query to add the constraint to
field - - the constraint field
from - - from value to search for in the field
to - - to value to search for in the field
Returns:
constraint which matches a field value

addLimitConstraint

public static void addLimitConstraint(NodeQuery query,
                                      int offset,
                                      int maxNumber)
Limit the result set of the query. Note: converting a query with a limit to a counted query Queries.count(Query) will only limit the result set for that query A result set is than always one.

Parameters:
query - - the query to add the constraint to
offset - - the offset where the result set should start
maxNumber - - the maximum number of results which are allowed to return

addTypeConstraints

public static void addTypeConstraints(NodeQuery query,
                                      List<String> types)
Add a constraint to the query which limits the node types of the nodes in the result

Parameters:
query - - the query to add the constraint to
types - - names of node managers

createTypeConstraints

public static FieldValueInConstraint createTypeConstraints(NodeQuery query,
                                                           List<String> types)
Create a constraint for the query which limits the node types of the nodes in the result

Parameters:
query - - the query to add the constraint to
types - - names of node managers
Returns:
constraint with node types

addNodesConstraints

public static void addNodesConstraints(Query query,
                                       Field field,
                                       NodeList nodes)
Add a constraint to the query which limits the nodes in the result based on the number

Parameters:
query - - the query to add the constraint to
field - - the constraint field
nodes - - node which should be used for the constraint

createNodesConstraints

public static SortedSet<Integer> createNodesConstraints(NodeList nodes)
Create a set with the node numbers of the list of nodes

Parameters:
nodes - - list of nodes
Returns:
Set sorted on node number

addInConstraint

public static void addInConstraint(Query query,
                                   Field field,
                                   SortedSet<? extends Object> set)
Add a constraint to the query which limits the values in the result based on the set

Parameters:
query - - the query to add the constraint to
field - - the constraint field
set - - set with possible values

createInConstraint

public static FieldValueInConstraint createInConstraint(Query query,
                                                        Field field,
                                                        SortedSet<? extends Object> set)
Create a constraint for the query which limits the values in the result based on the set

Parameters:
query - - the query to add the constraint to
field - - the constraint field
set - - set with possible values
Returns:
in-constraint

addConstraint

public static void addConstraint(Query query,
                                 Constraint constraint)
Add a constraint to the query. When there is already a constraint then the constraint is added with an AND operator

Parameters:
query - - the query to add the constraint to
constraint - - the constraint

createANDConstraint

public static Constraint createANDConstraint(Query query,
                                             Constraint first,
                                             Constraint second)
Create a AND composite constraint for the query

Parameters:
query - - the query to add the constraint to
first - - first constraint
second - - second constraint
Returns:
composite constraint

addORConstraint

public static void addORConstraint(Query query,
                                   Constraint constraint)
Add a constraint to the query. When there is already a constraint then the constraint is added with an OR operator

Parameters:
query - - the query to add the constraint to
constraint - - the constraint

addORConstraint

public static Constraint addORConstraint(Query query,
                                         Constraint first,
                                         Constraint second)
Create a OR composite constraint for the query

Parameters:
query - - the query to add the constraint to
first - - first constraint
second - - second constraint
Returns:
composite constraint

addConstraint

public static void addConstraint(Query query,
                                 Constraint constraint,
                                 int operator)
Add a constraint to the query. When there is already a constraint then the constraint is added with the operator specified

Parameters:
query - - the query to add the constraint to
constraint - - the constraint
operator - - the logical operator (CompositeConstraint.LOGICAL_OR, CompositeConstraint.LOGICAL_AND)

createLogicalConstraint

public static CompositeConstraint createLogicalConstraint(Query query,
                                                          Constraint first,
                                                          Constraint second,
                                                          int operator)
Create a composite constraint for the query

Parameters:
query - - the query to add the constraint to
first - - first constraint
second - - second constraint
operator - - the logical operator (CompositeConstraint.LOGICAL_OR, CompositeConstraint.LOGICAL_AND)
Returns:
composite constraint

isEmptyOrWhitespace

public static boolean isEmptyOrWhitespace(String str)
is Empty Or Whitespace.String

Parameters:
str - String to check emptiness
Returns:
boolean is it empty


MMBase 2.0-SNAPSHOT - null