/// <summary> /// Instantiate and deserialize the properties of a <paramref name="RelationalExpression"/> /// </summary> /// <param name="jObject">The <see cref="JObject"/> containing the data</param> /// <returns>The <see cref="RelationalExpression"/> to instantiate</returns> public static CDP4Common.DTO.RelationalExpression FromJsonObject(JObject jObject) { var iid = jObject["iid"].ToObject <Guid>(); var revisionNumber = jObject["revisionNumber"].IsNullOrEmpty() ? 0 : jObject["revisionNumber"].ToObject <int>(); var relationalExpression = new CDP4Common.DTO.RelationalExpression(iid, revisionNumber); if (!jObject["excludedDomain"].IsNullOrEmpty()) { relationalExpression.ExcludedDomain.AddRange(jObject["excludedDomain"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedPerson"].IsNullOrEmpty()) { relationalExpression.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject <IEnumerable <Guid> >()); } if (!jObject["modifiedOn"].IsNullOrEmpty()) { relationalExpression.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>(); } if (!jObject["parameterType"].IsNullOrEmpty()) { relationalExpression.ParameterType = jObject["parameterType"].ToObject <Guid>(); } if (!jObject["relationalOperator"].IsNullOrEmpty()) { relationalExpression.RelationalOperator = jObject["relationalOperator"].ToObject <RelationalOperatorKind>(); } if (!jObject["scale"].IsNullOrEmpty()) { relationalExpression.Scale = jObject["scale"].ToObject <Guid?>(); } if (!jObject["thingPreference"].IsNullOrEmpty()) { relationalExpression.ThingPreference = jObject["thingPreference"].ToObject <string>(); } if (!jObject["value"].IsNullOrEmpty()) { relationalExpression.Value = SerializerHelper.ToValueArray <string>(jObject["value"].ToString()); } return(relationalExpression); }
/// <summary> /// Instantiate and deserialize the properties of a <paramref name="SimpleParameterValue"/> /// </summary> /// <param name="jObject">The <see cref="JObject"/> containing the data</param> /// <returns>The <see cref="SimpleParameterValue"/> to instantiate</returns> public static CDP4Common.DTO.SimpleParameterValue FromJsonObject(JObject jObject) { var iid = jObject["iid"].ToObject <Guid>(); var revisionNumber = jObject["revisionNumber"].IsNullOrEmpty() ? 0 : jObject["revisionNumber"].ToObject <int>(); var simpleParameterValue = new CDP4Common.DTO.SimpleParameterValue(iid, revisionNumber); if (!jObject["excludedDomain"].IsNullOrEmpty()) { simpleParameterValue.ExcludedDomain.AddRange(jObject["excludedDomain"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedPerson"].IsNullOrEmpty()) { simpleParameterValue.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject <IEnumerable <Guid> >()); } if (!jObject["modifiedOn"].IsNullOrEmpty()) { simpleParameterValue.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>(); } if (!jObject["parameterType"].IsNullOrEmpty()) { simpleParameterValue.ParameterType = jObject["parameterType"].ToObject <Guid>(); } if (!jObject["scale"].IsNullOrEmpty()) { simpleParameterValue.Scale = jObject["scale"].ToObject <Guid?>(); } if (!jObject["thingPreference"].IsNullOrEmpty()) { simpleParameterValue.ThingPreference = jObject["thingPreference"].ToObject <string>(); } if (!jObject["value"].IsNullOrEmpty()) { simpleParameterValue.Value = SerializerHelper.ToValueArray <string>(jObject["value"].ToString()); } return(simpleParameterValue); }
/// <summary> /// Instantiate and deserialize the properties of a <paramref name="ParameterSubscriptionValueSet"/> /// </summary> /// <param name="jObject">The <see cref="JObject"/> containing the data</param> /// <returns>The <see cref="ParameterSubscriptionValueSet"/> to instantiate</returns> public static CDP4Common.DTO.ParameterSubscriptionValueSet FromJsonObject(JObject jObject) { var iid = jObject["iid"].ToObject <Guid>(); var revisionNumber = jObject["revisionNumber"].IsNullOrEmpty() ? 0 : jObject["revisionNumber"].ToObject <int>(); var parameterSubscriptionValueSet = new CDP4Common.DTO.ParameterSubscriptionValueSet(iid, revisionNumber); if (!jObject["excludedDomain"].IsNullOrEmpty()) { parameterSubscriptionValueSet.ExcludedDomain.AddRange(jObject["excludedDomain"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedPerson"].IsNullOrEmpty()) { parameterSubscriptionValueSet.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject <IEnumerable <Guid> >()); } if (!jObject["manual"].IsNullOrEmpty()) { parameterSubscriptionValueSet.Manual = SerializerHelper.ToValueArray <string>(jObject["manual"].ToString()); } if (!jObject["modifiedOn"].IsNullOrEmpty()) { parameterSubscriptionValueSet.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>(); } if (!jObject["subscribedValueSet"].IsNullOrEmpty()) { parameterSubscriptionValueSet.SubscribedValueSet = jObject["subscribedValueSet"].ToObject <Guid>(); } if (!jObject["thingPreference"].IsNullOrEmpty()) { parameterSubscriptionValueSet.ThingPreference = jObject["thingPreference"].ToObject <string>(); } if (!jObject["valueSwitch"].IsNullOrEmpty()) { parameterSubscriptionValueSet.ValueSwitch = jObject["valueSwitch"].ToObject <ParameterSwitchKind>(); } return(parameterSubscriptionValueSet); }
/// <summary> /// Instantiate and deserialize the properties of a <paramref name="Constant"/> /// </summary> /// <param name="jObject">The <see cref="JObject"/> containing the data</param> /// <returns>The <see cref="Constant"/> to instantiate</returns> public static CDP4Common.DTO.Constant FromJsonObject(JObject jObject) { var iid = jObject["iid"].ToObject <Guid>(); var revisionNumber = jObject["revisionNumber"].IsNullOrEmpty() ? 0 : jObject["revisionNumber"].ToObject <int>(); var constant = new CDP4Common.DTO.Constant(iid, revisionNumber); if (!jObject["alias"].IsNullOrEmpty()) { constant.Alias.AddRange(jObject["alias"].ToObject <IEnumerable <Guid> >()); } if (!jObject["category"].IsNullOrEmpty()) { constant.Category.AddRange(jObject["category"].ToObject <IEnumerable <Guid> >()); } if (!jObject["definition"].IsNullOrEmpty()) { constant.Definition.AddRange(jObject["definition"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedDomain"].IsNullOrEmpty()) { constant.ExcludedDomain.AddRange(jObject["excludedDomain"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedPerson"].IsNullOrEmpty()) { constant.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject <IEnumerable <Guid> >()); } if (!jObject["hyperLink"].IsNullOrEmpty()) { constant.HyperLink.AddRange(jObject["hyperLink"].ToObject <IEnumerable <Guid> >()); } if (!jObject["isDeprecated"].IsNullOrEmpty()) { constant.IsDeprecated = jObject["isDeprecated"].ToObject <bool>(); } if (!jObject["modifiedOn"].IsNullOrEmpty()) { constant.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>(); } if (!jObject["name"].IsNullOrEmpty()) { constant.Name = jObject["name"].ToObject <string>(); } if (!jObject["parameterType"].IsNullOrEmpty()) { constant.ParameterType = jObject["parameterType"].ToObject <Guid>(); } if (!jObject["scale"].IsNullOrEmpty()) { constant.Scale = jObject["scale"].ToObject <Guid?>(); } if (!jObject["shortName"].IsNullOrEmpty()) { constant.ShortName = jObject["shortName"].ToObject <string>(); } if (!jObject["thingPreference"].IsNullOrEmpty()) { constant.ThingPreference = jObject["thingPreference"].ToObject <string>(); } if (!jObject["value"].IsNullOrEmpty()) { constant.Value = SerializerHelper.ToValueArray <string>(jObject["value"].ToString()); } return(constant); }
/// <summary> /// Instantiate and deserialize the properties of a <paramref name="SampledFunctionParameterType"/> /// </summary> /// <param name="jObject">The <see cref="JObject"/> containing the data</param> /// <returns>The <see cref="SampledFunctionParameterType"/> to instantiate</returns> public static CDP4Common.DTO.SampledFunctionParameterType FromJsonObject(JObject jObject) { var iid = jObject["iid"].ToObject <Guid>(); var revisionNumber = jObject["revisionNumber"].IsNullOrEmpty() ? 0 : jObject["revisionNumber"].ToObject <int>(); var sampledFunctionParameterType = new CDP4Common.DTO.SampledFunctionParameterType(iid, revisionNumber); if (!jObject["alias"].IsNullOrEmpty()) { sampledFunctionParameterType.Alias.AddRange(jObject["alias"].ToObject <IEnumerable <Guid> >()); } if (!jObject["category"].IsNullOrEmpty()) { sampledFunctionParameterType.Category.AddRange(jObject["category"].ToObject <IEnumerable <Guid> >()); } if (!jObject["definition"].IsNullOrEmpty()) { sampledFunctionParameterType.Definition.AddRange(jObject["definition"].ToObject <IEnumerable <Guid> >()); } if (!jObject["degreeOfInterpolation"].IsNullOrEmpty()) { sampledFunctionParameterType.DegreeOfInterpolation = jObject["degreeOfInterpolation"].ToObject <int?>(); } if (!jObject["dependentParameterType"].IsNullOrEmpty()) { sampledFunctionParameterType.DependentParameterType.AddRange(jObject["dependentParameterType"].ToOrderedItemCollection()); } if (!jObject["excludedDomain"].IsNullOrEmpty()) { sampledFunctionParameterType.ExcludedDomain.AddRange(jObject["excludedDomain"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedPerson"].IsNullOrEmpty()) { sampledFunctionParameterType.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject <IEnumerable <Guid> >()); } if (!jObject["hyperLink"].IsNullOrEmpty()) { sampledFunctionParameterType.HyperLink.AddRange(jObject["hyperLink"].ToObject <IEnumerable <Guid> >()); } if (!jObject["independentParameterType"].IsNullOrEmpty()) { sampledFunctionParameterType.IndependentParameterType.AddRange(jObject["independentParameterType"].ToOrderedItemCollection()); } if (!jObject["interpolationPeriod"].IsNullOrEmpty()) { sampledFunctionParameterType.InterpolationPeriod = SerializerHelper.ToValueArray <string>(jObject["interpolationPeriod"].ToString()); } if (!jObject["isDeprecated"].IsNullOrEmpty()) { sampledFunctionParameterType.IsDeprecated = jObject["isDeprecated"].ToObject <bool>(); } if (!jObject["modifiedOn"].IsNullOrEmpty()) { sampledFunctionParameterType.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>(); } if (!jObject["name"].IsNullOrEmpty()) { sampledFunctionParameterType.Name = jObject["name"].ToObject <string>(); } if (!jObject["shortName"].IsNullOrEmpty()) { sampledFunctionParameterType.ShortName = jObject["shortName"].ToObject <string>(); } if (!jObject["symbol"].IsNullOrEmpty()) { sampledFunctionParameterType.Symbol = jObject["symbol"].ToObject <string>(); } if (!jObject["thingPreference"].IsNullOrEmpty()) { sampledFunctionParameterType.ThingPreference = jObject["thingPreference"].ToObject <string>(); } return(sampledFunctionParameterType); }