From 35d89fa48de27593e950ae23a0258ff578b730b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Plohn?= Date: Fri, 25 Aug 2023 11:18:53 +0200 Subject: [PATCH] minor refactoring update README.md --- persistence-utils-product/README.md | 3 ++- .../com/axonivy/utils/persistence/beans/ToggleableEntity.java | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/persistence-utils-product/README.md b/persistence-utils-product/README.md index 76a3adc..f6eea78 100644 --- a/persistence-utils-product/README.md +++ b/persistence-utils-product/README.md @@ -23,10 +23,11 @@ Axon Ivy's JPA Persistence Lib utility helps you accelerate process automation i *Incompatibilities* - Datatype of **AuditableEntity**s **Header** attributes for create/update and delete date where changed to *Instant* - Attribute **expiryDate** of **ToggleableEntity** has been renamed to **expiry** and its datatype changed to *Instant* -- Datatype of **ToggleableEntity**s **enabled** has been changed to boolean +- Attribute **ToggleableEntity**s **isEnabled** has been renamed to **enabled** and its datatype changed to *boolean* *Recommendations* - rename the expiry column to **expiry** unless you have customized the column names anyways. e.g. ALTER TABLE **yourtable** RENAME COLUMN **expiryDate** TO **expiry**. +- rename the isEnabled column to **enabled** unless you have customized the column names anyways. e.g. ALTER TABLE **yourtable** RENAME COLUMN **isEnabled** TO **enabled**. - Make sure there are no *NULL* values for the **enabled** column in your database. The column was defined as not nullable, so only manual changes in the database should have lead to *NULL* values - use *get/set...AsDate* or *get/set...AsLocalDateTime* methods to get converted datatypes of create/update/delete/expiry *Instant*s diff --git a/persistence-utils/src/com/axonivy/utils/persistence/beans/ToggleableEntity.java b/persistence-utils/src/com/axonivy/utils/persistence/beans/ToggleableEntity.java index 52de471..f2774f6 100644 --- a/persistence-utils/src/com/axonivy/utils/persistence/beans/ToggleableEntity.java +++ b/persistence-utils/src/com/axonivy/utils/persistence/beans/ToggleableEntity.java @@ -74,8 +74,7 @@ public void setExpiry(Instant expiryDate) { * @return true if expiryDate is set and is before */ public boolean isExpired() { - Instant now = Instant.now(); - return expiry != null && expiry.compareTo(now) < 0; + return expiry != null && expiry.isBefore(Instant.now(null)); } /**