当前位置: 首页>>代码示例>>C#>>正文


C# EA.GetElementByGuid方法代码示例

本文整理汇总了C#中EA.GetElementByGuid方法的典型用法代码示例。如果您正苦于以下问题:C# EA.GetElementByGuid方法的具体用法?C# EA.GetElementByGuid怎么用?C# EA.GetElementByGuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EA的用法示例。


在下文中一共展示了EA.GetElementByGuid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addConnector

        /// <summary>
        /// method adds a new connector between source and target element
        /// </summary>
        /// <param name="Repository">EA repository</param>
        /// <param name="srcGUID">GUID of source element</param>
        /// <param name="targetGUID">GUID of target element</param>
        /// <param name="name">name of new connector</param>
        /// <param name="elementType">type of new connector</param>
        /// <returns>GUID of new connector</returns>
        public string addConnector(EA.Repository Repository, string srcGUID, string targetGUID, string name, int elementType)
        {
            EA.Element source = (EA.Element)Repository.GetElementByGuid(srcGUID);
            EA.Element target = (EA.Element)Repository.GetElementByGuid(targetGUID);

            EA.Connector newConnector = (EA.Connector)source.Connectors.AddNew(name, getConnectorType(elementType));

            if (elementType == 73)
            {
                newConnector.Subtype = "Includes";
                newConnector.Stereotype = "include";
            }
            else if (elementType == 74)
            {
                newConnector.Subtype = "Extends";
                newConnector.Stereotype = "extend";
            }

            newConnector.SupplierID = target.ElementID;
            newConnector.Update();
            source.Connectors.Refresh();

            BPAddIn.synchronizationWindow.addToList("Addition of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + name +
                   "' between element '" + source.Name + "' and element '" + target.Name + "'");

            return newConnector.ConnectorGUID;
        }
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:36,代码来源:SynchronizationAdditions.cs

示例2: GetElementFromContextObject

 /// <summary>
 /// Get element from Context element. Possible inputs are: Attribute, Operation, Element, Package
 /// </summary>
 /// <param name="rep"></param>
 /// <returns></returns>
 public static EA.Element GetElementFromContextObject(EA.Repository rep)  {
     EA.Element el = null;
     EA.ObjectType objectType = rep.GetContextItemType();
     switch (objectType)
     {
         case ObjectType.otAttribute:
             var a = (EA.Attribute)rep.GetContextObject();
             el = rep.GetElementByID(a.ParentID);
             break;
         case ObjectType.otMethod:
             var m = (Method)rep.GetContextObject();
             el = rep.GetElementByID(m.ParentID);
             break;
         case ObjectType.otElement:
             el = (EA.Element)rep.GetContextObject();
             break;
         case ObjectType.otPackage:
             EA.Package pkg  = rep.GetContextObject();
             el = rep.GetElementByGuid(pkg.PackageGUID);
             break;
         case ObjectType.otNone:
             EA.Diagram dia = rep.GetCurrentDiagram();
             if (dia?.SelectedObjects.Count == 1)
             {
                 var objSelected = (EA.DiagramObject)dia.SelectedObjects.GetAt(0);
                 el = rep.GetElementByID(objSelected.ElementID);
             }
             break;
         default:
             MessageBox.Show(@"No Element, Attribute, Operation, Package selected");
             break;
      }
     return el;
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:39,代码来源:Util.cs

示例3: moveDiagramToElement

        /// <summary>
        /// method moves diagram into target element
        /// </summary>
        /// <param name="Repository">EA repository</param>
        /// <param name="diagramGUID">GUID of diagram that should be moved</param>
        /// <param name="elementGUID">GUID of target element</param>
        public void moveDiagramToElement(EA.Repository Repository, string diagramGUID, string elementGUID)
        {
            EA.Element element = (EA.Element)Repository.GetElementByGuid(elementGUID);
            EA.Diagram diagram = (EA.Diagram)Repository.GetDiagramByGuid(diagramGUID);
            diagram.ParentID = element.ElementID;
            diagram.Update();
            element.Diagrams.Refresh();

            BPAddIn.synchronizationWindow.addToList("Movement of diagram '" + diagram.Name + "' to element '" +
                    element.Name + "'");
        }
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:17,代码来源:SynchronizationMovements.cs

示例4: showObjectProperties

 public void showObjectProperties(EA.Repository Repository, string GUID, EA.ObjectType ot)
 {
     eaObjectType.Text = ot.ToString();
     eaObjectName.Text = "?";
     switch(ot)
     {
         case EA.ObjectType.otAttribute:
             EA.Attribute attribute = Repository.GetAttributeByGuid(GUID);
             currentEaObject = attribute;
             currentEaObjectCollections = null;
             eaObjectName.Text = attribute.Name;
             showEmbeddedObjects.Enabled = false;
             showEmbeddedObjects.Checked = false;
             break;
         case EA.ObjectType.otElement:
             EA.Element element = Repository.GetElementByGuid(GUID);
             currentEaObject = element;
             currentEaObjectCollections = new EAElementCollections(element);
             eaObjectName.Text = element.Name;
             showEmbeddedObjects.Enabled = true;
             break;
         case EA.ObjectType.otMethod:
             EA.Method method = Repository.GetMethodByGuid(GUID);
             currentEaObject = method;
             currentEaObjectCollections = null;
             eaObjectName.Text = method.Name;
             showEmbeddedObjects.Enabled = false;
             showEmbeddedObjects.Checked = false;
             break;
         case EA.ObjectType.otPackage:
             EA.Package package = Repository.GetPackageByGuid(GUID);
             currentEaObject = package;
             currentEaObjectCollections = new EAPackageCollections(package);
             eaObjectName.Text = package.Name;
             showEmbeddedObjects.Enabled = true;
             break;
         case EA.ObjectType.otConnector:
             EA.Connector connector = Repository.GetConnectorByGuid(GUID);
             currentEaObject = connector;
             currentEaObjectCollections = null;
             showEmbeddedObjects.Enabled = false;
             showEmbeddedObjects.Checked = false;
             break;
         default:
             currentEaObject = null;
             currentEaObjectCollections = null;
             propertyGrid.SelectedObject = null;
             showEmbeddedObjects.Enabled = false;
             showEmbeddedObjects.Checked = false;
             break;
     }
     SynchPropertyGridSelection();
 }
开发者ID:makulik,项目名称:EA-Explorer,代码行数:53,代码来源:EAExplorerControl.cs

示例5: GetBehaviorForOperation

 public static EA.Element GetBehaviorForOperation(EA.Repository repository, EA.Method method)
 {
     EA.Element returnValue = null;
     string behavior = method.Behavior;
     if (behavior.StartsWith("{", StringComparison.Ordinal) & behavior.EndsWith("}", StringComparison.Ordinal))
     {
         // get object according to behavior
         EA.Element el = repository.GetElementByGuid(behavior);
         returnValue = el;
     }
     return returnValue;
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:12,代码来源:Appl.cs

示例6: addConstraint

        /// <summary>
        /// method adds constraint to element
        /// </summary>
        /// <param name="repository">EA repository</param>
        /// <param name="elementGUID">GUID of changed element</param>
        /// <param name="name">name of new constraint</param>
        /// <param name="type">type of new constraint</param>
        /// <param name="elementType">type of changed element</param>
        public void addConstraint(EA.Repository repository, string elementGUID, string name, string type, int elementType)
        {
            int index = name.IndexOf("notes:=") + 7;

            EA.Element element = (EA.Element)repository.GetElementByGuid(elementGUID);
            EA.Constraint constraint = (EA.Constraint)element.Constraints.AddNew(name.Substring(0, index-8), type);
            constraint.Notes = name.Substring(index, name.Length - index);
            constraint.Update();
            element.Constraints.Refresh();

            BPAddIn.synchronizationWindow.addToList("Addition of constraint '" + name.Substring(0, index - 8) + "' of type '" + type + "' to "
               + itemTypes.getElementTypeInEnglish(elementType) + " '" + element.Name + "' (Location of element: " + itemTypes.getLocationOfItem(repository, element.PackageID, element.ParentID));
        }
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:21,代码来源:SynchronizationChanges.cs

示例7: load

        public override void load(EA.Repository rep)
        {

            _Name = _pkg.Name;
            _Description = _pkg.Notes;
            _Stereotype = _pkg.StereotypeEx;


            // Model don't have an element
            if (_pkg.ParentID != 0)
            {
                EA.Element elPkg = rep.GetElementByGuid(GUID);
                _Stereotype = elPkg.StereotypeEx;
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:15,代码来源:FindAndReplaceItemPackage.cs

示例8: addAttribute

        /// <summary>
        /// method adds a new attribute into element
        /// </summary>
        /// <param name="Repository">EA repository</param>
        /// <param name="elementGUID">GUID of element</param>
        /// <param name="name">name of new attribute</param>
        /// <param name="scope">scope of new attribute</param>
        /// <returns>GUID of new attribute</returns>
        public string addAttribute(EA.Repository Repository, string elementGUID, string name, string scope)
        {
            EA.Element element = (EA.Element)Repository.GetElementByGuid(elementGUID);

            EA.Attribute attribute = (EA.Attribute)element.Attributes.AddNew(name, "");
            attribute.Visibility = scope;
            attribute.Update();

            element.Attributes.Refresh();

            BPAddIn.synchronizationWindow.addToList("Addition of attribute '" + name + "' with scope '" + scope
                + "' to element '" + element.Name + "' (Location of element: " + itemTypes.getLocationOfItem(Repository, element.PackageID, element.ParentID));

            return attribute.AttributeGUID;
        }
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:23,代码来源:SynchronizationAdditions.cs

示例9: DisplayBehaviorForOperation

 public static void DisplayBehaviorForOperation(EA.Repository repository, EA.Method method)
 {
     string behavior = method.Behavior;
     if (behavior.StartsWith("{", StringComparison.Ordinal) & behavior.EndsWith("}", StringComparison.Ordinal))
     {
         // get object according to behavior
         EA.Element el = repository.GetElementByGuid(behavior);
         // Activity
         if (el == null) { }
         else
         {
             if (el.Type.Equals("Activity") || el.Type.Equals("Interaction") || el.Type.Equals("StateMachine"))
             {
                 Util.OpenBehaviorForElement(repository, el);
             }
         }
     }
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:18,代码来源:Appl.cs

示例10: save

 public override void save(EA.Repository rep, FindAndReplaceItem.FieldType fieldType)
 {
     _pkg = rep.GetPackageByGuid(GUID);
     if ((fieldType & FindAndReplaceItem.FieldType.Description) > 0)
     { _pkg.Notes = _Description; }
     if ((fieldType & (FindAndReplaceItem.FieldType.Name | FindAndReplaceItem.FieldType.Stereotype) ) > 0)
     {
         // model don't have an element
         if (_pkg.ParentID != 0)
         {
             EA.Element el = rep.GetElementByGuid(GUID);
             el.StereotypeEx = _Stereotype;
             el.Name = _Name;
             el.Update();
         }
         _pkg.Name = _Name;
     }
     _isUpdated = true;
     _pkg.Update();
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:20,代码来源:FindAndReplaceItemPackage.cs

示例11: doRecursivePkg

        public static void doRecursivePkg(EA.Repository rep, EA.Package pkg, FindAndReplace fr)
        {
            // perform package
            if (fr.isPackageSearch)
            {
                fr.FindStringInItem(EA.ObjectType.otPackage, pkg.PackageGUID);
                if (fr.isTagSearch)
                {
                    // tagged values are beneath element with the same Id
                    EA.Element el = rep.GetElementByGuid(pkg.PackageGUID);
                    if (el != null)   FindMatchingPackageTaggedValue(rep, pkg, fr);
                }

            }

            // perform diagrams of package
            if (fr.isDiagramSearch)
            {
                foreach (EA.Diagram dia in pkg.Diagrams)
                {
                    if (dia != null) fr.FindStringInItem(EA.ObjectType.otDiagram, dia.DiagramGUID);
                }
            }
            // run elements of package
            foreach (EA.Element el in pkg.Elements)
            {
                doRecursiveEl(rep, el, fr);
            }
            
            // run packages of package
            foreach (EA.Package pkgTrgt in pkg.Packages)
            {
                doRecursivePkg(rep, pkgTrgt, fr);
            }
            return;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:36,代码来源:RecursivePackagesFind.cs

示例12: handleContextItemChange

        public void handleContextItemChange(EA.Repository repository, string GUID, ObjectType ot)
        {
            try
            {
                switch (ot)
                {
                    case ObjectType.otElement:
                        this.currentItem = repository.GetElementByGuid(GUID);

                        if (currentItem.Type == "Class")
                        {
                            currentAttributes = new Dictionary<string, EA.Attribute>();
                            foreach (EA.Attribute attr in currentItem.Attributes)
                            {
                                currentAttributes.Add(attr.AttributeGUID, attr);
                            }
                        }

                        if (currentItem.Type == "UseCase")
                        {
                            // CONSTRAINTS
                            currentConstraintsList = new List<ConstraintWrapper>();
                            foreach (EA.Constraint constraint in currentItem.Constraints)
                            {
                                currentConstraintsList.Add(new ConstraintWrapper(constraint));
                            }

                            // SCENARIOS
                            currentScenarioList = new List<ScenarioWrapper>();
                            currentScenarioStepList = new Dictionary<string, List<EA.ScenarioStep>>();
                            foreach (EA.Scenario scenario in currentItem.Scenarios)
                            {
                                currentScenarioList.Add(new ScenarioWrapper(scenario));
                                if (!currentScenarioStepList.ContainsKey(scenario.ScenarioGUID))
                                {
                                    currentScenarioStepList.Add(scenario.ScenarioGUID, new List<ScenarioStep>());
                                }

                                foreach (ScenarioStep step in scenario.Steps)
                                {
                                    currentScenarioStepList[scenario.ScenarioGUID].Add(step);
                                }
                            }
                        }

                        this.currentConnector = null;
                        this.currentDiagram = null;
                        changed = false;
                        currentAuthor = repository.GetElementByGuid(GUID).Author;
                        break;
                    case ObjectType.otPackage:
                        this.currentItem = repository.GetElementByGuid(GUID);
                        this.currentConnector = null;
                        this.currentDiagram = null;
                        changed = false;
                        currentAuthor = repository.GetElementByGuid(GUID).Author;
                        break;
                    case ObjectType.otConnector:
                        this.currentConnector = repository.GetConnectorByGuid(GUID);
                        this.currentItem = null;
                        this.currentDiagram = null;
                        changed = false;
                        break;
                    case ObjectType.otDiagram:
                        this.currentDiagram = (EA.Diagram)repository.GetDiagramByGuid(GUID);
                        this.currentConnector = null;
                        this.currentItem = null;
                        changed = false;
                        currentAuthor = ((EA.Diagram)repository.GetDiagramByGuid(GUID)).Author;
                        currentParent = currentDiagram.ParentID.ToString();

                        currentExtensionPoints = new Dictionary<string, string>();
                        currentDiagramObjectPositions = new Dictionary<int, string>();
                        foreach (EA.DiagramObject diagramObject in currentDiagram.DiagramObjects)
                        {
                            try
                            {
                                EA.Collection col = repository.GetElementSet("" + diagramObject.ElementID, 1);
                                EA.Element element = (EA.Element)col.GetAt(0);

                                if (element.Type == "UseCase")
                                {
                                    currentExtensionPoints.Add(element.ElementGUID, element.ExtensionPoints);
                                }
                            }
                            catch (Exception ex)
                            {
                            }

                            string coordinates = "";
                            coordinates += "l=" + diagramObject.left + ";";
                            coordinates += "r=" + diagramObject.right + ";";
                            coordinates += "t=" + diagramObject.top + ";";
                            coordinates += "b=" + diagramObject.bottom + ";";
                            currentDiagramObjectPositions.Add(diagramObject.ElementID, coordinates);

                        }
                        break;
                    default:
                        return;
//.........这里部分代码省略.........
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:101,代码来源:ContextWrapper.cs

示例13: GetOperationFromConnector


//.........这里部分代码省略.........
//               (!rep.ConnectionString.Contains(".eap")))// Access
//            {
//                query =
//                  @"select op.ea_guid AS EA_GUID
//                        from t_operation op 
//                        where op.Behaviour = '" + el.ElementGUID + "'";

//            }

//            string str = rep.SQLQuery(query);
//            XmlDocument XmlDoc = new XmlDocument();
//            XmlDoc.LoadXml(str);

//            XmlNode operationGUIDNode = XmlDoc.SelectSingleNode("//EA_GUID");
//            if (operationGUIDNode != null)
//            {
//                string GUID = operationGUIDNode.InnerText;
//                method = rep.GetMethodByGuid(GUID);
//            }
//            return method;
//        }



        public static Method GetOperationFromConnector(EA.Repository rep, EA.Connector con)
        {
            Method method = null;
            string query = "";
            if (GetConnectionString(rep).Contains("DBType=3"))
                //pdat3: 'Activity','Sequence', (..)
            {   // Oracle DB
                query =
                    @"select description AS EA_GUID
                      from t_xref x 
                      where Cast(x.client As Varchar2(38)) = '" + con.ConnectorGUID + "'" +
                                                                " AND Behavior = 'effect' ";
            }
            if (GetConnectionString(rep).Contains("DBType=1"))
            {   // SQL Server

                query =
                      @"select description AS EA_GUID
                        from t_xref x 
                        where Substring(x.client,1,38) = " + "'" + con.ConnectorGUID + "'" +
                           " AND Behavior = 'effect' "                   
                                          ;
            }
            if (GetConnectionString(rep).Contains(".eap"))
            {

                query =
                      @"select description AS EA_GUID
                        from t_xref x 
                        where client = " + "'" + con.ConnectorGUID + "'" +
                           " AND Behavior = 'effect' "
                                          ;
            }
            if ((! GetConnectionString(rep).Contains("DBType=1")) &&  // SQL Server, DBType=0 MySQL
                (! GetConnectionString(rep).Contains("DBType=3")) &&  // Oracle
                (! GetConnectionString(rep).Contains(".eap")))// Access
            {
                query =
                @"select description AS EA_GUID
                        from t_xref x 
                        where client = " + "'" + con.ConnectorGUID + "'" +
                             " AND Behavior = 'effect' "
                                            ;

            }


            string str = rep.SQLQuery(query);
            var xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(str);

            //string type = "";
            //XmlNode pdat3Node = XmlDoc.SelectSingleNode("//PDAT3");
            //if (pdat3Node != null)
            //{
            //    type = pdat3Node.InnerText;
                
            //}
            //if ( type.EndsWith(")")) // Operation
            //{ 
            string guid = null;
                XmlNode operationGuidNode = xmlDoc.SelectSingleNode("//EA_GUID");
                if (operationGuidNode != null)
                {
                    guid = operationGuidNode.InnerText;
                    method = rep.GetMethodByGuid(guid);
                }
                if (method == null)
                {

                     if (guid != null) OpenBehaviorForElement(rep, rep.GetElementByGuid(guid));
                }
            //}

            return method;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:101,代码来源:Util.cs

示例14: FindMatchingPackageTaggedValue

        /// <summary>
        /// Find matching tagged values for element 
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="el"></param>
        /// <param name="fr"></param>
        private static void FindMatchingPackageTaggedValue(EA.Repository rep, EA.Package pkg, FindAndReplace fr)
        {
            EA.Element el = rep.GetElementByGuid(pkg.PackageGUID);
            foreach (EA.TaggedValue tag in el.TaggedValues)
            {
                if ((fr.tagValueNames.Length == 0) || (fr.tagValueNames.Contains(tag.Name)))
                {
                    int count = FindAndReplaceItem.findCountForType(fr.regexPattern, tag.Value);
                    if (count > 0)
                    {
                        FindAndReplaceItem frItem = fr.lastItem();
                        if ((frItem == null) || (frItem.GUID != el.ElementGUID))
                        {
                            frItem = FindAndReplaceItem.Factory(rep, EA.ObjectType.otPackage, el.ElementGUID);
                            fr.l_items.Add(frItem);


                        }
                        var frItemPkg = (FindAndReplaceItemPackage)frItem;
                        frItemPkg.l_itemTag.Add(new FindAndReplaceItemTagPackage(tag));
                        frItemPkg.CountChanges = frItemPkg.CountChanges + count;


                    }
                }

            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:34,代码来源:RecursivePackagesFind.cs

示例15: GetParameterFromActivity

        //------------------------------------------------------------------------------------------------------------------------------------
        // Find the Parameter of a Activity
        //------------------------------------------------------------------------------------------------------------------------------------
        // par Parameter of Operation (only if isReturn = false)
        // act Activity
        // Parameter wird aufgrund des Alias-Namens gefunden
        //
        // 
        public static EA.Element  GetParameterFromActivity(EA.Repository rep, EA.Parameter par, EA.Element act, bool isReturn = false)
        {

            string aliasName;
            if (isReturn)
            {
                aliasName = "return:";
            }
            else
            {
                aliasName = "par_" + par.Position;
            }

            EA.Element parTrgt = null;
            string query = @"select o2.ea_guid AS CLASSIFIER_GUID
                      from t_object o1 INNER JOIN t_object o2 on ( o2.parentID = o1.object_id)
                      where o1.Object_ID = " + act.ElementID + 
                             " AND  o2.Alias like '"+ aliasName + GetWildCard(rep) + "'";
            string str = rep.SQLQuery(query); 
            var xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(str);

            XmlNode operationGuidNode = xmlDoc.SelectSingleNode("//CLASSIFIER_GUID");
            if (operationGuidNode != null)
            {
                string guid = operationGuidNode.InnerText;
                parTrgt = rep.GetElementByGuid(guid);
            }
            return parTrgt;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:38,代码来源:Util.cs


注:本文中的EA.GetElementByGuid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。