Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » associations and stereotypes(can't create an association between two stereotypes)
associations and stereotypes [message #806124] Fri, 24 February 2012 15:17
Lionel Montrieux is currently offline Lionel Montrieux
Messages: 4
Registered: October 2011
Location: UK
Junior Member
Hi there,

I'm having a problem with a UML profile, rbacUML, that I created using Rational Software Architect. The attached picture shows two stereotypes, «User» and «Role», that can be attached to a class. There is also a 0..* association between «User» and «Role».

Now, I can easily create classes stereotyped with «User» or «Role». Here is a code sample that create one of each:

Package root = (Package)element;
org.eclipse.uml2.uml.Class jSmith = root.createOwnedClass("John Smith", false);
org.eclipse.uml2.uml.Class student = root.createOwnedClass("Student", false);
						
Stereotype uSter = root.getAppliedProfile("rbacUML").getOwnedStereotype("User");
jSmith.applyStereotype(uSter);
Stereotype rSter = root.getAppliedProfile("rbacUML").getOwnedStereotype("RBACRole");
student.applyStereotype(rSter);


The problem is: how do I create an association between «User» on the class John Smith and «Role» on the class Student? I tried using setValue(...):

jSmith.setValue(jSmith.getAppliedStereotype("rbacUML::User"), "rBACRole", student.getAppliedStereotype("rbacUML::Role"));


... but I get the following exception:

java.lang.IllegalArgumentException: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@38b938b9 (name: RBACRole, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)
	at org.eclipse.uml2.uml.internal.operations.ElementOperations.setValue(Unknown Source)
	at org.eclipse.uml2.uml.internal.impl.ElementImpl.setValue(Unknown Source)
	at LDAPImporter$1.doExecute(Unknown Source)
	at org.eclipse.emf.transaction.RecordingCommand.execute(Unknown Source)
	at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(Unknown Source)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(Unknown Source)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(Unknown Source)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(Unknown Source)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(Unknown Source)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(Unknown Source)
	at LDAPImporter.plugletmain(Unknown Source)



I guess the problem comes from the 0..* multiplicity? Can anyone help me create such an association?

Thank you very much!
Previous Topic:Platform specific or independent models?
Next Topic:How to install SoaML plugin in IBM RSA (based on Eclipse)
Goto Forum:
  


Current Time: Tue Sep 23 18:41:29 GMT 2014

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

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