Exemple #1
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);
        }
        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);
        }
Exemple #3
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();
            }
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #7
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);
     }
 }