Esempio n. 1
0
        internal HashSet <UML_SM.Vertex> createVertices
            (BehaviorStateMachines.Region region
            )
        {
            HashSet <UML_SM.Vertex> newVertices =
                new HashSet <UML_SM.Vertex>();

            global::EA.Element parentElement = region.wrappedElement;
            foreach (global::EA.Element childElement in parentElement.Elements)
            {
                UML_SM.Vertex newVertex = null;
                switch (childElement.Type)
                {
                case "State":
                case "StateMachine":
                case "StateNode":
                    newVertex = createEAElementWrapper(childElement) as UML_SM.Vertex;
                    break;
                }
                if (newVertex != null)
                {
                    if (region.isContainedElement(newVertex as ElementWrapper))
                    {
                        newVertex.container = region;
                        newVertices.Add(newVertex);
                    }
                }
            }
            return(newVertices);
        }
Esempio n. 2
0
        /// creates a new EAElementWrapper based on the given EA.Element
        internal ElementWrapper createEAElementWrapper
            (global::EA.Element elementToWrap)
        {
            switch (elementToWrap.Type)
            {
            case "Class":
                return(new Class(this.model as Model, elementToWrap));

            case "Interface":
                return(new Interface(this.model as Model, elementToWrap));

            case "Note":
                return(new NoteComment(this.model as Model, elementToWrap));

            case "Action":
                // figure out wether this Action is a standard action or a
                // specialized action
                //elementToWrap.Properties;
                XmlDocument descriptionXml  = ((Model)this.model).SQLQuery(@"SELECT x.Description FROM t_object o
										inner join t_xref x on x.Client = o.ea_guid
										where o.Object_ID = "                                         + elementToWrap.ElementID.ToString());
                XmlNode     descriptionNode = descriptionXml.SelectSingleNode("//Description");
                if (descriptionNode != null)
                {
                    if (descriptionNode.InnerText.Contains("CallOperation"))
                    {
                        return(new CallOperationAction(this.model as Model, elementToWrap));
                    }
                }
                // simple Action
                return(new Action(this.model as Model, elementToWrap));

            case "Interaction":
                return(new Interaction(this.model as Model, elementToWrap));

            case "Activity":
                return(new Activity(this.model as Model, elementToWrap));

            case "StateMachine":
                return(new StateMachine(this.model as Model, elementToWrap));

            case "Package":
                int packageID;
                if (int.TryParse(elementToWrap.MiscData[0], out packageID))
                {
                    return(((Model)this.model).getElementWrapperByPackageID(packageID));
                }
                else
                {
                    throw new Exception("WrappedElement " + elementToWrap.Name + " is not a package");
                }

            default:
                return(new ElementWrapper(this.model as Model, elementToWrap));
            }
        }
Esempio n. 3
0
 public static global::EA.Element getElementForPackage(Model model, global::EA.Package package)
 {
     global::EA.Element foundElement = package.Element;
     //if for some reason the Element is not filled in we get it using the package GUID.
     if (foundElement == null)
     {
         foundElement = model.wrappedModel.GetElementByGuid(package.PackageGUID);
     }
     return(foundElement);
 }
        /// <summary>
        /// checks if this element is an associationclass.
        /// Associationclasses have the connectorID in the Miscdata[3] (PDATA4)
        /// We have to use this because elementToWrap.IsAssocationClass() throws an exception when used in a background trhead
        /// </summary>
        /// <param name="elementToWrap">the element to check</param>
        /// <returns>true if it is an associationclass</returns>
        private bool isAssociationClass(global::EA.Element elementToWrap)
        {
            int connectorID;

            if (int.TryParse(elementToWrap.MiscData[3].ToString(), out connectorID))
            {
                return(elementToWrap.Type == "Class" && connectorID > 0);
            }
            return(false);
        }
Esempio n. 5
0
 public AssociationClass(Model model, global::EA.Element elementToWrap)
     : base(model, elementToWrap)
 {
 }
Esempio n. 6
0
 public ElementWrapper(Model model, global::EA.Element wrappedElement)
     : base(model)
 {
     this.wrappedElement = wrappedElement;
 }
 public NoteComment(Model model, global::EA.Element wrappedNote)
     : base(model, wrappedNote)
 {
 }
 public FinalState(Model model, global::EA.Element wrappedElement, UML.StateMachines.BehaviorStateMachines.Region containingRegion)
     : base(model, wrappedElement, containingRegion)
 {
 }
 public Property(Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
 public Class(Model model, global::EA.Element elementToWrap)
     : base(model, elementToWrap)
 {
 }
 public Action(Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
Esempio n. 12
0
 public Trigger(UTF_EA.Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
     _event = new UTF_EA.BehaviorStateMachines.Event(model, wrappedElement);
 }
 public Enumeration(Model model, global::EA.Element elementToWrap)
     : base(model, elementToWrap)
 {
 }
 public InformationItem(Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
        /// creates a new EAElementWrapper based on the given EA.Element
        internal ElementWrapper createEAElementWrapper
            (global::EA.Element elementToWrap)
        {
            //first check if this element already exists in the cache
            if (this.EAModel.useCache)
            {
                var elementWrapper = this.EAModel.getElementFromCache(elementToWrap.ElementID);
                if (elementWrapper != null)
                {
                    return(elementWrapper);
                }
            }
            ElementWrapper newElementWrapper;

            switch (elementToWrap.Type)
            {
            case "Class":
                //first check if this isn't an enumeration.
                // Enumerations are stored as type Class but with the stereotype enumeration
                if (elementToWrap.StereotypeEx.Contains("enumeration"))
                {
                    newElementWrapper = new Enumeration(this.model as Model, elementToWrap);
                    break;
                }
                else
                {
                    //check if associationclass
                    //elementToWrap.IsAssocationClass() returns an exception when used in a background thread so we use our own method to figure out if its an associationClass.
                    if (this.isAssociationClass(elementToWrap))
                    {
                        newElementWrapper = new AssociationClass(this.model as Model, elementToWrap);
                        break;
                    }
                    else
                    {
                        //just a regular class
                        newElementWrapper = new Class(this.model as Model, elementToWrap);
                        break;
                    }
                }

            case "Enumeration":
                // since version 10 there are also "real" enumerations Both are still supported
                newElementWrapper = new Enumeration(this.model as Model, elementToWrap);
                break;

            case "Interface":
                newElementWrapper = new Interface(this.model as Model, elementToWrap);
                break;

            case "Note":
                newElementWrapper = new NoteComment(this.model as Model, elementToWrap);
                break;

            case "Action":
                // figure out wether this Action is a standard action or a
                // specialized action
                //elementToWrap.Properties;
                XmlDocument descriptionXml   = ((Model)this.model).SQLQuery(@"SELECT x.Description FROM t_object o
										inner join t_xref x on x.Client = o.ea_guid
										where o.Object_ID = "                                         + elementToWrap.ElementID.ToString());
                XmlNodeList descriptionNodes = descriptionXml.SelectNodes(((EA.Model) this.model).formatXPath("//Description"));
                foreach (XmlNode descriptionNode in descriptionNodes)
                {
                    if (descriptionNode.InnerText.Contains("CallOperation"))
                    {
                        newElementWrapper = new CallOperationAction(this.model as Model, elementToWrap);
                        break;
                    }
                }

                // simple Action
                newElementWrapper = new Action(this.model as Model, elementToWrap);
                break;

            case "Interaction":
                newElementWrapper = new Interaction(this.model as Model, elementToWrap);
                break;

            case "Activity":
                newElementWrapper = new Activity(this.model as Model, elementToWrap);
                break;

            case "StateMachine":
                newElementWrapper = new BehaviorStateMachines.StateMachine(this.model as Model, elementToWrap);
                break;

            case "State":
                newElementWrapper = new BehaviorStateMachines.State(this.model as Model, elementToWrap, null);
                break;

            case "StateNode":
                string metaType = elementToWrap.MetaType;
                if (metaType == "Pseudostate" ||
                    metaType == "Synchronisation")
                {
                    newElementWrapper = new BehaviorStateMachines.PseudoState(this.model as Model, elementToWrap, null);
                    break;
                }
                else if (metaType == "FinalState")
                {
                    newElementWrapper = new BehaviorStateMachines.FinalState(this.model as Model, elementToWrap, null);
                    break;
                }
                newElementWrapper = new ElementWrapper(this.model as Model, elementToWrap);
                break;

            case "Package":
                int packageID;
                if (int.TryParse(elementToWrap.MiscData[0], out packageID))
                {
                    newElementWrapper = ((Model)this.model).getElementWrapperByPackageID(packageID);
                    break;
                }
                else
                {
                    throw new Exception("WrappedElement " + elementToWrap.Name + " is not a package");
                }

            case "DataType":
            case "PrimitiveType":     //TODO: fix primitive type so it can handle this
                newElementWrapper = new DataType(this.model as Model, elementToWrap);
                break;

            case "InformationItem":
                newElementWrapper = new InformationItem(this.model as Model, elementToWrap);
                break;

            case "ProxyConnector":
                newElementWrapper = new ProxyConnector(this.model as Model, elementToWrap);
                break;

            case "Part":
                newElementWrapper = new Property(this.model as Model, elementToWrap);
                break;

            case "InteractionFragment":
                newElementWrapper = new InteractionFragment(this.model as Model, elementToWrap);
                break;

            default:
                newElementWrapper = new ElementWrapper(this.model as Model, elementToWrap);
                break;
            }
            //add the element to the cache if needed
            if (this.EAModel.useCache)
            {
                this.EAModel.addElementToCache(newElementWrapper);
            }
            return(newElementWrapper);
        }
 public DataType(Model model, global::EA.Element elementToWrap)
     : base(model, elementToWrap)
 {
 }
 /// <summary>
 /// constructor, no special treatment
 /// </summary>
 /// <param name="model">the model</param>
 /// <param name="wrappedElement">the EA.Element to wrap</param>
 public CallOperationAction(Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
 public Interface(Model model, global::EA.Element element) :
     base(model, element)
 {
 }
Esempio n. 19
0
 /// <summary>
 /// default constructor, calls parent constructor
 /// </summary>
 /// <param name="model">the model containing the element</param>
 /// <param name="wrappedElement">the EA.Element to be wrapped</param>
 public StateMachine(Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
Esempio n. 20
0
 public ProxyConnector(Model model, global::EA.Element wrappedElement) : base(model, wrappedElement)
 {
 }
 public Vertex(Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
Esempio n. 22
0
        /// creates a new EAElementWrapper based on the given EA.Element
        internal ElementWrapper createEAElementWrapper
            (global::EA.Element elementToWrap)
        {
            switch (elementToWrap.Type)
            {
            case "Class":
                //first check if this isn't an enumeration.
                // Enumerations are stored as type Class but with the stereotype enumeration
                if (elementToWrap.StereotypeEx.Contains("enumeration"))
                {
                    return(new Enumeration(this.model as Model, elementToWrap));
                }
                else
                {
                    return(new Class(this.model as Model, elementToWrap));
                }

            case "Enumeration":
                // since version 10 there are also "real" enumerations Both are still supported
                return(new Enumeration(this.model as Model, elementToWrap));

            case "Interface":
                return(new Interface(this.model as Model, elementToWrap));

            case "Note":
                return(new NoteComment(this.model as Model, elementToWrap));

            case "Action":
                // figure out wether this Action is a standard action or a
                // specialized action
                //elementToWrap.Properties;
                XmlDocument descriptionXml   = ((Model)this.model).SQLQuery(@"SELECT x.Description FROM t_object o
										inner join t_xref x on x.Client = o.ea_guid
										where o.Object_ID = "                                         + elementToWrap.ElementID.ToString());
                XmlNodeList descriptionNodes = descriptionXml.SelectNodes(((EA.Model) this.model).formatXPath("//Description"));
                foreach (XmlNode descriptionNode in descriptionNodes)
                {
                    if (descriptionNode.InnerText.Contains("CallOperation"))
                    {
                        return(new CallOperationAction(this.model as Model, elementToWrap));
                    }
                }

                // simple Action
                return(new Action(this.model as Model, elementToWrap));

            case "Interaction":
                return(new Interaction(this.model as Model, elementToWrap));

            case "Activity":
                return(new Activity(this.model as Model, elementToWrap));

            case "StateMachine":
                return(new BehaviorStateMachines.StateMachine(this.model as Model, elementToWrap));

            case "State":
                return(new BehaviorStateMachines.State(this.model as Model, elementToWrap, null));

            case "StateNode":
                string metaType = elementToWrap.MetaType;
                if (metaType == "Pseudostate" ||
                    metaType == "Synchronisation")
                {
                    return(new BehaviorStateMachines.PseudoState(this.model as Model, elementToWrap, null));
                }
                else if (metaType == "FinalState")
                {
                    return(new BehaviorStateMachines.FinalState(this.model as Model, elementToWrap, null));
                }
                return(new ElementWrapper(this.model as Model, elementToWrap));

            case "Package":
                int packageID;
                if (int.TryParse(elementToWrap.MiscData[0], out packageID))
                {
                    return(((Model)this.model).getElementWrapperByPackageID(packageID));
                }
                else
                {
                    throw new Exception("WrappedElement " + elementToWrap.Name + " is not a package");
                }

            case "DataType":
                return(new DataType(this.model as Model, elementToWrap));

            default:
                return(new ElementWrapper(this.model as Model, elementToWrap));
            }
        }
 public Vertex(Model model, global::EA.Element wrappedElement, UML.StateMachines.BehaviorStateMachines.Region containingRegion)
     : base(model, wrappedElement)
 {
     this._container = containingRegion;
 }
Esempio n. 24
0
        internal global::EA.Diagram getMasterStateDiagram(ElementWrapper elementWrapper, global::EA.Element stateChartElement)
        {
            foreach (global::EA.Diagram diagram in elementWrapper.wrappedElement.Diagrams)
            {
                // Just return the first state chart diagram found that contains the stateChartElement
                if (diagram.Type == "Statechart")
                {
                    foreach (global::EA.DiagramObject diagramObject in diagram.DiagramObjects)
                    {
                        if (stateChartElement.ElementID == diagramObject.ElementID)
                        {
                            return(diagram);
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 25
0
 public ElementWrapper(Model model, global::EA.Element wrappedElement)
     : base(model)
 {
     this.wrappedElement = wrappedElement;
     this.isDirty        = false;
 }
Esempio n. 26
0
 public InteractionFragment(UTF_EA.Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }
 public Event(UTF_EA.Model model, global::EA.Element wrappedElement)
     : base(model, wrappedElement)
 {
 }