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
  • Property Details

  • Constructor Details

    • PortalUser

      public PortalUser(Portal portal, String username)
      Constructor for use if you wish to fetch a particular user from a portal. Call loadAsync() 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 Details

    • fromJson

      public 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
    • toJson

      public String 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 interface JsonSerializable
      Returns:
      a JSON string
    • getUnknownJson

      public Map<String,Object> 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 interface JsonSerializable
      Returns:
      an unmodifiable Map containing unknown data from the source JSON
    • getUnsupportedJson

      public Map<String,Object> 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 interface JsonSerializable
      Returns:
      an unmodifiable Map containing unsupported data from the source JSON
    • getAccess

      public 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
    • availableCreditsProperty

      public ReadOnlyDoubleProperty 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 the availableCredits 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

      public List<String> 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

      public ReadOnlyStringProperty userIdProperty()
      The ID of the user.
      Returns:
      the userId property
      Since:
      200.4.0
      See Also:
    • getUserId

      public String getUserId()
      Gets the value of the userId property.
      Property description:
      The ID of the user.
      Returns:
      the value of the userId property
      Since:
      200.4.0
      See Also:
    • getCreated

      public 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
    • getEmail

      public String getEmail()
      Gets the email address of this user.
      Returns:
      the email address of this user
      Since:
      100.0.0
    • getFavoritesGroupId

      public 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
    • getFullName

      public String getFullName()
      Gets the full name of this user.
      Returns:
      the full name of this user
      Since:
      100.0.0
    • getGroups

      public 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 of LoadStatus.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

      public 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
    • getOrganizationId

      public 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
    • getPortal

      public Portal getPortal()
      Gets the portal this user belongs to.
      Returns:
      the portal this user belongs to
      Since:
      100.0.0
    • getPrivileges

      public 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
    • getRole

      public 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
    • getTags

      public 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
    • getThumbnailFileName

      public String getThumbnailFileName()
      Gets the filename of the thumbnail for this user.
      Returns:
      the filename of the thumbnail for this user
      Since:
      100.0.0
    • getUnits

      public 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
    • getUserDescription

      public String getUserDescription()
      Gets the description of this user.
      Returns:
      the description of this user
      Since:
      100.0.0
    • getUsername

      public String getUsername()
      Gets the username for this user.
      Returns:
      the username for this user
      Since:
      100.0.0
    • fetchThumbnailAsync

      public 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:
      Since:
      100.0.0
    • fetchContentAsync

      public 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:
      Since:
      100.0.0
    • fetchContentInFolderAsync

      public 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:
      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 be PortalItem.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:
      Throws:
      IllegalArgumentException - if portalItem or contentParameters is null; or if portalItem is insufficiently populated (title must be set).
      ArcGISRuntimeException - if the current LicenseLevel is too low for this operation (LicenseLevel.BASIC or higher is required to edit portal content)
      Since:
      100.0.0
    • deletePortalItemAsync

      public 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:
      Throws:
      IllegalArgumentException - if portalItem is null
      ArcGISRuntimeException - if the current LicenseLevel is too low for this operation (LicenseLevel.BASIC or higher is required to edit portal content)
      Since:
      100.0.0
    • createFolderAsync

      public 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:
      Throws:
      IllegalArgumentException - if title is null or empty
      ArcGISRuntimeException - if the current LicenseLevel is too low for this operation (LicenseLevel.BASIC or higher is required to edit portal content)
      Since:
      100.0.0
    • deleteFolderAsync

      public 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:
      Throws:
      IllegalArgumentException - if portalFolder is null
      ArcGISRuntimeException - if the current LicenseLevel 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 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:
      Throws:
      IllegalArgumentException - if portalItem is null
      ArcGISRuntimeException - if the current LicenseLevel 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 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:
      Throws:
      IllegalArgumentException - if portalItems is null or empty or includes a PortalItem that has no item ID
      ArcGISRuntimeException - if the current LicenseLevel is too low for this operation (LicenseLevel.BASIC or higher is required to edit portal content)
      Since:
      100.0.0
    • getLoadStatus

      public LoadStatus getLoadStatus()
      Gets the value of the loadStatus property.
      Specified by:
      getLoadStatus in interface Loadable
      Property description:
      Returns:
      the value of the loadStatus property
      See Also:
    • getLoadError

      public ArcGISRuntimeException getLoadError()
      Gets the value of the loadError property.
      Specified by:
      getLoadError in interface Loadable
      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 from LoadStatus.LOADING to LoadStatus.FAILED_TO_LOAD state. If the load operation was successfully cancelled, a CancellationException will be returned from Loadable.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 interface Loadable
    • 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 to LoadStatus.LOADING. A listener can be added via Loadable.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 calling Loadable.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) when loadAsync 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 or LoadStatus.FAILED_TO_LOAD state) when loadAsync 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 calling Loadable.cancelLoad().

      Specified by:
      loadAsync in interface Loadable
    • 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 interface Loadable
    • addDoneLoadingListener

      public void addDoneLoadingListener(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, add a listener to the Loadable.loadStatusProperty() instead.

      Specified by:
      addDoneLoadingListener in interface Loadable
      Parameters:
      listener - a Runnable that is invoked upon completion of the load operation
    • removeDoneLoadingListener

      public boolean removeDoneLoadingListener(Runnable listener)
      Description copied from interface: Loadable
      Removes a done loading listener from the loadable resource.
      Specified by:
      removeDoneLoadingListener in interface Loadable
      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 a LoadStatusChangedListener 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 interface Loadable
      Parameters:
      listener - the LoadStatusChangedListener to be added
    • removeLoadStatusChangedListener

      public boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
      Description copied from interface: Loadable
      Removes a LoadStatusChangedListener from the loadable resource.
      Specified by:
      removeLoadStatusChangedListener in interface Loadable
      Parameters:
      listener - the LoadStatusChangedListener to be removed
      Returns:
      true if the listener was removed, otherwise false
    • loadStatusProperty

      public ReadOnlyObjectProperty<LoadStatus> loadStatusProperty()
      Description copied from interface: Loadable
      The load status.
      Specified by:
      loadStatusProperty in interface Loadable
      Returns:
      the loadStatus property
      See Also:
    • loadErrorProperty

      public ReadOnlyObjectProperty<ArcGISRuntimeException> loadErrorProperty()
      Description copied from interface: Loadable
      The load error.
      Specified by:
      loadErrorProperty in interface Loadable
      Returns:
      the loadError property
      See Also: