Class SendCalendarNotificationFunction
java.lang.Object
org.ametys.plugins.workflow.AbstractWorkflowComponent
org.ametys.plugins.explorer.workflow.AbstractExplorerNodeWorkflowComponent
org.ametys.plugins.workspaces.project.notification.SendCalendarNotificationFunction
- All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider
,PluginAware
,Initializable
,Contextualizable
,LogEnabled
,Serviceable
public class SendCalendarNotificationFunction
extends AbstractExplorerNodeWorkflowComponent
implements com.opensymphony.workflow.FunctionProvider, Initializable, PluginAware, Contextualizable
OS workflow function to send mail after an action is triggered.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
Context available to subclasses.protected I18nUtils
I18nUtilsprotected String
The plugin name.protected ProjectManager
The project resolverprotected RenderingContextHandler
The rendering context handlerprotected AmetysObjectResolver
The ametys resolverprotected RightManager
The right manager.protected UserManager
The users manager.protected WorkflowProvider
The workflow providerprotected static final String
The mail body key.protected static final String
The mail subject key.static final String
Provide "false" to prevent the function sending the mail.protected static final String
The mail subject key.Fields inherited from class org.ametys.plugins.explorer.workflow.AbstractExplorerNodeWorkflowComponent
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
_getRecurrentDateInfo
(CalendarEvent event, DateFormat dayFormat) Get the recurrent information on a eventvoid
contextualize
(Context context) void
getBodyI18nParams
(Project project, User issuer, CalendarEvent event) Get the i18n parameters of mail body textprotected Page
getCalendarModulePage
(Project project) Get the module's pageprotected String
Get the default language to resolve module's pageprotected String
getEventUrl
(Project project, String calendarId, Date eventStartDate) Get the absolute full url of the eventprotected String
getProjectUrl
(Project project) Get the absolute url of projectgetSubjectI18nParams
(Project project, User issuer, CalendarEvent event) Get the i18n parameters of mail subjectprotected List<UserIdentity>
getUsersToNotify
(AmetysObject object, String[] rightsId) Get the users allowed to be notifiedvoid
protected void
sendMail
(Project project, CalendarEvent event, User issuer, String mailSubjecti18nKey, String mailBodyi18nKey, String[] rightIds) 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.explorer.workflow.AbstractExplorerNodeWorkflowComponent
getExplorerNode
Methods inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser, service
-
Field Details
-
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:
-
SUBJECT_KEY
The mail subject key.- See Also:
-
RIGHTS
The mail subject key.- See Also:
-
BODY_KEY
The mail body key.- See Also:
-
_rightManager
The right manager. -
_userManager
The users manager. -
_workflowProvider
The workflow provider -
_pluginName
The plugin name. -
_i18nUtils
I18nUtils -
_resolver
The ametys resolver -
_projectManager
The project resolver -
_context
Context available to subclasses. -
_renderingContextHandler
The rendering context handler
-
-
Constructor Details
-
SendCalendarNotificationFunction
public SendCalendarNotificationFunction()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
setPluginInfo
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
- 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(Project project, CalendarEvent event, User issuer, String mailSubjecti18nKey, String mailBodyi18nKey, String[] rightIds) Sent an email- Parameters:
project
- The projectevent
- The calendar eventissuer
- The issuermailSubjecti18nKey
- The i18n key for subjectmailBodyi18nKey
- The i18n key for bodyrightIds
- The rights to check
-
getUsersToNotify
Get the users allowed to be notified- Parameters:
object
- The object responsible of the notificationrightsId
- The id of rights to check- Returns:
- The allowed users
-
getSubjectI18nParams
Get the i18n parameters of mail subject- Parameters:
project
- the the projectissuer
- the issuerevent
- the event- Returns:
- the i18n parameters
-
getBodyI18nParams
Get the i18n parameters of mail body text- Parameters:
project
- The projectissuer
- the issuerevent
- the event- Returns:
- the i18n parameters
-
_getRecurrentDateInfo
Get the recurrent information on a event- Parameters:
event
- the eventdayFormat
- the date format for day- Returns:
- the recurrent information or empty if the event is not recurrent
-
getEventUrl
Get the absolute full url of the event- Parameters:
project
- The projectcalendarId
- The id of parent calendareventStartDate
- The start date of the event- Returns:
- The full uri
-
getProjectUrl
Get the absolute url of project- Parameters:
project
- The project- Returns:
- the project's url
-
getDefaultLanguage
Get the default language to resolve module's page- Returns:
- The default language
-
getCalendarModulePage
Get the module's page- Parameters:
project
- The project- Returns:
- The page or
null
if not found
-