Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » OHF » ProvideAndRegisterDocumentSetType --> OMElement
ProvideAndRegisterDocumentSetType --> OMElement [message #45932] Tue, 19 August 2008 13:00 Go to next message
Stefan S. is currently offline Stefan S.Friend
Messages: 22
Registered: July 2009
Junior Member
Hi Everybody!

I have a very basic question - at least I hope it is basic ;) - that is
bothering me for days now!

I have metadata - received by an ITI-15 request - in form of an
ProvideAndRegisterDocumentSetType. Now I am changing and adding some
specific attributes. As an example - just for testing - I am trying to
add a XDSDocumentEntry.size to every DocumentEntryType with a simple loop
like:

for (DocumentEntryType documentEntry :
(EList<DocumentEntryType>)xdsMetadata.getDocumentEntry()) {
documentEntry.setSize("123456");
}

Now my problem is, that I want to send this "modified" metadata to an IHE
Registry using ITI-14.

Therefore I have to convert this metadata
-ProvideAndRegisterDocumentSetType - to an OMElement.

But I am really stuck on how to solve this problem.
I hope someone can help me!

Thanks in Advance for both your time and your knowledge!

Greetings
Stefan
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #46040 is a reply to message #45932] Tue, 19 August 2008 19:44 Go to previous messageGo to next message
Matthew DavisFriend
Messages: 269
Registered: July 2009
Senior Member
Hi Stefan,

Indeed this is --- kinda simple. So, one thing to start with is - when
sending the payload to the registry from a repository, you will need to
convert from the ProvideAndRegisterDocumentSetType back to an ebXML
SubmitObjectsRequestType. Once you're back into that type, then you can
submit to the repository.

The way we handle this in the XDS Source and XDS Consumer is
straightforward. In general, it requires three things:

1. Convert the ProvideAndRegisterDocumentSetType (XDS) object to
SubmitObjectsRequestType (ebXML) object
2. Convert the EMF-created SubmitObjectsRequestType object to a DOM object
3. Convert the DOM object to OM for use with Axis2.


Converting from ProvideAndRegisterDocumentSetType (XDS) object to
SubmitObjectsRequestType (ebXML) object
---

For XDS.a:

EbXML_2_1ProvideAndRegisterDocumentSetTransformer setTransformer = new
EbXML_2_1ProvideAndRegisterDocumentSetTransformer();
setTransformer.transform(prDocumentSetTypeObject);
SubmitObjectsRequestType submitObjectsRequest =
setTransformer.getSubmitReq()


For XDS.b:

EbXML_3_0ProvideAndRegisterDocumentSetTransformer setTransformer = new
EbXML_3_0ProvideAndRegisterDocumentSetTransformer();
setTransformer.transform(prDocumentSetTypeObject);
SubmitObjectsRequestType submitObjectsRequest =
setTransformer.getSubmitReq()



Converting from EMF to DOM
---
This conversion requires the creation of an empty DOM Document and then
using the EMF XMLResource's "save" method to save EMF to DOM. Code
snippet looks something like this:

// Create DOM Document Instance
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
org.w3c.dom.Document domDocument = builder.newDocument();

// Convert / "save" EMF to DOM
RegistryPackage packageInstance = RegistryPackage.eINSTANCE;
DocumentRoot root = RegistryFactory.eINSTANCE.createDocumentRoot();
root.setSubmitObjectsRequest(submitObjectsRequest);
XMLResource resource = (XMLResource)(new
RegistryResourceFactoryImpl()).createResource(URI.createURI( RegistryPackage.eNS_URI));
resource.getContents().add(root);
resource.save(domDocument, new HashMap(), new DefaultDOMHandlerImpl());
resource.unload();

Element domElement = domDocument.getDocumentElement();



Converting from DOM to OM
---
Apache Axis provides a utility to convert from DOM to OM (and back).
Use this:

OMElement omElement = org.apache.axis2.util.XMLUtils.toOM(domElement);




The P&R element should now be "sendable" over the wire.

I put this together pretty fast, so I'm sure I missed something, but
might give it a try!

-Matt



Stefan S. wrote:
> Hi Everybody!
>
> I have a very basic question - at least I hope it is basic ;) - that is
> bothering me for days now!
>
> I have metadata - received by an ITI-15 request - in form of an
> ProvideAndRegisterDocumentSetType. Now I am changing and adding some
> specific attributes. As an example - just for testing - I am trying to
> add a XDSDocumentEntry.size to every DocumentEntryType with a simple
> loop like:
>
> for (DocumentEntryType documentEntry :
> (EList<DocumentEntryType>)xdsMetadata.getDocumentEntry()) {
> documentEntry.setSize("123456");
> }
>
> Now my problem is, that I want to send this "modified" metadata to an
> IHE Registry using ITI-14.
> Therefore I have to convert this metadata
> -ProvideAndRegisterDocumentSetType - to an OMElement.
>
> But I am really stuck on how to solve this problem.
> I hope someone can help me!
>
> Thanks in Advance for both your time and your knowledge!
>
> Greetings
> Stefan
>
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #46101 is a reply to message #46040] Wed, 20 August 2008 05:43 Go to previous messageGo to next message
Stefan S. is currently offline Stefan S.Friend
Messages: 22
Registered: July 2009
Junior Member
Hi Matt!

Thanks for your answer.

Indeed it is very simple, if you know how to do it! ;)

Greetings
Stefan
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #46131 is a reply to message #46101] Wed, 20 August 2008 07:12 Go to previous messageGo to next message
Stefan S. is currently offline Stefan S.Friend
Messages: 22
Registered: July 2009
Junior Member
Hi Matt!

After examining your code fragment in detail I stumbled across the
following "problem" and would like to present my solution, just in case
someone experiences the same problem.

The presented example contains the following:

// Convert / "save" EMF to DOM
RegistryPackage packageInstance = RegistryPackage.eINSTANCE;
DocumentRoot root = RegistryFactory.eINSTANCE.createDocumentRoot();
root.setSubmitObjectsRequest(submitObjectsRequest);

The "problem" is, that the class/interface DocumentRoot -
org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot - as returned by
RegistryFactory.eINSTANCE.createDocumentRoot() does not contain a method
"setSubmitObjectsRequest".

My "solution" - or approach - is to use the method "setRegisterRequest()",
as shown in the lines below:

org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot root =
RegistryFactory.eINSTANCE.createDocumentRoot();
root.setRegistryRequest(submitObjectsRequest);

It seems to work, so I think the "problem" is saved. Thanks again for your
help!

Greetings
Stefan
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #46342 is a reply to message #46131] Thu, 21 August 2008 01:24 Go to previous message
Matthew DavisFriend
Messages: 269
Registered: July 2009
Senior Member
Ah - good catch! I shouldn't have been as ambiguous with those Java
package names. Thanks for the clarification!

-Matt

Stefan S. wrote:
> Hi Matt!
>
> After examining your code fragment in detail I stumbled across the
> following "problem" and would like to present my solution, just in case
> someone experiences the same problem.
>
> The presented example contains the following:
>
> // Convert / "save" EMF to DOM
> RegistryPackage packageInstance = RegistryPackage.eINSTANCE;
> DocumentRoot root = RegistryFactory.eINSTANCE.createDocumentRoot();
> root.setSubmitObjectsRequest(submitObjectsRequest);
>
> The "problem" is, that the class/interface DocumentRoot -
> org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot - as returned by
> RegistryFactory.eINSTANCE.createDocumentRoot() does not contain a method
> "setSubmitObjectsRequest".
>
> My "solution" - or approach - is to use the method
> "setRegisterRequest()", as shown in the lines below:
>
> org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot root =
> RegistryFactory.eINSTANCE.createDocumentRoot();
> root.setRegistryRequest(submitObjectsRequest);
>
> It seems to work, so I think the "problem" is saved. Thanks again for
> your help!
>
> Greetings
> Stefan
>
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #586885 is a reply to message #45932] Tue, 19 August 2008 19:44 Go to previous message
Matthew DavisFriend
Messages: 269
Registered: July 2009
Senior Member
Hi Stefan,

Indeed this is --- kinda simple. So, one thing to start with is - when
sending the payload to the registry from a repository, you will need to
convert from the ProvideAndRegisterDocumentSetType back to an ebXML
SubmitObjectsRequestType. Once you're back into that type, then you can
submit to the repository.

The way we handle this in the XDS Source and XDS Consumer is
straightforward. In general, it requires three things:

1. Convert the ProvideAndRegisterDocumentSetType (XDS) object to
SubmitObjectsRequestType (ebXML) object
2. Convert the EMF-created SubmitObjectsRequestType object to a DOM object
3. Convert the DOM object to OM for use with Axis2.


Converting from ProvideAndRegisterDocumentSetType (XDS) object to
SubmitObjectsRequestType (ebXML) object
---

For XDS.a:

EbXML_2_1ProvideAndRegisterDocumentSetTransformer setTransformer = new
EbXML_2_1ProvideAndRegisterDocumentSetTransformer();
setTransformer.transform(prDocumentSetTypeObject);
SubmitObjectsRequestType submitObjectsRequest =
setTransformer.getSubmitReq()


For XDS.b:

EbXML_3_0ProvideAndRegisterDocumentSetTransformer setTransformer = new
EbXML_3_0ProvideAndRegisterDocumentSetTransformer();
setTransformer.transform(prDocumentSetTypeObject);
SubmitObjectsRequestType submitObjectsRequest =
setTransformer.getSubmitReq()



Converting from EMF to DOM
---
This conversion requires the creation of an empty DOM Document and then
using the EMF XMLResource's "save" method to save EMF to DOM. Code
snippet looks something like this:

// Create DOM Document Instance
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
org.w3c.dom.Document domDocument = builder.newDocument();

// Convert / "save" EMF to DOM
RegistryPackage packageInstance = RegistryPackage.eINSTANCE;
DocumentRoot root = RegistryFactory.eINSTANCE.createDocumentRoot();
root.setSubmitObjectsRequest(submitObjectsRequest);
XMLResource resource = (XMLResource)(new
RegistryResourceFactoryImpl()).createResource(URI.createURI( RegistryPackage.eNS_URI));
resource.getContents().add(root);
resource.save(domDocument, new HashMap(), new DefaultDOMHandlerImpl());
resource.unload();

Element domElement = domDocument.getDocumentElement();



Converting from DOM to OM
---
Apache Axis provides a utility to convert from DOM to OM (and back).
Use this:

OMElement omElement = org.apache.axis2.util.XMLUtils.toOM(domElement);




The P&R element should now be "sendable" over the wire.

I put this together pretty fast, so I'm sure I missed something, but
might give it a try!

-Matt



Stefan S. wrote:
> Hi Everybody!
>
> I have a very basic question - at least I hope it is basic ;) - that is
> bothering me for days now!
>
> I have metadata - received by an ITI-15 request - in form of an
> ProvideAndRegisterDocumentSetType. Now I am changing and adding some
> specific attributes. As an example - just for testing - I am trying to
> add a XDSDocumentEntry.size to every DocumentEntryType with a simple
> loop like:
>
> for (DocumentEntryType documentEntry :
> (EList<DocumentEntryType>)xdsMetadata.getDocumentEntry()) {
> documentEntry.setSize("123456");
> }
>
> Now my problem is, that I want to send this "modified" metadata to an
> IHE Registry using ITI-14.
> Therefore I have to convert this metadata
> -ProvideAndRegisterDocumentSetType - to an OMElement.
>
> But I am really stuck on how to solve this problem.
> I hope someone can help me!
>
> Thanks in Advance for both your time and your knowledge!
>
> Greetings
> Stefan
>
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #586911 is a reply to message #46040] Wed, 20 August 2008 05:43 Go to previous message
Stefan S. is currently offline Stefan S.Friend
Messages: 22
Registered: July 2009
Junior Member
Hi Matt!

Thanks for your answer.

Indeed it is very simple, if you know how to do it! ;)

Greetings
Stefan
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #586921 is a reply to message #46101] Wed, 20 August 2008 07:12 Go to previous message
Stefan S. is currently offline Stefan S.Friend
Messages: 22
Registered: July 2009
Junior Member
Hi Matt!

After examining your code fragment in detail I stumbled across the
following "problem" and would like to present my solution, just in case
someone experiences the same problem.

The presented example contains the following:

// Convert / "save" EMF to DOM
RegistryPackage packageInstance = RegistryPackage.eINSTANCE;
DocumentRoot root = RegistryFactory.eINSTANCE.createDocumentRoot();
root.setSubmitObjectsRequest(submitObjectsRequest);

The "problem" is, that the class/interface DocumentRoot -
org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot - as returned by
RegistryFactory.eINSTANCE.createDocumentRoot() does not contain a method
"setSubmitObjectsRequest".

My "solution" - or approach - is to use the method "setRegisterRequest()",
as shown in the lines below:

org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot root =
RegistryFactory.eINSTANCE.createDocumentRoot();
root.setRegistryRequest(submitObjectsRequest);

It seems to work, so I think the "problem" is saved. Thanks again for your
help!

Greetings
Stefan
Re: ProvideAndRegisterDocumentSetType --> OMElement [message #587006 is a reply to message #46131] Thu, 21 August 2008 01:24 Go to previous message
Matthew DavisFriend
Messages: 269
Registered: July 2009
Senior Member
Ah - good catch! I shouldn't have been as ambiguous with those Java
package names. Thanks for the clarification!

-Matt

Stefan S. wrote:
> Hi Matt!
>
> After examining your code fragment in detail I stumbled across the
> following "problem" and would like to present my solution, just in case
> someone experiences the same problem.
>
> The presented example contains the following:
>
> // Convert / "save" EMF to DOM
> RegistryPackage packageInstance = RegistryPackage.eINSTANCE;
> DocumentRoot root = RegistryFactory.eINSTANCE.createDocumentRoot();
> root.setSubmitObjectsRequest(submitObjectsRequest);
>
> The "problem" is, that the class/interface DocumentRoot -
> org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot - as returned by
> RegistryFactory.eINSTANCE.createDocumentRoot() does not contain a method
> "setSubmitObjectsRequest".
>
> My "solution" - or approach - is to use the method
> "setRegisterRequest()", as shown in the lines below:
>
> org.eclipse.ohf.ihe.common.ebxml._3._0.rs.DocumentRoot root =
> RegistryFactory.eINSTANCE.createDocumentRoot();
> root.setRegistryRequest(submitObjectsRequest);
>
> It seems to work, so I think the "problem" is saved. Thanks again for
> your help!
>
> Greetings
> Stefan
>
Previous Topic:Query Document Failure using the OHF
Next Topic:ITI-14 - RetrieveDocument URI (Length Problem)
Goto Forum:
  


Current Time: Fri Apr 19 06:00:39 GMT 2024

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

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

Back to the top