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.
-
-
Field Summary
-
Fields inherited from class com.perforce.p4java.impl.generic.core.ServerResource
refreshable, server, updateable
-
Fields inherited from interface com.perforce.p4java.core.IUserGroup
UNDEFINED, UNLIMITED, UNSET
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description UserGroupaddOwner(java.lang.String owner)UserGroupaddSubgroup(java.lang.String subgroup)UserGroupaddUser(java.lang.String user)intgetMaxLockTime()Get the maximum lock time for queries by members of this group.intgetMaxMemory()Get Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.intgetMaxOpenFiles()Get the maximum files that can be opened by members of this group.intgetMaxResults()Get the maximum number of results returned for queries by members of this group.intgetMaxScanRows()Get the maximum number of scan rows returned for queries by members of this group.java.lang.StringgetName()Get the group's name.java.util.List<java.lang.String>getOwners()Get a list of owner names for this group.intgetPasswordTimeout()Get the password timeout value associated with this user group.java.util.List<java.lang.String>getSubgroups()Get the list of known subgroups of this groups.intgetTimeout()Get the timeout value for commands by members of this group.java.util.List<java.lang.String>getUsers()Get a list of user names for this group.booleanisSubGroup()Return true if this group is a sub group of another group on this server.static UserGroupnewUserGroup(java.lang.String name, java.util.List<java.lang.String> users)Simple convenience factory method to return a new local UserGroup object.intparseGroupIntValue(java.lang.String str)Parse a Perforce server-side string representing a user group integer value (such as timeout).voidrefresh()Refresh the underlying object from the Perforce server.voidsetMaxLockTime(int maxLockTimeOfMilliSeconds)Set the maximum lock time for queries by members of this group.voidsetMaxMemory(int maxMemory)Set Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.voidsetMaxOpenFiles(int maxOpenFiles)Set maximum files that can be opened by members of this group.voidsetMaxResults(int maxResults)Set the maximum number of results returned for queries by members of this group.voidsetMaxScanRows(int maxScanRows)Set the maximum number of scan rows returned for queries by members of this group.voidsetName(java.lang.String name)Set the group's name.voidsetOwners(java.util.List<java.lang.String> owners)Deprecated.Please use methodaddOwner(String owner)voidsetPasswordTimeout(int passwordTimeoutOfSeconds)Set the password timeout value associated with this user group.voidsetSubGroup(boolean subGroup)Set whether this group is a sub group of another group on this server.voidsetSubgroups(java.util.List<java.lang.String> subgroups)Deprecated.Please use methodaddSubgroup(String subgroup)voidsetTimeout(int timeoutOfSeconds)Set the timeout value for commands by members of this group.voidsetUsers(java.util.List<java.lang.String> users)Deprecated.Please use methodaddUser(String user)voidupdate()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, clearRawFields, complete, getRawField, getRawFields, hasRawField, parseDate, setRawField, setRawFields, setRefreshable, setServer, toDateString, 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, clearRawFields, complete, getRawField, getRawFields, hasRawField, setRawField, setRawFields, setServer, update, update
-
-
-
-
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(@Nullable java.util.Map<java.lang.String,java.lang.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 Detail
-
newUserGroup
public static UserGroup newUserGroup(@Nonnull java.lang.String name, @Nonnull java.util.List<java.lang.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(java.util.List<java.lang.String> users)
Deprecated.Please use methodaddUser(String user)Description copied from interface:IUserGroupSet the list of user names for this group.- Specified by:
setUsersin interfaceIUserGroup- Parameters:
users- users
-
parseGroupIntValue
public int parseGroupIntValue(java.lang.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:IUserGroupGet the maximum lock time for queries by members of this group.- Specified by:
getMaxLockTimein interfaceIUserGroup- Returns:
- max lock time - milliseconds
-
setMaxLockTime
public void setMaxLockTime(int maxLockTimeOfMilliSeconds)
Description copied from interface:IUserGroupSet the maximum lock time for queries by members of this group.- Specified by:
setMaxLockTimein interfaceIUserGroup- Parameters:
maxLockTimeOfMilliSeconds- - milliseconds
-
getMaxResults
public int getMaxResults()
Description copied from interface:IUserGroupGet the maximum number of results returned for queries by members of this group.- Specified by:
getMaxResultsin interfaceIUserGroup- Returns:
- max results
-
setMaxResults
public void setMaxResults(int maxResults)
Description copied from interface:IUserGroupSet the maximum number of results returned for queries by members of this group.- Specified by:
setMaxResultsin interfaceIUserGroup- Parameters:
maxResults- max results
-
getMaxScanRows
public int getMaxScanRows()
Description copied from interface:IUserGroupGet the maximum number of scan rows returned for queries by members of this group.- Specified by:
getMaxScanRowsin interfaceIUserGroup- Returns:
- max rows
-
setMaxScanRows
public void setMaxScanRows(int maxScanRows)
Description copied from interface:IUserGroupSet the maximum number of scan rows returned for queries by members of this group.- Specified by:
setMaxScanRowsin interfaceIUserGroup- Parameters:
maxScanRows- max rows
-
getName
public java.lang.String getName()
Description copied from interface:IUserGroupGet the group's name.- Specified by:
getNamein interfaceIUserGroup- Returns:
- name
-
setName
public void setName(java.lang.String name)
Description copied from interface:IUserGroupSet the group's name.- Specified by:
setNamein interfaceIUserGroup- Parameters:
name- name
-
getOwners
public java.util.List<java.lang.String> getOwners()
Description copied from interface:IUserGroupGet a list of owner names for this group. Will be null or empty if this group has no owners.- Specified by:
getOwnersin interfaceIUserGroup- Returns:
- owners
-
getPasswordTimeout
public int getPasswordTimeout()
Description copied from interface:IUserGroupGet the password timeout value associated with this user group.- Specified by:
getPasswordTimeoutin interfaceIUserGroup- Returns:
- max password time out - seconds
-
setPasswordTimeout
public void setPasswordTimeout(int passwordTimeoutOfSeconds)
Description copied from interface:IUserGroupSet the password timeout value associated with this user group.- Specified by:
setPasswordTimeoutin interfaceIUserGroup- Parameters:
passwordTimeoutOfSeconds- - seconds
-
getSubgroups
public java.util.List<java.lang.String> getSubgroups()
Description copied from interface:IUserGroupGet 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:
getSubgroupsin interfaceIUserGroup- Returns:
- subgroups
-
getTimeout
public int getTimeout()
Description copied from interface:IUserGroupGet the timeout value for commands by members of this group.- Specified by:
getTimeoutin interfaceIUserGroup- Returns:
- seconds
-
setTimeout
public void setTimeout(int timeoutOfSeconds)
Description copied from interface:IUserGroupSet the timeout value for commands by members of this group.- Specified by:
setTimeoutin interfaceIUserGroup- Parameters:
timeoutOfSeconds- - seconds
-
getUsers
public java.util.List<java.lang.String> getUsers()
Description copied from interface:IUserGroupGet a list of user names for this group. Will be null or empty if this group has no users.- Specified by:
getUsersin interfaceIUserGroup- Returns:
- list of users
-
isSubGroup
public boolean isSubGroup()
Description copied from interface:IUserGroupReturn 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:
isSubGroupin interfaceIUserGroup- Returns:
- if true
-
setSubGroup
public void setSubGroup(boolean subGroup)
Description copied from interface:IUserGroupSet whether this group is a sub group of another group on this server.- Specified by:
setSubGroupin interfaceIUserGroup- Parameters:
subGroup- sub group
-
getMaxOpenFiles
public int getMaxOpenFiles()
Description copied from interface:IUserGroupGet the maximum files that can be opened by members of this group.- Specified by:
getMaxOpenFilesin interfaceIUserGroup- Returns:
- max open files
-
setMaxOpenFiles
public void setMaxOpenFiles(int maxOpenFiles)
Description copied from interface:IUserGroupSet maximum files that can be opened by members of this group.- Specified by:
setMaxOpenFilesin interfaceIUserGroup- Parameters:
maxOpenFiles- max open files
-
getMaxMemory
public int getMaxMemory()
Description copied from interface:IUserGroupGet Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.- Specified by:
getMaxMemoryin interfaceIUserGroup- Returns:
- amount of memory in MB
-
setMaxMemory
public void setMaxMemory(int maxMemory)
Description copied from interface:IUserGroupSet Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.- Specified by:
setMaxMemoryin interfaceIUserGroup- Parameters:
maxMemory- - in MB
-
refresh
public void refresh() throws ConnectionException, RequestException, AccessExceptionDescription copied from interface:IServerResourceRefresh 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:
refreshin interfaceIServerResource- Overrides:
refreshin classServerResource- 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 requestAccessException- if the Perforce server denies access to the caller- See Also:
IServerResource.refresh()
-
update
public void update() throws ConnectionException, RequestException, AccessExceptionDescription copied from interface:IServerResourceUpdate 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:
updatein interfaceIServerResource- Overrides:
updatein classServerResource- 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 requestAccessException- if the Perforce server denies access to the caller- See Also:
IServerResource.update()
-
setSubgroups
public void setSubgroups(java.util.List<java.lang.String> subgroups)
Deprecated.Please use methodaddSubgroup(String subgroup)Description copied from interface:IUserGroupSet the list of known subgroups of this groups.- Specified by:
setSubgroupsin interfaceIUserGroup- Parameters:
subgroups- list of subgroups
-
setOwners
public void setOwners(java.util.List<java.lang.String> owners)
Deprecated.Please use methodaddOwner(String owner)Description copied from interface:IUserGroupSet the list of owner names for this group.- Specified by:
setOwnersin interfaceIUserGroup- Parameters:
owners- list of owners
-
addOwner
public UserGroup addOwner(java.lang.String owner)
-
addSubgroup
public UserGroup addSubgroup(java.lang.String subgroup)
-
addUser
public UserGroup addUser(java.lang.String user)
-
-