protected override SSAPBodyMessage Create(Type objectType, JObject jsonObject) { string type = jsonObject["@type"].Value <String>(); switch (type) { case "SSAPBodyReturnMessage": return(SSAPBodyReturnMessage.FromJson(jsonObject.ToString())); case "SSAPBodyConfigMessage": return(SSAPBodyConfigMessage.FromJson(jsonObject.ToString())); case "SSAPBodyJoinMessage": return(SSAPBodyJoinMessage.FromJson(jsonObject.ToString())); case "SSAPBodyJoinTokenMessage": return(SSAPBodyJoinMessage.FromJson(jsonObject.ToString())); case "SSAPBodyJoinUserAndPasswordMessage": return(SSAPBodyJoinUserAndPasswordMessage.FromJson(jsonObject.ToString())); case "SSAPBodyLeaveMessage": return(SSAPBodyLeaveMessage.FromJson(jsonObject.ToString())); case "SSAPBodyMessage": return(SSAPBodyMessage.FromJson(jsonObject.ToString())); case "SSAPBodyOperationMessage": return(SSAPBodyOperationMessage.FromJson(jsonObject.ToString())); case "SSAPBodyQueryMessage": return(SSAPBodyQueryMessage.FromJson(jsonObject.ToString())); case "SSAPBodyQueryWithParamMessage": return(SSAPBodyQueryWithParamMessage.FromJson(jsonObject.ToString())); case "SSAPBodySubscribeMessage": return(SSAPBodySubscribeMessage.FromJson(jsonObject.ToString())); case "SSAPBodyUnsubscribeMessage": return(SSAPBodyUnsubscribeMessage.FromJson(jsonObject.ToString())); case "SSAPBodyLogMessage": return(SSAPBodyLogMessage.FromJson(jsonObject.ToString())); default: return(null); } }
/// <summary> /// Generates a predefined in SIB Query Message /// </summary> /// <param name="sessionKey">Session Key</param> /// <param name="idQuery">Predefined Query Id</param> /// <returns>Query Message</returns> public SSAPMessage <SSAPBodyMessage> GenerateQueryMessage(string sessionKey, string idQuery) { var body = new SSAPBodyQueryMessage() { Query = idQuery, QueryType = SSAPQueryTypeEnum.SIB_DEFINED }; return(new SSAPMessage <SSAPBodyMessage>() { SessionKey = sessionKey, Body = body, Direction = SSAPMessageDirectionEnum.REQUEST, MessageType = SSAPMessageTypesEnum.QUERY, }); }
/// <summary> /// Generates a Native Query Message /// </summary> /// <param name="sessionKey">Session Key</param> /// <param name="ontology">Ontoogy</param> /// <param name="query">Query</param> /// <returns>Query Message</returns> public SSAPMessage <SSAPBodyMessage> GenerateQueryMessage(string sessionKey, string ontology, string query) { var body = new SSAPBodyQueryMessage() { Query = query }; return(new SSAPMessage <SSAPBodyMessage>() { SessionKey = sessionKey, Body = body, Direction = SSAPMessageDirectionEnum.REQUEST, MessageType = SSAPMessageTypesEnum.QUERY, Ontology = ontology }); }