Class AbstractTppProcessingStep
java.lang.Object
es.uvigo.esei.sing.textproc.step.AbstractProcessingStep
es.uvigo.esei.sing.textproc.abstracttppstep.AbstractTppProcessingStep
- All Implemented Interfaces:
es.uvigo.esei.sing.textproc.step.internal.ProcessingStepInterface
public abstract class AbstractTppProcessingStep extends AbstractProcessingStep
Handles common processing logic to all processing steps that call the Text
Processing Python web service for processing documents.
- Author:
- Alejandro González García
-
Nested Class Summary
Nested classes/interfaces inherited from class es.uvigo.esei.sing.textproc.step.AbstractProcessingStep
AbstractProcessingStep.NullProcessingConsumer<T>, AbstractProcessingStep.ProcessingConsumer<T>
-
Field Summary
Fields inherited from class es.uvigo.esei.sing.textproc.step.AbstractProcessingStep
BATCH_SIZE_STEP_PARAMETER_NAME, DATA_ACCESS_EXCEPTION_MESSAGE, DEFAULT_BATCH_SIZE_STEP_PARAMETER, DEFAULT_PAGE_SIZE_STEP_PARAMETER, DEFAULT_PRIMARY_KEY_COLUMN_PROCESSING_STEP_PARAMETER, DEFAULT_TEXT_COLUMN_PROCESSING_STEP_PARAMETER, DEFAULT_TITLE_COLUMN_PROCESSING_STEP_PARAMETER, numberOfUnprocessedEntitiesProviders, PAGE_SIZE_STEP_PARAMETER_NAME, PRIMARY_KEY_COLUMN_PROCESSING_STEP_PARAMETER_NAME, TEXT_COLUMN_PROCESSING_STEP_PARAMETER_NAME, TEXT_DOCUMENT_TABLE_NAME_PROCESSING_STEP_PARAMETER_NAME, TEXT_DOCUMENT_WITH_TITLE_TABLE_NAME_PROCESSING_STEP_PARAMETER_NAME, TITLE_COLUMN_PROCESSING_STEP_PARAMETER_NAME, unprocessedDocumentsAttributes, unprocessedDocumentsQuerySuppliers, unprocessedDocumentTypesNames
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTppProcessingStep(java.util.Map<java.lang.String,java.util.function.Predicate<java.lang.String>> validationPredicates, java.util.Set<java.lang.String> requiredParameters, @NonNull java.util.List<java.lang.Class<? extends ProcessedDocument>> processedDocumentTypes, @NonNull java.lang.String stepDescriptionFormatString, @NonNull JsonResponseAttributeType jsonResponseAttributeType, @NonNull AbstractProcessingStep.ProcessingConsumer<? super javax.json.stream.JsonGenerator> requestParametersAction, @NonNull ProcessingBiConsumer<? super java.util.Map.Entry<java.lang.String,javax.json.JsonObject>,? super java.util.Map<java.lang.String,java.lang.String>> storeProcessedAttributeAction)
Creates a new processing step that processes documents via calls to the Text Processing Python web service. -
Method Summary
Modifier and Type Method Description protected void
run()
Executes the processing step implemented by this object.Methods inherited from class es.uvigo.esei.sing.textproc.step.AbstractProcessingStep
buildUnprocessedDocumentSelectStatement, buildUnprocessedDocumentWithTitleSelectStatement, deleteAllProcessedDocumentsOfType, execute, forEachDocumentInNativeQuery, getParameters, getUnprocessedDocuments, getUnprocessedDocumentsWithTitle, saveProcessedDocument
-
Constructor Details
-
AbstractTppProcessingStep
protected AbstractTppProcessingStep(java.util.Map<java.lang.String,java.util.function.Predicate<java.lang.String>> validationPredicates, java.util.Set<java.lang.String> requiredParameters, @NonNull @NonNull java.util.List<java.lang.Class<? extends ProcessedDocument>> processedDocumentTypes, @NonNull @NonNull java.lang.String stepDescriptionFormatString, @NonNull @NonNull JsonResponseAttributeType jsonResponseAttributeType, @NonNull @NonNull AbstractProcessingStep.ProcessingConsumer<? super javax.json.stream.JsonGenerator> requestParametersAction, @NonNull @NonNull ProcessingBiConsumer<? super java.util.Map.Entry<java.lang.String,javax.json.JsonObject>,? super java.util.Map<java.lang.String,java.lang.String>> storeProcessedAttributeAction)Creates a new processing step that processes documents via calls to the Text Processing Python web service.- Parameters:
validationPredicates
- A map with additional parameter validation predicates, specific to the concrete processing step.requiredParameters
- A set with additional mandatory parameters, specific to this processing step.processedDocumentTypes
- The processed entity types generated by the particular processing step. At the moment, this must be a list of two processed document types, where the first one is interpreted as the resulting type for titled documents, and the second one is the resulting type for untitled documents. The format of this list may be changed in the future if more unprocessed document types are added.stepDescriptionFormatString
- A format string (as defined byFormatter
) that will be used for generating a user-friendly step activity description string. It will receive a single string parameter with the name of the unprocessed entity that is being processed.jsonResponseAttributeType
- The expected JSON type of processed document attributes in the web service response.requestParametersAction
- The action to execute to populate the request object with parameters, after the documents object.storeProcessedAttributeAction
- An action that receives the JSON document object of the response, and is expected to put its processed form in the provided map.- Throws:
java.lang.IllegalArgumentException
- If any parameter isnull
or invalid.
-
-
Method Details
-
run
Description copied from class:AbstractProcessingStep
Executes the processing step implemented by this object. The processing step parameters are already validated and available upon request onAbstractProcessingStep.getParameters()
. This method is invoked in the context of a JPA transaction that is started and committed or rolled back automatically.- Specified by:
run
in classAbstractProcessingStep
- Throws:
ProcessingException
- If an exception occurs during execution.
-