Class Portal
- java.lang.Object
-
- com.esri.arcgisruntime.portal.Portal
-
- All Implemented Interfaces:
RemoteResource
,Loadable
public final class Portal extends java.lang.Object implements Loadable, RemoteResource
Represents an information portal such as ArcGIS Online or Portal for ArcGIS. Supports the following operations:- sign in to the portal
- get metadata describing the portal
- search the portal for content such as portal items and groups
- fetch items from the portal
Note that if a Portal is initially loaded anonymously and attempts to access a secured resource, an AuthenticationChallenge will be issued. If the challenge results in a Credential object that satisfies the secure resource, that Credential will be set back on the Portal. At this point, subsequent requests will use that Credential for authentication. The PortalInfo and PortalUser, however, will remain as the anonymous versions as they were initially loaded. If these objects are desired to have privileged information, then a new Portal instance needs to be constructed and the Credential needs to be set using
setCredential(Credential)
before loading the new Portal instance.- Since:
- 100.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Portal.LoginType
Signifies the login type for a portal.static class
Portal.Mode
Signifies the tenancy mode of a portal.
-
Constructor Summary
Constructors Constructor Description Portal(java.lang.String portalUrl)
Creates a Portal for anonymous access using the portal URL.Portal(java.lang.String portalUrl, boolean loginRequired)
Creates a Portal for anonymous or authenticated access using the portal URL, depending on the value of the loginRequired parameter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCredentialChangedListener(CredentialChangedListener credentialChangedListener)
Adds a CredentialChangedListener to be called when the Portal's Credential is changed.void
addDoneLoadingListener(java.lang.Runnable listener)
Adds a listener to the loadable resource that is invoked when loading has completed.void
addLoadStatusChangedListener(LoadStatusChangedListener listener)
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.void
cancelLoad()
Cancels loading metadata for the object.ListenableFuture<java.util.List<Basemap>>
fetchBasemapsAsync()
Executes an asynchronous operation to fetch the basemaps using thePortalInfo.getBasemapGalleryGroupQuery()
query string.ListenableFuture<java.util.List<Basemap>>
fetchDeveloperBasemapsAsync()
Executes an asynchronous operation to fetch the developer basemaps using thePortalInfo.getDeveloperBasemapGalleryGroupQuery()
query string.ListenableFuture<java.util.List<PortalGroup>>
fetchFeaturedGroupsAsync()
Executes an asynchronous operation to fetch the featured groups for the organization.ListenableFuture<java.util.List<PortalItem>>
fetchFeaturedItemsAsync()
Executes an asynchronous operation to fetch the featured items for the organization.ListenableFuture<java.util.List<PortalItem>>
fetchHomePageFeaturedContentAsync()
Executes an asynchronous operation to fetch the featured content for display on the organization's home page.ListenableFuture<LicenseInfo>
fetchLicenseInfoAsync()
Executes an asynchronous operation to fetch the current user's LicenseInfo including the entitlements and extensions.static ListenableFuture<Portal.LoginType>
fetchLoginTypeForUrlAsync(java.lang.String url)
Executes an asynchronous operation to determine the login type for a given portal URL.ListenableFuture<java.util.List<PortalItem>>
fetchStylesAsync()
Executes an asynchronous operation to fetch the styles using thePortalInfo.getStylesGroupQuery()
query string.ListenableFuture<java.util.List<PortalItem>>
fetchSymbolSetsAsync()
Executes an asynchronous operation to fetch the symbol sets using thePortalInfo.getSymbolSetsGroupQuery()
query string.ListenableFuture<java.util.List<Basemap>>
fetchVectorBasemapsAsync()
Executes an asynchronous operation to fetch the vector basemaps using thePortalInfo.getVectorBasemapGalleryGroupQuery()
query string.ListenableFuture<PortalQueryResultSet<PortalGroup>>
findGroupsAsync(PortalQueryParameters queryParameters)
Executes an asynchronous operation to find groups in this portal with a query using the specified portal query parameters.ListenableFuture<PortalQueryResultSet<PortalItem>>
findItemsAsync(PortalQueryParameters queryParameters)
Executes an asynchronous operation to find items in this portal with a query using the specified portal query parameters.Credential
getCredential()
Gets the credential set on this portal instance.java.lang.String
getCulture()
Gets a code that specifies the culture-specific formatting to use when accessing portal content.ArcGISRuntimeException
getLoadError()
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.LoadStatus
getLoadStatus()
Returns theLoadStatus
of the loadable resource.PortalInfo
getPortalInfo()
Gets the PortalInfo object for this portal.RequestConfiguration
getRequestConfiguration()
Gets the RequestConfiguration object in use by this Portal.java.lang.String
getSharingUrl()
Gets the sharing URL, that is, the URL of the root REST resource for the portal.java.lang.String
getUri()
Gets the portal URL.PortalUser
getUser()
Gets a PortalUser object describing the user currently signed in to this portal.boolean
isLoginRequired()
Indicates if loginRequired was specified when this Portal object was constructed.boolean
isPKCESupported()
Returns a boolean that defines if PKCE (proof key code exchange) is supported with this portal.void
loadAsync()
Loads the metadata of the loadable resource asynchronously.ListenableFuture<java.lang.String>
postRequestAsync(java.lang.String requestUrl)
Executes an asynchronous operation to send a customized request and let the caller handle the response.boolean
removeCredentialChangedListener(CredentialChangedListener credentialChangedListener)
Attempts to remove a CredentialChangedListener.boolean
removeDoneLoadingListener(java.lang.Runnable listener)
Removes a done loading listener from the loadable resource.boolean
removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Removes aLoadStatusChangedListener
from the loadable resource.void
retryLoadAsync()
Loads or retries loading metadata for the object asynchronously.ListenableFuture<java.lang.String>
sendRequestAsync(java.lang.String requestUrl)
Executes an asynchronous operation to send a customized request and let the caller handle the response.void
setCredential(Credential credential)
Sets the credential used to authenticate the user with the Portal.void
setCulture(java.lang.String culture)
Sets a code that specifies the culture-specific formatting to use when accessing portal content.void
setRequestConfiguration(RequestConfiguration requestConfiguration)
Sets configuration parameters used for network requests sent using this Portal object.
-
-
-
Constructor Detail
-
Portal
public Portal(java.lang.String portalUrl)
Creates a Portal for anonymous access using the portal URL. If the portal does not support anonymous access, an AuthenticationChallenge will be issued to obtain credentials. If valid credentials are not supplied, the portal will fail to load. This is the same as calling new Portal(url, false). If the app knows the credential to use in advance, it can avoid an AuthenticationChallenge by callingsetCredential(Credential)
after this constructor and before loading this Portal.- Parameters:
portalUrl
- the portal URL. For examplehttps://www.arcgis.com
for ArcGIS Online, orhttps://<host>:<port>/arcgis
for an on-premises portal.- Throws:
java.lang.IllegalArgumentException
- if the portalUrl is null or empty- Since:
- 100.0.0
-
Portal
public Portal(java.lang.String portalUrl, boolean loginRequired)
Creates a Portal for anonymous or authenticated access using the portal URL, depending on the value of the loginRequired parameter. If true is passed, then the user will be required to login to the portal in order to use it at all (this will be done using the AuthenticationChallengeHandler, so the credential does not need to be known in advance). If it is false, then the user will only be required to login if the portal does not support anonymous access (that is, if the PortalAccess is PRIVATE). If the app knows the credential to use in advance, it can avoid an AuthenticationChallenge by callingsetCredential(Credential)
after this constructor and before loading this Portal.- Parameters:
portalUrl
- the portal URL. For examplehttps://www.arcgis.com
for ArcGIS Online, orhttps://<host>:<port>/arcgis
for an on-premises portal.loginRequired
- true to force user login, false to only login if required by the portal- Throws:
java.lang.IllegalArgumentException
- if the portalUrl is null or empty- Since:
- 100.0.0
-
-
Method Detail
-
isLoginRequired
public boolean isLoginRequired()
Indicates if loginRequired was specified when this Portal object was constructed.- Returns:
- true if login is required, false if anonymous access is allowed
- Since:
- 100.0.0
-
setCredential
public void setCredential(Credential credential)
Sets the credential used to authenticate the user with the Portal. If set after a Portal is loaded anonymously, the credential will be used for subsequent requests but the PortalInfo will remain the anonymous info. To obtain a privileged PortalInfo, the credential must be set before the instance is loaded.If the credential being set is different from the portal's current credential (or the portal's current credential is null), this will trigger any CredentialChangedListeners that were added with
addCredentialChangedListener(CredentialChangedListener)
Do not set new credentials while the portal is still loading as that can lead the portal to be in an undetermined state.
- Specified by:
setCredential
in interfaceRemoteResource
- Parameters:
credential
- the credential used to authenticate the user with the portal- Throws:
java.lang.IllegalArgumentException
- if the Credential is nulljava.lang.IllegalStateException
- if the credential cannot be set because the Portal has been loaded and already has a credential- Since:
- 100.0.0
-
getCredential
public Credential getCredential()
Gets the credential set on this portal instance.- Specified by:
getCredential
in interfaceRemoteResource
- Returns:
- the credential, or null if none has been set
- Since:
- 100.0.0
-
getPortalInfo
public PortalInfo getPortalInfo()
Gets the PortalInfo object for this portal.- Returns:
- the PortalInfo object for this portal, or null if the portal is not loaded yet
- Since:
- 100.0.0
- See Also:
PortalInfo
-
getUser
public PortalUser getUser()
Gets a PortalUser object describing the user currently signed in to this portal.- Returns:
- a PortalUser object, or null if no user is signed in due to anonymous access or portal not loaded yet
- Since:
- 100.0.0
- See Also:
PortalUser
-
getSharingUrl
public java.lang.String getSharingUrl()
Gets the sharing URL, that is, the URL of the root REST resource for the portal. For examplehttps://www.arcgis.com/sharing/rest
for ArcGIS Online, orhttps://<host>:<port>/arcgis/sharing/rest
for an on-premises portal.- Returns:
- the sharing URL
- Since:
- 100.0.0
-
setCulture
public void setCulture(java.lang.String culture)
Sets a code that specifies the culture-specific formatting to use when accessing portal content.The culture code provides localized content when viewing featured groups or items, adding or updating an item, and so on. If not explicitly set, the culture used by the device/machine is used. Set it to null if you want to see portal content in the language corresponding to the culture set in the portal/organization settings.
The format for culture code is based on a language code and a country code separated by a dash. Example: "en-US". For the list of cultures, see Supported languages.
- Parameters:
culture
- the culture code to use, or null to see portal content in the language corresponding to the culture set in the portal/organization settings- Since:
- 100.9.0
-
getCulture
public java.lang.String getCulture()
Gets a code that specifies the culture-specific formatting to use when accessing portal content.The culture code provides localized content when viewing featured groups or items, adding or updating an item, and so on. If not explicitly set, the culture used by the device/machine is used.
The format for culture code is based on a language code and a country code separated by a dash. Example: "en-US". For the list of cultures, see Supported languages.
- Returns:
- the culture code currently in use, or null if none
- Since:
- 100.9.0
-
getUri
public java.lang.String getUri()
Gets the portal URL.- Specified by:
getUri
in interfaceRemoteResource
- Returns:
- the portal URL
- Since:
- 100.0.0
-
setRequestConfiguration
public void setRequestConfiguration(RequestConfiguration requestConfiguration)
Sets configuration parameters used for network requests sent using this Portal object. The global RequestConfiguration is used if no RequestConfiguration is set or null is set (seeRequestConfiguration.getGlobalRequestConfiguration()
).- Specified by:
setRequestConfiguration
in interfaceRemoteResource
- Parameters:
requestConfiguration
- object containing the parameters to use- Since:
- 100.0.0
-
getRequestConfiguration
public RequestConfiguration getRequestConfiguration()
Gets the RequestConfiguration object in use by this Portal. If null is returned, then that indicates that the global RequestConfiguration is used instead.- Specified by:
getRequestConfiguration
in interfaceRemoteResource
- Returns:
- the RequestConfiguration object or null if none is set
- Since:
- 100.0.0
- See Also:
RequestConfiguration
-
addCredentialChangedListener
public void addCredentialChangedListener(CredentialChangedListener credentialChangedListener)
Adds a CredentialChangedListener to be called when the Portal's Credential is changed. If the Credential is changed the app may want to create and load a new Portal object using the new Credential.This listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- Parameters:
credentialChangedListener
- the CredentialChangedListener to add- Throws:
java.lang.IllegalArgumentException
- if the listener is null- Since:
- 100.0.0
-
removeCredentialChangedListener
public boolean removeCredentialChangedListener(CredentialChangedListener credentialChangedListener)
Attempts to remove a CredentialChangedListener. Returns true if the listener is successfully found and removed.- Parameters:
credentialChangedListener
- the listener to be removed- Returns:
- true if the listener is removed
- Throws:
java.lang.IllegalArgumentException
- if the listener is null- Since:
- 100.0.0
-
fetchLoginTypeForUrlAsync
public static ListenableFuture<Portal.LoginType> fetchLoginTypeForUrlAsync(java.lang.String url)
Executes an asynchronous operation to determine the login type for a given portal URL. The result is a LoginType enum.- Parameters:
url
- the URL- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Throws:
java.lang.IllegalArgumentException
- if url is null or empty- Since:
- 100.0.0
-
fetchBasemapsAsync
public ListenableFuture<java.util.List<Basemap>> fetchBasemapsAsync()
Executes an asynchronous operation to fetch the basemaps using thePortalInfo.getBasemapGalleryGroupQuery()
query string. The result is an unmodifiable list of Basemaps. The Basemaps are not loaded, but their PortalItem metadata are available usingBasemap.getItem()
.Note: the size of the resultant list is limited to 25. If a portal has more than 25 basemaps, they can all be fetched by using
PortalInfo.getBasemapGalleryGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.1.0
-
fetchDeveloperBasemapsAsync
public ListenableFuture<java.util.List<Basemap>> fetchDeveloperBasemapsAsync()
Executes an asynchronous operation to fetch the developer basemaps using thePortalInfo.getDeveloperBasemapGalleryGroupQuery()
query string. The result is an unmodifiable list of Basemaps.Note: the size of the resultant list is limited to 25. If a portal has more than 25 developer basemaps, they can all be fetched by using
PortalInfo.getDeveloperBasemapGalleryGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.12.0
-
fetchFeaturedGroupsAsync
public ListenableFuture<java.util.List<PortalGroup>> fetchFeaturedGroupsAsync()
Executes an asynchronous operation to fetch the featured groups for the organization. The result is an unmodifiable list of PortalGroup objects. These are fully populated and have a load status ofLoadStatus.LOADED
.Note: the size of the resultant list is limited to 25. If an organization has more than 25 featured groups, they can all be fetched by using
PortalInfo.getFeaturedGroupsQueries()
andfindGroupsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.1.0
-
fetchFeaturedItemsAsync
public ListenableFuture<java.util.List<PortalItem>> fetchFeaturedItemsAsync()
Executes an asynchronous operation to fetch the featured items for the organization. The result is an unmodifiable list of PortalItems.Note: the size of the resultant list is limited to 25. If an organization has more than 25 featured items, they can all be fetched by using
PortalInfo.getFeaturedItemsGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.1.0
-
fetchHomePageFeaturedContentAsync
public ListenableFuture<java.util.List<PortalItem>> fetchHomePageFeaturedContentAsync()
Executes an asynchronous operation to fetch the featured content for display on the organization's home page. The result is an unmodifiable list of PortalItems.Note: the size of the resultant list is limited to 25. If an organization has more than 25 home page featured items, they can all be fetched by using
PortalInfo.getHomePageFeaturedContentGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.1.0
-
fetchVectorBasemapsAsync
public ListenableFuture<java.util.List<Basemap>> fetchVectorBasemapsAsync()
Executes an asynchronous operation to fetch the vector basemaps using thePortalInfo.getVectorBasemapGalleryGroupQuery()
query string. The result is an unmodifiable list of Basemaps. The Basemaps are not loaded, but their PortalItem metadata is available usingBasemap.getItem()
.Note: the size of the resultant list is limited to 25. If a portal has more than 25 vector basemaps, they can all be fetched by using
PortalInfo.getVectorBasemapGalleryGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.6.0
- See Also:
fetchBasemapsAsync()
-
fetchLicenseInfoAsync
public ListenableFuture<LicenseInfo> fetchLicenseInfoAsync()
Executes an asynchronous operation to fetch the current user's LicenseInfo including the entitlements and extensions.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.7.0
-
fetchStylesAsync
public ListenableFuture<java.util.List<PortalItem>> fetchStylesAsync()
Executes an asynchronous operation to fetch the styles using thePortalInfo.getStylesGroupQuery()
query string. The result is an unmodifiable list of PortalItems.Note: the size of the resultant list is limited to 25. If a portal has more than 25 styles, they can all be fetched by using
PortalInfo.getStylesGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.12.0
-
fetchSymbolSetsAsync
public ListenableFuture<java.util.List<PortalItem>> fetchSymbolSetsAsync()
Executes an asynchronous operation to fetch the symbol sets using thePortalInfo.getSymbolSetsGroupQuery()
query string. The result is an unmodifiable list of PortalItems.Note: the size of the resultant list is limited to 25. If a portal has more than 25 symbol sets, they can all be fetched by using
PortalInfo.getSymbolSetsGroupQuery()
,findGroupsAsync(PortalQueryParameters)
andfindItemsAsync(PortalQueryParameters)
.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if a network request fails
- Since:
- 100.12.0
-
findItemsAsync
public ListenableFuture<PortalQueryResultSet<PortalItem>> findItemsAsync(PortalQueryParameters queryParameters)
Executes an asynchronous operation to find items in this portal with a query using the specified portal query parameters. The result is a PortalQueryResultSet object containing a set of portal items.If you are considering using this method to find items that belong to a group, see
PortalGroup.findItemsAsync(PortalGroupContentSearchParameters)
for a description of how that method, which uses a Group Content Search operation that's designed specifically for finding items that belong to a group, differs from this method which uses a general-purpose Search operation.- Parameters:
queryParameters
- parameters used to search the portal- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if the network request fails
- Throws:
java.lang.IllegalArgumentException
- if queryParameters is null- Since:
- 100.0.0
-
findGroupsAsync
public ListenableFuture<PortalQueryResultSet<PortalGroup>> findGroupsAsync(PortalQueryParameters queryParameters)
Executes an asynchronous operation to find groups in this portal with a query using the specified portal query parameters. The result is a PortalQueryResultSet object containing a collection of PortalGroup objects. These are fully populated and have a load status ofLoadStatus.LOADED
.- Parameters:
queryParameters
- parameters used to search the portal- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if the network request fails
- Throws:
java.lang.IllegalArgumentException
- if queryParameters is null- Since:
- 100.0.0
-
postRequestAsync
public ListenableFuture<java.lang.String> postRequestAsync(java.lang.String requestUrl)
Executes an asynchronous operation to send a customized request and let the caller handle the response. The request will be sent using the "POST" method. The result is a String object containing JSON.- Parameters:
requestUrl
- the URL of the request- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if the network request fails
- Since:
- 100.0.0
-
sendRequestAsync
public ListenableFuture<java.lang.String> sendRequestAsync(java.lang.String requestUrl)
Executes an asynchronous operation to send a customized request and let the caller handle the response. The request will be sent using the "POST" or "GET" method based on the length of the URL. The result is a String object containing JSON.- Parameters:
requestUrl
- the URL of the request- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to an exception as follows:IOException
if the network request fails
- Since:
- 100.0.0
-
getLoadStatus
public LoadStatus getLoadStatus()
Description copied from interface:Loadable
Returns theLoadStatus
of the loadable resource.- Specified by:
getLoadStatus
in interfaceLoadable
- Returns:
- the LoadStatus of the loadable resource
-
getLoadError
public ArcGISRuntimeException getLoadError()
Description copied from interface:Loadable
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.If the resource subsequently transitions to
LoadStatus.LOADED
(for example, if a call toretryLoadAsync
completes successfully) the error is cleared out.- Specified by:
getLoadError
in interfaceLoadable
- Returns:
- the most recent error that was encountered when the loadable resource transitioned to the
LoadStatus.FAILED_TO_LOAD
state.
-
cancelLoad
public void cancelLoad()
Description copied from interface:Loadable
Cancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADING
toLoadStatus.FAILED_TO_LOAD
state. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.getLoadError()
.Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.
This method does nothing if the resource is not in
LoadStatus.LOADING
state.- Specified by:
cancelLoad
in interfaceLoadable
-
loadAsync
public void loadAsync()
Description copied from interface:Loadable
Loads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADED
toLoadStatus.LOADING
. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.Runnable)
that is invoked upon completion of the asynchronous load operation.If the load operation completes successfully, the load status will be
LoadStatus.LOADED
, which means the resource has loaded its metadata.If the load operation failed, the load status will be
LoadStatus.FAILED_TO_LOAD
and the error can be retrieved by callingLoadable.getLoadError()
.This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (
LoadStatus.LOADING
state) whenloadAsync
is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED
orLoadStatus.FAILED_TO_LOAD
state) whenloadAsync
is called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsync
on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource,Loadable.retryLoadAsync()
needs to be used.A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by callingLoadable.cancelLoad()
.
-
retryLoadAsync
public void retryLoadAsync()
Description copied from interface:Loadable
Loads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD
. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync()
.- Specified by:
retryLoadAsync
in interfaceLoadable
-
addDoneLoadingListener
public void addDoneLoadingListener(java.lang.Runnable listener)
Description copied from interface:Loadable
Adds a listener to the loadable resource that is invoked when loading has completed.The listener may be added at any point, whether the loadable resource has already completed loading or not.
- For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.
Alternatively, to be notified when there is any change in the load status, use the
Loadable.addLoadStatusChangedListener(LoadStatusChangedListener)
method instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
public boolean removeDoneLoadingListener(java.lang.Runnable listener)
Description copied from interface:Loadable
Removes a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
-
addLoadStatusChangedListener
public void addLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:Loadable
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the
Loadable.addDoneLoadingListener(Runnable)
method.- Specified by:
addLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be added
-
removeLoadStatusChangedListener
public boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:Loadable
Removes aLoadStatusChangedListener
from the loadable resource.- Specified by:
removeLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be removed- Returns:
- true if the listener was removed, otherwise false
-
isPKCESupported
public boolean isPKCESupported()
Returns a boolean that defines if PKCE (proof key code exchange) is supported with this portal. PKCE is supported for portal version 10.9 and higher if OAuth is supported.- Returns:
- a boolean that defines if PKCE is supported with this portal
- Since:
- 100.12.0
-
-