Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » EAnnotation and Cross document reference
EAnnotation and Cross document reference [message #626768] Tue, 08 July 2008 05:59
Sushant Sirsikar is currently offline Sushant SirsikarFriend
Messages: 5
Registered: July 2009
Junior Member
Hi All,
I am working on project which uses cross document reference
functionality of EMF. I have two models
1) UML2.0 model. (Which is uml model created by emf’s tool project)
2) Description model (This model is create using emf to store
description of Uml model).
Both the models are in different resource and using EMF version
2.2. There is one constraint, that I can not change the UML2.0 model
because of dependency with other code.
Now problem is, I need to attach this new “Description” model to
UML2.0 model. I am trying to add this model inside the EMF model using
EAnnotation. EAnnotation has ‘details’ field which returns ECoreEMap,
which delegates to EStringTOStringMap as …

public class EAnnotationImpl extends EModelElementImpl implements
EAnnotation
{
………
---
public EMap getDetails()
{
if (details == null)
{
details = new
EcoreEMap(EcorePackage.eINSTANCE.getEStringToStringMapEntry( ),
EStringToStringMapEntryImpl.class, this,
EcorePackage.EANNOTATION__DETAILS);
}
return details;
}
--
--
--
}

Above is default implementation provided in
org.eclipse.emf.ecore.impl.EAnnotationImpl. Now I want my details contains
map which can take ‘object’ as key and value instead of String which is
provided by EStringTOStringMap. To achieve this I override details()
method as

EAnnotaion annotation = new EAnnotationImpl(){
@Override
public EMap getDetails() {
if(this.details==null){
this.details = new
EcoreEMap(Uml2docPackage.eINSTANCE.getObjectMap(), ObjectMapImpl.class,
this, EcorePackage.EANNOTATION__DETAILS);
}
return this.details;
}
};
annotation.setSource(IAnnotationConstants.DOCUMENTATION_SOUR CE);
umlelement.getEAnnotations().add(annotation);
This details method delegates to ObjectMap which is inside “Description”
model. So when I save my resources, my .uml file looks like bellow :

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.zensar.sbp.modelTransformation.model="http://zensar.com"
xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML"
xmi:id="_x2a-IEvrEd2X0eL_8jpS4A">
<eAnnotations xmi:id="_0UEsUEvrEd2X0eL_8jpS4A"
source="http://www.zensar.com/uuid">
<details xmi:id="_0UEsUUvrEd2X0eL_8jpS4A" key="uuid"
value="12154112091090"/>
</eAnnotations>
-------------------------------
-----------Some serialized model-----------------------
-------------------------------
<ownedMember xmi:type="uml:UseCase" xmi:id="_yy6bkEvrEd2X0eL_8jpS4A"
name="UseCase1">
<eAnnotations xmi:id="_zlSTsEvrEd2X0eL_8jpS4A"
source="http://www.zensar.com/documentation">
<eAnnotations xmi:id="_0UEsWEvrEd2X0eL_8jpS4A"
source="http://www.zensar.com/uuid">
<details xmi:id="_0UEsWUvrEd2X0eL_8jpS4A" key="uuid"
value="12154112091095"/>
</eAnnotations>
<details
xmi:type="com.zensar.sbp.modelTransformation.model:ObjectMap "
xmi:id="_zlSTsUvrEd2X0eL_8jpS4A" key="documentation">
<value
xmi:type="com.zensar.sbp.modelTransformation.model:Documentation "
href="file:/c:/docTest.uml2doc#/"/>
</details>
</eAnnotations>
<eAnnotations xmi:id="_0UEsVkvrEd2X0eL_8jpS4A"
source="http://www.zensar.com/uuid">
<details xmi:id="_0UEsV0vrEd2X0eL_8jpS4A" key="uuid"
value="12154112091094"/>
</eAnnotations>
</ownedMember>
</ownedMember>
</uml:Model>

So my problem is :
1) When I load the uml and description model in resource set, it loads
object map with key but it doesn’t load value, which is cross document
reference to ‘description’ model.
2) What is the way to register my new annotationimpl inside EcoreFactory
and package.? Because when I load uml model, it again creates
EStringToString map and could not store my ObjectMap which in terns gives
ArrayStoreExcption.

Thanks in advance for any suggestion.
Previous Topic:Best way to model arguments of a message?
Next Topic:[Stereotype] isAppliedStereotype differs on JavaDoc and Implementation
Goto Forum:
  


Current Time: Mon Apr 06 19:06:22 GMT 2020

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

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

Back to the top