Exemplo n.º 1
0
        public void UnmapViewComponents(View view)
        {
            View readView = ViewDao.FindById(view.Id);

            // Remove all maps for the ViewNodes connected to the View
            IList <ViewNode> viewNodeList = ViewNodeDao.FindAllByViewId(readView.Id);

            foreach (ViewNode viewNode in viewNodeList)
            {
                // Delete the ViewMap
                if (viewNode.ViewMap != null)
                {
                    PropertyMapDao.Delete(viewNode.ViewMap);
                }

                // Remove ViewMap from the ViewNode
                viewNode.ViewMap = null;

                // Save ViewNode
                ViewNodeDao.SaveOrUpdate(viewNode);
            }

            // Remove the connections from ViewComponents to MappedProperty
            WalkViewComponentsAndUnmap(readView.VisualTree);
        }
Exemplo n.º 2
0
        public View GetViewById(Guid viewId)
        {
            View view = ViewDao.FindById(viewId);

            InitializeView(view);

            return(view);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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;
            }
        }
Exemplo n.º 5
0
        public ViewNode ConnectViewToViewNode(View view, ViewNode parentViewNode)
        {
            if (view != null && parentViewNode != null)
            {
                // First update/create the view
                View readView = ViewDao.FindById(view.Id);
                parentViewNode = ViewNodeDao.FindById(parentViewNode.Id);

                // Create viewnode to connect the view to
                ViewNode viewNode = new ViewNode();

                viewNode.Dialog   = parentViewNode.Dialog;
                viewNode.Parent   = parentViewNode;
                viewNode.Sequence = viewNode.Dialog.ViewNodes.Max(node => node.Sequence) + 1;
                viewNode.Title    = null;
                viewNode.View     = readView;

                // Save the new ViewNode
                viewNode = ViewNodeDao.SaveOrUpdate(viewNode);

                if (NHibernateUtil.IsInitialized(parentViewNode.Dialog) && NHibernateUtil.IsInitialized(parentViewNode.Dialog.ViewNodes))
                {
                    // Connect the ViewNode to the Dialogs ViewNodes
                    parentViewNode.Dialog.ViewNodes.Add(viewNode);
                }

                if (NHibernateUtil.IsInitialized(parentViewNode.Children))
                {
                    // Connect the ViewNode as a child to the Parent ViewNode
                    parentViewNode.Children.Add(viewNode);
                }

                return(viewNode);
            }

            return(null);
        }