Class ExtractionExecutor
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.extraction.execution.ExtractionExecutor
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class ExtractionExecutor extends AbstractLogEnabled implements Component, Serviceable
Extracts query results form a XML definition file
-
-
Field Summary
Fields Modifier and Type Field Description private ContentTypeExtensionPoint
_contentTypeExtensionPoint
private ContentTypesHelper
_contentTypesHelper
private CurrentUserProvider
_currentUserProvider
private ExtractionDefinitionReader
_reader
private AmetysObjectResolver
_resolver
private PathResolver
_resultPathResolver
private RightManager
_rightManager
private SourceResolver
_sourceResolver
static String
EXTRACTION_DIR_NAME
The directory under ametys home data directory for extraction resultsstatic String
ROLE
The Avalon role.
-
Constructor Summary
Constructors Constructor Description ExtractionExecutor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_checkRights()
private void
_doExecute(AttributesImpl attributes, Extraction extraction, String extractionName, ExtractionExecutionContext context, String defaultResultFileName, PipelineDescriptor pipeline)
private void
_doExecuteForPathWithNoVar(AttributesImpl attributes, Extraction extraction, ExtractionExecutionContext context, OutputStream outputStream, PipelineDescriptor pipelineDescriptor)
private void
_doExecuteForPathWithVar(AttributesImpl attributes, Extraction extraction, ExtractionExecutionContext context, List<TwoStepsExecutingExtractionComponent> components, Path basePath, String unresolvedPath, PipelineDescriptor pipelineDescriptor)
private void
_execute(String fileName, String defaultResultFileName, OutputStream resultOutputStream, String lang, Map<String,Object> parameters, PipelineDescriptor pipeline)
private Path
_filePathWhenNoVar(Path fileOrFolderPath, String defaultFileName)
private AttributesImpl
_getAttrs(String definitionFilename)
private ExtractionExecutionContext
_getContext(Extraction extraction, String lang, Map<String,Object> parameters)
private Boolean
_getDipslayOptionalColumn(String optionalColumnName, Map<String,Object> parameters)
(package private) Map<String,Boolean>
_getDisplayOptionalColumns(List<String> displayOptionalColumnsNames, Map<String,Object> parameters)
private Pair<Extraction,String>
_getExtraction(String fileName)
private Map<String,String>
_getQueryVariables(Map<String,String> queryVariablesNamesAndContentTypes, Map<String,Object> parameters)
private void
_noVarExecute(ContentHandler contentHandler, AttributesImpl attributes, Extraction extraction, ExtractionExecutionContext context)
private String
_unresolvedFilePathWhenVar(String unresolvedFolderOrFilePath, PipelineDescriptor pipelineDescriptor)
private void
_withVarExecute(ContentHandler contentHandler, AttributesImpl attributes, ExtractionExecutionContext context, List<TwoStepsExecutingExtractionComponent> components, List<Content> involvedContentsForPath, Map<TwoStepsExecutingExtractionComponent,List<Content>> firstLevelResultsByComponent)
void
execute(String fileName, OutputStream resultOutputStream, String lang, Map<String,Object> parameters, PipelineDescriptor pipeline)
Executes the given extractionvoid
execute(String fileName, String defaultResultFileName, String lang, Map<String,Object> parameters, PipelineDescriptor pipeline)
Executes the given extractionvoid
service(ServiceManager serviceManager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
EXTRACTION_DIR_NAME
public static final String EXTRACTION_DIR_NAME
The directory under ametys home data directory for extraction results- See Also:
- Constant Field Values
-
_rightManager
private RightManager _rightManager
-
_reader
private ExtractionDefinitionReader _reader
-
_currentUserProvider
private CurrentUserProvider _currentUserProvider
-
_contentTypeExtensionPoint
private ContentTypeExtensionPoint _contentTypeExtensionPoint
-
_resolver
private AmetysObjectResolver _resolver
-
_contentTypesHelper
private ContentTypesHelper _contentTypesHelper
-
_sourceResolver
private SourceResolver _sourceResolver
-
_resultPathResolver
private PathResolver _resultPathResolver
-
-
Constructor Detail
-
ExtractionExecutor
public ExtractionExecutor()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
execute
public void execute(String fileName, String defaultResultFileName, String lang, Map<String,Object> parameters, PipelineDescriptor pipeline) throws Exception
Executes the given extraction- Parameters:
fileName
- The name of the extraction file to executedefaultResultFileName
- The default file name for the result (it can be unused, for instance if resultSubFolder is a file, i.e. contains a '.' in its last element)lang
- The langparameters
- The parameterspipeline
- The execution pipeline- Throws:
Exception
- if an errors occured
-
execute
public void execute(String fileName, OutputStream resultOutputStream, String lang, Map<String,Object> parameters, PipelineDescriptor pipeline) throws Exception
Executes the given extraction- Parameters:
fileName
- The name of the extraction file to executeresultOutputStream
- The result output streamlang
- The langparameters
- The parameterspipeline
- The execution pipeline- Throws:
Exception
- if an errors occured
-
_execute
private void _execute(String fileName, String defaultResultFileName, OutputStream resultOutputStream, String lang, Map<String,Object> parameters, PipelineDescriptor pipeline) throws Exception
- Throws:
Exception
-
_checkRights
private void _checkRights()
-
_getExtraction
private Pair<Extraction,String> _getExtraction(String fileName) throws Exception
- Throws:
Exception
-
_getAttrs
private AttributesImpl _getAttrs(String definitionFilename)
-
_getContext
private ExtractionExecutionContext _getContext(Extraction extraction, String lang, Map<String,Object> parameters)
-
_getDisplayOptionalColumns
Map<String,Boolean> _getDisplayOptionalColumns(List<String> displayOptionalColumnsNames, Map<String,Object> parameters)
-
_getDipslayOptionalColumn
private Boolean _getDipslayOptionalColumn(String optionalColumnName, Map<String,Object> parameters)
-
_getQueryVariables
private Map<String,String> _getQueryVariables(Map<String,String> queryVariablesNamesAndContentTypes, Map<String,Object> parameters)
-
_doExecute
private void _doExecute(AttributesImpl attributes, Extraction extraction, String extractionName, ExtractionExecutionContext context, String defaultResultFileName, PipelineDescriptor pipeline) throws Exception
- Throws:
Exception
-
_filePathWhenNoVar
private Path _filePathWhenNoVar(Path fileOrFolderPath, String defaultFileName)
-
_doExecuteForPathWithNoVar
private void _doExecuteForPathWithNoVar(AttributesImpl attributes, Extraction extraction, ExtractionExecutionContext context, OutputStream outputStream, PipelineDescriptor pipelineDescriptor) throws Exception
- Throws:
Exception
-
_noVarExecute
private void _noVarExecute(ContentHandler contentHandler, AttributesImpl attributes, Extraction extraction, ExtractionExecutionContext context) throws Exception
- Throws:
Exception
-
_doExecuteForPathWithVar
private void _doExecuteForPathWithVar(AttributesImpl attributes, Extraction extraction, ExtractionExecutionContext context, List<TwoStepsExecutingExtractionComponent> components, Path basePath, String unresolvedPath, PipelineDescriptor pipelineDescriptor) throws Exception
- Throws:
Exception
-
_unresolvedFilePathWhenVar
private String _unresolvedFilePathWhenVar(String unresolvedFolderOrFilePath, PipelineDescriptor pipelineDescriptor)
-
_withVarExecute
private void _withVarExecute(ContentHandler contentHandler, AttributesImpl attributes, ExtractionExecutionContext context, List<TwoStepsExecutingExtractionComponent> components, List<Content> involvedContentsForPath, Map<TwoStepsExecutingExtractionComponent,List<Content>> firstLevelResultsByComponent) throws Exception
- Throws:
Exception
-
-