コード例 #1
0
        public QueryResults parseLabChemDdrResults(VistaQuery query, String[] results)
        {
            Dictionary <String, IList <String> > testsByIens    = parseLabChemDdrResultsAndSetCommentFlags(query, results);
            Dictionary <String, String>          commentsByIens = VistaDaoUtils.getCommentsForIens(query.SiteCode, this.IensWithComment);

            mergeLabChemCommentsWithParsedResults(commentsByIens, testsByIens);

            return(new QueryResults()
            {
                StringResult = buildResults(testsByIens)
            });
        }
コード例 #2
0
        bool checkSiteForWork()
        {
            try
            {
                if (_config == null ||
                    String.IsNullOrEmpty(_config.QueryConfigurations.RootNode.Value.File) ||
                    String.IsNullOrEmpty(_config.SiteCode) ||
                    String.IsNullOrEmpty(_config.QueryConfigurations.RootNode.Value.Fields))
                {
                    throw new ApplicationException("The Vista service has not been properly configured. Unable to continue");
                }

                // get Vista header info for metrics - if we fail, no big deal, we should still proceed
                try
                {
                    // since we're not storing the global, we'll get it dynamically
                    String   global       = _vistaDao.getDao().getVariableValueQuery(_config.SiteCode, "$G(^DIC(" + _config.QueryConfigurations.RootNode.Value.File + ",0,\"GL\"))");
                    String   header       = _vistaDao.getDao().getVariableValueQuery(_config.SiteCode, "$G(" + global + "0))");
                    String[] headerPieces = header.Split(new char[] { '^' });
                    _serviceState.LastVistaIEN = headerPieces[2];
                    try
                    {
                        _serviceState.RecordsInFile = Convert.ToInt64(headerPieces[3]);
                    }
                    catch (Exception) { /* swallow */ }
                    _report.addDebug(String.Format("File global: {0} -- File header: {1}", global, header));
                }
                catch (Exception) { /* only affects metrics - not unrecoverable */ }

                if (_config.ExtractMode == ExtractorMode.REBUILD)
                {
                    // _lastSqlIEN = "0"; // this is used for calculating percentage finished so we set it here
                    _vistaQuery.From = _vistaQuery.StartIen = "0"; // set start point to zero if we are rebuilding a file
                }
                else if (_config.ExtractMode == ExtractorMode.INCREMENTAL)
                {
                    //_lastSqlIEN = _config.StartIen; // getting this from Orchestrator!
                    _vistaQuery.From = _vistaQuery.StartIen = _config.StartIen;
                }
                else if (_config.ExtractMode == ExtractorMode.DIFF)
                {
                    if (_config.SqlIens == null || _config.SqlIens.Count == 0)
                    {
                        throw new DownstreamException("DIFF mode was specified but no SQL IENs were provided");
                    }
                    IList <String> iensFromVista         = VistaDaoUtils.getIensFromVistaFile(_vistaDao.getDao(), _config.SiteCode, _config.QueryConfigurations.RootNode.Value.File);
                    KeyValuePair <String, String> fromTo = new DataCleaningUtils().getExtractRange(_config.SqlIens, iensFromVista);
                    //_lastSqlIEN =
                    _config.StartIen = _vistaQuery.From = _vistaQuery.StartIen = fromTo.Key;
                    this.LastIen     = fromTo.Value;
                    _report.addInfo(String.Format("Running in diff mode - extracting IENs {0} through {1}", fromTo.Key, fromTo.Value));
                }

                //if (new VistaIenSeeder(null).needsConfigChange(_config.QueryConfigurations.RootNode.Value.File))
                //{
                //    _report.addDebug("This file's configs need updating - start IEN from Orchestartor: " + _config.StartIen);
                //    new VistaIenSeeder(null).updateConfig(_config);
                //    _vistaQuery.Screen = _config.QueryConfigurations.RootNode.Value.Screen; // this is UGLY!!! we're starting to copy properties between objects here and it smells... need to refactor
                //    _vistaQuery.Identifier = _config.QueryConfigurations.RootNode.Value.Identifier; // this is UGLY!!! we're starting to copy properties between objects here and it smells... need to refactor
                //    _lastSqlIEN = _vistaQuery.From = _vistaQuery.StartIen = _config.StartIen = _config.QueryConfigurations.RootNode.Value.From; // set by VistaIenSeeder.updateConfig
                //}
            }
            catch (Exception exc)
            {
                _report.addError("A critical error occurred while trying to verify setup for a Vista service", exc);
                return(false); // if don't return true then expect check did not succeed
            }

            return(true); // we're not really doing much to check for work so probably ok to just return true if we drop all the way through
        }