Author: mthl
Date: Sun Sep 22 12:29:54 2019 New Revision: 1867342 URL: http://svn.apache.org/viewvc?rev=1867342&view=rev Log: Reverted: JSON entity data import and export utility (OFBIZ-10966) Implementation was not matching OFBiz code quality requirements. Removed: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/JsonDsDump.groovy ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonEvents.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityExportAllJson.ftl ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityImportDirJson.ftl ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityImportJson.ftl ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/JsonDsDump.ftl Modified: ofbiz/ofbiz-framework/trunk/applications/commonext/webapp/ofbizsetup/WEB-INF/controller.xml ofbiz/ofbiz-framework/trunk/applications/commonext/widget/ofbizsetup/CommonScreens.xml ofbiz/ofbiz-framework/trunk/build.gradle ofbiz/ofbiz-framework/trunk/framework/webtools/config/WebtoolsUiLabels.xml ofbiz/ofbiz-framework/trunk/framework/webtools/servicedef/services.xml ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java ofbiz/ofbiz-framework/trunk/framework/webtools/template/Main.ftl ofbiz/ofbiz-framework/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml Modified: ofbiz/ofbiz-framework/trunk/applications/commonext/webapp/ofbizsetup/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/commonext/webapp/ofbizsetup/WEB-INF/controller.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/commonext/webapp/ofbizsetup/WEB-INF/controller.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/commonext/webapp/ofbizsetup/WEB-INF/controller.xml Sun Sep 22 12:29:54 2019 @@ -58,17 +58,6 @@ <response name="success" type="view" value="EntityExportAll"/> <response name="error" type="view" value="EntityExportAll"/> </request-map> - <request-map uri="EntityExportAllJson"> - <security https="true" auth="true"/> - <response name="success" type="view" value="EntityExportAllJson"/> - <response name="error" type="view" value="EntityExportAllJson"/> - </request-map> - <request-map uri="entityExportAllJson"> - <security https="true" auth="true"/> - <event type="service" path="" invoke="entityExportAllJson"/> - <response name="success" type="view" value="EntityExportAllJson"/> - <response name="error" type="view" value="EntityExportAllJson"/> - </request-map> <!-- ================ Product Store Requests ============= --> <request-map uri="FindProductStore"> @@ -217,7 +206,6 @@ <view-map name="EditProductStore" type="screen" page="component://commonext/widget/ofbizsetup/SetupScreens.xml#EditProductStore"/> <view-map name="EntityExportAll" type="screen" page="component://commonext/widget/ofbizsetup/CommonScreens.xml#EntityExportAll"/> - <view-map name="EntityExportAllJson" type="screen" page="component://commonext/widget/ofbizsetup/CommonScreens.xml#EntityExportAllJson"/> <view-map name="FindWebSite" type="screen" page="component://commonext/widget/ofbizsetup/SetupScreens.xml#FindWebSite"/> <view-map name="EditWebSite" type="screen" page="component://commonext/widget/ofbizsetup/SetupScreens.xml#EditWebSite"/> Modified: ofbiz/ofbiz-framework/trunk/applications/commonext/widget/ofbizsetup/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/commonext/widget/ofbizsetup/CommonScreens.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/commonext/widget/ofbizsetup/CommonScreens.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/commonext/widget/ofbizsetup/CommonScreens.xml Sun Sep 22 12:29:54 2019 @@ -153,26 +153,4 @@ </widgets> </section> </screen> - <screen name="EntityExportAllJson"> - <section> - <actions> - <set field="titleProperty" value="PageTitleEntityExportAllJson"/> - <set field="tabButtonItem" value="entityExportAllJson"/> - <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/> - <set field="results" from-field="parameters.results"/> - <set field="headerItem" value="export"/> - </actions> - <widgets> - <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> - <screenlet title="${uiLabelMap.PageTitleEntityExportAllJson}"> - <platform-specific> - <html><html-template location="component://webtools/template/entity/EntityExportAllJson.ftl"/></html> - </platform-specific> - </screenlet> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> </screens> Modified: ofbiz/ofbiz-framework/trunk/build.gradle URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/build.gradle?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/build.gradle (original) +++ ofbiz/ofbiz-framework/trunk/build.gradle Sun Sep 22 12:29:54 2019 @@ -202,7 +202,6 @@ dependencies { implementation 'wsdl4j:wsdl4j:1.6.3' implementation 'org.jsoup:jsoup:1.12.1' implementation 'com.auth0:java-jwt:3.8.2' - implementation 'org.json:json:20140107' testImplementation 'org.hamcrest:hamcrest:2.1' testImplementation 'org.hamcrest:hamcrest-library:2.1' // Enable junit4 to not depend on hamcrest-1.3 testImplementation 'org.mockito:mockito-core:3.0.0' Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/config/WebtoolsUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/config/WebtoolsUiLabels.xml Sun Sep 22 12:29:54 2019 @@ -98,15 +98,6 @@ <value xml:lang="zh">没ææå®çæ件å/ç½åæå®æ´çXMLææ¡£ï¼ä»ä¹ä¹ä¸åã</value> <value xml:lang="zh-TW">æ²ææå®çæªæ¡å/網åæå®æ´çXMLæª,ä»éº¼ä¹ä¸å.</value> </property> - <property key="EntityImportNoJsonFileSpecified"> - <value xml:lang="en">No filename/URL or complete JSON document specified, doing nothing.</value> - <value xml:lang="fr">Pas de fichier, URL ou flux JSON fournit, aucune action réalisée.</value> - <value xml:lang="it">Nessun nome file/URL o documento JSON completo specificato, nientre verrà fatto.</value> - <value xml:lang="ja">ãã¡ã¤ã«å/URLã¾ãã¯å®å ¨ãªJSONææ¸ãæå®ããã¦ãã¾ãããå¦çãè¡ãã¾ããã</value> - <value xml:lang="vi">Không Táºp tin/URL hoặc tà i liá»u JSON hoà n chá»nh nà o Äược xác Äá»nh nên há» thá»ng sẽ không là m gì cả.</value> - <value xml:lang="zh">没ææå®çæ件å/ç½åæå®æ´çJSONææ¡£ï¼ä»ä¹ä¹ä¸åã</value> - <value xml:lang="zh-TW">æ²ææå®çæªæ¡å/網åæå®æ´çJSONæª,ä»éº¼ä¹ä¸å.</value> - </property> <property key="EntityImportNumberOfEntityToBeProcessed"> <value xml:lang="en">Got ${numberRead} entities from ${fileName}</value> <value xml:lang="fr">Chargement de ${numberRead} entités depuis ${fileName}</value> @@ -125,15 +116,6 @@ <value xml:lang="zh">解æå®ä½XMLæ件æ¶åºéï¼${errorString}</value> <value xml:lang="zh-TW">解æè³æ實é«XMLæªæåºé¯:${errorString}</value> </property> - <property key="EntityImportJsonParsingError"> - <value xml:lang="en">ERROR parsing Entity Json file: ${errorString}</value> - <value xml:lang="fr">ERREUR dans l'analyse de l'JSON : ${errorString}</value> - <value xml:lang="it">ERRORE di parsing file entità JSON: ${errorString}</value> - <value xml:lang="ja">ã¨ã³ãã£ãã£JSONãã¡ã¤ã«ãã¼ã¹æã«ã¨ã©ã¼: ${errorString}</value> - <value xml:lang="vi">Lá»I khi phân tÃch táºp tin JSON Thá»±c thá»: ${errorString}</value> - <value xml:lang="zh">解æå®ä½JSONæ件æ¶åºéï¼${errorString}</value> - <value xml:lang="zh-TW">解æè³æ實é«JSONæªæåºé¯:${errorString}</value> - </property> <property key="EntityImportPassedFile"> <value xml:lang="en">Pass ${passes} complete</value> <value xml:lang="fr">Passe ${passes} complete</value> @@ -531,32 +513,6 @@ <value xml:lang="zh">XMLæ°æ®å¯¼åºå ¨é¨</value> <value xml:lang="zh-TW">XMLè³æå¯åºå ¨é¨</value> </property> - <property key="PageTitleEntityExportJson"> - <value xml:lang="de">JSON-Daten exportieren</value> - <value xml:lang="en">JSON Data Export</value> - <value xml:lang="fr">Export de données JSON</value> - <value xml:lang="it">Esporta dati in JSON</value> - <value xml:lang="ja">JSONãã¼ã¿ã¨ã¯ã¹ãã¼ã</value> - <value xml:lang="pt">Exportação de dados JSON</value> - <value xml:lang="ro">Exporta Date in JSON</value> - <value xml:lang="th">สà¹à¸à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥ json</value> - <value xml:lang="vi">Kết xuất dữ liá»u JSON</value> - <value xml:lang="zh">JSONæ°æ®å¯¼åº</value> - <value xml:lang="zh-TW">JSONè³æå¯åº</value> - </property> - <property key="PageTitleEntityExportAllJson"> - <value xml:lang="de">Alle JSON-Daten exportieren</value> - <value xml:lang="en">JSON Data Export All</value> - <value xml:lang="fr">Exporter toutes les données JSON</value> - <value xml:lang="it">Esporta tutti i dati in JSON</value> - <value xml:lang="ja">JSONãã¼ã¿ããã¹ã¦ã¨ã¯ã¹ãã¼ã</value> - <value xml:lang="pt">Exportação de todos os dados JSON</value> - <value xml:lang="ro">Exporta Toate Datele in JSON</value> - <value xml:lang="th">สà¹à¸à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥ JSON à¸à¸±à¹à¸à¸«à¸¡à¸</value> - <value xml:lang="vi">Kết xuất tất cả dữ liá»u JSON</value> - <value xml:lang="zh">JSONæ°æ®å¯¼åºå ¨é¨</value> - <value xml:lang="zh-TW">JSONè³æå¯åºå ¨é¨</value> - </property> <property key="PageTitleEntityImport"> <value xml:lang="de">XML-Daten importieren</value> <value xml:lang="en">XML Data Import</value> @@ -583,32 +539,6 @@ <value xml:lang="zh">XMLæ°æ®å¯¼å ¥ç®å½ </value> <value xml:lang="zh-TW">XMLè³æå¯å ¥ç®é </value> </property> - <property key="PageTitleEntityImportJson"> - <value xml:lang="de">JSON-Daten importieren</value> - <value xml:lang="en">JSON Data Import</value> - <value xml:lang="fr">Import de données JSON</value> - <value xml:lang="it">Importa dati da JSON</value> - <value xml:lang="ja">JSONãã¼ã¿ã¤ã³ãã¼ã</value> - <value xml:lang="pt">Importar dados JSON</value> - <value xml:lang="ro">Importa Datele din JSON</value> - <value xml:lang="th">à¸à¸³à¹à¸à¹à¸²à¸à¹à¸à¸¡à¸¹à¸¥ json</value> - <value xml:lang="vi">Nháºp khẩu dữ liá»u JSON</value> - <value xml:lang="zh">JSONæ°æ®å¯¼å ¥</value> - <value xml:lang="zh-TW">JSONè³æå¯å ¥</value> - </property> - <property key="PageTitleEntityImportDirJson"> - <value xml:lang="de">JSON Datenimport aus Verzeichnis</value> - <value xml:lang="en">JSON Data Import Dir</value> - <value xml:lang="fr">Import de données JSON depuis un répertoire</value> - <value xml:lang="it">Importa dati JSON in directory</value> - <value xml:lang="ja">JSONãã¼ã¿ã¤ã³ãã¼ããã£ã¬ã¯ããª</value> - <value xml:lang="pt">Importar dados JSON em diretório</value> - <value xml:lang="ro">Importa Datele din JSON in Directory</value> - <value xml:lang="th">à¸à¸³à¹à¸à¹à¸²à¸à¹à¸à¸¡à¸¹à¸¥ json à¹à¸ Directory</value> - <value xml:lang="vi">ThÆ° mục nháºp khẩu JSON</value> - <value xml:lang="zh">JSONæ°æ®å¯¼å ¥ç®å½ </value> - <value xml:lang="zh-TW">JSONè³æå¯å ¥ç®é </value> - </property> <property key="PageTitleEntityImportReaders"> <value xml:lang="de">Leser für XML Datenimport</value> <value xml:lang="en">XML Data Import Readers</value> @@ -1290,19 +1220,6 @@ <value xml:lang="zh">å®æXMLææ¡£ (æ ¹æ ç¾: entity-engine-xml)</value> <value xml:lang="zh-TW">å®æXMLæª (æ ¹æ¨ç°½: entity-engine-xml)</value> </property> - <property key="WebtoolsCompleteJsonData"> - <value xml:lang="de">Vollständiges JSON dokument</value> - <value xml:lang="en">Complete JSON data</value> - <value xml:lang="fr">Compléter le data JSON</value> - <value xml:lang="it">Documento JSON</value> - <value xml:lang="ja">JSONããã¥ã¡ã³ããå®äºãã</value> - <value xml:lang="pt">Documento JSON completo</value> - <value xml:lang="ro">Completeaza documentul JSON</value> - <value xml:lang="th">à¹à¸à¸à¸ªà¸²à¸£ JSON à¹à¸ªà¸£à¹à¸à¹à¸£à¸µà¸¢à¸à¸£à¹à¸à¸¢à¹à¸¥à¹à¸§</value> - <value xml:lang="vi">Hoà n thà nh tà i liá»u JSON</value> - <value xml:lang="zh">å®æJSONææ¡£</value> - <value xml:lang="zh-TW">å®æJSONæª</value> - </property> <property key="WebtoolsComponentsLoaded"> <value xml:lang="de">Komponenten geladen</value> <value xml:lang="en">Loaded Components</value> @@ -2080,18 +1997,6 @@ <value xml:lang="zh">å®ä½XMLå·¥å ·</value> <value xml:lang="zh-TW">è³æ實é«XMLå·¥å ·</value> </property> - <property key="WebtoolsEntityJSONTools"> - <value xml:lang="de">Entität JSON Tools</value> - <value xml:lang="en">Entity JSON Tools</value> - <value xml:lang="fr">Outils JSON d'entité</value> - <value xml:lang="it">Strumenti JSON per entità </value> - <value xml:lang="ja">ã¨ã³ãã£ãã£JSONãã¼ã«</value> - <value xml:lang="ro">Instrumente pentru Entitatea JSON</value> - <value xml:lang="th">à¹à¸à¸£à¸·à¹à¸à¸à¸¡à¸·à¸ Entity JSON </value> - <value xml:lang="vi">Công cụ JSON Thá»±c thá»</value> - <value xml:lang="zh">å®ä½JSONå·¥å ·</value> - <value xml:lang="zh-TW">è³æ實é«XMLå·¥å ·</value> - </property> <property key="WebtoolsEnvName"> <value xml:lang="de">Umgebungsname</value> <value xml:lang="en">Env Name</value> @@ -2281,19 +2186,6 @@ <value xml:lang="zh">ä»æ°æ®æºå¯¼åºXML</value> <value xml:lang="zh-TW">å¾è³ææºå¯åºXML</value> </property> - <property key="WebtoolsExportJSONFromDataSource"> - <value xml:lang="de">JSON Export aus der Datenquelle</value> - <value xml:lang="en">JSON Export from DataSource(s)</value> - <value xml:lang="fr">Export JSON depuis les sources de données</value> - <value xml:lang="it">Esportazione JSON da Datasource</value> - <value xml:lang="ja">ãã¼ã¿ã½ã¼ã¹ããJSONãã¨ã¯ã¹ãã¼ã</value> - <value xml:lang="pt">Exportar de JSON DataSource(s)</value> - <value xml:lang="ro">Exporta Sursa Date in JSON</value> - <value xml:lang="th">JSON à¸à¸µà¹à¸¡à¸²à¸à¸²à¸à¹à¸«à¸¥à¹à¸à¸à¹à¸à¸¡à¸¹à¸¥</value> - <value xml:lang="vi">Kết xuất JSON từ nguá»n dữ liá»u</value> - <value xml:lang="zh">ä»æ°æ®æºå¯¼åºJSON</value> - <value xml:lang="zh-TW">å¾è³ææºå¯åºJSON</value> - </property> <property key="WebtoolsExportable"> <value xml:lang="de">Exportierbar</value> <value xml:lang="en">Exportable</value> @@ -2748,19 +2640,6 @@ <value xml:lang="zh">æXMLå¯¼å ¥å°æ°æ®æº</value> <value xml:lang="zh-TW">æXMLå¯å ¥å°è³ææº</value> </property> - <property key="WebtoolsJsonImportToDataSource"> - <value xml:lang="de">JSON-Import in DataSource(n)</value> - <value xml:lang="en">JSON Import to DataSource(s)</value> - <value xml:lang="fr">Import JSON vers la source de données</value> - <value xml:lang="it">Importazione JSON in Datasource</value> - <value xml:lang="ja">ãã¼ã¿ã½ã¼ã¹ã«JSONãã¤ã³ãã¼ã</value> - <value xml:lang="pt">Importar JSON para DataSource(s)</value> - <value xml:lang="ro">Importa Sursa de Date din JSON</value> - <value xml:lang="th">à¸à¸³à¹à¸à¹à¸² JSON à¹à¸à¸¢à¸±à¸à¹à¸«à¸¥à¹à¸à¸à¹à¸à¸¡à¸¹à¸¥</value> - <value xml:lang="vi">Nháºp khẩu JSON từ nguá»n dữ liá»u</value> - <value xml:lang="zh">æJSONå¯¼å ¥å°æ°æ®æº</value> - <value xml:lang="zh-TW">æJSONå¯å ¥å°è³ææº</value> - </property> <property key="WebtoolsImportantLogLevel"> <value xml:lang="de">Wichtig</value> <value xml:lang="en">Important</value> @@ -6063,7 +5942,7 @@ <property key="WebtoolsXMLExportInfo"> <value xml:lang="de">Hier Seite können Daten aus der Datenbank exportiert werden. Die exportierten Dokumente werden in einem XML-root-tag "<entity-engine-xml>" enthalten sein. Es wird für jede Entität in dem für diese webapp konfigurierten Delegator eine eigene Datei erstellt.</value> <value xml:lang="en">This page can be used to export data from the database. The exported documents will have a root tag of "<entity-engine-xml>". There will be one file for each Entity in the configured delegator for this webapp.</value> - <value xml:lang="fr">Cette page peut être utilisée pour exporter des données depuis la base. Les documents exportés auront une balise de racine de "<entity-engine-xml>". Il y aura un fichier créé pour chaque entité dans le delegator configuré pour cette webapp.</value> + <value xml:lang="fr">Cette page peut être utilisée pour exporter des données depuis la base. Les documents exportés auront une balise de racine de "<entity-engine-xml>". Il y aura un dossier pour chaque entité dans le delegator configuré pour cette webapp.</value> <value xml:lang="it">Questa pagina può essere usata per esportare i dati dal database. I documenti esportati avranno un root tag "<entity-engine-xml>". C'è un file per ogni Entità nel delegator configurato per questa applicazione web.</value> <value xml:lang="ja">ãã®ãã¼ã¸ã§ãã¼ã¿ãã¼ã¹ãããã¼ã¿ãã¨ã¯ã¹ãã¼ããããã¨ãã§ãã¾ããã¨ã¯ã¹ãã¼ãããããã¥ã¡ã³ãã«ã¯"<entity-engine-xml>"ã«ã¼ãã¿ã°ãããã¾ããWebã¢ããªã±ã¼ã·ã§ã³ã«è¨å®ãããããªã²ã¼ã¿ã®ä¸ã®ããããã®ã¨ã³ãã£ãã£ã«å¯¾ãã¦ï¼ã¤ã®ãã¡ã¤ã«ãä½æããã¾ãã</value> <value xml:lang="pt">Esta página pode ser utilizado para exportar dados do banco de dados. Os documentos de exportação terão uma tag raiz de " <entity-engine-xml>". Haverá um arquivo para cada entidade do delegator configurado para essa webapp.</value> @@ -6073,43 +5952,6 @@ <value xml:lang="zh">æ¬é¡µé¢ç¨äºä»æ°æ®åºå¯¼åºæ°æ® 导åºçææ¡£ä¼æä¸ä¸ª"<entity-engine-xml>"çæ ¹æ ç¾å¨ä¸ºè¿ä¸ªåºç¨é ç½®ç代表ä¸ï¼ä¼å¯¹æ¯ä¸ªå®ä½æä¸ä¸ªæ件ã</value> <value xml:lang="zh-TW">æ¬é é¢ç¨æ¼å¾è³æ庫å¯åºè³æ å¯åºçæªææä¸å"<entity-engine-xml>"çæ ¹æ¨ç°½å¨çºéåæç¨é ç½®ç代表ä¸,æå°æ¯åè³æ實é«æä¸åæª.</entity-engine-xml></value> </property> - <property key="WebtoolsWroteNRecordsToJSONFile"> - <value xml:lang="de">Es wurden ${numberWritten} Datensätze in die Datei ${parameters.filename} geschrieben.</value> - <value xml:lang="en">Wrote ${numberWritten} records to JSON file ${parameters.filename}.</value> - <value xml:lang="fr">Ecrire ${numberWritten} les enregistrements dans le fichier JSON ${parameters.filename}.</value> - <value xml:lang="it">Scritti ${numberWritten} records su file JSON ${parameters.filename}.</value> - <value xml:lang="ja">${numberWritten} ã¬ã³ã¼ãããJSONãã¡ã¤ã« ${parameters.filename} ã«æ¸ãåºãã¾ããã</value> - <value xml:lang="pt">Escreveu ${numberWritten} registros para o arquivo JSON ${parameters.filename}.</value> - <value xml:lang="th">à¹à¸à¸µà¸¢à¸ ${numberWritten} à¸à¸±à¸à¸à¸¶à¸à¸¡à¸¹à¸¥ XML à¹à¸à¸¥à¹ ${parameters.filename}.</value> - <value xml:lang="vi">Äã ghi ${numberWritten} bản ghi tá»i táºp tin JSON ${parameters.filename}.</value> - <value xml:lang="zh">æ${numberWritten}个记å½åå°JSONæ件${parameters.filename}ã</value> - <value xml:lang="zh-TW">æ${numberWritten}åè¨é寫å°JSONæª${parameters.filename}.</value> - </property> - <property key="WebtoolsWroteJSONForAllDataIn"> - <value xml:lang="de">Es wurde JSON für alle Daten in ${numberofEntities} Entitäten geschrieben.</value> - <value xml:lang="en">Wrote JSON for all data in ${numberOfEntities} entities.</value> - <value xml:lang="fr">Ecrire JSON pour toute les donnée inclues ${numberOfEntities} Entités.</value> - <value xml:lang="it">Scritti JSON per tutti i dati in ${numberOfEntities} entità .</value> - <value xml:lang="ja">${numberOfEntities} ã¨ã³ãã£ãã£ã®ãã¹ã¦ã®ãã¼ã¿ãXMLãã¡ã¤ã«ã«æ¸ãåºãã¾ããã</value> - <value xml:lang="pt">Escreveu JSON para todos os dados em ${numberOfEntities} entidades.</value> - <value xml:lang="th">à¹à¸à¸µà¸¢à¸ JSON สำหรัà¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸ ${numberOfEntities} entities.</value> - <value xml:lang="vi">Äã ghi JSON cho tất cả dữ liá»u trong ${numberOfEntities} Thá»±c thá».</value> - <value xml:lang="zh">为${numberOfEntities}个å®ä½ä¸çå ¨é¨æ°æ®åå°JSONã</value> - <value xml:lang="zh-TW">çº${numberOfEntities}åè³æ實é«ä¸çå ¨é¨è³æ寫å°JSON.</value> - </property> - <property key="WebtoolsJSONExportInfo"> - <value xml:lang="de">Hier Seite können Daten aus der Datenbank exportiert werden. Es wird für jede Entität in dem für diese webapp konfigurierten Delegator eine eigene Datei erstellt.</value> - <value xml:lang="en">This page can be used to export data from the database. There will be one file for each Entity in the configured delegator for this webapp.</value> - <value xml:lang="fr">Cette page peut être utilisée pour exporter des données depuis la base. Il y aura un fichier créé pour chaque entité dans le delegator configuré pour cette webapp.</value> - <value xml:lang="it">Questa pagina può essere usata per esportare i dati dal database. C'è un file per ogni Entità nel delegator configurato per questa applicazione web.</value> - <value xml:lang="ja">ãã®ãã¼ã¸ã§ãã¼ã¿ãã¼ã¹ãããã¼ã¿ãã¨ã¯ã¹ãã¼ããããã¨ãã§ãã¾ããWebã¢ããªã±ã¼ã·ã§ã³ã«è¨å®ãããããªã²ã¼ã¿ã®ä¸ã®ããããã®ã¨ã³ãã£ãã£ã«å¯¾ãã¦ï¼ã¤ã®ãã¡ã¤ã«ãä½æããã¾ãã</value> - <value xml:lang="pt">Esta página pode ser utilizado para exportar dados do banco de dados. Haverá um arquivo para cada entidade do delegator configurado para essa webapp.</value> - <value xml:lang="ro">Aceasta pagina poate fi folosita pentru exportarea datelor din database. Exista un file pentru orice Entitate din delegatorul configurat pentru aceasta aplicatie web.</value> - <value xml:lang="th">หà¸à¹à¸²à¸à¸µà¹à¹à¸à¹à¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸£à¸ªà¹ มี 1 à¹à¸à¸¥à¹à¸ªà¸³à¸«à¸£à¸±à¸à¸à¸±à¸§à¸à¸¢à¹à¸²à¸ Entity à¹à¸à¸à¸²à¸£à¸ªà¸£à¹à¸²à¸à¸à¸±à¸§à¹à¸à¸à¸ªà¸³à¸«à¸£à¸±à¸à¹à¸à¸£à¹à¸à¸£à¸¡à¸à¸£à¸°à¸¢à¸¸à¸à¸à¹à¸à¸µà¹</value> - <value xml:lang="vi">Giao diá»n bạn Äang sá» dụng cung cấp chức nÄng Kết xuất dữ liá»u từ CÆ¡ sá» dữ liá»u.( có 01 Táºp tin vá»i má»i Thá»±c thá» của Ứng dụng nà y)</value> - <value xml:lang="zh">æ¬é¡µé¢ç¨äºä»æ°æ®åºå¯¼åºæ°æ® çæ ¹æ ç¾å¨ä¸ºè¿ä¸ªåºç¨é ç½®ç代表ä¸ï¼ä¼å¯¹æ¯ä¸ªå®ä½æä¸ä¸ªæ件ã</value> - <value xml:lang="zh-TW">æ¬é é¢ç¨æ¼å¾è³æ庫å¯åºè³æ çæ ¹æ¨ç°½å¨çºéåæç¨é ç½®ç代表ä¸,æå°æ¯åè³æ實é«æä¸åæª.</value> - </property> <property key="WebtoolsXMLImportInfo"> <value xml:lang="de">Hier können zuvor exportierte Entitäten XML Dateien wieder in die Datenbank importiert werden. Diese Dokumente haben eine XML-root-tag "<entity-engine-xml>".</value> <value xml:lang="en">This page can be used to import exported Entity Engine XML documents. These documents all have a root tag of "<entity-engine-xml>".</value> @@ -6123,19 +5965,6 @@ <value xml:lang="zh">æ¬é¡µé¢ç¨äºå¯¼å ¥å¯¼åºçå®ä½å¼æXMLææ¡£ãè¿äºææ¡£é½æä¸ä¸ªæ ¹æ ç¾ "<entity-engine-xml>".</value> <value xml:lang="zh-TW">æ¬é é¢ç¨æ¼å¯å ¥å¯åºçè³æ實é«å¼æXMLæª.éäºæªé½æä¸åæ ¹æ¨ç°½ "<entity-engine-xml>".</entity-engine-xml></value> </property> - <property key="WebtoolsJSONImportInfo"> - <value xml:lang="de">Hier können zuvor exportierte Entitäten JSON Dateien wieder in die Datenbank importiert werden.</value> - <value xml:lang="en">This page can be used to import exported Entity Engine JSON data.</value> - <value xml:lang="fr">Cette page peut être utilisée pour importer des documents JSON exportés par le moteur d'entité.".</value> - <value xml:lang="it">Questa pagina può essere usata per importare documenti JSON contenenti export di Entita'.</value> - <value xml:lang="ja">ãã®ãã¼ã¸ã§ã¨ã¯ã¹ãã¼ããããã¨ã³ãã£ãã£ã¨ã³ã¸ã³JSONããã¥ã¡ã³ããã¤ã³ãã¼ããããã¨ãã§ãã¾ãã</value> - <value xml:lang="pt">Esta página pode ser utilizado para importação e exportação de documentos JSON do Engine de Entidades.</value> - <value xml:lang="ro">Aceasta pagina nu poate fi folosita pentru importarea exportarea documentelor JSON de Entity Engine.</value> - <value xml:lang="th">หà¸à¹à¸²à¸à¸µà¹à¹à¸à¹à¸à¸²à¸£à¸à¸³à¹à¸à¹à¸²à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸¡à¸µà¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸à¹à¸à¸à¸à¸´à¸à¸µà¹à¹à¸à¸à¸à¸´à¸à¹à¸à¸à¸ªà¸²à¸£ JSON à¹à¸à¸¢à¹à¸à¹à¸à¸³à¸ªà¸±à¹à¸</value> - <value xml:lang="vi">Giao diá»n bạn Äang sá» dụng cung cấp chức nÄng Nháºp khẩu dữ liá»u từ các Tà i liá»u Thá»±c thá» JSON.</value> - <value xml:lang="zh">æ¬é¡µé¢ç¨äºå¯¼å ¥å¯¼åºçå®ä½å¼æJSONææ¡£ã</value> - <value xml:lang="zh-TW">æ¬é é¢ç¨æ¼å¯å ¥å¯åºçè³æ實é«å¼æJSONæª</value> - </property> <property key="WebtoolsYouMayCreateAnEntity"> <value xml:lang="de">You may create an Entity ${entityName} by entering the values you want, and clicking Create.</value> <value xml:lang="en">You may create an Entity ${entityName} by entering the values you want, and clicking Create.</value> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/servicedef/services.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/servicedef/services.xml (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/servicedef/services.xml Sun Sep 22 12:29:54 2019 @@ -56,36 +56,6 @@ under the License. <attribute name="placeholderValues" type="java.util.Map" mode="IN" optional="true"/> <attribute name="messages" type="List" mode="OUT" optional="false"/> </service> - <service name="parseEntityJsonFile" engine="java" - location="org.apache.ofbiz.webtools.WebToolsServices" invoke="parseEntityJsonFile" auth="true" use-transaction="false"> - <description>Parses an entity xml file or an entity xml text</description> - <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/> - <attribute name="url" type="java.net.URL" mode="IN" optional="true"/> - <attribute name="xmltext" type="String" mode="IN" optional="true" allow-html="any"/> - <attribute name="onlyInserts" type="String" mode="IN" optional="true"/> - <attribute name="maintainTimeStamps" type="String" mode="IN" optional="true"/> - <attribute name="txTimeout" type="Integer" mode="IN" optional="true"/> - <attribute name="createDummyFks" type="String" mode="IN" optional="true"/> - <attribute name="checkDataOnly" type="String" mode="IN" optional="true"/> - <attribute name="placeholderValues" type="java.util.Map" mode="IN" optional="true"/> - <attribute name="rowProcessed" type="Long" mode="OUT" optional="false"/> - </service> - <service name="entityImportJson" engine="java" - location="org.apache.ofbiz.webtools.WebToolsServices" invoke="entityImportJson" auth="true" use-transaction="false"> - <description>Imports an entity xml file or text string</description> - <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/> - <attribute name="filename" type="String" mode="IN" optional="true" allow-html="any"/> - <attribute name="fmfilename" type="String" mode="IN" optional="true" allow-html="any"/> - <attribute name="fulltext" type="String" mode="IN" optional="true" allow-html="any"/> - <attribute name="isUrl" type="String" mode="IN" optional="true"/> - <attribute name="onlyInserts" type="String" mode="IN" optional="true"/> - <attribute name="maintainTimeStamps" type="String" mode="IN" optional="true"/> - <attribute name="createDummyFks" type="String" mode="IN" optional="true"/> - <attribute name="checkDataOnly" type="String" mode="IN" optional="true"/> - <attribute name="txTimeout" type="Integer" mode="IN" optional="true"/> - <attribute name="placeholderValues" type="java.util.Map" mode="IN" optional="true"/> - <attribute name="messages" type="List" mode="OUT" optional="false"/> - </service> <service name="entityImportDir" engine="java" location="org.apache.ofbiz.webtools.WebToolsServices" invoke="entityImportDir" auth="true" use-transaction="false"> <description>Imports all entity xml files contained in a directory</description> @@ -101,21 +71,6 @@ under the License. <attribute name="placeholderValues" type="java.util.Map" mode="IN" optional="true"/> <attribute name="messages" type="List" mode="OUT" optional="false"/> </service> - <service name="entityImportDirJson" engine="java" - location="org.apache.ofbiz.webtools.WebToolsServices" invoke="entityImportDirJson" auth="true" use-transaction="false"> - <description>Imports all entity json files contained in a directory</description> - <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/> - <attribute name="path" type="String" mode="IN" optional="true"/> - <attribute name="onlyInserts" type="String" mode="IN" optional="true"/> - <attribute name="maintainTimeStamps" type="String" mode="IN" optional="true"/> - <attribute name="createDummyFks" type="String" mode="IN" optional="true"/> - <attribute name="checkDataOnly" type="String" mode="IN" optional="true"/> - <attribute name="deleteFiles" type="String" mode="IN" optional="true"/> - <attribute name="txTimeout" type="Integer" mode="IN" optional="true"/> - <attribute name="filePause" type="Long" mode="IN" optional="true"/> - <attribute name="placeholderValues" type="java.util.Map" mode="IN" optional="true"/> - <attribute name="messages" type="List" mode="OUT" optional="false"/> - </service> <service name="entityImportReaders" engine="java" location="org.apache.ofbiz.webtools.WebToolsServices" invoke="entityImportReaders" auth="true" use-transaction="false"> <description>Imports an entity xml file or text string</description> @@ -136,15 +91,6 @@ under the License. <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/> <attribute name="outpath" type="String" mode="IN" optional="true"/> <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> - <attribute name="txTimeout" type="Integer" mode="IN" optional="true"/> - <attribute name="results" type="List" mode="OUT" optional="false"/> - </service> - <service name="entityExportAllJson" engine="java" - location="org.apache.ofbiz.webtools.WebToolsServices" invoke="entityExportAllJson" auth="true" use-transaction="false"> - <description>Exports all entities into json files</description> - <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/> - <attribute name="outpath" type="String" mode="IN" optional="true"/> - <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> <attribute name="txTimeout" type="Integer" mode="IN" optional="true"/> <attribute name="results" type="List" mode="OUT" optional="false"/> </service> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java Sun Sep 22 12:29:54 2019 @@ -80,7 +80,6 @@ import org.apache.ofbiz.entity.transacti import org.apache.ofbiz.entity.transaction.TransactionUtil; import org.apache.ofbiz.entity.util.EntityDataAssert; import org.apache.ofbiz.entity.util.EntityDataLoader; -import org.apache.ofbiz.entity.util.EntityJsonReader; import org.apache.ofbiz.entity.util.EntityListIterator; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.entity.util.EntitySaxReader; @@ -313,226 +312,6 @@ public class WebToolsServices { return resp; } - /** - * - * @param dctx - * @param context - * @return - */ - public static Map<String, Object> entityImportJson(DispatchContext dctx, Map<String, ? extends Object> context) { - GenericValue userLogin = (GenericValue) context.get("userLogin"); - LocalDispatcher dispatcher = dctx.getDispatcher(); - Locale locale = (Locale) context.get("locale"); - List<String> messages = new LinkedList<>(); - - String filename = (String)context.get("filename"); - String fmfilename = (String)context.get("fmfilename"); - String fulltext = (String)context.get("fulltext"); - boolean isUrl = (String)context.get("isUrl") != null; - String onlyInserts = (String)context.get("onlyInserts"); - String maintainTimeStamps = (String)context.get("maintainTimeStamps"); - String createDummyFks = (String)context.get("createDummyFks"); - String checkDataOnly = (String) context.get("checkDataOnly"); - Map<String, Object> placeholderValues = UtilGenerics.cast(context.get("placeholderValues")); - - Integer txTimeout = (Integer)context.get("txTimeout"); - if (txTimeout == null) { - txTimeout = 7200; - } - URL url = null; - - // ############################# - // The filename to parse is prepared - // ############################# - if (UtilValidate.isNotEmpty(filename)) { - try { - url = isUrl?FlexibleLocation.resolveLocation(filename):UtilURL.fromFilename(filename); - } catch (MalformedURLException mue) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsInvalidFileName", UtilMisc.toMap("filename", filename, "errorString", mue.getMessage()), locale)); - } catch (Exception exc) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrorReadingFileName", UtilMisc.toMap("filename", filename, "errorString", exc.getMessage()), locale)); - } - } - - // ############################# - // FM Template - // ############################# - if (UtilValidate.isNotEmpty(fmfilename) && (UtilValidate.isNotEmpty(fulltext) || url != null)) { - File fmFile = new File(fmfilename); - if (!fmFile.exists()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrorReadingTemplateFile", UtilMisc.toMap("filename", fmfilename, "errorString", "Template file not found."), locale)); - } - try { - DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource ins = url != null ? new InputSource(url.openStream()) : new InputSource(new StringReader(fulltext)); - Document doc; - try { - doc = documentBuilder.parse(ins); - } finally { - if (ins.getByteStream() != null) { - ins.getByteStream().close(); - } - if (ins.getCharacterStream() != null) { - ins.getCharacterStream().close(); - } - } - StringWriter outWriter = new StringWriter(); - Map<String, Object> fmcontext = new HashMap<>(); - fmcontext.put("doc", doc); - FreeMarkerWorker.renderTemplate(fmFile.toURI().toURL().toString(), fmcontext, outWriter); - fulltext = outWriter.toString(); - } catch (Exception ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrorProcessingTemplateFile", UtilMisc.toMap("filename", fmfilename, "errorString", ex.getMessage()), locale)); - } - } - - // ############################# - // The parsing takes place - // ############################# - if (fulltext != null || url != null) { - try { - Map<String, Object> inputMap = UtilMisc.toMap("onlyInserts", onlyInserts, - "createDummyFks", createDummyFks, - "checkDataOnly", checkDataOnly, - "maintainTimeStamps", maintainTimeStamps, - "txTimeout", txTimeout, - "placeholderValues", placeholderValues, - "userLogin", userLogin); - if (fulltext != null) { - inputMap.put("xmltext", fulltext); - } else { - inputMap.put("url", url); - } - Map<String, Object> outputMap = dispatcher.runSync("parseEntityJsonFile", inputMap); - if (ServiceUtil.isError(outputMap)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrorParsingFile", UtilMisc.toMap("errorString", ServiceUtil.getErrorMessage(outputMap)), locale)); - } else { - Long numberRead = (Long)outputMap.get("rowProcessed"); - messages.add(UtilProperties.getMessage(resource, "EntityImportRowProcessed", UtilMisc.toMap("numberRead", numberRead.toString()), locale)); - } - } catch (GenericServiceException gsex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportJsonParsingError", UtilMisc.toMap("errorString", gsex.getMessage()), locale)); - } catch (Exception ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportJsonParsingError", UtilMisc.toMap("errorString", ex.getMessage()), locale)); - } - } else { - messages.add(UtilProperties.getMessage(resource, "EntityImportNoJsonFileSpecified", locale)); - } - - // send the notification - Map<String, Object> resp = UtilMisc.toMap("messages", (Object) messages); - return resp; - } - - /** - * - * @param dctx - * @param context - * @return - */ - public static Map<String, Object> entityImportDirJson(DispatchContext dctx, Map<String, ? extends Object> context) { - GenericValue userLogin = (GenericValue) context.get("userLogin"); - LocalDispatcher dispatcher = dctx.getDispatcher(); - Locale locale = (Locale) context.get("locale"); - List<String> messages = new LinkedList<>(); - - String path = (String) context.get("path"); - String onlyInserts = (String) context.get("onlyInserts"); - String maintainTimeStamps = (String) context.get("maintainTimeStamps"); - String createDummyFks = (String) context.get("createDummyFks"); - boolean deleteFiles = (String) context.get("deleteFiles") != null; - String checkDataOnly = (String) context.get("checkDataOnly"); - Map<String, Object> placeholderValues = UtilGenerics.cast(context.get("placeholderValues")); - - Integer txTimeout = (Integer)context.get("txTimeout"); - Long filePause = (Long)context.get("filePause"); - - if (txTimeout == null) { - txTimeout = 7200; - } - if (filePause == null) { - filePause = 0L; - } - - if (UtilValidate.isNotEmpty(path)) { - long pauseLong = filePause; - File baseDir = new File(path); - - if (baseDir.isDirectory() && baseDir.canRead()) { - File[] fileArray = baseDir.listFiles(); - List<File> files = new LinkedList<>(); - for (File file: fileArray) { - if (file.getName().toUpperCase().endsWith("JSON")) { - files.add(file); - } - } - - int passes=0; - int initialListSize = files.size(); - int lastUnprocessedFilesCount = 0; - List<File> unprocessedFiles = new LinkedList<>(); - while (files.size()>0 && - files.size() != lastUnprocessedFilesCount) { - lastUnprocessedFilesCount = files.size(); - unprocessedFiles = new LinkedList<>(); - for (File f: files) { - Map<String, Object> parseEntityXmlFileArgs = UtilMisc.toMap("onlyInserts", onlyInserts, - "createDummyFks", createDummyFks, - "checkDataOnly", checkDataOnly, - "maintainTimeStamps", maintainTimeStamps, - "txTimeout", txTimeout, - "placeholderValues", placeholderValues, - "userLogin", userLogin); - - try { - URL furl = f.toURI().toURL(); - parseEntityXmlFileArgs.put("url", furl); - Map<String, Object> outputMap = dispatcher.runSync("parseEntityJsonFile", parseEntityXmlFileArgs); - Long numberRead = (Long) outputMap.get("rowProcessed"); - messages.add(UtilProperties.getMessage(resource, "EntityImportNumberOfEntityToBeProcessed", UtilMisc.toMap("numberRead", numberRead.toString(), "fileName", f.getName()), locale)); - if (deleteFiles) { - messages.add(UtilProperties.getMessage(resource, "EntityImportDeletFile", UtilMisc.toMap("fileName", f.getName()), locale)); - f.delete(); - } - } catch (Exception e) { - unprocessedFiles.add(f); - messages.add(UtilProperties.getMessage(resource, "EntityImportFailedFile", UtilMisc.toMap("fileName", f.getName()), locale)); - } - // pause in between files - if (pauseLong > 0) { - Debug.logInfo("Pausing for [" + pauseLong + "] seconds - " + UtilDateTime.nowTimestamp(), module); - try { - Thread.sleep((pauseLong * 1000)); - } catch (InterruptedException ie) { - Debug.logInfo("Pause finished - " + UtilDateTime.nowTimestamp(), module); - } - } - } - files = unprocessedFiles; - passes++; - messages.add(UtilProperties.getMessage(resource, "EntityImportPassedFile", UtilMisc.toMap("passes", passes), locale)); - Debug.logInfo("Pass " + passes + " complete", module); - } - lastUnprocessedFilesCount=unprocessedFiles.size(); - messages.add("---------------------------------------"); - messages.add(UtilProperties.getMessage(resource, "EntityImportSucceededNumberFile", UtilMisc.toMap("succeeded", (initialListSize-lastUnprocessedFilesCount), "total", initialListSize), locale)); - messages.add(UtilProperties.getMessage(resource, "EntityImportFailedNumberFile", UtilMisc.toMap("failed", lastUnprocessedFilesCount, "total", initialListSize), locale)); - messages.add("---------------------------------------"); - messages.add(UtilProperties.getMessage(resource, "EntityImportFailedFileList", locale)); - for (File file: unprocessedFiles) { - messages.add(file.toString()); - } - } else { - messages.add(UtilProperties.getMessage(resource, "EntityImportPathNotFound", locale)); - } - } else { - messages.add(UtilProperties.getMessage(resource, "EntityImportPathNotSpecified", locale)); - } - // send the notification - Map<String, Object> resp = UtilMisc.toMap("messages", (Object) messages); - return resp; - } - public static Map<String, Object> entityImportReaders(DispatchContext dctx, Map<String, Object> context) { String readers = (String) context.get("readers"); String overrideDelegator = (String) context.get("overrideDelegator"); @@ -684,46 +463,6 @@ public class WebToolsServices { return resp; } - public static Map<String, Object> parseEntityJsonFile(DispatchContext dctx, Map<String, ? extends Object> context) { - Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale) context.get("locale"); - URL url = (URL) context.get("url"); - String xmltext = (String) context.get("xmltext"); - - if (url == null && xmltext == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportNoXmlFileOrTextSpecified", locale)); - } - boolean onlyInserts = (String) context.get("onlyInserts") != null; - boolean maintainTimeStamps = (String) context.get("maintainTimeStamps") != null; - boolean createDummyFks = (String) context.get("createDummyFks") != null; - boolean checkDataOnly = (String) context.get("checkDataOnly") != null; - Integer txTimeout = (Integer) context.get("txTimeout"); - Map<String, Object> placeholderValues = UtilGenerics.cast(context.get("placeholderValues")); - - if (txTimeout == null) { - txTimeout = 7200; - } - - long rowProcessed = 0; - try { - EntityJsonReader reader = new EntityJsonReader(delegator); - reader.setUseTryInsertMethod(onlyInserts); - reader.setMaintainTxStamps(maintainTimeStamps); - reader.setTransactionTimeout(txTimeout); - reader.setCreateDummyFks(createDummyFks); - reader.setCheckDataOnly(checkDataOnly); - reader.setPlaceholderValues(placeholderValues); - - long numberRead = (url != null ? reader.parse(url) : reader.parse(xmltext)); - rowProcessed = numberRead; - } catch (Exception ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportJsonParsingError", UtilMisc.toMap("errorString", ex.toString()), locale)); - } - // send the notification - Map<String, Object> resp = UtilMisc.<String, Object>toMap("rowProcessed", rowProcessed); - return resp; - } - public static Map<String, Object> entityExportAll(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); @@ -797,110 +536,6 @@ public class WebToolsServices { continue; } fileNumber++; - } catch (GenericTransactionException e) { - Debug.logError(e, module); - results.add(e.getLocalizedMessage()); - } - } - } else { - results.add("Path not found or no write access."); - } - } else { - results.add("No path specified, doing nothing."); - } - // send the notification - Map<String, Object> resp = UtilMisc.<String, Object>toMap("results", results); - return resp; - } - - public static Map<String, Object> entityExportAllJson(DispatchContext dctx, Map<String, ? extends Object> context) { - Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale) context.get("locale"); - String outpath = (String) context.get("outpath"); // mandatory - Timestamp fromDate = (Timestamp) context.get("fromDate"); - Integer txTimeout = (Integer) context.get("txTimeout"); - if (txTimeout == null) { - txTimeout = 7200; - } - - List<String> results = new LinkedList<>(); - - if (UtilValidate.isNotEmpty(outpath)) { - File outdir = new File(outpath); - if (!outdir.exists()) { - outdir.mkdir(); - } - if (outdir.isDirectory() && outdir.canWrite()) { - Set<String> passedEntityNames; - try { - ModelReader reader = delegator.getModelReader(); - Collection<String> ec = reader.getEntityNames(); - passedEntityNames = new TreeSet<>(ec); - } catch (Exception exc) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportErrorRetrievingEntityNames", locale)); - } - int fileNumber = 1; - - for (String curEntityName : passedEntityNames) { - long numberWritten = 0; - ModelEntity me = delegator.getModelEntity(curEntityName); - if (me instanceof ModelViewEntity) { - results.add("[" + fileNumber + "] [vvv] " + curEntityName + " skipping view entity"); - continue; - } - List<EntityCondition> conds = new LinkedList<>(); - if (UtilValidate.isNotEmpty(fromDate)) { - conds.add(EntityCondition.makeCondition("createdStamp", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); - } - EntityQuery eq = EntityQuery.use(delegator).from(curEntityName).where(conds).orderBy(me.getPkFieldNames()); - - try { - boolean beganTx = TransactionUtil.begin(); - // some databases don't support cursors, or other problems may happen, so if there is an error here log it and move on to get as much as possible - //Don't bother writing the file if there's nothing to put into it - try (EntityListIterator values = eq.queryIterator()) { - GenericValue value = values.next(); - if (value != null) { - int curValueCount = 0; - try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, curEntityName + ".json")), "UTF-8")))) { - writer.println("["); - writer.print("{"); - boolean isFirst = true; - do { - if (isFirst) { - writer.print('"'); - writer.print(curEntityName); - writer.print('"'); - writer.print(':'); - writer.print('['); - isFirst = false; - } - EntityJsonHelper.writeJsonText(writer, value); - curValueCount++; - numberWritten++; - if(curValueCount < values.getResultsSizeAfterPartialList()) { - writer.println(','); - } - if (numberWritten % 500 == 0) { - TransactionUtil.commit(beganTx); - beganTx = TransactionUtil.begin(); - } - } while ((value = values.next()) != null); - writer.println("]}"); - writer.print("]"); - } catch (UnsupportedEncodingException | FileNotFoundException e) { - results.add("[" + fileNumber + "] [xxx] Error when writing " + curEntityName + ": " + e); - } - results.add("[" + fileNumber + "] [" + numberWritten + "] " + curEntityName + " wrote " + numberWritten + " records"); - } else { - results.add("[" + fileNumber + "] [---] " + curEntityName + " has no records, not writing file"); - } - TransactionUtil.commit(beganTx); - } catch (GenericEntityException entityEx) { - results.add("[" + fileNumber + "] [xxx] Error when writing " + curEntityName + ": " + entityEx); - continue; - } - fileNumber++; } catch (GenericTransactionException e) { Debug.logError(e, module); results.add(e.getLocalizedMessage()); Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/Main.ftl URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/Main.ftl?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/Main.ftl (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/Main.ftl Sun Sep 22 12:29:54 2019 @@ -80,12 +80,6 @@ under the License. <li><a href="<@ofbizUrl>EntityImport</@ofbizUrl>">${uiLabelMap.PageTitleEntityImport}</a></li> <li><a href="<@ofbizUrl>EntityImportDir</@ofbizUrl>">${uiLabelMap.PageTitleEntityImportDir}</a></li> <li><a href="<@ofbizUrl>EntityImportReaders</@ofbizUrl>">${uiLabelMap.PageTitleEntityImportReaders}</a></li> - - <li><h3>${uiLabelMap.WebtoolsEntityJSONTools}</h3></li> - <li><a href="<@ofbizUrl>jsondsdump</@ofbizUrl>">${uiLabelMap.PageTitleEntityExportJson}</a></li> - <li><a href="<@ofbizUrl>EntityExportAllJson</@ofbizUrl>">${uiLabelMap.PageTitleEntityExportAllJson}</a></li> - <li><a href="<@ofbizUrl>EntityImportJson</@ofbizUrl>">${uiLabelMap.PageTitleEntityImportJson}</a></li> - <li><a href="<@ofbizUrl>EntityImportDirJson</@ofbizUrl>">${uiLabelMap.PageTitleEntityImportDirJson}</a></li> </#if> <#if security.hasPermission("SERVICE_MAINT", session)> <li><h3>${uiLabelMap.WebtoolsServiceEngineTools}</h3></li> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Sun Sep 22 12:29:54 2019 @@ -426,27 +426,6 @@ under the License. <response name="success" type="view" value="EntityImport"/> <response name="error" type="view" value="EntityImport"/> </request-map> - <request-map uri="EntityImportJson"><security https="true" auth="true"/><response name="success" type="view" value="EntityImportJson"/></request-map> - <request-map uri="entityImportJson"> - <security https="true" auth="true"/> - <event type="service" path="" invoke="entityImportJson"/> - <response name="success" type="view" value="EntityImportJson"/> - <response name="error" type="view" value="EntityImportJson"/> - </request-map> - <request-map uri="EntityExportAllJson"><security https="true" auth="true"/><response name="success" type="view" value="EntityExportAllJson"/><response name="error" type="view" value="EntityExportAllJson"/></request-map> - <request-map uri="entityExportAllJson"> - <security https="true" auth="true"/> - <event type="service" path="" invoke="entityExportAllJson"/> - <response name="success" type="view" value="EntityExportAllJson"/> - <response name="error" type="view" value="EntityExportAllJson"/> - </request-map> - <request-map uri="EntityImportDirJson"><security https="true" auth="true"/><response name="success" type="view" value="EntityImportDirJson"/></request-map> - <request-map uri="entityImportDirJson"> - <security https="true" auth="true"/> - <event type="service" path="" invoke="entityImportDirJson"/> - <response name="success" type="view" value="EntityImportDir"/> - <response name="error" type="view" value="EntityImportDir"/> - </request-map> <request-map uri="EntityImportReaders"><security https="true" auth="true"/><response name="success" type="view" value="EntityImportReaders"/></request-map> <request-map uri="entityImportReaders"> <security https="true" auth="true"/> @@ -462,15 +441,6 @@ under the License. <security https="true" auth="true"/> <response name="success" type="view" value="xmldsrawdump"/> </request-map> - <request-map uri="jsondsdump"> - <security https="true" auth="true"/> - <response name="success" type="view" value="jsondsdump"/> - </request-map> - <request-map uri="jsondsrawdump"> - <security https="true" auth="true"/> - <event type="java" path="org.apache.ofbiz.webtools.EntityJsonEvents" invoke="downloadJsonData" /> - <response name="success" type="view" value="jsondsdump"/> - </request-map> <!-- EntitySync requests --> <request-map uri="EntitySyncStatus"><security https="true" auth="true"/><response name="success" type="view" value="EntitySyncStatus"/></request-map> @@ -630,9 +600,7 @@ under the License. <view-map name="checkdb" type="screen" page="component://webtools/widget/EntityScreens.xml#CheckDb"/> <view-map name="xmldsdump" type="screen" page="component://webtools/widget/EntityScreens.xml#xmldsdump"/> - <view-map name="jsondsdump" type="screen" page="component://webtools/widget/EntityScreens.xml#jsondsdump"/> <view-map name="xmldsrawdump" page="template/entity/xmldsrawdump.jsp"/> - <view-map name="jsondsrawdump" page="template/entity/jsondsrawdump.jsp"/> <view-map name="FindUtilCache" type="screen" page="component://webtools/widget/CacheScreens.xml#FindUtilCache"/> <view-map name="FindUtilCacheElements" type="screen" page="component://webtools/widget/CacheScreens.xml#FindUtilCacheElements"/> @@ -671,12 +639,9 @@ under the License. <view-map name="EntitySQLProcessor" type="screen" page="component://webtools/widget/EntityScreens.xml#EntitySQLProcessor"/> <view-map name="ConnectionPoolStatus" type="screen" page="component://webtools/widget/EntityScreens.xml#ConnectionPoolStatus"/> <view-map name="EntityExportAll" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityExportAll"/> - <view-map name="EntityExportAllJson" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityExportAllJson"/> <view-map name="ProgramExport" type="screen" page="component://webtools/widget/EntityScreens.xml#ProgramExport"/> <view-map name="EntityImportDir" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityImportDir"/> - <view-map name="EntityImportDirJson" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityImportDirJson"/> <view-map name="EntityImport" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityImport"/> - <view-map name="EntityImportJson" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityImportJson"/> <view-map name="EntityImportReaders" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityImportReaders"/> <!-- cert views --> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml Sun Sep 22 12:29:54 2019 @@ -71,27 +71,6 @@ under the License. </widgets> </section> </screen> - <screen name="EntityExportAllJson"> - <section> - <actions> - <set field="titleProperty" value="PageTitleEntityExportAllJson"/> - <set field="tabButtonItem" value="entityExportAllJson"/> - <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/> - <set field="results" from-field="parameters.results"/> - </actions> - <widgets> - <decorator-screen name="CommonImportExportDecorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> - <screenlet> - <platform-specific> - <html><html-template location="component://webtools/template/entity/EntityExportAllJson.ftl"/></html> - </platform-specific> - </screenlet> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> <screen name="ProgramExport"> <section> <actions> @@ -137,28 +116,6 @@ under the License. </widgets> </section> </screen> - <screen name="EntityImportDirJson"> - <section> - <actions> - <set field="titleProperty" value="PageTitleEntityImportDirJson"/> - <set field="tabButtonItem" value="entityImportDirJson"/> - <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/> - - <set field="messages" from-field="parameters.messages"/> - </actions> - <widgets> - <decorator-screen name="CommonImportExportDecorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> - <screenlet> - <platform-specific> - <html><html-template location="component://webtools/template/entity/EntityImportDirJson.ftl"/></html> - </platform-specific> - </screenlet> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> <screen name="EntityImport"> <section> <actions> @@ -181,28 +138,6 @@ under the License. </widgets> </section> </screen> - <screen name="EntityImportJson"> - <section> - <actions> - <set field="titleProperty" value="PageTitleEntityImportJson"/> - <set field="tabButtonItem" value="entityImportJson"/> - <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/> - - <set field="messages" from-field="parameters.messages"/> - </actions> - <widgets> - <decorator-screen name="CommonImportExportDecorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> - <screenlet> - <platform-specific> - <html><html-template location="component://webtools/template/entity/EntityImportJson.ftl"/></html> - </platform-specific> - </screenlet> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> <screen name="EntityImportReaders"> <section> <actions> @@ -539,28 +474,6 @@ under the License. </screenlet> </decorator-section> </decorator-screen> - </widgets> - </section> - </screen> - - <screen name="jsondsdump"> - <section> - <actions> - <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/> - <set field="titleProperty" value="PageTitleEntityExportJson"/> - <set field="tabButtonItem" value="jsonDsDump"/> - <set field="entityFrom" from-field="parameters.entityFrom" type="Timestamp"/> - <set field="entityThru" from-field="parameters.entityThru" type="Timestamp"/> - <script location="component://webtools/groovyScripts/entity/JsonDsDump.groovy"/> - </actions> - <widgets> - <decorator-screen name="CommonImportExportDecorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> - <screenlet> - <platform-specific><html><html-template location="component://webtools/template/entity/JsonDsDump.ftl"/></html></platform-specific> - </screenlet> - </decorator-section> - </decorator-screen> </widgets> </section> </screen> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml?rev=1867342&r1=1867341&r2=1867342&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml Sun Sep 22 12:29:54 2019 @@ -98,18 +98,6 @@ under the License. <menu-item name="entityImportReaders" title="${uiLabelMap.PageTitleEntityImportReaders}"> <link target="EntityImportReaders"/> </menu-item> - <menu-item name="jsonDsDump" title="${uiLabelMap.PageTitleEntityExportJson}"> - <link target="jsondsdump"/> - </menu-item> - <menu-item name="entityExportAllJson" title="${uiLabelMap.PageTitleEntityExportAllJson}"> - <link target="EntityExportAllJson"/> - </menu-item> - <menu-item name="entityImportJson" title="${uiLabelMap.PageTitleEntityImportJson}"> - <link target="EntityImportJson"/> - </menu-item> - <menu-item name="entityImportDirJson" title="${uiLabelMap.PageTitleEntityImportDirJson}"> - <link target="EntityImportDirJson"/> - </menu-item> </menu> <menu name="ServiceTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml" |
Free forum by Nabble | Edit this page |