Package org.ametys.cms.workflow.archive
Class ArchiveContentsSchedulable
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
org.ametys.cms.workflow.archive.ArchiveContentsSchedulable
- All Implemented Interfaces:
Schedulable,LogEnabled,PluginAware,Component,Configurable,Contextualizable,Serviceable
- Direct Known Subclasses:
ArchiveContentsSchedulable
Runnable engine that archive the contents that have an scheduled archiving
date set before the current date.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AmetysObjectResolverThe ametys object resolver.The user e-mail notification will be sent to users that have this at least one of this rights.protected StringThe server base URL.protected ContextThe cocoon environment context.protected I18nUtilsThe i18n utils.protected LoggerThe logger.protected StringThe content of "from" field in emails.protected ServiceManagerThe service manager.protected RightManagerThe rights managerprotected SourceResolverThe avalon source resolver.protected StringThe sysadmin mail address, to which will be sent the report e-mail.protected StringThe user notification error mail body i18n key.protected StringThe user notification error mail subject i18n key.protected StringThe user notification mail body i18n key.protected StringThe user notification mail subject i18n key.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, _userManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Set<UserIdentity>_getAuthorizedContributors(Content content) Get the authorized contributors to receive mail notificationprotected String_getContentsListAsString(List<Content> contents) Get the contents list as Stringprotected String_getRequestURI(Content content) Get the request URI to set in mailprotected void_sendMailsToUsers(String subject, String body, Set<UserIdentity> users, String from) Send the emails to users (contributors)voidconfigure(Configuration configuration) Configure the engine (called by the scheduler).voidcontextualize(Context context) voidexecute(JobExecutionContext context) The action to perform when a trigger is fired.getAdminEmailParams(List<Content> archivedContents, List<Content> contentsWithError) Get the report e-mail parameters.protected StringgetArchiveActionUri(String contentId) Get the pipeline uri for the archive actiongetBodyParamsForContributors(Content content, boolean archived) Get email body parametersprotected voidsendErrorMailToContributors(Content content, Set<UserIdentity> users) Send the mail to alert users that an error has occurred while trying to archive the content.protected voidsendMailToAdministrator(List<Content> archivedContents, List<Content> contentsWithError) Send the archive report e-mail.protected voidsendMailToContributors(Content content, Set<UserIdentity> users) Send the mail to alert users that the content has been archived.voidservice(ServiceManager manager) protected voidsetRequestAttributes(Request request, Content content) Set the necessary request attributesMethods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, isPrivate, setPluginInfoMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_logger
The logger. -
_manager
The service manager. -
_baseUrl
The server base URL. -
_environmentContext
The cocoon environment context. -
_ametysResolver
The ametys object resolver. -
_sourceResolver
The avalon source resolver. -
_rightManager
The rights manager -
_i18nUtils
The i18n utils. -
_mailFrom
The content of "from" field in emails. -
_sysadminMail
The sysadmin mail address, to which will be sent the report e-mail. -
_archiveRights
The user e-mail notification will be sent to users that have this at least one of this rights. -
_userMailBody
The user notification mail body i18n key. -
_userMailSubject
The user notification mail subject i18n key. -
_userErrorMailBody
The user notification error mail body i18n key. -
_userErrorMailSubject
The user notification error mail subject i18n key.
-
-
Constructor Details
-
ArchiveContentsSchedulable
public ArchiveContentsSchedulable()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractStaticSchedulable- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Overrides:
contextualizein classAbstractStaticSchedulable- Throws:
ContextException
-
configure
Configure the engine (called by the scheduler).- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractStaticSchedulable- Parameters:
configuration- the component configuration.- Throws:
ConfigurationException- If an error occurred
-
execute
Description copied from interface:SchedulableThe action to perform when a trigger is fired. Do not manually call this method.- Specified by:
executein interfaceSchedulable- Specified by:
executein classAbstractStaticSchedulable- Parameters:
context- the context- Throws:
Exception- if an error occured
-
setRequestAttributes
Set the necessary request attributes- Parameters:
request- The requestcontent- The content
-
getArchiveActionUri
Get the pipeline uri for the archive action- Parameters:
contentId- the current contend id- Returns:
- a pipeline uri
-
sendMailToAdministrator
protected void sendMailToAdministrator(List<Content> archivedContents, List<Content> contentsWithError) Send the archive report e-mail.- Parameters:
archivedContents- The list of archived contentscontentsWithError- The list of contents with error
-
getAdminEmailParams
protected List<String> getAdminEmailParams(List<Content> archivedContents, List<Content> contentsWithError) Get the report e-mail parameters.- Parameters:
archivedContents- The list of archived contentscontentsWithError- The list of contents with error- Returns:
- the e-mail parameters.
-
_getContentsListAsString
Get the contents list as String- Parameters:
contents- The contents- Returns:
- the list of contents as String
-
_getAuthorizedContributors
Get the authorized contributors to receive mail notification- Parameters:
content- The content to be archived- Returns:
- The user logins
-
sendMailToContributors
Send the mail to alert users that the content has been archived.- Parameters:
content- The archived contentusers- The users
-
getBodyParamsForContributors
Get email body parameters- Parameters:
content- the archived contentarchived- true if the content has archived- Returns:
- The mail parameters
-
sendErrorMailToContributors
Send the mail to alert users that an error has occurred while trying to archive the content.- Parameters:
content- The contentusers- The users
-
_getRequestURI
Get the request URI to set in mail- Parameters:
content- The content. Can be null- Returns:
- the request URI
-
_sendMailsToUsers
Send the emails to users (contributors)- Parameters:
subject- the e-mail subject.body- the e-mail body.users- users to send the mail to.from- the address sending the e-mail.
-