public static void ProcessDetailUseCase(EA.Package package, XisEntity master, EA.Element useCase, EA.Element be, bool isStartingUC, List<EA.Element> useCases = null, String patternType = null) { EA.Diagram detailDiagram = XISMobileHelper.CreateDiagram(package, master.Element.Name + "EditorIS Diagram", "XIS-Mobile_Diagrams::InteractionSpaceViewModel"); XisInteractionSpace detailIS = null; if (isStartingUC && patternType != null) { detailIS = new XisInteractionSpace(repository, package, detailDiagram, master.Element.Name + "EditorIS", master.Element.Name + " Editor"); } else { detailIS = new XisInteractionSpace(repository, package, detailDiagram, master.Element.Name + "EditorIS", master.Element.Name + " Editor", isStartingUC, !isStartingUC); if (isStartingUC && patternType == null) { homeIS = detailIS; } } #region Process Master attributes if (!string.IsNullOrEmpty(master.Filter)) { XisForm form = new XisForm(repository, detailDiagram, detailIS, master.Element.Name + "Form", master.Element.Name); List<EA.Attribute> filtered = GetFilteredAttributeList(master); foreach (EA.Attribute attr in filtered) { XISMobileHelper.ProcessXisAttribute(repository, detailDiagram, form, attr, master.Element.Name); } } else { XisForm form = new XisForm(repository, detailDiagram, detailIS, master.Element.Name + "Form", master.Element.Name); foreach (EA.Attribute attr in master.Element.Attributes) { XISMobileHelper.ProcessXisAttribute(repository, detailDiagram, form, attr, master.Element.Name); } } #endregion #region Process 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, detailDiagram, d.Element.Name + "ManagerButton", actionName); btn.SetValue("Manage " + d.Element.Name); XisInteractionSpace managerIS = CreateDetailOrRefManagerIS(package, d, detailIS, useCase, true, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, managerIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, managerIS); } 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, detailDiagram, d.Element.Name + "EditorButton", actionName); btn.SetValue(d.Element.Name); XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, d, detailIS, useCase, true, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS); } else { XisForm form = new XisForm(repository, detailDiagram, detailIS, d.Element.Name + "Form", d.Element.Name); foreach (EA.Attribute attr in filtered) { XISMobileHelper.ProcessXisAttribute(repository, detailDiagram, form, attr, d.Element.Name); } if (ContainsReadDetail(useCase)) { if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase)) { XisVisibilityBoundary b = new XisVisibilityBoundary(repository, detailDiagram, 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, detailDiagram, d.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + d.Element.Name); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK); } } else if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase)) { string actionName = "save" + d.Element.Name; XisButton btn = new XisButton(repository, detailIS, detailDiagram, d.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + d.Element.Name); XISMobileHelper.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, detailDiagram, d.Element.Name + "EditorButton", actionName); btn.SetValue(d.Element.Name); XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, d, detailIS, useCase, true, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS); } else { XisForm form = new XisForm(repository, detailDiagram, detailIS, d.Element.Name + "Form", d.Element.Name); foreach (EA.Attribute attr in d.Element.Attributes) { XISMobileHelper.ProcessXisAttribute(repository, detailDiagram, form, attr, d.Element.Name); } if (ContainsReadDetail(useCase)) { if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase)) { XisVisibilityBoundary b = new XisVisibilityBoundary(repository, detailDiagram, 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, detailDiagram, d.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + d.Element.Name); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK); } } else if (ContainsCreateDetail(useCase) || ContainsUpdateDetail(useCase)) { string actionName = "save" + d.Element.Name; XisButton btn = new XisButton(repository, detailIS, detailDiagram, d.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + d.Element.Name); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK); } } } } #endregion #region Process 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, detailDiagram, r.Element.Name + "ManagerButton", actionName); btn.SetValue("Manage " + r.Element.Name); XisInteractionSpace viewIS = CreateDetailOrRefManagerIS(package, r, detailIS, useCase, false, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, viewIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, viewIS); } 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, detailDiagram, r.Element.Name + "EditorButton", actionName); btn.SetValue(r.Element.Name); XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, r, detailIS, useCase, false, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS); } else { XisForm form = new XisForm(repository, detailDiagram, detailIS, r.Element.Name + "Form", r.Element.Name); foreach (EA.Attribute attr in filtered) { XISMobileHelper.ProcessXisAttribute(repository, detailDiagram, form, attr, r.Element.Name); } if (ContainsReadReference(useCase)) { if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase)) { XisVisibilityBoundary b = new XisVisibilityBoundary(repository, detailDiagram, 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, detailDiagram, r.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + r.Element.Name); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK); } } else if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase)) { string actionName = "save" + r.Element.Name; XisButton btn = new XisButton(repository, detailIS, detailDiagram, r.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + r.Element.Name); XISMobileHelper.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, detailDiagram, r.Element.Name + "EditorButton", actionName); btn.SetValue(r.Element.Name); XisInteractionSpace editorIS = CreateDetailOrRefEditorIS(package, r, detailIS, useCase, false, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, editorIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, editorIS); } else { XisForm form = new XisForm(repository, detailDiagram, detailIS, r.Element.Name + "Form", r.Element.Name); foreach (EA.Attribute attr in r.Element.Attributes) { XISMobileHelper.ProcessXisAttribute(repository, detailDiagram, form, attr, r.Element.Name); } if (ContainsReadReference(useCase)) { if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase)) { XisVisibilityBoundary b = new XisVisibilityBoundary(repository, detailDiagram, 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, detailDiagram, r.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + r.Element.Name); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK); } } else if (ContainsCreateReference(useCase) || ContainsUpdateReference(useCase)) { string actionName = "save" + r.Element.Name; XisButton btn = new XisButton(repository, detailIS, detailDiagram, r.Element.Name + "SaveButton", actionName); btn.SetValue("Save " + r.Element.Name); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.OK); } } } } #endregion // Navigation between main UC and the others if (patternType != null) { AddToHomeISByPattern(useCase, detailIS, patternType); } else if (isStartingUC) { if (useCases != null) { AssociateFirstSubSpaces(detailDiagram, useCases, detailIS, be.ElementID, master.Element.Name); } } if (ContainsCreateMaster(useCase) || ContainsUpdateMaster(useCase)) { XisWidget parent = detailIS; if (ContainsReadMaster(useCase)) { parent = new XisVisibilityBoundary(repository, detailDiagram, detailIS, "Save" + master.Element.Name + "Boundary", ContainsCreateMaster(useCase), false, ContainsUpdateMaster(useCase)); ((XisVisibilityBoundary)parent).SetEntityName(master.Element.Name); } XisMenu menu = new XisMenu(repository, detailDiagram, parent, detailIS.Element.Name + "Menu", MenuType.OptionsMenu); menu.SetEntityName(master.Element.Name); string actionName = "save" + master.Element.Name; XisMenuItem menuItem = new XisMenuItem(repository, detailDiagram, menu, "Save" + master.Element.Name, actionName); menuItem.SetValue("Save " + master.Element.Name); XISMobileHelper.CreateXisAction(repository, menuItem.Element, actionName, ActionType.OK); detailIS.Menu = menu; } #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 (detailIS.Menu == null) { detailIS.Menu = new XisMenu(repository, detailDiagram, detailIS, detailIS.Element.Name + "Menu", MenuType.OptionsMenu); } foreach (List<EA.Element> lst in services.Keys) { foreach (EA.Element serv in lst) { foreach (EA.Method method in serv.Methods) { if (method.Stereotype == "XisServiceMethod") { XisMenuItem menuItem = new XisMenuItem(repository, detailDiagram, detailIS.Menu, method.Name, serv.Name + "." + method.Name); menuItem.SetValue(method.Name); XISMobileHelper.CreateXisAction(repository, menuItem.Element, menuItem.GetOnTapAction(), ActionType.WebService); } } } } } } #endregion if (homeIS != detailIS) { if (detailIS.Menu == null) { detailIS.Menu = new XisMenu(repository, detailDiagram, detailIS, detailIS.Element.Name + "Menu", MenuType.OptionsMenu); } string actionBack = "backTo" + homeIS.Element.Name; XisMenuItem backMenuItem = new XisMenuItem(repository, detailDiagram, detailIS.Menu, "BackTo" + homeIS.Element.Name + "Item", actionBack); backMenuItem.SetValue("Back"); XISMobileHelper.CreateXisAction(repository, backMenuItem.Element, actionBack, ActionType.Cancel); CreateXisInteractionSpaceAssociation(actionBack, detailIS, homeIS); } ComputePositions(detailIS, detailDiagram); // Associate BE AssociateBEtoIS(detailDiagram, detailIS, be); if (detailIS.GetDiagramObject(nsDiagram) == null && isStartingUC) { detailIS.SetPosition(nsDiagram, 355, 445, 10, 80); } if (!isStartingUC) { // TODO: Link subspaces //CreateXisInteractionSpaceAssociation("goTo" + detailIS.Element.Name, homeIS, detailIS); } }
private static void AssociateFirstSubSpaces(EA.Diagram diagram, List<EA.Element> useCases, XisInteractionSpace space, int beID, string master) { XisButton btn = null; EA.Element auxBE = null; string entityName = null; string ucType = null; foreach (EA.Element uc in useCases) { foreach (EA.Connector c in uc.Connectors) { if (c.Stereotype == "XisEntityUC-BEAssociation") { if (c.SupplierID != beID) { auxBE = repository.GetElementByID(c.SupplierID); foreach (EA.Connector conn in auxBE.Connectors) { if (conn.Stereotype == "XisBE-EntityMasterAssociation") { entityName = repository.GetElementByID(conn.SupplierID).Name; } } } else { entityName = master; } break; } } ucType = GetTaggedValue(uc.TaggedValues, "type").Value; string spaceName = null; if (ucType == "EntityManagement") { spaceName = entityName + "ListIS"; } else if (ucType == "EntityConfiguration") { spaceName = entityName + "DetailIS"; } string actionName = "goTo" + spaceName; btn = new XisButton(repository, space, diagram, actionName + "Button", actionName); btn.SetValue(entityName); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, spaceName); } }
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 = XISMobileHelper.CreateDiagram(package, master.Element.Name + "EditorIS Diagram", "XIS-Mobile_Diagrams::InteractionSpaceViewModel"); XisInteractionSpace detailIS = new XisInteractionSpace(repository, package, diagram, master.Element.Name + "EditorIS", master.Element.Name + " Editor", false, true); #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) { XISMobileHelper.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) { XISMobileHelper.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); XisInteractionSpace managerIS = CreateDetailOrRefManagerIS(package, d, detailIS, useCase, true, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, managerIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, managerIS); } 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); XISMobileHelper.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) { XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.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) { XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.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); XisInteractionSpace viewIS = CreateDetailOrRefManagerIS(package, r, detailIS, useCase, false, be); XISMobileHelper.CreateXisAction(repository, btn.Element, actionName, ActionType.Navigate, viewIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, viewIS); } 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); XISMobileHelper.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) { XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.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) { XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.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); XISMobileHelper.CreateXisAction(repository, menuItem.Element, actionName, ActionType.OK, previousIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, detailIS, previousIS); } #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); XISMobileHelper.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("Cancel " + master.Element.Name); XISMobileHelper.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; }
private static void AddToHomeISByPattern(EA.Element useCase, XisInteractionSpace targetIS, string patternType) { String actionName = "goTo" + targetIS.Element.Name; switch (patternType) { case "Springboard": XisButton b = new XisButton(repository, homeIS, homeDiagram, useCase.Name, actionName); b.SetValue(useCase.Name); XISMobileHelper.CreateXisAction(repository, b.Element, actionName, ActionType.Navigate, targetIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, homeIS, targetIS); break; case "List Menu": 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); XISMobileHelper.CreateXisAction(repository, item.Element, actionName, ActionType.Navigate, targetIS.Element.Name); CreateXisInteractionSpaceAssociation(actionName, homeIS, targetIS); break; //case "Tab Menu": // // TODO: Implement Tab // break; default: break; } }