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]

Classes

class  PipelineConfig
Contains configuration information relating to a particular pipeline. More...

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, PipelineConfig config)
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, PipelineConfig config)
Get all the properties. More...
virtual Dictionary< string, object >  GetValues (IFlowData flowData, string dataPath, IReadOnlyDictionary< string, object > sourceData, PipelineConfig config)
Get the names and values for all the JSON properties required to represent the given source data. More...
virtual void  AddJsonValuesForProperty (IFlowData flowData, Dictionary< string, object > jsonValues, string dataPath, string name, object value, PipelineConfig config, bool includeValueDataOnly)
Add entries to the supplied jsonValues dictionary to represent the supplied property name and value. 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

◆ AddJsonValuesForProperty()

virtual void FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.AddJsonValuesForProperty ( IFlowData   flowData,
Dictionary< string, object >   jsonValues,
string   dataPath,
string   name,
object   value,
PipelineConfig   config,
bool   includeValueDataOnly  
)
protected virtual

Add entries to the supplied jsonValues dictionary to represent the supplied property name and value.

Parameters
flowData - The IFlowData for the current request.
jsonValues - A dictionary containing the key/value pairs that are going to appear in the JSON output. This method will add new entries to this dictionary for the supplied property.
dataPath - The . separated name of the container that the supplied property will be added to. For example, 'location' or 'devices.profiles'
name - The name of the property to add to jsonValues.
value - The value of the property to add to jsonValues.
config - The configuration to use.
includeValueDataOnly - Flag used to indicate if additional meta-data properties should be written or not. These are needed when the JSON is going to be used by the JavaScriptBuilderElement to generate content for use on the client. They are not needed to simply serialize the values stored in aspect properties.
Exceptions
ArgumentNullException - Thrown if required parameters are null

◆ BuildJson() [1/2]

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

Create and populate a JSON string from the specified data.

Parameters
data -
config - The configuration to use
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,
PipelineConfig   config  
)
protected virtual

Get all the properties.

Parameters
data -
config - The configuration to use
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.

◆ GetValues()

virtual Dictionary<string, object> FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.GetValues ( IFlowData   flowData,
string   dataPath,
IReadOnlyDictionary< string, object >   sourceData,
PipelineConfig   config  
)
protected virtual

Get the names and values for all the JSON properties required to represent the given source data.

The method adds meta-properties as required such as *nullreason, *delayexecution, etc.

Parameters
flowData - The IFlowData for the current request.
dataPath - The . separated name of the container that the supplied data will be added to. For example, 'location' or 'devices.profiles'
sourceData - The source data to use when populating the result.
config - The configuration to use.
Returns
A new dictionary with string keys and object values.
Exceptions
ArgumentNullException - Thrown if required parameters are null
protected virtual

Get the names and values for all the JSON properties required to represent the given source data.

The method adds meta-properties as required such as *nullreason, *delayexecution, etc.

Parameters
flowData - The IFlowData for the current request.
dataPath - The . separated name of the container that the supplied data will be added to. For example, 'location' or 'devices.profiles'
sourceData - The source data to use when populating the result.
config - The configuration to use.
Returns
A new dictionary with string keys and object values.
Exceptions
ArgumentNullException - Thrown if required parameters are null

◆ ManagedResourcesCleanup()

override void FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.ManagedResourcesCleanup ( )
protected virtual

◆ 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.

◆ UnmanagedResourcesCleanup()

override void FiftyOne.Pipeline.JsonBuilder.FlowElement.JsonBuilderElement.UnmanagedResourcesCleanup ( )
protected virtual

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.

On This Page