From: Benjamin B. <bg...@us...> - 2005-04-08 09:12:03
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32031/Plugin/com/ibm/ecute/plugins/output/funcionality Modified Files: CMPIProviderGenerator.java RoseREI.java RSAModelCreator.java mofCreator.java Log Message: [ 1179045 ] Various issues in eCute4RSA Index: RSAModelCreator.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/RSAModelCreator.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- RSAModelCreator.java 30 Mar 2005 07:37:33 -0000 1.9 +++ RSAModelCreator.java 8 Apr 2005 09:11:16 -0000 1.10 @@ -17,10 +17,12 @@ import org.eclipse.uml2.Class; import org.eclipse.uml2.Classifier; import org.eclipse.uml2.Comment; +//import org.eclipse.uml2.Constraint; import org.eclipse.uml2.Element; import org.eclipse.uml2.Generalization; import org.eclipse.uml2.Model; import org.eclipse.uml2.MultiplicityElement; +//import org.eclipse.uml2.OpaqueExpression; import org.eclipse.uml2.Operation; import org.eclipse.uml2.Package; import org.eclipse.uml2.PackageableElement; @@ -311,8 +313,8 @@ return OK; } - public void AddAtribute(String dataType, String name, String defaultValue){ - //System.out.println("AddAtribute: " + name); + public void AddAttribute(String dataType, String name, String defaultValue){ + //System.out.println("AddAttribute: " + name); if (defaultValue == null) defaultValue = ""; @@ -549,8 +551,8 @@ while (it.hasNext()){ Diagram diagram = (Diagram) it.next(); if(layout){ - if(!diagram.getChildren().isEmpty()) - diagramHelper.layoutNodes(diagram.getChildren(), ILayoutNodesProvider.DEFAULT_LAYOUT); + if(!diagram.getChildren().isEmpty()) + diagramHelper.layoutNodes(diagram.getChildren(), ILayoutNodesProvider.DEFAULT_LAYOUT); } if(diagram.getName().equalsIgnoreCase("main")){ diagramHelper.setMainDiagram(package_, diagram); @@ -597,6 +599,7 @@ } Generalization generalization = specificClassifier.createGeneralization(generalClassifier); + generalization.setIsSubstitutable(true); //System.out.println("Generalization " + specificClassifier.getQualifiedName() + " ->> " // + generalClassifier.getQualifiedName() + " created."); @@ -630,10 +633,118 @@ if(type == TCLASS){ if(name.equalsIgnoreCase("Composition")&& !value.equalsIgnoreCase("false")){ - lastClassComposition = true; + lastClassComposition = true; + } + /* + // create OCL class constraint + if(name.equalsIgnoreCase("OCL")&& !value.equalsIgnoreCase("null")){ + Package package_ = lastCategory; + Constraint constraint = (Constraint)package_.createOwnedMember(UML2Package.eINSTANCE.getConstraint()); + // constraint.setName(name); + + // create specification + constraint.createSpecification(UML2Package.eINSTANCE.getOpaqueExpression()); + String tempBody, body = ""; + // prepare constraint body content + if(value.startsWith("{")){ + int length = value.length(); + tempBody = value.substring(2, length - 2); + } else { + tempBody = value; + } + int index = tempBody.indexOf(","); + boolean multiple = false; + if (index != -1) + multiple = true; + while (index != -1){ + int length = tempBody.length(); + body = body.concat(tempBody.substring(0, index - 2)); + body = body.concat("\n"); + tempBody = tempBody.substring(index + 2); + index = tempBody.indexOf(","); + } + if (multiple){ + body = body.concat(tempBody.substring(index + 1)); + } + if (!multiple) + body = tempBody; + + //set constraint body and language + ((OpaqueExpression)constraint.getSpecification()).setBody(body); + ((OpaqueExpression)constraint.getSpecification()).setLanguage("OCL"); + + // get the connection line between the constraint and the class + constraint.getConstrainedElements().add(lastClass); + + // add constraint to diagram + ArrayList list = new ArrayList(); + list.add(constraint); + List diagrams = diagramHelper.getDiagrams(package_, UMLDiagramKind.CLASS_LITERAL); + Iterator it = diagrams.iterator(); + Diagram thisDiagram = null; + while(it.hasNext()){ + Diagram diagram = (Diagram)it.next(); + if(diagram.getName().equalsIgnoreCase("Main")) + thisDiagram = diagram; + } + if (thisDiagram != null){ + diagramHelper.createViews(thisDiagram, list); + } + }*/ + } +/* + if(type == TMETHOD){ + + if(name.equalsIgnoreCase("OCL")&& !value.equalsIgnoreCase("null")){ + System.out.println("class: " + lastClass.getName()); + System.out.println("name: " + name + " value: "+ value); + Package package_ = lastCategory; + Constraint constraint = (Constraint)package_.createOwnedMember(UML2Package.eINSTANCE.getConstraint()); + constraint.setName(name); + constraint.createSpecification(UML2Package.eINSTANCE.getOpaqueExpression()); + String tempBody, body = ""; + if(value.startsWith("{")){ + int length = value.length(); + tempBody = value.substring(2, length - 2); + } else { + tempBody = value; + } + int index = tempBody.indexOf(","); + boolean multiple = false; + if (index != -1) + multiple = true; + while (index != -1){ + int length = tempBody.length(); + body = body.concat(tempBody.substring(0, index - 2)); + body = body.concat("\n"); + tempBody = tempBody.substring(index + 2); + index = tempBody.indexOf(","); + } + if (multiple){ + body = body.concat(tempBody.substring(index + 1)); + } + if (!multiple) + body = tempBody; + ((OpaqueExpression)constraint.getSpecification()).setBody(body); + ((OpaqueExpression)constraint.getSpecification()).setLanguage("OCL"); + // TODO add connection line between constraint and class + ArrayList list = new ArrayList(); + list.add(constraint); + List diagrams = diagramHelper.getDiagrams(package_, UMLDiagramKind.CLASS_LITERAL); + Iterator it = diagrams.iterator(); + Diagram thisDiagram = null; + while(it.hasNext()){ + Diagram diagram = (Diagram)it.next(); + if(diagram.getName().equalsIgnoreCase("Main")) + thisDiagram = diagram; + } + if (thisDiagram != null){ + diagramHelper.createViews(thisDiagram, list); + } } } + */ // because of the different role order in RSA theElement is // lastAssocProp2 if type TLINK1 if (type == TLINK1) { @@ -790,7 +901,20 @@ ((Operation)theElement).setIsStatic(true); } } - + + }else if(name.equalsIgnoreCase("ArrayType")){ + if(value.equalsIgnoreCase("Ordered") || + value.equalsIgnoreCase("Indexed") ){ + if(theElement instanceof Property){ + ((Property)theElement).setIsOrdered(true); + }else if(theElement instanceof Parameter){ + ((Parameter)theElement).setIsOrdered(true); + } + } + int stereotypePropertyIndex = ((List) theElement.getValue(cimStereotype, "QualifierName")).size(); + theElement.setValue(cimStereotype, "QualifierName["+stereotypePropertyIndex+"]", name); + theElement.setValue(cimStereotype, "QualifierValue["+stereotypePropertyIndex+"]", value); + }else{ if (value.length() == 0) Index: RoseREI.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/RoseREI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- RoseREI.java 18 Mar 2005 08:02:49 -0000 1.6 +++ RoseREI.java 8 Apr 2005 09:11:16 -0000 1.7 @@ -533,7 +533,7 @@ lastObject = Parameter; } - public void AddAtribute( + public void AddAttribute( String dataType, String name, String defaultValue) { Index: CMPIProviderGenerator.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/CMPIProviderGenerator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CMPIProviderGenerator.java 16 Nov 2004 11:32:22 -0000 1.4 +++ CMPIProviderGenerator.java 8 Apr 2005 09:10:57 -0000 1.5 @@ -1972,7 +1972,7 @@ boolean addQualifiers) { for (int i = 0; i < list.size(); i++) { UMLAttribute at = (UMLAttribute) list.get(i); - MOFGen.AddAtribute(at.dataType, at.name, at.value); + MOFGen.AddAttribute(at.dataType, at.name, at.value); //I use addQualifiers as parameter of "localOnly" //to ensure I get the key qualifier for the repository //mof, since it defines a class without inheritance Index: mofCreator.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/mofCreator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mofCreator.java 21 Dec 2004 17:08:31 -0000 1.3 +++ mofCreator.java 8 Apr 2005 09:11:16 -0000 1.4 @@ -335,7 +335,7 @@ files.set(lastFile, file); } - public void AddAtribute( + public void AddAttribute( String dataType, String name, String defaultValue) { @@ -383,12 +383,12 @@ String name2, Object diagram) { if (Assoc1 != null) { - AddAtribute(Assoc1, name1, null); + AddAttribute(Assoc1, name1, null); if (Assoc2 != null) { int temp = posQualifier1; - AddAtribute(Assoc2, name2, null); + AddAttribute(Assoc2, name2, null); posQualifier2 = posQualifier1; posQualifier1 = temp; |