51Degrees Pipeline for Node.js

FlowElement Class Reference

Detailed Description

A FlowElement is placed inside a pipeline It receives Evidence via a FlowData object It uses this to optionally create ElementData on the Flowdata It has a unique dataKey which is used to extract data from the FlowData Any errors in processing are caught in the FlowData's errors object.

Examples
clientSideEvidenceFlowElement.js, and simpleEvidenceFlowElement.js.

Inheritance diagram for FlowElement:

[legend]

Public Member Functions

 constructor ({ processInternal, dataKey, properties={}, evidenceKeyFilter }={})
 Constructor for flowElement class.
 onRegistration (pipeline, flowElement)
 Internal function to be called when a FlowElement is added to pipeline, runs through any registrationCallbacks on the FlowElement.
 ready ()
 Function called to check if a FlowElement is ready Used when there are asynchronous initialisation steps.
 processInternal (flowData)
 Internal process function for a particular flowElement called (via the flowElement.process() method) when flowData generated by a pipleline is processsed.
 process (flowData)
 To allow actions to take place before and after a FlowElement's processInternal function runs, a process wrapper is run first.
 updateProperties ()
 Call this function to update the properties meta database in all the pipelines this flowElement has been added to.
 getProperties ()
 Get a flowElement's properties.
 _log (type, message)
 Internal log.

Member Function Documentation

◆ _log()

FlowElement::_log ( type,
message )
inline

Internal log.

Parameters
{string}type log type
{*}message message to log

◆ constructor()

FlowElement::constructor ( { processInternal, dataKey, properties={}, evidenceKeyFilter } = {})
inline

Constructor for flowElement class.

Parameters
{object}options options for the FlowElement
{string}options.dataKey the dataKey the flowElement's elementData will be stored under
{Function}options.processInternal callback to act on flowData
{object}options.properties list of properties including metadata
{EvidenceKeyFilter}options.evidenceKeyFilter an instance of an EvidenceKeyFilter to filter evidence added to the Pipeline

@type {Function[]}

@type {Pipeline[]}

◆ getProperties()

FlowElement::getProperties ( )
inline

Get a flowElement's properties.

By default returns a promise wrapped version of the object's properties list Can return standard value or promise

Returns
{object} dictionary of properties

◆ onRegistration()

FlowElement::onRegistration ( pipeline,
flowElement )
inline

Internal function to be called when a FlowElement is added to pipeline, runs through any registrationCallbacks on the FlowElement.

Parameters
{Pipeline}pipeline the Pipeline the FlowElement is registered with
{FlowElement}flowElement The FlowElement the registration callback is called on

◆ process()

FlowElement::process ( flowData)
inline

To allow actions to take place before and after a FlowElement's processInternal function runs, a process wrapper is run first.

Parameters
{FlowData}flowData FlowData being processed
Returns
{Promise} FlowData after processing

◆ processInternal()

FlowElement::processInternal ( flowData)
inline

Internal process function for a particular flowElement called (via the flowElement.process() method) when flowData generated by a pipleline is processsed.

Overriden by instances of this base class

Parameters
{FlowData}flowData FlowData being processed
Returns
{*} result of processing

◆ ready()

FlowElement::ready ( )
inline

Function called to check if a FlowElement is ready Used when there are asynchronous initialisation steps.

Returns
{Promise} returns Promise

◆ updateProperties()

FlowElement::updateProperties ( )
inline

Call this function to update the properties meta database in all the pipelines this flowElement has been added to.

Returns
{Promise} notification of complete updates