fixes issue 40067: Cleanup in EntityPersistenceEventObserver classes
authorCarlos Aristu <carlos.aristu@openbravo.com>
Wed, 30 Jan 2019 18:38:10 +0100
changeset 35410 41c88f9c32e6
parent 35409 396b375afe22
child 35426 9141b6a4a4e8
fixes issue 40067: Cleanup in EntityPersistenceEventObserver classes
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_FinaccTransactionEventListener.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_PaymentEventListener.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_ReconciliationEventListener.java
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/OrderTestObserver.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentConfigEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentMetadataEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/BusinessPartnerBankAccountHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/DataPoolSelectionEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/FieldHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/GeneralLedgerOrganizationHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/LocationSettingsHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/MenuCacheHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ModuleHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/NoteEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RemoveImagesEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ReorderCascadingChildDeletionsHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RoleAccessUniqueHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableTreeEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/UsageAuditHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/WindowPersonalizationEventHandler.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorFieldHandler.java
src/org/openbravo/erpCommon/ad_callouts/SysInfoCustomAllowed.java
src/org/openbravo/event/ADTableEventHandler.java
src/org/openbravo/event/ADTableNavigationEventHandler.java
src/org/openbravo/event/BusinessPartnerEventHandler.java
src/org/openbravo/event/CharacteristicValueEventHandler.java
src/org/openbravo/event/ConversionRateEventHandler.java
src/org/openbravo/event/DocTypeEventHandler.java
src/org/openbravo/event/FaccAcctModifyEventHandler.java
src/org/openbravo/event/GLItemAccountsEventHandler.java
src/org/openbravo/event/GLJournalEventHandler.java
src/org/openbravo/event/GLJournalLineEventHandler.java
src/org/openbravo/event/InvoiceEventHandler.java
src/org/openbravo/event/InvoiceLineEventHandler.java
src/org/openbravo/event/InvoiceTaxEventHandler.java
src/org/openbravo/event/MInOutLineEventHandler.java
src/org/openbravo/event/OrderDiscountEventHandler.java
src/org/openbravo/event/OrderEventHandler.java
src/org/openbravo/event/OrderLineEventHandler.java
src/org/openbravo/event/PaidStatusEventHandler.java
src/org/openbravo/event/PeriodEventHandler.java
src/org/openbravo/event/ProcessRequestEventHandler.java
src/org/openbravo/event/ProductAumEventHandler.java
src/org/openbravo/event/ProductCharacteristicEventHandler.java
src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
src/org/openbravo/event/ProductEventHandler.java
src/org/openbravo/event/ProductPriceObserver.java
src/org/openbravo/event/ProductServiceConfigurationObserver.java
src/org/openbravo/event/ProductionLineEventHandler.java
src/org/openbravo/event/ReferenceInventoryEventHandler.java
src/org/openbravo/event/RoleEventHandler.java
src/org/openbravo/event/ServiceOrderLineEventHandler.java
src/org/openbravo/event/ServicePriceRuleRangeEventHandler.java
src/org/openbravo/event/ServiceRelationEventHandler.java
src/org/openbravo/event/SimpleGLJournalEventHandler.java
src/org/openbravo/event/SubsetValueEventHandler.java
src/org/openbravo/event/UOMConversionEventHandler.java
src/org/openbravo/role/inheritance/InheritedAccessEnabledEventHandler.java
src/org/openbravo/role/inheritance/RoleInheritanceEventHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_FinaccTransactionEventListener.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_FinaccTransactionEventListener.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014-2017 Openbravo SLU
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -36,11 +36,11 @@
 import org.openbravo.model.financialmgmt.payment.FIN_FinaccTransaction;
 import org.openbravo.model.financialmgmt.payment.FIN_Payment;
 
-public class FIN_FinaccTransactionEventListener extends EntityPersistenceEventObserver {
+class FIN_FinaccTransactionEventListener extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(FIN_FinaccTransaction.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
+  private static Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_PaymentEventListener.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_PaymentEventListener.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012-2018 Openbravo SLU
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -44,7 +44,7 @@
 import org.openbravo.model.financialmgmt.payment.PaymentExecutionProcess;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class FIN_PaymentEventListener extends EntityPersistenceEventObserver {
+class FIN_PaymentEventListener extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(FIN_Payment.ENTITY_NAME) };
 
@@ -110,7 +110,7 @@
     }
     FIN_Payment pay = OBDal.getInstance().get(FIN_Payment.class, event.getTargetInstance().getId());
     List<FIN_PaymentDetail> pdList = pay.getFINPaymentDetailList();
-    if (pdList.size() > 0) {
+    if (!pdList.isEmpty()) {
       String language = OBContext.getOBContext().getLanguage().getLanguage();
       ConnectionProvider conn = new DalConnectionProvider(false);
       throw new OBException(Utility.messageBD(conn, "ForeignKeyViolation", language));
@@ -172,7 +172,7 @@
     }
 
     int rowCount;
-    final StringBuffer hql = new StringBuffer();
+    final StringBuilder hql = new StringBuilder();
     hql.append("update APRM_PendingPaymentInvoice ");
     hql.append("set paymentExecutionProcess.id = :paymentExecutionProcessId ");
     hql.append("where paymentExecutionProcess.id <> :paymentExecutionProcessId ");
@@ -197,7 +197,7 @@
     }
 
     int rowCount;
-    final StringBuffer hql = new StringBuffer();
+    final StringBuilder hql = new StringBuilder();
     hql.append("delete from APRM_PendingPaymentInvoice ");
     hql.append("where payment.id = :paymentId ");
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_ReconciliationEventListener.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/event/FIN_ReconciliationEventListener.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2016-2018 Openbravo SLU
+ * All portions are Copyright (C) 2016-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -30,7 +30,7 @@
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.financialmgmt.payment.FIN_Reconciliation;
 
-public class FIN_ReconciliationEventListener extends EntityPersistenceEventObserver {
+class FIN_ReconciliationEventListener extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(FIN_Reconciliation.ENTITY_NAME) };
 
@@ -59,7 +59,7 @@
    */
   private void updateNextReconciliationsBalance(final FIN_Reconciliation rec) {
     BigDecimal balance = rec.getEndingBalance().subtract(rec.getStartingbalance());
-    StringBuffer update = new StringBuffer();
+    StringBuilder update = new StringBuilder();
     update.append(" update " + FIN_Reconciliation.ENTITY_NAME);
     update.append(" set " + FIN_Reconciliation.PROPERTY_STARTINGBALANCE + " = "
         + FIN_Reconciliation.PROPERTY_STARTINGBALANCE + " - :balance");
--- a/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/OrderTestObserver.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/OrderTestObserver.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2017 Openbravo SLU
+ * All portions are Copyright (C) 2017-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -33,7 +33,7 @@
 import org.openbravo.model.common.order.Order;
 import org.openbravo.model.common.order.OrderLine;
 
-public class OrderTestObserver extends EntityPersistenceEventObserver {
+class OrderTestObserver extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Order.ENTITY_NAME) };
   private static int executionCount = 0;
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentConfigEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentConfigEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015-2018 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -42,7 +42,7 @@
  * listens to Insert, Update or Delete events to update the cached "clientConfigs" Map in
  * AttachmentUtils.
  */
-public class AttachmentConfigEventHandler extends EntityPersistenceEventObserver {
+class AttachmentConfigEventHandler extends EntityPersistenceEventObserver {
   private static final Logger logger = LogManager.getLogger();
 
   private static Entity[] entities = {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentMetadataEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentMetadataEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015-2016 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -38,7 +38,7 @@
  * same column name. This event handlers checks that no new metadatas with an existing columnname
  * are added or edited.
  */
-public class AttachmentMetadataEventHandler extends EntityPersistenceEventObserver {
+class AttachmentMetadataEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Parameter.class) };
 
   @Override
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012-2013 Openbravo SLU
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,8 +25,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.ScrollMode;
 import org.hibernate.ScrollableResults;
 import org.hibernate.criterion.Restrictions;
@@ -45,11 +43,10 @@
 import org.openbravo.model.financialmgmt.accounting.coa.Element;
 import org.openbravo.model.financialmgmt.accounting.coa.ElementValue;
 
-public class AcctSchemaEventHandler extends EntityPersistenceEventObserver {
+class AcctSchemaEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(AcctSchema.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -61,8 +58,7 @@
       return;
     }
     boolean eval = false;
-    if ((Boolean) event
-        .getCurrentState(getProperty(AcctSchema.PROPERTY_CENTRALMAINTENANCE)) == true) {
+    if ((Boolean) event.getCurrentState(getProperty(AcctSchema.PROPERTY_CENTRALMAINTENANCE))) {
       if (!event.getPreviousState(getProperty(AcctSchema.PROPERTY_CENTRALMAINTENANCE))
           .equals(event.getCurrentState(getProperty(AcctSchema.PROPERTY_CENTRALMAINTENANCE)))) {
         eval = true;
@@ -97,7 +93,7 @@
       if (countSchemas(element) > 1) {
         throw new OBException(OBMessageUtils.messageBD("SharedAccountTree"));
       }
-      updateElementValues(element, acctSchema,
+      updateElementValues(element.getId(),
           (Boolean) event.getCurrentState(getProperty(AcctSchema.PROPERTY_ASSETPOSITIVE)),
           (Boolean) event.getCurrentState(getProperty(AcctSchema.PROPERTY_LIABILITYPOSITIVE)),
           (Boolean) event.getCurrentState(getProperty(AcctSchema.PROPERTY_EQUITYPOSITIVE)),
@@ -106,8 +102,8 @@
     }
   }
 
-  private Property getProperty(String PROPERTY) {
-    return entities[0].getProperty(PROPERTY);
+  private Property getProperty(String property) {
+    return entities[0].getProperty(property);
   }
 
   private Element getAccountElement(AcctSchema acctSchema) {
@@ -118,7 +114,7 @@
     aee.add(Restrictions.eq(AcctSchemaElement.PROPERTY_TYPE, ELEMENTTYPE_ACCOUNT));
     aee.setMaxResults(1);
     List<AcctSchemaElement> aees = aee.list();
-    if (aees.size() > 0) {
+    if (!aees.isEmpty()) {
       return aees.get(0).getAccountingElement();
     } else {
       return null;
@@ -126,7 +122,7 @@
   }
 
   private int countSchemas(Element element) {
-    Set<AcctSchema> schemas = new HashSet<AcctSchema>();
+    Set<AcctSchema> schemas = new HashSet<>();
     OBCriteria<AcctSchemaElement> aee = OBDal.getInstance().createCriteria(AcctSchemaElement.class);
     aee.add(Restrictions.eq(AcctSchemaElement.PROPERTY_ACCOUNTINGELEMENT, element));
     for (AcctSchemaElement acctSchemaElement : aee.list()) {
@@ -136,14 +132,14 @@
 
   }
 
-  private void updateElementValues(Element _element, AcctSchema acctSchema, boolean assetPositive,
+  private void updateElementValues(String elementId, boolean assetPositive,
       boolean liabilityPositive, boolean ownersEquityPositive, boolean expensePositive,
       boolean revenuePositive) {
-    StringBuffer where = new StringBuffer();
+    StringBuilder where = new StringBuilder();
     final String ACCOUNTSIGN_CREDIT = "C";
     final String ACCOUNTSIGN_DEBIT = "D";
     final String ACCOUNTTYPE_MEMO = "M";
-    Element element = OBDal.getInstance().get(Element.class, _element.getId());
+    Element element = OBDal.getInstance().get(Element.class, elementId);
     where.append(ElementValue.PROPERTY_ACCOUNTINGELEMENT + ".id = :element");
     OBQuery<ElementValue> elementValueQry = OBDal.getInstance()
         .createQuery(ElementValue.class, where.toString());
@@ -155,8 +151,6 @@
 
     ScrollableResults elementvalues = elementValueQry.scroll(ScrollMode.FORWARD_ONLY);
     try {
-      // TODO: Review with Martin to see if flush is permitted in handlers
-      // int i = 0;
       while (elementvalues.next()) {
         ElementValue elementValue = (ElementValue) elementvalues.get(0);
         boolean isCredit = getAccountSign(elementValue.getAccountType(), assetPositive,
@@ -164,12 +158,6 @@
         if (!ACCOUNTTYPE_MEMO.equals(elementValue.getAccountType())) {
           elementValue.setAccountSign(isCredit ? ACCOUNTSIGN_CREDIT : ACCOUNTSIGN_DEBIT);
         }
-        // if ((i % 100) == 0) {
-        // OBDal.getInstance().flush();
-        // OBDal.getInstance().getSession().clear();
-        // element = OBDal.getInstance().get(Element.class, element.getId());
-        // }
-        // i++;
       }
     } finally {
       elementvalues.close();
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/BusinessPartnerBankAccountHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/BusinessPartnerBankAccountHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -39,11 +39,11 @@
  * @author openbravo
  * 
  */
-public class BusinessPartnerBankAccountHandler extends EntityPersistenceEventObserver {
+class BusinessPartnerBankAccountHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(BankAccount.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
+  private static Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/DataPoolSelectionEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/DataPoolSelectionEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2018 Openbravo SLU
+ * All portions are Copyright (C) 2018-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,8 +21,6 @@
 import javax.enterprise.event.Observes;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.resource.transaction.spi.TransactionStatus;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -41,9 +39,8 @@
  * Note that in a cluster environment, it is required to restart Tomcat to refresh all changes in
  * every node.
  */
-public class DataPoolSelectionEventHandler extends EntityPersistenceEventObserver {
+class DataPoolSelectionEventHandler extends EntityPersistenceEventObserver {
 
-  protected Logger logger = LogManager.getLogger();
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(DataPoolSelection.class) };
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012-2016 Openbravo SLU
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -26,8 +26,6 @@
 import javax.enterprise.event.Observes;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.model.Entity;
@@ -44,11 +42,10 @@
 import org.openbravo.model.ad.utility.TreeNode;
 import org.openbravo.model.financialmgmt.accounting.coa.ElementValue;
 
-public class ElementValueEventHandler extends EntityPersistenceEventObserver {
+class ElementValueEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ElementValue.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -108,11 +105,11 @@
     obc.setMaxResults(1);
     List<TreeNode> nodes = obc.list();
     HashMap<String, String> result = getParentAndSeqNo(account);
-    String parent_ID = result.get("ParentID");
+    String parentId = result.get("ParentID");
     String seqNo = result.get("SeqNo");
-    if (nodes.size() > 0) {
+    if (!nodes.isEmpty()) {
       TreeNode node = nodes.get(0);
-      node.setReportSet(!isNumber ? rootNode : parent_ID);
+      node.setReportSet(!isNumber ? rootNode : parentId);
       node.setSequenceNumber(Long.valueOf(seqNo));
       OBDal.getInstance().save(node);
     } else {
@@ -120,7 +117,7 @@
       treeElement.setOrganization(account.getOrganization());
       treeElement.setNode(account.getId());
       treeElement.setTree(account.getAccountingElement().getTree());
-      treeElement.setReportSet(!isNumber ? rootNode : parent_ID);
+      treeElement.setReportSet(!isNumber ? rootNode : parentId);
       treeElement.setSequenceNumber(Long.valueOf(seqNo));
       OBDal.getInstance().save(treeElement);
     }
@@ -128,7 +125,7 @@
   }
 
   HashMap<String, String> getParentAndSeqNo(ElementValue account) {
-    HashMap<String, String> result = new HashMap<String, String>();
+    HashMap<String, String> result = new HashMap<>();
     // Default values for result
     result.put("ParentID", "0");
     result.put("SeqNo",
@@ -182,18 +179,17 @@
       node.setSequenceNumber(node.getSequenceNumber() + 10l);
       OBDal.getInstance().save(node);
     }
-    return;
   }
 
-  long getNextSeqNo(Tree tree, String parent_ID) {
+  long getNextSeqNo(Tree tree, String parentId) {
     OBCriteria<TreeNode> obc = OBDal.getInstance().createCriteria(TreeNode.class);
-    obc.add(Restrictions.eq(TreeNode.PROPERTY_REPORTSET, parent_ID));
+    obc.add(Restrictions.eq(TreeNode.PROPERTY_REPORTSET, parentId));
     obc.add(Restrictions.eq(TreeNode.PROPERTY_TREE, tree));
     obc.addOrder(Order.desc(TreeNode.PROPERTY_SEQUENCENUMBER));
     obc.setFilterOnReadableClients(false);
     obc.setFilterOnReadableOrganization(false);
     List<TreeNode> nodes = obc.list();
-    if (nodes.size() > 0 && obc.list().get(0).getSequenceNumber() != null) {
+    if (!nodes.isEmpty() && obc.list().get(0).getSequenceNumber() != null) {
       return obc.list().get(0).getSequenceNumber() + 10l;
     } else {
       return 10l;
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/FieldHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/FieldHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -42,7 +42,7 @@
  * 
  * @author mtaal
  */
-public class FieldHandler extends EntityPersistenceEventObserver {
+class FieldHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Field.ENTITY_NAME) };
 
   public void onUpdate(@Observes EntityUpdateEvent event) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/GeneralLedgerOrganizationHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/GeneralLedgerOrganizationHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012-1015 Openbravo SLU
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -24,8 +24,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -39,11 +37,10 @@
 import org.openbravo.model.common.enterprise.OrganizationAcctSchema;
 import org.openbravo.model.financialmgmt.accounting.coa.AcctSchema;
 
-public class GeneralLedgerOrganizationHandler extends EntityPersistenceEventObserver {
+class GeneralLedgerOrganizationHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(Organization.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -71,7 +68,7 @@
         orgSchema.setFilterOnActive(false);
         orgSchema.add(Restrictions.eq(OrganizationAcctSchema.PROPERTY_ORGANIZATION, organization));
         List<OrganizationAcctSchema> orgSchemalist = orgSchema.list();
-        ArrayList<String> idlist = new ArrayList<String>();
+        ArrayList<String> idlist = new ArrayList<>();
 
         boolean exist = false;
 
@@ -87,7 +84,7 @@
             exist = true;
             continue;
           }
-          if (orgAcctSchema.getOrganizationClosingList().size() == 0) {
+          if (orgAcctSchema.getOrganizationClosingList().isEmpty()) {
             OBDal.getInstance().remove(orgAcctSchema);
           } else {
             orgAcctSchema.setActive(false);
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/LocationSettingsHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/LocationSettingsHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -23,12 +23,9 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
-import org.openbravo.client.kernel.event.EntityDeleteEvent;
 import org.openbravo.client.kernel.event.EntityNewEvent;
 import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
 import org.openbravo.client.kernel.event.EntityUpdateEvent;
@@ -41,9 +38,8 @@
  * 
  * @author openbravo
  */
-public class LocationSettingsHandler extends EntityPersistenceEventObserver {
+class LocationSettingsHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Country.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -68,12 +64,6 @@
         instanceCountry.getDateformat());
   }
 
-  public void onDelete(@Observes EntityDeleteEvent event) {
-    if (!isValidEvent(event)) {
-      return;
-    }
-  }
-
   private void checkCorrectValues(String numericmask, String datetimeformat, String dateformat) {
     if (numericmask != null) {
       if (checkNumericMask(numericmask)) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/MenuCacheHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/MenuCacheHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,7 +39,7 @@
  * @author alostale
  * 
  */
-public class MenuCacheHandler extends EntityPersistenceEventObserver {
+class MenuCacheHandler extends EntityPersistenceEventObserver {
   @Inject
   private GlobalMenu menu;
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ModuleHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ModuleHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2011 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -37,7 +37,7 @@
  * @author alostale
  * 
  */
-public class ModuleHandler extends EntityPersistenceEventObserver {
+class ModuleHandler extends EntityPersistenceEventObserver {
   private static final String MODULE_TABLE_ID = "9D36D488605044F5A0264D7C8B916657";
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntityByTableId(MODULE_TABLE_ID) };
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/NoteEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/NoteEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2013-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -47,7 +47,7 @@
  * 
  * @author shankar balachandran
  */
-public class NoteEventHandler extends EntityPersistenceEventObserver {
+class NoteEventHandler extends EntityPersistenceEventObserver {
   private static Logger log = LogManager.getLogger();
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Note.ENTITY_NAME) };
 
@@ -82,7 +82,10 @@
    */
   private void isReadOnly() {
     boolean isReadOnly = false;
-    String disableNotesForReadOnly = "Y", tabId = null, roleId = null, language = null;
+    String disableNotesForReadOnly = "Y";
+    String tabId = null;
+    String roleId = null;
+    String language = null;
     ConnectionProvider connection = null;
     try {
       OBContext.setAdminMode();
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RemoveImagesEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RemoveImagesEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -38,7 +38,7 @@
 import org.openbravo.model.ad.utility.Image;
 import org.openbravo.model.common.plm.Product;
 
-public class RemoveImagesEventHandler extends EntityPersistenceEventObserver {
+class RemoveImagesEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = getImageEntities();
   private static final String DUMMY_IMAGE_ID = "2FA7212E426F11E5A151FEFF819CDC9F";
@@ -151,7 +151,7 @@
   }
 
   private static Entity[] getImageEntities() {
-    ArrayList<Entity> entityArray = new ArrayList<Entity>();
+    ArrayList<Entity> entityArray = new ArrayList<>();
 
     // Create the observed entities from ModelProvider
     for (Entity entity : ModelProvider.getInstance().getEntityWithImage().keySet()) {
@@ -171,10 +171,7 @@
     obCriteria.setMaxResults(1);
     Product product = (Product) obCriteria.uniqueResult();
 
-    if (product != null) {
-      return true;
-    }
-    return false;
+    return product != null;
   }
 
   private static List<String> getImageProperties(Entity entity) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ReorderCascadingChildDeletionsHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ReorderCascadingChildDeletionsHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2011-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -50,7 +50,7 @@
  * 
  * @author shuehner
  */
-public class ReorderCascadingChildDeletionsHandler extends EntityPersistenceEventObserver {
+class ReorderCascadingChildDeletionsHandler extends EntityPersistenceEventObserver {
   private static final Logger log = LogManager.getLogger();
 
   private static final String ORDER_TABLE_ID = "259";
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RoleAccessUniqueHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RoleAccessUniqueHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -49,7 +49,7 @@
  * @author alostale
  *
  */
-public class RoleAccessUniqueHandler extends EntityPersistenceEventObserver {
+class RoleAccessUniqueHandler extends EntityPersistenceEventObserver {
   private static final String WIDGET_CLASS_ACCESS_TABLE_ID = "D1829E5F3A8441BF85DDBC06D49C1074";
   private static final String PROCESS_DEF_ACCESS_TABLE_ID = "FF80818132D85DB50132D860924E0004";
   private static final String VIEW_ACCESS_TALBLE_ID = "E6F29F8A30BC4603B1D1195051C4F3A6";
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/SetDocumentNoHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2011-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -47,7 +47,7 @@
  * 
  * @author mtaal
  */
-public class SetDocumentNoHandler extends EntityPersistenceEventObserver {
+class SetDocumentNoHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = null;
   private static Property[] documentNoProperties = null;
   private static Property[] documentTypeProperties = null;
@@ -112,11 +112,11 @@
   @Override
   protected synchronized Entity[] getObservedEntities() {
     if (entities == null) {
-      List<Entity> entityList = new ArrayList<Entity>();
-      List<Property> documentNoPropertyList = new ArrayList<Property>();
-      List<Property> documentTypePropertyList = new ArrayList<Property>();
-      List<Property> documentTypeTargetPropertyList = new ArrayList<Property>();
-      List<Property> processedPropertyList = new ArrayList<Property>();
+      List<Entity> entityList = new ArrayList<>();
+      List<Property> documentNoPropertyList = new ArrayList<>();
+      List<Property> documentTypePropertyList = new ArrayList<>();
+      List<Property> documentTypeTargetPropertyList = new ArrayList<>();
+      List<Property> processedPropertyList = new ArrayList<>();
       for (Entity entity : ModelProvider.getInstance().getModel()) {
         for (Property prop : entity.getProperties()) {
           if (prop.isUsedSequence()) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2013 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,9 +39,14 @@
  * 
  * @author Shankar
  */
-public class TableEventHandler extends EntityPersistenceEventObserver {
+class TableEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Table.ENTITY_NAME) };
 
+  @Override
+  protected Entity[] getObservedEntities() {
+    return entities;
+  }
+
   public void onUpdate(@Observes EntityUpdateEvent event) {
     if (!isValidEvent(event)) {
       return;
@@ -61,12 +66,6 @@
     checkJavaClassName(javaClassName);
   }
 
-  @Override
-  protected Entity[] getObservedEntities() {
-    // TODO Auto-generated method stub
-    return entities;
-  }
-
   private Boolean checkJavaClassName(String javaClassName) {
     if (javaClassName != null && javaClassName.contains(" ")) {
       String language = OBContext.getOBContext().getLanguage().getLanguage();
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableTreeEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableTreeEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -45,7 +45,7 @@
  * This event handler is in charge of ensuring that each table define at most one ADTree table
  * 
  */
-public class TableTreeEventHandler extends EntityPersistenceEventObserver {
+class TableTreeEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(TableTree.ENTITY_NAME) };
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2017 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -53,7 +53,7 @@
  * the corresponding datasource is executed.
  * 
  */
-public class TreeTablesEventHandler extends EntityPersistenceEventObserver {
+class TreeTablesEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = getTreeTables();
 
@@ -85,7 +85,7 @@
         return;
       }
       JSONObject jsonBob = this.fromBobToJSONObject(bob);
-      Map<String, String> parameters = new HashMap<String, String>();
+      Map<String, String> parameters = new HashMap<>();
       parameters.put("jsonBob", jsonBob.toString());
       dataSource.add(parameters, null);
     } finally {
@@ -105,7 +105,7 @@
         return;
       }
       JSONObject jsonBob = this.fromBobToJSONObject(bob);
-      Map<String, String> parameters = new HashMap<String, String>();
+      Map<String, String> parameters = new HashMap<>();
       parameters.put("jsonBob", jsonBob.toString());
       dataSource.remove(parameters);
     } finally {
@@ -167,7 +167,7 @@
     OBCriteria<Table> treeTablesCriteria = OBDal.getInstance().createCriteria(Table.class);
     treeTablesCriteria.add(Restrictions.eq(Table.PROPERTY_ISTREE, true));
     List<Table> treeTableList = treeTablesCriteria.list();
-    ArrayList<Entity> entityArray = new ArrayList<Entity>();
+    ArrayList<Entity> entityArray = new ArrayList<>();
     for (Table treeTable : treeTableList) {
       entityArray.add(ModelProvider.getInstance().getEntityByTableId(treeTable.getId()));
     }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/UsageAuditHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/UsageAuditHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -37,7 +37,7 @@
  * @author alostale
  * 
  */
-public class UsageAuditHandler extends EntityPersistenceEventObserver {
+class UsageAuditHandler extends EntityPersistenceEventObserver {
   private static final String SYSTEM_INFO_TABLE_ID = "1005400005";
   private static final Entity[] entities = {
       ModelProvider.getInstance().getEntityByTableId(SYSTEM_INFO_TABLE_ID) };
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/WindowPersonalizationEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/WindowPersonalizationEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -43,11 +43,11 @@
 import org.openbravo.model.ad.ui.Window;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class WindowPersonalizationEventHandler extends EntityPersistenceEventObserver {
+class WindowPersonalizationEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(UIPersonalization.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
+  private static Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorFieldHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorFieldHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -35,7 +35,7 @@
  * @author alostale
  * 
  */
-public class SelectorFieldHandler extends EntityPersistenceEventObserver {
+class SelectorFieldHandler extends EntityPersistenceEventObserver {
   private static final String SELECTOR_FIELD_TABLE_ID = "A2F880F9981349E2A6A57BD58267EBCE";
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntityByTableId(SELECTOR_FIELD_TABLE_ID) };
--- a/src/org/openbravo/erpCommon/ad_callouts/SysInfoCustomAllowed.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/erpCommon/ad_callouts/SysInfoCustomAllowed.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,7 +22,6 @@
 import javax.servlet.ServletException;
 
 import org.openbravo.base.filter.ValueListFilter;
-import org.openbravo.client.application.event.ModuleHandler;
 import org.openbravo.client.kernel.BaseComponent;
 
 /**
@@ -30,10 +29,10 @@
  * this value is set to true, it nullifies module cache in other to detect the newly created in
  * development template for the ETag.
  * 
- * This is needed because currently System Info window is opened in 2.50 style, so
- * {@link ModuleHandler}, which performs the same action, is not executed in this case.
+ * This is needed because currently System Info window is opened in 2.50 style, so the
+ * org.openbravo.client.application.event.ModuleHandler observer, which performs the same action, is
+ * not executed in this case.
  * 
- * @see ModuleHandler
  * @see BaseComponent#getETag()
  * 
  * @author alostale
--- a/src/org/openbravo/event/ADTableEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ADTableEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
@@ -46,11 +44,9 @@
  * @author shankar
  * 
  */
-
-public class ADTableEventHandler extends EntityPersistenceEventObserver {
+class ADTableEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Table.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/ADTableNavigationEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ADTableNavigationEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -40,11 +38,9 @@
  * @author airaceburu
  * 
  */
-
-public class ADTableNavigationEventHandler extends EntityPersistenceEventObserver {
+class ADTableNavigationEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(TableNavigation.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/BusinessPartnerEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/BusinessPartnerEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -31,10 +29,9 @@
 import org.openbravo.client.kernel.event.EntityUpdateEvent;
 import org.openbravo.model.common.businesspartner.BusinessPartner;
 
-public class BusinessPartnerEventHandler extends EntityPersistenceEventObserver {
+class BusinessPartnerEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(BusinessPartner.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/CharacteristicValueEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/CharacteristicValueEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2018 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -45,11 +45,11 @@
 import org.openbravo.scheduling.ProcessBundle;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class CharacteristicValueEventHandler extends EntityPersistenceEventObserver {
-  protected Logger logger = LogManager.getLogger();
+class CharacteristicValueEventHandler extends EntityPersistenceEventObserver {
+  private static Logger logger = LogManager.getLogger();
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(CharacteristicValue.ENTITY_NAME) };
-  private static ThreadLocal<String> chvalueUpdated = new ThreadLocal<String>();
+  private static ThreadLocal<String> chvalueUpdated = new ThreadLocal<>();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -72,7 +72,7 @@
         .getEntity(CharacteristicValue.ENTITY_NAME);
     final Property codeProperty = prodchValue.getProperty(CharacteristicValue.PROPERTY_CODE);
     if (event.getCurrentState(codeProperty) != event.getPreviousState(codeProperty)) {
-      StringBuffer where = new StringBuffer();
+      StringBuilder where = new StringBuilder();
       where.append("update ProductCharacteristicConf as pcc ");
       where.append("set code = :code, updated = now(), updatedBy = :user ");
       where.append("where exists ( ");
@@ -120,7 +120,7 @@
 
       ProcessBundle pb = new ProcessBundle(VariantChDescUpdateProcess.AD_PROCESS_ID, vars)
           .init(new DalConnectionProvider(false));
-      HashMap<String, Object> parameters = new HashMap<String, Object>();
+      HashMap<String, Object> parameters = new HashMap<>();
       parameters.put("mProductId", "");
       parameters.put("mChValueId", strChValueId);
       pb.setParams(parameters);
--- a/src/org/openbravo/event/ConversionRateEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ConversionRateEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,8 +22,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.query.Query;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
@@ -37,12 +35,10 @@
 import org.openbravo.model.common.currency.ConversionRate;
 import org.openbravo.model.common.currency.Currency;
 
-public class ConversionRateEventHandler extends EntityPersistenceEventObserver {
+class ConversionRateEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ConversionRate.ENTITY_NAME) };
 
-  protected Logger logger = LogManager.getLogger();
-
   @Override
   protected Entity[] getObservedEntities() {
     return entities;
--- a/src/org/openbravo/event/DocTypeEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/DocTypeEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -34,10 +32,9 @@
 import org.openbravo.model.common.enterprise.DocumentType;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class DocTypeEventHandler extends EntityPersistenceEventObserver {
+class DocTypeEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(DocumentType.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/FaccAcctModifyEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/FaccAcctModifyEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -29,10 +27,9 @@
 import org.openbravo.client.kernel.event.EntityUpdateEvent;
 import org.openbravo.model.financialmgmt.accounting.AccountingFact;
 
-public class FaccAcctModifyEventHandler extends EntityPersistenceEventObserver {
+class FaccAcctModifyEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(AccountingFact.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/GLItemAccountsEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/GLItemAccountsEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2018 Openbravo SLU
+ * All portions are Copyright (C) 2018-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -31,7 +31,7 @@
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.financialmgmt.gl.GLItemAccounts;
 
-public class GLItemAccountsEventHandler extends EntityPersistenceEventObserver {
+class GLItemAccountsEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(GLItemAccounts.ENTITY_NAME) };
--- a/src/org/openbravo/event/GLJournalEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/GLJournalEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.ScrollMode;
 import org.hibernate.ScrollableResults;
 import org.hibernate.criterion.Restrictions;
@@ -35,8 +33,7 @@
 import org.openbravo.model.financialmgmt.gl.GLJournal;
 import org.openbravo.model.financialmgmt.gl.GLJournalLine;
 
-public class GLJournalEventHandler extends EntityPersistenceEventObserver {
-  protected Logger logger = LogManager.getLogger();
+class GLJournalEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(GLJournal.ENTITY_NAME) };
 
--- a/src/org/openbravo/event/GLJournalLineEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/GLJournalLineEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -32,8 +32,8 @@
 import org.openbravo.client.kernel.event.EntityUpdateEvent;
 import org.openbravo.model.financialmgmt.gl.GLJournalLine;
 
-public class GLJournalLineEventHandler extends EntityPersistenceEventObserver {
-  protected Logger logger = LogManager.getLogger();
+class GLJournalLineEventHandler extends EntityPersistenceEventObserver {
+  private static Logger logger = LogManager.getLogger();
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(GLJournalLine.ENTITY_NAME) };
 
--- a/src/org/openbravo/event/InvoiceEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/InvoiceEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2017-2018 Openbravo SLU
+ * All portions are Copyright (C) 2017-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -21,8 +21,6 @@
 import javax.enterprise.event.Observes;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.query.Query;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -34,10 +32,9 @@
 import org.openbravo.model.common.invoice.Invoice;
 import org.openbravo.model.common.invoice.InvoiceDiscount;
 
-public class InvoiceEventHandler extends EntityPersistenceEventObserver {
+class InvoiceEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Invoice.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/InvoiceLineEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/InvoiceLineEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2017 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -33,10 +31,9 @@
 import org.openbravo.model.common.invoice.InvoiceLine;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOut;
 
-public class InvoiceLineEventHandler extends EntityPersistenceEventObserver {
+class InvoiceLineEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(InvoiceLine.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -50,18 +47,17 @@
     checkInvoiceLineRelation((InvoiceLine) event.getTargetInstance());
   }
 
-  private void checkInvoiceLineRelation(InvoiceLine ObjInvoiceLine) {
+  private void checkInvoiceLineRelation(InvoiceLine invoiceLine) {
     OBCriteria<InvoiceLine> criteria = OBDal.getInstance().createCriteria(InvoiceLine.class);
-    criteria.add(Restrictions.eq(InvoiceLine.PROPERTY_INVOICE, ObjInvoiceLine.getInvoice()));
+    criteria.add(Restrictions.eq(InvoiceLine.PROPERTY_INVOICE, invoiceLine.getInvoice()));
 
     if (criteria.count() == 1) {
-      Invoice ObjInvoice = OBDal.getInstance()
-          .get(Invoice.class, ObjInvoiceLine.getInvoice().getId());
+      Invoice invoice = OBDal.getInstance().get(Invoice.class, invoiceLine.getInvoice().getId());
 
-      if (ObjInvoice != null) {
-        ObjInvoice.setSalesOrder(null);
-        OBDal.getInstance().save(ObjInvoice);
-        unlinkInvoiceFromGoodsReceipt(ObjInvoice);
+      if (invoice != null) {
+        invoice.setSalesOrder(null);
+        OBDal.getInstance().save(invoice);
+        unlinkInvoiceFromGoodsReceipt(invoice);
         OBDal.getInstance().flush();
       }
     }
--- a/src/org/openbravo/event/InvoiceTaxEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/InvoiceTaxEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2016 Openbravo SLU
+ * All portions are Copyright (C) 2016-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -30,10 +28,9 @@
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.common.invoice.InvoiceTax;
 
-public class InvoiceTaxEventHandler extends EntityPersistenceEventObserver {
+class InvoiceTaxEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(InvoiceTax.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/MInOutLineEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/MInOutLineEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2014 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
@@ -36,10 +34,9 @@
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOut;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine;
 
-public class MInOutLineEventHandler extends EntityPersistenceEventObserver {
+class MInOutLineEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ShipmentInOutLine.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/OrderDiscountEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/OrderDiscountEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -33,10 +31,9 @@
 import org.openbravo.model.common.order.OrderDiscount;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class OrderDiscountEventHandler extends EntityPersistenceEventObserver {
+class OrderDiscountEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(OrderDiscount.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/OrderEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/OrderEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2013-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,8 +25,6 @@
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.hibernate.query.Query;
 import org.openbravo.base.model.Entity;
@@ -47,13 +45,12 @@
 import org.openbravo.model.common.order.OrderDiscount;
 import org.openbravo.model.common.order.OrderLine;
 
-public class OrderEventHandler extends EntityPersistenceEventObserver {
+class OrderEventHandler extends EntityPersistenceEventObserver {
 
   private static final String DO_NOT_SYNC_WAREHOUSE_PREFERENCE = "DoNotSyncWarehouse";
   private static final String DO_NOT_SYNC_DATE_DELIVERED_PREFERENCE = "DoNotSyncDateDelivered";
   private static final String DO_NOT_SYNC_DATE_ORDERED_PREFERENCE = "DoNotSyncDateOrdered";
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Order.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/OrderLineEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/OrderLineEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015-2018 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.query.Query;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -31,10 +29,9 @@
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.common.order.OrderLine;
 
-public class OrderLineEventHandler extends EntityPersistenceEventObserver {
+class OrderLineEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(OrderLine.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -53,7 +50,7 @@
     try {
       OBContext.setAdminMode(true);
       final OrderLine thisLine = (OrderLine) event.getTargetInstance();
-      final StringBuffer hql = new StringBuffer();
+      final StringBuilder hql = new StringBuilder();
       hql.append(" update from OrderLine ol ");
       hql.append(" set ol.sOPOReference.id = null ");
       hql.append(" where ol.sOPOReference.id = :thisLine ");
--- a/src/org/openbravo/event/PaidStatusEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/PaidStatusEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -32,7 +32,7 @@
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentDetail;
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentScheduleDetail;
 
-public class PaidStatusEventHandler extends EntityPersistenceEventObserver {
+class PaidStatusEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(FIN_FinaccTransaction.ENTITY_NAME) };
   protected Logger logger = LogManager.getLogger();
@@ -57,13 +57,12 @@
     final Property processedProperty = transactionEntity
         .getProperty(FIN_FinaccTransaction.PROPERTY_PROCESSED);
     String oldStatus = (String) event.getPreviousState(statusProperty);
-    // boolean processedOldStatus = (Boolean) event.getPreviousState(processedProperty);
     boolean processedNewStatus = (Boolean) event.getPreviousState(processedProperty);
     String newStatus = (String) event.getCurrentState(statusProperty);
     final FIN_FinaccTransaction transaction = (FIN_FinaccTransaction) event.getTargetInstance();
     if (processedNewStatus) {
-      if ((oldStatus.equals(STATUS_DEPOSIT) | oldStatus.equals(STATUS_WITHDRAWN))
-          & newStatus.equals(STATUS_CLEARED)) {
+      if ((oldStatus.equals(STATUS_DEPOSIT) || oldStatus.equals(STATUS_WITHDRAWN))
+          && newStatus.equals(STATUS_CLEARED)) {
 
         Boolean invoicePaidold = false;
 
@@ -85,18 +84,17 @@
           }
         }
 
-      } else if ((newStatus.equals(STATUS_DEPOSIT) | newStatus.equals(STATUS_WITHDRAWN))
-          & oldStatus.equals(STATUS_CLEARED)) {
+      } else if ((newStatus.equals(STATUS_DEPOSIT) || newStatus.equals(STATUS_WITHDRAWN))
+          && oldStatus.equals(STATUS_CLEARED)) {
         Boolean invoicePaidold = false;
         if (transaction.getFinPayment() != null) {
           for (FIN_PaymentDetail pd : transaction.getFinPayment().getFINPaymentDetailList()) {
             for (FIN_PaymentScheduleDetail psd : pd.getFINPaymentScheduleDetailList()) {
               invoicePaidold = psd.isInvoicePaid();
-              if (invoicePaidold) {
-                if (oldStatus.equals(FIN_Utility.invoicePaymentStatus(transaction.getFinPayment()))
-                    && (!psd.getPaymentDetails().isPrepayment())) {
-                  FIN_Utility.restorePaidAmounts(psd);
-                }
+              if (invoicePaidold
+                  && oldStatus.equals(FIN_Utility.invoicePaymentStatus(transaction.getFinPayment()))
+                  && (!psd.getPaymentDetails().isPrepayment())) {
+                FIN_Utility.restorePaidAmounts(psd);
               }
             }
           }
--- a/src/org/openbravo/event/PeriodEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/PeriodEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2015 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -38,9 +38,9 @@
 import org.openbravo.model.financialmgmt.calendar.Year;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class PeriodEventHandler extends EntityPersistenceEventObserver {
+class PeriodEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Period.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
+  private static final Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -66,11 +66,7 @@
   }
 
   private boolean adjustmentPeriod(Period period) {
-    if ("A".equals(period.getPeriodType())) {
-      return true;
-    } else {
-      return false;
-    }
+    return "A".equals(period.getPeriodType());
   }
 
   private void checkPeriod(Period period) {
--- a/src/org/openbravo/event/ProcessRequestEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProcessRequestEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -41,11 +39,10 @@
 /**
  * Event Handler to check Process Group fields consistency
  */
-public class ProcessRequestEventHandler extends EntityPersistenceEventObserver {
+class ProcessRequestEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ProcessRequest.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/ProductAumEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductAumEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2016 Openbravo SLU
+ * All portions are Copyright (C) 2016-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -43,7 +43,7 @@
  * @author Nono Carballo
  *
  */
-public class ProductAumEventHandler extends EntityPersistenceEventObserver {
+class ProductAumEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ProductAUM.ENTITY_NAME) };
 
--- a/src/org/openbravo/event/ProductCharacteristicEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductCharacteristicEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2018 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -22,8 +22,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.ScrollMode;
 import org.hibernate.ScrollableResults;
 import org.hibernate.criterion.Restrictions;
@@ -47,10 +45,9 @@
 import org.openbravo.model.common.plm.ProductCharacteristicConf;
 import org.openbravo.model.common.plm.ProductCharacteristicValue;
 
-public class ProductCharacteristicEventHandler extends EntityPersistenceEventObserver {
+class ProductCharacteristicEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ProductCharacteristic.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -203,7 +200,7 @@
         List<ProductCharacteristicConf> prChConfs = (List<ProductCharacteristicConf>) event
             .getCurrentState(charConfListProperty);
 
-        StringBuffer hql = new StringBuffer();
+        StringBuilder hql = new StringBuilder();
         hql.append(" select cv." + CharacteristicValue.PROPERTY_ID);
         hql.append(" from " + ProductCharacteristicConf.ENTITY_NAME + " as pcc");
         hql.append(
@@ -270,7 +267,7 @@
 
     // If a subset is defined insert only values of it.
     if (prCh.getCharacteristicSubset() != null) {
-      StringBuffer hql = new StringBuffer();
+      StringBuilder hql = new StringBuilder();
       hql.append(" select cv." + CharacteristicValue.PROPERTY_ID);
       hql.append(" , coalesce(csv." + CharacteristicSubsetValue.PROPERTY_CODE + ", cv."
           + CharacteristicValue.PROPERTY_CODE + ")");
@@ -288,7 +285,7 @@
 
     // Add all not summary values.
     else {
-      StringBuffer hql = new StringBuffer();
+      StringBuilder hql = new StringBuilder();
       hql.append(" select cv." + CharacteristicValue.PROPERTY_ID);
       hql.append(" , cv." + CharacteristicValue.PROPERTY_CODE);
       hql.append(" , cv." + CharacteristicValue.PROPERTY_ACTIVE);
@@ -317,15 +314,13 @@
   }
 
   private void deleteProductCharacteristicValue(ProductCharacteristic productCharacteristic) {
-    ScrollableResults scroll = null;
-    try {
-      OBCriteria<ProductCharacteristicValue> criteria = OBDal.getInstance()
-          .createCriteria(ProductCharacteristicValue.class);
-      criteria.add(Restrictions.eq(ProductCharacteristicValue.PROPERTY_CHARACTERISTIC,
-          productCharacteristic.getCharacteristic()));
-      criteria.add(Restrictions.eq(ProductCharacteristicValue.PROPERTY_PRODUCT,
-          productCharacteristic.getProduct()));
-      scroll = criteria.scroll(ScrollMode.FORWARD_ONLY);
+    OBCriteria<ProductCharacteristicValue> criteria = OBDal.getInstance()
+        .createCriteria(ProductCharacteristicValue.class);
+    criteria.add(Restrictions.eq(ProductCharacteristicValue.PROPERTY_CHARACTERISTIC,
+        productCharacteristic.getCharacteristic()));
+    criteria.add(Restrictions.eq(ProductCharacteristicValue.PROPERTY_PRODUCT,
+        productCharacteristic.getProduct()));
+    try (ScrollableResults scroll = criteria.scroll(ScrollMode.FORWARD_ONLY)) {
       int i = 0;
       while (scroll.next()) {
         ProductCharacteristicValue productCharacteristicValue = (ProductCharacteristicValue) scroll
@@ -337,8 +332,6 @@
           OBDal.getInstance().getSession().clear();
         }
       }
-    } finally {
-      scroll.close();
     }
   }
 }
--- a/src/org/openbravo/event/ProductCharacteristicValueEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductCharacteristicValueEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2018 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -44,12 +44,13 @@
 import org.openbravo.model.common.plm.ProductCharacteristicValue;
 import org.openbravo.service.importprocess.ImportEntryManager;
 
-public class ProductCharacteristicValueEventHandler extends EntityPersistenceEventObserver {
+class ProductCharacteristicValueEventHandler extends EntityPersistenceEventObserver {
   private static final int IMPORT_ENTRY_SIZE = 100;
   private static Logger logger = LogManager.getLogger();
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ProductCharacteristicValue.ENTITY_NAME) };
-  private static ThreadLocal<Set<String>> prodchvalueUpdated = new ThreadLocal<Set<String>>();
+  private static ThreadLocal<Set<String>> prodchvalueUpdated = new ThreadLocal<>();
+
   @Inject
   ImportEntryManager importEntryManager;
 
@@ -95,7 +96,7 @@
           || event.getTransaction().getStatus() == TransactionStatus.ROLLED_BACK) {
         return;
       }
-      ArrayList<String> products = new ArrayList<String>(productList);
+      ArrayList<String> products = new ArrayList<>(productList);
       int productCount = productList.size();
       for (int i = 0; i < productCount; i += IMPORT_ENTRY_SIZE) {
         int currentLimit = (i + IMPORT_ENTRY_SIZE) < productCount ? (i + IMPORT_ENTRY_SIZE)
@@ -117,7 +118,7 @@
   private void addProductToList(ProductCharacteristicValue pchv) {
     Set<String> productList = prodchvalueUpdated.get();
     if (productList == null) {
-      productList = new HashSet<String>();
+      productList = new HashSet<>();
     }
     productList.add(pchv.getProduct().getId());
     prodchvalueUpdated.set(productList);
--- a/src/org/openbravo/event/ProductEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2014 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -36,9 +34,8 @@
 import org.openbravo.model.common.plm.ProductCharacteristic;
 import org.openbravo.model.common.plm.ProductCharacteristicConf;
 
-public class ProductEventHandler extends EntityPersistenceEventObserver {
+class ProductEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Product.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -53,7 +50,7 @@
     final Property genericProperty = productEntity.getProperty(Product.PROPERTY_ISGENERIC);
     boolean oldGeneric = (Boolean) event.getPreviousState(genericProperty);
     boolean newGeneric = (Boolean) event.getCurrentState(genericProperty);
-    if (oldGeneric == true && newGeneric == false) {
+    if (oldGeneric && !newGeneric) {
       // check that the generic does not have any variant created.
       final Product product = (Product) event.getTargetInstance();
       if (!product.getProductGenericProductList().isEmpty()) {
@@ -61,7 +58,7 @@
       }
     }
 
-    if (newGeneric == true && oldGeneric == false) {
+    if (newGeneric && !oldGeneric) {
       // check that whether the there are characteristic already define
       final Product product = (Product) event.getTargetInstance();
       if (!product.getProductCharacteristicList().isEmpty()) {
--- a/src/org/openbravo/event/ProductPriceObserver.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductPriceObserver.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,8 +22,6 @@
 import javax.enterprise.event.Observes;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -35,11 +33,10 @@
 import org.openbravo.model.pricing.pricelist.PriceListVersion;
 import org.openbravo.model.pricing.pricelist.ProductPrice;
 
-public class ProductPriceObserver extends EntityPersistenceEventObserver {
+class ProductPriceObserver extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ProductPrice.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/ProductServiceConfigurationObserver.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductServiceConfigurationObserver.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,7 +21,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -35,10 +34,9 @@
 import org.openbravo.model.common.order.OrderLine;
 import org.openbravo.model.common.plm.Product;
 
-public class ProductServiceConfigurationObserver extends EntityPersistenceEventObserver {
+class ProductServiceConfigurationObserver extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Product.ENTITY_NAME) };
-  protected Logger logger = Logger.getLogger(this.getClass());
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/ProductionLineEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ProductionLineEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2013 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,8 +22,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
@@ -42,12 +40,12 @@
 import org.openbravo.model.materialmgmt.transaction.ProductionPlan;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class ProductionLineEventHandler extends EntityPersistenceEventObserver {
+class ProductionLineEventHandler extends EntityPersistenceEventObserver {
 
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ProductionLine.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
-  private static String BOM_PRODUCTION = "321";
+  private static final String BOM_PRODUCTION = "321";
+  private static final BigDecimal ZERO = new BigDecimal("0");
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -62,13 +60,12 @@
     try {
       vars = RequestContext.get().getVariablesSecureApp();
     } catch (Exception e) {
-      logger.error("Error:", e);
+      throw new OBException("Error: " + e.getMessage());
     }
     String currentTabId = vars.getStringParameter("tabId");
     if (BOM_PRODUCTION.equals(currentTabId)) {
       final Entity productionLineEntity = ModelProvider.getInstance()
           .getEntity(ProductionLine.ENTITY_NAME);
-      final BigDecimal ZERO = new BigDecimal("0");
       final Property productionPlanProperty = productionLineEntity
           .getProperty(ProductionLine.PROPERTY_PRODUCTIONPLAN);
       final Property movementQtyProperty = productionLineEntity
--- a/src/org/openbravo/event/ReferenceInventoryEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ReferenceInventoryEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2017-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2017-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -36,7 +36,7 @@
 /**
  * Event Observer over {@link ReferencedInventory} entity
  */
-public class ReferenceInventoryEventHandler extends EntityPersistenceEventObserver {
+class ReferenceInventoryEventHandler extends EntityPersistenceEventObserver {
 
   private static final Entity[] ENTITIES = {
       ModelProvider.getInstance().getEntity(ReferencedInventory.ENTITY_NAME) };
--- a/src/org/openbravo/event/RoleEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/RoleEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -41,13 +41,13 @@
 import org.openbravo.model.ad.access.RoleOrganization;
 import org.openbravo.model.common.enterprise.Organization;
 
-public class RoleEventHandler extends EntityPersistenceEventObserver {
+class RoleEventHandler extends EntityPersistenceEventObserver {
   private static final String InitialOrgSetup_CLASSNAME = "org.openbravo.erpCommon.businessUtility.InitialOrgSetup";
   private static final String InitialClientSetup_CLASSNAME = "org.openbravo.erpCommon.businessUtility.InitialClientSetup";
 
   private static Entity[] entities = { ModelProvider.getInstance().getEntity(Role.ENTITY_NAME) };
 
-  protected Logger logger = LogManager.getLogger();
+  private static final Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -87,7 +87,7 @@
 
   // Get org access list
   private List<RoleOrganization> getRoleOrganizationList(Role role) throws Exception {
-    List<RoleOrganization> roleOrganizationList = new ArrayList<RoleOrganization>();
+    List<RoleOrganization> roleOrganizationList = new ArrayList<>();
 
     // Client or System level: Only * [isOrgAdmin=N]
     if (StringUtils.equals(role.getUserLevel(), " C")
--- a/src/org/openbravo/event/ServiceOrderLineEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ServiceOrderLineEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015-20167 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -22,8 +22,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.ScrollMode;
 import org.hibernate.ScrollableResults;
 import org.openbravo.base.exception.OBException;
@@ -42,10 +40,9 @@
 import org.openbravo.model.common.order.OrderLine;
 import org.openbravo.model.common.order.OrderlineServiceRelation;
 
-public class ServiceOrderLineEventHandler extends EntityPersistenceEventObserver {
+class ServiceOrderLineEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(OrderLine.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -180,14 +177,11 @@
   private boolean hasRelatedServices(OrderLine thisLine) {
     OBQuery<OrderlineServiceRelation> rol = relatedServices(thisLine);
     rol.setMaxResult(1);
-    if (rol.uniqueResult() != null) {
-      return true;
-    }
-    return false;
+    return rol.uniqueResult() != null;
   }
 
   private OBQuery<OrderlineServiceRelation> relatedServices(OrderLine thisLine) {
-    StringBuffer where = new StringBuffer();
+    StringBuilder where = new StringBuilder();
     where.append(" as rol");
     where.append(
         " where " + OrderlineServiceRelation.PROPERTY_ORDERLINERELATED + ".id = :orderLineId");
@@ -201,14 +195,11 @@
   private boolean hasRelatedProducts(OrderLine thisLine) {
     OBQuery<OrderlineServiceRelation> rol = relatedProducts(thisLine);
     rol.setMaxResult(1);
-    if (rol.uniqueResult() != null) {
-      return true;
-    }
-    return false;
+    return rol.uniqueResult() != null;
   }
 
   private OBQuery<OrderlineServiceRelation> relatedProducts(OrderLine thisLine) {
-    StringBuffer where = new StringBuffer();
+    StringBuilder where = new StringBuilder();
     where.append(" as rol");
     where.append(
         " where " + OrderlineServiceRelation.PROPERTY_SALESORDERLINE + ".id = :orderLineId");
--- a/src/org/openbravo/event/ServicePriceRuleRangeEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ServicePriceRuleRangeEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,12 +21,9 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
-import org.openbravo.client.kernel.event.EntityDeleteEvent;
 import org.openbravo.client.kernel.event.EntityNewEvent;
 import org.openbravo.client.kernel.event.EntityPersistenceEvent;
 import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
@@ -37,10 +34,9 @@
 import org.openbravo.model.pricing.pricelist.ServicePriceRuleRange;
 import org.openbravo.service.db.DalConnectionProvider;
 
-public class ServicePriceRuleRangeEventHandler extends EntityPersistenceEventObserver {
+class ServicePriceRuleRangeEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(ServicePriceRuleRange.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
@@ -61,12 +57,6 @@
     ruleTypePriceListValidation(event);
   }
 
-  public void onDelete(@Observes EntityDeleteEvent event) {
-    if (!isValidEvent(event)) {
-      return;
-    }
-  }
-
   /**
    * Checks if a Service Price Rule Range has Rule Type = 'Fixed' and Price List = null
    * 
--- a/src/org/openbravo/event/ServiceRelationEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/ServiceRelationEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -24,8 +24,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -40,10 +38,9 @@
 import org.openbravo.model.common.order.OrderlineServiceRelation;
 import org.openbravo.model.common.plm.Product;
 
-public class ServiceRelationEventHandler extends EntityPersistenceEventObserver {
+class ServiceRelationEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(OrderlineServiceRelation.ENTITY_NAME) };
-  protected Logger logger = LogManager.getLogger();
 
   @Override
   protected Entity[] getObservedEntities() {
--- a/src/org/openbravo/event/SimpleGLJournalEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/SimpleGLJournalEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -31,12 +29,10 @@
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.financialmgmt.gl.GLJournal;
 
-public class SimpleGLJournalEventHandler extends EntityPersistenceEventObserver {
+class SimpleGLJournalEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(GLJournal.ENTITY_NAME) };
 
-  protected Logger logger = LogManager.getLogger();
-
   @Override
   protected Entity[] getObservedEntities() {
     return entities;
@@ -54,7 +50,7 @@
     if (event.getCurrentState(isMulti) != event.getPreviousState(isMulti)) {
       final GLJournal simpleGLJournal = (GLJournal) event.getTargetInstance();
 
-      if (simpleGLJournal.getFinancialMgmtGLJournalLineList().size() > 0) {
+      if (!simpleGLJournal.getFinancialMgmtGLJournalLineList().isEmpty()) {
         throw new OBException(
             OBMessageUtils.getI18NMessage("MultiGeneralLedgerCheckValidation", null));
       }
--- a/src/org/openbravo/event/SubsetValueEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/SubsetValueEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):______________________________________.
  *************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
@@ -34,15 +32,13 @@
 import org.openbravo.model.common.plm.ProductCharacteristic;
 import org.openbravo.model.common.plm.ProductCharacteristicConf;
 
-public class SubsetValueEventHandler extends EntityPersistenceEventObserver {
-  protected Logger logger = LogManager.getLogger();
+class SubsetValueEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(CharacteristicSubsetValue.class) };
-  private static ThreadLocal<String> chsubsetvalueUpdated = new ThreadLocal<String>();
+  private static ThreadLocal<String> chsubsetvalueUpdated = new ThreadLocal<>();
 
   @Override
   protected Entity[] getObservedEntities() {
-    // TODO Auto-generated method stub
     return entities;
   }
 
--- a/src/org/openbravo/event/UOMConversionEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/event/UOMConversionEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -20,8 +20,6 @@
 
 import javax.enterprise.event.Observes;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.hibernate.query.Query;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
@@ -36,12 +34,10 @@
 import org.openbravo.model.common.uom.UOM;
 import org.openbravo.model.common.uom.UOMConversion;
 
-public class UOMConversionEventHandler extends EntityPersistenceEventObserver {
+class UOMConversionEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(UOMConversion.ENTITY_NAME) };
 
-  protected Logger logger = LogManager.getLogger();
-
   @Override
   protected Entity[] getObservedEntities() {
     return entities;
@@ -89,14 +85,11 @@
 
       // If changing from inactive to active, check if exists another record using this uomFrom -
       // uomTo
-      if (uomConversion.isActive()) {
-        if (existsRecord(uomConversion.getClient(), uomConversion.getUOM(),
-            uomConversion.getToUOM())) {
-          throw new OBException(String.format(OBMessageUtils.messageBD("CannotInsertUOMConversion"),
-              uomConversion.getUOM().getName(), uomConversion.getToUOM().getName()));
-        }
+      if (uomConversion.isActive() && existsRecord(uomConversion.getClient(),
+          uomConversion.getUOM(), uomConversion.getToUOM())) {
+        throw new OBException(String.format(OBMessageUtils.messageBD("CannotInsertUOMConversion"),
+            uomConversion.getUOM().getName(), uomConversion.getToUOM().getName()));
       }
-
     }
 
     // Check if MultipleRateBy or DivideRateBy have changed
@@ -127,11 +120,7 @@
       query.setParameter("client", client);
     }
     query.setMaxResults(1);
-    if (query.list().size() > 0) {
-      return true;
-    } else {
-      return false;
-    }
+    return !query.list().isEmpty();
   }
 
 }
--- a/src/org/openbravo/role/inheritance/InheritedAccessEnabledEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/role/inheritance/InheritedAccessEnabledEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -40,7 +40,7 @@
  * {@link InheritedAccessEnabled} interface. This handler takes care of propagating the changes
  * according to the affected role inheritance settings.
  */
-public class InheritedAccessEnabledEventHandler extends EntityPersistenceEventObserver {
+class InheritedAccessEnabledEventHandler extends EntityPersistenceEventObserver {
   private static final String SAVE = "save";
   private static final String UPDATE = "update";
   private static final String DELETE = "delete";
@@ -62,7 +62,7 @@
    *          the new event
    */
   public void onSave(@Observes EntityNewEvent event) {
-    if (!isInheritedAccessEnabled(event)) {
+    if (!isValidEvent(event)) {
       return;
     }
     doAction(SAVE, event.getTargetInstance());
@@ -76,7 +76,7 @@
    *          the update event
    */
   public void onUpdate(@Observes EntityUpdateEvent event) {
-    if (!isInheritedAccessEnabled(event)) {
+    if (!isValidEvent(event)) {
       return;
     }
     doAction(UPDATE, event.getTargetInstance());
@@ -90,7 +90,7 @@
    *          the delete event
    */
   public void onDelete(@Observes EntityDeleteEvent event) {
-    if (!isInheritedAccessEnabled(event)) {
+    if (!isValidEvent(event)) {
       return;
     }
     doAction(DELETE, event.getTargetInstance());
@@ -107,7 +107,7 @@
       manager.propagateNewAccess(role, access, entityClassName);
     } else if (UPDATE.equals(action) && isTemplate) {
       manager.propagateUpdatedAccess(role, access, entityClassName);
-    } else if (DELETE.equals(action) && notDeletingParent(role, access)) {
+    } else if (DELETE.equals(action) && notDeletingParent(role)) {
       if (access.getInheritedFrom() != null) {
         Utility.throwErrorMessage("NotDeleteInheritedAccess");
       }
@@ -119,19 +119,16 @@
     }
   }
 
-  private boolean isInheritedAccessEnabled(EntityPersistenceEvent event) {
+  @Override
+  protected boolean isValidEvent(EntityPersistenceEvent event) {
     // Disable event handlers if data is being imported
     if (TriggerHandler.getInstance().isDisabled()) {
       return false;
     }
-    if (event.getTargetInstance() instanceof InheritedAccessEnabled) {
-      return true;
-    } else {
-      return false;
-    }
+    return event.getTargetInstance() instanceof InheritedAccessEnabled;
   }
 
-  private boolean notDeletingParent(Role role, InheritedAccessEnabled access) {
+  private boolean notDeletingParent(Role role) {
     if (role == null) {
       return true;
     }
--- a/src/org/openbravo/role/inheritance/RoleInheritanceEventHandler.java	Fri Feb 01 08:48:40 2019 +0100
+++ b/src/org/openbravo/role/inheritance/RoleInheritanceEventHandler.java	Wed Jan 30 18:38:10 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2015 Openbravo SLU 
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,7 +39,7 @@
  * Listens to delete, update and save events for the {@link RoleInheritance} entity. This handler
  * takes care of recalculating the access of the role affected by the changes on its inheritance.
  */
-public class RoleInheritanceEventHandler extends EntityPersistenceEventObserver {
+class RoleInheritanceEventHandler extends EntityPersistenceEventObserver {
   private static Entity[] entities = {
       ModelProvider.getInstance().getEntity(RoleInheritance.ENTITY_NAME) };
 
@@ -133,7 +133,7 @@
   }
 
   private void checkAncestors(Role role, Role parent) {
-    Set<String> ancestorList = new HashSet<String>();
+    Set<String> ancestorList = new HashSet<>();
     getAncestorList(parent, ancestorList);
     ancestorList.add(parent.getId());
     // check if the role is inheriting from the new parent role
@@ -141,7 +141,7 @@
       Utility.throwErrorMessage("RoleExistsInRoleInheritance");
     } else {
       // check any the role descendants is inheriting from the new parent role
-      Set<String> descendantsAncestorList = new HashSet<String>();
+      Set<String> descendantsAncestorList = new HashSet<>();
       getAncestorListWithChildrenAncestors(role, descendantsAncestorList);
       for (String ancestorId : ancestorList) {
         if (descendantsAncestorList.contains(ancestorId)) {