Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » getAllAppliedProfile
getAllAppliedProfile [message #476605] Wed, 22 July 2009 02:59 Go to next message
guenin is currently offline guenin
Messages: 42
Registered: July 2009
Member
Hi,

I want to get the profile applied to my model with the function
"getAllAppliedProfiles" I obtain the list here under but when I use the
function "getOwnedStereotypes()" on these profiles I obtain an empty
list.I work with papyrus and my code to load my model is also here under.

getAllAppliedProfiles :

[org.eclipse.uml2.uml.internal.impl.ProfileImpl@2f0d54 (eProxyURI:
pathmap://UML_PROFILES/Standard.profile.uml#_0),
org.eclipse.uml2.uml.internal.impl.ProfileImpl@1961581 (eProxyURI:
resources/MARTE.profile.uml#_EIfnABJeEdy3Td9UhuLFPg),
org.eclipse.uml2.uml.internal.impl.ProfileImpl@113beb5 (eProxyURI:
resources/MARTE.profile.uml#_5ZCOIAPMEdyuUt-4qHuVvQ),
org.eclipse.uml2.uml.internal.impl.ProfileImpl@193f6e2 (eProxyURI:
resources/MARTE.profile.uml#_yNSZIAPMEdyuUt-4qHuVvQ),
org.eclipse.uml2.uml.internal.impl.ProfileImpl@1e13e07 (eProxyURI:
resources/MARTE.profile.uml#_A_vtYBJeEdy3Td9UhuLFPg)]


my code:

public static void main(String[] args) {
URI uri = URI.createURI("essai2/essai2.uml");


try {
ResourceSetImpl resourceSet = new ResourceSetImpl();
// Plug in UML model loader (package and file extension recognition)
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap()
.put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
UMLResource resource = (UMLResource) resourceSet.getResource(uri, true);
Model mod=(Model)EcoreUtil.getObjectByType(((Resource)
resource).getContents(), UMLPackage.eINSTANCE.getModel());
System.out.println(mod.getAllAppliedProfiles());
System.out.println(mod.getAllAppliedProfiles().get(1).getOwn edStereotypes());
} catch (WrappedException we) {
we.printStackTrace();
System.exit(1);
}


}

Aurélie
Re: getAllAppliedProfile [message #476607 is a reply to message #476605] Thu, 23 July 2009 07:57 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Aurélie,

The given code looks correct.
You can check it by printing owned stereotypes of Standard.profile.uml:
System.out.println(mod.getAllAppliedProfiles().get(0).getOwn edStereotypes());
Note, that I take the first, not second, profile here: #get(0).

Can it happen that there are no stereotypes in your profiles?

BTW, this is UML2 Tools newsgroup. Papyrus has its own newsgroup -- http://www.eclipse.org/newsportal/thread.php?group=eclipse.p apyrus.

Best wishes,
Tanya.

> Hi,
>
> I want to get the profile applied to my model with the function
> "getAllAppliedProfiles" I obtain the list here under but when I use
> the function "getOwnedStereotypes()" on these profiles I obtain an
> empty list.I work with papyrus and my code to load my model is also
> here under.
>
> getAllAppliedProfiles :
>
> [org.eclipse.uml2.uml.internal.impl.ProfileImpl@2f0d54 (eProxyURI:
> pathmap://UML_PROFILES/Standard.profile.uml#_0),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1961581 (eProxyURI:
> resources/MARTE.profile.uml#_EIfnABJeEdy3Td9UhuLFPg),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@113beb5 (eProxyURI:
> resources/MARTE.profile.uml#_5ZCOIAPMEdyuUt-4qHuVvQ),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@193f6e2 (eProxyURI:
> resources/MARTE.profile.uml#_yNSZIAPMEdyuUt-4qHuVvQ),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1e13e07 (eProxyURI:
> resources/MARTE.profile.uml#_A_vtYBJeEdy3Td9UhuLFPg)]
>
> my code:
>
> public static void main(String[] args) {
> URI uri = URI.createURI("essai2/essai2.uml");
> try {
> ResourceSetImpl resourceSet = new ResourceSetImpl();
> // Plug in UML model loader (package and file extension
> recognition)
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap()
> .put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> UMLResource resource = (UMLResource) resourceSet.getResource(uri,
> true);
> Model mod=(Model)EcoreUtil.getObjectByType(((Resource)
> resource).getContents(), UMLPackage.eINSTANCE.getModel());
> System.out.println(mod.getAllAppliedProfiles());
>
> System.out.println(mod.getAllAppliedProfiles().get(1).getOwn edStereoty
> pes());
> } catch (WrappedException we) {
> we.printStackTrace();
> System.exit(1);
> }
> }
>
> Aurélie
>
Re: getAllAppliedProfile [message #476612 is a reply to message #476607] Thu, 23 July 2009 10:29 Go to previous message
guenin is currently offline guenin
Messages: 42
Registered: July 2009
Member
Hi,

Thank you for answering me.
My first try was with the standard profile (get(0)) and I had the same
problem (the list is empty). the problem seems a problem with loading. I
will post my question on papyrus forum.

Aurélie
Re: getAllAppliedProfile [message #624652 is a reply to message #476605] Thu, 23 July 2009 07:57 Go to previous message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Aurélie,

The given code looks correct.
You can check it by printing owned stereotypes of Standard.profile.uml:
System.out.println(mod.getAllAppliedProfiles().get(0).getOwn edStereotypes());
Note, that I take the first, not second, profile here: #get(0).

Can it happen that there are no stereotypes in your profiles?

BTW, this is UML2 Tools newsgroup. Papyrus has its own newsgroup -- http://www.eclipse.org/newsportal/thread.php?group=eclipse.p apyrus

Best wishes,
Tanya.

> Hi,
>
> I want to get the profile applied to my model with the function
> "getAllAppliedProfiles" I obtain the list here under but when I use
> the function "getOwnedStereotypes()" on these profiles I obtain an
> empty list.I work with papyrus and my code to load my model is also
> here under.
>
> getAllAppliedProfiles :
>
> [org.eclipse.uml2.uml.internal.impl.ProfileImpl@2f0d54 (eProxyURI:
> pathmap://UML_PROFILES/Standard.profile.uml#_0),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1961581 (eProxyURI:
> resources/MARTE.profile.uml#_EIfnABJeEdy3Td9UhuLFPg),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@113beb5 (eProxyURI:
> resources/MARTE.profile.uml#_5ZCOIAPMEdyuUt-4qHuVvQ),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@193f6e2 (eProxyURI:
> resources/MARTE.profile.uml#_yNSZIAPMEdyuUt-4qHuVvQ),
> org.eclipse.uml2.uml.internal.impl.ProfileImpl@1e13e07 (eProxyURI:
> resources/MARTE.profile.uml#_A_vtYBJeEdy3Td9UhuLFPg)]
>
> my code:
>
> public static void main(String[] args) {
> URI uri = URI.createURI("essai2/essai2.uml");
> try {
> ResourceSetImpl resourceSet = new ResourceSetImpl();
> // Plug in UML model loader (package and file extension
> recognition)
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap()
> .put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> UMLResource resource = (UMLResource) resourceSet.getResource(uri,
> true);
> Model mod=(Model)EcoreUtil.getObjectByType(((Resource)
> resource).getContents(), UMLPackage.eINSTANCE.getModel());
> System.out.println(mod.getAllAppliedProfiles());
>
> System.out.println(mod.getAllAppliedProfiles().get(1).getOwn edStereoty
> pes());
> } catch (WrappedException we) {
> we.printStackTrace();
> System.exit(1);
> }
> }
>
> Aurélie
>
Re: getAllAppliedProfile [message #624657 is a reply to message #476607] Thu, 23 July 2009 10:29 Go to previous message
guenin is currently offline guenin
Messages: 42
Registered: July 2009
Member
Hi,

Thank you for answering me.
My first try was with the standard profile (get(0)) and I had the same
problem (the list is empty). the problem seems a problem with loading. I
will post my question on papyrus forum.

Aurélie
Previous Topic:Newbie Question about Use Cases and Description
Next Topic:How to deal with uml model fragments?
Goto Forum:
  


Current Time: Sat Aug 30 12:36:30 EDT 2014

Powered by FUDForum. Page generated in 0.01870 seconds