com.ansys.ingress.client.api

## Interface AdministrationManager

-     public interface AdministrationManager

  AdministrationManager provides the interface to perform administrative operations on an EKM server. This includes managing users and groups (for users with administrative privileges), managing the user's recycle bin, and other miscellaneous operations.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSubgroups(java.util.List<java.lang.String> subgroups, java.lang.String group)` Adds subgroups to the specified group.
    `void` | `addUsersToGroup(java.util.List<java.lang.String> users, java.lang.String group)` Adds the users in the list to the specified group.
    `boolean` | `belongsTo(java.lang.String member, java.lang.String group)` Determines if the member (a user or group) belongs to the specified group.
    `void` | `clearRecycleBin()` Clears the current user's recycle bin on the EKM server.
    `ModelObject` | `createGroup(java.lang.String group)` Creates a new group.
    `ModelObject` | `createUser(java.lang.String user)` Creates a new user account on the EKM server.
    `ModelObject` | `createUser(java.lang.String user, java.lang.String jobExecUser, java.lang.String jobExecPw)` Creates a new user account on the EKM server and sets the job execution username and password.
    `boolean` | `deleteMember(java.lang.String member)` Deletes a user or group.
    `void` | `executeScript(java.lang.String script)` For a user with appropriate privileges, executes the given Python code on the server.
    `java.lang.Object` | `executeScript(java.lang.String script, java.lang.String language, java.lang.String resultVariable, java.lang.String resultType)` For a user with appropriate privileges, executes the given script code on the server and returns the results.
    `ModelObject` | `findGroup(java.lang.String group)` Searches the groups defined in EKM for the one with the given name.
    `ModelObject` | `findUser(java.lang.String user)` Searches the user accounts defined in EKM for the user with the specified name.
    `java.lang.String` | `getCurrentUsersUnitSystem()` Gets the current unit system being used by this user on the EKM server.
    `java.lang.String` | `getPreference(java.lang.String key)` Gets a user's preference value.
    `java.util.Map<java.lang.String,java.lang.String>` | `getPreferences()` Gets all of a user's preferences.
    `java.util.Date` | `getServerTime()` Retrieves the date and time from the server.
    `void` | `removeSubgroups(java.util.List<java.lang.String> subgroups, java.lang.String group)` Removes subgroups from a group.
    `void` | `removeUsersFromGroup(java.util.List<java.lang.String> users, java.lang.String group)` Removes users from a group.
    `void` | `restoreRecycleBin(java.util.List<java.lang.String> idsToRestore)` Restores the data in the user's recycle bin on the EKM server to its original locations.
    `void` | `setPreference(java.lang.String key, java.lang.String value)` Sets a user preference.
    `void` | `setPreferences(java.util.Map<java.lang.String,java.lang.String> preferences)` Sets a user's preferences.

- - ### Method Detail

    - #### addSubgroups

          void addSubgroups(java.util.List<java.lang.String> subgroups,
                            java.lang.String group)
                     throws AdministrationException

      Adds subgroups to the specified group. If a subgroup in the list does not exist, it is ignored.
      Parameters:
        `subgroups` - The list of subgroups
        `group` - The name of the group to which subgroups are added
      Throws:
        `AdministrationException` - if the subgroups could not be added to the group.

    - #### addUsersToGroup

          void addUsersToGroup(java.util.List<java.lang.String> users,
                               java.lang.String group)
                        throws AdministrationException

      Adds the users in the list to the specified group. If a user in the list does not exist, it is ignored.
      Parameters:
        `users` - The users to add
        `group` - The name of the groupd to which users are added
      Throws:
        `AdministrationException` - if the users could not be added to the group.

    - #### belongsTo

          boolean belongsTo(java.lang.String member,
                            java.lang.String group)

      Determines if the member (a user or group) belongs to the specified group.
      Parameters:
        `member` - The name of the user or subgroup to check
        `group` - The name of the group to check
      Returns:
        Returns true if the member belongs to the group.

    - #### clearRecycleBin

          void clearRecycleBin()
                        throws ConnectionException

      Clears the current user's recycle bin on the EKM server.
      Throws:
        `ConnectionException` - if the connection associated with the administration interface is not open.

    - #### createGroup

          ModelObject createGroup(java.lang.String group)
                           throws AdministrationException

      Creates a new group.
      Parameters:
        `group` - the name of the new group
      Returns:
        Returns the new group.
      Throws:
        `AdministrationException` - if the groupd could not be created.

    - #### createUser

          ModelObject createUser(java.lang.String user)
                          throws AdministrationException

      Creates a new user account on the EKM server.
      Parameters:
        `user` - the name of the new user to create
      Returns:
        Returns the newly created user.
      Throws:
        `AdministrationException` - if the user could not be created.

    - #### createUser

          ModelObject createUser(java.lang.String user,
                                 java.lang.String jobExecUser,
                                 java.lang.String jobExecPw)
                          throws AdministrationException

      Creates a new user account on the EKM server and sets the job execution username and password.
      Parameters:
        `user` - the user to create
        `jobExecUser` - the username used when executing a job. If null, defaults to user.
        `jobExecPw` - the password used when exeucting a job. If null, defaults to the user's password.
      Returns:
        Returns the newly created user.
      Throws:
        `AdministrationException` - if the user could not be created.

    - #### deleteMember

          boolean deleteMember(java.lang.String member)
                        throws AdministrationException

      Deletes a user or group.
      Parameters:
        `member` - the name of the member to delete.
      Returns:
        Returns true if the member was deleted and false if the member does not exist.
      Throws:
        `AdministrationException` - if the member could not be deleted due to a permissions error.

    - #### executeScript

          void executeScript(java.lang.String script)
                      throws AdministrationException

      For a user with appropriate privileges, executes the given Python code on the server. For example, executeScript("print 1 + 1") will execute that code on the server.
      Parameters:
        `script` - the Python code to execute. This is not a path to a script on the server.
      Throws:
        `AdministrationException` - if an error occurs executing the script.

    - #### executeScript

          java.lang.Object executeScript(java.lang.String script,
                                         java.lang.String language,
                                         java.lang.String resultVariable,
                                         java.lang.String resultType)
                                  throws AdministrationException

      For a user with appropriate privileges, executes the given script code on the server and returns the results. For example:

      `executeScript("a = 1 + 1", "py", "a", "text/plain")`

      will execute that code on the server and return the value of "a" as a string.
      Parameters:
        `script` - the script to execute
        `language` - the language in which the script is written
        `resultVariable` - the name of the variable within the script that contains the result to be returned
        `resultType` - the media type of the result, e.g. text/plain, application/json
      Returns:
        Returns the results of the script.
      Throws:
        `AdministrationException` - if an error occurs executing the script.

    - #### findGroup

          ModelObject findGroup(java.lang.String group)
                         throws AdministrationException

      Searches the groups defined in EKM for the one with the given name.
      Parameters:
        `group` - the name of the group to search for
      Returns:
        Returns the group or null if it was not found.
      Throws:
        `AdministrationException` - if an error occurs executing the search.

    - #### findUser

          ModelObject findUser(java.lang.String user)
                        throws AdministrationException

      Searches the user accounts defined in EKM for the user with the specified name.
      Parameters:
        `user` - the user to search for
      Returns:
        Returns the user or null if the user does not exist.
      Throws:
        `AdministrationException` - if an error occurs executing the search.

    - #### getCurrentUsersUnitSystem

          java.lang.String getCurrentUsersUnitSystem()
                                              throws ConnectionException

      Gets the current unit system being used by this user on the EKM server.
      Returns:
        Returns the current unit system (e.g. SI).
      Throws:
        `ConnectionException` - if the connection associated with this administration interface is not open.

    - #### getPreference

          java.lang.String getPreference(java.lang.String key)
                                  throws AdministrationException

      Gets a user's preference value.
      Parameters:
        `key` - the prefernce to get
      Returns:
        Returns the value which will be empty if the preference is not set or does not exist.
      Throws:
        `AdministrationException` - if the preference could not be retrieved.

    - #### getPreferences

          java.util.Map<java.lang.String,java.lang.String> getPreferences()
                                                                   throws AdministrationException

      Gets all of a user's preferences.
      Returns:
        Returns the map of the user's preferences.
      Throws:
        `AdministrationException` - if the preferences could not be retrieved.

    - #### getServerTime

          java.util.Date getServerTime()
                                throws ConnectionException

      Retrieves the date and time from the server.
      Returns:
        Returns the current date and time of the server.
      Throws:
        `ConnectionException` - if the connection associated with this administration interface is not open.

    - #### removeSubgroups

          void removeSubgroups(java.util.List<java.lang.String> subgroups,
                               java.lang.String group)
                        throws AdministrationException

      Removes subgroups from a group. If a subgroup specified in the list of subgroups does not exist, it is ignored.
      Parameters:
        `subgroups` - the subgroups to remove
        `group` - the group
      Throws:
        `AdministrationException` - if an error occurs removing the subgroups from the group.

    - #### removeUsersFromGroup

          void removeUsersFromGroup(java.util.List<java.lang.String> users,
                                    java.lang.String group)
                             throws AdministrationException

      Removes users from a group. If a user specified in the list of users does not exist, it is ignored.
      Parameters:
        `users` - the users to remove
        `group` - the group
      Throws:
        `AdministrationException` - if an error occurs removing the users from the group.

    - #### restoreRecycleBin

          void restoreRecycleBin(java.util.List<java.lang.String> idsToRestore)
                          throws AdministrationException

      Restores the data in the user's recycle bin on the EKM server to its original locations.
      Parameters:
        `idsToRestore` - The IDs of the objects in the recycle bin to be restored.
      Throws:
        `AdministrationException` - if the objects could not be restored.

    - #### setPreference

          void setPreference(java.lang.String key,
                             java.lang.String value)
                      throws AdministrationException

      Sets a user preference.
      Parameters:
        `key` - the preference to set
        `value` - the value for the preference.
      Throws:
        `AdministrationException` - if a user is not currently logged in.

    - #### setPreferences

          void setPreferences(java.util.Map<java.lang.String,java.lang.String> preferences)
                       throws AdministrationException

      Sets a user's preferences.
      Parameters:
        `preferences` - the preferences to set
      Throws:
        `AdministrationException` - if a user is not currently logged in.