/// <summary>
        /// Setups the activity data.
        /// </summary>
        /// <param name="activity">The activity.</param>
        public void SetupActivityData(IWebActivity activity)
        {
            if (activity != null)
            {
                SavedInputMapping  = activity.SavedInputMapping;
                SavedOutputMapping = activity.SavedOutputMapping;
                ActivityType       = activity.UnderlyingWebActivityObjectType;
                _complexObjects    = new List <ComplexObjectItemModel>();
                if (activity.ResourceModel != null)
                {
                    string inputs;
                    string outputs;

                    // handle workflows differently ;)

                    if (activity.IsNotAvailable())
                    {
                        inputs  = activity.ResourceModel.Inputs;
                        outputs = activity.ResourceModel.Outputs;
                    }
                    else
                    {
                        var datalist = activity.ResourceModel.DataList;
                        AddComplexObjects(datalist);
                        inputs = DataListUtil.GenerateSerializableDefsFromDataList(datalist,
                                                                                   enDev2ColumnArgumentDirection.Input);
                        outputs = DataListUtil.GenerateSerializableDefsFromDataList(datalist,
                                                                                    enDev2ColumnArgumentDirection.Output);
                    }

                    ActivityInputDefinitions  = inputs;
                    ActivityOutputDefinitions = outputs;
                }
            }
        }
        public AutoMappingOutputAction(IDataMappingViewModel beforeAutoMapping, IWebActivity activity)
        {
            _beforeAutoMapping = beforeAutoMapping;
            _copyOfBeforeAutoMapping = new DataMappingViewModel(activity);


        }
Esempio n. 3
0
        public static IWebActivity CreateWebActivity(object webActivityWrappingObject)
        {
            IWebActivity activity = CreateWebActivity();

            activity.WebActivityObject = webActivityWrappingObject;
            return(activity);
        }
 public static IWebActivity CreateWebActivity(object webActivityWrappingObject, IContextualResourceModel resourceModel, string serviceName)
 {
     IWebActivity activity = CreateWebActivity();
     activity.WebActivityObject = webActivityWrappingObject;
     activity.ResourceModel = resourceModel;
     activity.ServiceName = serviceName;
     return activity;
 }
Esempio n. 5
0
        public DataMappingViewModel(IWebActivity activity, NotifyCollectionChangedEventHandler mappingCollectionChangedEventHandler)
        {
            _activity = activity;
            Inputs    = new ObservableCollection <IInputOutputViewModel>();
            Outputs   = new ObservableCollection <IInputOutputViewModel>();

            if (mappingCollectionChangedEventHandler != null)
            {
                Inputs.CollectionChanged  += mappingCollectionChangedEventHandler;
                Outputs.CollectionChanged += mappingCollectionChangedEventHandler;
            }
            Initialize(_activity);
        }
Esempio n. 6
0
        public DataMappingViewModel(IWebActivity activity, NotifyCollectionChangedEventHandler mappingCollectionChangedEventHandler = null)
        {
            _activity = activity;
            _actionManager = new ActionManager();
            Inputs = new ObservableCollection<IInputOutputViewModel>();
            Outputs = new ObservableCollection<IInputOutputViewModel>();

            if(mappingCollectionChangedEventHandler != null)
            {
                Inputs.CollectionChanged += mappingCollectionChangedEventHandler;
                Outputs.CollectionChanged += mappingCollectionChangedEventHandler;
            }
            Initialize(_activity);
        }
        internal void Initialize(IWebActivity activity)
        {
            // -- NEW ;)

            Activity = activity;
            ActivityName = activity.ServiceName;

            var activeDataList = string.Empty;

            if(DataListSingleton.ActiveDataList != null)
            {
                activeDataList = DataListSingleton.DataListAsXmlString;
            }

            ActivityDataMappingBuilder ioBuilder = new ActivityDataMappingBuilder
            {
                DataList = activeDataList,
            };

            ioBuilder.SetupActivityData(activity);

            var mappingData = ioBuilder.Generate();

            // save model data
            //Outputs = mappingData.Outputs.ToObservableCollection();
            foreach(var ioViewModel in mappingData.Outputs)
            {
                Outputs.Add(ioViewModel);
            }
            //Inputs = mappingData.Inputs.ToObservableCollection();
            foreach(var ioViewModel in mappingData.Inputs)
            {
                Inputs.Add(ioViewModel);
            }

            // update special fields on the model?!
            var toSaveOutputMapping = ioBuilder.SavedOutputMapping;
            var toSaveInputMapping = ioBuilder.SavedInputMapping;

            XmlOutput = toSaveOutputMapping;
            Activity.SavedOutputMapping = toSaveOutputMapping;
            Activity.LiveOutputMapping = toSaveOutputMapping;

            XmlOutput = (XmlOutput + toSaveInputMapping);
            Activity.SavedInputMapping = toSaveInputMapping;
            Activity.LiveInputMapping = toSaveInputMapping;

        }
        public void Given_WebActivityBackedByAModelItem_ExpectedTheServiceNamePropertySetsTheServiceNamePropertyOnTheModelItem()
        {
            DsfActivity Act = new DsfActivity();

            Act.ServiceName   = "testResource";
            Act.InputMapping  = @"<Inputs><Input Name=""Host"" Source=""Host"" DefaultValue=""mail.bellevuenet.co.za""><Validator Type=""Required"" /></Input><Input Name=""Port"" Source=""Port"" DefaultValue=""25""><Validator Type=""Required"" /></Input><Input Name=""From"" Source=""From"" DefaultValue=""*****@*****.**""><Validator Type=""Required"" /></Input><Input Name=""To"" Source=""To""><Validator Type=""Required"" /></Input><Input Name=""Subject"" Source=""Subject""><Validator Type=""Required"" /></Input><Input Name=""BodyType"" Source=""Bodytype"" DefaultValue=""html""><Validator Type=""Required"" /></Input><Input Name=""Body"" Source=""Body""><Validator Type=""Required"" /></Input><Input Name=""Attachment"" Source=""Attachment"" DefaultValue=""NONE""><Validator Type=""Required"" /></Input></Inputs>";
            Act.OutputMapping = @"<Outputs><Output Name=""FailureMessage"" MapsTo=""FailureMessage"" Value=""[[FailureMessage]]"" /><Output Name=""Message"" MapsTo=""Message"" Value=""[[Message]]"" /></Outputs>";
            ModelItem testItem = TestModelItemFactory.CreateModelItem(Act);

            string serviceName = "cake";

            IWebActivity webActivity = WebActivityFactory.CreateWebActivity(testItem, null, serviceName);

            Assert.AreEqual(serviceName, webActivity.ServiceName);
            Assert.AreEqual("DsfActivity", ModelItemUtils.GetProperty("DisplayName", testItem));
        }
Esempio n. 9
0
        /// <summary>
        /// Setups the activity data.
        /// </summary>
        /// <param name="activity">The activity.</param>
        public void SetupActivityData(IWebActivity activity)
        {
            if (activity != null)
            {
                SavedInputMapping  = activity.SavedInputMapping;
                SavedOutputMapping = activity.SavedOutputMapping;
                ActivityType       = activity.UnderlyingWebActivityObjectType;

                if (activity.ResourceModel != null)
                {
                    IsWorkflow = activity.ResourceModel.ResourceType == Studio.Core.AppResources.Enums.ResourceType.WorkflowService;

                    string inputs;
                    string outputs;

                    // handle workflows differently ;)
                    if (IsWorkflow)
                    {
                        //if (!activity.ResourceModel.Environment.IsLocalHost && !activity.ResourceModel.Environment.HasLoadedResources)
                        if (activity.IsNotAvailable())
                        {
                            inputs  = activity.ResourceModel.Inputs;
                            outputs = activity.ResourceModel.Outputs;
                        }
                        else
                        {
                            var datalist = activity.ResourceModel.DataList;
                            var compiler = DataListFactory.CreateDataListCompiler();

                            inputs = compiler.GenerateSerializableDefsFromDataList(datalist,
                                                                                   enDev2ColumnArgumentDirection.Input);
                            outputs = compiler.GenerateSerializableDefsFromDataList(datalist,
                                                                                    enDev2ColumnArgumentDirection.Output);
                        }
                    }
                    else
                    {
                        // handle services ;)
                        inputs  = activity.ResourceModel.Inputs;
                        outputs = activity.ResourceModel.Outputs;
                    }

                    ActivityInputDefinitions  = inputs;
                    ActivityOutputDefinitions = outputs;
                }
            }
        }
Esempio n. 10
0
        internal void Initialize(IWebActivity activity)
        {
            // -- NEW ;)

            Activity     = activity;
            ActivityName = activity.ServiceName;

            var activeDataList = string.Empty;

            if (DataListSingleton.ActiveDataList != null)
            {
                activeDataList = DataListSingleton.DataListAsXmlString;
            }

            ActivityDataMappingBuilder ioBuilder = new ActivityDataMappingBuilder
            {
                DataList = activeDataList,
            };

            ioBuilder.SetupActivityData(activity);

            var mappingData = ioBuilder.Generate();

            // save model data
            //Outputs = mappingData.Outputs.ToObservableCollection();
            foreach (var ioViewModel in mappingData.Outputs)
            {
                Outputs.Add(ioViewModel);
            }
            //Inputs = mappingData.Inputs.ToObservableCollection();
            foreach (var ioViewModel in mappingData.Inputs)
            {
                Inputs.Add(ioViewModel);
            }

            // update special fields on the model?!
            var toSaveOutputMapping = ioBuilder.SavedOutputMapping;
            var toSaveInputMapping  = ioBuilder.SavedInputMapping;

            XmlOutput = toSaveOutputMapping;
            Activity.SavedOutputMapping = toSaveOutputMapping;
            Activity.LiveOutputMapping  = toSaveOutputMapping;

            XmlOutput = (XmlOutput + toSaveInputMapping);
            Activity.SavedInputMapping = toSaveInputMapping;
            Activity.LiveInputMapping  = toSaveInputMapping;
        }
Esempio n. 11
0
        public WebsiteEditorViewModel(IWebActivity webActivity)
        {
            WebCommunication    = ImportService.GetExportValue <IWebCommunication>();
            FileNameProvider    = ImportService.GetExportValue <IFileNameProvider>();
            UserMessageProvider = ImportService.GetExportValue <IUserMessageProvider>();

            if (webActivity == null)
            {
                throw new ArgumentNullException("webActivity");
            }
            _webActivity   = webActivity;
            _layoutObjects = new ObservableCollection <ILayoutObjectViewModel>();

            _resource = webActivity.ResourceModel;

            InitializeWebResources();
            SetDefaultWebpage();
        }
Esempio n. 12
0
        public WebsiteEditorViewModel(IWebActivity webActivity)
        {
            WebCommunication = ImportService.GetExportValue<IWebCommunication>();
            FileNameProvider = ImportService.GetExportValue<IFileNameProvider>();
            UserMessageProvider = ImportService.GetExportValue<IUserMessageProvider>();

            if(webActivity == null)
            {
                throw new ArgumentNullException("webActivity");
            }
            _webActivity = webActivity;
            _layoutObjects = new ObservableCollection<ILayoutObjectViewModel>();

            _resource = webActivity.ResourceModel;

            InitializeWebResources();
            SetDefaultWebpage();
        }
        public void WebActivity_IsConnected_PassThrough(bool retConnected, bool retLoaded, bool expected)
        {
            DsfActivity Act = new DsfActivity();

            Act.ServiceName   = "testResource";
            Act.InputMapping  = @"<Inputs><Input Name=""Host"" Source=""Host"" DefaultValue=""mail.bellevuenet.co.za""><Validator Type=""Required"" /></Input><Input Name=""Port"" Source=""Port"" DefaultValue=""25""><Validator Type=""Required"" /></Input><Input Name=""From"" Source=""From"" DefaultValue=""*****@*****.**""><Validator Type=""Required"" /></Input><Input Name=""To"" Source=""To""><Validator Type=""Required"" /></Input><Input Name=""Subject"" Source=""Subject""><Validator Type=""Required"" /></Input><Input Name=""BodyType"" Source=""Bodytype"" DefaultValue=""html""><Validator Type=""Required"" /></Input><Input Name=""Body"" Source=""Body""><Validator Type=""Required"" /></Input><Input Name=""Attachment"" Source=""Attachment"" DefaultValue=""NONE""><Validator Type=""Required"" /></Input></Inputs>";
            Act.OutputMapping = @"<Outputs><Output Name=""FailureMessage"" MapsTo=""FailureMessage"" Value=""[[FailureMessage]]"" /><Output Name=""Message"" MapsTo=""Message"" Value=""[[Message]]"" /></Outputs>";
            ModelItem testItem = TestModelItemFactory.CreateModelItem(Act);
            var       resource = new Mock <IContextualResourceModel>();
            var       env      = new Mock <IEnvironmentModel>();

            resource.Setup(a => a.Environment).Returns(env.Object);
            env.Setup(a => a.IsConnected).Returns(retConnected);
            env.Setup(a => a.HasLoadedResources).Returns(retLoaded);
            string serviceName = "cake";

            IWebActivity webActivity = WebActivityFactory.CreateWebActivity(testItem, resource.Object, serviceName);

            Assert.AreEqual(expected, webActivity.IsNotAvailable());
        }
Esempio n. 14
0
        internal void Initialize(IWebActivity activity)
        {
            Activity     = activity;
            ActivityName = activity.ServiceName;

            var activeDataList = string.Empty;

            if (DataListSingleton.ActiveDataList != null)
            {
                activeDataList = DataListSingleton.DataListAsXmlString;
            }

            var ioBuilder = new ActivityDataMappingBuilder
            {
                DataList = activeDataList,
            };

            ioBuilder.SetupActivityData(activity);

            var mappingData = ioBuilder.Generate();

            foreach (var ioViewModel in mappingData.Outputs)
            {
                Outputs.Add(ioViewModel);
            }
            foreach (var ioViewModel in mappingData.Inputs)
            {
                Inputs.Add(ioViewModel);
            }
            var toSaveOutputMapping = ioBuilder.SavedOutputMapping;
            var toSaveInputMapping  = ioBuilder.SavedInputMapping;

            XmlOutput = toSaveOutputMapping;
            Activity.SavedOutputMapping = toSaveOutputMapping;
            Activity.LiveOutputMapping  = toSaveOutputMapping;

            XmlOutput = XmlOutput + toSaveInputMapping;
            Activity.SavedInputMapping = toSaveInputMapping;
            Activity.LiveInputMapping  = toSaveInputMapping;
        }
        internal void AddWebPageDesigner(IWebActivity webActivity)
        {
            if (webActivity == null) return;

            string xmlConfig = "<WebParts/>";

            if (!String.IsNullOrEmpty(webActivity.XMLConfiguration))
            {
                xmlConfig = webActivity.XMLConfiguration;
            }

            if (xmlConfig.StartsWith("[[")) return;

            if (!XmlHelper.IsValidXElement(xmlConfig)) return;

            var l = new LayoutGridViewModel(webActivity);
            ImportService.SatisfyImports(l);
            var layoutGrid = new AutoLayoutGridWindow(l);

            UIElementTitleProperty.SetTitle(layoutGrid,
                                            string.Format("{0}/{1}.ui", webActivity.ResourceModel.ResourceName,
                                                          (webActivity.WebActivityObject as dynamic).DisplayName));
            UIElementImageProperty.SetImage(layoutGrid, "pack://application:,,,/Images/User.png");
            UIElementTabActionContext.SetTabActionContext(layoutGrid, WorkSurfaceContext.Webpage);
            //Set the active page to signal user interface transitions.
            if (l.LayoutObjects.Any())
            {
                MainViewModel.SetActivePage(l.LayoutObjects.First());
            }

            foreach (FrameworkElement tab in Tabs)
            {
                if (UIElementTitleProperty.GetTitle(tab) == UIElementTitleProperty.GetTitle(layoutGrid))
                {
                    SetActiveDocument(tab);
                    return;
                }
            }

            Tabs.Add(layoutGrid);
            SetActiveDocument(layoutGrid);
        }
        internal void WorkflowActivitySelected(IWebActivity activity)
        {
            var mappingVm = new DataMappingViewModel(activity);
            var mappingView = new DataMapping { DataContext = mappingVm };

            if (DataMappingPane == null)
                return;

            DataMappingPane.Content = mappingView;
        }
Esempio n. 17
0
 public DataMappingViewModel(IWebActivity activity)
     : this(activity, null)
 {
 }
 public IDataMappingViewModel CreateModel(IWebActivity activity, NotifyCollectionChangedEventHandler mappingCollectionChangedEventHandler) => new DataMappingViewModel(activity, mappingCollectionChangedEventHandler);
 public IDataMappingViewModel CreateModel(IWebActivity activity) => CreateModel(activity, null);
        /// <summary>
        /// Setups the activity data.
        /// </summary>
        /// <param name="activity">The activity.</param>
        public void SetupActivityData(IWebActivity activity)
        {
            if(activity != null)
            {
                SavedInputMapping = activity.SavedInputMapping;
                SavedOutputMapping = activity.SavedOutputMapping;
                ActivityType = activity.UnderlyingWebActivityObjectType;

                if(activity.ResourceModel != null)
                {
                    IsWorkflow = activity.ResourceModel.ResourceType == Studio.Core.AppResources.Enums.ResourceType.WorkflowService;

                    string inputs;
                    string outputs;

                    // handle workflows differently ;)
                    if(IsWorkflow)
                    {
                        //if (!activity.ResourceModel.Environment.IsLocalHost && !activity.ResourceModel.Environment.HasLoadedResources)
                        if(activity.IsNotAvailable())
                        {
                            inputs = activity.ResourceModel.Inputs;
                            outputs = activity.ResourceModel.Outputs;

                        }
                        else
                        {
                            var datalist = activity.ResourceModel.DataList;

                            inputs = DataListUtil.GenerateSerializableDefsFromDataList(datalist,
                                                                                   enDev2ColumnArgumentDirection.Input);
                            outputs = DataListUtil.GenerateSerializableDefsFromDataList(datalist,
                                                                                    enDev2ColumnArgumentDirection.Output);
                        }
                    }
                    else
                    {
                        // handle services ;)
                        inputs = activity.ResourceModel.Inputs;
                        outputs = activity.ResourceModel.Outputs;
                    }

                    ActivityInputDefinitions = inputs;
                    ActivityOutputDefinitions = outputs;
                }

            }
        }
 public IDataMappingViewModel CreateModel(IWebActivity activity,
                                          NotifyCollectionChangedEventHandler mappingCollectionChangedEventHandler = null)
 {
     return  new DataMappingViewModel(activity,mappingCollectionChangedEventHandler);
 }
        internal void AddWebsiteDesigner(IWebActivity webActivity)
        {
            foreach (FrameworkElement tab in Tabs)
            {
                if (
                    !UIElementTitleProperty.GetTitle(tab)
                                           .Equals(
                                               string.Format("{0}.website", webActivity.ResourceModel.ResourceName),
                                               StringComparison.InvariantCultureIgnoreCase)) continue;
                SetActiveDocument(tab);
                return;
            }

            var viewModel = new WebsiteEditorViewModel(webActivity);
            ImportService.SatisfyImports(viewModel);
            var editor = new WebsiteEditorWindow(viewModel);
            UIElementTitleProperty.SetTitle(editor, string.Format("{0}.website", webActivity.ResourceModel.ResourceName));
            UIElementImageProperty.SetImage(editor, "pack://application:,,,/Images/webpagebuilder.png");
            UIElementTabActionContext.SetTabActionContext(editor, WorkSurfaceContext.Website);

            Tabs.Add(editor);
            SetActiveDocument(editor);
        }
Esempio n. 23
0
 public AutoMappingOutputAction(IDataMappingViewModel beforeAutoMapping, IWebActivity activity)
 {
     _beforeAutoMapping       = beforeAutoMapping;
     _copyOfBeforeAutoMapping = new DataMappingViewModel(activity);
 }