Package org.ametys.odf.cdmfr
Class AbstractCDMfrProcessor
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.odf.cdmfr.AbstractCDMfrProcessor
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
- Direct Known Subclasses:
DepositCDMfrProcessor
,SendCDMfrProcessor
public abstract class AbstractCDMfrProcessor
extends AbstractLogEnabled
implements Component, Serviceable, Initializable
Processor to process CDM-fr files.
- Filter programs if need
- Iterate on programs
- Generate the CDM-fr file
- Process on the CDM-fr file
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ODFHelper
The ODF helperprotected SourceResolver
The source resolver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStream
_getCDMfrContent
(Program program) Get the CDM-fr of the current program.filterPrograms
(Stream<Program> programs) Filter programs if needed.protected abstract String
Get the configuration parameter name to determine if the process is active.protected abstract String
Get the error message if process fails.void
boolean
isActive()
true
if the process is activeprotected abstract boolean
true
to generate CDM-fr for another Ametys,false
otherwise.protected abstract void
processProgram
(Program program, InputStream cdmfrContent) Process the program and its CDM-fr input stream.void
processPrograms
(Set<Program> programs) Process the CDM-fr of the given programs.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_sourceResolver
The source resolver -
_odfHelper
The ODF helper
-
-
Constructor Details
-
AbstractCDMfrProcessor
public AbstractCDMfrProcessor()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getConfigActiveParam
Get the configuration parameter name to determine if the process is active.- Returns:
- The configuration parameter name
-
isActive
true
if the process is active- Returns:
true
if the process is active
-
processPrograms
Process the CDM-fr of the given programs.- Parameters:
programs
- The programs to process
-
processProgram
protected abstract void processProgram(Program program, InputStream cdmfrContent) throws IOException Process the program and its CDM-fr input stream.- Parameters:
program
- The programcdmfrContent
- The CDM-fr content asInputStream
- Throws:
IOException
- if an exception occurs
-
getErrorMessage
Get the error message if process fails.- Returns:
- the error message
-
filterPrograms
Filter programs if needed.- Parameters:
programs
- The programs to filter- Returns:
- The filtered programs
-
_getCDMfrContent
Get the CDM-fr of the current program.- Parameters:
program
- The program to export as CDM-fr- Returns:
- The
InputStream
with the CDM-fr content - Throws:
IOException
- if an exception occurs
-
isCDMfrForAmetys
true
to generate CDM-fr for another Ametys,false
otherwise.- Returns:
true
to generate CDM-fr for another Ametys instance
-