private void DoRule46(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisMenu") { if (Element.Elements.Count > 0) { EA.Element el = null; for (short i = 0; i < Element.Elements.Count; i++) { el = Element.Elements.GetAt(i); if (el.Stereotype != "XisMenuItem" && el.Stereotype != "XisMenuGroup" && el.Stereotype != "XisVisibilityBoundary") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule46), EA.EnumMVErrorType.mvError, GetRuleStr(rule46)); isValid = false; break; } } } } }
private void DoRule09(EA.Repository Repository, EA.Connector Connector) { EA.Project Project = Repository.GetProjectInterface(); EA.Element client = Repository.GetElementByID(Connector.ClientID); EA.Element supplier = Repository.GetElementByID(Connector.SupplierID); if (Connector.Stereotype == "XisEntityInheritance" && (client.Stereotype != "XisEntity" || supplier.Stereotype != "XisEntity")) { Project.PublishResult(LookupMap(rule09), EA.EnumMVErrorType.mvError, GetRuleStr(rule09)); isValid = false; } }
private void DoRule109(EA.Repository Repository, EA.Package Package) { if (Package.StereotypeEx == "UseCases View") { if (Package.Diagrams.Count > 0) { if (Package.Diagrams.Count == 1) { EA.Diagram diagram = Package.Diagrams.GetAt(0); if (diagram.MetaType != "XIS-Mobile_Diagrams::UseCasesViewModel") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule109), EA.EnumMVErrorType.mvError, GetRuleStr(rule109)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule109), EA.EnumMVErrorType.mvError, GetRuleStr(rule109)); isValid = false; } } } }
private void DoRule96_97(EA.Repository Repository, EA.Element Element, string filter) { if (Element.Type == "Class" && Element.Stereotype == "XisList") { string domainRef = M2MTransformer.GetTaggedValue(Element.TaggedValues, filter).Value; if (!string.IsNullOrEmpty(domainRef) && domainRef.Contains('.')) { bool publishResult = false; string[] values = domainRef.Split('.'); if (values.Length == 2) { EA.Element space = null; EA.Element el = null; EA.Connector conn = null; EA.Connector assoc = null; int parentID = Element.ParentID; while (parentID > 0) { el = Repository.GetElementByID(parentID); if (el.Type == "Class" && el.Stereotype == "XisInteractionSpace") { space = el; break; } parentID = el.ParentID; } if (space != null) { for (short i = 0; i < space.Connectors.Count; i++) { conn = space.Connectors.GetAt(i); if (conn.Stereotype == "XisIS-BEAssociation") { assoc = conn; break; } } if (assoc != null) { EA.Element be = Repository.GetElementByID(assoc.SupplierID); bool hasEntity = false; if (be.Stereotype == "XisBusinessEntity" && be.Connectors.Count > 0) { EA.Element entity = null; for (short i = 0; i < be.Connectors.Count; i++) { conn = be.Connectors.GetAt(i); if (conn.Stereotype == "XisBE-EntityMasterAssociation" || conn.Stereotype == "XisBE-EntityDetailAssociation" || conn.Stereotype == "XisBE-EntityReferenceAssociation") { entity = Repository.GetElementByID(conn.SupplierID); if (entity.Type == "Class" && entity.Stereotype == "XisEntity" && entity.Name == values[0]) { hasEntity = true; break; } } } if (hasEntity && entity.Attributes.Count > 0) { bool attrExists = false; EA.Attribute attr = null; for (short i = 0; i < entity.Attributes.Count; i++) { attr = entity.Attributes.GetAt(i); if (attr.Stereotype == "XisEntityAttribute" && attr.Name == values[1]) { attrExists = true; break; } } if (!attrExists) { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } if (publishResult) { EA.Project Project = Repository.GetProjectInterface(); switch (filter) { case "searchBy": Project.PublishResult(LookupMap(rule96), EA.EnumMVErrorType.mvError, GetRuleStr(rule96)); isValid = false; break; case "orderBy": Project.PublishResult(LookupMap(rule97), EA.EnumMVErrorType.mvError, GetRuleStr(rule97)); isValid = false; break; default: break; } } } } }
// Validate number of views private void DoRule01_to_04(EA.Repository Repository, EA.Package Package) { EA.Project Project = Repository.GetProjectInterface(); EA.Package model = (EA.Package)Repository.Models.GetAt(0); EA.Package view = (EA.Package)model.Packages.GetAt(0); if (view.PackageID == Package.PackageID) { if (view.Packages.Count < 3) { Project.PublishResult(LookupMap(rule01), EA.EnumMVErrorType.mvError, GetRuleStr(rule01)); isValid = false; } else if (view.Packages.Count == 3) { EA.Package p = null; bool arch = false; Dictionary<string, int> smart = new Dictionary<string, int>(3); for (short i = 0; i < view.Packages.Count; i++) { p = view.Packages.GetAt(i); if (p.StereotypeEx == "Architectural View") { arch = true; break; } else if (p.StereotypeEx == "BusinessEntities View" || p.StereotypeEx == "Domain View" || p.StereotypeEx == "UseCases View") { if (smart.ContainsKey(p.StereotypeEx)) { smart[p.StereotypeEx] += 1; } else { smart.Add(p.StereotypeEx, 1); } } } if (arch) { Project.PublishResult(LookupMap(rule01), EA.EnumMVErrorType.mvError, GetRuleStr(rule02)); isValid = false; } else { if (!smart.ContainsKey("BusinessEntities View") || !smart.ContainsKey("Domain View") || !smart.ContainsKey("UseCases View") || smart["BusinessEntities View"] != 1 || smart["Domain View"] != 1 || smart["UseCases View"] != 1) { Project.PublishResult(LookupMap(rule01), EA.EnumMVErrorType.mvError, GetRuleStr(rule01)); isValid = false; } } } else { EA.Package p = null; bool arch = false; Dictionary<string, int> dummy = new Dictionary<string, int>(5); for (short i = 0; i < view.Packages.Count; i++) { p = view.Packages.GetAt(i); if (p.StereotypeEx == "Architectural View") { arch = true; if (dummy.ContainsKey(p.StereotypeEx)) { dummy[p.StereotypeEx] += 1; } else { dummy.Add(p.StereotypeEx, 1); } } else if (p.StereotypeEx == "BusinessEntities View" || p.StereotypeEx == "Domain View" || p.StereotypeEx == "InteractionSpace View" || p.StereotypeEx == "NavigationSpace View") { if (dummy.ContainsKey(p.StereotypeEx)) { dummy[p.StereotypeEx] += 1; } else { dummy.Add(p.StereotypeEx, 1); } } } if (arch && (!dummy.ContainsKey("BusinessEntities View") || !dummy.ContainsKey("Domain View") || !dummy.ContainsKey("InteractionSpace View") || !dummy.ContainsKey("NavigationSpace View") || dummy["Architectural View"] != 1 || dummy["BusinessEntities View"] != 1 || dummy["Domain View"] != 1 || dummy["InteractionSpace View"] != 1 || dummy["NavigationSpace View"] != 1)) { Project.PublishResult(LookupMap(rule01), EA.EnumMVErrorType.mvError, GetRuleStr(rule04)); isValid = false; } else if (!dummy.ContainsKey("BusinessEntities View") || !dummy.ContainsKey("Domain View") || !dummy.ContainsKey("InteractionSpace View") || !dummy.ContainsKey("NavigationSpace View") || dummy["BusinessEntities View"] != 1 || dummy["Domain View"] != 1 || dummy["InteractionSpace View"] != 1 || dummy["NavigationSpace View"] != 1) { Project.PublishResult(LookupMap(rule01), EA.EnumMVErrorType.mvError, GetRuleStr(rule03)); isValid = false; } } } }
private void DoRule87(EA.Repository Repository, EA.Method method) { if (method.Stereotype == "XisAction") { string type = M2MTransformer.GetMethodTag(method.TaggedValues, "type").Value; if (type == "Navigate") { string navigation = M2MTransformer.GetMethodTag(method.TaggedValues, "navigation").Value; if (!string.IsNullOrEmpty(navigation)) { EA.Package model = Repository.GetPackageByID(Repository.GetElementByID(method.ParentID).PackageID); EA.Package interaction = null; if (model.StereotypeEx == "InteractionSpace View") { interaction = model; } if (interaction != null) { EA.Element el = null; bool exists = false; for (short i = 0; i < interaction.Elements.Count; i++) { el = interaction.Elements.GetAt(i); if (el.Type == "Class" && el.Stereotype == "XisInteractionSpace" && el.Name == navigation) { exists = true; break; } } if (!exists) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule87), EA.EnumMVErrorType.mvError, GetRuleStr(rule87)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule87), EA.EnumMVErrorType.mvError, GetRuleStr(rule87)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule87), EA.EnumMVErrorType.mvError, GetRuleStr(rule87)); isValid = false; } } } }
private void DoRule89_to_93(EA.Repository Repository, EA.Element Element, string stereotype) { if (Element.Type == "Class" && Element.Stereotype == stereotype) { string entityName = M2MTransformer.GetTaggedValue(Element.TaggedValues, "entityName").Value; if (!string.IsNullOrEmpty(entityName)) { EA.Element space = null; EA.Element el = null; EA.Connector conn = null; EA.Connector assoc = null; bool publishResult = false; int parentID = Element.ParentID; while (parentID > 0) { el = Repository.GetElementByID(parentID); if (el.Type == "Class" && el.Stereotype == "XisInteractionSpace") { space = el; break; } parentID = el.ParentID; } if (space == null && stereotype == "XisMenu") { EA.Element end = null; for (short i = 0; i < Element.Connectors.Count; i++) { conn = Element.Connectors.GetAt(i); if (conn.ClientID != Element.ElementID) { end = Repository.GetElementByID(conn.ClientID); } else { end = Repository.GetElementByID(conn.SupplierID); } if (conn.Stereotype == "XisIS-MenuAssociation") { if (end.Stereotype == "XisInteractionSpace") { space = end; break; } else { parentID = end.ParentID; while (parentID > 0) { el = Repository.GetElementByID(parentID); if (el.Type == "Class" && el.Stereotype == "XisInteractionSpace") { space = el; break; } parentID = el.ParentID; } } } } } if (space != null) { for (short i = 0; i < space.Connectors.Count; i++) { conn = space.Connectors.GetAt(i); if (conn.Stereotype == "XisIS-BEAssociation") { assoc = conn; break; } } if (assoc != null) { EA.Element be = Repository.GetElementByID(assoc.SupplierID); bool hasEntity = false; if (be.Stereotype == "XisBusinessEntity" && be.Connectors.Count > 0) { EA.Element entity = null; for (short i = 0; i < be.Connectors.Count; i++) { conn = be.Connectors.GetAt(i); if (conn.Stereotype == "XisBE-EntityMasterAssociation" || conn.Stereotype == "XisBE-EntityDetailAssociation" || conn.Stereotype == "XisBE-EntityReferenceAssociation") { entity = Repository.GetElementByID(conn.SupplierID); if (entity.Type == "Class" && entity.Stereotype == "XisEntity" && entity.Name == entityName) { hasEntity = true; break; } } } if (!hasEntity) { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } if (publishResult) { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisForm": Project.PublishResult(LookupMap(rule89), EA.EnumMVErrorType.mvError, GetRuleStr(rule89)); isValid = false; break; case "XisList": Project.PublishResult(LookupMap(rule90), EA.EnumMVErrorType.mvError, GetRuleStr(rule90)); isValid = false; break; case "XisListGroup": Project.PublishResult(LookupMap(rule91), EA.EnumMVErrorType.mvError, GetRuleStr(rule91)); isValid = false; break; case "XisVisibilityBoundary": Project.PublishResult(LookupMap(rule92), EA.EnumMVErrorType.mvError, GetRuleStr(rule92)); isValid = false; break; case "XisMenu": Project.PublishResult(LookupMap(rule93), EA.EnumMVErrorType.mvError, GetRuleStr(rule93)); isValid = false; break; default: break; } } } } }
private void DoRule53_56_59(EA.Repository Repository, EA.Element Element, String stereotype) { if (Element.Type == "Class" && Element.Stereotype == stereotype) { if (Element.Methods.Count > 0) { EA.Method method = null; int actionCounter = 0; for (short i = 0; i < Element.Methods.Count; i++) { method = Element.Methods.GetAt(i); if (method.Stereotype == "XisAction") { actionCounter++; } } if (actionCounter > 1) { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisButton": Project.PublishResult(LookupMap(rule53), EA.EnumMVErrorType.mvError, GetRuleStr(rule53)); isValid = false; break; case "XisLink": Project.PublishResult(LookupMap(rule56), EA.EnumMVErrorType.mvError, GetRuleStr(rule56)); isValid = false; break; case "XisMenuItem": Project.PublishResult(LookupMap(rule59), EA.EnumMVErrorType.mvError, GetRuleStr(rule59)); isValid = false; break; default: break; } } } } }
private void DoRule62(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisListItem") { String onLongTap = M2MTransformer.GetTaggedValue(Element.TaggedValues, "onLongTap").Value; if (!string.IsNullOrEmpty(onLongTap)) { if (Element.Methods.Count > 0) { EA.Method method = null; bool exists = false; for (short i = 0; i < Element.Methods.Count; i++) { method = Element.Methods.GetAt(i); if (method.Stereotype == "XisAction" && method.Name == onLongTap) { exists = true; break; } } if (!exists) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule62), EA.EnumMVErrorType.mvError, GetRuleStr(rule62)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule62), EA.EnumMVErrorType.mvError, GetRuleStr(rule62)); isValid = false; } } } }
private void DoRule51_54_57(EA.Repository Repository, EA.Element Element, String stereotype) { if (Element.Type == "Class" && Element.Stereotype == stereotype) { String onTap = M2MTransformer.GetTaggedValue(Element.TaggedValues, "onTap").Value; if (Element.Methods.Count > 0) { EA.Method method = null; bool noOnTap = false; for (short i = 0; i < Element.Methods.Count; i++) { method = Element.Methods.GetAt(i); if (method.Stereotype == "XisAction" && method.Name != onTap) { noOnTap = true; break; } } if (noOnTap) { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisButton": Project.PublishResult(LookupMap(rule51), EA.EnumMVErrorType.mvError, GetRuleStr(rule51)); isValid = false; break; case "XisLink": Project.PublishResult(LookupMap(rule54), EA.EnumMVErrorType.mvError, GetRuleStr(rule54)); isValid = false; break; case "XisMenuItem": Project.PublishResult(LookupMap(rule57), EA.EnumMVErrorType.mvError, GetRuleStr(rule57)); isValid = false; break; default: break; } } } } }
private void DoRule52_55_58(EA.Repository Repository, EA.Element Element, String stereotype) { if (Element.Type == "Class" && Element.Stereotype == stereotype) { String onTap = M2MTransformer.GetTaggedValue(Element.TaggedValues, "onTap").Value; if (!string.IsNullOrEmpty(onTap)) { if (Element.Methods.Count > 0) { EA.Method method = null; bool exists = false; for (short i = 0; i < Element.Methods.Count; i++) { method = Element.Methods.GetAt(i); if (method.Stereotype == "XisAction" && method.Name == onTap) { exists = true; break; } } if (!exists) { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisButton": Project.PublishResult(LookupMap(rule52), EA.EnumMVErrorType.mvError, GetRuleStr(rule52)); isValid = false; break; case "XisLink": Project.PublishResult(LookupMap(rule55), EA.EnumMVErrorType.mvError, GetRuleStr(rule55)); isValid = false; break; case "XisMenuItem": Project.PublishResult(LookupMap(rule58), EA.EnumMVErrorType.mvError, GetRuleStr(rule58)); isValid = false; break; default: break; } } } else { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisButton": Project.PublishResult(LookupMap(rule52), EA.EnumMVErrorType.mvError, GetRuleStr(rule52)); isValid = false; break; case "XisLink": Project.PublishResult(LookupMap(rule55), EA.EnumMVErrorType.mvError, GetRuleStr(rule55)); isValid = false; break; case "XisMenuItem": Project.PublishResult(LookupMap(rule58), EA.EnumMVErrorType.mvError, GetRuleStr(rule58)); isValid = false; break; default: break; } } } } }
private void DoRule50(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisMenu") { EA.TaggedValue menuType = M2MTransformer.GetTaggedValue(Element.TaggedValues, "type"); if (menuType != null && menuType.Value == "OptionsMenu") { if (Element.ParentID > 0) { EA.Element parent = Repository.GetElementByID(Element.ParentID); if (parent.Stereotype != "XisInteractionSpace") { if (parent.Stereotype == "XisVisibilityBoundary" && parent.ParentID > 0) { parent = Repository.GetElementByID(parent.ParentID); if (parent.Stereotype != "XisInteractionSpace") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule50), EA.EnumMVErrorType.mvError, GetRuleStr(rule50)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule50), EA.EnumMVErrorType.mvError, GetRuleStr(rule50)); isValid = false; } } } else if (Element.Connectors.Count > 0) { EA.Connector conn = null; EA.Element end = null; for (short i = 0; i < Element.Connectors.Count; i++) { conn = Element.Connectors.GetAt(i); if (conn.ClientID != Element.ElementID) { end = Repository.GetElementByID(conn.ClientID); } else { end = Repository.GetElementByID(conn.SupplierID); } if ((conn.Stereotype == "XisIS-MenuAssociation" && end.Stereotype != "XisInteractionSpace") || (conn.Stereotype != "XisIS-MenuAssociation" && end.Stereotype == "XisInteractionSpace")) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule50), EA.EnumMVErrorType.mvError, GetRuleStr(rule50)); isValid = false; break; } } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule50), EA.EnumMVErrorType.mvError, GetRuleStr(rule50)); isValid = false; } } } }
private void DoRule49(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisMenuItem") { if (Element.Elements.Count > 0) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule49), EA.EnumMVErrorType.mvError, GetRuleStr(rule49)); isValid = false; } } }
private void DoRule47(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisMenuGroup") { if (Element.Elements.Count > 0) { bool hasItem = false; EA.Element el = null; for (short i = 0; i < Element.Elements.Count; i++) { el = Element.Elements.GetAt(i); if (el.Stereotype == "XisMenuItem") { hasItem = true; break; } } if (!hasItem) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule47), EA.EnumMVErrorType.mvError, GetRuleStr(rule47)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule47), EA.EnumMVErrorType.mvError, GetRuleStr(rule47)); isValid = false; } } }
private void DoRule84(EA.Repository Repository, EA.Method method) { if (method.Stereotype == "XisAction") { string type = M2MTransformer.GetMethodTag(method.TaggedValues, "type").Value; if (type == "OpenBrowser") { if (method.Parameters.Count == 1) { EA.Parameter p = method.Parameters.GetAt(0); if (p.Name != "url" || string.IsNullOrEmpty(p.Default)) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule84), EA.EnumMVErrorType.mvError, GetRuleStr(rule84)); isValid = false; } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule84), EA.EnumMVErrorType.mvError, GetRuleStr(rule84)); isValid = false; } } } }
private void DoRule63(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisListItem") { if (Element.Methods.Count > 0) { EA.Method method = null; int actionCounter = 0; for (short i = 0; i < Element.Methods.Count; i++) { method = Element.Methods.GetAt(i); if (method.Stereotype == "XisAction") { actionCounter++; } } if (actionCounter > 2) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule63), EA.EnumMVErrorType.mvError, GetRuleStr(rule63)); isValid = false; } } } }
private void DoRule86(EA.Repository Repository, EA.Method method) { if (method.Stereotype == "XisAction") { string type = M2MTransformer.GetMethodTag(method.TaggedValues, "type").Value; if (type == "WebService") { if (method.Name.Contains('.')) { string[] serviceName = method.Name.Split('.'); if (serviceName.Length == 2) { EA.Package model = Repository.GetPackageByID(Repository.GetElementByID(method.ParentID).PackageID); EA.Package package = null; EA.Package architectural = null; for (short i = 0; i < model.Packages.Count; i++) { package = model.Packages.GetAt(i); if (package.StereotypeEx == "Architectural View") { architectural = package; break; } } if (architectural != null) { EA.Element el = null; EA.Element service = null; for (short i = 0; i < architectural.Elements.Count; i++) { el = architectural.Elements.GetAt(i); if (el.Type == "Interface" && (el.Stereotype == "XisInternalService" || el.Stereotype == "XisRemoteService") && el.Name == serviceName[0]) { service = el; break; } } if (service != null && service.Methods.Count > 0) { EA.Method m = null; bool hasMethod = false; for (short i = 0; i < service.Methods.Count; i++) { m = service.Methods.GetAt(i); if (m.Stereotype == "XisServiceMethod" && m.Name == serviceName[1]) { hasMethod = true; break; } } if (hasMethod) { if (m.Parameters.Count == method.Parameters.Count) { EA.Parameter p1 = null; EA.Parameter p2 = null; for (short i = 0; i < m.Parameters.Count; i++) { p1 = m.Parameters.GetAt(i); p2 = method.Parameters.GetAt(i); if (p1.Name == p2.Name) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule86), EA.EnumMVErrorType.mvError, GetRuleStr(rule86)); isValid = false; break; } } } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule86), EA.EnumMVErrorType.mvError, GetRuleStr(rule86)); isValid = false; } } } } } } } } }
private void DoRule64(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisDialog") { if (Element.Elements.Count > 0) { EA.Element el = null; int buttonCounter = 0; for (short i = 0; i < Element.Elements.Count; i++) { el = Element.Elements.GetAt(i); if (el.Stereotype == "Class" && el.Stereotype == "XisButton") { buttonCounter++; } else { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule64), EA.EnumMVErrorType.mvError, GetRuleStr(rule64)); isValid = false; break; } } if (buttonCounter > 3) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule64), EA.EnumMVErrorType.mvError, GetRuleStr(rule64)); isValid = false; } } } }
private void DoRule88(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisForm") { string entityName = M2MTransformer.GetTaggedValue(Element.TaggedValues, "entityName").Value; if (string.IsNullOrEmpty(entityName)) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule88), EA.EnumMVErrorType.mvError, GetRuleStr(rule88)); isValid = false; } } }
private void DoRule65(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisMapView") { if (Element.Elements.Count > 0) { EA.Element el = null; for (short i = 0; i < Element.Elements.Count; i++) { el = Element.Elements.GetAt(i); if (el.Stereotype != "Class" || el.Stereotype != "XisMapMarker") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule65), EA.EnumMVErrorType.mvError, GetRuleStr(rule65)); isValid = false; break; } } } } }
private void DoRule94_95(EA.Repository Repository, EA.Element Element, string filter) { if (Element.Type == "Class" && Element.Stereotype == "XisList") { string entityName = M2MTransformer.GetTaggedValue(Element.TaggedValues, filter).Value; if (!string.IsNullOrEmpty(entityName) && !entityName.Contains('.')) { EA.Project Project = Repository.GetProjectInterface(); switch (filter) { case "searchBy": Project.PublishResult(LookupMap(rule94), EA.EnumMVErrorType.mvError, GetRuleStr(rule94)); isValid = false; break; case "orderBy": Project.PublishResult(LookupMap(rule95), EA.EnumMVErrorType.mvError, GetRuleStr(rule95)); isValid = false; break; default: break; } } } }
private void DoRule66_to_75(EA.Repository Repository, EA.Element Element, string stereotype) { if (Element.Type == "Class" && Element.Stereotype == stereotype) { if (Element.Elements.Count > 0) { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisLabel": Project.PublishResult(LookupMap(rule66), EA.EnumMVErrorType.mvError, GetRuleStr(rule66)); isValid = false; break; case "XisTextBox": Project.PublishResult(LookupMap(rule67), EA.EnumMVErrorType.mvError, GetRuleStr(rule67)); isValid = false; break; case "XisCheckBox": Project.PublishResult(LookupMap(rule68), EA.EnumMVErrorType.mvError, GetRuleStr(rule68)); isValid = false; break; case "XisButton": Project.PublishResult(LookupMap(rule69), EA.EnumMVErrorType.mvError, GetRuleStr(rule69)); isValid = false; break; case "XisLink": Project.PublishResult(LookupMap(rule70), EA.EnumMVErrorType.mvError, GetRuleStr(rule70)); isValid = false; break; case "XisImage": Project.PublishResult(LookupMap(rule71), EA.EnumMVErrorType.mvError, GetRuleStr(rule71)); isValid = false; break; case "XisDatePicker": Project.PublishResult(LookupMap(rule72), EA.EnumMVErrorType.mvError, GetRuleStr(rule72)); isValid = false; break; case "XisTimePicker": Project.PublishResult(LookupMap(rule73), EA.EnumMVErrorType.mvError, GetRuleStr(rule73)); isValid = false; break; case "XisWebView": Project.PublishResult(LookupMap(rule74), EA.EnumMVErrorType.mvError, GetRuleStr(rule74)); isValid = false; break; case "XisDropdown": Project.PublishResult(LookupMap(rule75), EA.EnumMVErrorType.mvError, GetRuleStr(rule75)); isValid = false; break; default: break; } } } }
private void DoRule98_to_105(EA.Repository Repository, EA.Element Element, string stereotype) { if (Element.Type == "Class" && Element.Stereotype == stereotype) { string value = M2MTransformer.GetTaggedValue(Element.TaggedValues, "value").Value; string valueFromExpression = M2MTransformer.GetTaggedValue(Element.TaggedValues, "valueFromExpression").Value; string entityAttributeName = M2MTransformer.GetTaggedValue(Element.TaggedValues, "entityAttributeName").Value; if (string.IsNullOrEmpty(value) && string.IsNullOrEmpty(valueFromExpression) && string.IsNullOrEmpty(entityAttributeName)) { EA.Project Project = Repository.GetProjectInterface(); switch (stereotype) { case "XisLabel": Project.PublishResult(LookupMap(rule98), EA.EnumMVErrorType.mvError, GetRuleStr(rule98)); isValid = false; break; case "XisTextBox": Project.PublishResult(LookupMap(rule99), EA.EnumMVErrorType.mvError, GetRuleStr(rule99)); isValid = false; break; case "XisCheckBox": Project.PublishResult(LookupMap(rule100), EA.EnumMVErrorType.mvError, GetRuleStr(rule100)); isValid = false; break; case "XisButton": Project.PublishResult(LookupMap(rule101), EA.EnumMVErrorType.mvError, GetRuleStr(rule101)); isValid = false; break; case "XisLink": Project.PublishResult(LookupMap(rule102), EA.EnumMVErrorType.mvError, GetRuleStr(rule102)); isValid = false; break; case "XisDatePicker": Project.PublishResult(LookupMap(rule103), EA.EnumMVErrorType.mvError, GetRuleStr(rule103)); isValid = false; break; case "XisTimePicker": Project.PublishResult(LookupMap(rule104), EA.EnumMVErrorType.mvError, GetRuleStr(rule104)); isValid = false; break; case "XisDropdown": Project.PublishResult(LookupMap(rule105), EA.EnumMVErrorType.mvError, GetRuleStr(rule105)); isValid = false; break; default: break; } } } }
private void DoRule76(EA.Repository Repository, EA.Method method) { if (method.Stereotype == "XisAction") { EA.Element element = Repository.GetElementByID(method.ParentID); if (element.Stereotype != "XisGesture" && element.Stereotype != "XisListItem" && element.Stereotype != "XisButton" && element.Stereotype != "XisLink" && element.Stereotype != "XisMenuItem") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule76), EA.EnumMVErrorType.mvError, GetRuleStr(rule76)); isValid = false; } } }
private void DoRule06(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisEntity") { if (Element.Attributes.Count > 0) { EA.Attribute attr = null; for (short i = 0; i < Element.Attributes.Count; i++) { attr = Element.Attributes.GetAt(i); if (attr.Stereotype != "XisEntityAttribute") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule06), EA.EnumMVErrorType.mvError, GetRuleStr(rule06)); isValid = false; break; } } } } }
private void DoRule77(EA.Repository Repository, EA.Method method) { if (method.Stereotype == "XisAction") { string type = M2MTransformer.GetMethodTag(method.TaggedValues, "type").Value; if (string.IsNullOrEmpty(type)) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule77), EA.EnumMVErrorType.mvError, GetRuleStr(rule77)); isValid = false; } } }
private void DoRule10(EA.Repository Repository, EA.Element Element) { if (Element.Stereotype == "XisEnumeration" && Element.Attributes.Count == 0) { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule10), EA.EnumMVErrorType.mvError, GetRuleStr(rule10)); isValid = false; } }
private void DoRule79_to_83(EA.Repository Repository, EA.Method method, string crud) { if (method.Stereotype == "XisAction") { string type = M2MTransformer.GetMethodTag(method.TaggedValues, "type").Value; if (type == crud) { EA.Element parent = Repository.GetElementByID(method.ParentID); bool needsParam = false; bool publishResult = false; while (parent != null) { if (parent.Stereotype == "XisForm" || parent.Stereotype == "XisList" || parent.Stereotype == "XisListGroup" || parent.Stereotype == "XisMenu") { break; } else if (parent.Stereotype == "XisInteractionSpace") { needsParam = true; break; } if (parent.ParentID > 0) { try { parent = Repository.GetElementByID(parent.ParentID); } catch (Exception) { break; } } } if (needsParam) { if (method.Parameters.Count == 1) { EA.Parameter p = method.Parameters.GetAt(0); if (parent.Connectors.Count > 0 && p.Name == "entityName" && !string.IsNullOrEmpty(p.Default)) { EA.Connector conn = null; EA.Connector assoc = null; for (short i = 0; i < parent.Connectors.Count; i++) { conn = parent.Connectors.GetAt(i); if (conn.Stereotype == "XisIS-BEAssociation") { assoc = conn; break; } } if (assoc != null) { EA.Element be = Repository.GetElementByID(assoc.SupplierID); bool hasEntity = false; if (be.Stereotype == "XisBusinessEntity" && be.Connectors.Count > 0) { EA.Element entity = null; for (short i = 0; i < be.Connectors.Count; i++) { conn = be.Connectors.GetAt(i); if (conn.Stereotype == "XisBE-EntityMasterAssociation" || conn.Stereotype == "XisBE-EntityDetailAssociation" || conn.Stereotype == "XisBE-EntityReferenceAssociation") { entity = Repository.GetElementByID(conn.SupplierID); if (entity.Type == "Class" && entity.Stereotype == "XisEntity" && entity.Name == p.Default) { hasEntity = true; break; } } } if (!hasEntity) { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } else { publishResult = true; } } if (publishResult) { EA.Project Project = Repository.GetProjectInterface(); switch (crud) { case "Create": Project.PublishResult(LookupMap(rule79), EA.EnumMVErrorType.mvError, GetRuleStr(rule79)); isValid = false; break; case "Read": Project.PublishResult(LookupMap(rule80), EA.EnumMVErrorType.mvError, GetRuleStr(rule80)); isValid = false; break; case "Update": Project.PublishResult(LookupMap(rule81), EA.EnumMVErrorType.mvError, GetRuleStr(rule81)); isValid = false; break; case "Delete": Project.PublishResult(LookupMap(rule82), EA.EnumMVErrorType.mvError, GetRuleStr(rule82)); isValid = false; break; case "DeleteAll": Project.PublishResult(LookupMap(rule83), EA.EnumMVErrorType.mvError, GetRuleStr(rule83)); isValid = false; break; default: break; } } } } }
private void ValidateModel(EA.Repository Repository) { EA.Package package = Repository.Models.GetAt(0); EA.Project project = Repository.GetProjectInterface(); project.ValidatePackage(package.PackageGUID); }
private void DoRule44(EA.Repository Repository, EA.Element Element) { if (Element.Type == "Class" && Element.Stereotype == "XisListItem") { if (Element.Elements.Count > 0) { EA.Element el = null; for (short i = 0; i < Element.Elements.Count; i++) { el = Element.Elements.GetAt(i); if (el.Stereotype != "XisLabel" && el.Stereotype != "XisTextBox" && el.Stereotype != "XisCheckBox" && el.Stereotype != "Button" && el.Stereotype != "Link" && el.Stereotype != "XisImage" && el.Stereotype != "XisDatePicker" && el.Stereotype != "XisTimePicker" && el.Stereotype != "XisWebView" && el.Stereotype != "XisMapView" && el.Stereotype != "XisDropdown") { EA.Project Project = Repository.GetProjectInterface(); Project.PublishResult(LookupMap(rule44), EA.EnumMVErrorType.mvError, GetRuleStr(rule44)); isValid = false; break; } } } } }