51Degrees Pipeline .NET  4.1

51Degrees Pipeline for .NET

FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement Class Reference

Detailed Description

The JsonBuilderElement takes accessible properties and adds the property key:values to the Json object.

The element will also add any errors which have been recorded in the FlowData.

Inheritance diagram for FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement:

[legend]

Collaboration diagram for FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement:

[legend]

Public Member Functions

 JsonBuilderElement (ILogger< JsonBuilderElement > logger, IEnumerable< JsonConverter > jsonConverters, Func< IPipeline, FlowElementBase< IJsonBuilderElementData, IElementPropertyMetaData >, IJsonBuilderElementData > elementDataFactory)
Constructor More...

Public Member Functions inherited from FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IJsonBuilderElementData, IElementPropertyMetaData >

 FlowElementBase (ILogger< FlowElementBase< T, TMeta >> logger)
Constructor More...
 FlowElementBase (ILogger< FlowElementBase< T, TMeta >> logger, Func< IPipeline, FlowElementBase< T, TMeta >, T > elementDataFactory)
Constructor More...
virtual void  Process (IFlowData data)
Process the given IFlowData with this FlowElement. More...
virtual void  AddPipeline (IPipeline pipeline)
Called when this element is added to a pipeline. More...
void  Dispose ()
Dispose More...

Public Attributes

override string  ElementDataKey => "json-builder"
The key to identify this engine's element data instance within IFlowData. More...
override IEvidenceKeyFilter  EvidenceKeyFilter
A filter that identifies the evidence items that this element can make use of. More...
override IList< IElementPropertyMetaData >  Properties
The meta-data for the properties populated by this element. More...

Protected Member Functions

override void  ManagedResourcesCleanup ()
Cleanup of an managed resources. More...
override void  ProcessInternal (IFlowData data)
Transform the data in the flow data instance into a JSON object. More...
virtual string  BuildJson (IFlowData data)
Create and populate a JSON string from the specified data. More...
override void  UnmanagedResourcesCleanup ()
Cleanup any unmanaged resources More...
virtual Dictionary< String, object >  GetAllProperties (IFlowData data)
Get all the proeprties. More...
virtual IList< string >  GetJavaScriptProperties (IFlowData data, IList< string > availableProperties)
Get the names of all properties from the given IFlowData instance that have type 'JavaScript'. More...

Protected Member Functions inherited from FiftyOne.Pipeline.Core.FlowElements.FlowElementBase< IJsonBuilderElementData, IElementPropertyMetaData >

abstract void  ProcessInternal (IFlowData data)
Abstract method called by Process(IFlowData). More...
virtual T  CreateElementData (IPipeline pipeline)
Method used to create element data instances that are populated by this flow element More...
virtual void  Dispose (bool disposing)
Dispose of any resources. More...

Static Protected Member Functions

static string  BuildJson (Dictionary< string, object > allProperties)
Build the JSON More...
static void  AddErrors (IFlowData data, Dictionary< String, object > allProperties)
Add any errors in the flow data object to the dictionary More...
static int  GetSequenceNumber (IFlowData data)
Get the sequence number from the evidence. More...

Constructor & Destructor Documentation

◆ JsonBuilderElement()

FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.JsonBuilderElement ( ILogger< JsonBuilderElement >   logger,
IEnumerable< JsonConverter >   jsonConverters,
Func< IPipeline, FlowElementBase< IJsonBuilderElementData, IElementPropertyMetaData >, IJsonBuilderElementData >   elementDataFactory  
)

Constructor

Parameters
logger - The logger for this instance to use.
jsonConverters - A collection of JsonConverter instances that will be used when serializing the data.
elementDataFactory - The factory function to use when creating a new element data instance.

Member Function Documentation

◆ AddErrors()

static void FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.AddErrors ( IFlowData   data,
Dictionary< String, object >   allProperties  
)
static protected

Add any errors in the flow data object to the dictionary

Parameters
data -
allProperties -
Exceptions
ArgumentNullException - Thrown if one of the supplied parameters is null

◆ BuildJson() [1/2]

virtual string FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.BuildJson ( IFlowData   data )
protected virtual

Create and populate a JSON string from the specified data.

Parameters
data -
Returns
A string containing the data in JSON format.

◆ BuildJson() [2/2]

static string FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.BuildJson ( Dictionary< string, object >   allProperties )
static protected

Build the JSON

Parameters
allProperties - A dictionary containing the data to convert to JSON. Key is the element data key. Value is a
Dictionary\<string, object\>
containing the property names and values for that element.
Returns

◆ GetAllProperties()

virtual Dictionary<String, object> FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.GetAllProperties ( IFlowData   data )
protected virtual

Get all the proeprties.

Parameters
data -
Returns
Exceptions
ArgumentNullException - Thrown if the supplied flow data is null.

◆ GetJavaScriptProperties()

virtual IList<string> FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.GetJavaScriptProperties ( IFlowData   data,
IList< string >   availableProperties  
)
protected virtual

Get the names of all properties from the given IFlowData instance that have type 'JavaScript'.

Parameters
data - The IFlowData to get properties from.
availableProperties - A list of the full string names (i.e. prefixed with the element data key for the element that populates that property) of the available properties in dot-separated format.
Returns
A list of the full string names of the properties that are of type 'JavaScript'
Exceptions
ArgumentNullException - Thrown if the supplied flow data is null.

◆ GetSequenceNumber()

static int FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.GetSequenceNumber ( IFlowData   data )
static protected

Get the sequence number from the evidence.

Parameters
data -
Returns
Exceptions
ArgumentNullException - Thrown if the supplied flow data is null.
PipelineException - Thrown if sequence number is not present in the evidence.

◆ ProcessInternal()

override void FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.ProcessInternal ( IFlowData   data )
protected

Transform the data in the flow data instance into a JSON object.

Parameters
data - The IFlowData
Exceptions
ArgumentNullException - Thrown if the supplied flow data is null.

Member Data Documentation

◆ ElementDataKey

override string FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.ElementDataKey => "json-builder"

The key to identify this engine's element data instance within IFlowData.

◆ EvidenceKeyFilter

override IEvidenceKeyFilter FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.EvidenceKeyFilter
Initial value:
=>
_evidenceKeyFilter

A filter that identifies the evidence items that this element can make use of.

JsonBuilder does not make use of any evidence so this filter will never match anything.

◆ Properties

override IList<IElementPropertyMetaData> FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.Properties
Initial value:
=>
_properties

The meta-data for the properties populated by this element.