Class SendCalendarNotificationFunction
- java.lang.Object
-
- org.ametys.plugins.workflow.AbstractWorkflowComponent
-
- org.ametys.plugins.workspaces.workflow.AbstractNodeWorkflowComponent
-
- org.ametys.plugins.workspaces.project.notification.SendCalendarNotificationFunction
-
- All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider
,PluginAware
,Initializable
,Contextualizable
,LogEnabled
,Serviceable
public class SendCalendarNotificationFunction extends AbstractNodeWorkflowComponent implements com.opensymphony.workflow.FunctionProvider, Initializable, PluginAware, Contextualizable
OS workflow function to send mail after an action is triggered.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
Context available to subclasses.protected I18nUtils
_i18nUtils
I18nUtilsprotected NotificationPreferencesHelper
_notificationPrefHelper
The notofication helperprotected String
_pluginName
The plugin name.protected ProjectManager
_projectManager
The project resolverprotected RenderingContextHandler
_renderingContextHandler
The rendering context handlerprotected AmetysObjectResolver
_resolver
The ametys resolverprotected RightManager
_rightManager
The right manager.protected SourceResolver
_srcResolver
Source Resolverprotected UserManager
_userManager
The users manager.protected WorkflowProvider
_workflowProvider
The workflow providerprotected static String
BODY_KEY
The mail body key.static String
SEND_MAIL
Provide "false" to prevent the function sending the mail.protected static String
SUBJECT_KEY
The mail subject key.-
Fields inherited from class org.ametys.plugins.workspaces.workflow.AbstractNodeWorkflowComponent
EXPLORERNODE_KEY
-
Fields inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY
-
-
Constructor Summary
Constructors Constructor Description SendCalendarNotificationFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
void
execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps)
protected List<String>
getSubjectI18nParams(Project project, UserIdentity issuer, CalendarEvent event)
Get the i18n parameters of mail subjectprotected List<UserIdentity>
getUsersToNotify(String eventId, AmetysObject object, String rightIds)
Get the users allowed to be notifiedvoid
initialize()
protected void
sendMail(List<UserIdentity> recipients, String subject, String htmlMailBody)
Sent an emailvoid
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.plugins.workspaces.workflow.AbstractNodeWorkflowComponent
getExplorerNode
-
Methods inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser, service
-
-
-
-
Field Detail
-
SEND_MAIL
public static final String SEND_MAIL
Provide "false" to prevent the function sending the mail. Useful when making large automatic workflow operations (for instance, when bulk importing and proposing in one action).- See Also:
- Constant Field Values
-
SUBJECT_KEY
protected static final String SUBJECT_KEY
The mail subject key.- See Also:
- Constant Field Values
-
BODY_KEY
protected static final String BODY_KEY
The mail body key.- See Also:
- Constant Field Values
-
_rightManager
protected RightManager _rightManager
The right manager.
-
_userManager
protected UserManager _userManager
The users manager.
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The workflow provider
-
_pluginName
protected String _pluginName
The plugin name.
-
_i18nUtils
protected I18nUtils _i18nUtils
I18nUtils
-
_resolver
protected AmetysObjectResolver _resolver
The ametys resolver
-
_projectManager
protected ProjectManager _projectManager
The project resolver
-
_renderingContextHandler
protected RenderingContextHandler _renderingContextHandler
The rendering context handler
-
_srcResolver
protected SourceResolver _srcResolver
Source Resolver
-
_notificationPrefHelper
protected NotificationPreferencesHelper _notificationPrefHelper
The notofication helper
-
-
Constructor Detail
-
SendCalendarNotificationFunction
public SendCalendarNotificationFunction()
-
-
Method Detail
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
execute
public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
- Specified by:
execute
in interfacecom.opensymphony.workflow.FunctionProvider
- Throws:
com.opensymphony.workflow.WorkflowException
-
sendMail
protected void sendMail(List<UserIdentity> recipients, String subject, String htmlMailBody)
Sent an email- Parameters:
recipients
- the users we want to send an emailsubject
- the subject of the mailhtmlMailBody
- the mail body
-
getUsersToNotify
protected List<UserIdentity> getUsersToNotify(String eventId, AmetysObject object, String rightIds)
Get the users allowed to be notified- Parameters:
eventId
- The id of the eventobject
- The object responsible of the notificationrightIds
- The id of rights to check- Returns:
- The allowed users
-
getSubjectI18nParams
protected List<String> getSubjectI18nParams(Project project, UserIdentity issuer, CalendarEvent event)
Get the i18n parameters of mail subject- Parameters:
project
- The the projectissuer
- The issuerevent
- The event- Returns:
- The i18n parameters
-
-