コード例 #1
0
ファイル: M2MTransformer.cs プロジェクト: theedward/xisweb
        public static XisInteractionSpace CreateDetailOrRefEditorIS(EA.Package package, XisEntity entity,
            XisInteractionSpace previousIS, EA.Element useCase, bool isDetail, EA.Element be)
        {
            EA.Diagram diagram = XisWebHelper.CreateDiagram(package, entity.Element.Name + "EditorIS Diagram",
                "XIS-Web_Diagrams::InteractionSpaceViewModel");
            XisInteractionSpace detailIS = new XisInteractionSpace(repository, package, diagram, entity.Element.Name + "EditorIS", entity.Element.Name + " Editor", InteractionSpaceType.DetailEntityEditor);

            //Image & Sitemap Creation - Define a proper source path!
            XisImage img = new XisImage(repository, detailIS, diagram, "../images/default.png");

            XisSiteMap siteMap = new XisSiteMap(repository, detailIS, diagram);

            XisForm form = new XisForm(repository, diagram, detailIS, entity.Element.Name + "Form", entity.Element.Name);

            if (!string.IsNullOrEmpty(entity.Filter))
            {
                List<EA.Attribute> filtered = GetFilteredAttributeList(entity);
                foreach (EA.Attribute attr in filtered)
                {
                    XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, entity.Element.Name);
                }
            }
            else
            {
                foreach (EA.Attribute attr in entity.Element.Attributes)
                {
                    XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, entity.Element.Name);
                }
            }

            XisMenu menu = new XisMenu(repository, diagram, detailIS, entity.Element.Name + "Menu", MenuType.OptionsMenu);

            if ((isDetail && (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase)))
                || (!isDetail && (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase))))
            {
                menu.SetEntityName(entity.Element.Name);
                string actionName = "save" + entity.Element.Name;
                XisMenuItem menuItem = new XisMenuItem(repository, diagram, menu, "Save" + entity.Element.Name, actionName);
                menuItem.SetValue("Save " + entity.Element.Name);
                XisWebHelper.CreateXisAction(repository, menuItem.Element, actionName, ActionType.OK, previousIS.Element.Name);
                CreateXisInteractionSpaceAssociation(actionName, detailIS, previousIS);
            }

            string cancelAction = "cancel" + entity.Element.Name;
            XisMenuItem cancelItem = new XisMenuItem(repository, diagram, menu, "Cancel" + entity.Element.Name, cancelAction);
            cancelItem.SetValue("Go Back "/* + entity.Element.Name*/);
            XisWebHelper.CreateXisAction(repository, cancelItem.Element, cancelAction, ActionType.Cancel);
            CreateXisInteractionSpaceAssociation("cancel" + entity.Element.Name, detailIS, previousIS);

            ComputePositions(detailIS, diagram);
            // Associate BE
            AssociateBEtoIS(diagram, detailIS, be);

            return detailIS;
        }
コード例 #2
0
ファイル: M2MTransformer.cs プロジェクト: theedward/xisweb
        public static void ProcessManagerUseCase(EA.Package package, XisEntity master,
            EA.Element useCase, EA.Element be, bool isStartingUC, List<EA.Element> useCases = null, String patternType = null)
        {
            // Create IS Diagram
            EA.Diagram listDiagram = XisWebHelper.CreateDiagram(package, master.Element.Name + "ListIS Diagram",
                "XIS-Web_Diagrams::InteractionSpaceViewModel");
            XisInteractionSpace listIS = null;

            if (isStartingUC && patternType != null)
            {
                listIS = new XisInteractionSpace(repository, package, listDiagram,
                    master.Element.Name + "ListIS", "Manage " + master.Element.Name + "s", InteractionSpaceType.MasterEntityList);
            }
            else
            {
                listIS = new XisInteractionSpace(repository, package, listDiagram,
                    master.Element.Name + "ListIS", "Manage " + master.Element.Name + "s", InteractionSpaceType.MasterEntityList, isStartingUC, !isStartingUC);

                if (isStartingUC && patternType == null)
                {
                    homeIS = listIS;
                }
            }

            //Image & Sitemap Creation - Define a proper source path!
            XisImage img = new XisImage(repository, listIS, listDiagram, "../images/default.png");

            XisSiteMap siteMap = new XisSiteMap(repository, listIS, listDiagram);

            // List Creation
            XisList list = new XisList(repository, listDiagram, listIS, master.Element.Name + "List");
            list.SetEntityName(master.Element.Name);

            //if (ContainsSearch(operations))
            //{
            //    string searchBy = "";
            //    string tv = null;

            //    foreach (EA.Attribute attr in master.Element.Attributes)
            //    {
            //        tv = GetAttributeTag(attr.TaggedValues, "isKey").Value;
            //        if (!string.IsNullOrEmpty(tv) && tv.ToLower() == "true")
            //        {
            //            searchBy += master.Element.Name + "." + attr.Name + ";";
            //        }
            //    }

            //    if (string.IsNullOrEmpty(searchBy))
            //    {
            //        list.SetSearchBy(master.Element.Name + ".Id");
            //    }
            //    else
            //    {
            //        list.SetSearchBy(searchBy.Substring(0, searchBy.Length - 1));
            //    }
            //}

            XisListItem item = new XisListItem(repository, listDiagram, list, list.Element.Name + "Item");

            if (ContainsUpdateMaster(useCase))
            {
                string actionName = "edit" + master.Element.Name;
                item.SetOnTapAction(actionName);
            }
            else if (ContainsReadMaster(useCase))
            {
                string actionName = "view" + master.Element.Name;
                item.SetOnTapAction(actionName);
            }

            if (master.Element.Attributes.Count > 1)
            {
                EA.Attribute first = master.Element.Attributes.GetAt(0);
                EA.Attribute second = master.Element.Attributes.GetAt(1);
                XisLabel lbl1 = new XisLabel(repository, item, listDiagram, first.Name + "Lbl");
                lbl1.SetEntityAttributeName(master.Element.Name + "." + first.Name);
                XisLabel lbl2 = new XisLabel(repository, item, listDiagram, second.Name + "Lbl");
                lbl2.SetEntityAttributeName(master.Element.Name + "." + second.Name);
            }
            else if (master.Element.Attributes.Count == 1)
            {
                EA.Attribute attr = master.Element.Attributes.GetAt(0);
                item.SetValueFromExpression(master.Element.Name + "." + attr.Name);
            }

            // Read, Update, Create
            //Menu Creation
            #region Create Options Menu
            Dictionary<ActionType, XisMenuItem> detailModes = new Dictionary<ActionType, XisMenuItem>(3);

            if (ContainsCreateMaster(useCase) || ContainsDeleteMaster(useCase))
            {
                XisMenu menu = new XisMenu(repository, listDiagram, listIS, listIS.Element.Name + "Menu", MenuType.OptionsMenu);

                if (ContainsCreateMaster(useCase))
                {
                    menu.SetEntityName(master.Element.Name);
                    string actionName = "create" + master.Element.Name;
                    XisMenuItem menuItem = new XisMenuItem(repository, listDiagram, menu,
                        "Create" + master.Element.Name + "Item", actionName);
                    menuItem.SetValue("Create " + master.Element.Name);
                    detailModes.Add(ActionType.Create, menuItem);
                }

                if (ContainsDeleteMaster(useCase))
                {
                    menu.SetEntityName(master.Element.Name);
                    string actionName = "deleteAll" + master.Element.Name + "s";
                    XisMenuItem menuItem = new XisMenuItem(repository, listDiagram, menu,
                        "DeleteAll" + master.Element.Name + "Item", actionName);
                    menuItem.SetValue("Delete all " + master.Element.Name + "s");
                    XisWebHelper.CreateXisAction(repository, menuItem.Element, actionName, ActionType.DeleteAll);
                }
                listIS.Menu = menu;
            }
            #endregion
            #region Create Context Menu
            if (ContainsReadMaster(useCase) || ContainsUpdateMaster(useCase) || ContainsDeleteMaster(useCase))
            {
                XisMenu context = new XisMenu(repository, listDiagram, package, list.Element.Name + "ContextMenu", MenuType.ContextMenu);

                if (ContainsReadMaster(useCase))
                {
                    context.SetEntityName(master.Element.Name);
                    string actionName = "view" + master.Element.Name;
                    XisMenuItem contextItem = new XisMenuItem(repository, listDiagram, context,
                        "View" + master.Element.Name + "Item", actionName);
                    contextItem.SetValue("View " + master.Element.Name);
                    detailModes.Add(ActionType.Read, contextItem);
                }

                if (ContainsUpdateMaster(useCase))
                {
                    context.SetEntityName(master.Element.Name);
                    string actionName = "edit" + master.Element.Name;
                    XisMenuItem contextItem = new XisMenuItem(repository, listDiagram, context,
                        "Edit" + master.Element.Name + "Item", actionName);
                    contextItem.SetValue("Edit " + master.Element.Name);
                    detailModes.Add(ActionType.Update, contextItem);
                }

                //This action is passing to the Editor page
                /*if (ContainsDeleteMaster(useCase))
                {
                    context.SetEntityName(master.Element.Name);
                    string actionName = "delete" + master.Element.Name;
                    XisMenuItem contextItem = new XisMenuItem(repository, listDiagram, context,
                        "Delete" + master.Element.Name + "Item", actionName);
                    contextItem.SetValue("Delete " + master.Element.Name);
                    XisWebHelper.CreateXisAction(repository, contextItem.Element, actionName, ActionType.Delete);
                }*/
                listIS.ContextMenu = context;
            }
            #endregion

            // Navigation between home UC and the others
            if (patternType != null)
            {
                AddToHomeISByPattern(useCase, listIS, patternType);
            }
            else if (isStartingUC)
            {
                if (useCases != null)
                {
                    AssociateFirstSubSpaces(listDiagram, useCases, listIS, be.ElementID, master.Element.Name);
                }
            }

            #region Check ServiceUC Extensions
            Dictionary<List<EA.Element>, bool> services = new Dictionary<List<EA.Element>, bool>();

            if (useCase.Connectors.Count > 0)
            {
                List<EA.Element> extends = new List<EA.Element>();
                Dictionary<EA.Element, bool> providers = new Dictionary<EA.Element, bool>();

                foreach (EA.Connector conn in useCase.Connectors)
                {
                    if (conn.Stereotype == "extend")
                    {
                        EA.Element el = repository.GetElementByID(conn.ClientID);
                        extends.Add(el);
                    }
                }

                foreach (EA.Element e in extends)
                {
                    bool hasBE = false;
                    EA.Element provider = null;

                    foreach (EA.Connector conn in e.Connectors)
                    {
                        if (conn.Stereotype == "XisServiceUC-BEAssociation")
                        {
                            hasBE = true;
                        }
                        else if (conn.Stereotype == "XisServiceUC-ProviderAssociation")
                        {
                            provider = repository.GetElementByID(conn.SupplierID);
                            providers.Add(provider, false);
                        }
                    }

                    if (provider != null && hasBE)
                    {
                        providers[provider] = true;
                    }
                }

                foreach (EA.Element p in providers.Keys)
                {
                    List<EA.Element> lst = new List<EA.Element>();

                    foreach (EA.Connector c in p.Connectors)
                    {
                        if (c.Stereotype == "XisProvider-ServiceRealization")
                        {
                            EA.Element el = repository.GetElementByID(c.SupplierID);
                            lst.Add(el);
                        }
                    }

                    if (lst.Count > 0)
                    {
                        services.Add(lst, providers[p]);
                    }
                }

                if (services.Count > 0)
                {
                    if (services.Values.Contains(true))
                    {
                        if (listIS.ContextMenu == null)
                        {
                            listIS.ContextMenu = new XisMenu(repository, listDiagram, package, list.Element.Name + "ContextMenu",
                                MenuType.ContextMenu);
                        }

                        foreach (List<EA.Element> lst in services.Keys)
                        {
                            if (services[lst])
                            {
                                foreach (EA.Element serv in lst)
                                {
                                    foreach (EA.Method method in serv.Methods)
                                    {
                                        if (method.Stereotype == "XisServiceMethod")
                                        {
                                            XisMenuItem menuItem = new XisMenuItem(repository, listDiagram, listIS.ContextMenu,
                                                method.Name, serv.Name + "." + method.Name);
                                            menuItem.SetValue(method.Name);
                                            XisWebHelper.CreateXisAction(repository, menuItem.Element, menuItem.GetOnTapAction(),
                                                ActionType.WebService);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (services.Values.Contains(false))
                    {
                        if (listIS.Menu == null)
                        {
                            listIS.Menu = new XisMenu(repository, listDiagram, listIS, listIS.Element.Name + "Menu", MenuType.OptionsMenu);
                        }

                        foreach (List<EA.Element> lst in services.Keys)
                        {
                            if (!services[lst])
                            {
                                foreach (EA.Element serv in lst)
                                {
                                    foreach (EA.Method method in serv.Methods)
                                    {
                                        if (method.Stereotype == "XisServiceMethod")
                                        {
                                            XisMenuItem menuItem = new XisMenuItem(repository, listDiagram, listIS.Menu,
                                                method.Name, serv.Name + "." + method.Name);
                                            menuItem.SetValue(method.Name);
                                            XisWebHelper.CreateXisAction(repository, menuItem.Element, menuItem.GetOnTapAction(),
                                                ActionType.WebService);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            if (detailModes.Count > 0 || !string.IsNullOrEmpty(item.GetOnTapAction()))
            {
                XisInteractionSpace detailIS = CreateMasterEditorIS(package, master, listIS, useCase, be, services);

                foreach (ActionType key in detailModes.Keys)
                {
                    XisMenuItem mItem = detailModes[key];
                    XisWebHelper.CreateXisAction(repository, mItem.Element, mItem.GetOnTapAction(),
                        key, detailIS.Element.Name);
                    CreateXisInteractionSpaceAssociation(mItem.GetOnTapAction(), listIS, detailIS);
                }

                if (!string.IsNullOrEmpty(item.GetOnTapAction()))
                {
                    XisWebHelper.CreateXisAction(repository, item.Element, item.GetOnTapAction(),
                        ActionType.Update, detailIS.Element.Name);
                    CreateXisInteractionSpaceAssociation(item.GetOnTapAction(), listIS, detailIS);
                }
            }

            if (homeIS != listIS)
            {
                if (listIS.Menu == null)
                {
                    listIS.Menu = new XisMenu(repository, listDiagram, listIS, listIS.Element.Name + "Menu", MenuType.OptionsMenu);
                }

                string actionBack = "backTo" + homeIS.Element.Name;
                XisMenuItem backMenuItem = new XisMenuItem(repository, listDiagram, listIS.Menu,
                    "BackTo" + homeIS.Element.Name + "Item", actionBack);
                backMenuItem.SetValue("Go Back");
                XisWebHelper.CreateXisAction(repository, backMenuItem.Element, actionBack, ActionType.Cancel);
                CreateXisInteractionSpaceAssociation(actionBack, listIS, homeIS);
            }

            ComputePositions(listIS, listDiagram);

            if (listIS.ContextMenu != null)
            {
                EA.DiagramObject obj = listIS.GetDiagramObject(listDiagram);
                int center = (obj.top + obj.bottom) / -2;
                listIS.ContextMenu.SetPosition(listDiagram, obj.right + 50, obj.right + 330, -obj.top, -obj.top + 70);
                ComputePositions(listIS.ContextMenu, listDiagram);

                // Create XisIS-MenuAssociation
                EA.DiagramObject sourceObj = item.GetDiagramObject(listDiagram);
                EA.Connector c = item.Element.Connectors.AddNew("", "Association");
                c.ClientID = item.Element.ElementID;
                c.SupplierID = listIS.ContextMenu.Element.ElementID;
                c.Direction = "Source -> Destination";
                c.Stereotype = "XisIS-MenuAssociation";
                c.Update();
                item.Element.Update();
                item.Element.Connectors.Refresh();
            }

            // Associate BE
            AssociateBEtoIS(listDiagram, listIS, be);

            if (!isStartingUC)
            {
                // TODO: Link subspaces
                //CreateXisInteractionSpaceAssociation(repository, "goTo" + listIS.Element.Name, homeIS, listIS);
            }
        }
コード例 #3
0
ファイル: M2MTransformer.cs プロジェクト: theedward/xisweb
        private static XisInteractionSpace CreateMasterEditorIS(EA.Package package, XisEntity master,
            XisInteractionSpace previousIS, EA.Element useCase, EA.Element be, Dictionary<List<EA.Element>, bool> services)
        {
            EA.Diagram diagram = XisWebHelper.CreateDiagram(package, master.Element.Name + "EditorIS Diagram",
                "XIS-Web_Diagrams::InteractionSpaceViewModel");
            XisInteractionSpace detailIS = new XisInteractionSpace(repository, package, diagram, master.Element.Name + "EditorIS",
                master.Element.Name + " Editor", InteractionSpaceType.MasterEntityEditor, false, true);

            //Image & Sitemap Creation - Define a proper source path!
            XisImage img = new XisImage(repository, detailIS, diagram, "../images/default.png");

            XisSiteMap siteMap = new XisSiteMap(repository, detailIS, diagram);

            #region Process Master attributes
            if (!string.IsNullOrEmpty(master.Filter))
            {
                XisForm form = new XisForm(repository, diagram, detailIS, master.Element.Name + "Form", master.Element.Name);
                List<EA.Attribute> filtered = GetFilteredAttributeList(master);
                foreach (EA.Attribute attr in filtered)
                {
                    XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, master.Element.Name);
                }
            }
            else
            {
                XisForm form = new XisForm(repository, diagram, detailIS, master.Element.Name + "Form", master.Element.Name);
                foreach (EA.Attribute attr in master.Element.Attributes)
                {
                    XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, master.Element.Name);
                }
            }
            #endregion

            #region Write Details info
            foreach (XisEntity d in master.Details)
            {
                if (d.Cardinality.Contains("*"))
                {
                    // Needs Manager screen
                    //string actionName = "goTo" + d.Element.Name + "ManagerIS";
                    //XisButton btn = new XisButton(repository, detailIS, diagram, d.Element.Name + "ManagerButton", actionName);
                    //btn.SetValue("Manage " + d.Element.Name);
                    //XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, managerIS.Element.Name);
                    //CreateXisInteractionSpaceAssociation(actionName, detailIS, managerIS);
                    XisCollapsible collapsible = CreateDetailOrRefManagerCollapsible(package, diagram, d, detailIS, useCase, true, be, d.Element.Name + "Collapsible");
                }
                else
                {
                    List<EA.Attribute> filtered = new List<EA.Attribute>();

                    if (!string.IsNullOrEmpty(d.Filter))
                    {
                        filtered = GetFilteredAttributeList(d);
                    }

                    if (filtered.Count > 0)
                    {
                        if (filtered.Count > 3)
                        {
                            string actionName = "goTo" + d.Element.Name + "EditorIS";
                            XisButton btn = new XisButton(repository, detailIS, diagram, d.Element.Name + "EditorButton", actionName);
                            btn.SetValue(d.Element.Name);
                            XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, d, detailIS, useCase, true, be);
                            XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name);
                            CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS);
                        }
                        else
                        {
                            XisForm form = new XisForm(repository, diagram, detailIS, d.Element.Name + "Form", d.Element.Name);
                            foreach (EA.Attribute attr in filtered)
                            {
                                XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, d.Element.Name);
                            }

                            if (ContainsReadDetail(useCase))
                            {
                                if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase))
                                {
                                    XisVisibilityBoundary b = new XisVisibilityBoundary(repository, diagram, form,
                                        "Save" + d.Element.Name + "Boundary", ContainsCreateDetail(useCase), false, ContainsUpdateDetail(useCase));
                                    b.SetEntityName(d.Element.Name);
                                    string actionName = "save" + d.Element.Name;
                                    XisButton btn = new XisButton(repository, b, diagram, d.Element.Name + "SaveButton", actionName);
                                    btn.SetValue("Save " + d.Element.Name);
                                    XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                                }
                            }
                            else if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase))
                            {
                                string actionName = "save" + d.Element.Name;
                                XisButton btn = new XisButton(repository, form, diagram, d.Element.Name + "SaveButton", actionName);
                                btn.SetValue("Save " + d.Element.Name);
                                XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                            }
                        }
                    }
                    else if (d.Element.Attributes.Count > 3)
                    {
                        string actionName = "goTo" + d.Element.Name + "EditorIS";
                        XisButton btn = new XisButton(repository, detailIS, diagram, d.Element.Name + "EditorButton", actionName);
                        btn.SetValue(d.Element.Name);
                        XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, d, detailIS, useCase, true, be);
                        XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name);
                        CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS);
                    }
                    else
                    {
                        XisForm form = new XisForm(repository, diagram, detailIS, d.Element.Name + "Form", d.Element.Name);
                        foreach (EA.Attribute attr in d.Element.Attributes)
                        {
                            XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, d.Element.Name);
                        }

                        if (ContainsReadDetail(useCase))
                        {
                            if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase))
                            {
                                XisVisibilityBoundary b = new XisVisibilityBoundary(repository, diagram, form,
                                    "Save" + d.Element.Name + "Boundary", ContainsCreateDetail(useCase), false, ContainsUpdateDetail(useCase));
                                b.SetEntityName(d.Element.Name);
                                string actionName = "save" + d.Element.Name;
                                XisButton btn = new XisButton(repository, b, diagram, d.Element.Name + "SaveButton", actionName);
                                btn.SetValue("Save " + d.Element.Name);
                                XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                            }
                        }
                        else if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase))
                        {
                            string actionName = "save" + d.Element.Name;
                            XisButton btn = new XisButton(repository, form, diagram, d.Element.Name + "SaveButton", actionName);
                            btn.SetValue("Save " + d.Element.Name);
                            XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                        }
                    }
                }
            }
            #endregion

            #region Write References info
            foreach (XisEntity r in master.References)
            {
                if (r.Cardinality.Contains("*"))
                {
                    //// Needs Manager screen
                    //string actionName = "goTo" + r.Element.Name + "ManagerIS";
                    //XisButton btn = new XisButton(repository, detailIS, diagram, r.Element.Name + "ManagerButton", actionName);
                    //btn.SetValue("Manage " + r.Element.Name);
                    //XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, viewIS.Element.Name);
                    //CreateXisInteractionSpaceAssociation(actionName, detailIS, viewIS);
                    XisCollapsible collapsible = CreateDetailOrRefManagerCollapsible(package, diagram, r, detailIS, useCase, false, be, r.Element.Name);
                }
                else
                {
                    List<EA.Attribute> filtered = new List<EA.Attribute>();

                    if (!string.IsNullOrEmpty(r.Filter))
                    {
                        filtered = GetFilteredAttributeList(r);
                    }

                    if (filtered.Count > 0)
                    {
                        if (filtered.Count > 3)
                        {
                            string actionName = "goTo" + r.Element.Name + "EditorIS";
                            XisButton btn = new XisButton(repository, detailIS, diagram, r.Element.Name + "EditorButton", actionName);
                            btn.SetValue(r.Element.Name);
                            XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, r, detailIS, useCase, false, be);
                            XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name);
                            CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS);
                        }
                        else
                        {
                            XisForm form = new XisForm(repository, diagram, detailIS, r.Element.Name + "Form", r.Element.Name);
                            foreach (EA.Attribute attr in filtered)
                            {
                                XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, r.Element.Name);
                            }

                            if (ContainsReadReference(useCase))
                            {
                                if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase))
                                {
                                    XisVisibilityBoundary b = new XisVisibilityBoundary(repository, diagram, form,
                                        "Save" + r.Element.Name + "Boundary", ContainsCreateReference(useCase), false, ContainsUpdateReference(useCase));
                                    b.SetEntityName(r.Element.Name);
                                    string actionName = "save" + r.Element.Name;
                                    XisButton btn = new XisButton(repository, b, diagram, r.Element.Name + "SaveButton", actionName);
                                    btn.SetValue("Save " + r.Element.Name);
                                    XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                                }
                            }
                            else if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase))
                            {
                                string actionName = "save" + r.Element.Name;
                                XisButton btn = new XisButton(repository, form, diagram, r.Element.Name + "SaveButton", actionName);
                                btn.SetValue("Save " + r.Element.Name);
                                XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                            }
                        }
                    }
                    else if (r.Element.Attributes.Count > 3)
                    {
                        string actionName = "goTo" + r.Element.Name + "EditorIS";
                        XisButton btn = new XisButton(repository, detailIS, diagram, r.Element.Name + "EditorButton", actionName);
                        btn.SetValue(r.Element.Name);
                        XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, r, detailIS, useCase, false, be);
                        XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name);
                        CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS);
                    }
                    else
                    {
                        XisForm form = new XisForm(repository, diagram, detailIS, r.Element.Name + "Form", r.Element.Name);
                        foreach (EA.Attribute attr in r.Element.Attributes)
                        {
                            XisWebHelper.ProcessXisAttribute(repository, diagram, form, attr, r.Element.Name);
                        }

                        if (ContainsReadReference(useCase))
                        {
                            if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase))
                            {
                                XisVisibilityBoundary b = new XisVisibilityBoundary(repository, diagram, form,
                                    "Save" + r.Element.Name + "Boundary", ContainsCreateReference(useCase), false, ContainsUpdateReference(useCase));
                                b.SetEntityName(r.Element.Name);
                                string actionName = "save" + r.Element.Name;
                                XisButton btn = new XisButton(repository, b, diagram, r.Element.Name + "SaveButton", actionName);
                                btn.SetValue("Save " + r.Element.Name);
                                XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                            }
                        }
                        else if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase))
                        {
                            string actionName = "save" + r.Element.Name;
                            XisButton btn = new XisButton(repository, form, diagram, r.Element.Name + "SaveButton", actionName);
                            btn.SetValue("Save " + r.Element.Name);
                            XisWebHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK);
                        }
                    }
                }
            }
            #endregion

            XisMenu menu = new XisMenu(repository, diagram, detailIS, detailIS.Element.Name + "Menu", MenuType.OptionsMenu);

            if (ContainsCreateMaster(useCase) || ContainsUpdateMaster(useCase))
            {
                menu.SetEntityName(master.Element.Name);
                string actionName = "save" + master.Element.Name;
                XisWidget parent = menu;

                if (ContainsReadMaster(useCase))
                {
                    parent = new XisVisibilityBoundary(repository, diagram, menu, "Save" + master.Element.Name + "Boundary",
                        ContainsCreateMaster(useCase), false, ContainsUpdateMaster(useCase));
                    ((XisVisibilityBoundary)parent).SetEntityName(master.Element.Name);
                }

                XisMenuItem menuItem = new XisMenuItem(repository, diagram, parent, "Save" + master.Element.Name, actionName);
                menuItem.SetValue("Save " + master.Element.Name);
                XisWebHelper.CreateXisAction(repository, menuItem.Element, actionName, ActionType.OK, previousIS.Element.Name);
                CreateXisInteractionSpaceAssociation(actionName, detailIS, previousIS);
            }

            if (ContainsDeleteMaster(useCase))
            {
                XisWidget parent = menu;

                menu.SetEntityName(master.Element.Name);
                string actionName = "delete" + master.Element.Name;
                XisMenuItem contextItem = new XisMenuItem(repository, diagram, parent,
                    "Delete" + master.Element.Name + "Item", actionName);
                contextItem.SetValue("Delete " + master.Element.Name);
                XisWebHelper.CreateXisAction(repository, contextItem.Element, actionName, ActionType.Delete);
            }

            #region Check ServiceUC Extensions
            if (services.Count > 0)
            {
                if (services.Values.Contains(true))
                {
                    foreach (List<EA.Element> lst in services.Keys)
                    {
                        if (services[lst])
                        {
                            foreach (EA.Element serv in lst)
                            {
                                foreach (EA.Method method in serv.Methods)
                                {
                                    if (method.Stereotype == "XisServiceMethod")
                                    {
                                        XisMenuItem menuItem = new XisMenuItem(repository, diagram, menu,
                                            method.Name, serv.Name + "." + method.Name);
                                        menuItem.SetValue(method.Name);
                                        XisWebHelper.CreateXisAction(repository, menuItem.Element, menuItem.GetOnTapAction(),
                                            ActionType.WebService);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            string cancelAction = "cancel" + master.Element.Name;
            XisMenuItem cancelItem = new XisMenuItem(repository, diagram, menu, "Cancel" + master.Element.Name, cancelAction);
            cancelItem.SetValue("Go Back"/*+ master.Element.Name*/);
            XisWebHelper.CreateXisAction(repository, cancelItem.Element, cancelAction, ActionType.Cancel, previousIS.Element.Name);
            CreateXisInteractionSpaceAssociation(cancelAction, detailIS, previousIS);

            ComputePositions(detailIS, diagram);

            // Associate BE
            AssociateBEtoIS(diagram, detailIS, be);

            return detailIS;
        }
コード例 #4
0
ファイル: M2MTransformer.cs プロジェクト: theedward/xisweb
        private static void AddToHomeISByPattern(EA.Element useCase, XisInteractionSpace targetIS, string patternType)
        {
            //sString actionName = "goTo" + targetIS.Element.Name;

            switch (patternType)
            {
                //case "Springboard":
                //    XisButton b = new XisButton(repository, homeIS, homeDiagram, useCase.Name, actionName);
                //    b.SetValue(useCase.Name);
                //    XisWebHelper.CreateXisAction(repository, b.Element, actionName, ActionType.Navigate, targetIS.Element.Name);
                //    CreateXisInteractionSpaceAssociation(actionName, homeIS, targetIS);
                //    break;
                case "List Menu":
                    //Image & Sitemap Creation
                    if (homeIS.Widgets.Count == 0)
                    {
                        XisImage img = new XisImage(repository, homeIS, homeDiagram, "../images/default.png");

                        XisSiteMap siteMap = new XisSiteMap(repository, homeIS, homeDiagram);
                    }

                    //XisList list = null;
                    //if (homeIS.Widgets.Count > 0)
                    //{
                    //    list = homeIS.Widgets.First() as XisList;
                    //}
                    //else
                    //{
                    //    list = new XisList(repository, homeDiagram, homeIS, homeIS.Element.Name + "List");
                    //}
                    //XisListItem item = new XisListItem(repository, homeDiagram, list, useCase.Name, actionName);
                    //XisWebHelper.CreateXisAction(repository, item.Element, actionName, ActionType.Navigate, targetIS.Element.Name);
                    //CreateXisInteractionSpaceAssociation(actionName, homeIS, targetIS);
                    break;
                //case "Tab Menu":
                //    // TODO: Implement Tab
                //    break;
                default:
                    break;
            }
        }