Package org.ametys.odf.schedulable
Class EducationalBookletSchedulable
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
org.ametys.cms.schedule.AbstractSendingMailSchedulable
org.ametys.odf.schedulable.EducationalBookletSchedulable
- All Implemented Interfaces:
Schedulable,LogEnabled,PluginAware,Initializable,Component,Configurable,Contextualizable,Serviceable
- Direct Known Subclasses:
ArchiveEducationalBookletSchedulable,EducationalBookletSchedulable
Schedulable for educational booklet.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classObject to represent list of programs exported and list of programs with error after PDF generationNested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentWorkflowHelperThe content workflow helperprotected static final StringMap key where the report is storedprotected AmetysObjectResolverThe ametys object resolverprotected SourceResolverThe avalon source resolver.static final StringThe directory under ametys home data directory for educational bookletstatic final StringScheduler parameter name of including of subprogramsstatic final StringScheduler parameter name of including of subprogramsFields inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_currentUserProvider, _i18nUtils, _mailSender, _sysadminMail, _userHelperFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_doExecute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) Executes the schedulable.protected void_generateEducationalBookletZip(JobExecutionContext context, File bookletDirectory, List<Content> exportedProgramItems, String zipKey) Generate the zip with the educational booklet for each exported program itemsprotected void_generateFile(File bookletDirectory, String uri, Map<String, Object> params, String name, String extension) Generate a file from the uriprotected void_generateProgramItemEducationalBookletPDF(File bookletDirectory, Content programItem, Map<String, Object> pdfParameters) Generate the educational booklet for one program itemprotected void_generateProgramItemsEducationalBooklet(JobExecutionContext context, File bookletDirectory, Map<String, Object> pdfParameters) Generate educational booklet for each program itemsprotected String_getDownloadLink(JobExecutionContext context, EducationalBookletSchedulable.EducationalBookletReport report, List<Content> exportedProgramItems) Get the link to download PDFprotected String_getErrorMailBody(JobExecutionContext context, Throwable throwable) Retrieves the body of the error mailprotected I18nizableText_getErrorMailSubject(JobExecutionContext context) Retrieves the subject of the error mailprotected StringThe base key for mail bodies.protected StringThe base key for mail subjects.protected I18nizableText_getProgramItemsI18nText(List<Content> programItems) Transform a list of program items in a readable list.protected String_getSuccessMailBody(JobExecutionContext context) Retrieves the body of the success mailprotected I18nizableTextRetrieves the subject of the success mailprotected boolean_isMailBodyInHTML(JobExecutionContext context) Determines if the mail body is in HTMLvoidservice(ServiceManager manager) Methods inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_getRecipient, _sendMail, execute, initializeMethods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, configure, contextualize, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, getProgressionTracker, isPrivate, setPluginInfoMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
EDUCATIONAL_BOOKLET_DIR_NAME
The directory under ametys home data directory for educational booklet- See Also:
-
PARAM_INCLUDE_SUBPROGRAMS
Scheduler parameter name of including of subprograms- See Also:
-
PARAM_PROGRAM_ITEM_ID
Scheduler parameter name of including of subprograms- See Also:
-
_EDUCATIONAL_BOOKLET_REPORT
Map key where the report is stored- See Also:
-
_sourceResolver
The avalon source resolver. -
_resolver
The ametys object resolver -
_contentWorkflowHelper
The content workflow helper
-
-
Constructor Details
-
EducationalBookletSchedulable
public EducationalBookletSchedulable()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSendingMailSchedulable- Throws:
ServiceException
-
_doExecute
protected void _doExecute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) throws Exception Description copied from class:AbstractSendingMailSchedulableExecutes the schedulable.- Specified by:
_doExecutein classAbstractSendingMailSchedulable- Parameters:
context- the contextprogressionTracker- The progression tracker- Throws:
Exception- if an error occurred
-
_getSuccessMailSubject
Description copied from class:AbstractSendingMailSchedulableRetrieves the subject of the success mail- Specified by:
_getSuccessMailSubjectin classAbstractSendingMailSchedulable- Parameters:
context- the context- Returns:
- the subject of the success mail
-
_getErrorMailSubject
Description copied from class:AbstractSendingMailSchedulableRetrieves the subject of the error mail- Specified by:
_getErrorMailSubjectin classAbstractSendingMailSchedulable- Parameters:
context- the context- Returns:
- the subject of the error mail
-
_getMailSubjectBaseKey
The base key for mail subjects.- Returns:
- The prefix of an I18N key
-
_isMailBodyInHTML
Description copied from class:AbstractSendingMailSchedulableDetermines if the mail body is in HTML- Overrides:
_isMailBodyInHTMLin classAbstractSendingMailSchedulable- Parameters:
context- the context- Returns:
trueif the mail body is in HTML,falseotherwise- Throws:
Exception- If an error occurs while retrieving if mail body should be HTML
-
_getSuccessMailBody
Description copied from class:AbstractSendingMailSchedulableRetrieves the body of the success mail- Specified by:
_getSuccessMailBodyin classAbstractSendingMailSchedulable- Parameters:
context- the context- Returns:
- the body of the success mail
- Throws:
IOException
-
_getDownloadLink
protected String _getDownloadLink(JobExecutionContext context, EducationalBookletSchedulable.EducationalBookletReport report, List<Content> exportedProgramItems) throws IOException Get the link to download PDF- Parameters:
context- the job execution contextreport- the reportexportedProgramItems- the exported programs- Returns:
- the download
- Throws:
IOException- if failed to build the download uri
-
_getErrorMailBody
Description copied from class:AbstractSendingMailSchedulableRetrieves the body of the error mail- Specified by:
_getErrorMailBodyin classAbstractSendingMailSchedulable- Parameters:
context- the contextthrowable- the error- Returns:
- the body of the error mail
-
_getMailBodyBaseKey
The base key for mail bodies.- Returns:
- The prefix of an I18N key
-
_getProgramItemsI18nText
Transform a list of program items in a readable list.- Parameters:
programItems- The program items to iterate on- Returns:
- An
I18nizableTextrepresenting the program items
-
_generateProgramItemsEducationalBooklet
protected void _generateProgramItemsEducationalBooklet(JobExecutionContext context, File bookletDirectory, Map<String, Object> pdfParameters) Generate educational booklet for each program items- Parameters:
context- the contextbookletDirectory- the booklet directorypdfParameters- the parameters to generate PDF
-
_generateProgramItemEducationalBookletPDF
protected void _generateProgramItemEducationalBookletPDF(File bookletDirectory, Content programItem, Map<String, Object> pdfParameters) throws IOExceptionGenerate the educational booklet for one program item- Parameters:
bookletDirectory- the booklet directoryprogramItem- the program itempdfParameters- the parameters to generate PDF- Throws:
IOException- if an error occured with files
-
_generateEducationalBookletZip
protected void _generateEducationalBookletZip(JobExecutionContext context, File bookletDirectory, List<Content> exportedProgramItems, String zipKey) throws IOException Generate the zip with the educational booklet for each exported program items- Parameters:
context- the contextbookletDirectory- the booklet directoryexportedProgramItems- the exported program itemszipKey- the zip key- Throws:
IOException- if an error occured with files
-
_generateFile
protected void _generateFile(File bookletDirectory, String uri, Map<String, Object> params, String name, String extension) throws IOExceptionGenerate a file from the uri- Parameters:
bookletDirectory- the booklet directory where the file are createduri- the uriparams- the parameters of the uriname- the name of the fileextension- the extension of the file- Throws:
IOException- if an error occured with files
-