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
public class EducationalBookletSchedulable extends AbstractSendingMailSchedulable
Schedulablefor educational booklet. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classEducationalBookletSchedulable.EducationalBookletReportObject to represent list of programs exported and list of programs with error after PDF generation- 
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser 
 - 
 
- 
Field Summary
Fields Modifier and Type Field Description protected ContentWorkflowHelper_contentWorkflowHelperThe content workflow helperprotected static String_EDUCATIONAL_BOOKLET_REPORTMap key where the report is storedprotected AmetysObjectResolver_resolverThe ametys object resolverprotected SourceResolver_sourceResolverThe avalon source resolver.static StringEDUCATIONAL_BOOKLET_DIR_NAMEThe directory under ametys home data directory for educational booklet- 
Fields 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, _userManager 
 - 
 
- 
Constructor Summary
Constructors Constructor Description EducationalBookletSchedulable() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_doExecute(JobExecutionContext context)Executes the schedulable.protected void_generateEducationalBookletZip(JobExecutionContext context, File bookletDirectory, List<SubProgram> exportSubPrograms, String zipKey)Generate the zip with the educational booklet for each export subProgramprotected void_generateFile(File bookletDirectory, String uri, Map<String,String> parameters, String name, String extension)Generate a file from the uriprotected void_generateSubProgramEducationalBookletPDF(File bookletDirectory, SubProgram subProgram, Map<String,String> pdfParameters)Generate the educational booklet for one subProgramprotected void_generateSubProgramsEducationalBooklet(JobExecutionContext context, File bookletDirectory, Map<String,String> pdfParameters)Generate educational booklet for each subProgramprotected I18nizableText_getErrorMailBody(JobExecutionContext context, Throwable throwable)Retrieves the body of the error mailprotected I18nizableText_getErrorMailSubject(JobExecutionContext context)Retrieves the subject of the error mailprotected String_getMailBodyBaseKey()The base key for mail bodies.protected String_getMailSubjectBaseKey()The base key for mail subjects.protected I18nizableText_getSubProgramListAsI18nText(List<SubProgram> subPrograms)Transform a list of subprogram in a readable list.protected I18nizableText_getSuccessMailBody(JobExecutionContext context)Retrieves the body of the success mailprotected I18nizableText_getSuccessMailSubject(JobExecutionContext context)Retrieves the subject of the success mailvoidservice(ServiceManager manager)- 
Methods inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_getRecipient, _isMailBodyInHTML, _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, isPrivate, setPluginInfo 
- 
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger 
 - 
 
 - 
 
- 
- 
Field Detail
- 
EDUCATIONAL_BOOKLET_DIR_NAME
public static final String EDUCATIONAL_BOOKLET_DIR_NAME
The directory under ametys home data directory for educational booklet- See Also:
 - Constant Field Values
 
 
- 
_EDUCATIONAL_BOOKLET_REPORT
protected static final String _EDUCATIONAL_BOOKLET_REPORT
Map key where the report is stored- See Also:
 - Constant Field Values
 
 
- 
_sourceResolver
protected SourceResolver _sourceResolver
The avalon source resolver. 
- 
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver 
- 
_contentWorkflowHelper
protected ContentWorkflowHelper _contentWorkflowHelper
The content workflow helper 
 - 
 
- 
Constructor Detail
- 
EducationalBookletSchedulable
public EducationalBookletSchedulable()
 
 - 
 
- 
Method Detail
- 
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
 servicein interfaceServiceable- Overrides:
 servicein classAbstractSendingMailSchedulable- Throws:
 ServiceException
 
- 
_doExecute
protected void _doExecute(JobExecutionContext context) throws Exception
Description copied from class:AbstractSendingMailSchedulableExecutes the schedulable.- Specified by:
 _doExecutein classAbstractSendingMailSchedulable- Parameters:
 context- the context- Throws:
 Exception- if an error occurred
 
- 
_getSuccessMailSubject
protected I18nizableText _getSuccessMailSubject(JobExecutionContext context)
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
protected I18nizableText _getErrorMailSubject(JobExecutionContext context)
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
protected String _getMailSubjectBaseKey()
The base key for mail subjects.- Returns:
 - The prefix of an I18N key
 
 
- 
_getSuccessMailBody
protected I18nizableText _getSuccessMailBody(JobExecutionContext context) throws IOException
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
 
- 
_getErrorMailBody
protected I18nizableText _getErrorMailBody(JobExecutionContext context, Throwable throwable)
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
protected String _getMailBodyBaseKey()
The base key for mail bodies.- Returns:
 - The prefix of an I18N key
 
 
- 
_getSubProgramListAsI18nText
protected I18nizableText _getSubProgramListAsI18nText(List<SubProgram> subPrograms)
Transform a list of subprogram in a readable list.- Parameters:
 subPrograms- The subprograms to iterate on- Returns:
 - An 
I18nizableTextrepresenting the list of subprograms or only a subprogram title 
 
- 
_generateSubProgramsEducationalBooklet
protected void _generateSubProgramsEducationalBooklet(JobExecutionContext context, File bookletDirectory, Map<String,String> pdfParameters)
Generate educational booklet for each subProgram- Parameters:
 context- the contextbookletDirectory- the booklet directorypdfParameters- the parameters to generate PDF
 
- 
_generateSubProgramEducationalBookletPDF
protected void _generateSubProgramEducationalBookletPDF(File bookletDirectory, SubProgram subProgram, Map<String,String> pdfParameters) throws IOException
Generate the educational booklet for one subProgram- Parameters:
 bookletDirectory- the booklet directorysubProgram- the subProgrampdfParameters- the parameters to generate PDF- Throws:
 IOException- if an error occured with files
 
- 
_generateEducationalBookletZip
protected void _generateEducationalBookletZip(JobExecutionContext context, File bookletDirectory, List<SubProgram> exportSubPrograms, String zipKey) throws IOException
Generate the zip with the educational booklet for each export subProgram- Parameters:
 context- the contextbookletDirectory- the booklet directoryexportSubPrograms- the export subProgramszipKey- the zip key- Throws:
 IOException- if an error occured with files
 
- 
_generateFile
protected void _generateFile(File bookletDirectory, String uri, Map<String,String> parameters, String name, String extension) throws IOException
Generate a file from the uri- Parameters:
 bookletDirectory- the booklet directory where the file are createduri- the uriparameters- the parameters of the uriname- the name of the fileextension- the extension of the file- Throws:
 IOException- if an error occured with files
 
 - 
 
 -