From 823a3d70c5bb53601ce18df4fbc0f5682d4fbfe7 Mon Sep 17 00:00:00 2001 From: MinaR Date: Mon, 18 Nov 2024 17:31:00 +0100 Subject: [PATCH] aggiunti campi sulle righe dei rapportini --- .idea/runConfigurations/Tomcat.xml | 5 +- .../model/Migration_20241118095742.java | 26 ++++++++++ .../it/integry/ems_model/entity/JtbRLavr.java | 50 ++++++++++++++++++- .../main/resources/rules/config_activity.drl | 3 +- .../src/main/resources/rules/production.drl | 21 ++++++++ 5 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 ems-core/src/main/java/it/integry/ems/migration/model/Migration_20241118095742.java diff --git a/.idea/runConfigurations/Tomcat.xml b/.idea/runConfigurations/Tomcat.xml index ddde02463a..8c376f0427 100644 --- a/.idea/runConfigurations/Tomcat.xml +++ b/.idea/runConfigurations/Tomcat.xml @@ -1,7 +1,6 @@ \ No newline at end of file diff --git a/ems-core/src/main/java/it/integry/ems/migration/model/Migration_20241118095742.java b/ems-core/src/main/java/it/integry/ems/migration/model/Migration_20241118095742.java new file mode 100644 index 0000000000..5cba438c4e --- /dev/null +++ b/ems-core/src/main/java/it/integry/ems/migration/model/Migration_20241118095742.java @@ -0,0 +1,26 @@ +package it.integry.ems.migration.model; + +import it.integry.ems.migration._base.BaseMigration; +import it.integry.ems.migration._base.MigrationModelInterface; + +public class Migration_20241118095742 extends BaseMigration implements MigrationModelInterface { + + @Override + public void up() throws Exception { + if (isHistoryDB()) + return; + + executeStatement( + "ALTER TABLE jtb_rlavr ADD inserito_da varchar(40)", + "ALTER TABLE jtb_rlavr ADD data_ins datetime", + "ALTER TABLE jtb_rlavr ADD modificato_da varchar(40)", + "ALTER TABLE jtb_rlavr ADD data_mod datetime" + ); + } + + @Override + public void down() throws Exception { + + } + +} \ No newline at end of file diff --git a/ems-core/src/main/java/it/integry/ems_model/entity/JtbRLavr.java b/ems-core/src/main/java/it/integry/ems_model/entity/JtbRLavr.java index 6f63c3a313..968dcf89e4 100644 --- a/ems-core/src/main/java/it/integry/ems_model/entity/JtbRLavr.java +++ b/ems-core/src/main/java/it/integry/ems_model/entity/JtbRLavr.java @@ -6,7 +6,6 @@ import it.integry.ems_model.base.EntityBase; import org.kie.api.definition.type.PropertyReactive; import java.math.BigDecimal; import java.util.Date; -import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -113,6 +112,19 @@ public class JtbRLavr extends EntityBase { @SqlField(value = "id_posizione") private Long idPosizione; + @SqlField(value = "inserito_da") + private String inseritoDa; + + @SqlField(value = "data_ins") + private Date dataIns; + + @SqlField(value = "modificato_da") + private String modificatoDa; + + @SqlField(value = "data_mod") + private Date dataMod; + + public JtbRLavr() { super(logger); } @@ -377,4 +389,40 @@ public class JtbRLavr extends EntityBase { this.idPosizione = idPosizione; return this; } + + public String getInseritoDa() { + return inseritoDa; + } + + public JtbRLavr setInseritoDa(String inseritoDa) { + this.inseritoDa = inseritoDa; + return this; + } + + public Date getDataIns() { + return dataIns; + } + + public JtbRLavr setDataIns(Date dataIns) { + this.dataIns = dataIns; + return this; + } + + public String getModificatoDa() { + return modificatoDa; + } + + public JtbRLavr setModificatoDa(String modificatoDa) { + this.modificatoDa = modificatoDa; + return this; + } + + public Date getDataMod() { + return dataMod; + } + + public JtbRLavr setDataMod(Date dataMod) { + this.dataMod = dataMod; + return this; + } } diff --git a/ems-core/src/main/resources/rules/config_activity.drl b/ems-core/src/main/resources/rules/config_activity.drl index 37383d18a3..7b7731d104 100644 --- a/ems-core/src/main/resources/rules/config_activity.drl +++ b/ems-core/src/main/resources/rules/config_activity.drl @@ -216,4 +216,5 @@ when then List jtbRlavt = ConfigActivityRules.completeJtbRlavtActivity(conn, $entity); modify ( $entity ) { setJtbRLavt(jtbRlavt), setEffectiveEndtime($entity.getEffectiveEndtime() == null? new Date(): $entity.getEffectiveEndtime()) } -end \ No newline at end of file +end + diff --git a/ems-core/src/main/resources/rules/production.drl b/ems-core/src/main/resources/rules/production.drl index 833aba45af..27923f016c 100644 --- a/ems-core/src/main/resources/rules/production.drl +++ b/ems-core/src/main/resources/rules/production.drl @@ -164,6 +164,27 @@ then modify ( $rLavR ) { setaOra(aOra) } end +rule "completeDatiInsJtbRlavr" +no-loop +when + eval(completeRulesEnabled) + $entity : JtbRLavr(operation == OperationType.INSERT || (operation == OperationType.INSERT_OR_UPDATE && inseritoDa== null)) +then + modify ( $entity ) { + setInseritoDa(username), setDataIns(new Date()) + } +end + +rule "completeDatiModJtbRlavr" +no-loop +when + eval(completeRulesEnabled) + $entity : JtbRLavr(operation != OperationType.DELETE ) +then + modify ( $entity ) { + setModificatoDa(username), setDataMod(new Date()) + } +end //---------------------------------------------------------------------------------------------