Ejemplo n.º 1
0
 public DataSourceArray(DataSource mdo)
 {
     if (mdo == null)
     {
         return;
     }
     items = new DataSourceTO[1];
     items[0] = new DataSourceTO(mdo);
     count = 1;
 }
Ejemplo n.º 2
0
 public DataSourceArray(DataSource[] mdoItems)
 {
     if (mdoItems == null)
     {
         return;
     }
     items = new DataSourceTO[mdoItems.Length];
     for (int i = 0; i < mdoItems.Length; i++)
     {
         items[i] = new DataSourceTO(mdoItems[i]);
     }
     count = items.Length;
 }
Ejemplo n.º 3
0
 public override string authenticate(AbstractCredentials credentials, DataSource validationDataSource = null)
 {
     if (Cxn == null || !Cxn.IsConnected)
     {
         throw new ConnectionException("Must have connection");
     }
     if (credentials == null)
     {
         throw new ArgumentNullException("credentials");
     }
     else
     {
         throw new ArgumentException("Invalid credentials");
     }
 }
Ejemplo n.º 4
0
        public TaggedPatientArrays getPatientsWithUpdatedChemHemReports(string username, string pwd, string fromDate)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();
            //if (String.IsNullOrEmpty(username) | String.IsNullOrEmpty(pwd) | String.IsNullOrEmpty(fromDate))
            //{
            //    result.fault = new FaultTO("Must supply all arguments");
            //}
            try
            {
                LabsApi api = new LabsApi();
                DataSource ds = new DataSource { ConnectionString = mySession.MdwsConfiguration.CdwConnectionString };
                AbstractConnection cxn = new gov.va.medora.mdo.dao.sql.cdw.CdwConnection(ds);
                Dictionary<string, HashSet<string>> dict = api.getUpdatedChemHemReports(cxn, DateTime.Parse(fromDate));
                result.arrays = new TaggedPatientArray[dict.Keys.Count];
                int arrayCount = 0;

                foreach (string key in dict.Keys)
                {
                    TaggedPatientArray tpa = new TaggedPatientArray(key);
                    tpa.patients = new PatientTO[dict[key].Count];
                    int patientCount = 0;
                    foreach (string patientICN in dict[key])
                    {
                        PatientTO p = new PatientTO { mpiPid = patientICN };
                        tpa.patients[patientCount] = p;
                        patientCount++;
                    }
                    result.arrays[arrayCount] = tpa;
                    arrayCount++;
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return result;
        }
Ejemplo n.º 5
0
        protected void TestVistaSettingsClick(object sender, EventArgs e)
        {
            int port = 0;
            if (String.IsNullOrEmpty(textboxVistaIp.Text) || String.IsNullOrEmpty(textboxVistaPort.Text) ||
                !Int32.TryParse(textboxVistaPort.Text, out port))
            {
                labelMessage.Text = "Invalid Vista connection parameters. Please be sure to enter a valid IP address and port number";
                return;
            }

            DataSource testSrc = new DataSource();
            testSrc.Provider = textboxVistaIp.Text;
            testSrc.Modality = "HIS";
            testSrc.Port = port;
            testSrc.Protocol = "VISTA";
            testSrc.SiteId = new SiteId("900", "Test"); // this site id doesn't matter - it's just there because a site ID is expected by the code below

            string welcomeMsg = "";
            try
            {
                AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(testSrc.Protocol));
                AbstractConnection cxn = factory.getConnection(testSrc);
                cxn.connect();
                welcomeMsg = cxn.getWelcomeMessage();
                cxn.disconnect();
            }
            catch (Exception exc)
            {
                labelMessage.Text = "Unable to connect to that datasource. Please check your test system and try again." +
                    "This might help figure out why:</p><p>" + exc.ToString() + "</p>";
                return;
            }

            labelMessage.Text = "<p>You rock. Connection successfully established. You should put this site in your VhaSites.xml " +
                "file is you'd like it to be available later on via MDWS.</p><p>" + welcomeMsg + "</p>";
        }
Ejemplo n.º 6
0
        internal void buildConnectionSetForGetClaimants()
        {
            Dictionary<string, AbstractConnection> cxns = new Dictionary<string, AbstractConnection>(3);

            //DataSource nptSrc = new DataSource();
            //nptSrc.Protocol = "NPT";
            //nptSrc.SiteId = new SiteId("NPT", "National Patient Table");
            //AbstractConnection nptCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.NPT).getConnection(nptSrc);
            //try
            //{
            //    nptCxn.connect();
            //    cxns.Add("NPT", nptCxn);
            //}
            //catch (Exception ex)
            //{
            //}

            DataSource adrSrc = new DataSource();
            adrSrc.Protocol = "ADR";
            adrSrc.SiteId = new SiteId("ADR", "Administrative Data Repository");
            adrSrc.ConnectionString = gov.va.medora.mdo.dao.oracle.adr.AdrConstants.DEFAULT_CXN_STRING;
            AbstractConnection adrCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.ADR).getConnection(adrSrc);
            try
            {
                adrCxn.connect();
                cxns.Add("ADR", adrCxn);
            }
            catch (Exception ex)
            {
            }

            DataSource vadirSrc = new DataSource();
            vadirSrc.Protocol = "VADIR";
            vadirSrc.SiteId = new SiteId("VADIR", "VA-DoD Information Repository");
            vadirSrc.ConnectionString = gov.va.medora.mdo.dao.oracle.vadir.VadirConstants.DEFAULT_CXN_STRING;
            AbstractConnection vadirCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.VADIR).getConnection(vadirSrc);
            try
            {
                vadirCxn.connect();
                cxns.Add("VADIR", vadirCxn);
            }
            catch (Exception ex)
            {
            }

            DataSource vbacorpSrc = new DataSource();
            vbacorpSrc.Protocol = "VBACORP";
            vbacorpSrc.SiteId = new SiteId("VBACORP", "VBA Corp");
            vbacorpSrc.ConnectionString = gov.va.medora.mdo.dao.oracle.vbacorp.VbacorpConstants.DEFAULT_CXN_STRING;
            AbstractConnection vbacorpCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.VBACORP).getConnection(vbacorpSrc);
            try
            {
                vbacorpCxn.connect();
                cxns.Add("VBACORP", vbacorpCxn);
            }
            catch (Exception ex)
            {
            }

            mySession.ConnectionSet = new ConnectionSet(cxns);
        }
Ejemplo n.º 7
0
        // This method is exposed to the svcs via visitSites
        internal TaggedTextArray setupMultiSourceQuery(string pwd, List<DataSource> sources, string context)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (sources == null || sources.Count == 0)
            {
                result.fault = new FaultTO("No sources");
            }
            else if (mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No site table");
            }
            else if (mySession.Credentials == null)
            {
                result.fault = new FaultTO("No credentials", "Need to login?");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (String.IsNullOrEmpty(context))
            {
                context = mySession.DefaultPermissionString;
            }
            if (mySession.PrimaryPermission == null || String.IsNullOrEmpty(mySession.PrimaryPermission.Name))
            {
                mySession.PrimaryPermission = new MenuOption(context);
            }

            try
            {
                mySession.ConnectionSet.ExcludeSite200 = mySession._excludeSite200;
                mySession.ConnectionSet.Add(sources, mySession.DefaultVisitMethod);
                mySession.Credentials.SecurityPhrase = pwd;
                DataSource validator = new DataSource() { ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString };
                IndexedHashtable t = mySession.ConnectionSet.connect(mySession.Credentials, mySession.PrimaryPermission, validator);

                if (t.Count == 0)
                {
                    throw new Exception("Unable to connect to remote sites");
                }
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result = new TaggedTextArray();
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Ejemplo n.º 8
0
        internal TaggedTextArray setupMultiSourceQuery(string pwd, StringDictionary siteIds, string context)
        {
            List<DataSource> sources = new List<DataSource>();
            if (siteIds == null || siteIds.Count == 0)
            {
                return setupMultiSourceQuery(pwd, sources, context);
            }

            foreach (KeyValuePair<string, string> kvp in siteIds)
            {
                DataSource src = new DataSource();
                src.SiteId = new SiteId(kvp.Key, kvp.Value);
                sources.Add(src);
            }
            return setupMultiSourceQuery(pwd, sources, context);
        }
Ejemplo n.º 9
0
        public SiteTO addSite(string id, string name, string datasource, string port, string modality, string protocol, string region)
        {
            SiteTO result = new SiteTO();
            Site site = new Site();
            DataSource source = new DataSource();
            int iPort = 0;
            int iRegion = 0;

            if (!mySession.MdwsConfiguration.IsProduction)
            {
                result.fault = new FaultTO("You may not add data sources to non-production MDWS installations");
            }
            else if (String.IsNullOrEmpty(id) || String.IsNullOrEmpty(name) || String.IsNullOrEmpty(datasource) ||
                String.IsNullOrEmpty(port) || String.IsNullOrEmpty(modality) || String.IsNullOrEmpty(protocol) ||
                String.IsNullOrEmpty(region))
            {
                result.fault = new FaultTO("Must supply all parameters");
            }
            else if (mySession.SiteTable.Sites.ContainsKey(id))
            {
                result.fault = new FaultTO("That site id is in use", "Choose a different site id");
            }
            else if (!Int32.TryParse(port, out iPort))
            {
                result.fault = new FaultTO("Non-numeric port", "Provide a numeric value for the port");
            }
            else if (!Int32.TryParse(region, out iRegion))
            {
                result.fault = new FaultTO("Non-numeric region", "Provide a numeric value for the region");
            }
            else if (modality != "HIS")
            {
                result.fault = new FaultTO("Only HIS modality currently supported", "Use 'HIS' as your modality");
            }
            else if (protocol != "VISTA")
            {
                result.fault = new FaultTO("Only VISTA protocol currently supported", "Use 'VISTA' as your protocol");
            }

            if(result.fault != null)
            {
                return result;
            }

            source.Port = iPort;
            source.Modality = modality;
            source.Protocol = protocol;
            source.Provider = datasource;
            source.SiteId = new SiteId(id, name);

            site.Sources = new DataSource[1];
            site.Sources[0] = source;
            site.RegionId = region;
            site.Name = name;
            site.Id = id;

            if(!mySession.SiteTable.Regions.ContainsKey(iRegion))
            {
                Region r = new Region();
                r.Id = iRegion;
                r.Name = "Region " + region;
                r.Sites = new ArrayList();
                mySession.SiteTable.Regions.Add(iRegion, r);
            }
            ((Region)mySession.SiteTable.Regions[iRegion]).Sites.Add(site);
            mySession.SiteTable.Sites.Add(id, site);
            mySession.SiteTable.Sources.Add(site.Sources[0]);
            result = new SiteTO(site);
            return result;
        }
Ejemplo n.º 10
0
        public static AbstractCredentials setVisitCredentials(
            string duz,
            string ssn,
            string username,
            string userphone,
            DataSource authenticatingSource,
            string pwd)
        {
            AbstractCredentials credentials = new gov.va.medora.mdo.dao.vista.VistaCredentials();
            credentials.LocalUid = duz;
            credentials.FederatedUid = ssn;
            credentials.SubjectName = username;
            credentials.SubjectPhone = userphone;
            credentials.AuthenticationSource = authenticatingSource;
            credentials.AuthenticationToken = authenticatingSource.SiteId.Id + '_' + duz;
            credentials.SecurityPhrase = pwd;

            return credentials;
        }
Ejemplo n.º 11
0
 public override User authenticateAndAuthorize(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
 {
     throw new NotImplementedException();
 }