cancel
Showing results for 
Search instead for 
Did you mean: 

Help 4 a simple query by the ecm wewebu library!

7joeblack8
Champ in-the-making
Champ in-the-making
Hi guys,


i'm trying to execute a simple CmisSQL query in OWD.


I found in this library: com.wewebu.ow.server.app.OwEcmUtil

this method:
doSimpleSearch(String, String, String, OwSimpleSearchClause[], OwRepository, OwSort, Collection, int, int)

can anybody explain, maybe with an example, how can i obtain a cmis sql query result through that way?

ex: how do i have to put things in right order with doSimpleSearch to make a query like "Select * from D:smileysurprised:wd:hrdocument WHERE owd:value = '1234' ?

many many thanks in advance!

Smiley Wink
2 REPLIES 2

deko
Star Contributor
Star Contributor
Hi Black.jack,

the javadoc of this method should be a good point to start here:

 /** perform a simple search from an array of property values
*
* @param strClassName_p the object class to search for
* @param strResourceName_p the resource to search in, can be null to search the default resource
* @param rootpath_p the root path to search in, can be null to search all object's
* @param clauses_p an array of values operators and criteria names to apply to the search
* @param repository_p OwRepository the repository to search in
* @param sort_p the sort to apply, can be null
* @param propertynames_p the column properties to retrieve, can be null
* @param iMaxSize_p the max size of returned objects
* @param iVersionSelection_p int Selects the versions as defined in OwSearchTemplate.VERSION_SELECT_… or (OwSearchTemplate.VERSION_SELECT_DEFAULT or 0) to use default version
* @return OwObjectCollection
* @throws Exception
*/
public static OwObjectCollection doSimpleSearch(String strClassName_p, String strResourceName_p, String rootpath_p, OwSimpleSearchClause[] clauses_p, OwRepository repository_p, OwSort sort_p, Collection propertynames_p, int iMaxSize_p, int iVersionSelection_p) throws Exception
{

}

So for your simple example query "Select * from D:smileysurprised:wd:hrdocument WHERE owd:value = '1234', the call of the method could look like the following:


OwEcmUtil.OwSimpleSearchClause searchClause = new OwEcmUtil.OwSimpleSearchClause("owd:value", OwSearchOperator.CRIT_OP_EQUAL, "1234");

// create array of search criteria
OwEcmUtil.OwSimpleSearchClause[] whereClauses= new OwEcmUtil.OwSimpleSearchClause[] { searchClause };

OwEcmUtil.doSimpleSearch("D:owd:hrdocument", "Main Repository", null, whereClauses, network, null, null, 20, OwSearchTemplate.VERSION_SELECT_DEFAULT)

This search example will be performed in the "Main Repository" of your connected ECM system. The query should return the desired documents, whereas a maximum of 20 documents will be returned and the latest document version will be returned only.

If you would have more WHERE conditions, you just would have to extend the whereClauses array. Furthermore I used some null values in this example, which you could change to limit the search on a specified folder/path or to sort the results by any property.

7joeblack8
Champ in-the-making
Champ in-the-making
Smiley Surprised  oh great!!!


thanks you my friend!!!  Smiley Wink

i'll try as soon as possible  Smiley Very Happy