public static List <Configuration> GetWebserviceObjects(WebserviceInstance webserviceInstance) { List <Configuration> configurations = new List <Configuration>(); SysDataAccessCredential dac = DAOUtility.GetSysCredentials(); DataAccess das = new DataAccess(); using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac))) { conn.Open(); SqlCommand command = new SqlCommand(); command.Connection = conn; command.CommandType = System.Data.CommandType.Text; command.CommandText = das.SERVICE_VIEW_GET_WEBSERVICE_OBJECTS; command.Parameters.AddWithValue(ConfigurationDAO.AT_WEBSERVICE_INSTANCE_ID, webserviceInstance.id); try { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { configurations.Add(new Configuration(reader, Configuration.View.GetWebseviceObjects)); } } } catch (Exception e) { ErrorLogger.LogError(e, "GetWebserviceObjects(WebserviceInstance webserviceInstance)", webserviceInstance.id.ToString()); } } return(configurations); }
private static List <WebserviceInstance> getSingleWebserviceInstance(WebserviceInstance webserviceInstance) { List <WebserviceInstance> webserviceInstances = new List <WebserviceInstance>(); SysDataAccessCredential dac = DAOUtility.GetSysCredentials(); DataAccess das = new DataAccess(); using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac))) { conn.Open(); SqlCommand command = new SqlCommand(); command.Connection = conn; command.CommandType = System.Data.CommandType.Text; command.CommandText = das.GET_SINGLE_WEBSERVICE_INSTANCE; command.Parameters.AddWithValue(WebserviceInstanceDAO.AT_ID, webserviceInstance.id); try { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { webserviceInstances.Add(new WebserviceInstance(reader)); } } } catch (Exception e) { ErrorLogger.LogError(e, "getSingleWebserviceInstance(WebserviceInstance WebserviceInstance)", webserviceInstance.id.ToString()); } } return(webserviceInstances); }
private static bool deleteWebserviceInstance(WebserviceInstance webserviceInstance) { SysDataAccessCredential dac = DAOUtility.GetSysCredentials(); DataAccess das = new DataAccess(); using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac))) { conn.Open(); SqlCommand command = new SqlCommand(); command.Connection = conn; command.CommandType = System.Data.CommandType.Text; command.CommandText = das.DELETE_WEBSERVICE_INSTANCE; command.Parameters.AddWithValue(WebserviceInstanceDAO.AT_ID, webserviceInstance.id); try { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { webserviceInstance.id = DAOUtility.GetData <int>(reader, WebserviceInstanceDAO.ID); } } } catch (Exception e) { ErrorLogger.LogError(e, "DeleteWebserviceInstance()", webserviceInstance.id.ToString()); } } return(true); }
public static List <WebserviceObject> GetIncomingWebserviceObjects(WebserviceInstance webserviceIsntance, List <WebserviceObject> webserviceObjects) { List <WebserviceObject> tempWebserviceObjects = new List <WebserviceObject>(); tempWebserviceObjects = webserviceObjects.FindAll(o => o.webserviceInstanceId == webserviceIsntance.id); return(tempWebserviceObjects); }
public static WebserviceInstance GetIncomingWebserviceInstance(Communication communication, List <WebserviceInstance> webserviceInstances) { WebserviceInstance tempInstance = new WebserviceInstance(); tempInstance = webserviceInstances.Find(c => c.communicationId == communication.id); return(tempInstance); }
private static WebserviceInstance postUpdateWebserviceInstance(WebserviceInstance webserviceInstance) { SysDataAccessCredential dac = DAOUtility.GetSysCredentials(); DataAccess das = new DataAccess(); using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac))) { conn.Open(); SqlCommand command = new SqlCommand(); command.Connection = conn; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = das.PUT_WEBSERVICE_INSTANCE; command.Parameters.AddWithValue(WebserviceInstanceDAO.COMMUNICATION_ID, webserviceInstance.communicationId); command.Parameters.AddWithValue(WebserviceInstanceDAO.CREDENTIAL_ID, webserviceInstance.credentialId); command.Parameters.AddWithValue(WebserviceInstanceDAO.NAME, webserviceInstance.name); command.Parameters.AddWithValue(WebserviceInstanceDAO.SERVER, webserviceInstance.server); command.Parameters.AddWithValue(WebserviceInstanceDAO.IP_ADDRESS, webserviceInstance.ipAddress); command.Parameters.AddWithValue(WebserviceInstanceDAO.AT_ID, webserviceInstance.id); try { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { webserviceInstance.id = DAOUtility.GetData <int>(reader, WebserviceInstanceDAO.ID); } } } catch (Exception e) { ErrorLogger.LogError(e, "postUpdateWebserviceInstance()", webserviceInstance.id.ToString()); } } return(webserviceInstance); }
public static void newWebServiceInstanceAndTables() { // creates a new web service instance WebserviceInstance webserviceInstance = new WebserviceInstance() { communicationId = 18, credentialId = 7, ipAddress = "172.31.100.103", server = "https://shcappprod.shc.shcnet.pri/WSShieldsApps/ShieldsApps_MSFTONLY.svc", name = "WSShieldsApps" }; // should have an id webserviceInstance = WebserviceInstanceDAO.PostUpdate(webserviceInstance); // create new web service objects List <String> lines = new List <string>(); lines = File.ReadAllLines(@"C:\Users\chrisb\Documents\ApplicationDevelopment\Working\HL7Broker.root\HL7Broker\HL7BrokerConsoleTest\NewWebServiceObjects.txt").ToList(); lines.ForEach(delegate(String line) { WebserviceObject webserviceObject = new WebserviceObject() { id = 0, name = line, webserviceInstanceId = webserviceInstance.id }; // post update new service object webserviceObject = WebserviceObjectDAO.PostUpdate(webserviceObject); // write out the identities to process the columns Console.WriteLine(webserviceObject.name + "->" + webserviceObject.id); }); Console.Read(); }
public static void handleProcessingForOutboundHandler(Configuration masterConfig, OutboundHandler outboundHandler) { // to control some basic CPU handling settings Config outboundConfig = new Config(); // load each of the configurations into their own objects List <Application> applications = masterConfig.applications; List <Communication> communications = masterConfig.communications; List <WebserviceObject> webserviceObjects = masterConfig.webserviceObjects; List <WebserviceInstance> webserviceInstances = masterConfig.webserviceInstances; List <WebservicePropertySet> webserviceProperties = masterConfig.webservicePropertySets; List <MessageGroup> messageGroups = masterConfig.messageGroups; List <MessageGroupInstance> messageGroupInstances = masterConfig.messageGroupInstances; // continue to read the table while (true) { applications.ForEach(delegate(Application app) { if (app.name == outboundHandler.getApplicationName()) { // get the unprocessed message count for the application List <MessageBucket> brokerInformation = MessageBucketDAO.GetUnprocessedMessageHeaderInstancesByApplication(app); // set the MOD from config file. var options = new ParallelOptions { MaxDegreeOfParallelism = outboundConfig.MaxDegreeOfParallelism }; // parallel For each Parallel.ForEach(brokerInformation, options, broker => { // get the message header and message MessageHeaderInstance messageHeaderInstance = broker.messageHeaderInstance; Message message = broker.message; // srub the input of bad stuff string hl7Scrubbed = HL7MessageUtility.scrubHL7MessageForParse(message.hl7Raw); // make the hl7 message HL7Message hl7Message = HL7MessageDAO.getMessage(hl7Scrubbed); // locally retrieve the communication object from memory Communication communication = ConfigurationUtility.GetIncomingWebserviceCommunication(app, communications); // locally retrieve the webservice instance object from memory WebserviceInstance webserviceInstance = ConfigurationUtility.GetIncomingWebserviceInstance(communication, webserviceInstances); // locally retrieve the web service objects from memory List <WebserviceObject> wsObjects = ConfigurationUtility.GetIncomingWebserviceObjects(webserviceInstance, webserviceObjects); // determine the message type Generic.MessageType messageType = HL7MessageUtility.getMessageType(hl7Message, hl7Scrubbed); switch (messageType) { // to handle a new message add message type then its own handler case Generic.MessageType.ADT: break; case Generic.MessageType.ORM: handleProcessingForORM(wsObjects, webserviceProperties, hl7Message, messageGroupInstances, messageGroups, app, message); break; case Generic.MessageType.ORU: handleProcessingForORU(wsObjects, webserviceProperties, hl7Message, messageGroupInstances, messageGroups, app, message); break; case Generic.MessageType.SIU: break; case Generic.MessageType.UNKNOWN: break; default: break; } // update the table to processed MessageBucketDAO.UpdateProcessedFlagAndMessageLog(messageHeaderInstance, message, true); // update broker stats handleBrokerStatUpdate(message, communication); }); } }); // provide blocking if there is no data to process. Thread.Sleep(1000); } }
public static bool Delete(WebserviceInstance webserviceInstance) { return(deleteWebserviceInstance(webserviceInstance)); }
public static WebserviceInstance PostUpdate(WebserviceInstance webserviceInstance) { return(postUpdateWebserviceInstance(webserviceInstance)); }
public static List <WebserviceInstance> Get(WebserviceInstance webserviceInstance) { return(getSingleWebserviceInstance(webserviceInstance)); }
public static void TestConfigLoad() { Configuration masterConfig = ConfigurationDAO.GetAllConfigurations(); List <Application> applications = masterConfig.applications; List <Communication> communications = masterConfig.communications; List <WebserviceObject> webserviceObjects = masterConfig.webserviceObjects; List <WebserviceInstance> webserviceInstances = masterConfig.webserviceInstances; List <WebservicePropertySet> webserviceProperties = masterConfig.webservicePropertySets; List <MessageGroup> messageGroups = masterConfig.messageGroups; applications.ForEach(delegate(Application app) { if (app.name != RSERVER) { return; } // get the unprocessed message count for the application List <MessageBucket> brokerInformation = MessageBucketDAO.GetUnprocessedMessageHeaderInstancesByApplication(app); brokerInformation.ForEach(delegate(MessageBucket broker) { // get the message header and message MessageHeaderInstance messageHeaderInstance = broker.messageHeaderInstance; Message message = broker.message; // locally retrieve the communication object from memory Communication communication = ConfigurationUtility.GetIncomingWebserviceCommunication(app, communications); // locally retrieve the webservice instance object from memory WebserviceInstance webserviceInstance = ConfigurationUtility.GetIncomingWebserviceInstance(communication, webserviceInstances); // locally retrieve the web service objects from memory List <WebserviceObject> wsObjects = ConfigurationUtility.GetIncomingWebserviceObjects(webserviceInstance, webserviceObjects); // for each object - for each property set for that object - handle accordingly wsObjects.ForEach(delegate(WebserviceObject wsObject) { Console.WriteLine("OBJECT:" + wsObject.name); List <WebservicePropertySet> wsProperties = ConfigurationUtility.GetIncomingWebservicePropertySets(wsObject, webserviceProperties); wsProperties.ForEach(delegate(WebservicePropertySet wsProperty) { Console.WriteLine("Property:" + wsProperty.name); List <MessageGroup> msGroups = ConfigurationUtility.GetIncomingWebserviceMessageGroup(wsProperty, messageGroups); Console.WriteLine("Group Count:" + msGroups.Count); }); }); // update the table to processed // BrokerDAO.UpdateProcessedFlagAndMessageLog(messageHeaderInstance, message, true); }); }); }