public class CSUserGroups extends CSItemMultiple
The CSUserGroups
class includes methods for the retrieval, update, and removal of several user groups.
It also provides a method that checks for the existence of several user groups. All such methods require that certain
database and key information (group IDs, for example) be specified via the set
methods provided, prior
to their invocation.
All database access/connectivity is handled internally by the CSUserGroups
class.
CSUserGroup
,
CSUserGroupContent
,
Serialized FormModifier 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. |
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSUserGroups()
Creates an empty
CSUserGroups object. |
CSUserGroups(java.lang.String strPropertyFile)
Creates an empty
CSUserGroups object, specifying a property file that contains all of the database
connection details. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Removes several user groups from the database.
|
boolean |
exist()
Checks for the existence of several user groups on the database.
|
void |
get()
Retrieves the details of several user groups from the database.
|
java.lang.String |
getFilter()
Gets the user group name filter currently specified as key information.
|
java.lang.String |
getGroupList()
Gets list of user group IDs currently specified as key information.
|
java.util.ArrayList |
getGroups()
Deprecated.
Use
CSItemMultiple.getItems() instead. |
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. |
java.lang.String |
getNameList()
Gets the list of user group names currently specified as key information.
|
int |
getParentID()
Gets the ID of a website group to be used as key information.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setFilter(java.lang.String strFilter)
Specifies the name filter to be used as key information.
|
void |
setGroupList(java.lang.String strGroupList)
Specifies a list of user group IDs to be used as key information.
|
void |
setGroups(java.util.ArrayList groups)
Deprecated.
Use
CSItemMultiple.setItems(ArrayList) instead. |
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 members supplied via the
setMemberList method. |
void |
setNameList(java.lang.String strNameList)
Specifies a list of user group names to be used as key information.
|
void |
setParentID(int groupID)
Specifies the ID of a website group to be used as key information. setParentID followed by
get
will populate this CSUserGroups object with details of all the groups that are the immediate
children of the specified parent. |
void |
setSortOrder(java.lang.String strSortOrderList)
Sets the order in which the user groups are to be retrieved.
|
java.lang.String |
toString()
Outputs the contents of this
CSUserGroups object to a String object in a
user-friendly format. |
void |
update()
Updates the details of several user groups on the database.
|
equals, getItems, getMaxRows, getSortOrder, getStartRow, iterator, setItems, setMaxRows, setStartRow
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 CSUserGroups()
CSUserGroups
object.
Use the various set
methods provided to initialise the CSUserGroups
object prior to
invoking any of its query methods.
public CSUserGroups(java.lang.String strPropertyFile)
CSUserGroups
object, specifying a property file that contains all of the database
connection details.
Use the various set methods provided to initialise the CSUserGroups
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 setSortOrder(java.lang.String strSortOrderList) throws CSParameterException
This method should not be used if the setGroupList
,
setNameList
or setMemberList
key information is being
supplied. With the setFilter
method, however, one or more of the available sort orders
may be specified as a comma-delimited list. Use ASC or DESC to indicate the direction of ordering for a sort
order. For example, "GROUPNAME DESC" would order in descending group name order. ASC is assumed if neither ASC or
DESC are specified. The default sort order in this instance is GROUPNAME ASC.
Available sort orders are :
GROUPID - order by group ID
.
GROUPNAME - order by group name
.
DESCRIPTION - order by group description
.
setSortOrder
in class CSItemMultiple
strSortOrderList
- a comma-separated list of one or more of the available sort orders.CSParameterException
- if an invalid sort order was specified.public void setGroupList(java.lang.String strGroupList)
setGroupList
followed by a call to exist
will determine whether user groups with
the specified IDs exist on the database or not.
setGroupList
followed by a call to get
will populate this CSUserGroups
object with details of all the listed user groups. Each user group will be stored as a CSUserGroup
object
within the item ArrayList
member - use getItems
or
iterator
to access/navigate through the user groups. The user groups will be stored in the
ArrayList
in the order that the IDs are specified in the supplied list.
setGroupList
followed by a call to delete
will remove the user groups with the
specified IDs from the database.
strGroupList
- a String
object containing a comma-separated list of user group IDs.public java.lang.String getGroupList()
String
object containing a comma-separated list of user group IDs.public void setNameList(java.lang.String strNameList)
setNameList
followed by a call to exist
will determine whether user groups with
the specified names exist on the database or not.
setNameList
followed by a call to get
will populate this CSUserGroups
object with details of all the listed user groups. Each user group will be stored as a CSUserGroup
object
within the item ArrayList
member - use getItems
or
iterator
to access/navigate through the user groups. The user groups will be stored in the
ArrayList
in the order that the names are specified in the supplied list.
setNameList
followed by a call to delete
will remove the user groups with the
specified names from the database.
strNameList
- a String
object containing a comma-separated list of user group names.public java.lang.String getNameList()
String
object containing a comma-separated list of user group names.public void setParentID(int groupID)
get
will populate this CSUserGroups
object with details of all the groups that are the immediate
children of the specified parent. A group ID of 0 will return top-level groups.groupID
- The parent website group ID.public int getParentID()
public void setMemberList(java.lang.String strMemberList)
setMemberList
and setMemberType
followed by a call to
get
will populate this CSUserGroups
object with details of all the groups that
contain the specified members. Each user group will be stored as a CSUserGroup
object within the item
ArrayList
member - use getItems
or iterator
to
access/navigate through the user groups. The user groups will be stored in the ArrayList
in an
unspecified order.
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
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 setFilter(java.lang.String strFilter)
If a filter is specified and no % is included in the filter, % is placed at the beginning and end so that any user group whose name is found to CONTAIN the specified text will be retrieved.
setFilter
followed by get
will result in this CSUserGroups
object
being populated with the details of all user groups whose name matches the filter specified. Each user group will
be stored as a CSUserGroup
object within the item ArrayList
member - use
getItems
or iterator
to access/navigate through the user groups. By
default, the user groups will be stored in the ArrayList
in ascending group name order. This can
be overridden by using the setSortOrder
method. Use the
setStartRow
and setMaxRows
methods to limit the number of user
groups retrieved.
setFilter
followed by delete
will result in all user groups whose name matches
the supplied filter being removed from the database. Any users that reside within the deleted groups will remain
intact.
strFilter
- the user group name filter.public java.lang.String getFilter()
public void setGroups(java.util.ArrayList groups)
CSItemMultiple.setItems(ArrayList)
instead.CSUserGroup
objects that contain the details to be written to the database by the
update
method.
groups
- An ArrayList
containing one of more CSUserGroup
objects.public java.util.ArrayList getGroups()
CSItemMultiple.getItems()
instead.CSUserGroup
objects containing the details that are to be written to the database by the
update
method.
ArrayList
containing one or more CSUserGroup
objects.public boolean exist() throws CSException
Use setGroupList
followed by exist
to determine whether user groups
with the specified IDs exist on the database.
Use setNameList
followed by exist
to determine whether user groups
with the specified names exist on the database.
exist
in class CSItemMultiple
true
if all user groups exist 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 setGroupList
followed by get
to populate this
CSUserGroups
object with details of all the user groups identified by the specified IDs. The
retrieved user groups will appear within CSUserGroups
in the order that their IDs appear within
the supplied list - as such, setSortOrder
, setMaxRows
and
setStartRow
are not valid in this instance.
Use setNameList
followed by get
to populate this
CSUserGroups
object with the details of all the user groups identified by the specified names. The
retrieved user groups will appear within CSUserGroups
in the order that their names appear within
the supplied list - as such, setSortOrder
, setMaxRows
and
setStartRow
are not valid in this instance.
Use setFilter
followed by get
to populate this
CSUserGroups
object with the details of all user groups whose name matches the filter specified.
By default the user groups will be retrieved in ascending name order. This can be overridden if required by using
the setSortOrder
method. The setStartRow
and setMaxRows
methods can
be used to restrict the number of user groups that are retrieved.
Use setMemberList
followed by get
to populate this
CSUserGroups
object with the details of all user groups that contain the supplied members. The
user groups will be retrieved in an unspecified order. The setSortOrder
method. The
setSortOrder
, setStartRow
and setMaxRows
methods cannot be used in
conjunction with the setMemberList
method. Use the setMemberType
method to indicate whether the supplied members are users or groups.
If none of setGroupList
, setNameList
, setFilter
or
setMemberList
are specified, ALL user groups will be retrieved.
Each retrieved user group will be stored as a CSUserGroup
object within the item ArrayList
member of this CSUserGroups
object - use getItems
or
iterator
to access/navigate through the user groups.
get
in class CSItemMultiple
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified user groups 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 setItems
followed by update
to save the supplied user group
details to the database.
update
in class CSItemMultiple
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified user groups cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setGroupList
followed by delete
to remove all user groups whose
IDs are listed, from the database. Any users that reside within the removed groups will remain intact.
delete
in class CSItemMultiple
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if any of the specified user groups cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public java.lang.String toString()
CSUserGroups
object to a String
object in a
user-friendly format.
toString
in class CSItemMultiple
String
containing the user-friendly output.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.