aggiunto campo tipo_valore sulla jtb_cicl_cq e sulla dtb_ord_cq
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2024-11-06 16:17:38 +01:00
parent 8064573fc8
commit d493e822e6
4 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20241106145413 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE jtb_cicl_cq ADD tipo_valore TINYINT DEFAULT 0 \n" +
"CHECK ([tipo_valore] = 0 OR [tipo_valore] = 1 OR [tipo_valore] = 2 OR [tipo_valore] = 3 OR [tipo_valore] = 4 OR [tipo_valore] = 5 OR [tipo_valore] = 6);" ,
"EXEC sp_addextendedproperty 'MS_Description', 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time',\n"+
"'SCHEMA', 'dbo', 'TABLE', 'jtb_cicl_cq', 'COLUMN', 'tipo_valore'" ,
"UPDATE jtb_cicl_cq SET tipo_valore = 0",
"ALTER TABLE jtb_cicl_cq ALTER COLUMN tipo_valore TINYINT NOT NULL;");
executeStatement("ALTER TABLE dtb_ord_cq ADD tipo_valore TINYINT DEFAULT 0 \n" +
"CHECK ([tipo_valore] = 0 OR [tipo_valore] = 1 OR [tipo_valore] = 2 OR [tipo_valore] = 3 OR [tipo_valore] = 4 OR [tipo_valore] = 5 OR [tipo_valore] = 6);" ,
"EXEC sp_addextendedproperty 'MS_Description', 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time',\n" +
" 'SCHEMA', 'dbo', 'TABLE', 'dtb_ord_cq', 'COLUMN', 'tipo_valore'" ,
"UPDATE dtb_ord_cq SET tipo_valore = 0" ,
"ALTER TABLE dtb_ord_cq ALTER COLUMN tipo_valore TINYINT NOT NULL;");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -6,6 +6,7 @@ import it.integry.ems_model.base.EntityBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kie.api.definition.type.PropertyReactive;
import it.integry.ems_model.entity._enum.TipoValore;
import java.util.ArrayList;
import java.util.Date;
@@ -63,6 +64,9 @@ public class DtbOrdCq extends EntityBase {
@SqlField(value = "note", maxLength = 1024)
private String note;
@SqlField(value = "tipo_valore", nullable = false, defaultObjectValue = "0")
private TipoValore tipoValore;
@EntityChild
private List<DtbOrdCqr> dtbOrdCqr = new ArrayList<>();
@@ -187,6 +191,15 @@ public class DtbOrdCq extends EntityBase {
return this;
}
public TipoValore getTipoValore() {
return tipoValore;
}
public DtbOrdCq setTipoValore(TipoValore tipoValore) {
this.tipoValore = tipoValore;
return this;
}
@Override
public void checkPreSave() throws Exception {
for (DtbOrdCqr dtbOrdCqr : getDtbOrdCqr()) {

View File

@@ -9,6 +9,7 @@ import it.integry.ems_model.base.EntityBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kie.api.definition.type.PropertyReactive;
import it.integry.ems_model.entity._enum.TipoValore;
@PropertyReactive
@Table(JtbCiclCq.ENTITY)
@@ -46,6 +47,9 @@ public class JtbCiclCq extends EntityBase {
@SqlField(value = "num_rip", defaultObjectValue = "0")
private Integer numRip;
@SqlField(value = "tipo_valore", nullable = false, defaultObjectValue = "0")
private TipoValore tipoValore;
public JtbCiclCq() {
super(logger);
}
@@ -105,4 +109,13 @@ public class JtbCiclCq extends EntityBase {
public void setNumRip(Integer numRip) {
this.numRip = numRip;
}
public TipoValore getTipoValore() {
return tipoValore;
}
public JtbCiclCq setTipoValore(TipoValore tipoValore) {
this.tipoValore = tipoValore;
return this;
}
}

View File

@@ -0,0 +1,44 @@
package it.integry.ems_model.entity._enum;
import com.fasterxml.jackson.annotation.JsonValue;
public enum TipoValore implements IBaseEnum<TipoValore> {
TESTO((short) 0), BOOLEAN((short) 1), INTERO((short) 2), DECIMALE((short) 3), DATE((short) 4), DATETIME((short) 5), TIME((short) 6);
private final short value;
TipoValore(final short value) {this.value = value;}
public static TipoValore from(Object value) {
short castValue = (short) value;
for (TipoValore b : TipoValore.values()) {
if (b.value == castValue)
return b;
}
return null;
}
@JsonValue
public Short getValue() {
return this.value;
}
@Override
public Object get() {
return this.value;
}
@Override
public TipoValore fromInternal(Object val) {
return from(val);
}
@Override
public String toString() {
return String.valueOf(value);
}
}