private static void transformConstraintToCSPElement(SQLElement eaElement2, SQLWrapperClasses.SQLRepository sqlRep, EA.Repository repository) { EA.Element eaElement = EAUtil.sqlEAObjectToOriginalObject(sqlRep, eaElement2) as EA.Element; String result = repository.SQLQuery("select Diagram_ID from t_diagramobjects where Object_ID = " + eaElement.ElementID); string diagramId = EAUtil.getXMLNodeContentFromSQLQueryString(result, "Diagram_ID")[0]; if (diagramId != "") { EA.Diagram diagram = repository.GetDiagramByID(int.Parse(diagramId)); EA.DiagramObject oldDiagObject = EAUtil.findDiagramObject(sqlRep, eaElement, diagram); EA.Element ruleElement = repository.GetElementByID(diagram.ParentID); if (ruleElement.Stereotype == TGGModelingMain.TggRuleStereotype) { List <EA.Connector> outgoingCons = new List <EA.Connector>(); foreach (EA.Connector con in eaElement.Connectors) { if (con.Stereotype == "ConstraintLink" && con.ClientID == eaElement.ElementID) { outgoingCons.Add(con); } } EA.Element newCsp = ruleElement.Elements.AddNew("", Main.EAClassType) as EA.Element; newCsp.Notes = eaElement.Notes; newCsp.Stereotype = TGGModelingMain.CSPConstraintStereotype; newCsp.Update(); EA.TaggedValue oldTag = EAUtil.findTaggedValue(eaElement, Main.MoflonExportTreeTaggedValueName); if (oldTag != null) { EAUtil.setTaggedValueNotes(sqlRep, newCsp, oldTag.Name, oldTag.Notes); } EA.DiagramObject newDiagObject = diagram.DiagramObjects.AddNew("", Main.EAClassType) as EA.DiagramObject; newDiagObject.ElementID = newCsp.ElementID; newDiagObject.left = oldDiagObject.left; newDiagObject.right = oldDiagObject.right; newDiagObject.bottom = oldDiagObject.bottom; newDiagObject.top = oldDiagObject.top; newDiagObject.Update(); foreach (EA.Connector con in outgoingCons) { con.ClientID = newCsp.ElementID; con.Update(); } EAUtil.deleteDiagramObject(repository, diagram, eaElement); EAUtil.deleteElement(eaElement, sqlRep); } } }