Class UserGroup

java.lang.Object
com.perforce.p4java.impl.generic.core.ServerResource
com.perforce.p4java.impl.generic.core.UserGroup
All Implemented Interfaces:
IServerResource, IUserGroup

public class UserGroup extends ServerResource implements IUserGroup
Simple generic implementation class for the IUserGroup interface.
  • Constructor Details

    • UserGroup

      public UserGroup()
      Default constructor. Sets all fields to null, UNSET, or false. Sets superclass IServerResource fields complete, completeable, refereable and updateable to true.
    • UserGroup

      public UserGroup(@Nullable Map<String,Object> map)
      Construct a new user group impl from the passed-in map. Note that this map must come from the Perforce "group" command or exact equivalent; using a map passed back by (e.g.) the Perforce "groups" (note the plural) command will fail due to the way the Perforce server returns group lists rather than individual groups. Calling this with a null map argument is equivalent to calling the default constructor.

      Sets superclass IServerResource fields complete, completeable, refereable and updateable to true.

      Parameters:
      map - spec map
  • Method Details

    • newUserGroup

      public static UserGroup newUserGroup(@Nonnull String name, @Nonnull List<String> users)
      Simple convenience factory method to return a new local UserGroup object.

      All fields not passed as parameters here default to the defaults applied by the associated default UserGroup constructor.

      Parameters:
      name - non-null name for the UserGroup.
      users - possibly-null list of users to be associated with the group.
      Returns:
      new user group.
    • setUsers

      public void setUsers(List<String> users)
      Deprecated.
      Please use method addUser(String user)
      Description copied from interface: IUserGroup
      Set the list of user names for this group.
      Specified by:
      setUsers in interface IUserGroup
      Parameters:
      users - users
    • parseGroupIntValue

      public int parseGroupIntValue(String str)
      Parse a Perforce server-side string representing a user group integer value (such as timeout). Copes with "unset" and "unlimited" properly.
      Parameters:
      str - string
      Returns:
      value
    • getMaxLockTime

      public int getMaxLockTime()
      Description copied from interface: IUserGroup
      Get the maximum lock time for queries by members of this group.
      Specified by:
      getMaxLockTime in interface IUserGroup
      Returns:
      max lock time - milliseconds
    • setMaxLockTime

      public void setMaxLockTime(int maxLockTimeOfMilliSeconds)
      Description copied from interface: IUserGroup
      Set the maximum lock time for queries by members of this group.
      Specified by:
      setMaxLockTime in interface IUserGroup
      Parameters:
      maxLockTimeOfMilliSeconds - - milliseconds
    • getMaxResults

      public int getMaxResults()
      Description copied from interface: IUserGroup
      Get the maximum number of results returned for queries by members of this group.
      Specified by:
      getMaxResults in interface IUserGroup
      Returns:
      max results
    • setMaxResults

      public void setMaxResults(int maxResults)
      Description copied from interface: IUserGroup
      Set the maximum number of results returned for queries by members of this group.
      Specified by:
      setMaxResults in interface IUserGroup
      Parameters:
      maxResults - max results
    • getMaxScanRows

      public int getMaxScanRows()
      Description copied from interface: IUserGroup
      Get the maximum number of scan rows returned for queries by members of this group.
      Specified by:
      getMaxScanRows in interface IUserGroup
      Returns:
      max rows
    • setMaxScanRows

      public void setMaxScanRows(int maxScanRows)
      Description copied from interface: IUserGroup
      Set the maximum number of scan rows returned for queries by members of this group.
      Specified by:
      setMaxScanRows in interface IUserGroup
      Parameters:
      maxScanRows - max rows
    • getName

      public String getName()
      Description copied from interface: IUserGroup
      Get the group's name.
      Specified by:
      getName in interface IUserGroup
      Returns:
      name
    • setName

      public void setName(String name)
      Description copied from interface: IUserGroup
      Set the group's name.
      Specified by:
      setName in interface IUserGroup
      Parameters:
      name - name
    • getOwners

      public List<String> getOwners()
      Description copied from interface: IUserGroup
      Get a list of owner names for this group. Will be null or empty if this group has no owners.
      Specified by:
      getOwners in interface IUserGroup
      Returns:
      owners
    • getPasswordTimeout

      public int getPasswordTimeout()
      Description copied from interface: IUserGroup
      Get the password timeout value associated with this user group.
      Specified by:
      getPasswordTimeout in interface IUserGroup
      Returns:
      max password time out - seconds
    • setPasswordTimeout

      public void setPasswordTimeout(int passwordTimeoutOfSeconds)
      Description copied from interface: IUserGroup
      Set the password timeout value associated with this user group.
      Specified by:
      setPasswordTimeout in interface IUserGroup
      Parameters:
      passwordTimeoutOfSeconds - - seconds
    • getSubgroups

      public List<String> getSubgroups()
      Description copied from interface: IUserGroup
      Get the list of known subgroups of this groups. Will be null or empty if no subgroups exist or if this user group object was returned from the IServer getUserGroupList method.
      Specified by:
      getSubgroups in interface IUserGroup
      Returns:
      subgroups
    • getTimeout

      public int getTimeout()
      Description copied from interface: IUserGroup
      Get the timeout value for commands by members of this group.
      Specified by:
      getTimeout in interface IUserGroup
      Returns:
      seconds
    • setTimeout

      public void setTimeout(int timeoutOfSeconds)
      Description copied from interface: IUserGroup
      Set the timeout value for commands by members of this group.
      Specified by:
      setTimeout in interface IUserGroup
      Parameters:
      timeoutOfSeconds - - seconds
    • getUsers

      public List<String> getUsers()
      Description copied from interface: IUserGroup
      Get a list of user names for this group. Will be null or empty if this group has no users.
      Specified by:
      getUsers in interface IUserGroup
      Returns:
      list of users
    • isSubGroup

      public boolean isSubGroup()
      Description copied from interface: IUserGroup
      Return true if this group is a sub group of another group on this server.

      Note that this method will always return false on an IUserGroup object retrieved from the IServer.getUserGroup() method (this is a restriction imposed by the Perforce server).

      Specified by:
      isSubGroup in interface IUserGroup
      Returns:
      if true
    • setSubGroup

      public void setSubGroup(boolean subGroup)
      Description copied from interface: IUserGroup
      Set whether this group is a sub group of another group on this server.
      Specified by:
      setSubGroup in interface IUserGroup
      Parameters:
      subGroup - sub group
    • getMaxOpenFiles

      public int getMaxOpenFiles()
      Description copied from interface: IUserGroup
      Get the maximum files that can be opened by members of this group.
      Specified by:
      getMaxOpenFiles in interface IUserGroup
      Returns:
      max open files
    • setMaxOpenFiles

      public void setMaxOpenFiles(int maxOpenFiles)
      Description copied from interface: IUserGroup
      Set maximum files that can be opened by members of this group.
      Specified by:
      setMaxOpenFiles in interface IUserGroup
      Parameters:
      maxOpenFiles - max open files
    • getMaxMemory

      public int getMaxMemory()
      Description copied from interface: IUserGroup
      Get Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.
      Specified by:
      getMaxMemory in interface IUserGroup
      Returns:
      amount of memory in MB
    • setMaxMemory

      public void setMaxMemory(int maxMemory)
      Description copied from interface: IUserGroup
      Set Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.
      Specified by:
      setMaxMemory in interface IUserGroup
      Parameters:
      maxMemory - - in MB
    • refresh

      public void refresh() throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServerResource
      Refresh the underlying object from the Perforce server.

      The details of what "refreshable" means in this context are always object-dependent, but typically mean that "live" data and metadata will be updated from the server.

      The results of calling this method on objects whose canRefresh method returns false are undefined (but will generally result in a UnimplementedError being thrown).

      Specified by:
      refresh in interface IServerResource
      Overrides:
      refresh in class ServerResource
      Throws:
      ConnectionException - if the Perforce server is unreachable or is not connected.
      RequestException - if the Perforce server encounters an error during its processing of the request
      AccessException - if the Perforce server denies access to the caller
      See Also:
    • update

      public void update() throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServerResource
      Update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.

      The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).

      Specified by:
      update in interface IServerResource
      Overrides:
      update in class ServerResource
      Throws:
      ConnectionException - if the Perforce server is unreachable or is not connected.
      RequestException - if the Perforce server encounters an error during its processing of the request
      AccessException - if the Perforce server denies access to the caller
      See Also:
    • setSubgroups

      public void setSubgroups(List<String> subgroups)
      Deprecated.
      Please use method addSubgroup(String subgroup)
      Description copied from interface: IUserGroup
      Set the list of known subgroups of this groups.
      Specified by:
      setSubgroups in interface IUserGroup
      Parameters:
      subgroups - list of subgroups
    • setOwners

      public void setOwners(List<String> owners)
      Deprecated.
      Please use method addOwner(String owner)
      Description copied from interface: IUserGroup
      Set the list of owner names for this group.
      Specified by:
      setOwners in interface IUserGroup
      Parameters:
      owners - list of owners
    • addOwner

      public UserGroup addOwner(String owner)
    • addSubgroup

      public UserGroup addSubgroup(String subgroup)
    • addUser

      public UserGroup addUser(String user)