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

Jayansh Shinde commented on OFBIZ-10966:
----------------------------------------

Agreed with you

_"Actually the path is missing in line 191 (same for XML, line 190) for Windows 
to work:_

_{{writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new 
FileOutputStream(outpath + "/" + filename), "UTF-8")))}}_

_I also think it should be used for *nix OS, else the file is always written at 
OFBiz root"_

Currently we put full path in filename to get it work otherwise its created at 
OFBiz root. 

There may be one more bug, if you provide both Filename and out directory it 
may be written at both locations :). 

So here its summarise as:

_filename_ is name with _Output directory =_ generate it in Ouput directory 
with given name. 

_filename_ only: No change in current behaviour.

Let me know can I fix this in XML data export as well,  or should create 
separate ticket for same.

 

> JSON entity data import and export utility
> ------------------------------------------
>
>                 Key: OFBIZ-10966
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10966
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>            Reporter: Jayansh Shinde
>            Assignee: Jayansh Shinde
>            Priority: Minor
>         Attachments: OFBIZ-10966.patch, exportJson.png, importJson.png
>
>
> Currently, we support import/export entity data in XML format.
>  Nowadays JSON is widely used in industry, we can have support for JSON 
> format which looks quite similar to XML support.
> Here is example of XML data and it's JSON version
> {code:java}
> <Party partyId="123456" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
> {code}
> {code:java}
> {“Party”: 
> {"partyId":"123456","partyTypeId":"PERSON","statusId":"PARTY_ENABLED”}}
> {code}
>  
> *Design Proposal*
> We can write *entityImportJson* and *entityImportDirJson* services for 
> importing JSON from screen and directory respectively.
> And the *entityExportAllJson* service for exporting entity data in JSON.
>  
> *Import Design*
>  The import service will perform following operations:
>  1.) Validate the input JSON data (I am in process of exploring the way for 
> this)
>  2.) On successful validation, convert JSON to OFBiz's entity model 
> (GenericValue)
>  3.) The GenericValue will be inserted in database by some handler class for 
> e.g we can write JsonDataHandler, it will convert given JSON to 
> List<GenericValue>, and finally write it to database (Similar pattern is used 
> in XML import).
>  
> *Export Design*
>  Based on existing XML pattern the writeXmlText method of GenericEntity class 
> write the exported data in XML format. 
>  In the similar way, we can implement writeJsonText to export data in JSON 
> format.
> Please free feel to share your thought.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to