public class CSUserMultiple extends CSItemMultiple<CSUser>
The CSUserMultiple
class includes methods for the retrieval, update, and removal of several users. It
also provides a method that checks for the existence of several users. All such methods require that certain database
and key information (user IDs, for example) be specified via the set
methods provided, prior to their
invocation.
All database access/connectivity is handled internally by the CSUserMultiple
class.
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSUserMultiple()
Creates an empty
CSUserMultiple object. |
CSUserMultiple(java.lang.String strPropertyFile)
Creates an empty
CSUserMultiple object, specifying a property file that contains all of the database
connection details. |
Modifier and Type | Method and Description |
---|---|
void |
checkForMatchingAccountUsers(java.lang.String loginUserName,
int zoneID,
java.lang.String email) |
void |
delete()
Removes several users from the database.
|
boolean |
exist()
Checks for the existence of several users on the database.
|
void |
get()
Retrieves the login details of several users from the database.
|
int |
getAccountUserID()
Gets the accountUserId that will be used for querying
|
java.lang.String |
getEmailAddress()
Gets the email address that will be used for querying
|
java.lang.Boolean |
getEnabled()
Returns true if only users that are enabled are to be returned.
|
java.lang.String |
getFilter()
Gets the user name filter currently specified as key information.
|
java.lang.String |
getGroupList()
Gets the list of user group IDs currently specified as key information.
|
java.util.Date |
getLastLoggedInAfter()
Returns the lastLoggedInAfter date filter if specified, null otherwise.
|
java.util.Date |
getLastLoggedInBefore()
Returns the lastLoggedInBefore date filter if specified, null otherwise.
|
java.lang.Boolean |
getLoginUsers()
Returns true if the query will allow operations on login users.
|
java.lang.String |
getNameList()
Gets the list of user names currently specified as key information.
|
int |
getSubsiteID()
Get the SubsiteId used to discover the ZoneID.
|
boolean |
getTolerateNotFound()
Set true to prevent throwing on ID or TYPE/LABEL not found
|
java.lang.String |
getUserList()
Gets the list of user IDs currently specified as key information.
|
java.util.ArrayList<CSUser> |
getUsers()
Deprecated.
Use
CSItemMultiple.getItems() instead. |
int |
getZoneID()
Get the zone used to filter users
|
void |
setAccountUserID(int accountUserId)
Sets the AccountUserId that will be used for querying.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setEmailAddress(java.lang.String emailAddress)
Sets the email address that will be used for querying.
|
void |
setEnabled(java.lang.Boolean enabled)
Specifies a value for the enabled/disabled user filter.
|
void |
setExcludeSubgroups(boolean bExclude)
Sets a flag determining whether or not users in subgroups will be excluded.
|
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 |
setLastLoggedInAfter(java.util.Date lastLoggedInSince)
Sets the lastLoggedInBefore date filter.
|
void |
setLastLoggedInBefore(java.util.Date lastLoggedInBefore)
Sets the lastLoggedInBefore date filter.
|
void |
setLoginUsers(java.lang.Boolean logins)
Specifies a value to indicate whether or not the query will perform operations on login users
|
void |
setNameList(java.lang.String strNameList)
Specifies a list of user names to be used as key information.
|
void |
setSortOrder(java.lang.String strSortOrderList)
Sets the order in which the users are to be retrieved.
|
void |
setSubsiteID(int subsiteID)
Set the SubsiteId used to discover the ZoneID.
|
void |
setTolerateNotFound(boolean tolerateNotFound)
Set true to prevent throwing on ID or TYPE/LABEL not found
|
void |
setUserList(java.lang.String strUserList)
Specifies a list of users IDs to be used as key information.
|
void |
setUsers(java.util.ArrayList<CSUser> users)
Deprecated.
Use
CSItemMultiple.setItems(ArrayList) instead. |
void |
setZoneID(int zoneId)
Set the zone used to filter users
|
java.lang.String |
toString()
Outputs the contents of this
CSUserMultiple object to a String object in a
user-friendly format. |
void |
update()
Updates the login details of several users 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 CSUserMultiple()
CSUserMultiple
object.
Use the various set
methods provided to initialise the CSUserMultiple
object prior to
invoking any of its query methods.
public CSUserMultiple(java.lang.String strPropertyFile)
CSUserMultiple
object, specifying a property file that contains all of the database
connection details.
Use the various set methods provided to initialise the CSUserMultiple
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 are :
LEVEL_ID - the user ID
.
LEVEL_ALL - the user name, description , strDBPassword and hint
.
Each detail level processes the information specified alongside it in addition to the information specified for all detail levels listed above it.
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 setUserList
, setNameList
or setGroupList
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,
"USERNAME DESC" would order in descending user name order. ASC is assumed if neither ASC or DESC are specified.
The default sort order in this instance is USERNAME ASC.
Available sort orders are :
USERID - order by user ID
.
USERNAME - order by user name
.
GROUPID - order by user group ID
.
GROUPNAME - order by user group name
.
setSortOrder
in class CSItemMultiple<CSUser>
strSortOrderList
- a comma-separated list of one or more of the available sort orders.CSParameterException
- if an invalid sort order was specified.public void setUserList(java.lang.String strUserList)
setUserList
followed by a call to exist
will determine whether users with the
specified IDs exist on the database or not.
setUserList
followed by a call to get
will populate this CSUserMultiple
object with details of all the listed users. Each user will be stored as a CSUser
object within the item
ArrayList
member - use getItems
or iterator
to
access/navigate through the users. The users will be stored in the ArrayList
in the order that the
IDs are specified in the supplied list.
setUserList
followed by a call to delete
will remove the users with the specified
IDs from the database.
strUserList
- a String
object containing a comma-separated list of user IDs.public java.lang.String getUserList()
String
object containing a comma-separated list of user IDs.public void setNameList(java.lang.String strNameList)
setNameList
followed by a call to exist
will determine whether users with the
specified names exist on the database or not.
setNameList
followed by a call to get
will populate this CSUserMultiple
object with details of all the listed users. Each user will be stored as a CSUser
object within the item
ArrayList
member - use getItems
or iterator
to
access/navigate through the users. The users 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 users with the specified
names from the database.
strNameList
- a String
object containing a comma-separated list of user names.public java.lang.String getNameList()
String
object containing a comma-separated list of user names.public void setGroupList(java.lang.String strGroupList)
setGroupList
followed by a call to get
will populate this CSUserMultiple
object with details of all the users that reside within any of the specified groups. Each user will be stored as
a CSUser
object within the item ArrayList
member - use getItems
or
iterator
to access/navigate through the users. The users will be stored in the
ArrayList
in an unspecified order.
strGroupList
- a String
object containing a comma-separated list of user group IDs.public void setExcludeSubgroups(boolean bExclude)
When retrieving users by GroupList, this flag determines whether or not users in subgroups will be excluded from the results
bExclude
- a boolean indicating whether or not to exclude subgroupspublic java.lang.String getGroupList()
String
object containing a comma-separated list of user group IDs.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 whose name is found to CONTAIN the specified text will be retrieved.
setFilter
followed by get
will result in this CSUserMultiple
object
being populated with the details of all users whose name matches the filter specified. Each user will be stored
as a CSUser
object within the item ArrayList
member - use getItems
or
iterator
to access/navigate through the users. By default, the users will be stored in the
ArrayList
in ascending user name order. This can be overridden by using the
setSortOrder
method. Use the setStartRow
and
setMaxRows
methods to limit the number of users retrieved.
strFilter
- the user name filter.public java.lang.String getEmailAddress()
public void setEmailAddress(java.lang.String emailAddress)
emailAddress
- the email address that will be used for queryingpublic int getAccountUserID()
public void setAccountUserID(int accountUserId)
accountUserId
- the accountUserId that will be used for queryingpublic int getSubsiteID()
public void setSubsiteID(int subsiteID)
subsiteID
- the SubsiteID to setpublic int getZoneID()
public void setZoneID(int zoneId)
zoneId
- the zoneId to setpublic boolean getTolerateNotFound()
public void setTolerateNotFound(boolean tolerateNotFound)
public java.lang.String getFilter()
public void setEnabled(java.lang.Boolean enabled)
enabled
- True if only enabled users should be returned, false if only disabled users should be returned, null
(the default) if both should be returned.public java.lang.Boolean getEnabled()
public void setLoginUsers(java.lang.Boolean logins)
logins
- true if login users will be returned/processed false if only account users will be
returned/processedpublic java.lang.Boolean getLoginUsers()
public void setLastLoggedInAfter(java.util.Date lastLoggedInSince)
Date
will be returned.lastLoggedInSince
- Only users that last logged in after the given Date
will be returned.public java.util.Date getLastLoggedInAfter()
Date
will be returned.Date
filter if specified, null otherwise.public void setLastLoggedInBefore(java.util.Date lastLoggedInBefore)
Date
will be returned.lastLoggedInBefore
- Only users that last logged in before the given Date
will be returned.public java.util.Date getLastLoggedInBefore()
Date
will be returned.Date
filter if specified, null otherwise.public void setUsers(java.util.ArrayList<CSUser> users)
CSItemMultiple.setItems(ArrayList)
instead.CSUser
objects that contain the details to be written to the database by the
update
method.
users
- one or more CSUser
objects.public java.util.ArrayList<CSUser> getUsers()
CSItemMultiple.getItems()
instead.CSUser
objects containing the details that are to be written to the database by the
update
method.
ArrayList
containing one or more CSUser
objects.public boolean exist() throws CSException
Use setUserList
followed by exist
to determine whether users with the
specified IDs exist on the database.
Use setNameList
followed by exist
to determine whether users with the
specified names exist on the database.
exist
in class CSItemMultiple<CSUser>
true
if all users 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 setUserList
followed by get
to populate this
CSUserMultiple
object with details of all the users identified by the specified IDs. The retrieved
users will appear within CSUserMultiple
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
CSUserMultiple
object with the details of all the users identified by the specified names. The
retrieved users will appear within CSUserMultiple
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
CSUserMultiple
object with the details of all users whose name matches the filter specified. By
default the user will be retrieved in ascending user 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 users that are retrieved.
Use setGroupList
followed by get
to populate this
CSUserMultiple
object with the details of all users that are members of any of the specified groups.
The users will be retrieved in an unspecified order. The setSortOrder
, setStartRow
and
setMaxRows
methods cannot be used in conjunction with the setGroupList
method.
If none of setUserList
, setNameList
, setFilter
or
setGroupList
are specified, ALL users will be retrieved.
Each retrieved user will be stored as a CSUser
object within the item ArrayList
member of
this CSUserMultiple
object - use getItems
or iterator
to
access/navigate through the users.
get
in class CSItemMultiple<CSUser>
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 users 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 details to
the database.
update
in class CSItemMultiple<CSUser>
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 users cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setUserList
followed by delete
to remove all users whose IDs are
listed, from the database.
Use setNameList
followed by delete
to remove all users whose names are
listed, from the database.
Use setFilter
followed by delete
to remove all users whose name matches
the specified filter.
Both user login details and any associated user profile details (CSUserProfile
) will be deleted.
delete
in class CSItemMultiple<CSUser>
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 users cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void checkForMatchingAccountUsers(java.lang.String loginUserName, int zoneID, java.lang.String email) throws CSException
CSException
public java.lang.String toString()
CSUserMultiple
object to a String
object in a
user-friendly format.
toString
in class CSItemMultiple<CSUser>
String
containing the user-friendly output.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.