private void ReadTaskingRequestItemsFromProxy(XsdNs.TaskingRequestType proxy) { // Setting defaults Parameters = new Item_DataRecord(); // Reading procedure ProcedureId = proxy.procedure; // Parameters defined in the proxy? if (proxy.taskingParameters != null && proxy.taskingParameters.ParameterData != null) { Parameters = new TaskingParameterProcessor(proxy.taskingParameters.ParameterData).Parameters; } }
private void PopulateTaskingRequestProxy(XsdNs.TaskingRequestType proxy) { // Assigning to fields that are common to both request types // Assigning mandatory attributes specified in the SWES standard. // These values are after the SPS specification. proxy.service = PROXY_SERVICE; proxy.version = PROXY_VERSION; proxy.procedure = ProcedureId; // According to the SWE schema, a data record should not be empty // -> omitting it if no parameters specified if (Parameters.ItemNames.Count > 0) { var serialisableParams = new TaskingParameterProcessor(Parameters); proxy.taskingParameters = new XsdNs.TaskingRequestTypeTaskingParameters() { ParameterData = serialisableParams.ToXmlProxy("TaskReqParams-") }; } }
/// <summary> /// Creates an XML proxy from the object. /// </summary> /// <param name="idPrefix">A prefix to be appended to the IDs of any child XML elements that /// require an ID. For certain XML elements, the schema requires an ID that is unique within /// the XML document. Instead of generating random IDs, these are systematic and hierarchical /// in this software. To ensure uniqueness, each ID prefix can occur only once. The ID is of /// type xsd:id. This derives from xsd:NCName, so not all characters are allowed.</param> /// <returns>Proxy.</returns> public XsdNs.StatusReportType ToXmlProxy(string idPrefix) { var proxy = new XsdNs.StatusReportType() { // #1 in XML schema: task task = TaskId, // #3 in XML schema: event (not implemented) // #5 in XML schema: procedure procedure = ProcedureId, // #6 in XML schema: requestStatus requestStatus = RequestStatus.ToString(), // #9 in XML schema: updateTime updateTime = UpdateTime // #10 in XML schema: alternative (not implemented) }; // #2 in XML schema: estimatedToC // Assign if defined if (EstimatedTimeOfCompletion.HasValue) { // UTC not expected because already supposedly checked in the setter, but check just in case XNeut.Helper.ExpectDateTimeIsUtc(EstimatedTimeOfCompletion.Value); // throws DateTimeException proxy.estimatedToC = EstimatedTimeOfCompletion.Value; } proxy.estimatedToCSpecified = EstimatedTimeOfCompletion.HasValue; // #4 in XML schema: percentCompletion if (PercentCompletion.HasValue) { proxy.percentCompletion = PercentCompletion.Value; } proxy.percentCompletionSpecified = PercentCompletion.HasValue; // #7 in XML schema: statusMessage if (StatusMessages != null && StatusMessages.Count > 0) { proxy.statusMessage = new XsdNs.LanguageStringType[StatusMessages.Count]; for (int a = 0; a < StatusMessages.Count; ++a) { proxy.statusMessage[a] = new XsdNs.LanguageStringType { Value = StatusMessages[a] }; } } // Assign status code only if known // #8 in XML schema: taskStatus if (TaskStatusCode != TaskStatusCodeType.Unknown) { proxy.taskStatus = TaskStatusCode.ToString(); } // Assign tasking parameters if defined // #11 in XML schema: taskingParameters if (TaskingParameters.ItemNames.Count > 0) { var paramsProc = new TaskingParameterProcessor(TaskingParameters); proxy.taskingParameters = new XsdNs.ParameterDataPropertyType() { ParameterData = paramsProc.ToXmlProxy(idPrefix + "TaskPar-") }; } return(proxy); }