com.waveset.object
Class QueryOptions

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.GenericObject
          extended bycom.waveset.object.QueryOptions
All Implemented Interfaces:
java.util.Map, javax.naming.Referenceable, XmlObject

public class QueryOptions
extends GenericObject

A class providing a more convenient set of constructor methods that build the option map for the query methods in the ObjectSource interface. Since this extends GenericObject, it implements Map and may be passed directly to ObjectSource methods.

//Hmm, since this might be convenient for the ObjectSource implementation //should we just change the signatures to take the class?


Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
static java.lang.String ATT_CONTROLLING_ADMINS
          The name of a pseudo-attribute that may be used in an attribute condition for queries on ObjectGroup objects.
static java.lang.String ATT_PERMISSIONS
          The name of a pseudo-attribute that may be used in an attribute condition for queries on User objects.
static java.lang.String ATT_SIMILAR_TO
          The name of a pseudo-attribute that may be used in an attribute condition for queries on User objects.
static java.lang.String ATT_USER_TYPE
          The name of a pseudo-attribute that may be used in an attribute condition for queries on User objects.
static java.lang.String code_id
           
static java.lang.String SCOPING_ORG
          The name of a pseudo-attribute that may be used for querying objects of any type.
static java.lang.String USER_TYPE_ADMINISTRATOR
          A value for the pseudo-attribute ATT_USER_TYPE that may be used in attribute conditions of User queries.
static java.lang.String USER_TYPE_APPROVER
          A value for the pseudo-attribute ATT_USER_TYPE that may be used in attribute conditions of User queries.
static java.lang.String USER_TYPE_REMEDIATOR
          A value for the pseudo-attribute ATT_USER_TYPE that may be used in attribute conditions of User queries.
 
Fields inherited from class com.waveset.object.GenericObject
ATT_ID, ATT_NAME, ATT_TYPE, ATT_VALUE, EL_ATTRIBUTE, EL_FORMREF, ELEMENT, FLATTEN_ALL, FLATTEN_NOTHING, FLATTEN_OBJECT_LISTS, SYN_MISMATCHED_NAMES, SYN_MISPLACED_DOT, SYN_MISPLACED_LBRACKET, SYN_NAMED_LIST, SYN_NO_DOT, SYN_NO_GEO, SYN_NO_INDEX, SYN_NO_LIST, SYN_NO_NAME, SYN_NO_TARGET
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
QueryOptions()
           
QueryOptions(java.util.Map options)
          Derive a QueryOptions object from another options map.
 
Method Summary
 void addCondition(AttributeCondition cond)
          Add one attribute condition to the query.
 void addCondition(java.lang.Object attname, AttributeCondition.Operator op, java.lang.Object value)
          Add one attribute condition to the query.
 void addCondition(java.lang.Object attname, java.lang.Object value)
          Add one attribute condition to the query.
 void addConditions(AttributeCondition[] conds)
          Add a set of attribute conditions represented as an array.
 void addConditions(java.util.List conds)
          Add a set of attribute conditions represented as a List of AttributeCondition objects.
 void addConditions(java.util.Map atts)
          Add a set of attribute conditions represented as a Map of name/value pairs with an implicit equality comparison.
 void addOrderBy(java.lang.Object name)
          Add one orderBy attribute.
 int getBlockSize()
           
static int getBlockSize(java.util.Map options)
           
 AttributeCondition[] getConditions()
           
static AttributeCondition[] getConditions(java.util.Map options)
          Extract an array of AttributeCondition objects from the options map.
 java.lang.String[] getEndBefore()
           
static java.lang.String[] getEndBefore(java.util.Map options)
          Convert the value of the OP_END_BEFORE option into an array of String objects.
 int getMaxRows()
           
static int getMaxRows(java.util.Map options)
           
 Attribute[] getOrderBy()
           
static Attribute[] getOrderBy(java.util.Map options)
          Convert the OP_ORDER_BY option into an array of Attribute objects.
 java.util.List getOrderByAttributeNames()
          Extract the value of OP_ORDER_BY option from the specified map.
static java.util.List getOrderByAttributeNames(java.util.Map options)
          Extract the value of OP_ORDER_BY option from the specified map.
 java.lang.String getScopingOrg()
           
static java.lang.String getScopingOrg(java.util.Map options)
           
 java.lang.String[] getStartAfter()
           
static java.lang.String[] getStartAfter(java.util.Map options)
          Convert the value of the OP_START_AFTER option into an array of String objects.
 Subject getSubject()
           
static Subject getSubject(java.util.Map options)
           
 boolean isBuffered()
           
static boolean isBuffered(java.util.Map options)
           
 boolean isNoCache()
           
static boolean isNoCache(java.util.Map options)
           
 boolean isOnlyNames()
          Set to return only the names and ids of items in a list result.
static boolean isOnlyNames(java.util.Map options)
           
 java.util.List normalizeConditions()
          Condition list accessor for a known query options object.
static java.util.List normalizeConditions(java.util.Map options)
          Normalize the conditions by converting an attributes map into a list of AttributeConditions and return the list.
 void setBlockSize(int size)
           
 void setBuffered(boolean b)
           
 void setEndBefore(java.lang.Object concatKey)
          Specify a value for the ObjectSource.OP_END_BEFORE option.
 void setMaxRows(int max)
           
 void setNoCache(boolean b)
           
 void setOnlyNames(boolean b)
          Set to return only the names and ids of items in a list result.
static void setOnlyNames(java.util.Map map, boolean b)
           
 void setOrderBy(java.lang.Object name)
          Set the ObjectSource.OP_ORDER_BY option.
 void setScopingOrg(java.lang.String scopingOrg)
           
 void setStartAfter(java.lang.Object concatKey)
          Specify a value for the ObjectSource.OP_START_AFTER option.
 void setSubject(Subject s)
           
 
Methods inherited from class com.waveset.object.GenericObject
add, addAlias, assimilate, assimilateModifications, browse, clear, clearAliases, containsKey, containsValue, dumpMap, entrySet, filter, findObject, findObject, get, getAttributes, getBoolean, getDate, getDate, getDate, getElementName, getEncrypted, getForm, getFormRef, getId, getInt, getList, getListOfStrings, getLocal, getLong, getName, getObject, getObjectCreateIfNull, getString, isEmpty, keySet, main, parseXml, parseXml, println, put, put, put, put, putAll, putLocal, remove, removeLocal, setAliases, setAttributes, setForm, setFormRef, setId, setIgnoreForm, setName, size, sort, sort, test1, test2, test3, toDisplayString, toDisplayString, toMap, toMap, toMap, toMap, toMap, toMap, toString, toXml, toXmlNoForm, toXmlNormalized, toXmlNormalized, toXmlNormalized, trace, trace, values
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

ATT_USER_TYPE

public static final java.lang.String ATT_USER_TYPE
The name of a pseudo-attribute that may be used in an attribute condition for queries on User objects. The possible values are defined by the USER_TYPE_* constants. // // Hmm, think more about this. Since the "type" argument // of the listObjects and getObjects method may be a String, // could also implement this as a pseudo-type name rather // than a condition. The advantage of using a condition is that // implementations that don't want to support filtering can // still run a normal User query and just ignore the options. // If this were specified as a type name, the implementation // would have to be extended to recognize it.

See Also:
Constant Field Values

USER_TYPE_ADMINISTRATOR

public static final java.lang.String USER_TYPE_ADMINISTRATOR
A value for the pseudo-attribute ATT_USER_TYPE that may be used in attribute conditions of User queries. This indicates that only users that have capabilities and control at least one organization should be returned.

See Also:
Constant Field Values

USER_TYPE_APPROVER

public static final java.lang.String USER_TYPE_APPROVER
A value for the pseudo-attribute ATT_USER_TYPE that may be used in attribute conditions of User queries. This indicates that only users that have MODIFY rights on WorkItems should be returned. // // Note: this can now be replaced with a condition // using the ATT_PERMISSIONS pseudo-attribute.

See Also:
Constant Field Values

USER_TYPE_REMEDIATOR

public static final java.lang.String USER_TYPE_REMEDIATOR
A value for the pseudo-attribute ATT_USER_TYPE that may be used in attribute conditions of User queries. This indicates that only users that have MODIFY rights on RemeditationWorkItem should be returned. // // Note: this can now be replaced with a condition // using the ATT_PERMISSIONS pseudo-attribute.

See Also:
Constant Field Values

ATT_PERMISSIONS

public static final java.lang.String ATT_PERMISSIONS
The name of a pseudo-attribute that may be used in an attribute condition for queries on User objects. The value is expected to be a List of Permission objects. Only those users whose rights include those implied by the permission list will be returned. The condition may use either Operator.EQUALS or Opertor.IN, but the test will always be performed as Operator.IN.

See Also:
Constant Field Values

ATT_SIMILAR_TO

public static final java.lang.String ATT_SIMILAR_TO
The name of a pseudo-attribute that may be used in an attribute condition for queries on User objects. The value is expected to be the name of an IDM user or a WSUser object. This indicates that the result should contain only users whose privileges are "similar to" another user, meaning that they must control the same organizations. // // This evolved from the old getAdministrators and // listsimilarApprovers methods. Note that this differs from // the original listSimilarApprovers concept in that similarity // is defined only by controlled organizations, it does not imply // that the admin must also have approver capabilities. If you need // to combine the two (the usual case) then you have to use both // ATT_SIMILAR_TO and ATT_USER_TYPE=USER_TYPE_APPROVER // This is probably the most common case, but it feels right to // keep the concepts distinct. May want to be more specific and // call this ATT_SIMILAR_CONTROLED_ORGS.

See Also:
Constant Field Values

SCOPING_ORG

public static final java.lang.String SCOPING_ORG
The name of a pseudo-attribute that may be used for querying objects of any type. The value is expected to be the name of an Idm organization. This indicates that the result should contain only objects of the requested type that are "available to" organizations controlled by an AdminRole that controls the organization matching the value of this query option and is assigned to the current logged in user. A common case for this is when a user is assigned more than one AdminRoles and you want to ensure that when creating or editing a user, the member organization of the user being created or edited determines what Idm objects are available for assignment.

See Also:
Constant Field Values

ATT_CONTROLLING_ADMINS

public static final java.lang.String ATT_CONTROLLING_ADMINS
The name of a pseudo-attribute that may be used in an attribute condition for queries on ObjectGroup objects. The value is expected to be the name of one or more Lighthouse users that are admins, such that the list of ObjectGroups returned would only include those controlled by the specified admin or admins. This pseudo-attribute can be used in conjunction with other queryable attributes or pseudo-attributes like ATT_PERMISSIONS and ATT_FLATTEN. When used with ATT_PERMISSIONS, the list of ObjectGroups returned would be filtered to only include those the specified admin(s) controlled and have the specified permissions within those ObjectGroups. The condition may use either Operator.EQUALS or Opertor.IN, but the test will always be performed as Operator.IN.

See Also:
Constant Field Values
Constructor Detail

QueryOptions

public QueryOptions()

QueryOptions

public QueryOptions(java.util.Map options)
             throws WavesetException
Derive a QueryOptions object from another options map.

Method Detail

setSubject

public void setSubject(Subject s)

getSubject

public static Subject getSubject(java.util.Map options)

getSubject

public Subject getSubject()

setMaxRows

public void setMaxRows(int max)

getMaxRows

public int getMaxRows()

getMaxRows

public static int getMaxRows(java.util.Map options)

setBuffered

public void setBuffered(boolean b)

setBlockSize

public void setBlockSize(int size)

getBlockSize

public int getBlockSize()

getBlockSize

public static int getBlockSize(java.util.Map options)

setNoCache

public void setNoCache(boolean b)

setOrderBy

public void setOrderBy(java.lang.Object name)
Set the ObjectSource.OP_ORDER_BY option. The argument may be a List if more than one attribute contributes to the sort. Do not assume that non-lists are Strings so that Attribute objects may be passed in if desired.


addOrderBy

public void addOrderBy(java.lang.Object name)
Add one orderBy attribute.


getOrderByAttributeNames

public java.util.List getOrderByAttributeNames()
Extract the value of OP_ORDER_BY option from the specified map. OP_ORDER_BY specifies a list of attribute names by which to sort results. Each object in the list is interpreted as a string.


getOrderByAttributeNames

public static java.util.List getOrderByAttributeNames(java.util.Map options)
Extract the value of OP_ORDER_BY option from the specified map. OP_ORDER_BY specifies a list of attribute names by which to sort results. Each object in the list is interpreted as a string.

The method is static so it may be used to process Maps that may not also be QueryOptions objects.


getOrderBy

public Attribute[] getOrderBy()

getOrderBy

public static Attribute[] getOrderBy(java.util.Map options)
Convert the OP_ORDER_BY option into an array of Attribute objects. This is the format currently expected by the Lighthouse Repository, but may also be convenient for other implemntations. The method is static so that it may be used to process Maps that may not also be QueryOptions objects.


setStartAfter

public void setStartAfter(java.lang.Object concatKey)
Specify a value for the ObjectSource.OP_START_AFTER option. If the specified value is not an instance of ArrayList, this method will coerce it into an instance of ArrayList.

The value of OP_START_AFTER should be an ArrayList that is one element longer than the value of OP_ORDER_BY. Each element except the final element in the value of OP_START_AFTER corresponds positionally to an element in the value of OP_ORDER_BY. The final element in the value of OP_START_AFTER is a repository ID.


getStartAfter

public java.lang.String[] getStartAfter()

getStartAfter

public static java.lang.String[] getStartAfter(java.util.Map options)
Convert the value of the OP_START_AFTER option into an array of String objects. This is the format currently expected by the Lighthouse Repository, but may also be convenient for other implementations. The method is static so that it may be used to process Maps that may not also be QueryOptions objects.


setEndBefore

public void setEndBefore(java.lang.Object concatKey)
Specify a value for the ObjectSource.OP_END_BEFORE option. If the specified value is not an instance of ArrayList, this method will coerce it into an instance of ArrayList.

The value of OP_END_BEFORE should be an ArrayList that is one element longer than the value of OP_ORDER_BY. Each element except the final element in the value of OP_END_BEFORE corresponds positionally to an element in the value of OP_ORDER_BY. The final element in the value of OP_END_BEFORE is a repository ID.


getEndBefore

public java.lang.String[] getEndBefore()

getEndBefore

public static java.lang.String[] getEndBefore(java.util.Map options)
Convert the value of the OP_END_BEFORE option into an array of String objects. This is the format currently expected by the Lighthouse Repository, but may also be convenient for other implementations. The method is static so that it may be used to process Maps that may not also be QueryOptions objects.


addConditions

public void addConditions(java.util.Map atts)
Add a set of attribute conditions represented as a Map of name/value pairs with an implicit equality comparison.


addConditions

public void addConditions(AttributeCondition[] conds)
Add a set of attribute conditions represented as an array. Several older classes build condition arrays, so its convenient to provide a conversion method here.


addConditions

public void addConditions(java.util.List conds)
Add a set of attribute conditions represented as a List of AttributeCondition objects.


addCondition

public void addCondition(AttributeCondition cond)
Add one attribute condition to the query.


addCondition

public void addCondition(java.lang.Object attname,
                         java.lang.Object value)
Add one attribute condition to the query. The condition is assumed to be an equality comparison.


addCondition

public void addCondition(java.lang.Object attname,
                         AttributeCondition.Operator op,
                         java.lang.Object value)
Add one attribute condition to the query. The condition is assumed to be an equality comparison.


getConditions

public AttributeCondition[] getConditions()

normalizeConditions

public static java.util.List normalizeConditions(java.util.Map options)
Normalize the conditions by converting an attributes map into a list of AttributeConditions and return the list.


normalizeConditions

public java.util.List normalizeConditions()
Condition list accessor for a known query options object.


getConditions

public static AttributeCondition[] getConditions(java.util.Map options)
Extract an array of AttributeCondition objects from the options map. They may be passed either as a List of AttributeCondition objects or as a Map of name/value pairs with in implicit EQUALS operator. The method is static so it may be used to process Maps that may not also be QueryOptions objects.


isBuffered

public boolean isBuffered()

isBuffered

public static boolean isBuffered(java.util.Map options)

isNoCache

public boolean isNoCache()

isNoCache

public static boolean isNoCache(java.util.Map options)

setOnlyNames

public void setOnlyNames(boolean b)
Set to return only the names and ids of items in a list result. This can be much faster than the standard list call for cached types.

Parameters:
b - true for results with only names, no attributes or objects

setOnlyNames

public static void setOnlyNames(java.util.Map map,
                                boolean b)

isOnlyNames

public boolean isOnlyNames()
Set to return only the names and ids of items in a list result. This can be much faster than the standard list call for cached types.


isOnlyNames

public static boolean isOnlyNames(java.util.Map options)

setScopingOrg

public void setScopingOrg(java.lang.String scopingOrg)

getScopingOrg

public java.lang.String getScopingOrg()

getScopingOrg

public static java.lang.String getScopingOrg(java.util.Map options)