com.esri.core.portal
Class Portal

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

public class Portal
extends Object

This class is used for connecting to a Portal and searching for items, users and groups. arcgis.com is an example of a portal, using this object a user(anonymous or with credentials) can see the contents of the portal. Using the portal a user can share content with other users that are members of the portal. The user can create content using maps that are public or services published by the the user on a server instance. Note: The API supports connecting to portals running ArcGIS Portal API Version 1.6.2 or higher.

Since:
1.0

Field Summary
static String DEFAULT_CULTURE
          The default locale of the Portal e.g. en-us.
 
Constructor Summary
Portal(String url, String sharingURL, UserCredentials credentials)
          Instantiates an object of Portal.
Portal(String url, UserCredentials credentials)
          Instantiates an object of Portal.
 
Method Summary
 PortalInfo fetchPortalInfo()
          Fetches the portal information from the server.
 InputStream fetchTxtFileContents()
          Returns properties from arcgismobile.txt config file.
 PortalUser fetchUser()
          Fetches the PortalUser set on this portal object from the server.
 String fetchVersion()
          Fetches the version of the portal.
 PortalQueryResultSet<PortalGroup> findGroups(PortalQueryParams queryParams)
          Finds groups with a query.
 void findGroups(PortalQueryParams queryParams, PortalListener<PortalQueryResultSet<PortalGroup>> portalListener)
          Deprecated. please use findGroups(PortalQueryParams) instead.
 PortalQueryResultSet<PortalItem> findItems(PortalQueryParams queryParams)
          Finds items with a query.
 void findItems(PortalQueryParams queryParams, PortalListener<PortalQueryResultSet<PortalItem>> portalListener)
          Deprecated. please use findItems(PortalQueryParams) instead.
 String findSharingUrl()
          Returns the portal's sharing url. i.e., https://www.arcgis.com/sharing/rest
 UserCredentials getCredentials()
          Returns a copy of the user credentials set on this portal object.
 String getUrl()
          Returns the portal's url.
 boolean isPreVersion162()
          Returns true if the portal version is earlier than the 1.6.2.
 org.codehaus.jackson.JsonParser postRequest(String requestURL)
          Sends the customized request and let users handle the response.
 org.codehaus.jackson.JsonParser sendRequest(String requestURL)
          Sends the customized request and let users handle the response.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CULTURE

public static final String DEFAULT_CULTURE
The default locale of the Portal e.g. en-us.

Constructor Detail

Portal

public Portal(String url,
              UserCredentials credentials)
Instantiates an object of Portal.

Parameters:
url - the portal url
credentials - the credentials to access the portal with. The credentials is not verified in this constructor. Invalid credentials can cause security exception in the sub-sequent operations.
Since:
1.0

Portal

public Portal(String url,
              String sharingURL,
              UserCredentials credentials)
Instantiates an object of Portal.

Parameters:
url - the portal url
sharingURL - the shareURL changed in 1.6.2 (e.g. http://porturl/sharing/rest), set to null if you don't know it.
credentials - the credentials to access the portal with. The credentials is not verified in this constructor. Invalid credentials can cause security exception in the sub-sequent operations.
Since:
1.0
Method Detail

fetchTxtFileContents

public InputStream fetchTxtFileContents()
Returns properties from arcgismobile.txt config file. Should be called from a thread.

Returns:
Properties from arcgismobile.txt config file
Since:
1.0

findItems

@Deprecated
public void findItems(PortalQueryParams queryParams,
                                 PortalListener<PortalQueryResultSet<PortalItem>> portalListener)
Deprecated. please use findItems(PortalQueryParams) instead.

Finds items with a query.

Parameters:
queryParams - - the query that is passed to the portal
portalListener - - portal listener that returns the portal
Since:
1.0

findItems

public PortalQueryResultSet<PortalItem> findItems(PortalQueryParams queryParams)
                                           throws Exception
Finds items with a query.

Parameters:
queryParams - - the query that is passed to the portal
Returns:
the portal query result set< portal item>
Throws:
Exception - If unable to complete the request.
Since:
1.0

findGroups

@Deprecated
public void findGroups(PortalQueryParams queryParams,
                                  PortalListener<PortalQueryResultSet<PortalGroup>> portalListener)
Deprecated. please use findGroups(PortalQueryParams) instead.

Finds groups with a query.

Parameters:
queryParams - - query parameters used to search the portal
portalListener - - portal listener that returns the portal
Since:
1.0

findGroups

public PortalQueryResultSet<PortalGroup> findGroups(PortalQueryParams queryParams)
                                             throws Exception
Finds groups with a query.

Parameters:
queryParams - - query parameters used to search the portal
Returns:
the portal query result set< portal group>
Throws:
Exception - If unable to complete the request.
Since:
1.0

getUrl

public String getUrl()
Returns the portal's url.

Returns:
The portal's url
Since:
1.0

findSharingUrl

public String findSharingUrl()
Returns the portal's sharing url. i.e., https://www.arcgis.com/sharing/rest

Returns:
The portal's sharing url
Since:
1.0

getCredentials

public UserCredentials getCredentials()
Returns a copy of the user credentials set on this portal object.

Returns:
The user credentials
Since:
1.0

fetchUser

public PortalUser fetchUser()
                     throws Exception
Fetches the PortalUser set on this portal object from the server.

Returns:
The PortalUser
Throws:
Exception - If unable to complete the request.
Since:
1.0

fetchPortalInfo

public PortalInfo fetchPortalInfo()
                           throws Exception
Fetches the portal information from the server.

Returns:
The portal information
Throws:
Exception - If unable to complete the request.
Since:
1.0

fetchVersion

public String fetchVersion()
                    throws Exception
Fetches the version of the portal.

Returns:
The version of the portal
Throws:
Exception - the exception
Since:
1.0

sendRequest

public org.codehaus.jackson.JsonParser sendRequest(String requestURL)
                                            throws EsriSecurityException,
                                                   Exception
Sends the customized request and let users handle the response. The request will be sent in "POST" or "GET" method based on the length of the URL.

Parameters:
requestURL - the url of the request.
Returns:
the response as a JsonParser
Throws:
EsriSecurityException - if failed to pass the security checking.
Exception - if the request is invalid.
Since:
1.0

isPreVersion162

public boolean isPreVersion162()
Returns true if the portal version is earlier than the 1.6.2.

Returns:
true if the portal version is earlier than the 1.6.2.
Since:
1.0

postRequest

public org.codehaus.jackson.JsonParser postRequest(String requestURL)
                                            throws EsriSecurityException,
                                                   Exception
Sends the customized request and let users handle the response. The request will be sent in "POST" method.

Parameters:
requestURL - the url of the request.
Returns:
the response as a JsonParser
Throws:
EsriSecurityException - if failed to pass the security checking.
Exception - if the request is invalid.
Since:
1.0

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.