|
Collaboration API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.filenet.bso.api.util.BsoSearch
This class encapsulates ad hoc Content Engine queries and returns the results as raw XML or Document Object Model (DOM) for the search. The class also provides a method to query for Content Object IDs and return thos as a String[]. The class also provides a convenience method that returns the namespaces used in the XML for working with the DOM.
The following example illustrates the use of this class. Consider a Financial Center application that has a requirement to find all of the opportunities for all subordinates of a particular supervisor, Sue. The results are to be returned as XML, ordered by company name, deal, and opportunity. The code example below returns XML with <row> elements that have Company, DealName, DealId, CaseOwner, CaseName, CaseId, DollarValue, and ClosingDate attributes.
String select = "SELECT d.Company, d.FolderName AS DealName, d.Id AS DealId, " + "o.CaseOwner, o.FolderName AS CaseName, o.Id AS CaseId, " + "DollarValue, ClosingDate" + "FROM DealFolder d INNER JOIN DealOpportunity o " + "ON d.this = o.Parent" + "WHERE o.CaseSupervisor = 'sue' " + "ORDER BY d.Company, d.FolderName, o.FolderName"; String xmlResult = BsoSearch(objectStore, select, 0);Example of how to use the query for object ids method:
StringBuffer queryString = new StringBuffer(); queryString.append("SELECT "); queryString.append(Property.ID); queryString.append(" FROM "); queryString.append(CASEWORK_SYMNAME); queryString.append(" WHERE "); queryString.append(CASEFILEID_SYMNAME); queryString.append(" = "); queryString.append(caseFileFolderID); String[] queryResults = BsoSearch.queryForObjectIDS(store, queryString.toString());The queryResults String array variable contains all Content Engine object GUIDs that match the query.
java.lang.MessageFormat#format()
Field Summary | |
static java.lang.String |
XPATH_DATA_SELECTOR
An XPath selector that can be used to find the data rows |
Method Summary | |
static void |
addSelectProperties(java.lang.StringBuffer sb,
java.lang.String[] requestedProps,
java.lang.String[] manditoryProps)
Adds a group of properties to a select statement. |
static void |
addSelectProperties(java.lang.StringBuffer sb,
java.lang.String[] requestedProps,
java.lang.String[] manditoryProps,
java.lang.String classAlias,
java.lang.String columnAliasPrefix,
boolean bContinue)
Adds a group of properties to a select statement. |
static int |
convertSearchResultDataType(java.lang.String resultDataType)
Converts a data type as represented in the search results XML to a Content Engine data type. |
static org.w3c.dom.Document |
getDOM(com.filenet.wcm.api.ObjectStore obs,
java.lang.String select,
int maxrecs)
Queries an object store and returns the results in a DOM document. |
static org.w3c.dom.Node |
getNamespace(org.w3c.dom.Document dom)
Returns the XML namespace for the search. |
static java.lang.String |
getRawXML(com.filenet.wcm.api.ObjectStore obs,
java.lang.String select,
int maxrecs)
Queries an object store and returns the results in raw, ADO XML format. |
static java.lang.String |
getRawXML(com.filenet.wcm.api.ObjectStore obs,
java.lang.String select,
int maxrecs,
boolean objectAsId)
Queries an object store and returns the results in raw, ADO XML format. |
static java.lang.String[] |
queryForObjectIDs(com.filenet.wcm.api.ObjectStore store,
java.lang.String selectStmt)
Perform a search operation based on the given select statement and return a string array of IDs for Content Engine objects that satisfy the query. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String XPATH_DATA_SELECTOR
Method Detail |
public static java.lang.String getRawXML(com.filenet.wcm.api.ObjectStore obs, java.lang.String select, int maxrecs)
getRawXML(obs, select, maxrecs, false)
.public static java.lang.String getRawXML(com.filenet.wcm.api.ObjectStore obs, java.lang.String select, int maxrecs, boolean objectAsId)
obs
- The object store against which this query runs.
select
- A String
containing a Content Engine
SELECT
statement, which
differs from a standard SQL SELECT
(see Content Engine documentation).
Note: be careful of column names that are the same as
SQL reserved words; if in doubt, surround the name with
escape characters ([ ]).
maxrecs
- The maximum number of records to return; specify 0 to
return all records found.
objectAsId
- If true, returns object valued properties as ID values.
If your select statement includes object valued properties
this argument must be specified to turn on that feature
of the search. Otherwise an error will be returned
because the property values cannot be returned as XML.
String
that contains XML representing the search
results in raw, ADO XML format.public static void addSelectProperties(java.lang.StringBuffer sb, java.lang.String[] requestedProps, java.lang.String[] manditoryProps)
sb
- String buffer accumulating the query statement.requestedProps
- Required, the property symbolic names to add
to the select statement.manditoryProps
- Optional, another array of property symbolic
names for properties that must be in the select
statement. You could use this second array
to indicate properties that your implementation
requires and the first array are properties
a user or other caller requests.public static void addSelectProperties(java.lang.StringBuffer sb, java.lang.String[] requestedProps, java.lang.String[] manditoryProps, java.lang.String classAlias, java.lang.String columnAliasPrefix, boolean bContinue)
sb
- String buffer accumulating the query statement.requestedProps
- The property symbolic names to add
to the select statement. Either this or
manditoryProps must be specified.manditoryProps
- Optional, another array of property symbolic
names for properties that must be in the select
statement. Either this or requestedProps
must be specified.
You could use this second array
to indicate properties that your implementation
requires and the first array are properties
a user or other caller requests.classAlias
- If non-null, the property names will be prefixed
with this alias followed by a dot (".").
For example, d.DocumentTitle
columnAliasPrefix
- If non-null, the property names will be given
an alias in brackets ([]) as the property name
prefixed by this alias. For example if the
the alias prefix is "d_", a column
alias in brackets will be something like
[d_DocumentTitle]
.bContinue
- If true, indicates these properties are a
continuation from previous properties. An
initial "," will be added to the
properties.public static int convertSearchResultDataType(java.lang.String resultDataType)
public static org.w3c.dom.Document getDOM(com.filenet.wcm.api.ObjectStore obs, java.lang.String select, int maxrecs)
obs
- The object store.select
- A String
containing a Content Engine
SELECT
statement, which
differs from a standard SQL SELECT
(see Content Engine documentation).
Note: be careful of column names that are the same as
SQL reserved words; if in doubt, surround the name with
escape characters ([ ]).
maxrecs
- The maximum number of records to return; specify 0 to
return all records found.
Document
object representing the search results.public static org.w3c.dom.Node getNamespace(org.w3c.dom.Document dom)
dom
- The DOM to use, preferably one returned by an earlier
getDOM
call.
public static java.lang.String[] queryForObjectIDs(com.filenet.wcm.api.ObjectStore store, java.lang.String selectStmt)
store
- The object store.selectStmt
- A String
containing a Content Engine
SELECT
statement, which
differs from a standard SQL SELECT
(see Content Engine documentation).
Note: be careful of column names that are the same as
SQL reserved words; if in doubt, surround the name with
escape characters ([ ]).
|
Collaboration API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |