Open Journal Systems
3.3.0
|
Static Public Member Functions | |
static | supportedRuntimeEnvironmentSettings () |
Data Fields | |
$_errors = array() | |
$_input | |
$_inputType | |
$_output | |
$_outputType | |
$_runtimeEnvironment = false | |
Data Fields inherited from DataObject | |
$_data = array() | |
$_extractionAdaptersLoaded = false | |
$_hasLoadableAdapters = false | |
$_injectionAdaptersLoaded = false | |
$_metadataExtractionAdapters = array() | |
$_metadataInjectionAdapters = array() | |
Class that provides the basic template for a filter. Filters are generic data processors that take in a well-specified data type and return another well-specified data type.
Filters enable us to re-use data transformations between applications. Generic filter implementations can sequence, (de-)multiplex or iterate over other filters. Thereby filters can be nested and combined in many different ways to form complex and easy-to-customize data processing networks or pipelines.
NB: This also means that filters only make sense if they accept and return standardized formats that are understood by other filters. Otherwise the extra implementation effort for a filter won't result in improved code re-use.
Objects from different applications (e.g. Papers and Articles) can first be transformed by an application specific filter into a common format and then be processed by application agnostic import/export filters or vice versa. Filters can be used to pre-process data before it is indexed for search. They also provide a framework to customize the processing applied in citation parsing and lookup (i.e. which parsers and lookup sources should be applied).
Filters can be used stand-alone outside PKP applications.
The following is a complete list of all use-cases that have been identified for filters: 1) Decode/Encode
2) Normalize
3) Map
4) Convert documents
5) Search
Definition at line 78 of file Filter.inc.php.
Filter::__construct | ( | $inputType, | |
$outputType | |||
) |
Constructor
Receives input and output type that define the transformation.
$inputType | string a string representation of a TypeDescription |
$outputType | string a string representation of a TypeDescription |
Reimplemented in CrosswalkFilter, MetadataDataObjectAdapter, and XSLTransformationFilter.
Definition at line 127 of file Filter.inc.php.
References setTransformationType().
Filter::addError | ( | $message | ) |
Add a filter error
$message | string |
Definition at line 265 of file Filter.inc.php.
Referenced by UserXmlPKPUserFilter\importUserPasswordValidation(), UserXmlPKPUserFilter\parseUser(), GenericSequencerFilter\process(), and GenericMultiplexerFilter\process().
Filter::clearErrors | ( | ) |
Clear all processing errors.
Definition at line 288 of file Filter.inc.php.
& Filter::execute | ( | & | $input, |
$returnErrors = false |
|||
) |
Filters the given input.
Input and output of this method will be tested for compliance with the filter definition.
NB: sub-classes will not normally override this method.
$input | mixed an input value that is supported by this filter |
$returnErrors | boolean whether the value should be returned also if an error occurred |
Definition at line 444 of file Filter.inc.php.
References $_output, HookRegistry\call(), fatalError(), isCompatibleWithRuntimeEnvironment(), process(), strtolower_codesafe(), supports(), and supportsAsInput().
Filter::getDisplayName | ( | ) |
Get the display name
NB: The standard implementation of this method will initialize the display name with the filter class name. Subclasses can of course override this behavior by explicitly setting a display name.
Definition at line 155 of file Filter.inc.php.
References DataObject\getData(), DataObject\hasData(), and DataObject\setData().
Filter::getErrors | ( | ) |
Get all filter errors
Definition at line 273 of file Filter.inc.php.
References $_errors.
& Filter::getInputType | ( | ) |
Get the input type
Definition at line 209 of file Filter.inc.php.
References $_inputType.
Referenced by MetadataDataObjectAdapter\__construct(), NativeExportFilter\supports(), and supports().
& Filter::getLastInput | ( | ) |
Get the last valid input processed by this filter.
This can be used for debugging internal filter state or for access to intermediate results when working with larger filter grids.
NB: The input will be set only after input validation so that you can be sure that you'll always find valid data here.
Definition at line 257 of file Filter.inc.php.
References $_input.
& Filter::getLastOutput | ( | ) |
Get the last valid output produced by this filter.
This can be used for debugging internal filter state or for access to intermediate results when working with larger filter grids.
NB: The output will be set only after output validation so that you can be sure that you'll always find valid data here.
Definition at line 237 of file Filter.inc.php.
References $_output.
& Filter::getOutputType | ( | ) |
Get the output type
Definition at line 217 of file Filter.inc.php.
References $_outputType.
Referenced by MetadataDataObjectAdapter\__construct(), NativeExportFilter\supports(), and supports().
& Filter::getRuntimeEnvironment | ( | ) |
Get the required runtime environment
Definition at line 313 of file Filter.inc.php.
References $_runtimeEnvironment.
Filter::getSequence | ( | ) |
Get the sequence id
Definition at line 175 of file Filter.inc.php.
References DataObject\getData().
Filter::hasErrors | ( | ) |
Whether this filter has produced errors.
Definition at line 281 of file Filter.inc.php.
Filter::isCompatibleWithRuntimeEnvironment | ( | ) |
Check whether the filter is compatible with the required runtime environment.
Reimplemented in CompositeFilter.
Definition at line 393 of file Filter.inc.php.
References DataObject\getData(), DataObject\hasData(), and supportedRuntimeEnvironmentSettings().
Referenced by execute().
& Filter::process | ( | & | $input | ) |
This method performs the actual data processing. NB: sub-classes must implement this method.
$input | mixed validated filter input data |
Reimplemented in XSLTransformationFilter, PKPUserUserXmlFilter, UserGroupNativeXmlFilter, ArticlePubMedXmlFilter, SubmissionNativeXmlFilter, SubmissionFileNativeXmlFilter, RepresentationNativeXmlFilter, ArticleMedraXmlFilter, IssueMedraXmlFilter, DOAJXmlFilter, IssueCrossrefXmlFilter, DataciteXmlFilter, DOAJJsonFilter, IssueNativeXmlFilter, IssueGalleyNativeXmlFilter, MetadataDataObjectAdapter, GenericMultiplexerFilter, TemplateBasedFilter, GenericSequencerFilter, CitationListTokenizerFilter, PKPPublicationNativeXmlFilter, NativeXmlArticleFilter, NativeImportFilter, and PKPAuthorNativeXmlFilter.
Definition at line 328 of file Filter.inc.php.
Referenced by execute().
Filter::setDisplayName | ( | $displayName | ) |
Set the display name
$displayName | string |
Definition at line 140 of file Filter.inc.php.
References DataObject\setData().
Referenced by ArticleCrossrefXmlFilter\__construct(), IssueCrossrefXmlFilter\__construct(), NativeXmlIssueGalleyFilter\__construct(), NativeXmlPKPAuthorFilter\__construct(), NativeXmlPKPPublicationFilter\__construct(), SubmissionFileNativeXmlFilter\__construct(), NativeXmlRepresentationFilter\__construct(), PKPUserUserXmlFilter\__construct(), IssueGalleyNativeXmlFilter\__construct(), PKPAuthorNativeXmlFilter\__construct(), NativeXmlSubmissionFileFilter\__construct(), NativeXmlSubmissionFilter\__construct(), NativeXmlUserGroupFilter\__construct(), CitationListTokenizerFilter\__construct(), IssueNativeXmlFilter\__construct(), PKPPublicationNativeXmlFilter\__construct(), RepresentationNativeXmlFilter\__construct(), UserXmlPKPUserFilter\__construct(), NativeXmlIssueFilter\__construct(), UserGroupNativeXmlFilter\__construct(), ArticleMedraXmlFilter\__construct(), IssueMedraXmlFilter\__construct(), GalleyMedraXmlFilter\__construct(), DOAJXmlFilter\__construct(), DOAJJsonFilter\__construct(), SubmissionNativeXmlFilter\__construct(), MetadataDescriptionDummyAdapter\__construct(), XSLTransformationFilter\__construct(), CompositeFilter\__construct(), DataciteXmlFilter\__construct(), and MetadataDataObjectAdapter\__construct().
Filter::setRuntimeEnvironment | ( | & | $runtimeEnvironment | ) |
Set the required runtime environment
$runtimeEnvironment | RuntimeEnvironment |
Definition at line 296 of file Filter.inc.php.
References DataObject\setData(), and supportedRuntimeEnvironmentSettings().
Filter::setSequence | ( | $seq | ) |
Set the sequence id
$seq | integer |
Definition at line 167 of file Filter.inc.php.
References DataObject\setData().
Filter::setTransformationType | ( | & | $inputType, |
& | $outputType | ||
) |
Set the input/output type of this filter group.
$inputType | TypeDescription|string |
$outputType | TypeDescription|string |
Definition at line 187 of file Filter.inc.php.
References TypeDescriptionFactory\getInstance().
Referenced by __construct().
|
static |
Returns a static array with supported runtime environment settings and their default values.
Definition at line 489 of file Filter.inc.php.
Referenced by isCompatibleWithRuntimeEnvironment(), and setRuntimeEnvironment().
Filter::supports | ( | & | $input, |
& | $output | ||
) |
Returns true if the given input and output objects represent a valid transformation for this filter.
This check must be type based. It can optionally include an additional stateful inspection of the given object instances.
If the output type is null then only check whether the given input type is one of the input types accepted by this filter.
The standard implementation provides full type based checking. Subclasses must implement any required stateful inspection of the provided objects.
$input | mixed |
$output | mixed |
Reimplemented in NativeExportFilter.
Definition at line 358 of file Filter.inc.php.
References getInputType(), and getOutputType().
Referenced by execute(), and supportsAsInput().
Filter::supportsAsInput | ( | & | $input | ) |
Returns true if the given input is supported by this filter. Otherwise returns false.
NB: sub-classes will not normally override this method.
$input | mixed |
Definition at line 383 of file Filter.inc.php.
References supports().
Referenced by execute().
array Filter::$_errors = array() |
a list of errors occurred while filtering
Definition at line 107 of file Filter.inc.php.
Referenced by getErrors().
mixed Filter::$_input |
Definition at line 95 of file Filter.inc.php.
Referenced by getLastInput().
TypeDescription Filter::$_inputType |
Definition at line 83 of file Filter.inc.php.
Referenced by getInputType().
mixed Filter::$_output |
Definition at line 101 of file Filter.inc.php.
Referenced by execute(), and getLastOutput().
TypeDescription Filter::$_outputType |
Definition at line 89 of file Filter.inc.php.
Referenced by getOutputType().
RuntimeEnvironment Filter::$_runtimeEnvironment = false |
the installation requirements required to run this filter instance, false on initialization.
Definition at line 116 of file Filter.inc.php.
Referenced by getRuntimeEnvironment().