ofbiz-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Crum (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-5790) Json string parameters as a service input are not recognized by OFBiz ServiceEventHandler.
Date Sat, 25 Oct 2014 06:46:33 GMT

    [ https://issues.apache.org/jira/browse/OFBIZ-5790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14184003#comment-14184003

Adrian Crum commented on OFBIZ-5790:

I'm open to different proposals. What I am opposed to is judgement calls on code that hasn't
been written yet.

Using the JSON class I proposed, your example would look like this:

JSON json = JSON.from(attrMap);
String jsonString = json.toString();

Yes, the same thing could be done in a static utility method, but the idea is to introduce
a JSON data type in the framework so that it is clear to client code what it represents.

[Adam and I had this discussion when he was working on the current JSON code, and I recommended
we use a JSON data type instead of String. If a method accepts a JSON data type, you know
it is JSON, otherwise if a method accepts a String data type, you can assume the String contains
JSON, but you can't be sure.]

Integrating the JSON data type with the conversion framework will make it easier to use JSON
throughout the project. That single simple integration brings with it the advantages of automatically
adding JSON support to the service engine, Mini-language, screen widgets, etc.

> Json string parameters as a service input are not recognized by OFBiz ServiceEventHandler.
> ------------------------------------------------------------------------------------------
>                 Key: OFBIZ-5790
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5790
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: Trunk
>            Reporter: Amardeep Singh Jhajj
>            Priority: Minor
>         Attachments: CommonEvents.java.patch, JSON.java.patch, OFBIZ-5790.patch, jackson-annotations-2.4.0.jar,
jackson-core-2.4.2.jar, jackson-databind-2.4.2.jar
> I was trying to pass the Json string as a input to a service, but is not recognized by
> Example Json String- {"faciltyId": "WebStoreWarehouse"}
> I worked on this issue and attached a patch here. Here I have used Jackson Json library
for parsing.

This message was sent by Atlassian JIRA

View raw message