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 UserGroup
addOwner(java.lang.String owner)
UserGroup
addSubgroup(java.lang.String subgroup)
UserGroup
addUser(java.lang.String user)
int
getMaxLockTime()
Get the maximum lock time for queries by members of this group.int
getMaxMemory()
Get Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.int
getMaxOpenFiles()
Get the maximum files that can be opened 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.java.lang.String
getName()
Get the group's name.java.util.List<java.lang.String>
getOwners()
Get a list of owner names for this group.int
getPasswordTimeout()
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.int
getTimeout()
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.boolean
isSubGroup()
Return true if this group is a sub group of another group on this server.static UserGroup
newUserGroup(java.lang.String name, java.util.List<java.lang.String> users)
Simple convenience factory method to return a new local UserGroup object.int
parseGroupIntValue(java.lang.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 maxLockTimeOfMilliSeconds)
Set the maximum lock time for queries by members of this group.void
setMaxMemory(int maxMemory)
Set Maximum amount of megabytes of random-access memory that a command can use when run by any member of the group.void
setMaxOpenFiles(int maxOpenFiles)
Set maximum files that can be opened 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(java.lang.String name)
Set the group's name.void
setOwners(java.util.List<java.lang.String> owners)
Deprecated.Please use methodaddOwner(String owner)
void
setPasswordTimeout(int passwordTimeoutOfSeconds)
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(java.util.List<java.lang.String> subgroups)
Deprecated.Please use methodaddSubgroup(String subgroup)
void
setTimeout(int timeoutOfSeconds)
Set the timeout value for commands by members of this group.void
setUsers(java.util.List<java.lang.String> users)
Deprecated.Please use methodaddUser(String user)
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, 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:IUserGroup
Set the list of user names for this group.- Specified by:
setUsers
in 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:IUserGroup
Get the maximum lock time for queries by members of this group.- Specified by:
getMaxLockTime
in interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- Parameters:
maxScanRows
- max rows
-
getName
public java.lang.String getName()
Description copied from interface:IUserGroup
Get the group's name.- Specified by:
getName
in interfaceIUserGroup
- Returns:
- name
-
setName
public void setName(java.lang.String name)
Description copied from interface:IUserGroup
Set the group's name.- Specified by:
setName
in interfaceIUserGroup
- Parameters:
name
- name
-
getOwners
public java.util.List<java.lang.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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- Parameters:
passwordTimeoutOfSeconds
- - seconds
-
getSubgroups
public java.util.List<java.lang.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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- Parameters:
timeoutOfSeconds
- - seconds
-
getUsers
public java.util.List<java.lang.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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIUserGroup
- 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 interfaceIServerResource
- Overrides:
refresh
in 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, 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 interfaceIServerResource
- Overrides:
update
in 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:IUserGroup
Set the list of known subgroups of this groups.- Specified by:
setSubgroups
in 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:IUserGroup
Set the list of owner names for this group.- Specified by:
setOwners
in 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)
-
-