Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Model Reader - Documentation issue.
Re: Model Reader - Documentation issue. [message #477368] Fri, 09 May 2008 10:24 Go to next message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Rajasekar,

Oops. Sorry for the previous mis send. This sounds like purely a UML
issue so I've added the UML2 newsgroup to the to list of the reply.
It's best to ask UML2 questions there.


Rajasekar M wrote:
> We have developed One plugin using EMF Framework. We are facing some
> issues while importing model.
>
> Each model will have field, relationship and field map. Field will
> have doc tag associated which will have comment for the field.
>
> eg.. <field name="AreaCode" scope="all">
> <properties label="{RESOURCE}"/>
> <type class="string3" required="true"/>
> <doc><![CDATA[3 digit Area Code]]></doc>
> <persistence dbName="AREA_COD"/>
> </field>
>
> When we import this model using our plugin, we could not see the
> comment "3 digit Area Code" on the documentation tab for the model.
>
> The below is source we used for reading model while import.
>
> private void processDoc(final DomainElement domainElement,
> org.eclipse.uml2.uml.Element element) {
> final List<Comment> commentList = element.getOwnedComments();
>
> final StringBuffer comments = new StringBuffer();
> for (Comment comment : commentList) {
> comments.append(comment.getBody());
> }
>
> domainElement.setDocumentation(comments.toString());
> }.
> The below piece of code is copied from .emx file.
>
> <ownedAttribute xmi:id="_kflz8aRHEdyRJ-yMLomXrA" name="AreaCode">
> <ownedComment xmi:id="_kgyGwKRHEdyRJ-yMLomXrA">
> <body>3 digit Area Code</body>
> </ownedComment>
> </ownedAttribute>
>
> Also, we have identified, when we enter comments in the RSA editor and
> save the model there is attribute called annotatedElement is added to
> the ownedComment tag.
>
> <ownedAttribute xmi:id="_kflz8aRHEdyRJ-yMLomXrA" name="AreaCode">
> <ownedComment xmi:id="_kgyGwKRHEdyRJ-yMLomXrA">
> <body>3 digit Area Code</body>
> </ownedComment>
> <ownedComment xmi:id="_nT6mgB15Ed2rhYiAzgNSyQ"
> annotatedElement="_kflz8aRHEdyRJ-yMLomXrA">
> <body>Test Documentation</body>
> </ownedComment>
> </ownedAttribute>.
>
> Please help me in this issue.
> Thanks,
> Rajasekar.
>
>
Re: Model Reader - Documentation issue. [message #477374 is a reply to message #477368] Mon, 12 May 2008 20:56 Go to previous messageGo to next message
james bruck is currently offline james bruck
Messages: 1724
Registered: July 2009
Senior Member
Hi Rajasekar,


A couple of points about RSA (which may or may not be relevant :) ):
1. RSA7.0.5 and later use rich text support and so embed extra information
in the body of the comment.
2. RSA has a concept of "documentation" which is used with transformations
and in the property sheet. One comment can be marked as documentation of
an element so it is treated differently from other comments. I don't
believe a round trip export / import will work in in that case since this
stereotype is not known to the opensource UML2 API. Only one element can
be marked as "documentation".
3. EMF has a concept of documentation that is different from UML's. see
EcoreUtil.setDocumentation() or UML2Util.addDocumentation();

In terms of "annotatedElement" feature, this is not coming from RSA
specifically but rather it is a feature of uml::Comment ( a UML thing, not
a RSA thing ). This is a reference to the element being commented.

In terms of why you cannot see the body of your comment it is still a
mystery to me. I've tried setting and getting the body of a comment and it
looks fine.

What version of UML2 API's are you using? Did you try stepping into the
..getBody() to see why you are not getting the results you are looking for?
Are there any errors?

Cheers,
- James.


"Ed Merks" <merks@ca.ibm.com> wrote in message
news:g018pf$6qq$2@build.eclipse.org...
> Rajasekar,
>
> Oops. Sorry for the previous mis send. This sounds like purely a UML
> issue so I've added the UML2 newsgroup to the to list of the reply. It's
> best to ask UML2 questions there.
>
>
> Rajasekar M wrote:
>> We have developed One plugin using EMF Framework. We are facing some
>> issues while importing model.
>>
>> Each model will have field, relationship and field map. Field will have
>> doc tag associated which will have comment for the field.
>>
>> eg.. <field name="AreaCode" scope="all">
>> <properties label="{RESOURCE}"/>
>> <type class="string3" required="true"/>
>> <doc><![CDATA[3 digit Area Code]]></doc>
>> <persistence dbName="AREA_COD"/>
>> </field>
>>
>> When we import this model using our plugin, we could not see the comment
>> "3 digit Area Code" on the documentation tab for the model.
>>
>> The below is source we used for reading model while import.
>>
>> private void processDoc(final DomainElement domainElement,
>> org.eclipse.uml2.uml.Element element) {
>> final List<Comment> commentList = element.getOwnedComments();
>>
>> final StringBuffer comments = new StringBuffer();
>> for (Comment comment : commentList) {
>> comments.append(comment.getBody());
>> }
>>
>> domainElement.setDocumentation(comments.toString());
>> }.
>> The below piece of code is copied from .emx file.
>>
>> <ownedAttribute xmi:id="_kflz8aRHEdyRJ-yMLomXrA" name="AreaCode">
>> <ownedComment xmi:id="_kgyGwKRHEdyRJ-yMLomXrA">
>> <body>3 digit Area Code</body>
>> </ownedComment>
>> </ownedAttribute>
>>
>> Also, we have identified, when we enter comments in the RSA editor and
>> save the model there is attribute called annotatedElement is added to the
>> ownedComment tag.
>>
>> <ownedAttribute xmi:id="_kflz8aRHEdyRJ-yMLomXrA" name="AreaCode">
>> <ownedComment xmi:id="_kgyGwKRHEdyRJ-yMLomXrA">
>> <body>3 digit Area Code</body>
>> </ownedComment>
>> <ownedComment xmi:id="_nT6mgB15Ed2rhYiAzgNSyQ"
>> annotatedElement="_kflz8aRHEdyRJ-yMLomXrA">
>> <body>Test Documentation</body>
>> </ownedComment>
>> </ownedAttribute>.
>>
>> Please help me in this issue.
>> Thanks,
>> Rajasekar.
>>
>>
Re: Model Reader - Documentation issue. [message #477397 is a reply to message #477374] Mon, 19 May 2008 08:59 Go to previous messageGo to next message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

Thanks for your reply. Sorry for the late reply. I was not in town last
week.

I am using uml2 2.0.4.v200707041607 version. For me also setter/getter is
working fine on RSA Editor.

Create document for a field from an editor and save. Open the model again,
the document is showing up for the field on the Documentation tab.

I am not getting any error while stepping into the .body method. I am able
to retrive the comment while importing. The issue here is while importing,
plugin is importing all the model attributes including the comments(from
doc tag)and creating element called OwnedComment, setting the
documentation inside body tag for OwnedComment. Whatever imported from the
model is not showing up on the editor(i mean on the Documentation tab.

for (Comment comment : commentList) {
comments.append(comment.getBody());
}
domainElement.setDocumentation(comments.toString());

The above code is retrieves comments from the body tag of OwnedComment
Element.

<ownedAttribute xmi:id="_IrCu8aRHEdyRJ-yMLomXrA"
name="state">
<ownedComment xmi:id="_Ir8G0KRHEdyRJ-yMLomXrA">
<body>The current state of the activity.</body>
</ownedComment>
</ownedAttribute>

The above code (ownedComment ) does not annotatedElement attribute. I
think that is why the editor is not showing the comments on the
documentation tab.

When we parse input xml files(domains),we create object for each and every
element of domain like field, fieldmap etc.,. So while creating these
object for every element we attach documentation. I hope while doing this
we are not creating annotatedElement attribute for ownedComment element.

I hope you understand my issue.


Thanks,

Rajasekar.
Re: Model Reader - Documentation issue. [message #477414 is a reply to message #477397] Wed, 21 May 2008 05:13 Go to previous messageGo to next message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

I found that RSA creates <Default : Documentation> - This tag will appear
at the end of the file outside of the <uml : Model> tag for each
ownedComment in the .emx file.

This tag contains the reference to the xmi:id of the ownedComment.

For example,
<ownedAttribute xmi:id="_h6MfAKRHEdyRJ-yMLomXrA" name="RoleAddressType">

<ownedComment xmi:id="_ivRWsCZ5Ed2xaOl7mYaIvQ"
annotatedElement="_h6MfAKRHEdyRJ-yMLomXrAraj">

<body>test rajasekar</body>

</ownedComment>

</ownedAttribute>



<Default:Documentation xmi:id="_ivk4sCZ5Ed2xaOl7mYaIvQ"
base_Comment="_ivRWsCZ5Ed2xaOl7mYaIvQ"/>


When you type comments and save from RSA for fields, the ownedComment
xmi:id reference is created with new <Default : Documentation> tag. So the
comment appears on the Documentation Tab.

I hope, if we have Default:Documentation tag created for all the fields,
the comments will be shown in the documentation tab.

Do you have any idea of how the Default:Documentation tag is created using
code?

Note: We were using XDE previously and moved to RSA.

Please let me know your comments.
Re: Model Reader - Documentation issue. [message #477415 is a reply to message #477374] Wed, 21 May 2008 05:50 Go to previous messageGo to next message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

I found that RSA creates <Default : Documentation> - This tag will appear
at the end of the file outside of the <uml : Model> tag for each
ownedComment in the .emx file.

This tag contains the reference to the xmi:id of the ownedComment.

For example,
<ownedAttribute xmi:id="_h6MfAKRHEdyRJ-yMLomXrA" name="RoleAddressType">

<ownedComment xmi:id="_ivRWsCZ5Ed2xaOl7mYaIvQ"
annotatedElement="_h6MfAKRHEdyRJ-yMLomXrAraj">

<body>test rajasekar</body>

</ownedComment>

</ownedAttribute>



<Default:Documentation xmi:id="_ivk4sCZ5Ed2xaOl7mYaIvQ"
base_Comment="_ivRWsCZ5Ed2xaOl7mYaIvQ"/>


When you type comments and save from RSA for fields, the ownedComment
xmi:id reference is created with new <Default : Documentation> tag. So the
comment appears on the Documentation Tab.

I hope, if we have Default:Documentation tag created for all the fields,
the comments will be shown in the documentation tab.

Do you have any idea of how the Default:Documentation tag is created from
code?

Is this issue related to XDE-RSA migration issue? (please look at the
below URL for more info.
http://www-1.ibm.com/support/docview.wss?uid=swg21266749).

Please let me know your comments.
Re: Model Reader - Documentation issue. [message #477419 is a reply to message #477415] Wed, 21 May 2008 15:06 Go to previous messageGo to next message
Dave Carlson is currently offline Dave Carlson
Messages: 399
Registered: July 2009
Senior Member
Rajasekar,

I have written code that assigns the RSA documentation stereotype. I use
this when programmatically creating new models, and assigning the stereotype
does cause the comment text to appear in the RSA documentation property tab.

I can send this to you privately; it's probably not appropriate to post
product-specific code to this newsgroup.

Regards,
Dave Carlson

>
> I hope, if we have Default:Documentation tag created for all the fields,
> the comments will be shown in the documentation tab.
>
> Do you have any idea of how the Default:Documentation tag is created from
> code?
>
Re: Model Reader - Documentation issue. [message #477427 is a reply to message #477419] Fri, 23 May 2008 03:41 Go to previous messageGo to next message
Eclipse User
Originally posted by: Rajasekar.M.cgi.com

Thanks Dave. Sure. It would be great if you send me your code.


Thanks Again,
Rajasekar.
Re: Model Reader - Documentation issue. [message #477439 is a reply to message #477427] Mon, 26 May 2008 03:48 Go to previous messageGo to next message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

Dave,

Please send your code to Rajasekar.m@cgi.com, Since this is a critical
defect, I would request you to send it ASAP.

Thanks,
Rajasekar.
Re: Model Reader - Documentation issue. [message #477440 is a reply to message #477427] Mon, 26 May 2008 04:51 Go to previous messageGo to next message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

Hi,

I have created <Default:Documentation> tag with reference to the
OwnedComment attribute.
.....
List documentationToBeAdded = new ArrayList();
saxParser.parse( new File(modelFilename), new
TestHandler(documentationToBeAdded) );

DocumentBuilder db =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc= db.parse(new File(modelFilename));

Element root = doc.getDocumentElement();

Iterator it = documentationToBeAdded.iterator();
while(it.hasNext()){
String id = (String)it.next();
Element docElem =
doc.createElement("Default:Documentation");
docElem.setAttribute("xmi:id", id+"0");
docElem.setAttribute("base_Comment", id);
root.appendChild(docElem);
}
....
Source src = new DOMSource(doc);
Result dest = new StreamResult(new File(modelFilename));
aTransformer.transform(src, dest);

public class TestHandler extends HandlerBase
{
List documentationToBeAdded;
public TestHandler(List documentationToBeAdded){
this.documentationToBeAdded = documentationToBeAdded;
}

public void startElement (String name, AttributeList attrs)
throws SAXException
{
if(name.equals("ownedComment")){
String id = attrs.getValue(0);
documentationToBeAdded.add(id);
}
}


}

After adding Default tag, my model is not opening up. I got "Documentaion"
class not found error. After the investigation, I found i have missed
adding Namespace and schema location to the root <xml:xmi>. When i
manually add these the model is opening up and the comment is showing on
Documentation tab.

I could not find any help on how to add Namespace and schema location to
root tag.

Please help me on this issue.

Regards,
Rajasekar.
Re: Model Reader - Documentation issue. [message #477443 is a reply to message #477440] Mon, 26 May 2008 12:08 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Rajasekar wrote:
> Hi,
>
> I have created <Default:Documentation> tag with reference to the
> OwnedComment attribute.
> .....
> List documentationToBeAdded = new ArrayList();
> saxParser.parse( new File(modelFilename), new
> TestHandler(documentationToBeAdded) );
>
> DocumentBuilder db =
> DocumentBuilderFactory.newInstance().newDocumentBuilder();
> Document doc= db.parse(new File(modelFilename));
> Element root = doc.getDocumentElement();
> Iterator it = documentationToBeAdded.iterator();
> while(it.hasNext()){
> String id = (String)it.next();
> Element docElem =
> doc.createElement("Default:Documentation");
Shouldn't you be using createElementNS? Does the xmlns declaration for
"Default" appear in the result?
> docElem.setAttribute("xmi:id", id+"0");
> docElem.setAttribute("base_Comment", id);
> root.appendChild(docElem);
> }
> ....
> Source src = new DOMSource(doc);
> Result dest = new StreamResult(new File(modelFilename));
> aTransformer.transform(src, dest);
>
> public class TestHandler extends HandlerBase
> {
> List documentationToBeAdded;
> public TestHandler(List documentationToBeAdded){
> this.documentationToBeAdded = documentationToBeAdded;
> }
>
> public void startElement (String name, AttributeList attrs)
> throws SAXException
> {
> if(name.equals("ownedComment")){
> String id = attrs.getValue(0);
> documentationToBeAdded.add(id);
> }
> }
>
>
> }
>
> After adding Default tag, my model is not opening up. I got
> "Documentaion" class not found error. After the investigation, I found
> i have missed adding Namespace and schema location to the root
> <xml:xmi>. When i manually add these the model is opening up and the
> comment is showing on Documentation tab.
>
> I could not find any help on how to add Namespace and schema location
> to root tag.
This is purely a DOM question, so it's best you find some documentation
on how to manipulate namespace aware DOMs.
>
> Please help me on this issue.
>
> Regards,
> Rajasekar.
>
Re: Model Reader - Documentation issue. [message #626553 is a reply to message #477368] Mon, 12 May 2008 20:56 Go to previous message
james bruck is currently offline james bruck
Messages: 1724
Registered: July 2009
Senior Member
Hi Rajasekar,


A couple of points about RSA (which may or may not be relevant :) ):
1. RSA7.0.5 and later use rich text support and so embed extra information
in the body of the comment.
2. RSA has a concept of "documentation" which is used with transformations
and in the property sheet. One comment can be marked as documentation of
an element so it is treated differently from other comments. I don't
believe a round trip export / import will work in in that case since this
stereotype is not known to the opensource UML2 API. Only one element can
be marked as "documentation".
3. EMF has a concept of documentation that is different from UML's. see
EcoreUtil.setDocumentation() or UML2Util.addDocumentation();

In terms of "annotatedElement" feature, this is not coming from RSA
specifically but rather it is a feature of uml::Comment ( a UML thing, not
a RSA thing ). This is a reference to the element being commented.

In terms of why you cannot see the body of your comment it is still a
mystery to me. I've tried setting and getting the body of a comment and it
looks fine.

What version of UML2 API's are you using? Did you try stepping into the
..getBody() to see why you are not getting the results you are looking for?
Are there any errors?

Cheers,
- James.


"Ed Merks" <merks@ca.ibm.com> wrote in message
news:g018pf$6qq$2@build.eclipse.org...
> Rajasekar,
>
> Oops. Sorry for the previous mis send. This sounds like purely a UML
> issue so I've added the UML2 newsgroup to the to list of the reply. It's
> best to ask UML2 questions there.
>
>
> Rajasekar M wrote:
>> We have developed One plugin using EMF Framework. We are facing some
>> issues while importing model.
>>
>> Each model will have field, relationship and field map. Field will have
>> doc tag associated which will have comment for the field.
>>
>> eg.. <field name="AreaCode" scope="all">
>> <properties label="{RESOURCE}"/>
>> <type class="string3" required="true"/>
>> <doc><![CDATA[3 digit Area Code]]></doc>
>> <persistence dbName="AREA_COD"/>
>> </field>
>>
>> When we import this model using our plugin, we could not see the comment
>> "3 digit Area Code" on the documentation tab for the model.
>>
>> The below is source we used for reading model while import.
>>
>> private void processDoc(final DomainElement domainElement,
>> org.eclipse.uml2.uml.Element element) {
>> final List<Comment> commentList = element.getOwnedComments();
>>
>> final StringBuffer comments = new StringBuffer();
>> for (Comment comment : commentList) {
>> comments.append(comment.getBody());
>> }
>>
>> domainElement.setDocumentation(comments.toString());
>> }.
>> The below piece of code is copied from .emx file.
>>
>> <ownedAttribute xmi:id="_kflz8aRHEdyRJ-yMLomXrA" name="AreaCode">
>> <ownedComment xmi:id="_kgyGwKRHEdyRJ-yMLomXrA">
>> <body>3 digit Area Code</body>
>> </ownedComment>
>> </ownedAttribute>
>>
>> Also, we have identified, when we enter comments in the RSA editor and
>> save the model there is attribute called annotatedElement is added to the
>> ownedComment tag.
>>
>> <ownedAttribute xmi:id="_kflz8aRHEdyRJ-yMLomXrA" name="AreaCode">
>> <ownedComment xmi:id="_kgyGwKRHEdyRJ-yMLomXrA">
>> <body>3 digit Area Code</body>
>> </ownedComment>
>> <ownedComment xmi:id="_nT6mgB15Ed2rhYiAzgNSyQ"
>> annotatedElement="_kflz8aRHEdyRJ-yMLomXrA">
>> <body>Test Documentation</body>
>> </ownedComment>
>> </ownedAttribute>.
>>
>> Please help me in this issue.
>> Thanks,
>> Rajasekar.
>>
>>
Re: Model Reader - Documentation issue. [message #626579 is a reply to message #477374] Mon, 19 May 2008 08:59 Go to previous message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

Thanks for your reply. Sorry for the late reply. I was not in town last
week.

I am using uml2 2.0.4.v200707041607 version. For me also setter/getter is
working fine on RSA Editor.

Create document for a field from an editor and save. Open the model again,
the document is showing up for the field on the Documentation tab.

I am not getting any error while stepping into the .body method. I am able
to retrive the comment while importing. The issue here is while importing,
plugin is importing all the model attributes including the comments(from
doc tag)and creating element called OwnedComment, setting the
documentation inside body tag for OwnedComment. Whatever imported from the
model is not showing up on the editor(i mean on the Documentation tab.

for (Comment comment : commentList) {
comments.append(comment.getBody());
}
domainElement.setDocumentation(comments.toString());

The above code is retrieves comments from the body tag of OwnedComment
Element.

<ownedAttribute xmi:id="_IrCu8aRHEdyRJ-yMLomXrA"
name="state">
<ownedComment xmi:id="_Ir8G0KRHEdyRJ-yMLomXrA">
<body>The current state of the activity.</body>
</ownedComment>
</ownedAttribute>

The above code (ownedComment ) does not annotatedElement attribute. I
think that is why the editor is not showing the comments on the
documentation tab.

When we parse input xml files(domains),we create object for each and every
element of domain like field, fieldmap etc.,. So while creating these
object for every element we attach documentation. I hope while doing this
we are not creating annotatedElement attribute for ownedComment element.

I hope you understand my issue.


Thanks,

Rajasekar.
Re: Model Reader - Documentation issue. [message #626596 is a reply to message #477397] Wed, 21 May 2008 05:13 Go to previous message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

I found that RSA creates <Default : Documentation> - This tag will appear
at the end of the file outside of the <uml : Model> tag for each
ownedComment in the .emx file.

This tag contains the reference to the xmi:id of the ownedComment.

For example,
<ownedAttribute xmi:id="_h6MfAKRHEdyRJ-yMLomXrA" name="RoleAddressType">

<ownedComment xmi:id="_ivRWsCZ5Ed2xaOl7mYaIvQ"
annotatedElement="_h6MfAKRHEdyRJ-yMLomXrAraj">

<body>test rajasekar</body>

</ownedComment>

</ownedAttribute>



<Default:Documentation xmi:id="_ivk4sCZ5Ed2xaOl7mYaIvQ"
base_Comment="_ivRWsCZ5Ed2xaOl7mYaIvQ"/>


When you type comments and save from RSA for fields, the ownedComment
xmi:id reference is created with new <Default : Documentation> tag. So the
comment appears on the Documentation Tab.

I hope, if we have Default:Documentation tag created for all the fields,
the comments will be shown in the documentation tab.

Do you have any idea of how the Default:Documentation tag is created using
code?

Note: We were using XDE previously and moved to RSA.

Please let me know your comments.
Re: Model Reader - Documentation issue. [message #626597 is a reply to message #477374] Wed, 21 May 2008 05:50 Go to previous message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

I found that RSA creates <Default : Documentation> - This tag will appear
at the end of the file outside of the <uml : Model> tag for each
ownedComment in the .emx file.

This tag contains the reference to the xmi:id of the ownedComment.

For example,
<ownedAttribute xmi:id="_h6MfAKRHEdyRJ-yMLomXrA" name="RoleAddressType">

<ownedComment xmi:id="_ivRWsCZ5Ed2xaOl7mYaIvQ"
annotatedElement="_h6MfAKRHEdyRJ-yMLomXrAraj">

<body>test rajasekar</body>

</ownedComment>

</ownedAttribute>



<Default:Documentation xmi:id="_ivk4sCZ5Ed2xaOl7mYaIvQ"
base_Comment="_ivRWsCZ5Ed2xaOl7mYaIvQ"/>


When you type comments and save from RSA for fields, the ownedComment
xmi:id reference is created with new <Default : Documentation> tag. So the
comment appears on the Documentation Tab.

I hope, if we have Default:Documentation tag created for all the fields,
the comments will be shown in the documentation tab.

Do you have any idea of how the Default:Documentation tag is created from
code?

Is this issue related to XDE-RSA migration issue? (please look at the
below URL for more info.
http://www-1.ibm.com/support/docview.wss?uid=swg21266749).

Please let me know your comments.
Re: Model Reader - Documentation issue. [message #626601 is a reply to message #477415] Wed, 21 May 2008 15:06 Go to previous message
Dave Carlson is currently offline Dave Carlson
Messages: 399
Registered: July 2009
Senior Member
Rajasekar,

I have written code that assigns the RSA documentation stereotype. I use
this when programmatically creating new models, and assigning the stereotype
does cause the comment text to appear in the RSA documentation property tab.

I can send this to you privately; it's probably not appropriate to post
product-specific code to this newsgroup.

Regards,
Dave Carlson

>
> I hope, if we have Default:Documentation tag created for all the fields,
> the comments will be shown in the documentation tab.
>
> Do you have any idea of how the Default:Documentation tag is created from
> code?
>
Re: Model Reader - Documentation issue. [message #626609 is a reply to message #477419] Fri, 23 May 2008 03:41 Go to previous message
Eclipse User
Originally posted by: Rajasekar.M.cgi.com

Thanks Dave. Sure. It would be great if you send me your code.


Thanks Again,
Rajasekar.
Re: Model Reader - Documentation issue. [message #626621 is a reply to message #477427] Mon, 26 May 2008 03:48 Go to previous message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

Dave,

Please send your code to Rajasekar.m@cgi.com, Since this is a critical
defect, I would request you to send it ASAP.

Thanks,
Rajasekar.
Re: Model Reader - Documentation issue. [message #626622 is a reply to message #477427] Mon, 26 May 2008 04:51 Go to previous message
Eclipse User
Originally posted by: Rajasekar.m.cgi.com

Hi,

I have created <Default:Documentation> tag with reference to the
OwnedComment attribute.
.....
List documentationToBeAdded = new ArrayList();
saxParser.parse( new File(modelFilename), new
TestHandler(documentationToBeAdded) );

DocumentBuilder db =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc= db.parse(new File(modelFilename));

Element root = doc.getDocumentElement();

Iterator it = documentationToBeAdded.iterator();
while(it.hasNext()){
String id = (String)it.next();
Element docElem =
doc.createElement("Default:Documentation");
docElem.setAttribute("xmi:id", id+"0");
docElem.setAttribute("base_Comment", id);
root.appendChild(docElem);
}
....
Source src = new DOMSource(doc);
Result dest = new StreamResult(new File(modelFilename));
aTransformer.transform(src, dest);

public class TestHandler extends HandlerBase
{
List documentationToBeAdded;
public TestHandler(List documentationToBeAdded){
this.documentationToBeAdded = documentationToBeAdded;
}

public void startElement (String name, AttributeList attrs)
throws SAXException
{
if(name.equals("ownedComment")){
String id = attrs.getValue(0);
documentationToBeAdded.add(id);
}
}


}

After adding Default tag, my model is not opening up. I got "Documentaion"
class not found error. After the investigation, I found i have missed
adding Namespace and schema location to the root <xml:xmi>. When i
manually add these the model is opening up and the comment is showing on
Documentation tab.

I could not find any help on how to add Namespace and schema location to
root tag.

Please help me on this issue.

Regards,
Rajasekar.
Re: Model Reader - Documentation issue. [message #626625 is a reply to message #477440] Mon, 26 May 2008 12:08 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Rajasekar wrote:
> Hi,
>
> I have created <Default:Documentation> tag with reference to the
> OwnedComment attribute.
> .....
> List documentationToBeAdded = new ArrayList();
> saxParser.parse( new File(modelFilename), new
> TestHandler(documentationToBeAdded) );
>
> DocumentBuilder db =
> DocumentBuilderFactory.newInstance().newDocumentBuilder();
> Document doc= db.parse(new File(modelFilename));
> Element root = doc.getDocumentElement();
> Iterator it = documentationToBeAdded.iterator();
> while(it.hasNext()){
> String id = (String)it.next();
> Element docElem =
> doc.createElement("Default:Documentation");
Shouldn't you be using createElementNS? Does the xmlns declaration for
"Default" appear in the result?
> docElem.setAttribute("xmi:id", id+"0");
> docElem.setAttribute("base_Comment", id);
> root.appendChild(docElem);
> }
> ....
> Source src = new DOMSource(doc);
> Result dest = new StreamResult(new File(modelFilename));
> aTransformer.transform(src, dest);
>
> public class TestHandler extends HandlerBase
> {
> List documentationToBeAdded;
> public TestHandler(List documentationToBeAdded){
> this.documentationToBeAdded = documentationToBeAdded;
> }
>
> public void startElement (String name, AttributeList attrs)
> throws SAXException
> {
> if(name.equals("ownedComment")){
> String id = attrs.getValue(0);
> documentationToBeAdded.add(id);
> }
> }
>
>
> }
>
> After adding Default tag, my model is not opening up. I got
> "Documentaion" class not found error. After the investigation, I found
> i have missed adding Namespace and schema location to the root
> <xml:xmi>. When i manually add these the model is opening up and the
> comment is showing on Documentation tab.
>
> I could not find any help on how to add Namespace and schema location
> to root tag.
This is purely a DOM question, so it's best you find some documentation
on how to manipulate namespace aware DOMs.
>
> Please help me on this issue.
>
> Regards,
> Rajasekar.
>
Previous Topic:Navigation through associations
Next Topic:apply stereotype problem with static profile
Goto Forum:
  


Current Time: Sat Sep 20 22:08:25 GMT 2014

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

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