public EA.Parameter getOrCreateParameter(EA.Method parentMethod, MocaNode attributeNode) { String oldGuid = attributeNode.getAttributeOrCreate(Main.GuidStringName).Value; String result = repository.SQLQuery("select * from t_operationparams where ea_guid = '" + oldGuid + "'"); EA.Parameter rattribute = null; SQLParameter attribute = new SQLParameter(sqlRep, result); if (attribute.ParameterGUID == "") { rattribute = parentMethod.Parameters.AddNew(attributeNode.getAttributeOrCreate("name").Value, "") as EA.Parameter; rattribute.Update(); repository.Execute("update t_operationparams set ea_guid = '" + oldGuid + "' where ea_guid = '" + rattribute.ParameterGUID + "'"); parentMethod.Parameters.Refresh(); foreach (EA.Parameter parm in parentMethod.Parameters) { if (parm.ParameterGUID == oldGuid) { return(parm); } } } return(rattribute); }
public EA.Method getOrCreateMethod(SQLElement parentClass, MocaNode methodNode) { String oldGuid = methodNode.getAttributeOrCreate(Main.GuidStringName).Value; String name = methodNode.getAttributeOrCreate("name").Value; String returnType = methodNode.getAttributeOrCreate("returnType").Value; return(getOrCreateMethod(parentClass, oldGuid, name, returnType)); }
private void importActivityNode(SQLElement sdmContainer, MocaNode activityNodeNode) { EA.Element activityNodeElement = null; ActivityNode aNode = null; if (activityNodeNode.getAttributeOrCreate("type").Value == "start") { activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAStateNodeType, Main.EAStartNodeSubtype); aNode = new StartNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID)); } else if (activityNodeNode.getAttributeOrCreate("type").Value == "stop") { activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAStateNodeType, Main.EAStopNodeSubtype); aNode = new StopNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID)); } else if (activityNodeNode.getAttributeOrCreate("type").Value == "statement") { activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAActivityType); aNode = new StatementNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID)); } else if (activityNodeNode.getAttributeOrCreate("type").Value == "story") { activityNodeElement = MainImport.getInstance().EcoreImport.getOrCreateElement(sdmContainer, activityNodeNode, Main.EAActivityType); appendSdmDiagram(activityNodeElement.Name, activityNodeElement); aNode = new StoryNode(sqlRep, sqlRep.GetElementByID(activityNodeElement.ElementID)); } MocaNode outgoingEdgesNode = activityNodeNode.getChildNodeWithName(ActivityNode.OutgoingTransitionsNodeName); if (outgoingEdgesNode != null) { foreach (MocaNode outgoingEdgeNode in outgoingEdgesNode.Children) { MainImport.getInstance().ConnectorNodeToParent.Add(outgoingEdgeNode, activityNodeElement); } } MocaNode objectVariablesNode = activityNodeNode.getChildNodeWithName(StoryPattern.ObjectVariablesChildNodeName); if (objectVariablesNode != null) { foreach (MocaNode ovNode in objectVariablesNode.Children) { importObjectVariable(sqlRep.GetElementByID(activityNodeElement.ElementID), ovNode); } } aNode.deserializeFromMocaTree(activityNodeNode); MainImport.getInstance().ElementGuidToElement.Add(activityNodeElement.ElementGUID, activityNodeElement); MainImport.getInstance().OldGuidToNewGuid.Add(aNode.EaGuid, activityNodeElement.ElementGUID); MainImport.getInstance().MocaTaggableElements.Add(aNode); }
public EA.Package getOrCreatePackage(SQLPackage rootPackage, MocaNode packageNode) { String oldGuid = packageNode.getAttributeOrCreate(Main.GuidStringName).Value; EA.Package modelPackage = repository.GetPackageByGuid(oldGuid); if (modelPackage != null) { DeleteWithGuid(rootPackage, oldGuid); EA.Package parent = repository.GetPackageByID(modelPackage.ParentID); DeleteWithGuid(parent, oldGuid); } EA.Package rootPackageOriginal = rootPackage.getRealPackage(); String packageName = packageNode.getAttributeOrCreate(MetamodelHelper.MoflonCustomNameTaggedValueName).Value; if (packageName == "") { packageName = packageNode.getAttributeOrCreate("name").Value; } modelPackage = rootPackageOriginal.Packages.AddNew(packageName, "") as EA.Package; if (rootPackageOriginal.ParentID == 0) { modelPackage.Flags = "isModel=1;VICON=3;"; } modelPackage.Update(); // import nsUri setTagValueIfPossibleForPackage(MetamodelHelper.MoflonCustomNsUriTaggedValueName, packageNode, modelPackage); // import export setTagValueIfPossibleForPackage(MetamodelHelper.MoflonExportTaggedValueName, packageNode, modelPackage); // import pluginID setTagValueIfPossibleForPackage(MetamodelHelper.MoflonCustomPluginIDTaggedValueName, packageNode, modelPackage); // import prefix setTagValueIfPossibleForPackage(MetamodelHelper.MoflonCustomNsPrefixTaggedValueName, packageNode, modelPackage); // import validated setTagValueIfPossibleForPackage(MetamodelHelper.MoflonValidatedTaggedValueName, packageNode, modelPackage); // import name setTagValueIfPossibleForPackage(MetamodelHelper.MoflonCustomNameTaggedValueName, packageNode, modelPackage); repository.Execute("update t_package set ea_guid = '" + oldGuid + "' where ea_guid = '" + modelPackage.PackageGUID + "'"); repository.Execute("update t_object set ea_guid = '" + oldGuid + "' where ea_guid = '" + modelPackage.PackageGUID + "'"); modelPackage = repository.GetPackageByGuid(oldGuid); return(modelPackage); }
public EA.Attribute getOrCreateAttribute(SQLElement parentClass, MocaNode attributeNode) { String oldGuid = attributeNode.getAttributeOrCreate(Main.GuidStringName).Value; EA.Attribute attribute = repository.GetAttributeByGuid(oldGuid); if (attribute == null) { attribute = parentClass.getRealElement().Attributes.AddNew(attributeNode.getAttributeOrCreate("name").Value, "") as EA.Attribute; attribute.Update(); repository.Execute("update t_attribute set ea_guid = '" + oldGuid + "' where ea_guid = '" + attribute.AttributeGUID + "'"); attribute = repository.GetAttributeByGuid(oldGuid); } return(attribute); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { this.MethodGuid = actNode.getAttributeOrCreate("methodGuid").Value; this.MethodNameOld = actNode.getAttributeOrCreate("methodName").Value; this.MethodReturnType = actNode.getAttributeOrCreate("methodReturnType").Value; SQLMethod mt = Repository.GetMethodByGuid(this.MethodGuid); if (mt != null) { this.MethodName = mt.Name; } else { this.MethodName = MethodNameOld; } MocaNode targetNode = actNode.getChildNodeWithName("target"); this.Target = Expression.createExpression(targetNode.getAttributeOrCreate("type").Value, Repository); this.Target.deserializeFromMocaTree(targetNode); foreach (MocaNode childNode in actNode.Children) { if (childNode.Name == "ownedParameterBinding") { ParameterBinding paramBinding = new ParameterBinding(Repository); paramBinding.deserializeFromMocaTree(childNode); this.OwnedParameterBinding.Add(paramBinding); } } }
public SQLMethod findMethodFromMocaNode(SQLElement parent, MocaNode methodNode) { SQLMethod found = null; foreach (SQLMethod method in parent.Methods) { int validCount = 0; if (method.Name == methodNode.getAttributeOrCreate("name").Value) { foreach (SQLParameter param in method.Parameters) { foreach (MocaNode paramNode in methodNode.getChildNodeWithName(EOperation.ParametersChildNodeName).Children) { if (paramNode.getAttributeOrCreate("name").Value == param.Name) { validCount++; } } } if (validCount == method.Parameters.Count && validCount == methodNode.getChildNodeWithName(EOperation.ParametersChildNodeName).Children.Count) { found = method; } } } return(found); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { MocaNode constExpNode = actNode.getChildNodeWithName("constraintExpression"); this.ConstraintExpression = Expression.createExpression(constExpNode.getAttributeOrCreate("type").Value, Repository) as ComparisonExpression; this.ConstraintExpression.deserializeFromMocaTree(constExpNode); }
private void processTggRule(SQLElement ruleClass) { //this.exportProgressBar.invokePerformNext("exporting EClass: " + eaClass.Name); SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(ruleClass, Main.MoflonExportTreeTaggedValueName); TGGRule tggRule = new TGGRule(repository, ruleClass); tggRule.loadTreeFromTaggedValue(); MocaNode tggRuleMocaNode = new MocaNode(); tggRuleMocaNode.deserializeFromXmlTree(MocaTreeUtil.stringToXmlDocument(mocaTreeTag.Notes).DocumentElement.FirstChild as XmlElement); this.currentNode.appendChildNode(tggRuleMocaNode); tggRule.additionalAttributesDuringExport(tggRuleMocaNode); foreach (SQLElement element in ruleClass.Elements) { //handle tgg rule pattern if (element.Stereotype == TGGModelingMain.TggObjectVariableStereotype || element.Stereotype == TGGModelingMain.TggCorrespondenceStereotype) { this.currentNode = tggRuleMocaNode.getChildNodeWithName(StoryPattern.ObjectVariablesChildNodeName); processTggObjectVariable(element); } //handle sdms of tgg rule class else if (element.Stereotype == SDMModelingMain.SdmContainerStereotype) { String associatedMethodguid = EAEcoreAddin.Util.EAUtil.findTaggedValue(element, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName).Value; MocaNode operationsNode = tggRuleMocaNode.getChildNodeWithName(EClass.OperationsChildNodeName); MocaNode owningOperationNode = null; foreach (MocaNode EOperationNode in operationsNode.Children) { MocaAttribute guidAttribute = EOperationNode.getAttributeOrCreate(Main.GuidStringName); if (guidAttribute != null && guidAttribute.Value == associatedMethodguid) { owningOperationNode = EOperationNode; } } if (owningOperationNode != null) { MocaNode sdmActivityNode = this.ExportMain.ecoreExport.sdmExport.processActivity(element); owningOperationNode.appendChildNode(sdmActivityNode); } } else if (element.Stereotype == TGGModelingMain.CSPConstraintStereotype || element.Stereotype == "TGGCsp") { MocaNode cspsNode = tggRuleMocaNode.getChildNodeWithName(TGGRule.CspsChildNodeName); if (cspsNode == null) { cspsNode = tggRuleMocaNode.appendChildNode(TGGRule.CspsChildNodeName); } this.currentNode = cspsNode; processTGGCSP(element); tggRuleMocaNode.getAttributeOrCreate(TGGRule.CspSpecAttributeName).Value += element.Notes.Replace(Environment.NewLine, ""); } } }
public EA.Element getOrCreateElement(SQLPackage parentPackage, MocaNode elementNode, String elementType) { String oldGuid = elementNode.getAttributeOrCreate(Main.GuidStringName).Value; EA.Element eclassElem = repository.GetElementByGuid(oldGuid); if (eclassElem == null) { EA.Package parentPackageOrig = parentPackage.getRealPackage(); eclassElem = parentPackageOrig.Elements.AddNew(elementNode.getAttributeOrCreate("name").Value, elementType) as EA.Element; eclassElem.Update(); if (oldGuid != "") { repository.Execute("update t_object set ea_guid = '" + oldGuid + "' where ea_guid = '" + eclassElem.ElementGUID + "'"); eclassElem = repository.GetElementByGuid(oldGuid); } } return(eclassElem); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { MocaNode valueExpressionNode = actNode.getChildNodeWithName("valueExpression"); this.ValueExpression = Expression.createExpression(valueExpressionNode.getAttributeOrCreate("type").Value, Repository); this.ValueExpression.deserializeFromMocaTree(valueExpressionNode); this.ParameterGuid = actNode.getAttributeOrCreate("parameterGuid").Value; this.ParameterType = actNode.getAttributeOrCreate("parameterType").Value; }
private void addCheckbox(MocaNode node) { int count = groupBoxCheckboxes.Controls.Count; CheckBox newBox = new CheckBox(); newBox.Checked = true; newBox.Location = new Point(9, 19 + count * 23); newBox.Width = groupBoxCheckboxes.Width; String name = node.getAttributeOrCreate("name").Value; if (name == "") { name = node.getAttributeOrCreate("Moflon::Name").Value; } newBox.Text = node.Name + ": " + name; newBox.Enabled = false; groupBoxCheckboxes.Controls.Add(newBox); }
public void additionalAttributesDuringExport(MocaNode currentNode) { currentNode.getAttributeOrCreate(TGGRule.CspSpecAttributeName).Value = ""; String refinesString = computeRefinementString(); currentNode.appendChildAttribute("refines", refinesString); String kernelString = computeKernelString(); currentNode.appendChildAttribute("kernel", kernelString); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { this.Operator = (ComparingOperator)Enum.Parse(typeof(ComparingOperator), actNode.getAttributeOrCreate("operator").Value.ToUpper()); MocaNode leftNode = actNode.getChildNodeWithName("leftExpression"); this.LeftExpression = Expression.createExpression(leftNode.getAttributeOrCreate("type").Value, Repository); this.LeftExpression.deserializeFromMocaTree(leftNode); MocaNode rightNode = actNode.getChildNodeWithName("rightExpression"); this.RightExpression = Expression.createExpression(rightNode.getAttributeOrCreate("type").Value, Repository); this.RightExpression.deserializeFromMocaTree(rightNode); }
public EA.Element getOrCreateElement(SQLElement parentElement, MocaNode elementNode, String elementType, int subtype) { String oldGuid = elementNode.getAttributeOrCreate(Main.GuidStringName).Value; EA.Element eclassElem = repository.GetElementByGuid(oldGuid); if (eclassElem == null) { eclassElem = parentElement.getRealElement().Elements.AddNew(elementNode.getAttributeOrCreate("name").Value, elementType) as EA.Element; if (subtype != int.MinValue) { eclassElem.Subtype = subtype; } eclassElem.Update(); if (oldGuid != "") { repository.Execute("update t_object set ea_guid = '" + oldGuid + "' where ea_guid = '" + eclassElem.ElementGUID + "'"); eclassElem = repository.GetElementByGuid(oldGuid); } } return(eclassElem); }
public void importActivityEdge(SQLElement activityNodeElement, MocaNode activityEdgeNode) { String targetgGuid = MainImport.getInstance().OldGuidToNewGuid[activityEdgeNode.getAttributeOrCreate("targetGuid").Value]; EA.Element targetElement = MainImport.getInstance().ElementGuidToElement[targetgGuid]; EA.Connector activityEdgeConnector = MainImport.getInstance().EcoreImport.getOrCreateConnector(activityNodeElement, sqlRep.GetElementByID(targetElement.ElementID), activityEdgeNode.getAttributeOrCreate(Main.GuidStringName).Value, Main.EAControlFlowType); ActivityEdge actEdge = new ActivityEdge(sqlRep, sqlRep.GetConnectorByID(activityEdgeConnector.ConnectorID)); actEdge.deserializeFromMocaTree(activityEdgeNode); MainImport.getInstance().MocaTaggableElements.Add(actEdge); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { base.deserializeFromMocaTree(actNode); MocaNode statement = actNode.getChildNodeWithName("statementExpression"); if (statement != null) { MocaAttribute typeAttribute = statement.getAttributeOrCreate("type"); if (typeAttribute != null) { this.StatementExpression = Expression.createExpression(typeAttribute.Value, this.Repository); this.StatementExpression.deserializeFromMocaTree(statement); } } }
public EClass importEClass(SQLPackage parentPackage, MocaNode eClassNode) { EA.Element eclassElem = getOrCreateElement(parentPackage, eClassNode, "Class"); MocaAttribute isAbstract = eClassNode.getAttributeOrCreate("isAbstract"); if (isAbstract.Value == "true") { eclassElem.Abstract = "1"; } else { eclassElem.Abstract = "0"; } eclassElem.Update(); return(importEClassFeatures(eClassNode, sqlRep.GetElementByID(eclassElem.ElementID))); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { setOvName(actNode); setOvGuid(actNode); this.AttributeGUID = actNode.getAttributeOrCreate("attributeGuid").Value; this.AttributeNameOld = actNode.getAttributeOrCreate("attributeName").Value; this.AttributeName = this.AttributeNameOld; MocaNode valueExpressionNode = actNode.getChildNodeWithName("valueExpression"); this.ValueExpression = Expression.createExpression(valueExpressionNode.getAttributeOrCreate("type").Value, Repository); this.ValueExpression.deserializeFromMocaTree(valueExpressionNode); SQLAttribute attribute = Repository.GetAttributeByGuid(this.AttributeGUID); if (attribute != null) { this.AttributeName = attribute.Name; } }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { base.deserializeFromMocaTree(actNode); MocaNode returnValueNode = actNode.getChildNodeWithName("returnValue"); if (returnValueNode != null) { MocaAttribute typeAttribute = returnValueNode.getAttributeOrCreate("type"); Expression returnValueExpression = Expression.createExpression(typeAttribute.Value, this.Repository); if (returnValueExpression != null) { returnValueExpression.deserializeFromMocaTree(returnValueNode); } else { } this.ReturnValue = returnValueExpression; } }
protected virtual void setOvName(MocaNode actNode) { MocaNode tempNode = actNode.Parent; if (tempNode != null) { while (tempNode != null && tempNode.Name != typeof(ObjectVariable).Name && tempNode.Name != typeof(TGGObjectVariable).Name && tempNode.Name != typeof(TGGCorrespondence).Name) { tempNode = tempNode.Parent; } if (tempNode != null) { MocaAttribute nameAttr = tempNode.getAttributeOrCreate("name"); if (nameAttr != null) { this.OvName = nameAttr.Value; } } } }
private void setOvGuid(MocaNode actNode) { MocaNode tempNode = actNode.Parent; if (tempNode != null) { while (tempNode != null && tempNode.Name != typeof(ObjectVariable).Name && tempNode.Name != typeof(TGGObjectVariable).Name && tempNode.Name != typeof(TGGCorrespondence).Name) { tempNode = tempNode.Parent; } if (tempNode != null) { MocaAttribute guidAttr = tempNode.getAttributeOrCreate(Main.GuidStringName); if (guidAttr != null) { this.OvGuid = guidAttr.Value; } } } }
public LinkVariable importLinkVariable(SQLElement ovElement, MocaNode lvNode) { String oldTargetGuid = lvNode.getAttributeOrCreate("targetGuid").Value; String newTargetGuid = MainImport.getInstance().OldGuidToNewGuid[oldTargetGuid]; EA.Element targetElement = MainImport.getInstance().ElementGuidToElement[newTargetGuid]; EA.Connector newLinkConnector = MainImport.getInstance().EcoreImport.getOrCreateConnector(ovElement, sqlRep.GetElementByID(targetElement.ElementID), lvNode.getAttributeOrCreate(Main.GuidStringName).Value, Main.EAAssociationType); LinkVariable lv = new LinkVariable(sqlRep.GetConnectorByID(newLinkConnector.ConnectorID), sqlRep); lv.deserializeFromMocaTree(lvNode); if (lv.linkDialogueEntry.clientRoleName != "" && lv.linkDialogueEntry.supplierRoleName != "") { lv.linkDialogueEntry.direction = LinkDialogueEntryDirection.BI; } MainImport.getInstance().MocaTaggableElements.Add(lv); return(lv); }
public EA.Package findOrCreateRoot(MocaNode ePackageNode) { EA.Package rootPackage = null; String workingSetName = ePackageNode.getAttributeOrCreate(MetamodelHelper.MoflonWorkingSetTaggedValueName).Value; if (workingSetName == "") { if (repository.Models.Count > 0) { rootPackage = repository.Models.GetAt(0) as EA.Package; } } else { foreach (EA.Package root in repository.Models) { if (root.Name == workingSetName) { rootPackage = root; } } } if (rootPackage == null) { String rootName = workingSetName; if (rootName == "") { rootName = "My Working Set"; } rootPackage = repository.Models.AddNew(rootName, "") as EA.Package; rootPackage.Update(); repository.Models.Refresh(); } return(rootPackage); }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode) { this.Constraints.Clear(); this.AttributeAssignments.Clear(); this.BindingSemantics = SDMUtil.computeBindingSemantics(actNode.getAttributeOrCreate(ObjectVariable.BindingSemanticsTaggedValueName).Value.ToUpper()); this.BindingOperator = SDMUtil.computeBindingOperator(actNode.getAttributeOrCreate(ObjectVariable.BindingOperatorTaggedValueName).Value.ToUpper()); if (actNode.getAttributeOrCreate(NacIndexTaggedValueName).Value != "") { NacIndex = int.Parse(actNode.getAttributeOrCreate(NacIndexTaggedValueName).Value); } this.BindingState = SDMUtil.computeBindingState(actNode.getAttributeOrCreate(ObjectVariable.BindingStateTaggedValueName).Value.ToUpper()); this.Guid = actNode.getAttributeOrCreate(Main.GuidStringName).Value; this.TypeGuid = actNode.getAttributeOrCreate("typeGuid").Value; MocaNode assignmentsNode = actNode.getChildNodeWithName("attributeAssignments"); MocaNode constraintsNode = actNode.getChildNodeWithName("constraints"); MocaNode bindingExpressionNode = actNode.getChildNodeWithName("bindingExpression"); if (bindingExpressionNode != null) { this.BindingExpression = Expression.createExpression(bindingExpressionNode.getAttributeOrCreate("type").Value, Repository); this.BindingExpression.deserializeFromMocaTree(bindingExpressionNode); } foreach (MocaNode constraints in constraintsNode.Children) { Constraint constraint = new Constraint(Repository); constraint.deserializeFromMocaTree(constraints); this.Constraints.Add(constraint); } foreach (MocaNode assignments in assignmentsNode.Children) { AttributeAssignment atAs = new AttributeAssignment(Repository); atAs.deserializeFromMocaTree(assignments); this.AttributeAssignments.Add(atAs); } }
public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode referencesNode) { MocaNode ereferenceNode = referencesNode; ereferenceNode = extractFromReferencesNode(ereferenceNode); //alternative way if (ereferenceNode == null || ereferenceNode.Name != "EReference") { if (ConnectorEnd.End == "Client") { ereferenceNode = referencesNode.getChildNodeWithName("ClientReference"); } else if (ConnectorEnd.End == "Supplier") { ereferenceNode = referencesNode.getChildNodeWithName("SupplierReference"); } if (ereferenceNode != null) { ereferenceNode = ereferenceNode.getChildNodeWithName("EReference"); } } if (ereferenceNode != null) { this.Navigable = true; MocaAttribute typeAttr = ereferenceNode.getAttributeOrCreate("typeGuid"); if (typeAttr != null) { this.typeGUID = typeAttr.Value; } MocaAttribute nameAttr = ereferenceNode.getAttributeOrCreate("name"); if (nameAttr != null) { this.Name = nameAttr.Value; } MocaAttribute guidAttr = ereferenceNode.getAttributeOrCreate(Main.GuidStringName); if (guidAttr != null) { this.refGUID = guidAttr.Value; } MocaAttribute lbAttr = ereferenceNode.getAttributeOrCreate("lowerBound"); if (lbAttr != null) { this.lowerBound = lbAttr.Value; } MocaAttribute ubAttr = ereferenceNode.getAttributeOrCreate("upperBound"); if (ubAttr != null) { this.upperBound = ubAttr.Value; } MocaAttribute cont = ereferenceNode.getAttribute("containment"); if (cont != null) { this.containment = cont.Value == "true"; } MocaAttribute oppo = ereferenceNode.getAttributeOrCreate("oppositeGuid"); if (oppo != null) { this.oppositeGUID = oppo.Value; } } }
public override void deserializeFromMocaTree(MocaNode actNode) { this.attributeType = actNode.getAttributeOrCreate("type").Value; this.typeGuid = actNode.getAttributeOrCreate("typeGuid").Value; this.Name = actNode.getAttributeOrCreate("name").Value; this.guid = actNode.getAttributeOrCreate(Main.GuidStringName).Value; this.lowerBound = actNode.getAttributeOrCreate("lowerBound").Value; this.upperBound = actNode.getAttributeOrCreate("upperBound").Value; this.ordered = actNode.getAttributeOrCreate("ordered").Value; this.isId = actNode.getAttributeOrCreate("isId").Value != "" ? actNode.getAttributeOrCreate("isId").Value : "false"; this.isDerived = actNode.getAttributeOrCreate("isDerived").Value != "" ? actNode.getAttributeOrCreate("isDerived").Value : "false"; MocaAttribute defAttr = actNode.getAttributeOrCreate("defaultLiteralValue"); if (defAttr != null) { this.defaultString = defAttr.Value; } }
public MocaNode processEClass(SQLElement eaClass) { //this.exportProgressBar.invokePerformNext("Exporting EClass: " + eaClass.Name); SQLTaggedValue changesTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaClass, Main.MoflonChangesTreeTaggedValueName); SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaClass, Main.MoflonExportTreeTaggedValueName); if (mocaTreeTag != null) { EClass eClass = new EClass(eaClass, repository); eClass.loadTreeFromTaggedValue(); MocaNode eClassMocaNode = MocaTreeUtil.mocaNodeFromXmlString(mocaTreeTag.Notes); eClass.addMocaAttributesDuringExport(eClassMocaNode); if (changesTreeTag != null) { MocaNode eClassChangesNode = MocaTreeUtil.mocaNodeFromXmlString(changesTreeTag.Notes); eClass.addMocaAttributesDuringExport(eClassChangesNode); } //add baseclass dependencies foreach (var baseClass in eClassMocaNode.getAttributeOrCreate("baseClasses").Value.Split(" ".ToArray())) { if (baseClass != "") { SQLElement baseclass = repository.GetElementByGuid(baseClass); Export.computeAndAddToDependencies(repository, baseclass); } } this.currentNode.appendChildNode(eClassMocaNode); //process SDM Container Objects int counter = 0; foreach (SQLElement possibleSDMContainer in eaClass.Elements) { if (possibleSDMContainer.Stereotype == SDMModelingMain.SdmContainerStereotype || possibleSDMContainer.Stereotype == "SDM_Container") { String associatedMethodguid = EAEcoreAddin.Util.EAUtil.findTaggedValue(possibleSDMContainer, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName).Value; MocaNode operationsNode = eClassMocaNode.getChildNodeWithName(EClass.OperationsChildNodeName); MocaNode owningOperationNode = null; if (!Export.showStatusBar) { Console.Out.WriteLine("SCALE:Export SDM '" + possibleSDMContainer.Name + "' %" + counter + "/" + eaClass.Elements.Count + "#"); } counter++; foreach (MocaNode EOperationNode in operationsNode.Children) { MocaAttribute guidAttribute = EOperationNode.getAttributeOrCreate(Main.GuidStringName); if (guidAttribute != null && guidAttribute.Value == associatedMethodguid) { owningOperationNode = EOperationNode; } } if (owningOperationNode != null) { MocaNode sdmActivityNode = this.sdmExport.processActivity(possibleSDMContainer); owningOperationNode.appendChildNode(sdmActivityNode); } } } foreach (SQLAttribute element in eaClass.Attributes) { string t = element.Type; int cid = element.ClassifierID; SQLElement typeElement = repository.GetElementByIDNullable(cid); Export.computeAndAddToDependencies(repository, typeElement); } counter = 0; foreach (SQLConnector ereference in eaClass.Connectors) { if (ereference.Type == Main.EAAssociationType) { if (!Export.showStatusBar) { Console.Out.WriteLine("SCALE:Export EReference '" + ereference.Name + "' %" + counter + "/" + eaClass.Connectors.Count + "#"); } counter++; MocaNode referencesNode = eClassMocaNode.getChildNodeWithName(EClass.ReferencesChildNodeName); if (ereference.ClientID != eaClass.ElementID && ereference.ClientEnd.IsNavigable) { this.currentNode = referencesNode; processEReference(ereference, ereference.ClientEnd.End); } else if (ereference.SupplierID != eaClass.ElementID && ereference.SupplierEnd.IsNavigable) { this.currentNode = referencesNode; processEReference(ereference, ereference.SupplierEnd.End); } if (ereference.SupplierID == eaClass.ElementID && ereference.ClientID == eaClass.ElementID && ereference.SupplierEnd.IsNavigable) { this.currentNode = referencesNode; processEReference(ereference, ereference.SupplierEnd.End); } if (ereference.SupplierID == eaClass.ElementID && ereference.ClientID == eaClass.ElementID && ereference.ClientEnd.IsNavigable) { this.currentNode = referencesNode; processEReference(ereference, ereference.ClientEnd.End); } } } return(eClassMocaNode); } return(null); }
public EClass importEClassFeatures(MocaNode eClassNode, SQLElement eclassElem) { MocaNode operationsNode = eClassNode.getChildNodeWithName(EClass.OperationsChildNodeName); MocaNode attributesNode = eClassNode.getChildNodeWithName(EClass.AttributesChildNodeName); MocaNode refsNode = eClassNode.getChildNodeWithName(EClass.ReferencesChildNodeName); foreach (MocaNode eOpNode in operationsNode.Children) { EA.Method eaMethod = getOrCreateMethod(eclassElem, eOpNode); foreach (MocaNode eParamNode in eOpNode.getChildNodeWithName(EOperation.ParametersChildNodeName).Children) { if (eParamNode.Name == "EParameter") { EA.Parameter eaParam = getOrCreateParameter(eaMethod, eParamNode); } } eaMethod.Parameters.Refresh(); MocaNode sdmActivityNode = eOpNode.getChildNodeWithName("Activity"); if (sdmActivityNode != null) { MainImport.getInstance().SdmImport.importSDMActivity(eclassElem, sqlRep.GetMethodByID(eaMethod.MethodID), sdmActivityNode); } } foreach (MocaNode eAttrNode in attributesNode.Children) { EA.Attribute eAttribute = getOrCreateAttribute(eclassElem, eAttrNode);; eAttribute.Update(); } if (refsNode.Children.Count != 0) { MainImport.getInstance().ConnectorNodeToParent.Add(refsNode, eclassElem.getRealElement()); } eclassElem.Attributes.Refresh(); eclassElem.Methods.Refresh(); EClass eclass = new EClass(sqlRep.GetElementByID(eclassElem.ElementID), sqlRep); eclass.deserializeFromMocaTree(eClassNode); foreach (EAttribute eattr in eclass.EAttributes) { if (eattr.typeGuid != "") { MainImport.getInstance().ObjectToTypeGuid.Add(eattr.EaAttribute.getRealAttribute(), eattr.typeGuid); } MainImport.getInstance().OldGuidToNewGuid.Add(eattr.guid, eattr.EaAttribute.AttributeGUID); } foreach (EOperation eOp in eclass.EOperations) { if (eOp.typeGuid != "") { MainImport.getInstance().ObjectToTypeGuid.Add(eOp.EaMethod.getRealMethod(), eOp.typeGuid); } MainImport.getInstance().OldGuidToNewGuid.Add(eOp.guid, eOp.EaMethod.MethodGUID); foreach (EParameter eParam in eOp.EParameters) { if (eParam.typeGuid != "") { MainImport.getInstance().ObjectToTypeGuid.Add(eParam.EaParameter.getRealParameter(), eParam.typeGuid); } MainImport.getInstance().OldGuidToNewGuid.Add(eParam.Guid, eParam.EaParameter.ParameterGUID); } } if (eClassNode.getAttributeOrCreate("baseClasses").Value != "") { MainImport.getInstance().ElementToBaseClassGuids.Add(eclassElem.getRealElement(), eClassNode.getAttributeOrCreate("baseClasses").Value); } MainImport.getInstance().ElementGuidToElement.Add(eclassElem.ElementGUID, eclassElem.getRealElement()); MainImport.getInstance().MocaTaggableElements.Add(eclass); MainImport.getInstance().OldGuidToNewGuid.Add(eclass.Guid, eclassElem.ElementGUID); return(eclass); }
public override void deserializeFromMocaTree(MocaNode actNode) { base.deserializeFromMocaTree(actNode); this.domain = TGGModelingUtil.stringToDomainType(actNode.getAttributeOrCreate("domain").Value); this.metamodelGuid = actNode.getAttributeOrCreate("metamodelGuid").Value; }