- All Implemented Interfaces:
JsonSerializable
,Loadable
- Since:
- 100.0.0
-
Property Summary
TypePropertyDescriptionThe number of credits available to the user.The load error.The load status.The ID of the user. -
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Signifies the level of access to a portal user, which determines who can access the user descriptive information.static enum
Signifies the role in the organization of a portal user. -
Constructor Summary
ConstructorDescriptionPortalUser
(Portal portal, String username) Constructor for use if you wish to fetch a particular user from a portal. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDoneLoadingListener
(Runnable listener) Adds a listener to the loadable resource that is invoked when loading has completed.void
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.addPortalItemAsync
(PortalItem portalItem, PortalItemContentParameters contentParameters, PortalFolder portalFolder) Executes an asynchronous operation to add a portal item to the portal.The number of credits available to the user.void
Cancels loading metadata for the object.createFolderAsync
(String title) Executes an asynchronous operation to create a new folder with the given title in this user's root folder (nested folders are not supported).deleteFolderAsync
(PortalFolder portalFolder) Executes an asynchronous operation to delete a folder from the portal.deletePortalItemAsync
(PortalItem portalItem) Executes an asynchronous operation to delete a portal item from the portal.Executes an asynchronous operation to fetch content from this user's root folder.fetchContentInFolderAsync
(String folderId) Executes an asynchronous operation to fetch content from a specific folder belonging to this user.ListenableFuture
<byte[]> Executes an asynchronous operation to fetch the thumbnail for this user.static PortalUser
Creates a PortalUser instance from a JSON string.Gets the access level of this user, which determines who can access the user descriptive information.double
Gets the value of theavailableCredits
property.Gets the member categories that the user is assigned to.Gets the date this user was created.getEmail()
Gets the email address of this user.Gets the ID of the favorites group for this user.Gets the full name of this user.Gets a list of the groups this user belongs to.Gets the value of theloadError
property.Gets the value of theloadStatus
property.Gets the date on which this user was last modified.Gets the ID of the organization the user belongs to, if any.Gets the portal this user belongs to.Gets a list of PortalPrivilege objects defining the fine-grained privileges possessed by this user.getRole()
Gets the role in the organization of this user.getTags()
Gets a list of the tags associated with this user.Gets the filename of the thumbnail for this user.getUnits()
Gets the preferred units of measurement for this user.Gets unknown data from the source JSON.Gets unsupported data from the source JSON.Gets the description of this user.Gets the value of theuserId
property.Gets the username for this user.void
Loads the metadata of the loadable resource asynchronously.The load error.The load status.movePortalItemAsync
(PortalItem portalItem, PortalFolder destinationFolder) Executes an asynchronous operation to move a portal item to a different folder.movePortalItemsAsync
(Iterable<PortalItem> portalItems, PortalFolder destinationFolder) Executes an asynchronous operation to move a batch of portal items to a different folder.boolean
removeDoneLoadingListener
(Runnable listener) Removes a done loading listener from the loadable resource.boolean
Removes aLoadStatusChangedListener
from the loadable resource.void
Loads or retries loading metadata for the object asynchronously.toJson()
Serializes this object to a JSON string.The ID of the user.
-
Property Details
-
availableCredits
The number of credits available to the user.This value is NaN if credit budgeting is turned off for the organization. See Understanding and managing ArcGIS Online credits for more information.
- Since:
- 200.4.0
- See Also:
-
userId
The ID of the user.- Since:
- 200.4.0
- See Also:
-
loadStatus
- Specified by:
loadStatusProperty
in interfaceLoadable
- Returns:
- the
loadStatus
property - See Also:
-
loadError
- Specified by:
loadErrorProperty
in interfaceLoadable
- Returns:
- the
loadError
property - See Also:
-
-
Constructor Details
-
PortalUser
Constructor for use if you wish to fetch a particular user from a portal. CallloadAsync()
on the resultant object to fetch the data for this user. Note that most of the getter methods will return null or zero until the load operation is complete.- Parameters:
portal
- the portal the user belongs tousername
- the username for the user- Throws:
IllegalArgumentException
- if portal is null or username is null or empty- Since:
- 100.0.0
-
-
Method Details
-
fromJson
Creates a PortalUser instance from a JSON string.- Parameters:
json
- a JSON string that represents a PortalUserportal
- the Portal object for use by the PortalUser- Returns:
- a PortalUser instance
- Throws:
IllegalArgumentException
- if portal is null or json is null or empty- Since:
- 100.0.0
-
toJson
Description copied from interface:JsonSerializable
Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.- Specified by:
toJson
in interfaceJsonSerializable
- Returns:
- a JSON string
-
getUnknownJson
Description copied from interface:JsonSerializable
Gets unknown data from the source JSON.Unknown JSON is a Map of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.
- Specified by:
getUnknownJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unknown data from the source JSON
-
getUnsupportedJson
Description copied from interface:JsonSerializable
Gets unsupported data from the source JSON.Unsupported JSON is a Map of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.
- Specified by:
getUnsupportedJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unsupported data from the source JSON
-
getAccess
Gets the access level of this user, which determines who can access the user descriptive information.- Returns:
- the access level of this user
- Since:
- 100.0.0
-
availableCreditsProperty
The number of credits available to the user.This value is NaN if credit budgeting is turned off for the organization. See Understanding and managing ArcGIS Online credits for more information.
- Returns:
- the
availableCredits
property - Since:
- 200.4.0
- See Also:
-
getAvailableCredits
public double getAvailableCredits()Gets the value of theavailableCredits
property.- Property description:
- The number of credits available to the user.
This value is NaN if credit budgeting is turned off for the organization. See Understanding and managing ArcGIS Online credits for more information.
- Returns:
- the value of the
availableCredits
property - Since:
- 200.4.0
- See Also:
-
getCategories
Gets the member categories that the user is assigned to.This is available only for ArcGIS.com and ArcGIS Enterprise version 11.0 and above, otherwise the list will be empty. See Introducing member categories for more information.
- Returns:
- the member categories that the user is assigned to
- Since:
- 200.4.0
-
userIdProperty
The ID of the user.- Returns:
- the
userId
property - Since:
- 200.4.0
- See Also:
-
getUserId
Gets the value of theuserId
property.- Property description:
- The ID of the user.
- Returns:
- the value of the
userId
property - Since:
- 200.4.0
- See Also:
-
getCreated
Gets the date this user was created.- Returns:
- the date this user was created; always a GregorianCalendar using UTC time zone and English locale
- Since:
- 100.0.0
-
getEmail
Gets the email address of this user.- Returns:
- the email address of this user
- Since:
- 100.0.0
-
getFavoritesGroupId
Gets the ID of the favorites group for this user.- Returns:
- the ID of the favorites group for this user
- Since:
- 100.0.0
-
getFullName
Gets the full name of this user.- Returns:
- the full name of this user
- Since:
- 100.0.0
-
getGroups
Gets a list of the groups this user belongs to. The resultant PortalGroup objects are fully populated and have a load status ofLoadStatus.LOADED
.- Returns:
- an unmodifiable list of the groups this user belongs to. This will throw an UnsupportedOperationException if an attempt is made to modify it.
- Since:
- 100.0.0
-
getModified
Gets the date on which this user was last modified.- Returns:
- the date on which this user was last modified; always a GregorianCalendar using UTC time zone and English locale
- Since:
- 100.0.0
-
getOrganizationId
Gets the ID of the organization the user belongs to, if any.- Returns:
- the ID of the organization, or null if the user does not belong to one
- Since:
- 100.0.0
-
getPortal
Gets the portal this user belongs to.- Returns:
- the portal this user belongs to
- Since:
- 100.0.0
-
getPrivileges
Gets a list of PortalPrivilege objects defining the fine-grained privileges possessed by this user.- Returns:
- an unmodifiable list of PortalPrivilege objects. This will throw an UnsupportedOperationException if an attempt is made to modify it.
- Since:
- 100.0.0
-
getRole
Gets the role in the organization of this user.- Returns:
- the role in the organization of this user
- Since:
- 100.0.0
-
getTags
Gets a list of the tags associated with this user.- Returns:
- an unmodifiable list of the tags associated with this user. This will throw an UnsupportedOperationException if an attempt is made to modify it.
- Since:
- 100.0.0
-
getThumbnailFileName
Gets the filename of the thumbnail for this user.- Returns:
- the filename of the thumbnail for this user
- Since:
- 100.0.0
-
getUnits
Gets the preferred units of measurement for this user.- Returns:
- the preferred units of measurement for this user, or null if none
- Since:
- 100.3.0
-
getUserDescription
Gets the description of this user.- Returns:
- the description of this user
- Since:
- 100.0.0
-
getUsername
Gets the username for this user.- Returns:
- the username for this user
- Since:
- 100.0.0
-
fetchThumbnailAsync
Executes an asynchronous operation to fetch the thumbnail for this user. The result is a byte[] containing the thumbnail data, or null if there is no thumbnail for this user.- 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
-
fetchContentAsync
Executes an asynchronous operation to fetch content from this user's root folder. The result is a PortalUserContent object containing items and folders found in the user's root folder.- 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
-
fetchContentInFolderAsync
Executes an asynchronous operation to fetch content from a specific folder belonging to this user. The result is an unmodifiable list of items found in the folder.- Parameters:
folderId
- ID of the folder for which to fetch content, must not be null- 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:
IllegalArgumentException
- if folderId is null- Since:
- 100.0.0
-
addPortalItemAsync
public ListenableFuture<String> addPortalItemAsync(PortalItem portalItem, PortalItemContentParameters contentParameters, PortalFolder portalFolder) Executes an asynchronous operation to add a portal item to the portal. The new item will belong to this user and its access level will bePortalItem.Access.PRIVATE
. The result is a String containing the ID of the new portal item.On completion, the metadata in the PortalItem object will be supplemented to include the ID, owner, owner folder ID and access level of the new item, but some other metadata such as created and modified dates will not be populated unless the PortalItem is loaded.
- Parameters:
portalItem
- a PortalItem object populated with metadata for the item to be added; must not be nullcontentParameters
- specifies the content for the item to be added; must not be nullportalFolder
- a PortalFolder belonging to this user in which to add the item, or null to add it to this user's root folder- 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:
IllegalArgumentException
- if portalItem or contentParameters is null; or if portalItem is insufficiently populated (title must be set).ArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to edit portal content)- Since:
- 100.0.0
-
deletePortalItemAsync
Executes an asynchronous operation to delete a portal item from the portal. The item must belong to this user.- Parameters:
portalItem
- a PortalItem object for the item to be deleted; must be loaded and must not be null- 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:
IllegalArgumentException
- if portalItem is nullArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to edit portal content)- Since:
- 100.0.0
-
createFolderAsync
Executes an asynchronous operation to create a new folder with the given title in this user's root folder (nested folders are not supported). The result is a PortalFolder object containing the new folder's ID, title and owner's username.- Parameters:
title
- a title for the folder; must not be null and must be unique to this user- 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:
IllegalArgumentException
- if title is null or emptyArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to edit portal content)- Since:
- 100.0.0
-
deleteFolderAsync
Executes an asynchronous operation to delete a folder from the portal. The folder must belong to this user. Deleting a folder also deletes all items that it contains.- Parameters:
portalFolder
- a PortalFolder object for the folder to be deleted; must not be null- 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:
IllegalArgumentException
- if portalFolder is nullArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to edit portal content)- Since:
- 100.0.0
-
movePortalItemAsync
public ListenableFuture<Void> movePortalItemAsync(PortalItem portalItem, PortalFolder destinationFolder) Executes an asynchronous operation to move a portal item to a different folder. The item and folder must already exist and belong to this user.- Parameters:
portalItem
- a PortalItem object for the item to be moved; must not be nulldestinationFolder
- a PortalFolder object for the destination folder; null to specify this user's root folder- Returns:
- a ListenableFuture for tracking when the computation 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 loaded
- Throws:
IllegalArgumentException
- if portalItem is nullArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to edit portal content)- Since:
- 100.0.0
-
movePortalItemsAsync
public ListenableFuture<List<PortalItemMoveError>> movePortalItemsAsync(Iterable<PortalItem> portalItems, PortalFolder destinationFolder) Executes an asynchronous operation to move a batch of portal items to a different folder. The items and folder must already exist and belong to this user. The result is an unmodifiable list of PortalItemMoveError objects, one for each item that was not moved, empty if all items were moved successfully.- Parameters:
portalItems
- PortalItem objects for the batch of items to be moved; must not be null or empty, and all the PortalItems must be loadeddestinationFolder
- a PortalFolder object for the destination folder; null to specify this user's root folder- 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:
IllegalArgumentException
- if portalItems is null or empty or includes a PortalItem that has no item IDArcGISRuntimeException
- if the currentLicenseLevel
is too low for this operation (LicenseLevel.BASIC
or higher is required to edit portal content)- Since:
- 100.0.0
-
getLoadStatus
Gets the value of theloadStatus
property.- Specified by:
getLoadStatus
in interfaceLoadable
- Property description:
- Returns:
- the value of the
loadStatus
property - See Also:
-
getLoadError
Gets the value of theloadError
property.- Specified by:
getLoadError
in interfaceLoadable
- Property description:
- Returns:
- the value of the
loadError
property - See Also:
-
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
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, add a listener to the
Loadable.loadStatusProperty()
instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
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
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
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
-
loadStatusProperty
Description copied from interface:Loadable
The load status.- Specified by:
loadStatusProperty
in interfaceLoadable
- Returns:
- the
loadStatus
property - See Also:
-
loadErrorProperty
Description copied from interface:Loadable
The load error.- Specified by:
loadErrorProperty
in interfaceLoadable
- Returns:
- the
loadError
property - See Also:
-