You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Archana Rai (JIRA)" <ji...@apache.org> on 2018/01/03 05:41:00 UTC

[jira] [Resolved] (OLINGO-1218) can not filter the string with "_"

     [ https://issues.apache.org/jira/browse/OLINGO-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Archana Rai resolved OLINGO-1218.
---------------------------------
    Resolution: Fixed

Hi,

The fix has been committed in the open source branch: https://git-wip-us.apache.org/repos/asf?p=olingo-odata2.git;a=commit;h=1577e4ea169f1a859a2c1d5b6b61f393e9576ad9

Thanks,
Archana

> can not filter the string with "_"
> ----------------------------------
>
>                 Key: OLINGO-1218
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1218
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.10
>            Reporter: Shumin Wang
>            Priority: Critical
>         Attachments: diff.patch
>
>
> Hello, 
> when I read all entityset, the result is 
> {panel:title=The result without filter}
> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/">
> <id>
> https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/CustomizedCardEntitySet
> </id>
> <title type="text">CustomizedCardEntitySet</title>
> <updated>2017-12-26T07:34:05.261Z</updated>
> <author>
> <name/>
> </author>
> <link href="CustomizedCardEntitySet" rel="self" title="CustomizedCardEntitySet"/>
> <entry>
> <id>
> https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/CustomizedCardEntitySet(519L)
> </id>
> <title type="text">CustomizedCardEntitySet</title>
> <updated>2017-12-26T07:34:05.261Z</updated>
> <category term="CardAdminService.CustomizedCardEntity" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
> <link href="CustomizedCardEntitySet(519L)" rel="edit" title="CustomizedCardEntity"/>
> <content type="application/xml">
> <m:properties>
> <d:CardName>tttt</d:CardName>
> <d:CardSubtitle>Card Subtitle</d:CardSubtitle>
> <d:CardTitle>tttt</d:CardTitle>
> <d:CardType>table</d:CardType>
> <d:CreateOn>2017-12-22T06:44:24.54</d:CreateOn>
> <d:CreatorId>I036207</d:CreatorId>
> <d:CreatorName>null null</d:CreatorName>
> *+{color:red}<d:Destination>northwind_CLONING_1</d:Destination>{color}+*
> <d:Id>519</d:Id>
> <d:Metadata>
> {"serviceUri":"/","entityType":"NorthwindModel.Category","entitySet":"Categories","columns":[{"column":"CategoryID","displayName":"Column 1","columnIndex":1},{"column":"Description","displayName":"Column 2","columnIndex":2},{"column":"CategoryName","displayName":"Column 3","columnIndex":3}],"url":"","keys":[],"primarySort":{"key":"","order":""},"secondarySort":{"key":"","order":""}}
> </d:Metadata>
> <d:ModifierId>I036207</d:ModifierId>
> <d:ModifierName>null null</d:ModifierName>
> <d:UpdateOn>2017-12-22T06:44:24.54</d:UpdateOn>
> </m:properties>
> </content>
> </entry>
> </feed>
> {panel}
> but when I add ?$filter=(Destination%20eq%20%27northwind_CLONING_1%27), the result is empty
> {panel:title=The result with filter}
> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/">
> <id>
> https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/CustomizedCardEntitySet
> </id>
> <title type="text">CustomizedCardEntitySet</title>
> <updated>2017-12-26T07:36:54.253Z</updated>
> <author>
> <name/>
> </author>
> <link href="CustomizedCardEntitySet" rel="self" title="CustomizedCardEntitySet"/>
> </feed>
> {panel}
> I have extend ODataJPAServiceFactory, in the class 
>     public ODataSingleProcessor createCustomODataProcessor(ODataJPAContext oDataJPAContext) {
>         return new CardAdminODataJPAProcessor(oDataJPAContext);
>     }
> the CardAdminODataJPAProcessor is extend ODataJPADefaultProcessor, and I have not override readEntitySet.
> {color:red}in the debug, I found the query becomes northwind\\_CLONING\\_1, instead of  northwind_CLONING_1. I do not why we encode it. {color}
> I found it is changed in class ODataExpressionParser
>   private static String updateValueIfWildcards(String value) {
>     if (value != null) {
>       value = value.replace("\\", "\\\\");
>       value = value.replace("%", "\\%");
>       value = value.replace("_", "\\_");
>     }
>     return value;
>   }
> but in my case _ is not wildcard.
> I have tested that this issue is not exist in version 2.0.8
> Thank you very much for help!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)