(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
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862206 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-1032)
Karl:
Avoids rollback on create error to be able to store the entity instead
(previous mostly-inserts feature).
Matin:
I think, the data load with "mostly inserts" activated should fail on a
create-failure (what it does indeed already), so I see no need for a working
solution of a fallback store attempt. Consistently the Feature should be renamed
in the frontend from "mostly inserts" to "only inserts".
Kyra:
Additional trivial refactoring in the patch: I reduced the full qualified
classname of org.xml.sax.SAXException in method signatures to the simple name.
This incorperates the changes that Martin has mentioned above.
The unnecessary call to store() is removed, simplifying the process of creating
and deleting entities. (These changes were already in Martins old patch but had
the wrong format.) This means that the flag "mostly Inserts?" is not accurately
worded since as long as there is only create fail, all operations are rolled
back. So the second patch renames the flag and all appropriate parameters to
"onlyInserts".
jleroux: I made few no functional changes, apart not swallowing an exception
Thanks: Thanks Karl for the 1st patch, Martin to get further, and Kyra to
complete the whole with a final touch and help to quickly test
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1822310 13f79535-47bb-0310-9956-ffa450edef68
The exception is caused by foreign key constraint violation between ShipmentCostEstimate and CarrierShipmentMethod entities.
Currently, when creating a new product store using ofbizsetup component default data associated with the product store is loaded into the database using the following steps.
1. read default data from entity xml file and replace specific items in the read data and write to temp file.
2. use service=parseEntityXmlFile to load the processed file into database.
The issue with this method is that the temp file can present a problem when ofbiz is operating in multitenant mode.
The solution is to modify the relevant services so that no temp file needs generated.
jleroux: I simply used an UtilValidate.isNotEmpty() method in EntitySaxReader class
I was initially reluctant to these changes because you can no longer load the content of the GlAccountData.xml and ProductStoreData.xml files, or the files themselves, using the import XML feature of webtools. But those files are specific to the setup component, so they should not be missed, they are supposed to be used in this context only.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1740008 13f79535-47bb-0310-9956-ffa450edef68
1. Not thread safe.
2. Server files were being read/written without multi-user synchronization
3. Reads all UI labels into memory, then stores them in static memory, PLUS
4. Finds all references of those labels in project files and store those references in static memory (!!!)
5. Doesn't follow best practices for UI layout
It's amazing the original code worked. Even more amazing is the fact that this code made it into the project.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@776988 13f79535-47bb-0310-9956-ffa450edef68
[ \t]+$ => "" (empty)
Should be easier to review when committing changes with trailing spaces removed automatically by anyedit or such tool (please refer to http://docs.ofbiz.org/x/mg)
Of course this effort to remove trailing spaces has no functional implications.
Actually, I was doing a 1st commit and as it's long to upload, I got conflicts with r763135
In the meantime I did some refactoring also in *.java and *.groovy files :
){ => ) {
if( => if (
while( => while (
}else => } else
else{ => else {
switch( => switch (
try{ => try {
}catch => } catch
catch( => catch (
}finally{ => } finally {
So these changes are also in this commit, should not be a problem anyway.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@763175 13f79535-47bb-0310-9956-ffa450edef68
+ some correct changes done with this update of Labels Manager (I updated some wrong ones by hand to keep going forward...)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@739955 13f79535-47bb-0310-9956-ffa450edef68
I put also some svn:ignore for shark build and lib diretories and assetmaint/build
I did some by hand lately, too much to remember. They were files with old header but without copyright. A 1st attempt I suppose, will have to check this after this commit.
I add some problems to commit this patch in one piece because it's so huge (specially with Eclipse I had to turn to Tortoise) !
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@499486 13f79535-47bb-0310-9956-ffa450edef68