public override void doRuleQuickFix(SQLConnector eaConnector, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage) { if (i == 0) { EA.Element ownerElement = null; try { ownerElement = repository.GetOriginalRepository().GetElementByID(eaConnector.ClientID); } catch { try { ownerElement = repository.GetOriginalRepository().GetElementByID(eaConnector.SupplierID); } catch { } } if (ownerElement != null) { short z = 0; foreach (EA.Connector con in ownerElement.Connectors) { if (con.ConnectorGUID == eaConnector.ConnectorGUID) { ownerElement.Connectors.DeleteAt(z, true); break; } z++; } } } }
public override void doRuleQuickFix(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage) { if (i == 0) { List <SQLConnector> toDelte = new List <SQLConnector>(); List <SQLElement> baseClasses = EAUtil.getBaseClasses(eaElement); if (baseClasses.Count > 1) { foreach (SQLConnector con in eaElement.Connectors) { if (con.Type != Main.EAGeneralizationConType) { toDelte.Add(con); } } } else { foreach (SQLConnector con in eaElement.Connectors) { if (con.Type == Main.EAAssociationType) { bool valid = true; SQLConnectorEnd rightEnd = null; SQLConnectorEnd wrongEnd = null; if (con.ClientID == eaElement.ElementID) { wrongEnd = con.ClientEnd; rightEnd = con.SupplierEnd; } else if (con.SupplierID == eaElement.ElementID) { wrongEnd = con.SupplierEnd; rightEnd = con.ClientEnd; } valid &= wrongEnd.Role == ""; valid &= !wrongEnd.IsNavigable; valid &= (rightEnd.Role == "source" || rightEnd.Role == "target"); valid &= rightEnd.IsNavigable; valid &= rightEnd.Cardinality == "1"; if (!valid) { toDelte.Add(con); } } } } foreach (EA.Connector toDeleteCon in toDelte) { EAUtil.deleteConnector(toDeleteCon, repository.GetOriginalRepository()); } } }
public override void doRuleQuickFix(SQLElement eaElement, SQLWrapperClasses.SQLRepository sqlRep, int i, string errorMessage) { EA.Repository repository = sqlRep.GetOriginalRepository(); if (errorMessage == "Tgg CSP is outdated and cant be modified - quickfix is recommended") { if (i == 0) { transformConstraintToCSPElement(eaElement, sqlRep, repository); } } }
public override void doRuleQuickFix(SQLConnector eaObject, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage) { if (i == 0) { String sql = "select DiagramID from t_diagramlinks where ConnectorID = " + eaObject.ConnectorID; String result = repository.SQLQuery(sql); EA.Diagram diagram = repository.GetOriginalRepository().GetDiagramByID(int.Parse(EAUtil.getXMLNodeContentFromSQLQueryString(result, "DiagramID")[0])); foreach (EA.DiagramLink link in diagram.DiagramLinks) { if (link.ConnectorID == eaObject.ConnectorID) { link.IsHidden = false; link.Update(); } } repository.OpenDiagram(diagram.DiagramID); repository.ReloadDiagram(diagram.DiagramID); } }
private void LiteralExpressionForm_Load(object sender, EventArgs e) { source.AddRange(new string[] { "true", "false", "null" }); // Add all known enum constants IEnumerable <EA.Element> enums = EAUtil.findAllEEnums(repository.GetOriginalRepository()); foreach (EA.Element ruleElement in enums) { foreach (EA.Attribute attribute in ruleElement.Attributes) { if (isEnumConstant(attribute)) { source.AddRange(new string[] { ruleElement.Name + "." + attribute.Name }); } } } }