public abstract class AbstractPilotageReport extends AbstractLogEnabled implements PilotageReport, Serviceable, Initializable, PluginAware
Modifier and Type | Class and Description |
---|---|
static class |
AbstractPilotageReport.PilotageFile
Object representing a pilotage file
Containing the zip file and the report status
|
static class |
AbstractPilotageReport.PilotageReportStatus
The enumerator for different pilotage report status
|
PilotageReport.PilotageReportTarget
Modifier and Type | Field and Description |
---|---|
protected String |
_currentFormattedDate
The current date formatted to yyyy-MM-dd
|
protected I18nUtils |
_i18nUtils
The I18N utils
|
private String |
_mailFrom |
protected ODFHelper |
_odfHelper
The ODF helper
|
protected PilotageHelper |
_pilotageHelper
The pilotage helper
|
private String |
_pluginName |
protected OdfReferenceTableHelper |
_refTableHelper
The ODF enumeration helper
|
protected ReportHelper |
_reportHelper
The report helper
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver
|
protected SourceResolver |
_sourceResolver
The source resolver
|
protected File |
_tmpFolder
The tmp folder
|
protected UserManager |
_userManager
The user manager
|
PARAMETER_CATALOG, PARAMETER_LANG, PARAMETER_ORGUNIT, PARAMETER_PROGRAM
Constructor and Description |
---|
AbstractPilotageReport() |
Modifier and Type | Method and Description |
---|---|
private String |
_buildZipName(String contextName)
Build the ZIP name.
|
protected void |
convertReport(File outputFolder,
String fileName,
File xmlFile)
Convert the report from XML to the required format
|
protected AbstractPilotageReport.PilotageFile |
createZipFile(File folderToZip,
String contextName)
Compress a folder to zip format
|
protected String |
getMailBody(AbstractPilotageReport.PilotageReportStatus status)
The mail body.
|
protected String |
getMailSubject()
The mail subject.
|
protected String |
getPipeline(String outputFolderName)
Build the pipeline to launch the transformation.
|
protected String |
getPluginName()
Get the plugin name to build the pipeline.
|
protected abstract String |
getReportName()
The report name to add in the mail.
|
protected abstract String |
getType()
Get the name of the report
|
void |
initialize() |
void |
launch(PilotageReport.PilotageReportTarget target,
Map<String,String> reportParameters,
UserIdentity user)
Launch a report on the given target with the given parameters.
|
protected abstract String |
launchByOrgUnit(Map<String,String> reportParameters)
Launch a report generation on an orgunit.
|
protected abstract String |
launchByProgram(Map<String,String> reportParameters)
Launch a report generation on a program.
|
protected void |
sendMail(AbstractPilotageReport.PilotageFile file,
UserIdentity user)
Send a mail with the ZIP file as attachment at the end of the report generation.
|
void |
service(ServiceManager manager) |
void |
setPluginInfo(String pluginName,
String featureName,
String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level. |
getLogger, setLogger
protected SourceResolver _sourceResolver
protected PilotageHelper _pilotageHelper
protected AmetysObjectResolver _resolver
protected ReportHelper _reportHelper
protected OdfReferenceTableHelper _refTableHelper
protected ODFHelper _odfHelper
protected UserManager _userManager
protected I18nUtils _i18nUtils
protected File _tmpFolder
protected String _currentFormattedDate
private String _pluginName
public AbstractPilotageReport()
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentpublic void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
protected abstract String launchByOrgUnit(Map<String,String> reportParameters) throws Exception
reportParameters
- The report parametersException
- if an exception occursprotected abstract String launchByProgram(Map<String,String> reportParameters) throws Exception
reportParameters
- The report parametersException
- if an exception occursprotected String getPluginName()
protected String getPipeline(String outputFolderName)
outputFolderName
- The name of the output folder namepublic void launch(PilotageReport.PilotageReportTarget target, Map<String,String> reportParameters, UserIdentity user)
PilotageReport
launch
in interface PilotageReport
target
- The target of the reportreportParameters
- The report parametersuser
- The current userprotected void convertReport(File outputFolder, String fileName, File xmlFile) throws IOException
outputFolder
- folder where the file will stay temporarilyfileName
- the name of the filexmlFile
- the file to be convertedIOException
- if an error occursprotected AbstractPilotageReport.PilotageFile createZipFile(File folderToZip, String contextName) throws IOException
folderToZip
- the folder to be compressedcontextName
- the name of the report contextIOException
- if an exception occursprotected void sendMail(AbstractPilotageReport.PilotageFile file, UserIdentity user)
file
- the pilotage fileuser
- the recipient if he has an emailprotected String getMailSubject()
protected String getMailBody(AbstractPilotageReport.PilotageReportStatus status)
status
- the status of the pilotage reportprotected abstract String getReportName()
private String _buildZipName(String contextName)
contextName
- The report context name