public void UpdateWorkflow(Workflow workflow) { MetaManagerServices.GetConfigurationManagementService().CheckOutDomainObject(workflow.Id, typeof(Workflow)); Workflow readWorkflow = WorkflowDao.FindById(workflow.Id); XDocument x = XDocument.Load(XmlReader.Create(new StringReader(readWorkflow.WorkflowXoml))); var dialogs = from d in x.Descendants() where d.Attribute("DialogId") != null select d; foreach (XElement element in dialogs) { Dialog d = DialogDao.FindById(new Guid(element.Attribute("DialogId").Value)); element.Name = XName.Get(WorkflowTypeFactory.GetDialogActivityClassName(d), element.Name.NamespaceName); } var serviceMethods = from s in x.Descendants() where s.Attribute("ServiceMethodId") != null select s; foreach (XElement element in serviceMethods) { ServiceMethod s = ServiceMethodDao.FindById(new Guid(element.Attribute("ServiceMethodId").Value)); element.Name = XName.Get(WorkflowTypeFactory.GetServiceMethodActivityClassName(s), element.Name.NamespaceName); } readWorkflow.WorkflowXoml = x.ToString(); WorkflowDao.SaveOrUpdate(readWorkflow); }
public ServiceMethod GetServiceMethodWithRequestMap(Guid serviceMethodId) { ServiceMethod serviceMethod = ServiceMethodDao.FindById(serviceMethodId); if (serviceMethod != null) { // Initialize Requestmap NHibernateUtil.Initialize(serviceMethod.RequestMap); } return(serviceMethod); }
public ServiceMethod GetServiceMethodMapsById(Guid serviceMethodId) { ServiceMethod serviceMethod = ServiceMethodDao.FindById(serviceMethodId); if (serviceMethod != null) { NHibernateUtil.Initialize(serviceMethod.Service); NHibernateUtil.Initialize(serviceMethod.RequestMap.MappedProperties); NHibernateUtil.Initialize(serviceMethod.ResponseMap.MappedProperties); NHibernateUtil.Initialize(serviceMethod.MappedToAction); } return(serviceMethod); }
public DataSource CreateDataSourceMaps(DataSource dataSource, View view, Guid serviceMethodId) { ServiceMethod serviceMethod = ServiceMethodDao.FindById(serviceMethodId); if (serviceMethod != null) { MetaManagerUtil.InitializePropertyMap(serviceMethod.RequestMap); MetaManagerUtil.InitializePropertyMap(serviceMethod.ResponseMap); View readView = ViewDao.FindById(view.Id); dataSource.ServiceMethod = serviceMethod; dataSource.RequestMap = new PropertyMap(); dataSource.RequestMap.IsCollection = serviceMethod.RequestMap.IsCollection; dataSource.ResponseMap = new PropertyMap(); dataSource.ResponseMap.IsCollection = serviceMethod.ResponseMap.IsCollection; foreach (MappedProperty sourceProperty in dataSource.ServiceMethod.RequestMap.MappedProperties) { MappedProperty mappedProperty = new MappedProperty(); mappedProperty.Source = sourceProperty; mappedProperty.Target = null; mappedProperty.Name = sourceProperty.Name; mappedProperty.Sequence = sourceProperty.Sequence; mappedProperty.PropertyMap = dataSource.RequestMap; dataSource.RequestMap.MappedProperties.Add(mappedProperty); } foreach (MappedProperty sourceProperty in readView.ResponseMap.MappedProperties) { MappedProperty mappedProperty = new MappedProperty(); mappedProperty.Source = sourceProperty; mappedProperty.Target = null; mappedProperty.IsEnabled = false; mappedProperty.Name = sourceProperty.Name; mappedProperty.Sequence = sourceProperty.Sequence; mappedProperty.PropertyMap = dataSource.ResponseMap; dataSource.ResponseMap.MappedProperties.Add(mappedProperty); } } return(dataSource); }
public IList <DbProperty> GetDbProperties(ServiceMethod serviceMethod) { serviceMethod = ServiceMethodDao.FindById(serviceMethod.Id); if (serviceMethod != null) { if (serviceMethod.MappedToAction.Query != null) { NHibernateUtil.Initialize(serviceMethod.MappedToAction.Query.Properties); return(serviceMethod.MappedToAction.Query.Properties.Cast <DbProperty>().ToList()); } else if (serviceMethod.MappedToAction.StoredProcedure != null) { NHibernateUtil.Initialize(serviceMethod.MappedToAction.StoredProcedure.Properties); return(serviceMethod.MappedToAction.StoredProcedure.Properties.Cast <DbProperty>().ToList()); } } return(null); }
public void CreateViewServiceMethodMap(View view, Guid serviceMethodId) { ServiceMethod serviceMethod = ServiceMethodDao.FindById(serviceMethodId); view.RequestMap = new PropertyMap(); view.ResponseMap = new PropertyMap(); // Check if we need to loop the properties in map. if (view.ServiceMethod != null) { foreach (MappedProperty sourceProperty in serviceMethod.RequestMap.MappedProperties) { MappedProperty mappedProperty = new MappedProperty(); mappedProperty.Source = sourceProperty; mappedProperty.Target = sourceProperty.Target; mappedProperty.Name = sourceProperty.Name; mappedProperty.Sequence = sourceProperty.Sequence; mappedProperty.PropertyMap = view.RequestMap; mappedProperty.IsSearchable = true; view.RequestMap.MappedProperties.Add(mappedProperty); } foreach (MappedProperty sourceProperty in serviceMethod.ResponseMap.MappedProperties) { MappedProperty mappedProperty = new MappedProperty(); mappedProperty.Source = sourceProperty; mappedProperty.Target = sourceProperty.Target; mappedProperty.Name = sourceProperty.Name; mappedProperty.Sequence = sourceProperty.Sequence; mappedProperty.PropertyMap = view.ResponseMap; view.ResponseMap.MappedProperties.Add(mappedProperty); } } }