예제 #1
0
 /// <summary>
 /// Ctor intended to be called by the CreateProvider method of the base class
 /// </summary>
 /// <param name="config"></param>
 /// <param name="globalCache"></param>
 /// <param name="typeDefinitions"></param>
 /// <param name="x12DelimitersForOuput"></param>
 internal X12IntakeProvider(OrchestratorConfig config, IGlobalCache globalCache, TypeDefinitions typeDefinitions, X12Delimiters x12DelimitersForOuput)
     : base(config, globalCache, typeDefinitions, sNo => sNo == 0 ? "Segment" : string.Format("Elem{0:000}", sNo)) //in case of X12, fields are named: Segment, Elem001, Elem002,...
 {
     _x12DelimitersForOutput = x12DelimitersForOuput;
     _x12FieldDelimiter      = config.DefaultX12FieldDelimiter;
     if (_x12FieldDelimiter == default(char))
     {
         _x12FieldDelimiter = '*';
     }
 }
예제 #2
0
        /// <summary>
        /// Factory method that returns a concrete instance of the derived class
        /// </summary>
        /// <param name="config"></param>
        /// <param name="globalCache"></param>
        /// <param name="x12Delimiters"></param>
        /// <returns></returns>
        internal static OutputProvider CreateProvider(OrchestratorConfig config, IGlobalCache globalCache, X12Delimiters x12Delimiters)
        {
            switch (config.OutputDataKind)
            {
            case KindOfTextData.Raw:
                return(new RawOutputProvider(config, globalCache));

            case KindOfTextData.Keyword:
                return(new KwOutputProvider(config, globalCache));

            case KindOfTextData.Delimited:
                return(new DelimitedOutputProvider(config, globalCache));

            case KindOfTextData.Flat:
                return(new FlatOutputProvider(config, globalCache));

            case KindOfTextData.Arbitrary:
                return(new ArbitraryOutputProvider(config, globalCache));

            case KindOfTextData.X12:
                return(new X12OutputProvider(config, globalCache, x12Delimiters));

            case KindOfTextData.XML:
                var allItemTypes = ItemType.Void | ItemType.Bool | ItemType.DateTime | ItemType.Decimal | ItemType.Int | ItemType.String;
                return(new XrecordOutputProvider(allItemTypes, config, globalCache));

            case KindOfTextData.JSON:
            case KindOfTextData.UnboundJSON:
                return(new XrecordOutputProvider(ItemType.DateTime, config, globalCache));

            default:
                //TODO: Message - fatal error, undetermined type of output data
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// Factory method that returns a concrete instance of the derived class
        /// </summary>
        /// <param name="config"></param>
        /// <param name="globalCache"></param>
        /// <param name="typeDefinitions"></param>
        /// <param name="x12DelimitersForOutput"></param>
        /// <returns></returns>
        internal static IntakeProvider CreateProvider(OrchestratorConfig config, IGlobalCache globalCache, TypeDefinitions typeDefinitions, X12Delimiters x12DelimitersForOutput)
        {
            switch (config.InputDataKind)
            {
            case KindOfTextData.Raw:
                return(new RawIntakeProvider(config, globalCache, typeDefinitions));

            case KindOfTextData.Keyword:
                return(new KwIntakeProvider(config, globalCache, typeDefinitions));

            case KindOfTextData.Delimited:
                return(new DelimitedIntakeProvider(config, globalCache, typeDefinitions));

            case KindOfTextData.Flat:
                return(new FlatIntakeProvider(config, globalCache, typeDefinitions));

            case KindOfTextData.Arbitrary:
                return(new ArbitraryIntakeProvider(config, globalCache, typeDefinitions));

            case KindOfTextData.X12:
                return(new X12IntakeProvider(config, globalCache, typeDefinitions, x12DelimitersForOutput));

            case KindOfTextData.XML:
            case KindOfTextData.JSON:
            case KindOfTextData.UnboundJSON:
                return(new XrecordIntakeProvider(config, globalCache, typeDefinitions));

            default:
                //TODO: Message - fatal error, undetermined type of intake data
                return(null);
            }
        }
예제 #4
0
 /// <summary>
 /// Ctor intended to be called by the CreateProvider method of the base class
 /// </summary>
 /// <param name="config"></param>
 /// <param name="globalCache"></param>
 /// <param name="x12Delimiters"></param>
 internal X12OutputProvider(OrchestratorConfig config, IGlobalCache globalCache, X12Delimiters x12Delimiters) : base(config, globalCache)
 {
     _x12Delimiters     = x12Delimiters;
     _x12FieldDelimiter = new Lazy <string>(() => _x12Delimiters.X12FieldDelimiter == default(char) ? "*" : _x12Delimiters.X12FieldDelimiter.ToString());
 }