Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal
11g Release 1 (11.1.1.6.0)
E15995-05


oracle.webcenter.spaces.query
Class SpacesQueryParameters

java.lang.Object
  extended by oracle.webcenter.spaces.query.SpacesQueryParameters

All Implemented Interfaces:
java.io.Serializable

public class SpacesQueryParameters
extends java.lang.Object
implements java.io.Serializable

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}

&nbsp 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']}

&nbsp 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.

Since:
release specific (what release of product did this appear in)
See Also:
Serialized Form

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

createInstance

public static SpacesQueryParameters createInstance()
Creates a spaces query.

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.

See Also:
SpacesManager#getSpaces(SpacesQueryParameters)

setPopulation

public SpacesQueryParameters setPopulation(SpacesQueryPopulation p)
Allows specifying the population on which to query spaces.

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}
&nbsp 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}
&nbsp 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}
&nbsp 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}
&nbsp 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}
&nbsp This query returns a list of all sub-spaces whose parent guid is 's8f265f22_9403_402e_a871_7eddf5f82e85'

Parameters:
p - Definition of the population on which to query spaces.
Returns:
The current instance.
See Also:
SpacesQueryPopulation

setReturnShape

public SpacesQueryParameters setReturnShape(SpacesQueryParameters.ReturnShape r)
Allows specifying in what shape the results are to be returned


Example -1:
#{spaceContext.spacesQuery.unionOf['USER_JOINED'].shape['ROOT_LEVEL'].listSpaces}
&nbsp 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}
&nbsp 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}
&nbsp 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

If we are using SpacesQueryParameters with space name as parent then the default shape is ROOT_LEVEL otherwise default shape is RECURSIVE_FLATTENED.
Parameters:
r - Definition of the shape in which the results are to be returned.
Returns:
The current instance.

setFilter

public SpacesQueryParameters setFilter(SpacesQueryFilter f)
Allows specifying a filter condition on top of the population. This EL returns a list of all spaces a user has access which are created by monty and those group spaces on which self subscription is enabled


EL : #{spaceContext.spacesQuery.unionOf.ALL_QUERIABLE.where[wCond['sp.createdBy']['=']['monty'] ['and'] [wCond['sp.selfSubEnabled']['=']['Y']] ].listSpaces}

Parameters:
f - Definition of the filter to be applied on top of the population.
Returns:
The current instance.
See Also:
SpacesQueryFilter

setSortCriteria

public SpacesQueryParameters setSortCriteria(java.lang.String orderByClause)
Allows specifying the criteria to use for sorting the results, as defined by a JPQL order-by expression.

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}

&nbsp This query returns a list of spaces the user has access to and the result set is sorted on discoverable and lastUpdateDate fields

Parameters:
orderByClause - A JPQL (Java Persistence Query Language) condition expression defining the criteria to use for sorting spaces
Returns:
The current instance.

setPageIndex

public 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.

EL: #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].pageNumber[page_num].listSpaces]}
Example : #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].pageNumber[2].listSpaces]}

&nbsp This EL returns a list of all group spaces a user has access on and returns the result set of 3rd page.

Parameters:
i - 0-based page number to select out from the entire result space.
Returns:
The current instance.
See Also:
setItemsPerPage(int)

setItemsPerPage

public 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.

EL: #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].itemsPerPage[page_num].listSpaces]}
Example : #{spaceContext.spacesQuery.unionOf['ALL_QUERIABLE'].pageNumber[10].listSpaces]}

&nbsp 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.

Parameters:
n - Number of results to be included in each page of the result.
Returns:
The current instance.
See Also:
setPageIndex(int)

getPopulation

public SpacesQueryPopulation getPopulation()
This method is liable to change across product releases and is not intended for consumer use.

getReturnShape

public SpacesQueryParameters.ReturnShape getReturnShape()
This method is liable to change across product releases and is not intended for consumer use.

getFilter

public SpacesQueryFilter getFilter()
This method is liable to change across product releases and is not intended for consumer use.

getSortCriteria

public java.lang.String getSortCriteria()
This method is liable to change across product releases and is not intended for consumer use.

getPageIndex

public int getPageIndex()
This method is liable to change across product releases and is not intended for consumer use.

getItemsPerPage

public int getItemsPerPage()
This method is liable to change across product releases and is not intended for consumer use.

getPivotUserName

public java.lang.String getPivotUserName()
This method is liable to change across product releases and is not intended for consumer use.

getPivotUserGuid

public java.lang.String getPivotUserGuid()
This method is liable to change across product releases and is not intended for consumer use.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal
11g Release 1 (11.1.1.6.0)
E15995-05


Copyright © 2009, 2012, Oracle and/or its affiliates. All rights reserved.