Package org.ametys.web.usermanagement
Class SendInvitationsSchedulable
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
org.ametys.cms.schedule.AbstractSendingMailSchedulable
org.ametys.web.usermanagement.SendInvitationsSchedulable
- All Implemented Interfaces:
Schedulable
,LogEnabled
,PluginAware
,Initializable
,Component
,Configurable
,Contextualizable
,Serviceable
Job for sending invitations email
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
Field Summary
Modifier and TypeFieldDescriptionprotected UserSignupManager
The signup managerprotected SiteManager
The site managerprotected UserPopulationDAO
DAO for user populationstatic final String
The key for the guestsstatic final String
The key for the guestsstatic final String
The key for the site namestatic final String
The key for the id of the populationstatic final String
The key for the id of the populationFields inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_currentUserProvider, _i18nUtils, _mailSender, _sysadminMail, _userHelper
Fields inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
_acceptConcurrentExecution, _context, _description, _iconGlyph, _iconLarge, _iconMedium, _iconSmall, _id, _label, _parameters, _pluginName, _private, _schedulableParameterTypeExtensionPoint, _smanager, _startTime, _userManager, PROGRESSION_TRACKER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
_buildErrorMailBody
(JobExecutionContext context, UserManagementException.StatusError globalErrorCause) Build the HTML mail body in case of errorprotected String
_buildMailBody
(JobExecutionContext context, List<String> successEmails, List<String> invalidEmails, List<String> errorMails, List<String> existingTempUsers, List<String> existingUsers) Build the HTML mail bodyprotected void
_doExecute
(JobExecutionContext context, ContainerProgressionTracker progressionTracker) Executes the schedulable.protected String
_getErrorMailBody
(JobExecutionContext context, Throwable throwable) Retrieves the body of the error mailprotected I18nizableText
_getErrorMailSubject
(JobExecutionContext context) Retrieves the subject of the error mailprotected Site
_getSite
(JobExecutionContext context) Get the site title from job execution contextprotected String
_getSuccessMailBody
(JobExecutionContext context) Retrieves the body of the success mailprotected I18nizableText
Retrieves the subject of the success mailprotected boolean
_isMailBodyInHTML
(JobExecutionContext context) Determines if the mail body is in HTMLprotected String
getToolUri
(Site site) Get the back-office url to access user temp toolvoid
void
service
(ServiceManager smanager) Methods inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_getRecipient, _sendMail, execute
Methods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, configure, contextualize, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, getProgressionTracker, isPrivate, setPluginInfo
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
USER_POPULATION_ID_KEY
The key for the id of the population- See Also:
-
USER_DIRECTORY_ID_KEY
The key for the id of the population- See Also:
-
SITE_NAME_KEY
The key for the site name- See Also:
-
GUESTS_KEY
The key for the guests- See Also:
-
RESEND_INVITATIONS_KEY
The key for the guests- See Also:
-
_signupManager
The signup manager -
_siteManager
The site manager -
_userPopulationDAO
DAO for user population
-
-
Constructor Details
-
SendInvitationsSchedulable
public SendInvitationsSchedulable()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSendingMailSchedulable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAbstractSendingMailSchedulable
- Throws:
Exception
-
_doExecute
protected void _doExecute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) throws Exception Description copied from class:AbstractSendingMailSchedulable
Executes the schedulable.- Specified by:
_doExecute
in classAbstractSendingMailSchedulable
- Parameters:
context
- the contextprogressionTracker
- The progression tracker- Throws:
Exception
- if an error occurred
-
_getSuccessMailSubject
Description copied from class:AbstractSendingMailSchedulable
Retrieves the subject of the success mail- Specified by:
_getSuccessMailSubject
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
- the subject of the success mail
- Throws:
Exception
- If an error occurs while building the mail subject
-
_getSuccessMailBody
Description copied from class:AbstractSendingMailSchedulable
Retrieves the body of the success mail- Specified by:
_getSuccessMailBody
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
- the body of the success mail
- Throws:
Exception
- If an error occurs while building the mail body
-
_isMailBodyInHTML
Description copied from class:AbstractSendingMailSchedulable
Determines if the mail body is in HTML- Overrides:
_isMailBodyInHTML
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
true
if the mail body is in HTML,false
otherwise- Throws:
Exception
- If an error occurs while retrieving if mail body should be HTML
-
_buildMailBody
protected String _buildMailBody(JobExecutionContext context, List<String> successEmails, List<String> invalidEmails, List<String> errorMails, List<String> existingTempUsers, List<String> existingUsers) throws IOException Build the HTML mail body- Parameters:
context
- the job context datasuccessEmails
- the mails in successinvalidEmails
- the invalid emailserrorMails
- the mails for which the send has failedexistingTempUsers
- the existing temporary usersexistingUsers
- the existing users- Returns:
- the HTML mail body
- Throws:
IOException
- if failed to build send invitation report
-
getToolUri
Get the back-office url to access user temp tool- Parameters:
site
- the site- Returns:
- the tool uri
-
_getErrorMailSubject
Description copied from class:AbstractSendingMailSchedulable
Retrieves the subject of the error mail- Specified by:
_getErrorMailSubject
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
- the subject of the error mail
- Throws:
Exception
- If an error occurs while building the mail subject
-
_getErrorMailBody
protected String _getErrorMailBody(JobExecutionContext context, Throwable throwable) throws Exception Description copied from class:AbstractSendingMailSchedulable
Retrieves the body of the error mail- Specified by:
_getErrorMailBody
in classAbstractSendingMailSchedulable
- Parameters:
context
- the contextthrowable
- the error- Returns:
- the body of the error mail
- Throws:
Exception
- If an error occurs while building the mail body
-
_buildErrorMailBody
protected String _buildErrorMailBody(JobExecutionContext context, UserManagementException.StatusError globalErrorCause) throws IOException Build the HTML mail body in case of error- Parameters:
context
- the job context dataglobalErrorCause
- the global error cause- Returns:
- the HTML mail body in case of error
- Throws:
IOException
- if failed to build send invitation error
-
_getSite
Get the site title from job execution context- Parameters:
context
- the job context- Returns:
- the site title
-