/[Apache-SVN]
ViewVC logotype

Revision 1862206


Jump to revision: Previous Next
Author: jleroux
Date: Thu Jun 27 11:49:22 2019 UTC (4 years, 10 months ago)
Changed paths: 18
Log Message:
Implemented: JSON entity data import and export utility
(OFBIZ-10966)

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
<Party partyId="123456" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
{“Party”: {"partyId":"123456","partyTypeId":"PERSON","statusId":"PARTY_ENABLED”}}

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
 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.

jleroux: I fixed 2 trivials things and at my request in last patch Jayansh added 
"JSON Data Export All" and "JSON Data Import Dir

Thanks: Jayansh Shinde 

Changed paths

Path Details
Directoryofbiz/ofbiz-framework/trunk/applications/commonext/webapp/ofbizsetup/WEB-INF/controller.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/commonext/widget/ofbizsetup/CommonScreens.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/build.gradle modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/config/WebtoolsUiLabels.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/JsonDsDump.groovy added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/servicedef/services.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/template/Main.ftl modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityExportAllJson.ftl added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityImportDirJson.ftl added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityImportJson.ftl added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/JsonDsDump.ftl added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26