You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2022/02/03 08:54:00 UTC
[ofbiz-framework] branch trunk updated: Improved: no functional change, adds a BuildBot badge (INFRA-22807)
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 884864b Improved: no functional change, adds a BuildBot badge (INFRA-22807)
884864b is described below
commit 884864b07ffaa0c6eae79c52d2a37717f1aa5b1e
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Thu Feb 3 09:53:55 2022 +0100
Improved: no functional change, adds a BuildBot badge (INFRA-22807)
It works locally (once you have installed Ruby, asciidoctor and
asciidoctor-diagram). CHecking that it's also OK on BuildBot, let's see result
at https://nightlies.apache.org/ofbiz/trunk/readme/html5/
---
README.adoc | 1 +
.../ofbiz/widget/model/ModelFormFieldBuilder.java | 107 +++++++++------------
2 files changed, 47 insertions(+), 61 deletions(-)
diff --git a/README.adoc b/README.adoc
index d18f10d..2d24417 100644
--- a/README.adoc
+++ b/README.adoc
@@ -22,6 +22,7 @@ The Apache OFBiz Project
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[link=http://www.apache.org/licenses/LICENSE-2.0]
image:https://img.shields.io/badge/Version-trunk-blue.svg[link=https://github.com/apache/ofbiz-framework]
+image:https://ci2.apache.org/badges/ofbizTrunkFrameworkPlugins.svg[link=https://ci2.apache.org/badges/ofbizTrunkFrameworkPlugins.svg]
image:https://github.com/apache/ofbiz-framework/actions/workflows/gradle.yaml/badge.svg?branch=trunk[link=https://github.com/apache/ofbiz-framework/actions/workflows/gradle.yaml]
image:https://sonarcloud.io/api/project_badges/measure?project=apache_ofbiz-framework&metric=alert_status[link=https://sonarcloud.io/dashboard?id=apache_ofbiz-framework]
image:https://github.com/apache/ofbiz-framework/actions/workflows/codeql-analysis.yml/badge.svg[link=https://github.com/apache/ofbiz-framework/actions/workflows/codeql-analysis.yml]
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java
index cfbefab..d01a8e6 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java
@@ -20,12 +20,10 @@ package org.apache.ofbiz.widget.model;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.StringUtil;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.base.util.UtilXml;
@@ -854,68 +852,55 @@ public class ModelFormFieldBuilder {
}
this.serviceName = modelService.getName();
this.attributeName = modelParam.getName();
- String modelParamFieldType = computeFieldTypeToUse(modelParam.getType());
- FieldInfo fieldInfo = null;
- switch (defaultFieldType) {
- case "display":
- fieldInfo = new ModelFormField.DisplayField(FieldInfo.SOURCE_AUTO_SERVICE, null);
- break;
- case "hidden":
- fieldInfo = new ModelFormField.HiddenField(FieldInfo.SOURCE_AUTO_SERVICE, null);
- break;
- case "find":
- if ("text".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.TextFindField(FieldInfo.SOURCE_AUTO_SERVICE, null);
- } else if ("numeric".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.RangeFindField(FieldInfo.SOURCE_AUTO_SERVICE, 6, null);
- } else if ("timestamp".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.DateFindField(FieldInfo.SOURCE_AUTO_SERVICE, "timestamp");
- } else if ("date".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.DateFindField(FieldInfo.SOURCE_AUTO_SERVICE, "date");
- } else if ("time".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.DateFindField(FieldInfo.SOURCE_AUTO_SERVICE, "time");
- }
- break;
- default: // default to "edit"
- if ("text".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.TextField(FieldInfo.SOURCE_AUTO_SERVICE, null);
- } else if ("numeric".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.TextField(FieldInfo.SOURCE_AUTO_SERVICE, 6, null, null);
- } else if ("timestamp".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.DateTimeField(FieldInfo.SOURCE_AUTO_SERVICE, "timestamp");
- } else if ("date".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.DateTimeField(FieldInfo.SOURCE_AUTO_SERVICE, "date");
- } else if ("time".equals(modelParamFieldType)) {
- fieldInfo = new ModelFormField.DateTimeField(FieldInfo.SOURCE_AUTO_SERVICE, "time");
+ if ("find".equals(defaultFieldType)) {
+ if (modelParam.getType().indexOf("Double") != -1 || modelParam.getType().indexOf("Float") != -1
+ || modelParam.getType().indexOf("Long") != -1 || modelParam.getType().indexOf("Integer") != -1) {
+ ModelFormField.RangeFindField textField = new ModelFormField.RangeFindField(FieldInfo.SOURCE_AUTO_SERVICE, 6,
+ null);
+ this.setFieldInfo(textField);
+ } else if (modelParam.getType().indexOf("Timestamp") != -1) {
+ ModelFormField.DateFindField dateTimeField = new ModelFormField.DateFindField(FieldInfo.SOURCE_AUTO_SERVICE,
+ "timestamp");
+ this.setFieldInfo(dateTimeField);
+ } else if (modelParam.getType().indexOf("Date") != -1) {
+ ModelFormField.DateFindField dateTimeField = new ModelFormField.DateFindField(FieldInfo.SOURCE_AUTO_SERVICE,
+ "date");
+ this.setFieldInfo(dateTimeField);
+ } else if (modelParam.getType().indexOf("Time") != -1) {
+ ModelFormField.DateFindField dateTimeField = new ModelFormField.DateFindField(FieldInfo.SOURCE_AUTO_SERVICE,
+ "time");
+ this.setFieldInfo(dateTimeField);
+ } else {
+ ModelFormField.TextFindField textField = new ModelFormField.TextFindField(FieldInfo.SOURCE_AUTO_SERVICE, null);
+ this.setFieldInfo(textField);
}
- }
- this.setFieldInfo(fieldInfo);
- return fieldInfo != null;
- }
-
- /**
- * For a service model parameter type, return the logique field type to use
- * If nothing found, return text
- * @param modelParamType
- * @return
- */
- private String computeFieldTypeToUse(String modelParamType) {
- final Map<String, String> switchType = Map.of("Double", "numeric",
- "Float", "numeric",
- "Long", "numeric",
- "Integer", "numeric",
- "BigDecimal", "numeric",
- "Timestamp", "timestamp",
- "Date", "date",
- "Time", "time");
- String typeToConvert = "";
- if (modelParamType.contains(".")) {
- LinkedList<String> splitString = new LinkedList<>(StringUtil.split(modelParamType, "."));
- typeToConvert = splitString.getLast();
+ } else if ("display".equals(defaultFieldType)) {
+ ModelFormField.DisplayField displayField = new ModelFormField.DisplayField(FieldInfo.SOURCE_AUTO_SERVICE, null);
+ this.setFieldInfo(displayField);
} else {
- typeToConvert = modelParamType;
+ // default to "edit"
+ if (modelParam.getType().indexOf("Double") != -1 || modelParam.getType().indexOf("Float") != -1
+ || modelParam.getType().indexOf("Long") != -1 || modelParam.getType().indexOf("Integer") != -1) {
+ ModelFormField.TextField textField = new ModelFormField.TextField(FieldInfo.SOURCE_AUTO_SERVICE, 6, null, null);
+ this.setFieldInfo(textField);
+ } else if (modelParam.getType().indexOf("Timestamp") != -1) {
+ ModelFormField.DateTimeField dateTimeField = new ModelFormField.DateTimeField(FieldInfo.SOURCE_AUTO_SERVICE,
+ "timestamp");
+ this.setFieldInfo(dateTimeField);
+ } else if (modelParam.getType().indexOf("Date") != -1) {
+ ModelFormField.DateTimeField dateTimeField = new ModelFormField.DateTimeField(FieldInfo.SOURCE_AUTO_SERVICE,
+ "date");
+ this.setFieldInfo(dateTimeField);
+ } else if (modelParam.getType().indexOf("Time") != -1) {
+ ModelFormField.DateTimeField dateTimeField = new ModelFormField.DateTimeField(FieldInfo.SOURCE_AUTO_SERVICE,
+ "time");
+ this.setFieldInfo(dateTimeField);
+ } else {
+ ModelFormField.TextField textField = new ModelFormField.TextField(FieldInfo.SOURCE_AUTO_SERVICE, null);
+ this.setFieldInfo(textField);
+ }
}
- return switchType.containsKey(typeToConvert) ? switchType.get(typeToConvert) : "text";
+ return true;
}
private boolean induceFieldInfoFromServiceParam(String defaultFieldType, ModelReader entityModelReader,
Re: [ofbiz-framework] branch trunk updated: Improved: no functional change, adds a BuildBot badge (INFRA-22807)
Posted by Jacques Le Roux <ja...@les7arts.com>.
Actually that was my bad to commit my local changes that helped me to get ahead.
I should have kept them local until you resolved the issue. BTW I did not change R22.
Please do as you prefer:
* don't wait for using SDK 11, fix the issue in both using your local code w/o reverting
* revert only R22 and wait for JDK 11 to commit both
I vaguely feel another option is possible, but my mind seems to like to hide it to "me". Weird isn't, intuition is not always right anyway. I guess
it's hypoglycaemic :)
HTH
Jacques
Le 03/02/2022 à 10:09, Nicolas Malin a écrit :
> No worries Jacques, I revert my local fix commit, you gone faster than me.
>
> What can I do for help, to escape any collision with you ?
>
> Nicolas
>
> On 03/02/2022 10:02, Jacques Le Roux wrote:
>> Le 03/02/2022 à 09:54,jleroux@apache.org a écrit :
>>> Improved: no functional change, adds a BuildBot badge (INFRA-22807)
>>> It works locally (once you have installed Ruby, asciidoctor
>>> and
>>> asciidoctor-diagram). CHecking that it's also OK on BuildBot,
>>> let's see result
>>> athttps://nightlies.apache.org/ofbiz/trunk/readme/html5/
>>> ---
>>> README.adoc | 1 +
>>> .../ofbiz/widget/model/ModelFormFieldBuilder.java | 107
>>> +++++++++------------
>>> 2 files changed, 47 insertions(+), 61 deletions(-)
>> Revert in model/ModelFormFieldBuilder.java should not have been part
>> of previous commit but another commit, my bad.
>>
>> Anyway at least things can get ahead now...
>>
>>
Re: [ofbiz-framework] branch trunk updated: Improved: no functional change, adds a BuildBot badge (INFRA-22807)
Posted by Nicolas Malin <ni...@nereide.fr>.
No worries Jacques, I revert my local fix commit, you gone faster than me.
What can I do for help, to escape any collision with you ?
Nicolas
On 03/02/2022 10:02, Jacques Le Roux wrote:
> Le 03/02/2022 à 09:54, jleroux@apache.org a écrit :
>> Improved: no functional change, adds a BuildBot badge (INFRA-22807)
>> It works locally (once you have installed Ruby, asciidoctor
>> and
>> asciidoctor-diagram). CHecking that it's also OK on BuildBot,
>> let's see result
>> athttps://nightlies.apache.org/ofbiz/trunk/readme/html5/
>> ---
>> README.adoc | 1 +
>> .../ofbiz/widget/model/ModelFormFieldBuilder.java | 107
>> +++++++++------------
>> 2 files changed, 47 insertions(+), 61 deletions(-)
> Revert in model/ModelFormFieldBuilder.java should not have been part
> of previous commit but another commit, my bad.
>
> Anyway at least things can get ahead now...
>
>
Re: [ofbiz-framework] branch trunk updated: Improved: no functional change, adds a BuildBot badge (INFRA-22807)
Posted by Jacques Le Roux <jl...@apache.org>.
Le 03/02/2022 à 09:54, jleroux@apache.org a écrit :
> Improved: no functional change, adds a BuildBot badge (INFRA-22807)
>
> It works locally (once you have installed Ruby, asciidoctor and
> asciidoctor-diagram). CHecking that it's also OK on BuildBot, let's see result
> athttps://nightlies.apache.org/ofbiz/trunk/readme/html5/
> ---
> README.adoc | 1 +
> .../ofbiz/widget/model/ModelFormFieldBuilder.java | 107 +++++++++------------
> 2 files changed, 47 insertions(+), 61 deletions(-)
Revert in model/ModelFormFieldBuilder.java should not have been part of previous commit but another commit, my bad.
Anyway at least things can get ahead now...