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 2020/08/27 17:10:50 UTC
[ofbiz-framework] branch trunk updated: Improved: Checkstyle:
Variable name must match pattern (OFBIZ-11926)
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 96be0c6 Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
96be0c6 is described below
commit 96be0c62a3a81026d46c2a2b772d19f4b0d17480
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Thu Aug 27 19:09:07 2020 +0200
Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
All final data members of the class must match this naming pattern
'^[A-Z][A-Z0-9](_[A-Z0-9]+)$'
I added the changes in CommonScreens.xml and kept the
private static Map<String, String> localeFiles = new HashMap<>();
expression, instead of
private static Map<String, String> localeFiles = new HashMap<String, String>();
in JsLanguageFilesMapping.ftl
I note that we use JQuery instead of Java conventional Jquery but that sounds OK
with me
Thanks: Suraj for the patch
---
build.gradle | 2 +-
.../ofbiz/common/JsLanguageFileMappingCreator.java | 5 ++-
.../template/JsLanguageFilesMapping.ftl | 52 +++++++++++-----------
themes/common-theme/widget/CommonScreens.xml | 14 +++---
4 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/build.gradle b/build.gradle
index d991138..55cd820 100644
--- a/build.gradle
+++ b/build.gradle
@@ -288,7 +288,7 @@ checkstyle {
// the sum of errors found last time it was changed after using the
// ‘checkstyle’ tool present in the framework and in the official
// plugins.
- tasks.checkstyleMain.maxErrors = 4212
+ tasks.checkstyleMain.maxErrors = 4206
// Currently there are a lot of errors so we need to temporarily
// hide them to avoid polluting the terminal output.
showViolations = false
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java
index d7221d6..c06fe5f 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java
@@ -40,7 +40,7 @@ import org.apache.ofbiz.service.ServiceUtil;
import freemarker.template.TemplateException;
-// Use the createJsLanguageFileMapping service to create or update JsLanguageFilesMapping.java and JsLanguageFilesMapping.ftl files.
+// Use the createJsLanguageFileMapping service to create or update JsLanguageFilesMapping.java and JsLanguageFilesMapping.ftl files.
// You will still need to compile thereafter
public class JsLanguageFileMappingCreator {
@@ -224,7 +224,8 @@ public class JsLanguageFileMappingCreator {
FileUtils.writeStringToFile(file, writer.toString(), encoding);
} catch (IOException | TemplateException e) {
Debug.logError(e, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage("CommonUiLabels", "CommonOutputFileCouldNotBeCreated", UtilMisc.toMap("errorString", e.getMessage()), (Locale) context.get("locale")));
+ return ServiceUtil.returnError(UtilProperties.getMessage("CommonUiLabels", "CommonOutputFileCouldNotBeCreated",
+ UtilMisc.toMap("errorString", e.getMessage()), (Locale) context.get("locale")));
}
return result;
diff --git a/themes/common-theme/template/JsLanguageFilesMapping.ftl b/themes/common-theme/template/JsLanguageFilesMapping.ftl
index 9bc8838..8009f32 100644
--- a/themes/common-theme/template/JsLanguageFilesMapping.ftl
+++ b/themes/common-theme/template/JsLanguageFilesMapping.ftl
@@ -24,16 +24,16 @@ package org.apache.ofbiz.common;
import java.util.HashMap;
import java.util.Map;
- <#-- The comment in UPPERCASE below is dynamically put in the JsLanguageFilesMapping.java generated file, so please keep it... -->
+<#-- The comment in UPPERCASE below is dynamically put in the JsLanguageFilesMapping.java generated file, so please keep it... -->
public final class JsLanguageFilesMapping {
// DO NOT EDIT THIS FILE! THIS IS AUTO GENERATED AND WILL GET WRITTEN OVER PERIODICALLY WHEN THE DATA CHANGE
// Rather use the createJsLanguageFileMapping service to create or update it. You will still need to compile thereafter
- public static class datejs {
+ public static class DateJs {
- private static Map<String, String> localeFiles = new HashMap<String, String>();
+ private static Map<String, String> localeFiles = new HashMap<>();
private static String defaultDateJs = "/common/js/jquery/plugins/datejs/date-en-US.js";
static {
@@ -44,16 +44,16 @@ public final class JsLanguageFilesMapping {
}
public static String getFilePath(String locale) {
- if (datejs.localeFiles.containsKey(locale)) {
- return datejs.localeFiles.get(locale);
+ if (DateJs.localeFiles.containsKey(locale)) {
+ return DateJs.localeFiles.get(locale);
}
- return datejs.defaultDateJs;
+ return DateJs.defaultDateJs;
}
}
- public static class jquery {
- private static Map<String, String> localeFiles = new HashMap<String, String>();
+ public static class JQuery {
+ private static Map<String, String> localeFiles = new HashMap<>();
private static String defaultDateJs = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js";
static {
@@ -64,16 +64,16 @@ public final class JsLanguageFilesMapping {
}
public static String getFilePath(String locale) {
- if (datejs.localeFiles.containsKey(locale)) {
- return jquery.localeFiles.get(locale);
+ if (DateJs.localeFiles.containsKey(locale)) {
+ return JQuery.localeFiles.get(locale);
}
- return jquery.defaultDateJs;
+ return JQuery.defaultDateJs;
}
}
- public static class validation {
- private static Map<String, String> localeFiles = new HashMap<String, String>();
+ public static class Validation {
+ private static Map<String, String> localeFiles = new HashMap<>();
private static String defaultValidation = "/common/js/jquery/plugins/validate/localization/messages_en.js";
static {
@@ -84,15 +84,15 @@ public final class JsLanguageFilesMapping {
}
public static String getFilePath(String locale) {
- if (validation.localeFiles.containsKey(locale)) {
- return validation.localeFiles.get(locale);
+ if (Validation.localeFiles.containsKey(locale)) {
+ return Validation.localeFiles.get(locale);
}
- return validation.defaultValidation;
+ return Validation.defaultValidation;
}
}
- public static class dateTime {
- private static Map<String, String> localeFiles = new HashMap<String, String>();
+ public static class DateTime {
+ private static Map<String, String> localeFiles = new HashMap<>();
private static String defaultDateTime = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js";
static {
@@ -103,15 +103,15 @@ public final class JsLanguageFilesMapping {
}
public static String getFilePath(String locale) {
- if (dateTime.localeFiles.containsKey(locale)) {
- return dateTime.localeFiles.get(locale);
+ if (DateTime.localeFiles.containsKey(locale)) {
+ return DateTime.localeFiles.get(locale);
}
- return dateTime.defaultDateTime;
+ return DateTime.defaultDateTime;
}
}
- public static class select2 {
- private static Map<String, String> localeFiles = new HashMap<String, String>();
+ public static class Select2 {
+ private static Map<String, String> localeFiles = new HashMap<>();
private static String defaultSelect2 = "/common/js/jquery/plugins/select2/js/i18n/en.js";
static {
@@ -122,10 +122,10 @@ public final class JsLanguageFilesMapping {
}
public static String getFilePath(String locale) {
- if (select2.localeFiles.containsKey(locale)) {
- return select2.localeFiles.get(locale);
+ if (Select2.localeFiles.containsKey(locale)) {
+ return Select2.localeFiles.get(locale);
}
- return select2.defaultSelect2;
+ return Select2.defaultSelect2;
}
}
}
diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml
index 2a65c1a..11f7189 100644
--- a/themes/common-theme/widget/CommonScreens.xml
+++ b/themes/common-theme/widget/CommonScreens.xml
@@ -122,10 +122,10 @@ under the License.
<screen name="GlobalActions">
<section>
<actions>
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.datejs.getFilePath(initialLocaleComplete)}" global="true" />
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.jquery.getFilePath(initialLocaleComplete)}" global="true" />
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.validation.getFilePath(initialLocaleComplete)}" global="true" />
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.dateTime.getFilePath(initialLocaleComplete)}" global="true" />
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.DateJs.getFilePath(initialLocaleComplete)}" global="true" />
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.JQuery.getFilePath(initialLocaleComplete)}" global="true" />
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.Validation.getFilePath(initialLocaleComplete)}" global="true" />
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.DateTime.getFilePath(initialLocaleComplete)}" global="true" />
<!-- Jgrowl -->
<set field="layoutSettings.styleSheets[+0]" value="/common/js/jquery/plugins/jquery-jgrowl/jquery.jgrowl-1.4.6.min.css" global="true" />
<!-- Set default user locale from browser -->
@@ -431,9 +431,9 @@ under the License.
<!-- The default (global) java scripts -->
<!-- jQuery part -->
<!-- Load available JS Language Files -->
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.datejs.getFilePath(initialLocaleComplete)}" global="true"/>
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.jquery.getFilePath(initialLocaleComplete)}" global="true"/>
- <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.validation.getFilePath(initialLocaleComplete)}" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.DateJs.getFilePath(initialLocaleComplete)}" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.JQuery.getFilePath(initialLocaleComplete)}" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="${groovy: org.apache.ofbiz.common.JsLanguageFilesMapping.Validation.getFilePath(initialLocaleComplete)}" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.js" global="true"/>
<set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.js" global="true"/>