You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Märker, Mathias <Ma...@tt-s.com> on 2015/08/28 15:09:48 UTC

WG: Sort of "Multi Origin Composition" for OData V2

Hi there,
For several days now I am trying to achieve the following:

I created an JPA Service which reflects my Database, this is working without any Problems.

Additionally I wanted to take the metadata of an different public service and enhance my own metadata with it. After long night sessions I thought I have it working by reading the public metdatda, parsing the Entities and Sets and Associations, replacing their namespace and so on(I case there is a simpler solution please let me know).

But now when I try to fetch the data from the public service via EntityProvider.readFeed and then later write the OData response via EntityProvider.writeFeed, I always get an exception because of missing attributes which shoudn't be null. Normally that would be ok but f.e. if I use $select=firstName the validation against the edm still fails because it determines that there are attributes which shouldn't be null.

So my main questions are:

1.      What is the best way to combine OData Services so I get 1 metadata document

2.      Why is writeFeed failing? And how can I tell it that I have an $select and only those attributes should be displayed?

In case my scenario can't be accomplished that would be a result as well ;)

Thanks in advance for your time an effort

Regards
Mathias


RE: Sort of "Multi Origin Composition" for OData V2

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Mathias,

in this case it could be easier to implement the SingleProcessor on your own. You can take guidance by looking at our ListsProcessor which is used in our integration test sample for some ideas.

Best Regards,
Christian

From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Montag, 31. August 2015 08:38
To: user@olingo.apache.org
Subject: AW: Sort of "Multi Origin Composition" for OData V2

Hi Christian,
thanks for the answer, I will try it. When you say "I haven´t seen any other implementation with JPA" would it be easier to implement a standard scenario with a SinglePrcocessor and handle the JPA manually, I only have two jpa entities but need around 7 Entities from the public service.

Regards
Mathias

Von: Amend, Christian [mailto:christian.amend@sap.com]
Gesendet: Freitag, 28. August 2015 15:38
An: user@olingo.apache.org<ma...@olingo.apache.org>
Betreff: RE: Sort of "Multi Origin Composition" for OData V2

Hi Mathias,


1.      The way you are doing this is what I would do. I haven´t seen any other implementation with JPA.

2.      Have you tried to pass an ExpandSelectTree to the writeFeed method? There you can specify which properties are selected. You can use the URIParser.buildExpandSelectTree() method to create such a tree. Then you pass this tree along with the EntityProviderWriteProperties.

Best Regards,
Christian

From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Freitag, 28. August 2015 15:10
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: WG: Sort of "Multi Origin Composition" for OData V2

Hi there,
For several days now I am trying to achieve the following:

I created an JPA Service which reflects my Database, this is working without any Problems.

Additionally I wanted to take the metadata of an different public service and enhance my own metadata with it. After long night sessions I thought I have it working by reading the public metdatda, parsing the Entities and Sets and Associations, replacing their namespace and so on(I case there is a simpler solution please let me know).

But now when I try to fetch the data from the public service via EntityProvider.readFeed and then later write the OData response via EntityProvider.writeFeed, I always get an exception because of missing attributes which shoudn't be null. Normally that would be ok but f.e. if I use $select=firstName the validation against the edm still fails because it determines that there are attributes which shouldn't be null.

So my main questions are:

1.      What is the best way to combine OData Services so I get 1 metadata document

2.      Why is writeFeed failing? And how can I tell it that I have an $select and only those attributes should be displayed?

In case my scenario can't be accomplished that would be a result as well ;)

Thanks in advance for your time an effort

Regards
Mathias


AW: Sort of "Multi Origin Composition" for OData V2

Posted by Märker, Mathias <Ma...@tt-s.com>.
Hi Christian,
thanks for the answer, I will try it. When you say "I haven´t seen any other implementation with JPA" would it be easier to implement a standard scenario with a SinglePrcocessor and handle the JPA manually, I only have two jpa entities but need around 7 Entities from the public service.

Regards
Mathias

Von: Amend, Christian [mailto:christian.amend@sap.com]
Gesendet: Freitag, 28. August 2015 15:38
An: user@olingo.apache.org
Betreff: RE: Sort of "Multi Origin Composition" for OData V2

Hi Mathias,


1.      The way you are doing this is what I would do. I haven´t seen any other implementation with JPA.

2.      Have you tried to pass an ExpandSelectTree to the writeFeed method? There you can specify which properties are selected. You can use the URIParser.buildExpandSelectTree() method to create such a tree. Then you pass this tree along with the EntityProviderWriteProperties.

Best Regards,
Christian

From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Freitag, 28. August 2015 15:10
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: WG: Sort of "Multi Origin Composition" for OData V2

Hi there,
For several days now I am trying to achieve the following:

I created an JPA Service which reflects my Database, this is working without any Problems.

Additionally I wanted to take the metadata of an different public service and enhance my own metadata with it. After long night sessions I thought I have it working by reading the public metdatda, parsing the Entities and Sets and Associations, replacing their namespace and so on(I case there is a simpler solution please let me know).

But now when I try to fetch the data from the public service via EntityProvider.readFeed and then later write the OData response via EntityProvider.writeFeed, I always get an exception because of missing attributes which shoudn't be null. Normally that would be ok but f.e. if I use $select=firstName the validation against the edm still fails because it determines that there are attributes which shouldn't be null.

So my main questions are:

1.      What is the best way to combine OData Services so I get 1 metadata document

2.      Why is writeFeed failing? And how can I tell it that I have an $select and only those attributes should be displayed?

In case my scenario can't be accomplished that would be a result as well ;)

Thanks in advance for your time an effort

Regards
Mathias


RE: Sort of "Multi Origin Composition" for OData V2

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Mathias,

setting the tree should give you a payload with only the properties you need. In order to construct the payload in an OData conform way Olingo needs these properties and all key properties. We need all key properties to construct the self-link.

So in your case you should set the expand select tree and your hash map needs to contain all selected property values as well as the key property values.
If you don`t have the key property values available you can use the content-only flag. Of course this also means that the Olingo library can`t provide the self-links in the payload.

Btw. Sorry for my late reply but I was on vacation and did not take a laptop with me :)

Best Regards,
Christian

From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Montag, 31. August 2015 09:35
To: user@olingo.apache.org
Subject: AW: Sort of "Multi Origin Composition" for OData V2

Hi Christian,
I tried that but it only does work when I set contentOnly(true) and the I am missing self links and so on, is hat intended or am I missing something else?

Regards
Mathias

Von: Amend, Christian [mailto:christian.amend@sap.com]
Gesendet: Freitag, 28. August 2015 15:38
An: user@olingo.apache.org<ma...@olingo.apache.org>
Betreff: RE: Sort of "Multi Origin Composition" for OData V2

Hi Mathias,


1.      The way you are doing this is what I would do. I haven´t seen any other implementation with JPA.

2.      Have you tried to pass an ExpandSelectTree to the writeFeed method? There you can specify which properties are selected. You can use the URIParser.buildExpandSelectTree() method to create such a tree. Then you pass this tree along with the EntityProviderWriteProperties.

Best Regards,
Christian

From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Freitag, 28. August 2015 15:10
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: WG: Sort of "Multi Origin Composition" for OData V2

Hi there,
For several days now I am trying to achieve the following:

I created an JPA Service which reflects my Database, this is working without any Problems.

Additionally I wanted to take the metadata of an different public service and enhance my own metadata with it. After long night sessions I thought I have it working by reading the public metdatda, parsing the Entities and Sets and Associations, replacing their namespace and so on(I case there is a simpler solution please let me know).

But now when I try to fetch the data from the public service via EntityProvider.readFeed and then later write the OData response via EntityProvider.writeFeed, I always get an exception because of missing attributes which shoudn't be null. Normally that would be ok but f.e. if I use $select=firstName the validation against the edm still fails because it determines that there are attributes which shouldn't be null.

So my main questions are:

1.      What is the best way to combine OData Services so I get 1 metadata document

2.      Why is writeFeed failing? And how can I tell it that I have an $select and only those attributes should be displayed?

In case my scenario can't be accomplished that would be a result as well ;)

Thanks in advance for your time an effort

Regards
Mathias


AW: Sort of "Multi Origin Composition" for OData V2

Posted by Märker, Mathias <Ma...@tt-s.com>.
Hi Christian,
I tried that but it only does work when I set contentOnly(true) and the I am missing self links and so on, is hat intended or am I missing something else?

Regards
Mathias

Von: Amend, Christian [mailto:christian.amend@sap.com]
Gesendet: Freitag, 28. August 2015 15:38
An: user@olingo.apache.org
Betreff: RE: Sort of "Multi Origin Composition" for OData V2

Hi Mathias,


1.      The way you are doing this is what I would do. I haven´t seen any other implementation with JPA.

2.      Have you tried to pass an ExpandSelectTree to the writeFeed method? There you can specify which properties are selected. You can use the URIParser.buildExpandSelectTree() method to create such a tree. Then you pass this tree along with the EntityProviderWriteProperties.

Best Regards,
Christian

From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Freitag, 28. August 2015 15:10
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: WG: Sort of "Multi Origin Composition" for OData V2

Hi there,
For several days now I am trying to achieve the following:

I created an JPA Service which reflects my Database, this is working without any Problems.

Additionally I wanted to take the metadata of an different public service and enhance my own metadata with it. After long night sessions I thought I have it working by reading the public metdatda, parsing the Entities and Sets and Associations, replacing their namespace and so on(I case there is a simpler solution please let me know).

But now when I try to fetch the data from the public service via EntityProvider.readFeed and then later write the OData response via EntityProvider.writeFeed, I always get an exception because of missing attributes which shoudn't be null. Normally that would be ok but f.e. if I use $select=firstName the validation against the edm still fails because it determines that there are attributes which shouldn't be null.

So my main questions are:

1.      What is the best way to combine OData Services so I get 1 metadata document

2.      Why is writeFeed failing? And how can I tell it that I have an $select and only those attributes should be displayed?

In case my scenario can't be accomplished that would be a result as well ;)

Thanks in advance for your time an effort

Regards
Mathias


RE: Sort of "Multi Origin Composition" for OData V2

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Mathias,



1.       The way you are doing this is what I would do. I haven´t seen any other implementation with JPA.

2.       Have you tried to pass an ExpandSelectTree to the writeFeed method? There you can specify which properties are selected. You can use the URIParser.buildExpandSelectTree() method to create such a tree. Then you pass this tree along with the EntityProviderWriteProperties.



Best Regards,

Christian



From: Märker, Mathias [mailto:Mathias.Maerker@tt-s.com]
Sent: Freitag, 28. August 2015 15:10
To: user@olingo.apache.org
Subject: WG: Sort of "Multi Origin Composition" for OData V2



Hi there,

For several days now I am trying to achieve the following:



I created an JPA Service which reflects my Database, this is working without any Problems.



Additionally I wanted to take the metadata of an different public service and enhance my own metadata with it. After long night sessions I thought I have it working by reading the public metdatda, parsing the Entities and Sets and Associations, replacing their namespace and so on(I case there is a simpler solution please let me know).



But now when I try to fetch the data from the public service via EntityProvider.readFeed and then later write the OData response via EntityProvider.writeFeed, I always get an exception because of missing attributes which shoudn't be null. Normally that would be ok but f.e. if I use $select=firstName the validation against the edm still fails because it determines that there are attributes which shouldn't be null.



So my main questions are:

1.      What is the best way to combine OData Services so I get 1 metadata document

2.      Why is writeFeed failing? And how can I tell it that I have an $select and only those attributes should be displayed?



In case my scenario can't be accomplished that would be a result as well ;)



Thanks in advance for your time an effort



Regards

Mathias