/// <summary>
        /// Initialization of the Form
        /// </summary>
        /// <param name="transition"></param>
        /// <param name="Repository"></param>
        public ActivityEdgePropertiesForm(ActivityEdge activityEdge, EA.Repository Repository)
        {
            InitializeComponent();
            activityEdge.loadTreeFromTaggedValue();
            this.repository   = Repository;
            this.activityEdge = activityEdge;

            this.StartPosition = FormStartPosition.CenterScreen;
            this.cmbGuard.comboBoxFromEdgeGuard(activityEdge.GuardType);
            this.ShowDialog();
        }
Ejemplo n.º 2
0
        public void processActivityEdge(SQLConnector activityEdgeEAElement)
        {
            SQLConnectorTag mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(activityEdgeEAElement, Main.MoflonExportTreeTaggedValueName);

            ActivityEdge aEdge = new ActivityEdge(repository, activityEdgeEAElement);
            Boolean      valid = aEdge.loadTreeFromTaggedValue();
            MocaNode     activityEdgeMocaNode = new MocaNode();

            activityEdgeMocaNode.deserializeFromXmlTree(MocaTreeUtil.stringToXmlDocument(mocaTreeTag.Notes).DocumentElement.FirstChild as XmlElement);

            aEdge.addAttributesDuringExport(activityEdgeMocaNode);

            this.currentNode.appendChildNode(activityEdgeMocaNode);
        }
        public override List <String> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == SDMModelingMain.StatementNodeStereotype)
            {
                StatementNode statementNode = new StatementNode(repository, eaElement);
                statementNode.loadTreeFromTaggedValue();

                if (statementNode.StatementExpression != null)
                {
                    String result = statementNode.StatementExpression.ToString();
                    if (!ConsistencyUtil.checkExpression(eaElement, statementNode.StatementExpression, repository))
                    {
                        results.Add("StatementExpression is invalid: (" + result + ")");
                    }
                }
                else
                {
                    results.Add("StatementExpression is missing");
                }

                foreach (SQLConnector outgoingCon in eaElement.Connectors)
                {
                    if (outgoingCon.ClientID == eaElement.ElementID)
                    {
                        ActivityEdge edge = new ActivityEdge(repository, outgoingCon);
                        edge.loadTreeFromTaggedValue();
                        if (edge.GuardType == EdgeGuard.FAILURE || edge.GuardType == EdgeGuard.SUCCESS)
                        {
                            if (statementNode.StatementExpression is MethodCallExpression)
                            {
                                MethodCallExpression mCe    = statementNode.StatementExpression as MethodCallExpression;
                                SQLMethod            method = repository.GetMethodByGuid(mCe.MethodGuid);

                                if (method != null && method.ReturnType != "EBoolean")
                                {
                                    results.Add("Method must be of type EBoolean if StatementNode has success/failure guards");
                                }
                            }
                        }
                    }
                }
            }
            return(results);
        }
Ejemplo n.º 4
0
        private void arrangeUnselectedConnectors(EA.Element newSdmContainer, EA.Diagram newSdmDiagram, EA.Element newStartNode, EA.Element selectedElement, int diagObjectBottom, int diagObjectLeft)
        {
            foreach (EA.Connector connector in selectedElement.Connectors)
            {
                if (!this.selectedElementIDs.Contains(connector.ClientID))
                {
                    ActivityEdge oldEdge = new ActivityEdge(sqlRepository, sqlRepository.GetConnectorByID(connector.ConnectorID));
                    oldEdge.loadTreeFromTaggedValue();
                    //rearrange connector target to new statement node
                    if (thisOvPattern != null)
                    {
                        connector.SupplierID = thisOvPattern.ElementID;
                    }
                    else
                    {
                        connector.SupplierID = sdmCallPattern.ElementID;
                    }
                    connector.Update();

                    //create new connection from new start node to selected Element
                    EA.Connector newConnection = newStartNode.Connectors.AddNew("", Main.EAControlFlowType) as EA.Connector;
                    newConnection.SupplierID = selectedElement.ElementID;
                    newConnection.Update();

                    ActivityEdge newEdge = new ActivityEdge(sqlRepository, sqlRepository.GetConnectorByID(newConnection.ConnectorID));
                    //newEdge.GuardType = oldEdge.GuardType;
                    newEdge.saveTreeToEATaggedValue(true);
                }
                else if (!this.selectedElementIDs.Contains(connector.SupplierID))
                {
                    ActivityEdge oldEdge = new ActivityEdge(sqlRepository, sqlRepository.GetConnectorByID(connector.ConnectorID));
                    oldEdge.loadTreeFromTaggedValue();
                    //rearrange target source to new statement node
                    connector.ClientID = sdmCallPattern.ElementID;
                    connector.Update();
                    EdgeGuard newGuard = oldEdge.GuardType;


                    oldEdge.GuardType = EdgeGuard.NONE;
                    oldEdge.saveTreeToEATaggedValue(true);

                    //create new stopnode for old outgoing edge from selected element
                    EA.Element newStopNode = newSdmContainer.Elements.AddNew("", Main.EAStateNodeType) as EA.Element;
                    newStopNode.Subtype = Main.EAStopNodeSubtype;
                    newStopNode.Update();

                    StopNode stopNode = new StopNode(sqlRepository, sqlRepository.GetElementByID(newStopNode.ElementID));
                    stopNode.saveTreeToEATaggedValue(true);

                    EA.DiagramObject stopNodeDiagramObject = newSdmDiagram.DiagramObjects.AddNew("", Main.EAStateNodeType) as EA.DiagramObject;
                    stopNodeDiagramObject.ElementID = newStopNode.ElementID;
                    stopNodeDiagramObject.top       = diagObjectBottom - 20;
                    stopNodeDiagramObject.bottom    = diagObjectBottom - 40;
                    stopNodeDiagramObject.left      = diagObjectLeft + 20;
                    stopNodeDiagramObject.right     = diagObjectLeft + 40;
                    stopNodeDiagramObject.Update();

                    EA.Connector newConnection = selectedElement.Connectors.AddNew("", Main.EAControlFlowType) as EA.Connector;
                    newConnection.SupplierID = newStopNode.ElementID;
                    newConnection.Update();

                    ActivityEdge newEdge = new ActivityEdge(sqlRepository, sqlRepository.GetConnectorByID(newConnection.ConnectorID));
                    newEdge.GuardType = newGuard;
                    newEdge.saveTreeToEATaggedValue(true);
                }
            }
        }