public class CSUserGroup extends CSItem
The CSUserGroup
class includes methods for the retrieval, update, and removal of a particular user
group. It also provides a method that checks for the existence of a user group. All such methods require that certain
database and key information (group ID, for example) be specified via the set
methods provided, prior
to their invocation.
All database access/connectivity is handled internally by the CSUserGroup
class.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TYPE_GROUP
A valid member type to be used by the
setMemberType method. |
static java.lang.String |
TYPE_USER
A valid member type to be used by the
setMemberType method. |
ACCESS_GRANTED, DOES_NOT_EXIST, EMPTY, EXISTS, SECURE_ACCESS_DENIED, SECURE_ACCESS_GRANTED, UPDATE_ACTION_INSERTED, UPDATE_ACTION_UPDATED
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSUserGroup()
Creates an empty
CSUserGroup object. |
CSUserGroup(java.lang.String strPropertyFile)
Creates an empty
CSUserGroup object, specifying a property file that contains all of the database
connection details. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Removes a user group from the database.
|
boolean |
exist()
Checks to see whether a user group exists on the database.
|
void |
get()
Retrieves the details of a user group from the database.
|
java.lang.String |
getDescription()
Gets the user group's description.
|
int |
getGroupID()
Gets the ID of the user group.
|
java.lang.String |
getGroupName()
Gets the name of the user group.
|
int |
getMemberID()
Gets the member ID currently specified as key information.
|
java.lang.String |
getMemberList()
Gets the list of member IDs currently specified as key information.
|
java.lang.String |
getMemberType()
Gets the type of members supplied via the
setMemberList method. |
void |
setDescription(java.lang.String strDescription)
Sets the description for the user group.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setGroupID(int nGroupID)
Sets the ID of the user group.
|
void |
setGroupName(java.lang.String strGroupName)
Sets the name of the user group.
|
void |
setMemberID(int nMemberID)
Sets the member ID to be used as key information.
|
void |
setMemberList(java.lang.String strMemberList)
Specifies a list of member (either user or group) IDs to be used as key information.
|
void |
setMemberType(java.lang.String strMemberType)
Specifies the type of member(s) supplied via the
setMemberList or
setMemberID method. |
java.lang.String |
toString()
Outputs the contents of this
CSUserGroup object to a String object in a
user-friendly format. |
void |
update()
Updates a user group on the database.
|
equals, getID, getStatus, hashCode, jsonString, serialiseWithTypes, setID, setStatus, unset
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public static java.lang.String TYPE_USER
setMemberType
method. Specify this to
indicate that the IDs supplied via the setMemberList
method are for users.public static java.lang.String TYPE_GROUP
setMemberType
method. Specify this to
indicate that the IDs supplied via the setMemberList
method are for groups.public CSUserGroup()
CSUserGroup
object.
Use the various set methods provided to initialise the CSUserGroup
object prior to invoking any of
its query methods.
public CSUserGroup(java.lang.String strPropertyFile)
CSUserGroup
object, specifying a property file that contains all of the database
connection details.
Use the various set methods provided to initialise the CSUserGroup
object prior to invoking any of
its query methods.
strPropertyFile
- the name of the property file from which the database connection details are to be read.public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method.
Valid detail levels for a user group are :
LEVEL_ID - the user group ID
.
LEVEL_ALL - the user group name and description
.
Each detail level processes the information specified alongside it in addition to the information specified for all detail levels listed above it. The default detail level is LEVEL_ALL.
setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public void setMemberID(int nMemberID)
setMemberID
followed by a call to exist
will determine whether that user/group is
a member of this CSUserGroup
. Use setMemberType
to indicate
whether the member is a user or a group. Use setGroupID
or
setGroupName
to identify the user group whose members are to be checked.
nMemberID
- the numeric identifier of the member user/group.public int getMemberID()
public void setMemberList(java.lang.String strMemberList)
setMemberList
and setMemberType
followed by a call to
update
will add the specified users/groups as members of this group.
setMemberList
and setMemberType
followed by a call to
delete
will remove the specified users/groups from being members of this group.
In both instances, either the ID (setGroupID
) or the Name(setGroupName
)
of the user group to which these members are to be added should also be supplied.
strMemberList
- a String
object containing a comma-separated list of member IDs.public java.lang.String getMemberList()
String
object containing a comma-separated list of member IDs.public void setMemberType(java.lang.String strMemberType) throws CSParameterException
setMemberList
or
setMemberID
method.
Valid types are :
TYPE_USER - all IDs within the member list are for users
.
TYPE_GROUP - all IDs within the member list are for groups
.
If no member type is explicitly specified, TYPE_USER
is assumed.
strMemberType
- one of the valid member types.CSParameterException
- if an invalid combination of key information has been supplied.public java.lang.String getMemberType()
setMemberList
method.
public void setGroupID(int nGroupID)
setGroupID
followed by a call to exist
will determine whether a user group with
that ID exists on the database.
setGroupID
followed by a call to get
will populate this CSUserGroup
object with that user group's details.
If a user group ID is specified, the update
method will update, using the contents of this
CSUserGroup
object, the user group on the database whose ID matches.
setGroupID
followed by a call to delete
will remove the user group with that ID
from the database.
setGroupID
can also be used in conjunction with setMemberList
and
setMemberType
methods to indicate the group to which the specified members are to
be added.
nGroupID
- the numeric identifier of the user group.public int getGroupID()
public void setGroupName(java.lang.String strGroupName)
setGroupName
followed by a call to exist
will determine whether a user group with
that name exists on the database. If the user group ID is known, it will be used in preference to the name.
setGroupName
followed by a call to get
will populate this CSUserGroup
object with details of the user group with the specified name. If the user group ID is known, it will be used in
preference to the name.
If no user group ID is specified, the update
method will use the user group name to update,
using the contents of this CSUserGroup
object, the user group on the database whose name matches.
If none exists, a new one will be created.
setGroupName
followed by a call to delete
will remove the user group with that
name from the database. If the user group ID is known, it will be used in preference to the name.
setGroupName
can also be used in conjunction with setMemberList
and
setMemberType
methods to indicate the group to which the specified members are to
be added.
strGroupName
- the user group's name.public java.lang.String getGroupName()
public void setDescription(java.lang.String strDescription)
strDescription
- the user group's description.public java.lang.String getDescription()
public boolean exist() throws CSException
Use setGroupID
followed by exist
to determine whether a user group with
the specified ID exists on the database.
Use setGroupName
followed by exist
to determine whether a user group
with the specified name exists on the database.
Use setMemberID
followed by exist
to determine whether a particular
user/group is a member of this user group. Identify the user group that is to be checked for membership via the
setGroupID
or setGroupName
method.
exist
in class CSItem
true
if the user group exists on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSException
- the base class for exceptions thrown by this method.public void get() throws CSException
Use setGroupID
followed by get
to populate this CSUserGroup
object with the details of the user group identified by the specified ID.
Use setGroupName
followed by get
to populate this
CSUserGroup
object with the details of the user group identified by the specified name.
get
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified user group cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
Use update
to store the current contents of this CSUserGroup
object to the
database. If a user group with the current ID/Name already exists, that user group's details will be updated.
Otherwise, a new user group will be created on the database.
Also use update
to add users/groups as members of the group identified by this
CSUserGroup
object. Supply the member IDs via the setMemberList
and
setMemberType
methods, and the group (to which they are to be added) via the
setGroupID
or setGroupName
methods prior to calling
update
.
update
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified user group cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setGroupID
followed by delete
to remove the user group with that ID
from the database.
Use setGroupName
followed by delete
to remove the user group with
that name from the database.
Also use delete
to remove users/groups from being members of the group identified by this
CSUserGroup
object. Supply the member IDs via the setMemberList
and
setMemberType
methods, and the group (from which they are to be removed) via the
setGroupID
or setGroupName
methods prior to calling
delete
.
delete
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified user group cannot be found on the database.CSException
- the base class for exceptions thrown by this method.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.