public class CSUserProfile extends CSObject
CSUser
) and the profile details which contain name, address and other information.
The CSUserProfile
class includes methods for the retrieval, update, and removal of a particular user's
profile. It also provides a method that checks for the existence of a user's profile. All such methods require that
certain database and key information (user ID, for example) be specified via the set
methods provided,
prior to their invocation.
All database access/connectivity is handled internally by the CSUserProfile
class.
Note that a CSUserProfile
object is derived from CSObject
and so can also be identified
by its object ID if required. Typically, the user ID or name will be sufficient.
DIRECTION_BOTH, DIRECTION_DESTINATION, DIRECTION_SOURCE
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 |
---|
CSUserProfile()
Creates an empty
CSUserProfile object. |
CSUserProfile(java.lang.String strPropertyFile)
Creates an empty
CSUserProfile object, specifying a property file that contains all of the
database connection details. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a duplicate of this
CSUserProfile object. |
void |
delete()
Removes a user profile from the database.
|
boolean |
exist()
Checks to see whether a user profile exists on the database.
|
void |
get()
Retrieves a user's profile from the database.
|
java.lang.String |
getUpdatedBy()
Gets the name of the user or function that is updating the user profile.
|
int |
getUserID()
Gets the ID of the user.
|
java.lang.String |
getUserName()
Gets the name of the user.
|
void |
setCreatedBy(java.lang.String strCreatedBy)
Sets the name of the user who is creating the user profile.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setUpdatedBy(java.lang.String strUpdatedBy)
Sets the name of the user or function that is updating the user profile.
|
void |
setUserID(int nUserID)
Sets the ID of the user.
|
void |
setUserName(java.lang.String strUserName)
Sets the name of the user.
|
void |
update()
Updates a user's profile on the database.
|
existsItem, generateXMLDocAsString, generateXMLFragment, getCheckTypeExistsOnCreate, getCreatedBy, getDateCreated, getDateLastUpdated, getDefaultHandlebarsHelpers, getDefaultUserProfileType, getHandlebarsResult, getHandlebarsResult, getHbContextData, getHbTemplate, getItem, getLabel, getLastUpdatedBy, getObjectData, getObjectID, getRelatedDirection, getRelatedID, getRelatedList, getType, getUpdateData, getUpdatedLabel, getUpdateIndex, getUserProfileType, readXMLDocument, readXMLFragment, setCheckTypeExistsOnCreate, setDateCreated, setDateLastUpdated, setDefaultHandlebarsHelpers, setDefaultUserProfileType, setHbContextData, setHbTemplate, setItem, setItem, setLabel, setLastUpdatedBy, setObjectData, setObjectID, setRelatedDirection, setRelatedID, setRelatedList, setType, setUpdateData, setUpdatedLabel, setUpdateIndex, setUserProfileType, toString
equals, getID, getStatus, hashCode, jsonString, serialiseWithTypes, setID, setStatus, unset
clearRecordedGatewayMessages, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSUserProfile()
CSUserProfile
object.
Use the various set methods provided to initialise the CSUserProfile
object prior to invoking any
of its query methods.
public CSUserProfile(java.lang.String strPropertyFile)
CSUserProfile
object, specifying a property file that contains all of the
database connection details.
Use the various set methods provided to initialise the CSUserProfile
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 profile are :
LEVEL_ID - the user ID and user profile (object) ID
.
LEVEL_SUMMARY - the object type and label
.
LEVEL_DETAIL - the user profile object's date and time created/last updated, and the name of the person that create/last updated it
.
LEVEL_ALL - the object data
.
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 CSObject
nDetailLevel
- The detail level to be usedCSParameterException
- if an invalid detail level is specified.public void setUserID(int nUserID)
setUserID
followed by a call to exist
will determine whether a user profile for
the user identified by that ID exists on the database.
setUserID
followed by a call to get
will populate this CSUserProfile
object with that user's profile details.
If a user ID is specified, the update
method will update, using the contents of this
CSUserProfile
object, the profile of the user on the database whose ID matches.
setUserID
followed by a call to delete
will remove the profile for the user with
that ID from the database.
nUserID
- the numeric identifier of the user.public int getUserID()
public void setUserName(java.lang.String strUserName)
setUserName
followed by a call to exist
will determine whether a profile for the
user with that name exists on the database. If the user ID is known, it will be used in preference to the name.
setUserName
followed by a call to get
will populate this CSUserProfile
object with details of the profile for the user with the specified name. If the user ID is known, it will be used
in preference to the name.
If no user ID is specified, the update
method will use the user name to update, using the
contents of this CSUserProfile
object, the profile of the user on the database whose name matches.
If none exists, a new one will be created.
setUserName
followed by a call to delete
will remove the profile of the user
with that name from the database. If the user ID is known, it will be used in preference to the name.
strUserName
- the user's name.public java.lang.String getUserName()
public void setCreatedBy(java.lang.String strCreatedBy)
setCreatedBy
in class CSObject
strCreatedBy
- The name of the user who is creating the user profile.public void setUpdatedBy(java.lang.String strUpdatedBy)
strUpdatedBy
- the user's or function's name.public java.lang.String getUpdatedBy()
public boolean exist() throws CSException
Use setUserID
followed by exist
to determine whether a profile for the
user with the specified ID exists on the database.
Use setUserName
followed by exist
to determine whether a profile for
the user with the specified name exists on the database.
Use setObjectID
followed by exist
to determine whether a profile
identified by the specified ID exists on the database.
exist
in class CSObject
true
if the user profile 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 setUserID
followed by get
to populate this CSUserProfile
object with the details of the profile for the user identified by the specified ID.
Use setUserName
followed by get
to populate this
CSUserProfile
object with the details of the profile for the user identified by the specified
name.
Use setObjectID
followed by get
to populate this
CSUserProfile
object with the details of the profile identified by the specified ID.
If none of setUserID
, setUserName
or setObjectID
have been
specified, an empty
CSUserProfile
object will be returned. This can then be populated with any user profile details and inserted into the
database using the update() method.
get
in class CSObject
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified user 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 CSUserProfile
object to the
database. The profile for the user identified by the supplied ID/Name will be updated. If none exists, a new one
will be created.
update
in class CSObject
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified user cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setUserID
followed by delete
to remove the profile for the user with
that ID from the database.
Use setUserName
followed by delete
to remove the profile for the user
with that name from the database.
Use setObjectID
followed by delete
to remove the profile identified by
that ID from the database.
delete
in class CSObject
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified user cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public java.lang.Object clone() throws java.lang.CloneNotSupportedException, java.lang.OutOfMemoryError
CSUserProfile
object.
clone
in class CSDatabaseItem
CSUserProfile
object.java.lang.CloneNotSupportedException
- if cloning is not supported/allowed.java.lang.OutOfMemoryError
- if there are any problems allocating memory.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.