From: Benjamin B. <bg...@us...> - 2005-05-31 13:12:57
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13859/Plugin/com/ibm/ecute/plugins/output/funcionality Modified Files: RSAModelCreator.java Log Message: 2.1 beta 1a fixed some CIM MOF import errors in RSA/RSM Index: RSAModelCreator.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/RSAModelCreator.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- RSAModelCreator.java 10 May 2005 09:11:54 -0000 1.11 +++ RSAModelCreator.java 31 May 2005 13:12:46 -0000 1.12 @@ -595,34 +595,36 @@ // 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 - 1)); - 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"); + // set OCL body + setOCLBody(constraint, value); +// 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 - 1)); +// 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); @@ -751,8 +753,11 @@ } else if (name.equalsIgnoreCase("Key")){ if(value.equalsIgnoreCase("true")){ if(theElement instanceof Property){ - Stereotype stereo = theElement.getApplicableStereotype("CIM::Key"); - ((Property)theElement).apply(stereo); + Stereotype appliedStereo = theElement.getAppliedStereotype("CIM::Key"); + if(appliedStereo == null){ + Stereotype stereo = theElement.getApplicableStereotype("CIM::Key"); + ((Property)theElement).apply(stereo); + } } } @@ -840,6 +845,39 @@ lastQualifierType = type; } + + private void setOCLBody(Constraint constraint, String value){ + + 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 - 1)); + 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"); + + } /*************************************************************************** * Private Methods |