Package org.opencms.jsp.userdata
Class CmsUserDataRequestManager
- java.lang.Object
-
- org.opencms.jsp.userdata.CmsUserDataRequestManager
-
public class CmsUserDataRequestManager extends java.lang.Object
Manager class for user data requests.Users can request their data either via username/password, in which case the user data will be collected for that user, or by email, in which case the data for all users with the given email address is collected.
User data is formatted as HTML by one or more configurable 'user data domain' classes, which implement the I_CmsUserDataDomain interface.
After the user requests their data, they are sent an email with a link (which is only valid for a certain time). When opening that link, they have to confirm the credentials they requested the data with, and if they successfully do so, are shown a page with their user data.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FUNCTION_NAME
The name that must be used for the function detail pages for user data requests.static java.lang.String
N_USERDATA
Tag name for the user data request manager.static java.lang.String
N_USERDATA_DOMAIN
Tag name for the user data domain.
-
Constructor Summary
Constructors Constructor Description CmsUserDataRequestManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addDigesterRules(org.apache.commons.digester3.Digester digester, java.lang.String basePath)
Adds digester rules for configuration.void
addUserDataDomain(I_CmsUserDataDomain domain)
Adds a user data domain during configuration phase.void
appendToXml(org.dom4j.Element element)
Writes the configuration back to XML.void
checkNotInitialized()
Checks that the manager has not already been initialized, and throws an exception otherwise.CmsUserDataRequestStore
getRequestStore()
Gets the user data request store.static java.util.List<CmsUser>
getUsersByEmail(CmsObject cms, java.lang.String email)
Gets all users with a given email address (maximum of 999).void
initialize(CmsObject cms)
Initializes the manager.java.util.Optional<CmsUserDataRequestConfig>
loadConfig(CmsObject cms, java.lang.String path)
Loads the user data request configuration from the given file.void
startUserDataRequest(CmsObject cms, CmsUserDataRequestConfig config, java.lang.String email)
Starts a user data request for the email case.void
startUserDataRequest(CmsObject cms, CmsUserDataRequestConfig config, CmsUser user)
Starts a user data request for the single user case (with user name and password).java.lang.String
toString()
-
-
-
Field Detail
-
FUNCTION_NAME
public static final java.lang.String FUNCTION_NAME
The name that must be used for the function detail pages for user data requests.- See Also:
- Constant Field Values
-
N_USERDATA
public static final java.lang.String N_USERDATA
Tag name for the user data request manager.- See Also:
- Constant Field Values
-
N_USERDATA_DOMAIN
public static final java.lang.String N_USERDATA_DOMAIN
Tag name for the user data domain.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsUserDataRequestManager
public CmsUserDataRequestManager()
-
-
Method Detail
-
addDigesterRules
public static void addDigesterRules(org.apache.commons.digester3.Digester digester, java.lang.String basePath)
Adds digester rules for configuration.- Parameters:
digester
- the digesterbasePath
- the base xpath for the configuration of user data requests
-
getUsersByEmail
public static java.util.List<CmsUser> getUsersByEmail(CmsObject cms, java.lang.String email) throws CmsException
Gets all users with a given email address (maximum of 999).- Parameters:
cms
- the CMS contextemail
- the email address- Returns:
- the list of users
- Throws:
CmsException
- if something goes wrong
-
addUserDataDomain
public void addUserDataDomain(I_CmsUserDataDomain domain)
Adds a user data domain during configuration phase.- Parameters:
domain
- the user data domain to add
-
appendToXml
public void appendToXml(org.dom4j.Element element)
Writes the configuration back to XML.- Parameters:
element
- the parent element
-
checkNotInitialized
public void checkNotInitialized()
Checks that the manager has not already been initialized, and throws an exception otherwise.
-
getRequestStore
public CmsUserDataRequestStore getRequestStore()
Gets the user data request store.- Returns:
- the user data request store
-
initialize
public void initialize(CmsObject cms)
Initializes the manager.- Parameters:
cms
- a CMS context with admin privileges
-
loadConfig
public java.util.Optional<CmsUserDataRequestConfig> loadConfig(CmsObject cms, java.lang.String path)
Loads the user data request configuration from the given file.Returns null if no configuration is found.
- Parameters:
cms
- the CMS contextpath
- the site path of the configuration- Returns:
- the configuration for the given path
-
startUserDataRequest
public void startUserDataRequest(CmsObject cms, CmsUserDataRequestConfig config, CmsUser user) throws javax.mail.internet.AddressException, org.apache.commons.mail.EmailException
Starts a user data request for the single user case (with user name and password).- Parameters:
cms
- the CMS contextconfig
- the configurationuser
- the user for which the data was requested- Throws:
javax.mail.internet.AddressException
- if parsing the email address failsorg.apache.commons.mail.EmailException
- if sending the email fails
-
startUserDataRequest
public void startUserDataRequest(CmsObject cms, CmsUserDataRequestConfig config, java.lang.String email) throws CmsUserDataRequestException, org.apache.commons.mail.EmailException, javax.mail.internet.AddressException
Starts a user data request for the email case.- Parameters:
cms
- the CMS contextconfig
- the user data request configurationemail
- the email address- Throws:
CmsUserDataRequestException
- if something goes wrongorg.apache.commons.mail.EmailException
- if sending the email failsjavax.mail.internet.AddressException
- if parsing the email address fails
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-