Ejemplo n.º 1
0
 public static bool filterDataItem(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (e != null)
     {
         if (DiagramManager.isVisible(con))
         {
             if (e.Stereotype.Contains(APIAddIn.APIAddinClass.METAMODEL_DATAITEM))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        static int visitOutboundConnectedElements(bool ensureVisible, EA.Repository Repository, EA.Element clientElement, YamlNode parent, Func <EA.Repository, EA.Connector, EA.Element, EA.Element, bool> filter, Func <EA.Connector, EA.Element, EA.Element, string> name, Func <EA.Repository, EA.Element, EA.Connector, EA.Element, YamlNode> properties)
        {
            int outboundCount = 0;

            //logger.log("Processing Connections from:" + clientElement.Name);
            foreach (EA.Connector con in clientElement.Connectors)
            {
                //logger.log("Processing Connector:" + con.Name);

                if (ensureVisible)
                {
                    if (!DiagramManager.isVisible(con))
                    {
                        continue;
                    }
                }

                EA.Element supplierElement = null;
                if (clientElement.ElementID == con.ClientID)
                {
                    supplierElement = Repository.GetElementByID(con.SupplierID);
                    //logger.log("Found resource:" + supplierElement.Name);

                    EA.Element supplierClassifier = null;
                    if (supplierElement.ClassifierID != 0)
                    {
                        supplierClassifier = Repository.GetElementByID(supplierElement.ClassifierID);
                    }

                    //logger.log("Classifier");
                    if (!filter(Repository, con, supplierElement, supplierClassifier))
                    {
                        continue;
                    }

                    outboundCount += 1;

                    //logger.log("Filtered");

                    String nm = name(con, supplierElement, clientElement);

                    YamlNode o = properties(Repository, supplierElement, con, clientElement);
                    if (o == null)
                    {
                        continue;
                    }
                    else if (parent.GetType().Name.StartsWith("YamlSequenceNode"))
                    {
                        YamlSequenceNode seq = (YamlSequenceNode)parent;
                        if (o.GetType().Name.StartsWith("YamlSequenceNode"))
                        {
                            YamlSequenceNode oseq = (YamlSequenceNode)o;
                            foreach (YamlNode n in oseq.Children)
                            {
                                seq.Add(n);
                            }
                        }
                        else
                        {
                            seq.Add(o);
                        }
                    }
                    else if (parent.GetType().Name.StartsWith("YamlMappingNode"))
                    {
                        if (nm == null)
                        {
                            continue;
                        }
                        YamlMappingNode map = (YamlMappingNode)parent;
                        try
                        {
                            map.Add(nm, o);
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("Duplicate entry:" + nm, ex);
                        }
                    }
                }
            }
            //logger.log("Processed Connections from:" + clientElement.Name);
            return(outboundCount);
        }