com.perforce.p4java.impl.generic.core
Class UserGroup

java.lang.Object
  extended by com.perforce.p4java.impl.generic.core.ServerResource
      extended by 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.


Field Summary
static String UNLIMITED_STR
          How the Perforce server represents an unlimited group value as a string.
static String UNSET_STR
          How the Perforce server represents an unset group value as a string.
 
Fields inherited from class com.perforce.p4java.impl.generic.core.ServerResource
refreshable, server, updateable
 
Fields inherited from interface com.perforce.p4java.core.IUserGroup
UNLIMITED, UNSET
 
Constructor Summary
UserGroup()
          Default constructor.
UserGroup(Map<String,Object> map)
          Construct a new user group impl from the passed-in map.
 
Method Summary
 int getMaxLockTime()
          Get the maximum lock time for queries by members of this group.
 int getMaxResults()
          Get the maximum number of results returned for queries by members of this group.
 int getMaxScanRows()
          Get the maximum number of scan rows returned for queries by members of this group.
 String getName()
          Get the group's name.
 List<String> getOwners()
          Get a list of owner names for this group.
 int getPasswordTimeout()
          Get the password timeout value associated with this user group.
 List<String> getSubgroups()
          Get the list of known subgroups of this groups.
 int getTimeout()
          Get the timeout value for commands by members of this group.
 List<String> getUsers()
          Get a list of user names for this group.
 boolean isSubGroup()
          Return true if this group is a sub group of another group on this server.
static UserGroup newUserGroup(String name, List<String> users)
          Simple convenience factory method to return a new local UserGroup object.
 int parseGroupIntValue(String str)
          Parse a Perforce server-side string representing a user group integer value (such as timeout).
 void refresh()
          Refresh the underlying object from the Perforce server.
 void setMaxLockTime(int maxLockTime)
          Set the maximum lock time for queries by members of this group.
 void setMaxResults(int maxResults)
          Set the maximum number of results returned for queries by members of this group.
 void setMaxScanRows(int maxScanRows)
          Set the maximum number of scan rows returned for queries by members of this group.
 void setName(String name)
          Set the group's name.
 void setOwners(List<String> owners)
          Set the list of owner names for this group.
 void setPasswordTimeout(int passwordTimeout)
          Set the password timeout value associated with this user group.
 void setSubGroup(boolean subGroup)
          Set whether this group is a sub group of another group on this server.
 void setSubgroups(List<String> subgroups)
          Set the list of known subgroups of this groups.
 void setTimeout(int timeout)
          Set the timeout value for commands by members of this group.
 void setUsers(List<String> users)
          Set the list of user names for this group.
 void update()
          Update the Perforce server object associated with the underlying P4Java object, if possible.
 
Methods inherited from class com.perforce.p4java.impl.generic.core.ServerResource
canRefresh, canUpdate, complete, setRefreshable, setServer, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.perforce.p4java.core.IServerResource
canRefresh, canUpdate, setServer, update, update
 

Field Detail

UNSET_STR

public static final String UNSET_STR
How the Perforce server represents an unset group value as a string.

See Also:
Constant Field Values

UNLIMITED_STR

public static final String UNLIMITED_STR
How the Perforce server represents an unlimited group value as a string.

See Also:
Constant Field Values
Constructor Detail

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(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.

Method Detail

newUserGroup

public static UserGroup newUserGroup(String name,
                                     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.

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
See Also:
IUserGroup.getMaxLockTime()

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
See Also:
IUserGroup.getMaxResults()

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
See Also:
IUserGroup.getMaxScanRows()

getName

public String getName()
Description copied from interface: IUserGroup
Get the group's name.

Specified by:
getName in interface IUserGroup
See Also:
IUserGroup.getName()

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
See Also:
IUserGroup.getOwners()

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
See Also:
IUserGroup.getSubgroups()

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
See Also:
IUserGroup.getTimeout()

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
See Also:
IUserGroup.getUsers()

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
See Also:
IUserGroup.isSubGroup()

setName

public void setName(String name)
Description copied from interface: IUserGroup
Set the group's name.

Specified by:
setName in interface IUserGroup

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

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

setMaxLockTime

public void setMaxLockTime(int maxLockTime)
Description copied from interface: IUserGroup
Set the maximum lock time for queries by members of this group.

Specified by:
setMaxLockTime in interface IUserGroup

setTimeout

public void setTimeout(int timeout)
Description copied from interface: IUserGroup
Set the timeout value for commands by members of this group.

Specified by:
setTimeout in interface IUserGroup

setSubgroups

public void setSubgroups(List<String> subgroups)
Description copied from interface: IUserGroup
Set the list of known subgroups of this groups.

Specified by:
setSubgroups in interface IUserGroup

setOwners

public void setOwners(List<String> owners)
Description copied from interface: IUserGroup
Set the list of owner names for this group.

Specified by:
setOwners in interface IUserGroup

setUsers

public void setUsers(List<String> users)
Description copied from interface: IUserGroup
Set the list of user names for this group.

Specified by:
setUsers in interface IUserGroup

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

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.


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:
ServerResource.refresh()

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:
ServerResource.update()

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
See Also:
IUserGroup.getPasswordTimeout()

setPasswordTimeout

public void setPasswordTimeout(int passwordTimeout)
Description copied from interface: IUserGroup
Set the password timeout value associated with this user group.

Specified by:
setPasswordTimeout in interface IUserGroup
See Also:
IUserGroup.setPasswordTimeout(int)


Copyright © 2015 Perforce Software. All Rights Reserved.