Пример #1
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);
            }
        }
Пример #2
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;
            }
        }
Пример #3
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);
        }
Пример #4
0
 public IList <UXSessionProperty> GetUXSessionProperties(Application application)
 {
     return(ApplicationService.GetUXSessionProperties(application));
 }