Class PortalUser
- java.lang.Object
- 
- com.esri.arcgisruntime.portal.PortalUser
 
- 
- All Implemented Interfaces:
- JsonSerializable,- Loadable
 
 public final class PortalUser extends Object implements Loadable, JsonSerializable Represents a registered user of a portal.- Since:
- 100.0.0
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPortalUser.AccessSignifies the level of access to a portal user, which determines who can access the user descriptive information.static classPortalUser.RoleSignifies the role in the organization of a portal user.
 - 
Constructor SummaryConstructors Constructor Description PortalUser(Portal portal, String username)Constructor for use if you wish to fetch a particular user from a portal.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDoneLoadingListener(Runnable listener)Adds a listener to the loadable resource that is invoked when loading has completed.voidaddLoadStatusChangedListener(LoadStatusChangedListener listener)Adds aLoadStatusChangedListenerto the loadable resource that is invoked whenever the load status changes.ListenableFuture<String>addPortalItemAsync(PortalItem portalItem, PortalItemContentParameters contentParameters, PortalFolder portalFolder)Executes an asynchronous operation to add a portal item to the portal.voidcancelLoad()Cancels loading metadata for the object.ListenableFuture<PortalFolder>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).ListenableFuture<Void>deleteFolderAsync(PortalFolder portalFolder)Executes an asynchronous operation to delete a folder from the portal.ListenableFuture<Void>deletePortalItemAsync(PortalItem portalItem)Executes an asynchronous operation to delete a portal item from the portal.ListenableFuture<PortalUserContent>fetchContentAsync()Executes an asynchronous operation to fetch content from this user's root folder.ListenableFuture<List<PortalItem>>fetchContentInFolderAsync(String folderId)Executes an asynchronous operation to fetch content from a specific folder belonging to this user.ListenableFuture<byte[]>fetchThumbnailAsync()Executes an asynchronous operation to fetch the thumbnail for this user.static PortalUserfromJson(String json, Portal portal)Creates a PortalUser instance from a JSON string.PortalUser.AccessgetAccess()Gets the access level of this user, which determines who can access the user descriptive information.CalendargetCreated()Gets the date this user was created.StringgetEmail()Gets the email address of this user.StringgetFavoritesGroupId()Gets the ID of the favorites group for this user.StringgetFullName()Gets the full name of this user.List<PortalGroup>getGroups()Gets a list of the groups this user belongs to.ArcGISRuntimeExceptiongetLoadError()Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOADstate, either due to calling theLoadable.loadAsync()orLoadable.retryLoadAsync()method.LoadStatusgetLoadStatus()Returns theLoadStatusof the loadable resource.CalendargetModified()Gets the date on which this user was last modified.StringgetOrganizationId()Gets the ID of the organization the user belongs to, if any.PortalgetPortal()Gets the portal this user belongs to.List<PortalPrivilege>getPrivileges()Gets a list of PortalPrivilege objects defining the fine-grained privileges possessed by this user.PortalUser.RolegetRole()Gets the role in the organization of this user.List<String>getTags()Gets a list of the tags associated with this user.StringgetThumbnailFileName()Gets the filename of the thumbnail for this user.UnitSystemgetUnits()Gets the preferred units of measurement for this user.Map<String,Object>getUnknownJson()If this object was created from JSON, this method gets unknown data from the source JSON.Map<String,Object>getUnsupportedJson()If this object was created from JSON, this method gets unsupported data from the source JSON.StringgetUserDescription()Gets the description of this user.StringgetUsername()Gets the username for this user.voidloadAsync()Loads the metadata of the loadable resource asynchronously.ListenableFuture<Void>movePortalItemAsync(PortalItem portalItem, PortalFolder destinationFolder)Executes an asynchronous operation to move a portal item to a different folder.ListenableFuture<List<PortalItemMoveError>>movePortalItemsAsync(Iterable<PortalItem> portalItems, PortalFolder destinationFolder)Executes an asynchronous operation to move a batch of portal items to a different folder.booleanremoveDoneLoadingListener(Runnable listener)Removes a done loading listener from the loadable resource.booleanremoveLoadStatusChangedListener(LoadStatusChangedListener listener)Removes aLoadStatusChangedListenerfrom the loadable resource.voidretryLoadAsync()Loads or retries loading metadata for the object asynchronously.StringtoJson()Serializes this object to a JSON string.
 
- 
- 
- 
Constructor Detail- 
PortalUserpublic PortalUser(Portal portal, String username) 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 to
- username- the username for the user
- Throws:
- IllegalArgumentException- if portal is null or username is null or empty
- Since:
- 100.0.0
 
 
- 
 - 
Method Detail- 
fromJsonpublic static PortalUser fromJson(String json, Portal portal) Creates a PortalUser instance from a JSON string.- Parameters:
- json- a JSON string that represents a PortalUser
- portal- 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
 
 - 
toJsonpublic String toJson() Description copied from interface:JsonSerializableSerializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.- Specified by:
- toJsonin interface- JsonSerializable
- Returns:
- a JSON string
 
 - 
getUnknownJsonpublic Map<String,Object> getUnknownJson() Description copied from interface:JsonSerializableIf this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.- Specified by:
- getUnknownJsonin interface- JsonSerializable
- Returns:
- an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of 
 the values depend on the types of tokens within the JSON as follows:
 - a Map<String, Object>represents an object in the JSON
- a List<Object>represents an array in the JSON
- a Stringrepresents a string in the JSON
- a Doublerepresents a number in the JSON
- a Booleanrepresents true or false in the JSON
- nullrepresents null in the JSON
 
- a 
 
 - 
getUnsupportedJsonpublic Map<String,Object> getUnsupportedJson() Description copied from interface:JsonSerializableIf this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.- Specified by:
- getUnsupportedJsonin interface- JsonSerializable
- Returns:
- an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of
 the values depend on the types of tokens within the JSON as follows:
 - a Map<String, Object>represents an object in the JSON
- a List<Object>represents an array in the JSON
- a Stringrepresents a string in the JSON
- a Doublerepresents a number in the JSON
- a Booleanrepresents true or false in the JSON
- nullrepresents null in the JSON
 
- a 
 
 - 
getAccesspublic PortalUser.Access 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
 
 - 
getCreatedpublic Calendar 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
 
 - 
getEmailpublic String getEmail() Gets the email address of this user.- Returns:
- the email address of this user
- Since:
- 100.0.0
 
 - 
getFavoritesGroupIdpublic String 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
 
 - 
getFullNamepublic String getFullName() Gets the full name of this user.- Returns:
- the full name of this user
- Since:
- 100.0.0
 
 - 
getGroupspublic List<PortalGroup> 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
 
 - 
getModifiedpublic Calendar 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
 
 - 
getOrganizationIdpublic String 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
 
 - 
getPortalpublic Portal getPortal() Gets the portal this user belongs to.- Returns:
- the portal this user belongs to
- Since:
- 100.0.0
 
 - 
getPrivilegespublic List<PortalPrivilege> 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
 
 - 
getRolepublic PortalUser.Role getRole() Gets the role in the organization of this user.- Returns:
- the role in the organization of this user
- Since:
- 100.0.0
 
 - 
getTagspublic List<String> 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
 
 - 
getThumbnailFileNamepublic String getThumbnailFileName() Gets the filename of the thumbnail for this user.- Returns:
- the filename of the thumbnail for this user
- Since:
- 100.0.0
 
 - 
getUnitspublic UnitSystem 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
 
 - 
getUserDescriptionpublic String getUserDescription() Gets the description of this user.- Returns:
- the description of this user
- Since:
- 100.0.0
 
 - 
getUsernamepublic String getUsername() Gets the username for this user.- Returns:
- the username for this user
- Since:
- 100.0.0
 
 - 
fetchThumbnailAsyncpublic ListenableFuture<byte[]> 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:- IOExceptionif the network request fails
 
- Since:
- 100.0.0
 
 - 
fetchContentAsyncpublic ListenableFuture<PortalUserContent> 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:- IOExceptionif the network request fails
 
- Since:
- 100.0.0
 
 - 
fetchContentInFolderAsyncpublic ListenableFuture<List<PortalItem>> fetchContentInFolderAsync(String folderId) 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:- IOExceptionif the network request fails
 
- Throws:
- IllegalArgumentException- if folderId is null
- Since:
- 100.0.0
 
 - 
addPortalItemAsyncpublic 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 null
- contentParameters- specifies the content for the item to be added; must not be null
- portalFolder- 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:- IOExceptionif 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 current- LicenseLevelis too low for this operation (- LicenseLevel.BASICor higher is required to edit portal content)
- Since:
- 100.0.0
 
 - 
deletePortalItemAsyncpublic ListenableFuture<Void> deletePortalItemAsync(PortalItem portalItem) 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:- IOExceptionif the network request fails
 
- Throws:
- IllegalArgumentException- if portalItem is null
- ArcGISRuntimeException- if the current- LicenseLevelis too low for this operation (- LicenseLevel.BASICor higher is required to edit portal content)
- Since:
- 100.0.0
 
 - 
createFolderAsyncpublic ListenableFuture<PortalFolder> 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). 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:- IOExceptionif the network request fails
 
- Throws:
- IllegalArgumentException- if title is null or empty
- ArcGISRuntimeException- if the current- LicenseLevelis too low for this operation (- LicenseLevel.BASICor higher is required to edit portal content)
- Since:
- 100.0.0
 
 - 
deleteFolderAsyncpublic ListenableFuture<Void> deleteFolderAsync(PortalFolder portalFolder) 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:- IOExceptionif the network request fails
 
- Throws:
- IllegalArgumentException- if portalFolder is null
- ArcGISRuntimeException- if the current- LicenseLevelis too low for this operation (- LicenseLevel.BASICor higher is required to edit portal content)
- Since:
- 100.0.0
 
 - 
movePortalItemAsyncpublic 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 null
- destinationFolder- 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:- IOExceptionif the network request fails loaded
 
- Throws:
- IllegalArgumentException- if portalItem is null
- ArcGISRuntimeException- if the current- LicenseLevelis too low for this operation (- LicenseLevel.BASICor higher is required to edit portal content)
- Since:
- 100.0.0
 
 - 
movePortalItemsAsyncpublic 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 loaded
- destinationFolder- 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:- IOExceptionif the network request fails
 
- Throws:
- IllegalArgumentException- if portalItems is null or empty or includes a PortalItem that has no item ID
- ArcGISRuntimeException- if the current- LicenseLevelis too low for this operation (- LicenseLevel.BASICor higher is required to edit portal content)
- Since:
- 100.0.0
 
 - 
getLoadStatuspublic LoadStatus getLoadStatus() Description copied from interface:LoadableReturns theLoadStatusof the loadable resource.- Specified by:
- getLoadStatusin interface- Loadable
- Returns:
- the LoadStatus of the loadable resource
 
 - 
getLoadErrorpublic ArcGISRuntimeException getLoadError() Description copied from interface:LoadableReturns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOADstate, either due to calling theLoadable.loadAsync()orLoadable.retryLoadAsync()method.If the resource subsequently transitions to LoadStatus.LOADED(for example, if a call toretryLoadAsynccompletes successfully) the error is cleared out.- Specified by:
- getLoadErrorin interface- Loadable
- Returns:
- the most recent error that was encountered when the loadable resource transitioned to the
         LoadStatus.FAILED_TO_LOADstate.
 
 - 
cancelLoadpublic void cancelLoad() Description copied from interface:LoadableCancels 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.LOADINGstate) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADINGtoLoadStatus.FAILED_TO_LOADstate. 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.LOADINGstate.- Specified by:
- cancelLoadin interface- Loadable
 
 - 
loadAsyncpublic void loadAsync() Description copied from interface:LoadableLoads the metadata of the loadable resource asynchronously.The load status changes from LoadStatus.NOT_LOADEDtoLoadStatus.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_LOADand 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.LOADINGstate) whenloadAsyncis 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.LOADEDorLoadStatus.FAILED_TO_LOADstate) whenloadAsyncis called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling loadAsyncon 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.LOADINGstate) can be cancelled by callingLoadable.cancelLoad().
 - 
retryLoadAsyncpublic void retryLoadAsync() Description copied from interface:LoadableLoads 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:
- retryLoadAsyncin interface- Loadable
 
 - 
addDoneLoadingListenerpublic void addDoneLoadingListener(Runnable listener) Description copied from interface:LoadableAdds 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:
- addDoneLoadingListenerin interface- Loadable
- Parameters:
- listener- a Runnable that is invoked upon completion of the load operation
 
 - 
removeDoneLoadingListenerpublic boolean removeDoneLoadingListener(Runnable listener) Description copied from interface:LoadableRemoves a done loading listener from the loadable resource.- Specified by:
- removeDoneLoadingListenerin interface- Loadable
- Parameters:
- listener- the listener to be removed
- Returns:
- true if the listener was removed, otherwise false
 
 - 
addLoadStatusChangedListenerpublic void addLoadStatusChangedListener(LoadStatusChangedListener listener) Description copied from interface:LoadableAdds aLoadStatusChangedListenerto 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:
- addLoadStatusChangedListenerin interface- Loadable
- Parameters:
- listener- the- LoadStatusChangedListenerto be added
 
 - 
removeLoadStatusChangedListenerpublic boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener) Description copied from interface:LoadableRemoves aLoadStatusChangedListenerfrom the loadable resource.- Specified by:
- removeLoadStatusChangedListenerin interface- Loadable
- Parameters:
- listener- the- LoadStatusChangedListenerto be removed
- Returns:
- true if the listener was removed, otherwise false
 
 
- 
 
-