public void WithProcessInstanceSmartObject(out SmartObject smartObject, out ServiceInstanceSettings serviceInstanceSettings) { smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo); var settings = new Mock <ServiceInstanceSettings>(); settings.SetupGet(i => i.Name).Returns("K2_Management"); var smartObjectInfo = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo); var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>(); mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo); this.SmartObjectManagementServer .Setup(i => i.GetSmartObjects( It.IsAny <SearchProperty>(), It.IsAny <SearchOperator>(), It.IsAny <string>())) .Returns(mockSmartObjectExplorer); this.SmartObjectManagementServer .Setup(i => i.GetSmartObjects( It.IsAny <Guid>())) .Returns(mockSmartObjectExplorer); this.SmartObjectManagementServer .Setup(i => i.GetSmartObjects( It.IsAny <string>())) .Returns(mockSmartObjectExplorer); this.SmartObjectClientServer .Setup(x => x.GetSmartObject( It.IsAny <string>())) .Returns(smartObject); this.SmartObjectClientServer .Setup(x => x.ExecuteScalar(It.IsAny <SmartObject>())) .Returns(smartObject); this.ServiceManagementServer .Setup(i => i.GetServiceInstanceConfig( It.IsAny <Guid>())) .Returns(Resources.ServiceInstanceConfig); this.ServiceManagementServer .Setup(i => i.GetServiceInstancesCompact( It.IsAny <Guid>())) .Returns(Resources.ServiceInstancesCompact_URMService); this.ServiceManagementServer .Setup(i => i.GetServiceInstance( It.IsAny <Guid>())) .Returns(Resources.ServiceInstance_URMService_Full); serviceInstanceSettings = settings.Object; }
internal DataTable DeserializeTypedArray(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, string value) { var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings); smartObject.MethodToExecute = "DeserializeTypedArray"; smartObject.SetInputPropertyValue("Serialized_Array", value); var dataTable = SmartObjectHelper.ExecuteListDataTable(this, smartObject); return(dataTable); }
internal SmartObject Deserialize(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, string value) { var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings); smartObject.MethodToExecute = "Deserialize"; smartObject.SetInputPropertyValue("Serialized_Item__String_", value); SmartObjectHelper.ExecuteScalar(this, smartObject); return(smartObject); }
public static string GetSmartObjectName(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings) { serviceInstanceSettings.ThrowIfNull("serviceInstanceSettings"); var managementServer = WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(null); using (managementServer.BaseAPIServer?.Connection) { return(GetSmartObjectName(managementServer, serviceObjectName, serviceInstanceSettings)); } }
public static ServiceInstance GetServiceInstance(ServiceInstanceSettings serviceInstanceSettings) { serviceInstanceSettings.ThrowIfNull("serviceInstanceSettings"); var connection = WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(null); using (connection.BaseAPIServer?.Connection) { var serviceInstance = ServiceInstance.Create(connection.GetServiceInstance(serviceInstanceSettings.Guid, ServiceExplorerLevel.ServiceObject)); return(serviceInstance); } }
public static ServiceObject GetServiceObject(ServiceInstanceSettings serviceInstanceSettings, string serviceObjectName) { serviceInstanceSettings.ThrowIfNull("serviceInstanceSettings"); var connection = WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(null); using (connection.BaseAPIServer?.Connection) { var serviceObject = ServiceObject.Create(connection.GetServiceInstanceServiceObject(serviceInstanceSettings.Guid, serviceObjectName)); return(serviceObject); } }
internal string SerializeItemToArray(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, params Action <SmartObject>[] actions) { actions.ThrowIfNull("actions"); var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings); smartObject.MethodToExecute = "SerializeItemToArray"; foreach (var action in actions) { action(smartObject); } SmartObjectHelper.ExecuteScalar(this, smartObject); return(smartObject.Properties["Serialized_Array"].Value); }
internal string Serialize(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, params Action <SmartObject>[] actions) { actions.ThrowIfNull("actions"); var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings); smartObject.MethodToExecute = "Serialize"; foreach (var action in actions) { action(smartObject); } var serialized = SmartObjectHelper.ExecuteScalar(this, smartObject); return(serialized.GetReturnPropertyValue("Serialized_Item__String_")); }
internal static string GetSmartObjectName(SmartObjectManagementServerWrapper managementServer, string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings) { var preSmartObjectName = string.Concat(serviceInstanceSettings.Name, "_"); var smartObjectExplorer = managementServer.GetSmartObjects(SearchProperty.SystemName, SearchOperator.EndsWith, string.Concat("_", serviceObjectName)); return((from s in smartObjectExplorer.SmartObjectList where s.Name.StartsWith(preSmartObjectName) select s.Name).FirstOrDefault()); }
internal static SmartObject GetSmartObject(SmartObjectClientServerWrapper clientServer, string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings) { clientServer.ThrowIfNull("clientServer"); var smartObjectName = GetSmartObjectName(serviceObjectName, serviceInstanceSettings); return(clientServer.GetSmartObject(smartObjectName)); }
public static SmartObject GetSmartObject(SmartObjectClientServer clientServer, string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings) { return(GetSmartObject(WrapperFactory.Instance.GetSmartObjectClientServerWrapper(clientServer), serviceObjectName, serviceInstanceSettings)); }
/// <summary> /// Executes the SerializeItemToArray method on the <paramref name="serviceObjectName"/> /// </summary> /// <param name="clientServer"></param> /// <param name="serviceObjectName"></param> /// <param name="existingSerializedArray"> /// An existing serialized array to add the item to /// </param> /// One or more custom actions to perform on the SmartObject associated with the specified /// <paramref name="serviceObjectName"/>. This will most commonly take the form of setting /// input values. See the accompanying example. /// <returns> /// A string representing the serialized array containing the item created by the actions used to set the input properties /// </returns> public static string SerializeItemToArray(this SmartObjectClientServer clientServer, string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, params Action <SmartObject>[] actions) { return(WrapperFactory.Instance.GetSmartObjectClientServerWrapper(clientServer).SerializeItemToArray(serviceObjectName, serviceInstanceSettings, actions)); }
/// <summary> /// Deserializes <paramref name="value"/> to a DataTable /// </summary> /// <param name="clientServer"></param> /// <param name="serviceObjectName"></param> /// <param name="value">The string to deserializd to a datatable</param> /// <returns>A DataTable containing the deserialized data for the object</returns> public static DataTable DeserializeTypedArray(this SmartObjectClientServer clientServer, string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, string value) { return(WrapperFactory.Instance.GetSmartObjectClientServerWrapper(clientServer).DeserializeTypedArray(serviceObjectName, serviceInstanceSettings, value)); }
/// <summary> /// Deserializes <paramref name="value"/> to a SmartObject /// </summary> /// <param name="clientServer"></param> /// <param name="serviceObjectName"></param> /// <param name="value">The serialized string version of the object</param> /// <returns>The SmartObject containing the return properties of the Deserialize call</returns> public static SmartObject Deserialize(this SmartObjectClientServer clientServer, string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, String value) { return(WrapperFactory.Instance.GetSmartObjectClientServerWrapper(clientServer).Deserialize(serviceObjectName, serviceInstanceSettings, value)); }