Ejemplo n.º 1
0
        public HeadCsvToXpoInserter(ImportHeadersParam param, Stream stream,
                                    Xafology.ExpressApp.Xpo.ValueMap.IXpoFieldMapper xpoFieldMapper, Xafology.ExpressApp.Xpo.ValueMap.IImportLogger logger)
        {
            if (logger == null)
            {
                this.logger = new Xafology.ExpressApp.Xpo.ValueMap.NullImportLogger();
            }
            else
            {
                this.logger = logger;
            }

            if (param == null)
            {
                throw new UserFriendlyException("Param cannot be null");
            }
            if (stream == null)
            {
                throw new UserFriendlyException("Stream cannot be null");
            }
            if (xpoFieldMapper == null)
            {
                throw new UserFriendlyException("XpoFieldMapper cannot be null");
            }

            csvReader           = new CsvReader(new StreamReader(stream), true);
            objTypeInfo         = param.ObjectTypeInfo;
            this.param          = param;
            this.xpoFieldMapper = xpoFieldMapper;

            recordMapper = new HeadCsvToXpoRecordMapper(xpoFieldMapper, param.HeaderToFieldMaps, csvReader);
            FieldMapsUtil.ValidateParameters(param);
        }
Ejemplo n.º 2
0
 public HeadCsvToXpoUpdater(ImportHeadersParam param, Stream stream,
                            Xafology.ExpressApp.Xpo.ValueMap.XpoFieldMapper xpoFieldMapper, Xafology.ExpressApp.Xpo.ValueMap.IImportLogger logger)
 {
     csvReader           = GetCsvReaderFromStream(stream, true);
     objTypeInfo         = param.ObjectTypeInfo;
     this.param          = param;
     this.xpoFieldMapper = xpoFieldMapper;
     this.logger         = logger;
     recordMapper        = new HeadCsvToXpoRecordMapper(xpoFieldMapper, param.HeaderToFieldMaps, csvReader);
     FieldMapsUtil.ValidateParameters(param);
 }