You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/04/13 11:35:51 UTC

[GitHub] [fineract] galovics commented on a diff in pull request #2279: FINERACT-1557: Fixes integration tests

galovics commented on code in PR #2279:
URL: https://github.com/apache/fineract/pull/2279#discussion_r849366254


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -491,7 +502,7 @@ private boolean isRegisteredDataTable(final String name) {
     private void assertDataTableExists(final String datatableName) {
         final String sql = "select (CASE WHEN exists (select 1 from information_schema.tables where table_schema = "
                 + sqlGenerator.currentSchema() + " and table_name = ?) THEN 'true' ELSE 'false' END)";
-        final String dataTableExistsString = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { datatableName }); // NOSONAR
+        final String dataTableExistsString = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { datatableName });

Review Comment:
   Please don't delete the NOSONAR note here.



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -559,7 +570,9 @@ private void parseDatatableColumnObjectForCreate(final JsonObject column, String
             } else if (type.equalsIgnoreCase("Decimal")) {
                 sqlBuilder = sqlBuilder.append("(19,6)");
             } else if (type.equalsIgnoreCase("Dropdown")) {
-                sqlBuilder = sqlBuilder.append("(11)");
+                if (databaseTypeResolver.isMySQL()) {
+                    sqlBuilder = sqlBuilder.append("(11)");

Review Comment:
   Don't we need this for PostgreSQL? 



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -329,6 +329,17 @@ private boolean isSurveyCategory(final Integer category) {
         return category.equals(DataTableApiConstant.CATEGORY_PPI);
     }
 
+    private JsonElement addColumn(final String name, final String dataType, final boolean isMandatory, final Integer length) {
+        JsonObject column = new JsonObject();
+        column.addProperty("name", name);
+        column.addProperty("type", dataType);
+        if (dataType.equalsIgnoreCase("string")) {
+            column.addProperty("length", length);
+        }
+        column.addProperty("mandatory", (isMandatory ? "true" : "false"));

Review Comment:
   Why the ternary operator here instead of just going with String.valueOf(isMandatory)?



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -938,9 +963,9 @@ public void updateDatatable(final String datatableName, final JsonCommand comman
             final boolean isConstraintApproach = this.configurationDomainService.isConstraintApproachEnabledForDatatables();
 
             if (!StringUtils.isBlank(entitySubType)) {
-                final String updateLegalFormSQL = "update x_registered_table SET entity_subtype='" + entitySubType
+                String updateLegalFormSQL = "update x_registered_table SET entity_subtype='" + entitySubType
                         + "' WHERE registered_table_name = '" + datatableName + "'";
-                this.jdbcTemplate.execute(updateLegalFormSQL); // NOSONAR
+                this.jdbcTemplate.execute(updateLegalFormSQL);

Review Comment:
   Please don't remove the NOSONAR note from here.



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/CollectionData.java:
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanaccount.data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+public final class CollectionData {

Review Comment:
   Let's utilize Lombok for this class instead of creating everything manually (getters/etc)



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -1476,7 +1501,7 @@ private String queryForApplicationTableName(final String datatable) {
         SQLInjectionValidator.validateSQLInput(datatable);
         final String sql = "SELECT application_table_name FROM x_registered_table where registered_table_name = ?";
 
-        String applicationTableName;
+        String applicationTableName = "";

Review Comment:
   Is there a reason we need to initialize the variable here?



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -1154,7 +1179,7 @@ private void assertDataTableEmpty(final String datatableName) {
 
     private int getRowCount(final String datatableName) {
         final String sql = "select count(*) from " + sqlGenerator.escape(datatableName);
-        return this.jdbcTemplate.queryForObject(sql, Integer.class); // NOSONAR
+        return this.jdbcTemplate.queryForObject(sql, Integer.class);

Review Comment:
   Please don't remove the NOSONAR note from here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org