|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.openptk.api.Query
public final class Query
The Query class is used to define simple and complex queries. Simple queries are of type:
| NOOPERATOR | No Operator |
| EQ | Equals |
| NE | Not Equals |
| BEGINS | Begins With |
| ENDS | Ends With |
| CONTAINS | Contains |
| LT | Less Than |
| LE | Less Than Or Equals To |
| GT | Greater Than |
| GE | Greater Than Or Equals To |
| LIKE | Sounds Like |
Examples:
Query q1 = new Query(Query.TYPE_EQUALS,"lastname","Smith"); Query q2 = new Query(Query.TYPE_CONTAINS,"firstname","Rob");
Complex queries are of type:
| AND | And |
| OR | Or |
Examples:
Query qTop = new Query(Query.TYPE_OR); Query q1 = new Query(Query.TYPE_CONTAINS,"firstname","Scott"); Query q2 = new Query(Query.TYPE_CONTAINS,"lastname","Scott"); qTop.addQuery(q1); qTop.addQuery(q2);
A complex query has at least two sub-queries. Sub-queries can be either simple or complex
| NOTICE: | All getter methods return copies of the Query's data. If a any of the data from a Query is modified, after it has been "gotten", then it MUST be "put back". |
| Nested Class Summary | |
|---|---|
static class |
Query.Type
|
| Field Summary | |
|---|---|
java.lang.String |
CLASS_NAME
|
static java.lang.String |
NAMESPACE
|
| Constructor Summary | |
|---|---|
Query()
Create a new complex Query with a default Type of "AND". |
|
Query(Query.Type type)
Create a new simple Query with the specified Type. |
|
Query(Query.Type type,
java.util.List<Query> qlist)
Create a new complex Query using the List of Queries. |
|
Query(Query.Type type,
Query query)
Create a new complex Query with the specified Type and adds the provided Query. |
|
Query(Query.Type type,
java.lang.String name,
java.lang.String value)
Create a new simple Query using the provided information. |
|
Query(Query query)
Create a new simple or complex Query from an existing Query The specified Query will be copied and it's data will be added to the new Query. |
|
Query(java.lang.String type,
java.lang.String name,
java.lang.String value)
Create a new simple Query using the provided information. |
|
| Method Summary | |
|---|---|
void |
addQuery(Query query)
Adds another Query (as a sub-query), making the Query complex. |
Query |
copy()
Creates a copy of the Query. |
java.lang.String |
getName()
Get the attribute name (Framework Name) from the Query. |
java.util.List<Query> |
getQueryList()
Gets a List of the sub-Queries, if the Query is complex the List will contain two or more Queries. |
java.lang.String |
getServiceName()
Get the Service attribute name, as known by the Service, from the Query This method is not to be used by OpenPTK applications. |
Query.Type |
getType()
Get the Query Type. |
java.lang.String |
getTypeAsString()
Get the String representation of the type. |
boolean |
getUseNamespace()
Get the value [ true | false ] of the flag which determines if the "namespace" feature should be used with the toXML() method. |
java.lang.String |
getValue()
Get the attribute value. |
boolean |
isInternal()
|
void |
setInternal(boolean bool)
Flag the Query as internal [ true | false ]. |
void |
setName(java.lang.String name)
Set the attribute name. |
void |
setQueryList(java.util.List<Query> qlist)
Set / replace the List |
void |
setServiceName(java.lang.String name)
Set the Service attribute name, as known by the Service, in the Query This method is not to be used by OpenPTK applications. |
void |
setType(Query.Type type)
Set the Query's Type. |
void |
setType(java.lang.String type)
Set the Query Type, using the String representaion for the Type. |
void |
setUseNamespace(boolean bool)
Set the value [ true | false ] for this flag. |
void |
setValue(java.lang.String value)
Set the attribute value. |
java.lang.String |
toString()
Returns a String that represents the Query Supports both simple and complex queries. |
java.lang.String |
toXML()
Returns an XML structure that represents the Query Supports both simple and complex queries. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final java.lang.String CLASS_NAME
public static final java.lang.String NAMESPACE
| Constructor Detail |
|---|
public Query()
public Query(Query.Type type)
type - the Query Type [ AND | OR ]
public Query(Query.Type type,
java.util.List<Query> qlist)
type - the Type of complex Queryqlist - a List of Query objects
public Query(Query.Type type,
Query query)
throws QueryException
type - the Query Type [ AND | OR ]query - the sub-query used for the "AND" or "OR" logic
QueryException
public Query(Query.Type type,
java.lang.String name,
java.lang.String value)
type - the Query Typename - the attributes namevalue - the attributes value
Example:
Query q = new Query(Query.TYPE_EQUALS,"lastname","Smith");public Query(Query query)
query - an existing Query
public Query(java.lang.String type,
java.lang.String name,
java.lang.String value)
throws QueryException
type - the Query TYPE (String name)name - the attributes namevalue - the attributes value
QueryException - Example:
Query q = new Query("equals","lastname","Smith");| Method Detail |
|---|
public final void addQuery(Query query)
query - an existing Querypublic Query copy()
public final java.lang.String getName()
public final java.util.List<Query> getQueryList()
public final java.lang.String getServiceName()
public final Query.Type getType()
public final java.lang.String getTypeAsString()
public final boolean getUseNamespace()
public final java.lang.String getValue()
public final boolean isInternal()
public final void setInternal(boolean bool)
bool - public final void setName(java.lang.String name)
name - the attributes namepublic final void setQueryList(java.util.List<Query> qlist)
qlist - public final void setServiceName(java.lang.String name)
name - the Service attribute namepublic final void setType(Query.Type type)
type - the Query Type
public final void setType(java.lang.String type)
throws QueryException
type - the String representation of Query Type
QueryExceptionpublic final void setUseNamespace(boolean bool)
bool - true or falsepublic final void setValue(java.lang.String value)
value - the attributes valuepublic java.lang.String toString()
toString in class java.lang.Objectpublic final java.lang.String toXML()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||