Package org.ametys.odf.export.pdf
Class GeneratePDFEngine
- java.lang.Object
-
- org.ametys.odf.export.pdf.GeneratePDFEngine
-
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
GeneratePDFEngine
public class GeneratePDFEngine extends Object implements Runnable
Content consistency engine: generate consistency information for all contents. Sends a report e-mail if there are inconsistencies.
-
-
Field Summary
Fields Modifier and Type Field Description private String_catalogprotected File_catalogRootDirectoryThe catalog directory.protected Context_contextThe avalon context.protected Map<String,Object>_contextualParametersThe contextual parametersprotected Context_environmentContextThe cocoon environment context.protected I18nUtils_i18nUtilsThe i18n utils.protected boolean_initializedIs the engine initialized ?private User_issuerprotected static org.slf4j.Logger_LOGGERThe logger.protected String_mailFromThe sender of the emailprotected ServiceManager_managerThe service manager.private static boolean_RUNNINGIs the thread running ?protected SourceResolver_sourceResolverThe avalon source resolver.
-
Constructor Summary
Constructors Constructor Description GeneratePDFEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_checkInitialization()Check the initialization and throw an exception if not initialized.protected void_dispose()Dispose of the resources and looked-up components.protected void_doGeneratePDF(Request request)Generate the PDF fileprotected void_generatePDF(Request request)Generates the PDF file.protected void_sendMail(boolean error)Sends an email to the user who has launched the generation of PDFvoidconfigure(Configuration configuration)Configure the engine (called by the scheduler).protected StringgetFailureMailBody()Get the body of mail in case of failureprotected StringgetLanguage()Get the language for exportprotected StringgetMailSubject()Get the subject of mailprotected StringgetSuccessMailBody()Get the body of mail in case of successvoidinitialize(ServiceManager manager, Context context)Initialize the alert engine.static booleanisRunning()Test if the engine is running at the time.voidrun()voidsetCatalog(String code)Set the code of catalogue to generatevoidsetContextualParameters(Map<String,Object> contextualParameters)Set the contextual parametersvoidsetIssuer(User issuer)Set the user who launched the PDF exportprivate static voidsetRunning(boolean running)
-
-
-
Field Detail
-
_LOGGER
protected static final org.slf4j.Logger _LOGGER
The logger.
-
_RUNNING
private static boolean _RUNNING
Is the thread running ?
-
_environmentContext
protected Context _environmentContext
The cocoon environment context.
-
_manager
protected ServiceManager _manager
The service manager.
-
_sourceResolver
protected SourceResolver _sourceResolver
The avalon source resolver.
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils.
-
_catalogRootDirectory
protected File _catalogRootDirectory
The catalog directory.
-
_initialized
protected boolean _initialized
Is the engine initialized ?
-
_contextualParameters
protected Map<String,Object> _contextualParameters
The contextual parameters
-
-
Constructor Detail
-
GeneratePDFEngine
public GeneratePDFEngine()
-
-
Method Detail
-
initialize
public void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException
Initialize the alert engine.- Parameters:
manager- the avalon service manager.context- the avalon context.- Throws:
ContextException- if an error occurs retrieving the environment context.ServiceException- if an error occurs retrieving a component.
-
configure
public void configure(Configuration configuration) throws ConfigurationException
Configure the engine (called by the scheduler).- Parameters:
configuration- the component configuration.- Throws:
ConfigurationException- if an error occurs
-
setContextualParameters
public void setContextualParameters(Map<String,Object> contextualParameters)
Set the contextual parameters- Parameters:
contextualParameters- the contextual parameters
-
setCatalog
public void setCatalog(String code)
Set the code of catalogue to generate- Parameters:
code- the code
-
setIssuer
public void setIssuer(User issuer)
Set the user who launched the PDF export- Parameters:
issuer- the issuer
-
_checkInitialization
protected void _checkInitialization()
Check the initialization and throw an exception if not initialized.
-
isRunning
public static boolean isRunning()
Test if the engine is running at the time.- Returns:
- true if the engine is running, false otherwise.
-
setRunning
private static void setRunning(boolean running)
-
_dispose
protected void _dispose()
Dispose of the resources and looked-up components.
-
_generatePDF
protected void _generatePDF(Request request) throws AmetysRepositoryException, IOException
Generates the PDF file. Checks that there is no current generation process.- Parameters:
request- The request- Throws:
AmetysRepositoryException- if an error occurs.IOException- if an I/O error occurs.
-
_doGeneratePDF
protected void _doGeneratePDF(Request request) throws IOException
Generate the PDF file- Parameters:
request- the request- Throws:
IOException- if an I/O error occurs.
-
getLanguage
protected String getLanguage()
Get the language for export- Returns:
- The language
-
_sendMail
protected void _sendMail(boolean error)
Sends an email to the user who has launched the generation of PDF- Parameters:
error- true if the catalog wasn't generated successfully, false otherwise.
-
getMailSubject
protected String getMailSubject()
Get the subject of mail- Returns:
- the subject
-
getSuccessMailBody
protected String getSuccessMailBody()
Get the body of mail in case of success- Returns:
- the body
-
getFailureMailBody
protected String getFailureMailBody()
Get the body of mail in case of failure- Returns:
- the body
-
-