olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Bolz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OLINGO-1048) Exception Handling in Class ODataJPAQueryExtensionEntityListener
Date Fri, 18 Nov 2016 20:34:59 GMT

    [ https://issues.apache.org/jira/browse/OLINGO-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15677676#comment-15677676
] 

Michael Bolz commented on OLINGO-1048:
--------------------------------------

Hi [~aparr],

can you please take a look into the attached patch or the [feature branch|https://git1-us-west.apache.org/repos/asf?p=olingo-odata2.git;a=shortlog;h=refs/heads/OLINGO-1048-JPA-EntityListener]
if such a solution would fit your use case.

In the {{org.apache.olingo.odata2.jpa.processor.ref.listeners.CustomerQueryExtension.class}}
the {{getQuery(GetEntitySetUriInfo uriInfo, EntityManager em)}} check if a filter starts with
_name_ was requested and then throw an exception.
Sample URL: http://localhost:8080/SalesOrderProcessing.svc/Customers?$format=json&$filter=name%20eq%20%27test%27

Best Regards, Michael


> Exception Handling in Class ODataJPAQueryExtensionEntityListener
> ----------------------------------------------------------------
>
>                 Key: OLINGO-1048
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1048
>             Project: Olingo
>          Issue Type: New Feature
>    Affects Versions: V2 2.0.6
>         Environment: SAP HANA Cloud Platform
>            Reporter: Alexander Parr
>            Priority: Critical
>              Labels: ODataJPAQueryExtensionEntityListener, entitylistener, getQuery,
jpa
>         Attachments: 0001-OLINGO-1048-Add-exception-for-EntityListeners.patch
>
>
> Hi all,
> I'm extending class ODataJPAQueryExtensionEntityListener in order to modify the sql query
to our needs in getQuery methods. In some cases I like to return no entry / query (e.g. the
user has not the sufficient role) which is not possible currently as the default query will
be build in case one returns null see
> https://github.com/apache/olingo-odata2/blob/master/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAQueryBuilder.java#L74
> on the other hand there are cases in which I like to throw and error message of type
ODataException in method getQuery to propagate this information to the consumer instead of
returning an empty list.
> Best
> Alex



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message