|
Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal 11g Release 1 (11.1.1.7.0) E15995-06 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.webcenter.spaces.query.SpacesQueryParameters
public class SpacesQueryParameters
Represents a spaces query for getting spaces based on various criteria.
One can create an empty object of this type via createInstance()
, and then call the various setXXX() methods on it to specify the query criteria. At a high level, one needs to mandatorily call setPopulation(oracle.webcenter.spaces.query.SpacesQueryPopulation)
, and then optionally call zero or more of the other setXXX() methods. One can then use SpacesManager.getSpaces(SpacesQueryParameters)
to evaluate the query.
Quering spaces through Expression Language:
It is possible to query for spaces through EL also.
Querying for a space through EL is similar to querying for it through API calls, meaning you need to set the query parameter(s) in the format .property[value] where property means the name of the property like unionOf,shape etc and value means the criteria as to fetch the list of all group spaces or discoverable group space etc.
The query will return the list of spaces of type GSMetadata if the expression is suffixed with .listSpaces
Example-1: #{spaceContext.spacesQuery.unionOf['DISCOVERABLE'].listSpaces}
  This expression will return the list of all discoverable group spaces
If the query expression is not suffixed with .listSpaces
, then the expression evaluates to an object of type SpacesQueryParameters which then needs to be evaluated using SpacesManager.getSpaces(SpacesQueryParameters)
which in turn returns a list of spaces of type GSMetadata.
Example-2: #{spaceContext.spacesQuery.unionOf['DISCOVERABLE']}
  This expression will return an instance of type SpacesQueryParameters with all the query conditions populated
We can also pass SpacesQueryParameters to space browser taskflow.
Example-3: You can pass following parameters to a space browser taskflow to list only the spaces created by user monty spaceContext.spacesQuery.unionOf.USER_JOINED.where[wCond[\'sp.createdBy\'][\'=\'][\'monty\']]
We can also pass SpacesQueryParameters to space adapter.
Example-4: You can pass following EL to a space adapter to list the pages within space "mySpace". spaceContext.spacesQuery.containingNames[\'mySpace\']
While using ELs with Spaces Browser taskflow or Spaces Adopter, you have to eliminate #{} and trailing listSpaces from the expression.
Nested Class Summary | |
---|---|
static class |
SpacesQueryParameters.ReturnShape Defines the shape in which to return results of a spaces query. |
Method Summary | |
---|---|
static SpacesQueryParameters |
createInstance() Creates a spaces query. |
SpacesQueryFilter |
getFilter() This method is liable to change across product releases and is not intended for consumer use. |
int |
getItemsPerPage() This method is liable to change across product releases and is not intended for consumer use. |
int |
getPageIndex() This method is liable to change across product releases and is not intended for consumer use. |
java.lang.String |
getPivotUserGuid() This method is liable to change across product releases and is not intended for consumer use. |
java.lang.String |
getPivotUserName() This method is liable to change across product releases and is not intended for consumer use. |
SpacesQueryPopulation |
getPopulation() This method is liable to change across product releases and is not intended for consumer use. |
SpacesQueryParameters.ReturnShape |
getReturnShape() This method is liable to change across product releases and is not intended for consumer use. |
java.lang.String |
getSortCriteria() This method is liable to change across product releases and is not intended for consumer use. |
SpacesQueryParameters |
setFilter(SpacesQueryFilter f) Allows specifying a filter condition on top of the population. |
SpacesQueryParameters |
setItemsPerPage(int n) For pagination, allows specifying the number of results to be included in each page when breaking down the result space into pages. |
SpacesQueryParameters |
setPageIndex(int i) For pagination, allows specifying the page number (0-based) to select out from the entire space of results matching the query criteria. |
SpacesQueryParameters |
setPopulation(SpacesQueryPopulation p) Allows specifying the population on which to query spaces. |
SpacesQueryParameters |
setReturnShape(SpacesQueryParameters.ReturnShape r) Allows specifying in what shape the results are to be returned |
SpacesQueryParameters |
setSortCriteria(java.lang.String orderByClause) Allows specifying the criteria to use for sorting the results, as defined by a JPQL order-by expression. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static SpacesQueryParameters createInstance()
The spaces query created by this method is initially empty, and the consumer is expected to call the various setXXX() methods on it to specify the query criteria of choice.
SpacesManager#getSpaces(SpacesQueryParameters)
public SpacesQueryParameters setPopulation(SpacesQueryPopulation p)
Following are some of the population types possible with advanced query options
Example 1 :
#{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].sort['sp.lastUpdateDate']['desc'].where[wCond['sp.createdBy']['=']['scott']].itemsPerPage[10].pageNumber[1].listSpaces}
  This query returns a list of all spaces created by user with the username 'scott', its result set is sorted by lastUpdate date, and the result set lists 10 items per page. As the page number is 1, it returns the list of all pages that would appear in the second page.
Example 2 :
#{spaceContext.spacesQuery.containingNames['gs1, gs2, gs3'].listSpaces}
  This query returns a list of all spaces whose space name matches gs1,gs2,gs3
Example 3 :
#{spaceContext.spacesQuery.containingGuids['sd3038962_aae5_4b3d_92ae_ed73c9d9d1f0 s8f265f22_9403_402e_a871_7eddf5f82e85'].listSpaces}
  This query returns a list of all spaces whose space guids matches sd3038962_aae5_4b3d_92ae_ed73c9d9d1f0 etc. Note : The list can be either comma separated or separated by space
Example 4 :
#{spaceContext.spacesQuery.parentSpaceName['gs1'].shape['RECURSIVE_FLATTENED'].listSpaces}
  This query returns a list of all sub-spaces that are under the hierarchy rooted at space gs1
Example 5 :
#{spaceContext.spacesQuery.parentSpaceGuid['s8f265f22_9403_402e_a871_7eddf5f82e85'].listSpaces}
  This query returns a list of all sub-spaces whose parent guid is 's8f265f22_9403_402e_a871_7eddf5f82e85'
p
- Definition of the population on which to query spaces.SpacesQueryPopulation
public SpacesQueryParameters setReturnShape(SpacesQueryParameters.ReturnShape r)
Example -1:
#{spaceContext.spacesQuery.unionOf['USER_JOINED'].shape['ROOT_LEVEL'].listSpaces}
  This API returns a list of all spaces the current user is a member of and returns only top level spaces, i.e spaces which have no parents
Example- 2:
#{spaceContext.spacesQuery.unionOf['USER_JOINED'].shape['RECURSIVE_FLATTENED'].listSpaces}
  This API returns a list of all spaces the current user is a member of and returns all the sub-spaces under each of these spaces the current user has access on
Example- 3:
#{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].shape['RECURSIVE_FLATTENED'].listSpaces}
  This API returns a list of all spaces the current user has access to and returns all the sub-spaces under each of these spaces the current user has access on
r
- Definition of the shape in which the results are to be returned.public SpacesQueryParameters setFilter(SpacesQueryFilter f)
EL : #{spaceContext.spacesQuery.unionOf.ALL_QUERIABLE.where[wCond['sp.createdBy']['=']['monty'] ['and'] [wCond['sp.selfSubEnabled']['=']['Y']] ].listSpaces}
f
- Definition of the filter to be applied on top of the population.SpacesQueryFilter
public SpacesQueryParameters setSortCriteria(java.lang.String orderByClause)
The JPQL expression can reference space attributes using the idenitifier 'sp
' representing the JPA entity for a space, WcSpaceHeader
. For example, the following expression can be used to first divide the spaces into discoverable and non-discoverable, and then in each set, order the spaces in reverse order of how long ago an activity happened on each of them: "sp.discoverable, sp.lastUpdateDate desc
".
EL: #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].sort[f1][o1].sort[f2][o2]...}
where f1, f2, ... are field picked from WcSpaceHeader, and o1, o2, ... are order specifiers
one of asc
and desc
.
Example:#{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].sort['sp.discoverable']['asc'].sort['sp.lastUpdateDate']['desc'].listSpaces}
  This query returns a list of spaces the user has access to and the result set is sorted on discoverable and lastUpdateDate fields
orderByClause
- A JPQL (Java Persistence Query Language) condition expression defining the criteria to use for sorting spacespublic SpacesQueryParameters setPageIndex(int i)
EL: #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].pageNumber[page_num].listSpaces]}
Example : #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].pageNumber[2].listSpaces]}
  This EL returns a list of all group spaces a user has access on and returns the result set of 3rd page.
i
- 0-based page number to select out from the entire result space.setItemsPerPage(int)
public SpacesQueryParameters setItemsPerPage(int n)
EL: #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].itemsPerPage[page_num].listSpaces]}
Example : #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].pageNumber[10].listSpaces]}
  This EL returns a list of all group spaces a user has access on and returns 10 records per page. By default it will return all the spaces within a single page.
n
- Number of results to be included in each page of the result.setPageIndex(int)
public SpacesQueryPopulation getPopulation()
public SpacesQueryParameters.ReturnShape getReturnShape()
public SpacesQueryFilter getFilter()
public java.lang.String getSortCriteria()
public int getPageIndex()
public int getItemsPerPage()
public java.lang.String getPivotUserName()
public java.lang.String getPivotUserGuid()
|
Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal 11g Release 1 (11.1.1.7.0) E15995-06 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |