From c0ab1b2660b285e6646f406c4959dbcaabd12b92 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 21 Aug 2019 15:37:16 -0500 Subject: [PATCH 1/3] remove system default handling, patch version snapshot --- auth/pom.xml | 10 +- core/pom.xml | 2 +- data/pom.xml | 4 +- .../weaver/data/utility/EntityUtility.java | 9 -- email/pom.xml | 2 +- messaging/pom.xml | 2 +- pom.xml | 2 +- reporting/pom.xml | 6 +- token-provider/pom.xml | 6 +- token/pom.xml | 2 +- user/pom.xml | 6 +- validation/pom.xml | 4 +- .../validation/utility/ValidationUtility.java | 106 ++++++++---------- wro/pom.xml | 4 +- 14 files changed, 73 insertions(+), 92 deletions(-) diff --git a/auth/pom.xml b/auth/pom.xml index 957d7e7e..6eefc762 100644 --- a/auth/pom.xml +++ b/auth/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -20,25 +20,25 @@ edu.tamu.weaver core - 2.0.0 + 2.0.1-SNAPSHOT edu.tamu.weaver user - 2.0.0 + 2.0.1-SNAPSHOT edu.tamu.weaver token - 2.0.0 + 2.0.1-SNAPSHOT edu.tamu.weaver email - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/core/pom.xml b/core/pom.xml index 8139adc8..9041eecb 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/data/pom.xml b/data/pom.xml index 2cb694c7..d6adf5a2 100644 --- a/data/pom.xml +++ b/data/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -20,7 +20,7 @@ edu.tamu.weaver core - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/data/src/main/java/edu/tamu/weaver/data/utility/EntityUtility.java b/data/src/main/java/edu/tamu/weaver/data/utility/EntityUtility.java index 39ead630..88f20974 100644 --- a/data/src/main/java/edu/tamu/weaver/data/utility/EntityUtility.java +++ b/data/src/main/java/edu/tamu/weaver/data/utility/EntityUtility.java @@ -29,7 +29,6 @@ public class EntityUtility { public static final String NAME_COLUMN_NAME = "name"; public static final String PASSWORD_COLUMN_NAME = "password"; public static final String POSITION_COLUMN_NAME = "position"; - public static final String SYSTEM_COLUMN_NAME = "isSystemRequired"; public static String snakeToCamelWithoutId(String value) { int l = 0; @@ -205,14 +204,6 @@ public static List queryByProperty(Class clazz, String property, Obje return entityManager.createQuery(query).getResultList(); } - public static Object createNewFromSystemDefault(Object model) { - EntityManager entityManager = SpringContext.bean(EntityManager.class); - setValueForProperty(model, SYSTEM_COLUMN_NAME, false); - setValueForProperty(model, ID_COLUMN_NAME, null); - entityManager.persist(model); - return model; - } - public static Field recursivelyFindField(Class clazz, String property) { Field field = null; try { diff --git a/email/pom.xml b/email/pom.xml index 636a0365..c303a49d 100644 --- a/email/pom.xml +++ b/email/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/messaging/pom.xml b/messaging/pom.xml index adb38dfc..2a2a3f18 100644 --- a/messaging/pom.xml +++ b/messaging/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 201175b8..3b2215ed 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT Weaver Webservice Parent diff --git a/reporting/pom.xml b/reporting/pom.xml index c45d28df..3d4afb18 100644 --- a/reporting/pom.xml +++ b/reporting/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -20,13 +20,13 @@ edu.tamu.weaver core - 2.0.0 + 2.0.1-SNAPSHOT edu.tamu.weaver email - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/token-provider/pom.xml b/token-provider/pom.xml index f02693d0..906b510e 100644 --- a/token-provider/pom.xml +++ b/token-provider/pom.xml @@ -13,7 +13,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -26,13 +26,13 @@ edu.tamu.weaver token - 2.0.0 + 2.0.1-SNAPSHOT edu.tamu.weaver core - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/token/pom.xml b/token/pom.xml index e9644d45..5fb3ccee 100644 --- a/token/pom.xml +++ b/token/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/user/pom.xml b/user/pom.xml index 6d4dc360..c455290b 100644 --- a/user/pom.xml +++ b/user/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -21,13 +21,13 @@ edu.tamu.weaver data - 2.0.0 + 2.0.1-SNAPSHOT edu.tamu.weaver validation - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/validation/pom.xml b/validation/pom.xml index c3eba9c3..113d4133 100644 --- a/validation/pom.xml +++ b/validation/pom.xml @@ -12,7 +12,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -21,7 +21,7 @@ edu.tamu.weaver data - 2.0.0 + 2.0.1-SNAPSHOT diff --git a/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java b/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java index ab25f91d..ca6be101 100644 --- a/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java +++ b/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java @@ -2,8 +2,6 @@ import static edu.tamu.weaver.data.utility.EntityUtility.NAME_COLUMN_NAME; import static edu.tamu.weaver.data.utility.EntityUtility.PASSWORD_COLUMN_NAME; -import static edu.tamu.weaver.data.utility.EntityUtility.SYSTEM_COLUMN_NAME; -import static edu.tamu.weaver.data.utility.EntityUtility.createNewFromSystemDefault; import static edu.tamu.weaver.data.utility.EntityUtility.getFieldForProperty; import static edu.tamu.weaver.data.utility.EntityUtility.getValueForProperty; import static edu.tamu.weaver.data.utility.EntityUtility.getValueFromPath; @@ -156,7 +154,8 @@ public static ValidationResults validateInputs(Inpu } @SuppressWarnings("unchecked") - public static ValidationResults validateBusiness(BusinessValidator validator, U model) { + public static ValidationResults validateBusiness(BusinessValidator validator, + U model) { ValidationResults results = new ValidationResults(); switch (validator.getType()) { @@ -196,7 +195,8 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(model, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to create due to restrictions! " + model.getClass().getSimpleName() + " " + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; + message = "Unable to create due to restrictions! " + model.getClass().getSimpleName() + " " + + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; invalid = true; } } @@ -237,16 +237,10 @@ public static ValidationResults validateBusiness(Bu // check if unique constraints will be violated!! - Boolean isSystemRequired = (Boolean) getValueForProperty(model, SYSTEM_COLUMN_NAME); - - if (isSystemRequired != null && isSystemRequired) { - model = (U) createNewFromSystemDefault(model); - } else { - if (uniqueConstraintPropertyChange(model)) { - UniqueConstraintViolation uniqueConstraintViolation = validateUniqueConstraints(model); - invalid = uniqueConstraintViolation.invalid; - message = uniqueConstraintViolation.message; - } + if (uniqueConstraintPropertyChange(model)) { + UniqueConstraintViolation uniqueConstraintViolation = validateUniqueConstraints(model); + invalid = uniqueConstraintViolation.invalid; + message = uniqueConstraintViolation.message; } } @@ -259,7 +253,8 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(model, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to update due to restrictions! " + model.getClass().getSimpleName() + " " + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; + message = "Unable to update due to restrictions! " + model.getClass().getSimpleName() + " " + + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; invalid = true; } } @@ -295,7 +290,8 @@ public static ValidationResults validateBusiness(Bu if (!invalid) { - // check if relationships from params(columns) will cause foreign key constraints!! + // check if relationships from params(columns) will cause foreign key + // constraints!! U modelToDelete = (U) queryResults.get(0); @@ -310,9 +306,11 @@ public static ValidationResults validateBusiness(Bu String name = (String) getValueForProperty(model, NAME_COLUMN_NAME); if (name != null) { - message = "Could not delete " + model.getClass().getSimpleName() + " " + name + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " " + name + + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; } else { - message = "Could not delete " + model.getClass().getSimpleName() + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " with id " + + ((WeaverEntity) model).getId() + " due to having " + param; } } @@ -323,9 +321,11 @@ public static ValidationResults validateBusiness(Bu String name = (String) getValueForProperty(model, NAME_COLUMN_NAME); if (name != null) { - message = "Could not delete " + model.getClass().getSimpleName() + " " + name + "(" + ((WeaverEntity) model).getId() + ") due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " " + name + "(" + + ((WeaverEntity) model).getId() + ") due to having " + param; } else { - message = "Could not delete " + model.getClass().getSimpleName() + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " with id " + + ((WeaverEntity) model).getId() + " due to having " + param; } } } else { @@ -349,14 +349,18 @@ public static ValidationResults validateBusiness(Bu if (field.getType().equals(modelToDelete.getClass())) { - List queryByPropertyResults = queryByProperty(join, field.getName(), modelToDelete); + List queryByPropertyResults = queryByProperty(join, field.getName(), + modelToDelete); if (queryByPropertyResults.size() > 0) { invalid = true; U owningModel = (U) queryByPropertyResults.get(0); - message = "Could not delete " + modelToDelete.getClass().getSimpleName() + " with id " + ((WeaverEntity) modelToDelete).getId() + " due to being used by " + owningModel.getClass().getSimpleName() + " with id " + ((WeaverEntity) owningModel).getId(); + message = "Could not delete " + modelToDelete.getClass().getSimpleName() + + " with id " + ((WeaverEntity) modelToDelete).getId() + + " due to being used by " + owningModel.getClass().getSimpleName() + + " with id " + ((WeaverEntity) owningModel).getId(); } } @@ -364,14 +368,18 @@ public static ValidationResults validateBusiness(Bu if (!invalid && validator.getRestrict().length() == 0 && validator.getPath().length > 0) { String fullPath = String.join(".", validator.getPath()); - List queryByPropertyResults = queryByProperty(join, fullPath, ((WeaverEntity) modelToDelete).getId()); + List queryByPropertyResults = queryByProperty(join, fullPath, + ((WeaverEntity) modelToDelete).getId()); if (queryByPropertyResults.size() > 0) { invalid = true; - message = "Could not delete " + modelToDelete.getClass().getSimpleName() + " with id " + ((WeaverEntity) modelToDelete).getId() + " due to being used by "; + message = "Could not delete " + modelToDelete.getClass().getSimpleName() + + " with id " + ((WeaverEntity) modelToDelete).getId() + + " due to being used by "; for (Object qm : queryByPropertyResults) { - message += qm.getClass().getSimpleName() + " with id " + ((WeaverEntity) qm).getId(); + message += qm.getClass().getSimpleName() + " with id " + + ((WeaverEntity) qm).getId(); } } @@ -395,7 +403,9 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(joinedEnity, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to delete due to restrictions! " + join.getSimpleName() + " " + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; + message = "Unable to delete due to restrictions! " + join.getSimpleName() + " " + + String.join(".", validator.getPath()) + " cannot be " + + validator.getRestrict() + "!"; invalid = true; break; } @@ -415,21 +425,14 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(model, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to delete due to restrictions! " + model.getClass().getSimpleName() + " " + String.join(".", validator.getPath()) + " is " + validator.getRestrict() + "!"; + message = "Unable to delete due to restrictions! " + model.getClass().getSimpleName() + " " + + String.join(".", validator.getPath()) + " is " + validator.getRestrict() + "!"; invalid = true; } } } - if (!invalid) { - Object value = getValueForProperty(model, SYSTEM_COLUMN_NAME); - if (value != null && ((Boolean) value) == true) { - invalid = true; - message = model.getClass().getSimpleName() + " with id " + ((WeaverEntity) model).getId() + " is a system default and cannot be deleted"; - } - } - if (invalid) { results.addMessage(BUSINESS_MESSAGE_KEY, validator.getType().toString(), message); results.setValid(false); @@ -454,24 +457,6 @@ public static ValidationResults validateBusiness(Bu } } - // check if model has a system default - - if (!invalid) { - if (getFieldForProperty(model, SYSTEM_COLUMN_NAME) == null) { - invalid = true; - message = model.getClass().getSimpleName() + " is not a system default in which can be reset"; - } - } - - // check if model is not a system default - - if (!invalid) { - if ((Boolean) getValueForProperty(model, SYSTEM_COLUMN_NAME) == true) { - invalid = true; - message = model.getClass().getSimpleName() + " is the system default"; - } - } - if (invalid) { results.addMessage(BUSINESS_MESSAGE_KEY, validator.getType().toString(), message); results.setValid(false); @@ -727,7 +712,8 @@ public static ValidationResults validateMethod( if (!invalid) { if (recursivelyFindField(validator.getClazz(), (String) validator.getArgs()[columnIndex]) == null) { invalid = true; - message = (String) validator.getArgs()[0] + " is not a column of " + validator.getClazz().getSimpleName(); + message = (String) validator.getArgs()[0] + " is not a column of " + + validator.getClazz().getSimpleName(); } } @@ -832,7 +818,8 @@ private static UniqueConstraintViolation validateUn Object value = getValueForProperty(model, property); if (value != null) { - if (!(value instanceof WeaverEntity) || ((value instanceof WeaverEntity) && ((WeaverEntity) value).getId() != null)) { + if (!(value instanceof WeaverEntity) + || ((value instanceof WeaverEntity) && ((WeaverEntity) value).getId() != null)) { if (!((value instanceof String) && ((String) value).length() == 0)) { predicates.add(cb.equal(root.get(property), value)); @@ -846,10 +833,12 @@ private static UniqueConstraintViolation validateUn } } - uniqueConstraintViolation.message = uniqueConstraintViolation.message.substring(0, uniqueConstraintViolation.message.length() - 2); + uniqueConstraintViolation.message = uniqueConstraintViolation.message.substring(0, + uniqueConstraintViolation.message.length() - 2); int index = uniqueConstraintViolation.message.lastIndexOf(", "); if (index >= 0) { - uniqueConstraintViolation.message = new StringBuilder(uniqueConstraintViolation.message).replace(index, index + ", ".length(), " and ").toString(); + uniqueConstraintViolation.message = new StringBuilder(uniqueConstraintViolation.message) + .replace(index, index + ", ".length(), " and ").toString(); } if (!invalid) { @@ -870,7 +859,8 @@ private static UniqueConstraintViolation validateUn return uniqueConstraintViolation; } - private static String craftUniqueConstraintsMessage(U model, List violatingColumns) { + private static String craftUniqueConstraintsMessage(U model, + List violatingColumns) { String message = model.getClass().getSimpleName() + " with "; for (String column : violatingColumns) { Object value = getValueForProperty(model, column); diff --git a/wro/pom.xml b/wro/pom.xml index a6e6020b..c69890ee 100644 --- a/wro/pom.xml +++ b/wro/pom.xml @@ -13,7 +13,7 @@ edu.tamu.weaver webservice-parent - 2.0.0 + 2.0.1-SNAPSHOT @@ -22,7 +22,7 @@ edu.tamu.weaver data - 2.0.0 + 2.0.1-SNAPSHOT From 4bd549a19af6c6530498e2d495cdf041ceb21a5f Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 21 Aug 2019 15:40:43 -0500 Subject: [PATCH 2/3] remove unused import, undo formatting changes --- .../validation/utility/ValidationUtility.java | 62 ++++++------------- 1 file changed, 19 insertions(+), 43 deletions(-) diff --git a/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java b/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java index ca6be101..58250f90 100644 --- a/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java +++ b/validation/src/main/java/edu/tamu/weaver/validation/utility/ValidationUtility.java @@ -2,7 +2,6 @@ import static edu.tamu.weaver.data.utility.EntityUtility.NAME_COLUMN_NAME; import static edu.tamu.weaver.data.utility.EntityUtility.PASSWORD_COLUMN_NAME; -import static edu.tamu.weaver.data.utility.EntityUtility.getFieldForProperty; import static edu.tamu.weaver.data.utility.EntityUtility.getValueForProperty; import static edu.tamu.weaver.data.utility.EntityUtility.getValueFromPath; import static edu.tamu.weaver.data.utility.EntityUtility.queryAllWithClass; @@ -154,8 +153,7 @@ public static ValidationResults validateInputs(Inpu } @SuppressWarnings("unchecked") - public static ValidationResults validateBusiness(BusinessValidator validator, - U model) { + public static ValidationResults validateBusiness(BusinessValidator validator, U model) { ValidationResults results = new ValidationResults(); switch (validator.getType()) { @@ -195,8 +193,7 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(model, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to create due to restrictions! " + model.getClass().getSimpleName() + " " - + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; + message = "Unable to create due to restrictions! " + model.getClass().getSimpleName() + " " + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; invalid = true; } } @@ -253,8 +250,7 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(model, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to update due to restrictions! " + model.getClass().getSimpleName() + " " - + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; + message = "Unable to update due to restrictions! " + model.getClass().getSimpleName() + " " + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; invalid = true; } } @@ -306,11 +302,9 @@ public static ValidationResults validateBusiness(Bu String name = (String) getValueForProperty(model, NAME_COLUMN_NAME); if (name != null) { - message = "Could not delete " + model.getClass().getSimpleName() + " " + name - + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " " + name + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; } else { - message = "Could not delete " + model.getClass().getSimpleName() + " with id " - + ((WeaverEntity) model).getId() + " due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; } } @@ -321,11 +315,9 @@ public static ValidationResults validateBusiness(Bu String name = (String) getValueForProperty(model, NAME_COLUMN_NAME); if (name != null) { - message = "Could not delete " + model.getClass().getSimpleName() + " " + name + "(" - + ((WeaverEntity) model).getId() + ") due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " " + name + "(" + ((WeaverEntity) model).getId() + ") due to having " + param; } else { - message = "Could not delete " + model.getClass().getSimpleName() + " with id " - + ((WeaverEntity) model).getId() + " due to having " + param; + message = "Could not delete " + model.getClass().getSimpleName() + " with id " + ((WeaverEntity) model).getId() + " due to having " + param; } } } else { @@ -349,18 +341,14 @@ public static ValidationResults validateBusiness(Bu if (field.getType().equals(modelToDelete.getClass())) { - List queryByPropertyResults = queryByProperty(join, field.getName(), - modelToDelete); + List queryByPropertyResults = queryByProperty(join, field.getName(), modelToDelete); if (queryByPropertyResults.size() > 0) { invalid = true; U owningModel = (U) queryByPropertyResults.get(0); - message = "Could not delete " + modelToDelete.getClass().getSimpleName() - + " with id " + ((WeaverEntity) modelToDelete).getId() - + " due to being used by " + owningModel.getClass().getSimpleName() - + " with id " + ((WeaverEntity) owningModel).getId(); + message = "Could not delete " + modelToDelete.getClass().getSimpleName() + " with id " + ((WeaverEntity) modelToDelete).getId() + " due to being used by " + owningModel.getClass().getSimpleName() + " with id " + ((WeaverEntity) owningModel).getId(); } } @@ -368,18 +356,14 @@ public static ValidationResults validateBusiness(Bu if (!invalid && validator.getRestrict().length() == 0 && validator.getPath().length > 0) { String fullPath = String.join(".", validator.getPath()); - List queryByPropertyResults = queryByProperty(join, fullPath, - ((WeaverEntity) modelToDelete).getId()); + List queryByPropertyResults = queryByProperty(join, fullPath, ((WeaverEntity) modelToDelete).getId()); if (queryByPropertyResults.size() > 0) { invalid = true; - message = "Could not delete " + modelToDelete.getClass().getSimpleName() - + " with id " + ((WeaverEntity) modelToDelete).getId() - + " due to being used by "; + message = "Could not delete " + modelToDelete.getClass().getSimpleName() + " with id " + ((WeaverEntity) modelToDelete).getId() + " due to being used by "; for (Object qm : queryByPropertyResults) { - message += qm.getClass().getSimpleName() + " with id " - + ((WeaverEntity) qm).getId(); + message += qm.getClass().getSimpleName() + " with id " + ((WeaverEntity) qm).getId(); } } @@ -403,9 +387,7 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(joinedEnity, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to delete due to restrictions! " + join.getSimpleName() + " " - + String.join(".", validator.getPath()) + " cannot be " - + validator.getRestrict() + "!"; + message = "Unable to delete due to restrictions! " + join.getSimpleName() + " " + String.join(".", validator.getPath()) + " cannot be " + validator.getRestrict() + "!"; invalid = true; break; } @@ -425,8 +407,7 @@ public static ValidationResults validateBusiness(Bu Object value = getValueFromPath(model, validator.getPath()); if (value.toString().equals(validator.getRestrict())) { - message = "Unable to delete due to restrictions! " + model.getClass().getSimpleName() + " " - + String.join(".", validator.getPath()) + " is " + validator.getRestrict() + "!"; + message = "Unable to delete due to restrictions! " + model.getClass().getSimpleName() + " " + String.join(".", validator.getPath()) + " is " + validator.getRestrict() + "!"; invalid = true; } } @@ -712,8 +693,7 @@ public static ValidationResults validateMethod( if (!invalid) { if (recursivelyFindField(validator.getClazz(), (String) validator.getArgs()[columnIndex]) == null) { invalid = true; - message = (String) validator.getArgs()[0] + " is not a column of " - + validator.getClazz().getSimpleName(); + message = (String) validator.getArgs()[0] + " is not a column of " + validator.getClazz().getSimpleName(); } } @@ -818,8 +798,7 @@ private static UniqueConstraintViolation validateUn Object value = getValueForProperty(model, property); if (value != null) { - if (!(value instanceof WeaverEntity) - || ((value instanceof WeaverEntity) && ((WeaverEntity) value).getId() != null)) { + if (!(value instanceof WeaverEntity) || ((value instanceof WeaverEntity) && ((WeaverEntity) value).getId() != null)) { if (!((value instanceof String) && ((String) value).length() == 0)) { predicates.add(cb.equal(root.get(property), value)); @@ -833,12 +812,10 @@ private static UniqueConstraintViolation validateUn } } - uniqueConstraintViolation.message = uniqueConstraintViolation.message.substring(0, - uniqueConstraintViolation.message.length() - 2); + uniqueConstraintViolation.message = uniqueConstraintViolation.message.substring(0, uniqueConstraintViolation.message.length() - 2); int index = uniqueConstraintViolation.message.lastIndexOf(", "); if (index >= 0) { - uniqueConstraintViolation.message = new StringBuilder(uniqueConstraintViolation.message) - .replace(index, index + ", ".length(), " and ").toString(); + uniqueConstraintViolation.message = new StringBuilder(uniqueConstraintViolation.message).replace(index, index + ", ".length(), " and ").toString(); } if (!invalid) { @@ -859,8 +836,7 @@ private static UniqueConstraintViolation validateUn return uniqueConstraintViolation; } - private static String craftUniqueConstraintsMessage(U model, - List violatingColumns) { + private static String craftUniqueConstraintsMessage(U model, List violatingColumns) { String message = model.getClass().getSimpleName() + " with "; for (String column : violatingColumns) { Object value = getValueForProperty(model, column); From 64de1e1e0856e42f5d1682a71cae03396137d58f Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 21 Aug 2019 15:42:00 -0500 Subject: [PATCH 3/3] switch travis ci to openjdk8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fb6a2d64..157ef94c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: java jdk: - - oraclejdk8 + - openjdk8 install: - mvn test-compile -DskipTests=true -Dmaven.javadoc.skip=true -B -V