Ejemplo n.º 1
0
 private void InitializeDataSource(DataSource dataSource)
 {
     MetaManagerUtil.InitializePropertyMap(dataSource.RequestMap);
     MetaManagerUtil.InitializePropertyMap(dataSource.ResponseMap);
     MetaManagerUtil.InitializePropertyMap(dataSource.ServiceMethod.RequestMap);
     MetaManagerUtil.InitializePropertyMap(dataSource.ServiceMethod.ResponseMap);
 }
Ejemplo n.º 2
0
        public void GetViewResponseMap(View view, out PropertyMap responseMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> requestProperties, out IList <IMappableProperty> targetProperties)
        {
            View readView = GetViewById(view.Id);

            sourceProperties  = new List <IMappableProperty>();
            targetProperties  = new List <IMappableProperty>();
            requestProperties = new List <IMappableProperty>();

            if (readView.RequestMap != null)
            {
                requestProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.RequestMap).MappedProperties.Cast <IMappableProperty>());
            }

            if (readView.Type == ViewType.Standard)
            {
                if ((readView.ServiceMethod != null) && (readView.ServiceMethod.ResponseMap != null))
                {
                    sourceProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.ServiceMethod.ResponseMap).MappedProperties.Cast <IMappableProperty>());
                }
            }

            targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.ResponseMap).MappedProperties.Cast <IMappableProperty>());

            IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readView.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            responseMap = readView.ResponseMap;

            MetaManagerUtil.InitializePropertyMap(responseMap);
        }
Ejemplo n.º 3
0
        public ViewNode GetParentViewNode(ViewNode viewNode)
        {
            ViewNode readViewNode = ViewNodeDao.FindById(viewNode.Id);

            ViewNode parentNode = readViewNode.Parent;

            while (parentNode != null)
            {
                if ((parentNode.View.ResponseMap != null) && (parentNode.View.ResponseMap.MappedProperties.Count > 0))
                {
                    break;
                }

                parentNode = parentNode.Parent;
            }

            if (parentNode != null)
            {
                NHibernateUtil.Initialize(parentNode.View.Application);
                NHibernateUtil.Initialize(parentNode.View.BusinessEntity);
                MetaManagerUtil.InitializePropertyMap(parentNode.View.ResponseMap);
            }

            return(parentNode);
        }
Ejemplo n.º 4
0
        public UXAction GetUXActionByIdWithMap(Guid uxActionId)
        {
            UXAction action = UXActionDao.FindById(uxActionId);

            if (action.ServiceMethod != null)
            {
                NHibernateUtil.Initialize(action.ServiceMethod.MappedToAction);

                if (action.ServiceMethod.MappedToAction != null)
                {
                    NHibernateUtil.Initialize(action.ServiceMethod.MappedToAction.MappedToObject);
                }
            }

            if (action.RequestMap != null)
            {
                MetaManagerUtil.InitializePropertyMap(action.RequestMap);
            }

            if ((action.Dialog != null) && (action.Dialog.InterfaceView != null))
            {
                if (action.Dialog.InterfaceView.ServiceMethod != null)
                {
                    NHibernateUtil.Initialize(action.Dialog.InterfaceView.ServiceMethod);
                    NHibernateUtil.Initialize(action.Dialog.InterfaceView.ServiceMethod.MappedToAction);
                }
            }

            return(action);
        }
Ejemplo n.º 5
0
        public Workflow GetWorkflowById(Guid workflowId)
        {
            Workflow workflow = WorkflowDao.FindById(workflowId);

            NHibernateUtil.Initialize(workflow.Dialogs);
            NHibernateUtil.Initialize(workflow.ServiceMethods);
            NHibernateUtil.Initialize(workflow.Subworkflows);
            NHibernateUtil.Initialize(workflow.Module);
            NHibernateUtil.Initialize(workflow.Module.Application);

            MetaManagerUtil.InitializePropertyMap(workflow.RequestMap);

            return(workflow);
        }
Ejemplo n.º 6
0
        public void GetViewNodeMap(ViewNode viewNode, out PropertyMap viewNodeMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            ViewNode readViewNode = ViewNodeDao.FindById(viewNode.Id);

            if (readViewNode.View.RequestMap != null)
            {
                sourceProperties = new List <IMappableProperty>(
                    (from MappedProperty p in MetaManagerUtil.InitializePropertyMap(readViewNode.View.RequestMap).MappedProperties
                     where !(p.Target is UXSessionProperty)
                     select p).Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            ViewNode parentNode = readViewNode.Parent;

            while (parentNode != null)
            {
                if ((parentNode.View.ResponseMap != null) && (parentNode.View.ResponseMap.MappedProperties.Count > 0))
                {
                    break;
                }

                parentNode = parentNode.Parent;
            }

            if (parentNode != null)
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(parentNode.View.ResponseMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readViewNode.View.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            viewNodeMap = readViewNode.ViewMap;

            if (viewNodeMap != null)
            {
                MetaManagerUtil.InitializePropertyMap(viewNodeMap);
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public void GetDataSourceToViewRequestMap(DataSource dataSource, View view, out PropertyMap dataSourceToViewRequestMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            DataSource readDataSource = DataSourceDao.FindById(dataSource.Id);
            View       readView       = ViewDao.FindById(view.Id);

            if (readDataSource != null &&
                readDataSource.ServiceMethod != null &&
                readDataSource.ServiceMethod.RequestMap != null)
            {
                sourceProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readDataSource.ServiceMethod.RequestMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            if (readView.ResponseMap != null)
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.ResponseMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readView.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            if (readDataSource != null)
            {
                dataSourceToViewRequestMap = readDataSource.RequestMap;
                MetaManagerUtil.InitializePropertyMap(dataSourceToViewRequestMap);
            }
            else
            {
                dataSourceToViewRequestMap = null;
            }
        }
Ejemplo n.º 9
0
        private void InitializeView(View view)
        {
            NHibernateUtil.Initialize(view);
            NHibernateUtil.Initialize(view.Application);
            NHibernateUtil.Initialize(view.BusinessEntity);
            NHibernateUtil.Initialize(view.ServiceMethod);

            if (view.RequestMap != null)
            {
                MetaManagerUtil.InitializePropertyMap(view.RequestMap);
            }

            if (view.ResponseMap != null)
            {
                MetaManagerUtil.InitializePropertyMap(view.ResponseMap);
            }

            if ((view.ServiceMethod != null) && (view.ServiceMethod.RequestMap != null))
            {
                MetaManagerUtil.InitializePropertyMap(view.ServiceMethod.RequestMap);
            }

            if ((view.ServiceMethod != null) && (view.ServiceMethod.ResponseMap != null))
            {
                MetaManagerUtil.InitializePropertyMap(view.ServiceMethod.ResponseMap);
            }

            if (view.DataSources.Count > 0)
            {
                foreach (DataSource dataSource in view.DataSources)
                {
                    InitializeDataSource(dataSource);
                }
            }

            ViewHelper.InitializeUXComponent(view.VisualTree);
        }
Ejemplo n.º 10
0
        public void GetServiceComponentMap(View view, UXServiceComponent serviceComponent, out PropertyMap componentMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            View readView = GetViewById(view.Id);

            ServiceMethod serviceMethod = this.ApplicationService.GetServiceMethodMapsById(serviceComponent.ServiceMethod.Id);

            if (serviceMethod != null)
            {
                sourceProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(serviceMethod.RequestMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            if (view.ResponseMap != null)
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.ResponseMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            IList <UXSessionProperty> sessionProperties = this.ApplicationService.GetUXSessionProperties(readView.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            if (serviceComponent.ComponentMap == null)
            {
                componentMap = null;
            }
            else
            {
                componentMap = MetaManagerUtil.InitializePropertyMap(PropertyMapDao.FindById(serviceComponent.ComponentMap.Id));
            }
        }
Ejemplo n.º 11
0
        public void GetViewToActionMap(ViewAction viewAction, out PropertyMap viewToActionMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            ViewAction readViewAction = ViewActionDao.FindById(viewAction.Id);

            PropertyMap actionRequestMap = readViewAction.Action.RequestMap;

            if (actionRequestMap != null)
            {
                sourceProperties = new List <IMappableProperty>(
                    (from MappedProperty p in MetaManagerUtil.InitializePropertyMap(actionRequestMap).MappedProperties
                     where !(p.Target is UXSessionProperty)
                     select p).Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            PropertyMap viewResponseMap = readViewAction.ViewNode.View.ResponseMap;

            if ((viewResponseMap != null) && (viewResponseMap != null))
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(viewResponseMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readViewAction.ViewNode.View.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            viewToActionMap = readViewAction.ViewToActionMap;

            MetaManagerUtil.InitializePropertyMap(viewToActionMap);
        }
        public void GetServiceMethodRequestMap(ServiceMethod serviceMethod, out PropertyMap requestMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            ServiceMethod readServiceMethod = GetServiceMethodMapsById(serviceMethod.Id);

            if (readServiceMethod != null &&
                readServiceMethod.RequestMap != null)
            {
                sourceProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readServiceMethod.RequestMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            if (readServiceMethod != null &&
                readServiceMethod.MappedToAction != null &&
                readServiceMethod.MappedToAction.RequestMap != null)
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readServiceMethod.MappedToAction.RequestMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            if (readServiceMethod != null)
            {
                requestMap = readServiceMethod.RequestMap;

                MetaManagerUtil.InitializePropertyMap(requestMap);
            }
            else
            {
                requestMap = null;
            }
        }