From 60748d097678a8ad15edb8a3ee794156d5f1846c Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Sun, 22 Dec 2024 17:10:37 -0400 Subject: [PATCH 1/2] Fixed error with parse data (#956) References: https://github.com/solop-develop/frontend-core/issues/67 --- .../ImportFileLoaderServiceLogic.java | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java b/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java index 76250eae..76b9357b 100644 --- a/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java +++ b/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java @@ -13,15 +13,15 @@ * along with this program. If not, see . * ************************************************************************************/ package org.spin.grpc.service.form.import_file_loader; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; import java.io.BufferedReader; +import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigDecimal; import java.nio.charset.Charset; import java.sql.Timestamp; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.stream.Collectors; import org.adempiere.core.domains.models.I_AD_ImpFormat; @@ -68,7 +68,9 @@ import org.spin.grpc.service.BusinessData; import org.spin.grpc.service.field.field_management.FieldManagementLogic; import org.spin.model.MADAppRegistration; +import org.spin.service.grpc.util.value.NumberManager; import org.spin.service.grpc.util.value.StringManager; +import org.spin.service.grpc.util.value.TimeManager; import org.spin.service.grpc.util.value.ValueManager; import org.spin.util.support.AppSupportHandler; import org.spin.util.support.IAppSupport; @@ -582,27 +584,32 @@ public static ListEntitiesResponse.Builder listFilePreview(ListFilePreviewReques info = ""; } } - String entry = info; - + String entry = row.parse(info); + // TODO: Reuse ADempiere Parser Value.Builder valueBuilder = Value.newBuilder(); - if (row.isDate()) { - Timestamp dateValue = Timestamp.valueOf(entry); - valueBuilder = ValueManager.getValueFromTimestamp(dateValue); - } else if (row.isNumber()) { - BigDecimal numberValue = null; - if (!Util.isEmpty(entry, true)) { - numberValue = new BigDecimal(entry); - if (row.isDivideBy100()) { - numberValue = numberValue.divide( - BigDecimal.valueOf(100) - ); + if(!Util.isEmpty(entry)) { + try { + if (row.isDate()) { + Timestamp dateValue = TimeManager.getTimestampFromString(entry); + valueBuilder = ValueManager.getValueFromTimestamp(dateValue); + } else if (row.isNumber()) { + BigDecimal numberValue = null; + if (!Util.isEmpty(entry, true)) { + numberValue = NumberManager.getBigDecimalFromString(entry); + if (numberValue != null && row.isDivideBy100()) { + numberValue = numberValue.divide( + BigDecimal.valueOf(100) + ); + } + } + valueBuilder = ValueManager.getValueFromBigDecimal(numberValue); + } else { + valueBuilder = ValueManager.getValueFromString(entry); } + } catch (Exception e) { + e.printStackTrace(); } - valueBuilder = ValueManager.getValueFromBigDecimal(numberValue); - } else { - valueBuilder = ValueManager.getValueFromString(entry); } - lineValues.putFields( row.getColumnName(), valueBuilder.build() From 4d338913432174b3f2415c1d90a5f760a948bfd2 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Sun, 22 Dec 2024 21:07:18 -0400 Subject: [PATCH 2/2] feat: Add lookup `UUID`. (#957) --- resources/adempiere-grpc-server.pb | Bin 907633 -> 907708 bytes .../java/org/spin/base/util/LookupUtil.java | 6 ++++++ .../ImportFileLoaderServiceLogic.java | 5 +++++ src/main/proto/base_data_type.proto | 7 ++++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/adempiere-grpc-server.pb b/resources/adempiere-grpc-server.pb index 9111f195cccd1998018f9d7ea92ed53e0749c0b5..5cccfddfb91c1184f88746fcdc39ecb85cc7aeae 100644 GIT binary patch delta 4263 zcmYM1+iw-u6^GBBnRCvbIp@qV6Cl3e3+84g#!0}~25~Wj1e;2jO5CadkphM)+eXrD~w3XaSeQnjhBCma_)V}n&-iEUJTdR*-AOa4MnPbzS@^n5 zJsGI|il-3T{%X=lBEAf=aLf*$^v9#?H+GKHnyW*W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&m(mTj>^R&d)qFO zuh*ibbr#= diff --git a/src/main/java/org/spin/base/util/LookupUtil.java b/src/main/java/org/spin/base/util/LookupUtil.java index 51c66bc1..7801dd28 100644 --- a/src/main/java/org/spin/base/util/LookupUtil.java +++ b/src/main/java/org/spin/base/util/LookupUtil.java @@ -20,6 +20,7 @@ import org.compiere.util.Env; import org.compiere.util.Util; import org.spin.backend.grpc.common.LookupItem; +import org.spin.service.grpc.util.value.StringManager; import org.spin.service.grpc.util.value.ValueManager; import com.google.protobuf.Struct; @@ -123,6 +124,11 @@ public static LookupItem.Builder convertLookupItemFromReferenceList(MRefList ref } builder.setId(refList.getAD_Ref_List_ID()) + .setUuid( + StringManager.getValidString( + refList.getUUID() + ) + ) .setTableName(I_AD_Ref_List.Table_Name) ; diff --git a/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java b/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java index 76b9357b..b39be604 100644 --- a/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java +++ b/src/main/java/org/spin/grpc/service/form/import_file_loader/ImportFileLoaderServiceLogic.java @@ -681,6 +681,11 @@ public static ListLookupItemsResponse.Builder listImportProcesses(ListImportProc builderItem.setTableName(I_AD_Process.Table_Name); builderItem.setId(processDefinition.getAD_Process_ID()); + builderItem.setUuid( + StringManager.getValidString( + processDefinition.getUUID() + ) + ); builderList.addRecords(builderItem.build()); }); diff --git a/src/main/proto/base_data_type.proto b/src/main/proto/base_data_type.proto index 7e5c3734..fc6e1a6e 100644 --- a/src/main/proto/base_data_type.proto +++ b/src/main/proto/base_data_type.proto @@ -41,9 +41,10 @@ message DocumentAction { // Lookup Item message LookupItem { int32 id = 1; - string table_name = 2; - google.protobuf.Struct values = 3; - bool is_active = 4; + string uuid = 2; + string table_name = 3; + google.protobuf.Struct values = 4; + bool is_active = 5; } message ListLookupItemsRequest {