Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » update attributes of class programmatically
update attributes of class programmatically [message #1198446] Wed, 20 November 2013 10:25
Kostas Triantafyllidis is currently offline Kostas Triantafyllidis
Messages: 15
Registered: November 2012
Junior Member
Hello all,

I am working in uml converting a model from xmi to uml-MARTE compatible. Of course this is done programmatically. I have already managed to create the model, the required classes and the operations that are inside the classes. The operations inside the classes are stereotyped with the "saStep" stereotype. I would like to update the values of some properties of this stereotype. I am trying to use the method setValue(Stereotype, "name_of_property", value), but this returns an exception.


//load subProfile SAM
Profile subprofile_SAM = diagram.getSubProfile(MARTE.getNestedPackage("MARTE_AnalysisModel"), "SAM");

System.out.println(subprofile_SAM);
Stereotype saStep = subprofile_SAM.getOwnedStereotype("SaStep");

org.eclipse.uml2.uml.Class new_class = diagram.createClass(swComponent.NameOfSWComponent);

for(int i=0; i<swComponent.SWComponent.size(); i++)
{
org.eclipse.uml2.uml.Operation tmp = diagram.createOwnedOperation(swComponent.SWComponent.get(i).OperationMetricsForAllPlatforms.get(0).NameOfOperation, new_class);


tmp.setValue(saStep, "L1CacheMiss", 1000);

}



The exception that i am receiving looks like this. Do you ave any idea why this is happening? I have to say that the property "L1CacheMiss" exists into the saStep stereotype and i can get its name by tmp.getAppliedStereotypes().get(0).getAllAttributes().get(cnt).getName();.


Exception in thread "main" java.lang.IllegalArgumentException: 1000
at org.eclipse.uml2.uml.internal.operations.ElementOperations.setValue(ElementOperations.java:841)
at org.eclipse.uml2.uml.internal.impl.ElementImpl.setValue(ElementImpl.java:306)
at loadPerformanceModels.files.main.create_OperationsClass(main.java:112)
at loadPerformanceModels.files.main.main(main.java:37)


Thank you in advance for you time,
Kostas

[Updated on: Thu, 21 November 2013 15:34]

Report message to a moderator

Previous Topic:OCL expression
Next Topic:Error when with classifier reference in EnumerationLiterals
Goto Forum:
  


Current Time: Thu Oct 23 10:28:10 GMT 2014

Powered by FUDForum. Page generated in 0.03024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software