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
Modifier and TypeClassDescriptionprotected static class
Object 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
Modifier and TypeFieldDescriptionprotected ContentWorkflowHelper
The content workflow helperprotected static final String
Map key where the report is storedprotected AmetysObjectResolver
The ametys object resolverprotected SourceResolver
The avalon source resolver.static final String
The directory under ametys home data directory for educational bookletstatic final String
Scheduler parameter name of including of subprogramsstatic final String
Scheduler parameter name of including of subprogramsFields 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 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 String
The base key for mail bodies.protected String
The 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 I18nizableText
Retrieves the subject of the success mailprotected boolean
_isMailBodyInHTML
(JobExecutionContext context) Determines if the mail body is in HTMLvoid
service
(ServiceManager manager) Methods inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_getRecipient, _sendMail, execute, initialize
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
-
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:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSendingMailSchedulable
- Throws:
ServiceException
-
_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
-
_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
-
_getMailSubjectBaseKey
The base key for mail subjects.- Returns:
- The prefix of an I18N key
-
_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
-
_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:
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: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
-
_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
I18nizableText
representing 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
-