Ejemplo n.º 1
0
        private bool tryOldDeserialize(Serialization.MocaTree.MocaNode actNode)
        {
            MocaNode adornmentsNode           = actNode.getChildNodeWithName("allowedAddornments");
            MocaNode modelgenAdornmentsNode   = actNode.getChildNodeWithName("modelgenAdornments");
            MocaNode parameterInformationNode = actNode.getChildNodeWithName("parameterInformation");
            MocaNode parameterTypesNode       = actNode.getChildNodeWithName("parameterTypes");

            addNodeChildrenToList(adornmentsNode, adornments);
            addNodeChildrenToList(modelgenAdornmentsNode, modelgenAdornments);
            addNodeChildrenToList(parameterInformationNode, SignatureInformation);
            addNodeChildrenToList(parameterTypesNode, Signature);


            this.informationText = actNode.getAttributeOrCreate("constraintInformation").Value;
            if (this.informationText.Contains("\r\n"))
            {
                String[] splitted = this.informationText.Split("\r\n".ToCharArray());
                this.informationText = splitted[splitted.Length - 1];
            }
            this.UserDefined = actNode.getAttributeOrCreate("userDefined").Value == "true";
            this.Name        = actNode.getAttributeOrCreate("name").Value;
            MocaAttribute indexAttr = actNode.getAttributeOrCreate("index");

            if (indexAttr.Value != "")
            {
                this.Index = int.Parse(indexAttr.Value);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            base.deserializeFromMocaTree(actNode);

            MocaNode domainsNode    = actNode.getChildNodeWithName("domains");
            MocaNode metamodelsNode = actNode.getChildNodeWithName("metamodels");

            Name = EaPackage.Name;

            if (metamodelsNode != null)
            {
                foreach (MocaNode mmNode in metamodelsNode.Children)
                {
                    Metamodel mm = new Metamodel();
                    mm.deserializeFromMocaTree(mmNode);
                    this.Metamodels.Add(mm);
                }
            }

            if (domainsNode != null)
            {
                foreach (MocaNode dNode in domainsNode.Children)
                {
                    Domain mm = new Domain();
                    mm.deserializeFromMocaTree(dNode);
                    this.Domains.Add(mm);
                }
            }

            loadCSPConstraints(actNode);
        }
Ejemplo n.º 3
0
        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 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);
                }
            }
        }
Ejemplo n.º 5
0
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            MocaAttribute guidAttr     = actNode.getAttributeOrCreate(Main.GuidStringName);
            MocaAttribute typeGuidAttr = actNode.getAttributeOrCreate("typeGuid");

            this.typeGuid   = typeGuidAttr.Value;
            this.guid       = actNode.getAttributeOrCreate(Main.GuidStringName).Value;
            this.returnType = actNode.getAttributeOrCreate("returnType").Value;
            this.Name       = actNode.getAttributeOrCreate("name").Value;
            MocaNode parametersNode = actNode.getChildNodeWithName(EOperation.ParametersChildNodeName);

            foreach (MocaNode eParamNode in parametersNode.Children)
            {
                if (eParamNode.Name == "EParameter")
                {
                    foreach (SQLParameter neededParam in this.EaMethod.Parameters)
                    {
                        if (neededParam.Name == eParamNode.getAttributeOrCreate("name").Value)
                        {
                            EParameter eParam = new EParameter(neededParam, Repository);
                            eParam.deserializeFromMocaTree(eParamNode);
                            this.EParameters.Add(eParam);
                        }
                    }
                }
            }

            //only for import purposes
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        public override void  deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            constraintName = actNode.getAttributeOrCreate("constraintName").Value;

            foreach (MocaNode exprNode in actNode.getChildNodeWithName("expressions").Children)
            {
                Expression expression = Expression.createExpression(exprNode.getAttributeOrCreate("type").Value, Repository);
                expression.deserializeFromMocaTree(exprNode);
                typedInExpressions.Add(expression);
            }
        }
Ejemplo n.º 9
0
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            //for old moca trees
            tryOldDeserialize(actNode);

            MocaNode adornmentsNode           = actNode.getChildNodeWithName(allowedAdornmentsNodeName);
            MocaNode modelgenAdornmentsNode   = actNode.getChildNodeWithName(modelgenAdornmentsNodeName);
            MocaNode signatureNode            = actNode.getChildNodeWithName(signatureNodeName);
            MocaNode signatureInformationNode = actNode.getChildNodeWithName(signatureInformationNodeName);

            addNodeChildrenToList(adornmentsNode, adornments);
            addNodeChildrenToList(modelgenAdornmentsNode, modelgenAdornments);
            addNodeChildrenToList(signatureNode, Signature);
            addNodeChildrenToList(signatureInformationNode, SignatureInformation);

            String infoValue = actNode.getAttributeOrCreate(informationTextNodeName).Value;

            if (infoValue != "")
            {
                this.informationText = infoValue;
            }

            String userDefinedValue = actNode.getAttributeOrCreate(userDefinedNodeName).Value;

            if (userDefinedValue != "")
            {
                this.UserDefined = userDefinedValue == "true";
            }
            if (actNode.Name != "CSPConstraint")
            {
                this.Name = actNode.Name;
            }
            MocaAttribute indexAttr = actNode.getAttributeOrCreate(indexNodeName);

            if (indexAttr.Value != "")
            {
                this.Index = int.Parse(indexAttr.Value);
            }
        }
Ejemplo n.º 10
0
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            MocaNode entriesNode = actNode.getChildNodeWithName("entries");

            if (entriesNode != null)
            {
                foreach (MocaNode entryNode in entriesNode.Children)
                {
                    CSPInstanceEntry entry = new CSPInstanceEntry(Repository);
                    entry.deserializeFromMocaTree(entryNode);
                    createdEntries.Add(entry);
                }
            }
        }
Ejemplo n.º 11
0
        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);
            }
        }
Ejemplo n.º 12
0
        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);
                }
            }
        }
Ejemplo n.º 13
0
        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;
            }
        }
Ejemplo n.º 14
0
        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;
            }
        }
Ejemplo n.º 15
0
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            this.Name = actNode.getAttributeOrCreate("name").Value;
            this.Guid = actNode.getAttributeOrCreate(Main.GuidStringName).Value;
            MocaNode literalsNode = actNode.getChildNodeWithName("literals");

            foreach (MocaNode literalNode in literalsNode.Children)
            {
                foreach (SQLAttribute litAttr in this.eaEEnumElement.Attributes)
                {
                    if (litAttr.Name == literalNode.getAttributeOrCreate("name").Value)
                    {
                        EEnumLiteral eenumLit = new EEnumLiteral(litAttr, Repository);
                        eenumLit.deserializeFromMocaTree(literalNode);
                        removeExisting(litAttr.Name);
                        this.Literals.Add(eenumLit);
                    }
                }
            }
        }
Ejemplo n.º 16
0
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            MocaNode      operationsNode  = actNode.getChildNodeWithName(EClass.OperationsChildNodeName);
            MocaNode      attributesNode  = actNode.getChildNodeWithName(EClass.AttributesChildNodeName);
            MocaAttribute guidAttr        = actNode.getAttributeOrCreate(Main.GuidStringName);
            MocaAttribute nameAttr        = actNode.getAttributeOrCreate("name");
            MocaAttribute aliasAttr       = actNode.getAttributeOrCreate("alias");
            MocaAttribute isAbstractAttr  = actNode.getAttributeOrCreate("isAbstract");
            MocaAttribute isInterfaceAttr = actNode.getAttributeOrCreate("isInterface");

            if (nameAttr != null)
            {
                this.Name = nameAttr.Value;
            }
            if (guidAttr != null)
            {
                this.Guid = guidAttr.Value;
            }
            if (aliasAttr != null)
            {
                this.Alias = aliasAttr.Value;
            }
            if (isAbstractAttr.Value != "")
            {
                if (bool.TryParse(isAbstractAttr.Value, out this.isAbstract))
                {
                }
                else
                {
                    int value = 0;
                    if (int.TryParse(isAbstractAttr.Value, out value))
                    {
                        this.isAbstract = value == 1;
                    }
                }
            }
            if (isInterfaceAttr.Value != "")
            {
                this.isInterface = Boolean.Parse(isInterfaceAttr.Value);
            }

            foreach (MocaNode eOpNode in operationsNode.Children)
            {
                SQLMethod method = findMethodFromMocaNode(this.EaElement, eOpNode);
                if (method != null)
                {
                    EOperation actEOperation = new EOperation(method, Repository);
                    actEOperation.deserializeFromMocaTree(eOpNode);
                    this.EOperations.Add(actEOperation);
                }
            }
            foreach (MocaNode eAttrNode in attributesNode.Children)
            {
                foreach (SQLAttribute attr in this.EaElement.Attributes)
                {
                    if (attr.Name == eAttrNode.getAttributeOrCreate("name").Value)
                    {
                        EAttribute eAttr = new EAttribute(attr, Repository);
                        eAttr.deserializeFromMocaTree(eAttrNode);
                        this.EAttributes.Add(eAttr);
                    }
                }
            }
            isInitialized = true;
        }
Ejemplo n.º 17
0
        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;
                }
            }
        }