|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ragic.s3.service.workflow.SDBQueryScript
public class SDBQueryScript
SDBQueryScript is a class employed by Ragic Workflow application, which allows applications to access Ragic database by multiple approaches and filter those data by customized patterns. This class usually implemented by db.getQuery() in Workflow. A basic strategy to access database is : go -> filter -> next -> dip. SDBQuery Object is sort of like a cursor manipulated by these functions. Going certain field means moving this cursor to that field. All the values of a field is like a list attached to that field. When calling next, this cursor will be moved down one item in the list and next will return last item it pointed. Noted that there are several kinds of filter method in this class, and they can be employed at the same time, that is, you can include multiple patterns to filter data by employing filter function several times. User: liberation Date: 2010/10/5 Time: 10:32:45 am
Constructor Summary | |
---|---|
SDBQueryScript(com.ragic.s3.sdb.data.bdb.BDBWorker worker)
Class constructor specifying a BDBWorker. |
Method Summary | |
---|---|
void |
close()
Deprecated. |
java.lang.String |
dip(int domainId)
Returns the value corresponding to this field ID. |
java.lang.String |
dipAll(int domainId)
Returns all the values corresponding to this field ID in a single string. |
java.util.List<com.ragic.s3.sdb.query.SDBNode> |
dipAllNodes(int domainId)
Returns all the SDBNode objects corresponding to this field ID in a list. |
com.ragic.s3.sdb.query.SDBNode |
dipNode(int domainId)
Returns the SDBNode object corresponding to this field ID. |
java.lang.String |
dive(int domainId)
Returns the value corresponding to this field ID. |
void |
filter(int domainId,
java.util.List<java.lang.Integer> list)
A filter specifying the field possessing this domainId and the pattern. |
void |
filter(int domainId,
java.lang.String value)
A filter specifying the field possessing this domainId and the pattern. |
void |
filter(java.util.List<java.lang.Integer> list)
A filter specifying a list of node ID. |
void |
filter(com.ragic.s3.sdb.query.SDBQuery conn)
A filter specifying another SDBQuery instance as the pattern. |
void |
filter(com.ragic.s3.sdb.query.SDBQuery conn,
boolean inverse)
A filter specifying another SDBQuery instance as the pattern and the specifier about whether or not to reverse the order of filtered data. |
void |
filter(java.lang.String value)
A filter specifying the pattern. |
void |
filterRange(int domainId,
java.lang.String hi,
java.lang.String low)
A filter specifying the field possessing this domainId and the range bounded by high value and low value. |
void |
filterRange(int domainId,
java.lang.String hi,
java.lang.String low,
boolean includeHi,
boolean includeLow)
A filter specifying the field possessing this domainId, the range bounded by high value and low value, and two specifiers about boundaries. |
void |
filterRange(java.lang.String hi,
java.lang.String low)
A filter specifying the range bounded by high value and low value. |
void |
filterRange(java.lang.String hi,
java.lang.String low,
boolean includeHi,
boolean includeLow)
A filter specifying the range bounded by high value and low value and two specifiers about boundaries. |
void |
filterRegex(int domainId,
java.lang.String value)
A filter specifying the field possessing this domainId and the Regular Expression pattern. |
void |
filterRegex(java.lang.String value)
A filter specifying the pattern in Regular Expression . |
java.lang.String |
getApname()
Returns the name of AP holding the field that q goes. |
int |
getDomainId()
Returns field ID of the current field which this query cursor goes |
java.util.List<com.ragic.s3.sdb.query.SDBNode> |
getList()
Returns a list of all nodes corresponding to the current field that the query cursor goes. |
int |
getParentDomainId()
Returns the field ID of last querying field. |
int |
getParentNodeId()
Returns the node ID of last querying field. |
int |
getResultSize()
|
com.ragic.s3.sdb.data.bdb.BDBWorker |
getWorker()
Returns the BDBWorker associated with this SDBQueryScript |
void |
go(int domainId)
Selects the field of interest to manipulate. |
void |
goback()
Goes back to last queried field. |
com.ragic.s3.sdb.query.SDBNode |
next()
Shifts to the next SDBNode object of the field this query went and returns last SDBNode it pointed. |
void |
resetCursor()
|
void |
setDelta(int delta)
|
void |
setFetchSize(int i)
Deprecated. |
void |
setReverse(boolean reverse)
Puts the order of values of current field upside down. |
boolean |
skip(int i)
Skips given number of nodes. |
void |
sort(int domainId,
int dir)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SDBQueryScript(com.ragic.s3.sdb.data.bdb.BDBWorker worker)
worker
- Method Detail |
---|
public void setDelta(int delta)
public java.lang.String getApname()
getApname
in interface com.ragic.s3.sdb.query.SDBQuery
public com.ragic.s3.sdb.data.bdb.BDBWorker getWorker()
getWorker
in interface com.ragic.s3.sdb.query.SDBQuery
public void filter(java.lang.String value)
filter
in interface com.ragic.s3.sdb.query.SDBQuery
value
- the pattern employed by this filterpublic void filterRegex(java.lang.String value)
filterRegex
in interface com.ragic.s3.sdb.query.SDBQuery
value
- the pattern in Regular Expression employed by this filter.public void filterRange(java.lang.String hi, java.lang.String low)
q = db.getQuery(();
q.go(DATE_FIELD_ID);
q.filter("2012/08/10", "2012/08/06");
then this query keeps only those values of DTE_FIELD_ID are before 2012/08/10 and after 2012/08/06.
Noted that no data will be kept if put these two date upside down.
filterRange
in interface com.ragic.s3.sdb.query.SDBQuery
hi
- upper bound of the filter range.low
- lower bound of the filter range.public void filterRange(java.lang.String hi, java.lang.String low, boolean includeHi, boolean includeLow)
filterRange
in interface com.ragic.s3.sdb.query.SDBQuery
hi
- upper bound of the filter range.low
- lower bound of the filter range.includeHi
- true
includes the upper bound.
false
otherwise.includeLow
- true
includes the lower bound.
false
otherwise.filterRange(String, String)
public void filter(com.ragic.s3.sdb.query.SDBQuery conn)
subQ = db.getQuery();
subQ.go(NAME_FIELD);
dubQ.filter("cindy");
q = db.getQuery();
q.go(ROOT_FIELD);
q.filter(subQ);
In this case, q turns out going ROOT_FIELD but filtering data by a pattern of NAME_FIELD.
This method is especially useful when your forms become more complicated.
conn
- another SDBQuery instancepublic void filter(com.ragic.s3.sdb.query.SDBQuery conn, boolean inverse)
filter
in interface com.ragic.s3.sdb.query.SDBQuery
conn
- another SDBQuery instanceinverse
- specifierfilter(com.ragic.s3.sdb.query.SDBQuery)
public void filter(java.util.List<java.lang.Integer> list)
filter
in interface com.ragic.s3.sdb.query.SDBQuery
list
- a list of node IDs.public void filter(int domainId, java.lang.String value)
filter
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- ID of the field to be screenedvalue
- the pattern employed by this filterpublic void filterRegex(int domainId, java.lang.String value)
filterRegex
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- ID of the field to be screenedvalue
- the pattern in regular expression employed by this filterfilter(String)
public void filterRange(int domainId, java.lang.String hi, java.lang.String low)
filterRange
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- hi
- low
- filterRange(String, String)
public void filterRange(int domainId, java.lang.String hi, java.lang.String low, boolean includeHi, boolean includeLow)
filterRange
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- hi
- low
- includeHi
- includeLow
- filterRange(String, String, boolean, boolean)
public void filter(int domainId, java.util.List<java.lang.Integer> list)
filter
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- list
- filter(java.util.List)
public void sort(int domainId, int dir)
sort
in interface com.ragic.s3.sdb.query.SDBQuery
public void setReverse(boolean reverse)
setReverse
in interface com.ragic.s3.sdb.query.SDBQuery
reverse
- true
reverse the order.
false
otherwise.public void go(int domainId)
go
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- the field of interest. Usually root field.dip(int)
,
SDBQueryScript
public com.ragic.s3.sdb.query.SDBNode next()
next
in interface com.ragic.s3.sdb.query.SDBQuery
go(int)
public void goback()
code example 1:
q = db.getQuery();
q.go(FIELD_1);
q.go(FIELD_2);
q.goback();
code example 2:
q = db.getQuery();
q.go(FIELD_1);
goback
in interface com.ragic.s3.sdb.query.SDBQuery
public int getResultSize()
getResultSize
in interface com.ragic.s3.sdb.query.SDBQuery
public java.lang.String dip(int domainId)
q = db. getQuery();
q.go(FIELD_1);
while(q.next()!=null)
{
q.dip(FIELD_2);
}
Will remain at the same node if no next or go happens, which is the major difference between dip and dive
dip
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- field ID of interest.
dive(int)
public com.ragic.s3.sdb.query.SDBNode dipNode(int domainId)
dipNode
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- field ID of interest.
dip(int)
public java.lang.String dipAll(int domainId)
dipAll
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- field ID of interest.
public java.util.List<com.ragic.s3.sdb.query.SDBNode> dipAllNodes(int domainId)
dipAllNodes
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
- field ID of interest.
public java.lang.String dive(int domainId)
dive
in interface com.ragic.s3.sdb.query.SDBQuery
domainId
-
dip(int)
public java.util.List<com.ragic.s3.sdb.query.SDBNode> getList()
getList
in interface com.ragic.s3.sdb.query.SDBQuery
public int getDomainId()
getDomainId
in interface com.ragic.s3.sdb.query.SDBQuery
public int getParentDomainId()
getParentDomainId
in interface com.ragic.s3.sdb.query.SDBQuery
public int getParentNodeId()
getParentNodeId
in interface com.ragic.s3.sdb.query.SDBQuery
public boolean skip(int i)
skip
in interface com.ragic.s3.sdb.query.SDBQuery
i
- number of nodes that should be skipped.
false
if i is a non-positive number or if there is no node to go after the current one.
true
otherwise.public void setFetchSize(int i)
setFetchSize
in interface com.ragic.s3.sdb.query.SDBQuery
public void resetCursor()
resetCursor
in interface com.ragic.s3.sdb.query.SDBQuery
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |