Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » getAllAppliedProfile
getAllAppliedProfile [message #470441] Thu, 23 July 2009 14:35 Go to next message
Eclipse UserFriend
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(0).getOwn edStereotypes());
} catch (WrappedException we) {
we.printStackTrace();
System.exit(1);
}


}

Aurélie
Re: getAllAppliedProfile [message #470444 is a reply to message #470441] Thu, 23 July 2009 16:17 Go to previous messageGo to next message
Emilien Perico is currently offline Emilien PericoFriend
Messages: 36
Registered: July 2009
Member
Hi Aurélie,

I think your resource is not resolve and you can't access owned stereotypes.

Check if the profile is a proxy:
getAllAppliedProfiles().get(0).eIsProxy()

if true: EcoreUtil.resolveAll(resourceSet)

If is not represented by proxy, maybe your stereotypes are owned by a
subpackage of your profile. If I remember, getOwnedStereotypes() only
check the first level

Your question is about UML, not only papyrus project.
Be careful to post on the right newsgroup next time.

Regards,

Emilien

guenin a écrit :
> 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(0).getOwn edStereotypes());
>
> } catch (WrappedException we) {
> we.printStackTrace();
> System.exit(1);
> }
>
>
> }
>
> Aurélie
>
Re: getAllAppliedProfile [message #470446 is a reply to message #470444] Fri, 24 July 2009 06:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi Emilien,

Thank you for your answer but the profiles are proxy and the function
resolveAll(ResourceSet) changes nothing.

For the newsgroup, I first post my question in umltool’s news group and
someone tell me that my code seemed to be right and I could post my
question on papyrus newsgroup

Aurélie.
Re: getAllAppliedProfile [message #470447 is a reply to message #470444] Fri, 24 July 2009 08:32 Go to previous message
Eclipse UserFriend
HI,

To be more precise, when the profile is not a proxy, the result is good and
when the profile is a proxy the function getOwnedStereotype return an
empty list

Aurélie
Re: getAllAppliedProfile [message #590767 is a reply to message #470441] Thu, 23 July 2009 16:17 Go to previous message
Emilien Perico is currently offline Emilien PericoFriend
Messages: 36
Registered: July 2009
Member
Hi Aurélie,

I think your resource is not resolve and you can't access owned stereotypes.

Check if the profile is a proxy:
getAllAppliedProfiles().get(0).eIsProxy()

if true: EcoreUtil.resolveAll(resourceSet)

If is not represented by proxy, maybe your stereotypes are owned by a
subpackage of your profile. If I remember, getOwnedStereotypes() only
check the first level

Your question is about UML, not only papyrus project.
Be careful to post on the right newsgroup next time.

Regards,

Emilien

guenin a écrit :
> 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(0).getOwn edStereotypes());
>
> } catch (WrappedException we) {
> we.printStackTrace();
> System.exit(1);
> }
>
>
> }
>
> Aurélie
>
Re: getAllAppliedProfile [message #590773 is a reply to message #470444] Fri, 24 July 2009 06:53 Go to previous message
Eclipse UserFriend
Hi Emilien,

Thank you for your answer but the profiles are proxy and the function
resolveAll(ResourceSet) changes nothing.

For the newsgroup, I first post my question in umltool’s news group and
someone tell me that my code seemed to be right and I could post my
question on papyrus newsgroup

Aurélie.
Re: getAllAppliedProfile [message #590782 is a reply to message #470444] Fri, 24 July 2009 08:32 Go to previous message
Eclipse UserFriend
HI,

To be more precise, when the profile is not a proxy, the result is good and
when the profile is a proxy the function getOwnedStereotype return an
empty list

Aurélie
Previous Topic:getAllAppliedProfile
Next Topic:Setting stereotype property value
Goto Forum:
  


Current Time: Thu Apr 25 15:57:15 GMT 2024

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

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

Back to the top