public class

PortalQueryParams

extends Object
java.lang.Object
   ↳ com.esri.core.portal.PortalQueryParams

Class Overview

This class contains query parameters suitable for finding content or groups contained in a Portal. Setter methods are provided for a number of particular parameters: 'sort order', 'sort field', 'start index' and 'results limit'. There are also a number of setters that set a 'query string' that can be a complex expression that contains names and values of one or more fields, e.g. "OWNER:username AND title:mygroupname". When the query string is set, any previous value is overwritten.

Start index and results limit are used when paging through large result sets. See PortalQueryResultSet.

A typical usage pattern is:

Summary

Nested Classes
enum PortalQueryParams.PortalQuerySortOrder Describes whether the query results get returned in ascending or descending order. 
Public Constructors
PortalQueryParams()
Creates a PortalQueryParams with default settings.
PortalQueryParams(String query)
Creates a PortalQueryParams with a particular query string.
PortalQueryParams(String query, int limit)
Creates a PortalQueryParams with a particular query string and results limit.
Public Methods
boolean equals(Object obj)
Map<String, String> generateRequestParams(String orgId, boolean isPre162)
For internal use only.
Map<String, String> generateRequestParams()
For internal use only.
int getLimit()
Gets the results limit, which is used when paging through large result sets.
String getQuery()
Returns the query string to search with.
String getSortField()
Returns the field or fields to sort the results by.
PortalQueryParams.PortalQuerySortOrder getSortOrder()
Returns whether the results are returned in ascending or descending order.
int getStartIndex()
Gets the start index, which is used when paging through large result sets.
int hashCode()
boolean isCanSearchPublic()
Returns whether or not public items outside the organization may be included in the query.
void setCanSearchPublic(boolean canSearchPublic)
Determines if public items outside the organization may be included in the query.
PortalQueryParams setLimit(int limit)
Sets the results limit, which is used when paging through large result sets.
PortalQueryParams setQuery(PortalItemType type, String groupId, String searchQuery)
Sets the query string to find items of a given type that are in a specific group with a specific search string.
PortalQueryParams setQuery(String query)
Sets the query string to search with.
PortalQueryParams setQueryForGroups(String username, String title)
Sets the query string to find groups with a specified owner and title.
PortalQueryParams setQueryForItemWithId(String itemId)
Sets the query string to find an item with a specified itemId.
PortalQueryParams setQueryForItemsInGroup(String groupId)
Sets the query string to find items in a specified group.
PortalQueryParams setSortField(String sortField)
Sets the field or fields to sort the results by.
PortalQueryParams setSortOrder(PortalQueryParams.PortalQuerySortOrder sortOrder)
Sets whether the order of results are returned in ascending or descending order.
PortalQueryParams setStartIndex(int startIndex)
Sets the start index, which is used when paging through large result sets.
String toString()
PortalQueryParams withNextStart(int nextStart)
Returns a new copy of the PortalQueryParams with the start index field being set to the nextStart parameter.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PortalQueryParams ()

Creates a PortalQueryParams with default settings. Start index will be 1, results limit will be 10, and sort order will be descending. The query string will be null until one is set.

public PortalQueryParams (String query)

Creates a PortalQueryParams with a particular query string. This is the same as PortalQueryParams(), with the addition of the query string being set.

Parameters
query String: the query string to use. The format is such as "OWNER:username AND title:mygroupname".

public PortalQueryParams (String query, int limit)

Creates a PortalQueryParams with a particular query string and results limit. This is the same as PortalQueryParams(), with the addition of the query string and results limit being set.

Parameters
query String: the query string to use. The format is such as "OWNER:username AND title:mygroupname".
limit int: maximum number of results to be included in the result set response. Used when paging through large result sets.

Public Methods

public boolean equals (Object obj)

Parameters
obj Object
Returns
boolean

public Map<String, String> generateRequestParams (String orgId, boolean isPre162)

For internal use only. Generates request parameters for a restricted search using an organization id.

Parameters
orgId String: organization id, set null for no restriction
isPre162 boolean: true if the portal version is earlier than 1.6.2
Returns
Map<String, String> Map containing names and values of the request parameters

public Map<String, String> generateRequestParams ()

For internal use only. Generates request parameters.

Returns
Map<String, String> Map containing names and values of the request parameters

public int getLimit ()

Gets the results limit, which is used when paging through large result sets. It is the maximum number of results to be included in the result set response.

Returns
int results limit to use when these PortalQueryParms are submitted

public String getQuery ()

Returns the query string to search with.

Returns
String query string to search with

public String getSortField ()

Returns the field or fields to sort the results by.

Returns
String String containing a list of one or more fields names, comma separated

public PortalQueryParams.PortalQuerySortOrder getSortOrder ()

Returns whether the results are returned in ascending or descending order.

Returns
PortalQueryParams.PortalQuerySortOrder indicates sort order for results

public int getStartIndex ()

Gets the start index, which is used when paging through large result sets. It is the index within the entire set of results of the first entry in the current page. The index number is 1-based.

Returns
int start index to use when these PortalQueryParms are submitted

public int hashCode ()

Returns
int

public boolean isCanSearchPublic ()

Returns whether or not public items outside the organization may be included in the query.

Returns
boolean true if items outside the organization may be included

public void setCanSearchPublic (boolean canSearchPublic)

Determines if public items outside the organization may be included in the query. Default behavior is they are included.

Parameters
canSearchPublic boolean: true to include items outside the organization

public PortalQueryParams setLimit (int limit)

Sets the results limit, which is used when paging through large result sets. It is the maximum number of results to be included in the result set response. It defaults to 10 if not set.

Parameters
limit int: the results limit to use when these PortalQueryParms are submitted
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setQuery (PortalItemType type, String groupId, String searchQuery)

Sets the query string to find items of a given type that are in a specific group with a specific search string.

Any of the parameters may be null, and the query string will only be set for the non-null parameters. If all are set, the query string will search for items that match the type AND are in the group AND match the search string. If none are set, a generic search will be performed.

Parameters
type PortalItemType: item type to search for, or null to search for items of any type
groupId String: ID of the group to search for, or null to search for items in any group
searchQuery String: search string to use, or null for no search string
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setQuery (String query)

Sets the query string to search with.

Parameters
query String: the query string for searching the portal, e.g. "OWNER:user AND TITLE:username"
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setQueryForGroups (String username, String title)

Sets the query string to find groups with a specified owner and title.

Either username or title may be null, and the query string will only be set for the non-null parameter. If both are set, the query string will search for groups that are owned by the named user AND that match the specified title.

Parameters
username String: name of the owner of the groups to search for, or null to search for groups with any owner
title String: the title of the groups to search for, or null to search for groups with any title
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setQueryForItemWithId (String itemId)

Sets the query string to find an item with a specified itemId. This is a convenience method provided for the case where the user already has a portal and groups, knows the item id and is ready to use it.

Parameters
itemId String: ID of the item
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setQueryForItemsInGroup (String groupId)

Sets the query string to find items in a specified group.

Parameters
groupId String: ID of the group for which items are required
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setSortField (String sortField)

Sets the field or fields to sort the results by. Allowed field names are title, uploaded, type, owner, avgRating, numRatings, numComments and numViews.

Parameters
sortField String: String containing a list of one or more fields names, comma separated
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setSortOrder (PortalQueryParams.PortalQuerySortOrder sortOrder)

Sets whether the order of results are returned in ascending or descending order.

Parameters
sortOrder PortalQueryParams.PortalQuerySortOrder: sort order for results
Returns
PortalQueryParams this PortalQueryParams

public PortalQueryParams setStartIndex (int startIndex)

Sets the start index, which is used when paging through large result sets. It is the index within the entire set of results of the first entry in the current page. The index number is 1-based.

Parameters
startIndex int: start index to use when these PortalQueryParms are submitted
Returns
PortalQueryParams this PortalQueryParams

public String toString ()

Returns
String

public PortalQueryParams withNextStart (int nextStart)

Returns a new copy of the PortalQueryParams with the start index field being set to the nextStart parameter. Start index is used when paging through large result sets.

Parameters
nextStart int: the next start index
Returns
PortalQueryParams a copy of this PortalQueryParams with the start index field being set to the nextStart parameter