C# Class DataMigration.ProcessingHelper

Processing helper class. It turns out there is quite a bit of shared logic between the RowProcessor and FeedProcessor classes. This class provides services to both.
ファイルを表示 Open project: scoutmedia/DataMigration

Public Methods

Method Description
ComputeDestinationValue ( int loadNumber, int rowNumber, IList row, IMethodResolver>.IDictionary methodResolvers, IExistence>.IDictionary existenceObjects, ILookup>.IDictionary lookups, ISourceValueMap map, string>.IDictionary values ) : string

This function is called to calculate destination values.

ComputeDestinationValueUsingTransform ( int loadNum, int rowNumber, IMethodResolver>.IDictionary methodResolvers, IExistence>.IDictionary existenceObjects, ILookup>.IDictionary lookups, IList row, ISourceValueMap map, string>.IDictionary values ) : string

This function is called when a transformation function is specified in the map for this computed data value.

GetForeignId ( int loadNumber, string dataSourceCode, FeedFilePlan plan, int rowNumber, IMethodResolver>.IDictionary methodResolvers, IExistence>.IDictionary existenceObjects, ILookup>.IDictionary lookups, IList row ) : string

This function is called once for each row. It attempts to obtain a designated foreign Id for the row, i.e., the piece of data that will be most reconizable to the purveyor of the feed that will help them identify a bad row. It repurposes the same codepath that does general destination value calculation, so that it can use transform functions and lookups.

ParseMethodArguments ( IList row, IMethodMap map, ILookup>.IDictionary lookups ) : IList

For a given sourcevaluemap, the optional 'srcColumns' attribute describes a comma- separated list of integer column indices. This method will look up and return those values as a list of strings.

ProcessLookups ( IList rowValues, IMethodMap map, ILookup>.IDictionary lookups ) : IList

ProcessLookups examines the map to determine if lookups are being specified. If not, it just returns the values. If so, it uses the ILookup object specifed, using the source values as inputs to the lookup, and returning the indirected values.

Private Methods

Method Description
ObtainSingleValueFromSourceWithNoTransform ( IList row, ISourceValueMap map, ILookup>.IDictionary lookups ) : string

This function handles the case where a single source column is migrated to the destination column. This is the most common case.

ProcessSingleValueWithLookupsIfSpecified ( string value, IMethodMap map, ILookup>.IDictionary lookups ) : string

This is a helper function that enables using lookups with either values from the source columns, or constants in the feed map as a key. All processed columns go through ProcessLookups, one way or another; this path is for the two cases when no method is specified (constant in feedmap and srcColumns).

Method Details

ComputeDestinationValue() public static method

This function is called to calculate destination values.
public static ComputeDestinationValue ( int loadNumber, int rowNumber, IList row, IMethodResolver>.IDictionary methodResolvers, IExistence>.IDictionary existenceObjects, ILookup>.IDictionary lookups, ISourceValueMap map, string>.IDictionary values ) : string
loadNumber int The LoadNumber.
rowNumber int The RowNumber.
row IList The raw parsed row data.
methodResolvers IMethodResolver>.IDictionary Method Resolver collection.
existenceObjects IExistence>.IDictionary Existence Objects collection.
lookups ILookup>.IDictionary Lookup objects collection./ /// The map that describes how to compute this value.
map ISourceValueMap
values string>.IDictionary The computed row so far.
return string

ComputeDestinationValueUsingTransform() public static method

This function is called when a transformation function is specified in the map for this computed data value.
public static ComputeDestinationValueUsingTransform ( int loadNum, int rowNumber, IMethodResolver>.IDictionary methodResolvers, IExistence>.IDictionary existenceObjects, ILookup>.IDictionary lookups, IList row, ISourceValueMap map, string>.IDictionary values ) : string
loadNum int The LoadNumber.
rowNumber int The numeric index of the row.
methodResolvers IMethodResolver>.IDictionary Method Resolver collection.
existenceObjects IExistence>.IDictionary Existence Objects collection.
lookups ILookup>.IDictionary Lookup objects collection./ /// The raw data row.
row IList
map ISourceValueMap An ISourceValueMap that describes how to perform the calculation. ///
values string>.IDictionary The computed row so far.
return string

GetForeignId() public static method

This function is called once for each row. It attempts to obtain a designated foreign Id for the row, i.e., the piece of data that will be most reconizable to the purveyor of the feed that will help them identify a bad row. It repurposes the same codepath that does general destination value calculation, so that it can use transform functions and lookups.
public static GetForeignId ( int loadNumber, string dataSourceCode, FeedFilePlan plan, int rowNumber, IMethodResolver>.IDictionary methodResolvers, IExistence>.IDictionary existenceObjects, ILookup>.IDictionary lookups, IList row ) : string
loadNumber int The LoadNumber.
dataSourceCode string The DataSourceCode for the feed.
plan FeedFilePlan The FeedFilePlan drives the FeedFile integration.
rowNumber int The numeric index of the row we're processing.
methodResolvers IMethodResolver>.IDictionary Method Resolver collection.
existenceObjects IExistence>.IDictionary Existence Objects collection.
lookups ILookup>.IDictionary Lookup objects collection./ /// The raw data for the row.
row IList
return string

ParseMethodArguments() public static method

For a given sourcevaluemap, the optional 'srcColumns' attribute describes a comma- separated list of integer column indices. This method will look up and return those values as a list of strings.
public static ParseMethodArguments ( IList row, IMethodMap map, ILookup>.IDictionary lookups ) : IList
row IList Input row data from the parser.
map IMethodMap The map that describes this transform.
lookups ILookup>.IDictionary List of lookups.
return IList

ProcessLookups() public static method

ProcessLookups examines the map to determine if lookups are being specified. If not, it just returns the values. If so, it uses the ILookup object specifed, using the source values as inputs to the lookup, and returning the indirected values.
public static ProcessLookups ( IList rowValues, IMethodMap map, ILookup>.IDictionary lookups ) : IList
rowValues IList The parsed raw input row.
map IMethodMap The map that specifies the lookup to use.
lookups ILookup>.IDictionary The collection of lookup objects.
return IList