예제 #1
0
        private void deleteTGGRuleMainMethods()
        {
            String result = repository.SQLQuery(@"SELECT a.ea_guid FROM t_object a WHERE a.Stereotype = 'Rule' OR a.Stereotype = 'Multi-Rule' ");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "ea_guid"))
            {
                if (row != "")
                {
                    EA.Element ruleElement = repository.GetElementByGuid(row);
                    if (ruleElement != null)
                    {
                        short i = 0;
                        foreach (EA.Method method in ruleElement.Methods)
                        {
                            if (method.Name == ruleElement.Name)
                            {
                                ruleElement.Methods.Delete(i);
                            }
                            i++;
                        }
                        EAUtil.deleteTaggedValue(ruleElement, "MainMethodGuid");
                    }
                }
            }
        }
        public override Dictionary <SQLElement, string> doGlobalRule(SQLRepository repository)
        {
            Dictionary <SQLElement, string> results = new Dictionary <SQLElement, string>();
            String sql    = "select * from t_object a where Object_ID not in ( select Object_ID from t_diagramobjects where Object_ID = a.Object_ID)";
            String result = repository.SQLQuery(sql);

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLElement eaElement = new SQLElement(repository, row);
                    if (eaElement.Stereotype == SDMModelingMain.ObjectVariableStereotype ||
                        eaElement.Stereotype == TGGModelingMain.TggObjectVariableStereotype ||
                        eaElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype ||
                        eaElement.Stereotype == SDMModelingMain.StoryNodeStereotype ||
                        eaElement.Stereotype == SDMModelingMain.StatementNodeStereotype ||
                        eaElement.Stereotype == SDMModelingMain.StartNodeStereotype ||
                        eaElement.Stereotype == SDMModelingMain.StopNodeStereotype ||
                        eaElement.Stereotype == ECOREModelingMain.EClassStereotype ||
                        eaElement.Stereotype == ECOREModelingMain.EEnumStereotype ||
                        eaElement.Stereotype == ECOREModelingMain.EDatatypeStereotype ||
                        eaElement.Stereotype == TGGModelingMain.TggRuleStereotype)
                    {
                        results.Add(eaElement, "Element is not on any diagram");
                    }
                }
            }
            return(results);
        }
        public override Dictionary <SQLElement, string> doGlobalRule(SQLWrapperClasses.SQLRepository repository)
        {
            Dictionary <SQLElement, string> results = new Dictionary <SQLElement, string>();

            String sqlString = "select o.* FROM t_object o, t_diagramobjects a, t_diagramobjects b " +
                               "WHERE a.Object_ID = o.Object_ID " +
                               "AND b.Object_ID <> a.Object_ID " +
                               "AND b.RectRight > a.RectRight " +
                               "AND b.RectLeft < a.RectLeft " +
                               "AND b.RectTop > a.RectTop " +
                               "AND b.RectBottom < a.RectBottom " +
                               "AND a.Diagram_ID = b.Diagram_ID " +
                               "AND o.ParentID <> b.Object_ID";

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(repository.SQLQuery(sqlString), "Row"))
            {
                if (row != "")
                {
                    SQLElement element = new SQLElement(repository, row);
                    if (element.Stereotype == SDMModelingMain.ObjectVariableStereotype || element.Stereotype == TGGModelingMain.TggObjectVariableStereotype)
                    {
                        results.Add(element, "Elements diagram bounds are contained by another diagram element which is not its parent");
                    }
                }
            }

            return(results);
        }
예제 #4
0
        public override void doRuleQuickFix(SQLElement eaObject, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage)
        {
            string sqlString = @"SELECT o.Object_ID from t_diagram d, t_diagramobjects a, t_diagramobjects b, t_object o,t_object x 
                                                              WHERE d.Diagram_ID = a.Diagram_ID 
                                                              AND o.Object_ID = a.Object_ID 
                                                              AND b.Diagram_ID = a.Diagram_ID 
                                                              AND b.RectTop <= a.RectTop 
                                                              AND b.RectBottom >= a.RectBottom 
                                                              AND b.RectLeft >= a.RectLeft 
                                                              AND b.RectRight <= a.RectRight 
                                                              AND b.Object_ID <> a.Object_ID 
                                                              AND x.Object_ID = b.Object_ID 
                                                              AND x.ParentID  <> o.Object_ID
                                                              AND o.Stereotype = '" + TGGModelingMain.TggRuleSetStereotype + @"' 
                                                              AND x.Stereotype = '" + TGGModelingMain.TggRuleStereotype + @"' 
                                                              AND x.Object_ID = " + eaObject.ElementID;
            String result    = repository.SQLQuery(sqlString);
            String id        = EAUtil.getXMLNodeContentFromSQLQueryString(result, "Object_ID")[0];

            if (id != "")
            {
                int parentId = int.Parse(id);
                eaObject.getRealElement().ParentID = parentId;
                eaObject.getRealElement().Update();
            }
        }
예제 #5
0
        public override Dictionary <SQLElement, string> doGlobalRule(SQLWrapperClasses.SQLRepository repository)
        {
            Dictionary <SQLElement, string> results = new Dictionary <SQLElement, string>();

            string sqlString = @"SELECT x.* from t_diagram d, t_diagramobjects a, t_diagramobjects b, t_object o,t_object x 
                                                              WHERE d.Diagram_ID = a.Diagram_ID 
                                                              AND o.Object_ID = a.Object_ID 
                                                              AND b.Diagram_ID = a.Diagram_ID 
                                                              AND b.RectTop <= a.RectTop 
                                                              AND b.RectBottom >= a.RectBottom 
                                                              AND b.RectLeft >= a.RectLeft 
                                                              AND b.RectRight <= a.RectRight 
                                                              AND b.Object_ID <> a.Object_ID 
                                                              AND x.Object_ID = b.Object_ID 
                                                              AND x.ParentID  <> o.Object_ID
                                                              AND o.Stereotype = '" + TGGModelingMain.TggRuleSetStereotype + @"' 
                                                              AND x.Stereotype = '" + TGGModelingMain.TggRuleStereotype + "'";

            String result = repository.SQLQuery(sqlString);

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLElement element = new SQLElement(repository, row);
                    results.Add(element, "The Rule should be a children of the containing Rule-Set");
                }
            }
            return(results);
        }
예제 #6
0
        public override Dictionary <SQLElement, string> doGlobalRule(SQLWrapperClasses.SQLRepository repository)
        {
            Dictionary <SQLElement, string> results = new Dictionary <SQLElement, string>();

            String ruleElements = repository.SQLQuery("select * from t_object where Stereotype = '" + TGGModelingMain.TggRuleStereotype + "'");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(ruleElements, "Row"))
            {
                if (row != "")
                {
                    SQLElement ruleElement  = new SQLElement(repository, row);
                    SQLDiagram ruleDiagram  = ruleElement.Diagrams.GetAt(0) as SQLDiagram;
                    EA.Diagram rruleDiagram = EAUtil.sqlEAObjectToOriginalObject(repository, ruleDiagram) as EA.Diagram;

                    foreach (EA.DiagramObject diagObject in rruleDiagram.DiagramObjects)
                    {
                        SQLElement diagElement = repository.GetElementByID(diagObject.ElementID);
                        if (diagElement.ParentID != ruleElement.ElementID &&
                            (diagElement.Stereotype == TGGModelingMain.TggObjectVariableStereotype ||
                             diagElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype))
                        {
                            results.Add(diagElement, "Element is no child of Rule: " + ruleElement.Name + " but is contained on its Rule Diagram");
                        }
                    }
                }
            }
            return(results);
        }
예제 #7
0
        /// <summary>
        /// create Inheritance connectors
        /// </summary>
        public void setInheritances()
        {
            foreach (EA.Element element in MainImport.getInstance().ElementToBaseClassGuids.Keys)
            {
                if (MainImport.hasGui)
                {
                    MainImport.getInstance().ImportWorker.ReportProgress(3, new ProgressObject(ProgressBarType.Current, "Create Inheritance", MainImport.getInstance().ElementToBaseClassGuids.Count));
                }

                String[] guids = MainImport.getInstance().ElementToBaseClassGuids[element].Split(" ".ToCharArray());
                foreach (String baseClassGuid in guids)
                {
                    if (baseClassGuid != "")
                    {
                        EA.Element baseClass = MainImport.getInstance().ElementGuidToElement[MainImport.getInstance().OldGuidToNewGuid[baseClassGuid]];

                        String result = repository.SQLQuery("select Connector_ID from t_connector where Connector_Type ='Generalization' AND Start_Object_ID = " + element.ElementID + " AND End_Object_ID = " + baseClass.ElementID);

                        if (EAUtil.getXMLNodeContentFromSQLQueryString(result, "Connector_ID")[0] == "")
                        {
                            EA.Connector inhCon = element.Connectors.AddNew("", "Generalization") as EA.Connector;
                            inhCon.SupplierID = baseClass.ElementID;
                            inhCon.Update();
                        }
                    }
                }
            }
        }
예제 #8
0
        public override Dictionary <SQLElement, string> doGlobalRule(SQLWrapperClasses.SQLRepository repository)
        {
            NameValueCollection             parentIdToName = new NameValueCollection();
            Dictionary <SQLElement, String> results        = new Dictionary <SQLElement, string>();

            //SDM ObjectVariables
            string result = repository.SQLQuery(@"select a.* from t_object a, t_object b, t_object c 
                                WHERE a.Name = b.Name 
                                AND a.ea_guid <> b.ea_guid 
                                AND a.ParentID = c.Object_ID
                                AND b.parentID = c.Object_ID
                                AND a.Stereotype = '" + SDMModelingMain.ObjectVariableStereotype + @"'
                                AND b.Stereotype = '" + SDMModelingMain.ObjectVariableStereotype + @"'
                                AND c.Stereotype = '" + SDMModelingMain.StoryNodeStereotype + "'");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLElement element = new SQLElement(repository, row);
                    String[]   names   = parentIdToName.GetValues(element.ParentID + "");
                    if (names == null || !names.Contains(element.Name))
                    {
                        results.Add(element, "ObjectVariable name in a single StoryPattern must be explicit");
                        parentIdToName.Add(element.ParentID + "", element.Name);
                    }
                }
            }

            //TGGObjectVariables
            result = repository.SQLQuery(@"select a.* from t_object a, t_object b, t_object c 
                                WHERE a.Name = b.Name 
                                AND a.ea_guid <> b.ea_guid 
                                AND a.ParentID = c.Object_ID
                                AND b.parentID = c.Object_ID
                                AND (a.Stereotype = '" + TGGModelingMain.TggObjectVariableStereotype + @"' OR a.Stereotype = '" + TGGModelingMain.TggCorrespondenceStereotype + @"')
                                AND (b.Stereotype = '" + TGGModelingMain.TggObjectVariableStereotype + @"' OR b.Stereotype = '" + TGGModelingMain.TggCorrespondenceStereotype + @"')
                                AND c.Stereotype = '" + TGGModelingMain.TggRuleStereotype + "'");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLElement element = new SQLElement(repository, row);
                    String[]   names   = parentIdToName.GetValues(element.ParentID + "");
                    if (names == null || !names.Contains(element.Name))
                    {
                        results.Add(element, "ObjectVariable name in a single Rule must be explicit");
                        parentIdToName.Add(element.ParentID + "", element.Name);
                    }
                }
            }


            return(results);
        }
예제 #9
0
        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);
                }
            }
        }
예제 #10
0
        public static EA.Element createAnchorElementIfNecessary(EA.Repository repository, EA.Diagram openedDiagram, Boolean reloadDiagramAfter)
        {
            //checks if the current SDM Diagram already contains an Anchor element.
            //String sqlResult = repository.SQLQuery(@"SELECT Count(*) as Count FROM t_object WHERE ParentID = " + openedDiagram.ParentID +
            //                                       " AND Stereotype = '" + SDMModelingMain.SDMAnchorStereotype + "'");

            String sqlResult = repository.SQLQuery(@"select Count(*) as Count from t_diagramobjects d, t_object o where d.Object_ID = o.Object_ID 
                                                    and o.Stereotype = '" + SDMModelingMain.SDMAnchorStereotype + "' and d.Diagram_ID = " + openedDiagram.DiagramID);
            String count     = EAUtil.getXMLNodeContentFromSQLQueryString(sqlResult, "Count")[0];

            if (count == "0")
            {
                Boolean locked = false;

                EA.Element newAnchorElement = null;

                if (openedDiagram.ParentID != 0)
                {
                    EA.Element parentElement = repository.GetElementByID(openedDiagram.ParentID);
                    locked           = parentElement.Locked;
                    newAnchorElement = parentElement.Elements.AddNew("", Main.EAClassType) as EA.Element;
                }
                else
                {
                    EA.Package parentPackage = repository.GetPackageByID(openedDiagram.PackageID);
                    locked           = parentPackage.Element.Locked;
                    newAnchorElement = parentPackage.Elements.AddNew("", Main.EAClassType) as EA.Element;
                }

                if (!locked)
                {
                    newAnchorElement.Stereotype = SDMModelingMain.SDMAnchorStereotype;
                    newAnchorElement.Update();

                    EA.DiagramObject newAnchorDiagramObject = openedDiagram.DiagramObjects.AddNew("", newAnchorElement.Type) as EA.DiagramObject;
                    newAnchorDiagramObject.left      = 5;
                    newAnchorDiagramObject.top       = -5;
                    newAnchorDiagramObject.right     = 25;
                    newAnchorDiagramObject.bottom    = -25;
                    newAnchorDiagramObject.ElementID = newAnchorElement.ElementID;

                    newAnchorDiagramObject.Update();

                    if (reloadDiagramAfter)
                    {
                        repository.ReloadDiagram(openedDiagram.DiagramID);
                    }
                    return(newAnchorElement);
                }
            }
            return(null);
        }
예제 #11
0
        public static void setAnchorElementTags(SQLRepository sqlRepository, EA.Diagram callDiagram, SQLElement sdmContainer)
        {
            String anchorElementId = EAUtil.getXMLNodeContentFromSQLQueryString(sqlRepository.SQLQuery("select Object_ID from t_object where ParentID = " + sdmContainer.ElementID + " AND Stereotype = '" + SDMModelingMain.SDMAnchorStereotype + "'"), "Object_ID")[0];

            if (anchorElementId != "")
            {
                SQLElement anchorElement = sqlRepository.GetElementByID(int.Parse(anchorElementId));
                if (EAUtil.findTaggedValue(anchorElement, SDMAnchorDiagramIDTaggedValueName) == null)
                {
                    EAUtil.setTaggedValue(sqlRepository, anchorElement.getRealElement(), SDMAnchorDiagramIDTaggedValueName, callDiagram.DiagramID.ToString());
                }
            }
        }
예제 #12
0
        public List <SQLElement> getElementsByStereotype(string Stereotype)
        {
            List <SQLElement> retrievedElements = new List <SQLElement>();
            String            ruleElements      = this.SQLQuery("select * from t_object where Stereotype = '" + Stereotype + "'");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(ruleElements, "Row"))
            {
                if (row != "")
                {
                    retrievedElements.Add(new SQLElement(this, row));
                }
            }
            return(retrievedElements);
        }
예제 #13
0
        private String OldCspsToNewCsps()
        {
            String result = repository.SQLQuery("select a.* from t_object a, t_package b, t_diagramobjects c where a.Object_Type = 'Constraint' AND a.Package_ID = b.Package_ID and b.Name = 'Rules' AND c.Object_ID = a.Object_ID");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLElement           actElement   = new SQLElement(sqlRep, row);
                    CSPConstraintInvalid ruleInstance = new CSPConstraintInvalid();
                    ruleInstance.doRuleQuickFix(actElement, sqlRep, 0, "Tgg CSP is outdated and cant be modified - quickfix is recommended");
                }
            }
            return(result);
        }
예제 #14
0
        public override Dictionary <SQLConnector, string> doGlobalRule(SQLWrapperClasses.SQLRepository repository)
        {
            Dictionary <SQLConnector, String> results = new Dictionary <SQLConnector, string>();
            //select all connectors where are hidden diagram links and NO visible diagram links
            String sql    = "select * from t_connector where Connector_ID in  ( select ConnectorID from t_diagramlinks link where HIDDEN = TRUE ) AND Connector_ID NOT IN ( select ConnectorID from t_diagramlinks link where HIDDEN = FALSE )";
            String result = repository.SQLQuery(sql);

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLConnector con = new SQLConnector(repository, row);
                    results.Add(con, "Connector is not visible on any diagram");
                }
            }
            return(results);
        }
예제 #15
0
        private void buttonVerboseGlobal_Click(object sender, EventArgs e)
        {
            String sqlQuery = "select * from t_diagram";

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(repository.SQLQuery(sqlQuery), "Row"))
            {
                if (row != "")
                {
                    SQLDiagram diagram = new SQLDiagram(repository, row);
                    if (SDMModelingMain.SdmDiagramMetatype.Contains(diagram.MetaType))
                    {
                        EA.Diagram rdiagram = repository.GetOriginalRepository().GetDiagramByID(diagram.DiagramID);
                        toggleDiagramVerboseStatus(rdiagram);
                    }
                }
            }
        }
예제 #16
0
        private void updateDiagramMetaType(String oldMetaType, String newMetaType, EA.Repository repository)
        {
            SQLRepository sqlRep = new SQLRepository(repository, false);

            String sqlString = "select Diagram_ID from t_diagram where StyleEx LIKE '*" + oldMetaType + "*'";
            String result    = repository.SQLQuery(sqlString);

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLDiagram diag    = new SQLDiagram(sqlRep, row);
                    EA.Diagram rdiag   = EAUtil.sqlEAObjectToOriginalObject(sqlRep, diag) as EA.Diagram;
                    String     StyleEx = rdiag.StyleEx.Replace(oldMetaType, newMetaType);
                    sqlString = "UPDATE t_diagram SET StyleEx = '" + StyleEx + "' WHERE Diagram_ID = " + rdiag.DiagramID;
                    repository.Execute(sqlString);
                }
            }
        }
예제 #17
0
        private Boolean ovIsRefining()
        {
            String            sqlStub      = "";
            TGGRule           rule         = StoryPattern as TGGRule;
            List <SQLElement> allBaseRules = rule.getAllBaseRules();

            foreach (SQLElement ruleElement in allBaseRules)
            {
                sqlStub += "ParentID = " + ruleElement.ElementID + " OR ";
            }
            if (sqlStub != "")
            {
                sqlStub = sqlStub.Substring(0, sqlStub.Length - 4);

                String sqlString = "select Count(*) as count from t_object where (" + sqlStub + ") AND Name = '" + sqlElement.Name + "'";
                String sqlResult = Repository.SQLQuery(sqlString);
                if (EAUtil.getXMLNodeContentFromSQLQueryString(sqlResult, "count")[0] != "0")
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #18
0
        private void buttonDeleteSdms_Click(object sender, EventArgs e)
        {
            ConfirmDeleteSDMs confirmDialog = new ConfirmDeleteSDMs();

            if (confirmDialog.ShowDialog() == DialogResult.OK)
            {
                SQLPackage selectedPackage  = repository.GetTreeSelectedPackage();
                SQLPackage outermostPackage = EAUtil.getOutermostPackage(selectedPackage, repository);

                String sqlResult = repository.SQLQuery("SELECT * FROM t_object WHERE Stereotype = '" + SDMModelingMain.SdmContainerStereotype + "'");
                foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(sqlResult, "Row"))
                {
                    if (row != "")
                    {
                        SQLElement element = new SQLElement(repository, row);
                        if (EAUtil.getOutermostPackage(element, repository).PackageGUID == outermostPackage.PackageGUID)
                        {
                            EAUtil.deleteElement(element.getRealElement(), repository);
                        }
                    }
                }
            }
        }
예제 #19
0
        public void extract_t_object()
        {
            String        sqlqry = eaRepository.SQLQuery("select * from t_object");
            List <String> rows   = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(sqlqry, "Row");

            foreach (String actRow in rows)
            {
                String guid       = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(actRow, "ea_guid")[0];
                string objectID   = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(actRow, "Object_ID")[0];
                string parentID   = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(actRow, "ParentID")[0];
                string packageID  = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(actRow, "Package_ID")[0];
                String pdata1     = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(actRow, "PDATA1")[0];
                String objectType = EAUtil.getXMLNodeContentFromSQLQueryString(actRow, "Object_Type")[0];
                t_objectGUID.Add(guid, actRow);
                t_objectObjectID.Add(objectID, actRow);
                t_objectParentID.Add(parentID.ToString(), actRow);
                t_objectPackageID.Add(packageID.ToString(), actRow);
                t_objectPDATA1.Add(pdata1, actRow);
                t_objectObjectType.Add(objectType, actRow);

                elementIdToEAElement.Add(int.Parse(objectID), new SQLElement(this, actRow));
                elementGuidToEAElement.Add(guid, new SQLElement(this, actRow));
            }
        }
예제 #20
0
        private void doRulesForFeatures(SQLRepository repository, List <SQLElement> listOfElements, List <SQLConnector> listOfConnectors, List <SQLAttribute> listOfAttributes, List <SQLMethod> listofMethods, List <SQLParameter> listofParameters, List <SQLPackage> listOfPackages)
        {
            List <SQLElement> toDelete = new List <SQLElement>();

            foreach (SQLElement elem in listOfElements)
            {
                if (elem.Type == "Constraint")
                {
                    toDelete.Add(elem);
                }
            }

            foreach (SQLElement del in toDelete)
            {
                listOfElements.Remove(del);
            }


            String result = repository.SQLQuery("select a.* from t_object a, t_package b, t_diagramobjects c where a.Object_Type = 'Constraint' AND a.Package_ID = b.Package_ID and b.Name = 'Rules' AND c.Object_ID = a.Object_ID");

            //String result = repository.SQLQuery("select * from t_object where Object_Type = 'Constraint' AND Diagram_ID <> 0");
            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    listOfElements.Add(new SQLElement(repository, row));
                }
            }

            consistencyProgressbar.invokeProgressBarSetBarSize(6);

            consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otElement);
            foreach (SQLElement element in listOfElements)
            {
                if (Canceled)
                {
                    return;
                }
                RuleControl.deleteRuleResults(EA.ObjectType.otElement, element.ElementID);
                RuleControl.doRules(element, repository);
            }
            consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otConnector);
            foreach (SQLConnector connector in listOfConnectors)
            {
                if (Canceled)
                {
                    return;
                }
                RuleControl.deleteRuleResults(EA.ObjectType.otConnector, connector.ConnectorID);
                RuleControl.doRules(connector, repository);
            }
            consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otMethod);
            foreach (SQLMethod method in listofMethods)
            {
                if (Canceled)
                {
                    return;
                }
                RuleControl.deleteRuleResults(EA.ObjectType.otMethod, method.MethodID);
                RuleControl.doRules(method, repository);
            }

            consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otParameter);
            foreach (SQLParameter parameter in listofParameters)
            {
            }

            consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otAttribute);
            foreach (SQLAttribute attribute in listOfAttributes)
            {
                if (Canceled)
                {
                    return;
                }
                RuleControl.deleteRuleResults(EA.ObjectType.otAttribute, attribute.AttributeID);
                RuleControl.doRules(attribute, repository);
            }
            consistencyProgressbar.invokeProgressBarAndPerformNext(EA.ObjectType.otPackage);
            foreach (SQLPackage actpackage in listOfPackages)
            {
                if (Canceled)
                {
                    return;
                }
                RuleControl.deleteRuleResults(EA.ObjectType.otPackage, actpackage.PackageID);
                RuleControl.doRules(actpackage, repository);
            }
        }
예제 #21
0
 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);
     }
 }