com.esri.core.portal
Class PortalQueryParams

java.lang.Object
  extended by com.esri.core.portal.PortalQueryParams

public class PortalQueryParams
extends Object

Creates query parameters suitable for finding content contained in a Portal. The query can contain multiple parameters that help to limit the content returned back by the Portal such as sort order, sort field, starting index, etc.

Since:
1.0

Nested Class Summary
static class PortalQueryParams.PortalQuerySortOrder
          Describes whether the query result order returns in ascending or descending order.
 
Constructor Summary
PortalQueryParams()
          Creates a PortalQueryParams with default settings.
PortalQueryParams(String query)
          Creates a PortalQueryParams with default settings.
PortalQueryParams(String query, int limit)
          Creates a PortalQueryParams with default settings.
 
Method Summary
 boolean equals(Object obj)
          
 Map<String,String> generateRequestParams()
          Generate request params.
 Map<String,String> generateRequestParams(String orgId, boolean isPre162)
          Generate request params for restricted search using the org id.
 int getLimit()
          Returns the maximum number of results to be included in the result set response.
 String getQuery()
          Retruns the query string to search against.
 String getSortField()
          Returns the field to sort the results by.
 PortalQueryParams.PortalQuerySortOrder getSortOrder()
          Returns whether the order of results are returned in ascending or descending order.
 int getStartIndex()
          Returns the number of the first entry in the result set response.
 int hashCode()
          
 boolean isCanSearchPublic()
          Sets to false for restricted search.
 void setCanSearchPublic(boolean canSearchPublic)
          Sets to false for restricted search.
 PortalQueryParams setLimit(int limit)
          Sets the maximum number of results to be included in the result set response.
 PortalQueryParams setQuery(PortalItemType type, String groupId, String searchQuery)
          Sets a query on the portalQueryParams that will (optionally) 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 against.
 PortalQueryParams setQueryForGroups(String username, String title)
          Sets a query on the portalQueryParams that will find groups with a specified owner and title.
 PortalQueryParams setQueryForItemsInGroup(String groupId)
          Sets a query on the portalQueryParams that will find items in a specified group.
 PortalQueryParams setQueryForItemWithId(String itemId)
          Sets a query on the portalQueryParams that will find an item with a specified itemId.
 PortalQueryParams setSortField(String sortField)
          Set the field 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)
          Set the number of the first entry in the result set response.
 String toString()
          
 PortalQueryParams withNextStart(int nextStart)
          Returns a new copy of the PortalQueryParams with the startIndex field being set to the nextStart parameter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PortalQueryParams

public PortalQueryParams()
Creates a PortalQueryParams with default settings. Start Index will be 1, Limit will be 10, and Sort Order will be descending. The query will be null until one is set.

Since:
1.0

PortalQueryParams

public PortalQueryParams(String query)
Creates a PortalQueryParams with default settings. This is the same as PortalQueryParams(), with the addition of the query being set.

Parameters:
query - - this is a string query passed in by the user format such as OWNER:username AND title:mygroupname
Since:
1.0

PortalQueryParams

public PortalQueryParams(String query,
                         int limit)
Creates a PortalQueryParams with default settings. This is the same as PortalQueryParams(), with the addition of the query and limit being set.

Parameters:
query - - this is a string query passed in by the user format such as OWNER:username AND title:mygroupname
limit - - the limit is 10 if not set by the user
Since:
1.0
Method Detail

withNextStart

public PortalQueryParams withNextStart(int nextStart)
Returns a new copy of the PortalQueryParams with the startIndex field being set to the nextStart parameter.

Parameters:
nextStart - the next start
Returns:
A new copy of the PortalQueryParams with the startIndex field being set to the nextStart parameter
Since:
1.0

setQueryForItemsInGroup

public PortalQueryParams setQueryForItemsInGroup(String groupId)
Sets a query on the portalQueryParams that will find items in a specified group.

Parameters:
groupId - - this is the id of the group for which the user needs to find items
Returns:
this PortalQueryParams
Since:
1.0

setQueryForGroups

public PortalQueryParams setQueryForGroups(String username,
                                           String title)
Sets a query on the portalQueryParams that will find groups with a specified owner and title.

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

Parameters:
username - - username of the group
title - - title of the group
Returns:
this PortalQueryParams
Since:
1.0

setQuery

public PortalQueryParams setQuery(PortalItemType type,
                                  String groupId,
                                  String searchQuery)
Sets a query on the portalQueryParams that will (optionally) 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 will only be set for the non-null parameters. If all are set, the query 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 - The item type - can be null
groupId - The group's ID - can be null
searchQuery - The string to search for - can be null
Returns:
this PortalQueryParams
Since:
1.0

setQueryForItemWithId

public PortalQueryParams setQueryForItemWithId(String itemId)
Sets a query on the portalQueryParams that will find an item with a specified itemId. Its a convenience method provided in the case where the user already has a portal and groups. Knows the item id and is ready to use it.

Parameters:
itemId - - item id of the item.
Returns:
this PortalQueryParams
Since:
1.0

generateRequestParams

public Map<String,String> generateRequestParams()
Generate request params.

Returns:
the hash map< string, string>
Since:
1.0

generateRequestParams

public Map<String,String> generateRequestParams(String orgId,
                                                boolean isPre162)
Generate request params for restricted search using the org id.

Parameters:
orgId - set null for no restriction.
isPre162 - the is pre162
Returns:
the hash map< string, string>
Since:
1.0

getQuery

public String getQuery()
Retruns the query string to search against.

Returns:
The query string to search against
Since:
1.0

setQuery

public PortalQueryParams setQuery(String query)
Sets the query string to search against.

Parameters:
query - - string for searching the portal for groups, e.g. OWNER:user AND TITLE:username
Returns:
this PortalQueryParams
Since:
1.0

getSortField

public String getSortField()
Returns the field to sort the results by.

Returns:
The field to sort the results by
See Also:
setSortField(String)

setSortField

public PortalQueryParams setSortField(String sortField)
Set the field to sort the results by. You can also sort by multiple fields for an item, comma seperated. The currently allowed field names are title, uploaded, type, owner, avgRating, numRatings, numComments and numViews.

Parameters:
sortField - - the results returned are sorted by the field provided.
Returns:
this PortalQueryParams
Since:
1.0

getSortOrder

public PortalQueryParams.PortalQuerySortOrder getSortOrder()
Returns whether the order of results are returned in ascending or descending order.

Returns:
The order of results are returned in ascending or descending order
Since:
1.0

setSortOrder

public PortalQueryParams setSortOrder(PortalQueryParams.PortalQuerySortOrder sortOrder)
Sets whether the order of results are returned in ascending or descending order.

Parameters:
sortOrder - - the results returned are in the order specified.
Returns:
this PortalQueryParams
Since:
1.0

getStartIndex

public int getStartIndex()
Returns the number of the first entry in the result set response. The index number is 1-based.

Returns:
The number of the first entry in the result set response. The index number is 1-based
Since:
1.0

setStartIndex

public PortalQueryParams setStartIndex(int startIndex)
Set the number of the first entry in the result set response. The index number is 1-based.

Parameters:
startIndex - the start index
Returns:
this PortalQueryParams
Since:
1.0

getLimit

public int getLimit()
Returns the maximum number of results to be included in the result set response.

Returns:
The maximum number of results to be included in the result set response
Since:
1.0

setLimit

public PortalQueryParams setLimit(int limit)
Sets the maximum number of results to be included in the result set response.

Parameters:
limit - - maximum number of results returned, its preset to 10 until specified otherwise.
Returns:
this PortalQueryParams
Since:
1.0

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

isCanSearchPublic

public boolean isCanSearchPublic()
Sets to false for restricted search.

Returns:
Returns the canSearchPublic.
Since:
10.1.1

setCanSearchPublic

public void setCanSearchPublic(boolean canSearchPublic)
Sets to false for restricted search.

Parameters:
canSearchPublic - The canSearchPublic to set.
Since:
10.1.1

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.