Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -11,6 +11,7 @@ public class CommonConstants {
|
||||
|
||||
public static final String INTEGRY = "integry";
|
||||
public static final String PROFILE_DB = "profileDb";
|
||||
public static final String COD_MDEP = "codMdep";
|
||||
public static final String WHERE_COND = "whereCond";
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ public class DbmsChangeTrackerComponent {
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
add(WtbGestSetupUser.ENTITY);
|
||||
|
||||
add(WtbDepo.ENTITY);
|
||||
}};
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
put(WtbGestSetupUser.ENTITY, WtbGestSetupUser.class);
|
||||
|
||||
put(WtbDepo.ENTITY, WtbDepo.class);
|
||||
}};
|
||||
|
||||
public EntityCacheComponent(DbmsChangeTrackerComponent dbmsChangeTrackerComponent, EntityPropertyHolder entityPropertyHolder) {
|
||||
|
||||
@@ -40,6 +40,10 @@ public class RequestDataDTO {
|
||||
private String requestClientIP;
|
||||
|
||||
private String profileDB;
|
||||
|
||||
//Indica il codice deposito reale dell'utente che effettua la richiesta, ovvero la posizione fisica dell'utente
|
||||
private String codMdep;
|
||||
|
||||
private Long deviceId;
|
||||
private String username;
|
||||
private String password;
|
||||
@@ -58,6 +62,10 @@ public class RequestDataDTO {
|
||||
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||
}
|
||||
|
||||
if (request != null && request.getHeader(CommonConstants.COD_MDEP) != null) {
|
||||
codMdep = request.getHeader(CommonConstants.COD_MDEP);
|
||||
}
|
||||
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) {
|
||||
readAuthenticationClaims(authentication);
|
||||
@@ -111,6 +119,10 @@ public class RequestDataDTO {
|
||||
return !UtilityString.isNullOrEmpty(profileDB);
|
||||
}
|
||||
|
||||
public boolean isValidCodMdep() {
|
||||
return !UtilityString.isNullOrEmpty(codMdep);
|
||||
}
|
||||
|
||||
public boolean isValidDeviceId() {
|
||||
return deviceId != null;
|
||||
}
|
||||
@@ -141,6 +153,10 @@ public class RequestDataDTO {
|
||||
return profileDB;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public IntegryCustomerDB getCustomerDB() {
|
||||
if (UtilityString.isNullOrEmpty(profileDB))
|
||||
return null;
|
||||
|
||||
@@ -173,7 +173,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
UtilityDB.cloneTable(connection, sourceTable, newTable, fillNewTable, dropOldTable, renameNewTable);
|
||||
}
|
||||
|
||||
protected void dropIndex(String tableName, String indexName) throws Exception {
|
||||
protected boolean existIndex(String tableName, String indexName) throws SQLException {
|
||||
return UtilityDB.existIndex(connection, tableName, indexName);
|
||||
}
|
||||
|
||||
protected void dropIndex(String tableName, String indexName) throws SQLException {
|
||||
UtilityDB.dropIndex(connection, tableName, indexName);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251126113917 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Sardinya)) {
|
||||
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "ATTIVO", "N",
|
||||
"Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "EMAIL_FOR_LOG", null,
|
||||
"Inserire il file l'indirizzo email per inviare il log dell'importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "GG_CANC_FILE", null,
|
||||
"Giorni per la cancellazione dei file dalla cartella di appoggio", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "IMPORT_REST", "S",
|
||||
"Inserire S/N per attivare/disattivare il salvataggio con i servizi REST", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "PATH_FILE", null,
|
||||
"Directory dove vengono salvati i file temporanei, se non è configurata i file saranno salvati in c:\\mlSetupWS\\TEMP_EXPORT", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
updateSetupValue("EXPORT_DOCUMENTI DI VENDITA", "MD", "ATTIVO", "S",
|
||||
"Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251126115627 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
|
||||
return;
|
||||
|
||||
boolean existIndex = existIndex("wtb_depo", "ux_wtb_depo_depo_default_utente");
|
||||
|
||||
if(existIndex)
|
||||
dropIndex("wtb_depo", "ux_wtb_depo_depo_default_utente");
|
||||
|
||||
executeStatement("ALTER TABLE dbo.wtb_depo\n" +
|
||||
" ALTER COLUMN user_name VARCHAR(40) NOT NULL",
|
||||
|
||||
"ALTER TABLE dbo.wtb_depo\n" +
|
||||
" ALTER COLUMN cod_mdep VARCHAR(5) NOT NULL",
|
||||
|
||||
"ALTER TABLE dbo.wtb_depo\n" +
|
||||
" ADD CONSTRAINT pk_wtb_depo\n" +
|
||||
" PRIMARY KEY (cod_mdep, user_name)");
|
||||
|
||||
if(existIndex)
|
||||
executeStatement("CREATE unique index ux_wtb_depo_depo_default_utente\n" +
|
||||
" on dbo.wtb_depo (user_name)\n" +
|
||||
" where [default_depo] = 1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.user;
|
||||
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.dto.UserDTO;
|
||||
@@ -21,6 +22,9 @@ public class UserSession {
|
||||
private UserDTO currentUser;
|
||||
private MtbDepo currentUserDepo;
|
||||
|
||||
@Autowired
|
||||
private EntityCacheComponent entityCacheComponent;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@@ -32,6 +36,17 @@ public class UserSession {
|
||||
try {
|
||||
currentUser = UtilityUser.getCurrentUser(multiDBTransactionManager, requestDataDTO.getUsername());
|
||||
|
||||
if (requestDataDTO.isValidCodMdep()) {
|
||||
currentUserDepo = entityCacheComponent.<MtbDepo>getCachedEntitiesStream(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB(),
|
||||
MtbDepo.ENTITY,
|
||||
x -> x.getCodMdep().equals(requestDataDTO.getCodMdep()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if(currentUserDepo != null)
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentUser != null)
|
||||
currentUserDepo = UtilityUser.getDefaultUserDepo(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB(), currentUser);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.entity.WtbDepo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@@ -51,9 +52,6 @@ public class UserDTO implements Cloneable{
|
||||
@SqlField("user_code")
|
||||
private String userCode;
|
||||
|
||||
@SqlField("cod_mdep")
|
||||
private String codMdep;
|
||||
|
||||
@SqlField("is_attivo")
|
||||
private boolean attivo;
|
||||
|
||||
@@ -68,6 +66,8 @@ public class UserDTO implements Cloneable{
|
||||
|
||||
private List<String> availableProfiles;
|
||||
|
||||
private List<WtbDepo> availableDepoList;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
@@ -203,18 +203,16 @@ public class UserDTO implements Cloneable{
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
@JsonProperty("cod_mdep")
|
||||
public String getCodMdepAlias() {
|
||||
return codMdep;
|
||||
}
|
||||
public String getCodMdep() {
|
||||
if(getAvailableDepoList() != null && !getAvailableDepoList().isEmpty()) {
|
||||
return getAvailableDepoList().stream().filter(WtbDepo::getDefaultDepo)
|
||||
.findFirst()
|
||||
.orElse(getAvailableDepoList().get(0))
|
||||
.getCodMdep();
|
||||
}
|
||||
|
||||
public UserDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAttivo() {
|
||||
@@ -289,6 +287,15 @@ public class UserDTO implements Cloneable{
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<WtbDepo> getAvailableDepoList() {
|
||||
return availableDepoList;
|
||||
}
|
||||
|
||||
public UserDTO setAvailableDepoList(List<WtbDepo> availableDepoList) {
|
||||
this.availableDepoList = availableDepoList;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO clone() {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.user.service;
|
||||
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.model.IntegryApplicationEnum;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
@@ -8,8 +9,8 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.task.TaskExecutorService;
|
||||
import it.integry.ems.user.dto.UserDTO;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems_model.entity.StbUser;
|
||||
import it.integry.ems_model.entity.WtbDepo;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHash;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -33,6 +34,9 @@ public class UserCacheService {
|
||||
@Autowired
|
||||
private TaskExecutorService taskExecutorService;
|
||||
|
||||
@Autowired
|
||||
private EntityCacheComponent entityCacheComponent;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private final HashMap<String, List<UserDTO>> cachedUsers = new HashMap<>();
|
||||
@@ -43,7 +47,7 @@ public class UserCacheService {
|
||||
|
||||
@PostContextConstruct(priority = 10)
|
||||
private void init() {
|
||||
canStart = !UtilityDebug.isDebugExecution();
|
||||
canStart = true; //!UtilityDebug.isDebugExecution();
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.MINUTES)
|
||||
@@ -208,22 +212,26 @@ public class UserCacheService {
|
||||
" DATEDIFF(DAY, su.password_endtime, GETDATE()) > 0 AND su.flag_password_expiring = 'S', 1,\n" +
|
||||
" 0) AS BIT) AS is_password_expired,\n" +
|
||||
" IIF(su.key_group = '3' AND su.user_code IS NULL, wc.cod_anag, su.user_code) AS user_code,\n" +
|
||||
" wd.cod_mdep,\n" +
|
||||
" CAST(IIF(ISNULL(su.flag_attivo, 'N') = 'S', 1, 0) AS BIT) AS is_attivo,\n" +
|
||||
" CAST(IIF(su.flag_intra_user = 'S' OR su.flag_dba = 'S', 1, 0) AS BIT) AS is_internal,\n" +
|
||||
" CAST(IIF(su.flag_intra_user = 'S' OR su.flag_extra_user = 'S', 1, 0) AS BIT) AS is_web,\n" +
|
||||
" '" + connection.getProfileName() + "' AS profile_db\n" +
|
||||
"FROM " + StbUser.ENTITY + " su " +
|
||||
" LEFT OUTER JOIN wtb_clie wc ON su.user_name = wc.user_name\n" +
|
||||
" LEFT OUTER JOIN wtb_depo wd ON su.user_name = wd.user_name\n" +
|
||||
" LEFT OUTER JOIN mtb_depo md ON wd.cod_mdep = md.cod_mdep\n" +
|
||||
"WHERE dbo.sys_dcd_pss(su.password) IS NOT NULL";
|
||||
|
||||
|
||||
final List<UserDTO> userDTOS = UtilityDB.executeSimpleQueryDTO(connection, sql, UserDTO.class);
|
||||
|
||||
if (userDTOS != null)
|
||||
userDTOS.forEach(x -> cache(connection.getDbName(), x));
|
||||
userDTOS.forEach(x -> {
|
||||
List<WtbDepo> availableDepoList = entityCacheComponent.getCachedEntitiesList(connection.getIntegryCustomerDB(), WtbDepo.ENTITY,
|
||||
y -> x.getUsername().equalsIgnoreCase(y.getUserName())
|
||||
);
|
||||
x.setAvailableDepoList(availableDepoList);
|
||||
|
||||
cache(connection.getDbName(), x);
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
logger.error(String.format("Errore durante la retrieve degli utenti su \"%s\". %s", connection.getProfileName(), ex.getMessage()), ex);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static sun.rmi.registry.RegistryImpl.getID;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbAartMarchio.ENTITY)
|
||||
@@ -50,6 +52,15 @@ public class MtbAartMarchio extends EntityBase implements EquatableEntityInterfa
|
||||
super(logger);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public MtbAartMarchio setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMarchio() {
|
||||
return marchio;
|
||||
}
|
||||
@@ -59,6 +70,33 @@ public class MtbAartMarchio extends EntityBase implements EquatableEntityInterfa
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbMarchioLinea> getMtbMarchioLinea() {
|
||||
return mtbMarchioLinea;
|
||||
}
|
||||
|
||||
public MtbAartMarchio setMtbMarchioLinea(List<MtbMarchioLinea> mtbMarchioLinea) {
|
||||
this.mtbMarchioLinea = mtbMarchioLinea;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbMarchioSlinea> getMtbMarchioSlinea() {
|
||||
return mtbMarchioSlinea;
|
||||
}
|
||||
|
||||
public MtbAartMarchio setMtbMarchioSlinea(List<MtbMarchioSlinea> mtbMarchioSlinea) {
|
||||
this.mtbMarchioSlinea = mtbMarchioSlinea;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbMarchioSslinea> getMtbMarchioSslinea() {
|
||||
return mtbMarchioSslinea;
|
||||
}
|
||||
|
||||
public MtbAartMarchio setMtbMarchioSslinea(List<MtbMarchioSslinea> mtbMarchioSslinea) {
|
||||
this.mtbMarchioSslinea = mtbMarchioSslinea;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbMarchioSslinea mtbMarchioSslinea = new MtbMarchioSslinea();
|
||||
@@ -77,23 +115,24 @@ public class MtbAartMarchio extends EntityBase implements EquatableEntityInterfa
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getMarchio(), other.getMarchio());
|
||||
return Objects.equals(getID(), other.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hashCode(getMarchio());
|
||||
return Objects.hashCode(getID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbAartMarchio)) return false;
|
||||
MtbAartMarchio that = (MtbAartMarchio) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(getMarchio(), that.getMarchio());
|
||||
MtbAartMarchio mtbAartMarchio = (MtbAartMarchio) o;
|
||||
return Objects.equals(getId(), mtbAartMarchio.getId()) && Objects.equals(getMarchio(), mtbAartMarchio.getMarchio());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, getMarchio());
|
||||
return Objects.hash(getId(), getMarchio());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,15 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbSsfam> getMtbSsfam() {
|
||||
return mtbSsfam;
|
||||
}
|
||||
|
||||
public MtbGrup setMtbSsfam(List<MtbSsfam> mtbSsfam) {
|
||||
this.mtbSsfam = mtbSsfam;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getFlagAttivo() { return flagAttivo; }
|
||||
|
||||
public MtbGrup setFlagAttivo(Boolean flagAttivo) {
|
||||
|
||||
@@ -3,18 +3,21 @@ package it.integry.ems_model.entity;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = MtbMarchioLinea.ENTITY)
|
||||
@JsonTypeName(value = MtbMarchioLinea.ENTITY)
|
||||
public class MtbMarchioLinea extends EntityBase {
|
||||
public class MtbMarchioLinea extends EntityBase implements EquatableEntityInterface<MtbMarchioLinea> {
|
||||
|
||||
|
||||
public final static String ENTITY = "mtb_marchio_linea";
|
||||
|
||||
@@ -89,9 +92,38 @@ public class MtbMarchioLinea extends EntityBase {
|
||||
}
|
||||
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbMarchioSlinea mtbMarchioSlinea = new MtbMarchioSlinea();
|
||||
mtbMarchioSlinea.deleteAllEntities(connection, this);
|
||||
MtbMarchioSslinea mtbMarchioSslinea = new MtbMarchioSslinea();
|
||||
mtbMarchioSslinea.deleteAllEntities(connection, this);
|
||||
MtbMarchioSlinea mtbMarchioSlinea = new MtbMarchioSlinea();
|
||||
mtbMarchioSlinea.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbMarchioLinea other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getIdMarchio(), other.getIdMarchio()) && Objects.equals(getCodLinea(), other.getCodLinea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getIdMarchio(), getCodLinea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbMarchioLinea)) return false;
|
||||
MtbMarchioLinea mtbMarchioLinea = (MtbMarchioLinea) o;
|
||||
return Objects.equals(getIdMarchio(), mtbMarchioLinea.getIdMarchio()) && Objects.equals(getCodLinea(), mtbMarchioLinea.getCodLinea()) && Objects.equals(getDescrizione(), mtbMarchioLinea.getDescrizione());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getIdMarchio(), getCodLinea(), getDescrizione());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = MtbMarchioSlinea.ENTITY)
|
||||
@JsonTypeName(value = MtbMarchioSlinea.ENTITY)
|
||||
public class MtbMarchioSlinea extends EntityBase {
|
||||
public class MtbMarchioSlinea extends EntityBase implements EquatableEntityInterface<MtbMarchioSlinea> {
|
||||
|
||||
public final static String ENTITY = "mtb_marchio_slinea";
|
||||
|
||||
@@ -36,6 +38,13 @@ public class MtbMarchioSlinea extends EntityBase {
|
||||
@SqlField(value = "descrizione", maxLength = 255, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@EntityChild
|
||||
private List<MtbMarchioSslinea> mtbMarchioSslinea;
|
||||
|
||||
{
|
||||
mtbMarchioSslinea = new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getCodLinea() {
|
||||
return codLinea;
|
||||
}
|
||||
@@ -62,4 +71,47 @@ public class MtbMarchioSlinea extends EntityBase {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbMarchioSslinea> getMtbMarchioSslinea() {
|
||||
return mtbMarchioSslinea;
|
||||
}
|
||||
|
||||
public MtbMarchioSlinea setMtbMarchioSslinea(List<MtbMarchioSslinea> mtbMarchioSslinea) {
|
||||
this.mtbMarchioSslinea = mtbMarchioSslinea;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbMarchioSslinea mtbMarchioSslinea = new MtbMarchioSslinea();
|
||||
mtbMarchioSslinea.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbMarchioSlinea other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getCodLinea(), other.getCodLinea()) && Objects.equals(getCodSlinea(), other.getCodSlinea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodLinea(), getCodSlinea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbMarchioSlinea)) return false;
|
||||
MtbMarchioSlinea mtbMarchioSlinea = (MtbMarchioSlinea) o;
|
||||
return Objects.equals(getCodLinea(), mtbMarchioSlinea.getCodLinea()) && Objects.equals(getCodSlinea(), mtbMarchioSlinea.getCodSlinea()) && Objects.equals(getDescrizione(), mtbMarchioSlinea.getDescrizione());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodLinea(), getCodSlinea(), getDescrizione());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,17 @@ import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = MtbMarchioSslinea.ENTITY)
|
||||
@JsonTypeName(value = MtbMarchioSslinea.ENTITY)
|
||||
public class MtbMarchioSslinea extends EntityBase {
|
||||
public class MtbMarchioSslinea extends EntityBase implements EquatableEntityInterface<MtbMarchioSslinea> {
|
||||
|
||||
public final static String ENTITY = "mtb_marchio_sslinea";
|
||||
|
||||
@@ -62,4 +65,33 @@ public class MtbMarchioSslinea extends EntityBase {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbMarchioSslinea other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getCodSlinea(), other.getCodSlinea()) && Objects.equals(getCodSslinea(), other.getCodSslinea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodSlinea(), getCodSslinea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbMarchioSslinea)) return false;
|
||||
MtbMarchioSslinea mtbMarchioSslinea = (MtbMarchioSslinea) o;
|
||||
return Objects.equals(getCodSlinea(), mtbMarchioSslinea.getCodSlinea()) && Objects.equals(getCodSslinea(), mtbMarchioSslinea.getCodSslinea()) && Objects.equals(getDescrizione(), mtbMarchioSslinea.getDescrizione());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodSlinea(), getCodSslinea(), getDescrizione());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,17 @@ public class UtilityDB {
|
||||
cs.close();
|
||||
}
|
||||
|
||||
public static void dropIndex(Connection conn, String tableName, String indexName ) throws SQLException {
|
||||
|
||||
public static boolean existIndex(Connection conn, String tableName, String indexName ) throws SQLException {
|
||||
String sql = Query.format("SELECT CAST(Count(*) as bit) from sys.sysindexes where name = %s and object_name(id) = %s", indexName, tableName);
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
}
|
||||
|
||||
boolean existIndex = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
public static void dropIndex(Connection conn, String tableName, String indexName ) throws SQLException {
|
||||
boolean existIndex = existIndex(conn, tableName, indexName);
|
||||
|
||||
if (existIndex) {
|
||||
sql = String.format("DROP INDEX %s ON dbo.%s", indexName, tableName);
|
||||
String sql = String.format("DROP INDEX %s ON dbo.%s", indexName, tableName);
|
||||
Statement statement = conn.createStatement();
|
||||
|
||||
statement.execute(sql);
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package it.integry.ems.document.export.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems_model.annotation.DtoField;
|
||||
|
||||
public class MdRigheDTO {
|
||||
|
||||
private final String format = "20";
|
||||
@DtoField(startPosition = 1, maxLength = 7, format = format, fillChar = "0")
|
||||
private String tipoRecord;
|
||||
@JsonProperty (value = "cod_mart")
|
||||
@DtoField(startPosition = 8, maxLength = 15, fillChar = " ")
|
||||
private String codMart;
|
||||
@JsonProperty (value = "descrizione")
|
||||
@DtoField(startPosition = 23, maxLength = 30, fillChar = " ")
|
||||
private String descrizione;
|
||||
@JsonProperty (value = "unt_doc")
|
||||
@DtoField(startPosition = 53, maxLength = 2, fillChar = " ")
|
||||
private String untDoc;
|
||||
@JsonProperty(value = "qta_doc")
|
||||
@DtoField(startPosition = 55, maxLength = 7, fillChar = "0")
|
||||
private Integer qtaDoc;
|
||||
@JsonProperty(value = "prezzo_netto")
|
||||
@DtoField(startPosition = 62, maxLength = 9, fillChar = "0")
|
||||
private Integer prezzoNetto;
|
||||
@JsonProperty(value = "imponibile")
|
||||
@DtoField(startPosition = 71, maxLength = 13, fillChar = "0")
|
||||
private Integer imponibile;
|
||||
@DtoField(startPosition = 84, maxLength = 1, fillChar = " ")
|
||||
private Integer record;
|
||||
@JsonProperty(value = "cod_aliq")
|
||||
@DtoField(startPosition = 85, maxLength = 2, fillChar = " ")
|
||||
private String codAliq;
|
||||
@JsonProperty(value = "tipo_cessione")
|
||||
@DtoField(startPosition = 87, maxLength = 1, fillChar = " ")
|
||||
private Integer tipoCessione;
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public String getTipoRecord() {
|
||||
return tipoRecord;
|
||||
}
|
||||
|
||||
public MdRigheDTO setTipoRecord(String tipoRecord) {
|
||||
this.tipoRecord = tipoRecord;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public MdRigheDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MdRigheDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntDoc() {
|
||||
return untDoc;
|
||||
}
|
||||
|
||||
public MdRigheDTO setUntDoc(String untDoc) {
|
||||
this.untDoc = untDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQtaDoc() {
|
||||
return qtaDoc;
|
||||
}
|
||||
|
||||
public MdRigheDTO setQtaDoc(Integer qtaDoc) {
|
||||
this.qtaDoc = qtaDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPrezzoNetto() {
|
||||
return prezzoNetto;
|
||||
}
|
||||
|
||||
public MdRigheDTO setPrezzoNetto(Integer prezzoNetto) {
|
||||
this.prezzoNetto = prezzoNetto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getImponibile() {
|
||||
return imponibile;
|
||||
}
|
||||
|
||||
public MdRigheDTO setImponibile(Integer imponibile) {
|
||||
this.imponibile = imponibile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
public MdRigheDTO setRecord(Integer record) {
|
||||
this.record = record;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAliq() {
|
||||
return codAliq;
|
||||
}
|
||||
|
||||
public MdRigheDTO setCodAliq(String codAliq) {
|
||||
this.codAliq = codAliq;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTipoCessione() {
|
||||
return tipoCessione;
|
||||
}
|
||||
|
||||
public MdRigheDTO setTipoCessione(Integer tipoCessione) {
|
||||
this.tipoCessione = tipoCessione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package it.integry.ems.document.export.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import it.integry.ems_model.annotation.DtoField;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MdTestateDTO {
|
||||
private final String format = "10";
|
||||
private final String dateFormat = "yyMMdd";
|
||||
@DtoField(startPosition = 1, maxLength = 7, format = format, fillChar = "0")
|
||||
private String tipoRecord;
|
||||
@JsonProperty (value = "num_doc_val")
|
||||
@DtoField(startPosition = 8, maxLength = 6, fillChar = "0")
|
||||
private Integer numDocVal;
|
||||
@JsonProperty (value = "data_doc_val")
|
||||
@DtoField(startPosition = 14, maxLength = 6, format = dateFormat, fillChar = " " )
|
||||
private Date dateDocVal;
|
||||
@JsonProperty (value = "num_doc")
|
||||
@DtoField(startPosition = 20, maxLength = 6, fillChar = " ")
|
||||
private Integer numDoc;
|
||||
@JsonProperty (value = "data_doc")
|
||||
@DtoField(startPosition = 26, maxLength = 6, format = dateFormat, fillChar = " " )
|
||||
private Date dateDoc;
|
||||
@JsonProperty (value = "cod_affiliazione")
|
||||
@DtoField(startPosition = 32, maxLength = 31, fillChar = " ")
|
||||
private String codAffiliazione;
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public String getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
public String getTipoRecord() {
|
||||
return tipoRecord;
|
||||
}
|
||||
|
||||
public MdTestateDTO setTipoRecord(String tipoRecord) {
|
||||
this.tipoRecord = tipoRecord;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumDocVal() {
|
||||
return numDocVal;
|
||||
}
|
||||
|
||||
public MdTestateDTO setNumDocVal(Integer numDocVal) {
|
||||
this.numDocVal = numDocVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDateDocVal() {
|
||||
return dateDocVal;
|
||||
}
|
||||
|
||||
public MdTestateDTO setDateDocVal(Date dateDocVal) {
|
||||
this.dateDocVal = dateDocVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public MdTestateDTO setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDateDoc() {
|
||||
return dateDoc;
|
||||
}
|
||||
|
||||
public MdTestateDTO setDateDoc(Date dateDoc) {
|
||||
this.dateDoc = dateDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAffiliazione() {
|
||||
return codAffiliazione;
|
||||
}
|
||||
|
||||
public MdTestateDTO setCodAffiliazione(String codAffiliazione) {
|
||||
this.codAffiliazione = codAffiliazione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user