Merge remote-tracking branch 'origin/develop' into develop
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -95,7 +95,7 @@ public class EntityHierarchy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Field {
|
public static class Field implements Cloneable {
|
||||||
private java.lang.reflect.Field field;
|
private java.lang.reflect.Field field;
|
||||||
private PK primaryKey;
|
private PK primaryKey;
|
||||||
private Identity identity;
|
private Identity identity;
|
||||||
@@ -151,7 +151,9 @@ public class EntityHierarchy {
|
|||||||
return identity != null;
|
return identity != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVarBinary() { return varBinary != null; }
|
public boolean isVarBinary() {
|
||||||
|
return varBinary != null;
|
||||||
|
}
|
||||||
|
|
||||||
public PK getPrimaryKey() {
|
public PK getPrimaryKey() {
|
||||||
return primaryKey;
|
return primaryKey;
|
||||||
@@ -237,5 +239,33 @@ public class EntityHierarchy {
|
|||||||
public String getFieldName() {
|
public String getFieldName() {
|
||||||
return fieldName;
|
return fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Field clone() {
|
||||||
|
try {
|
||||||
|
Field cloned = (Field) super.clone();
|
||||||
|
|
||||||
|
// java.lang.reflect.Field è final, quindi usiamo lo stesso riferimento
|
||||||
|
cloned.field = this.field;
|
||||||
|
|
||||||
|
// Tutte le altre proprietà sono @interface (annotazioni) quindi immutabili
|
||||||
|
cloned.primaryKey = this.primaryKey;
|
||||||
|
cloned.identity = this.identity;
|
||||||
|
cloned.sqlField = this.sqlField;
|
||||||
|
cloned.importFromParent = this.importFromParent;
|
||||||
|
cloned.priority = this.priority;
|
||||||
|
cloned.objectStorage = this.objectStorage;
|
||||||
|
cloned.blob = this.blob;
|
||||||
|
cloned.clob = this.clob;
|
||||||
|
cloned.varBinary = this.varBinary;
|
||||||
|
|
||||||
|
// String è immutabile
|
||||||
|
cloned.fieldName = this.fieldName;
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
throw new RuntimeException("Errore durante la clonazione del Field", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|||||||
import it.integry.ems.utility.UtilityDebug;
|
import it.integry.ems.utility.UtilityDebug;
|
||||||
import it.integry.ems_model.annotation.*;
|
import it.integry.ems_model.annotation.*;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.db.ResultSetMapper;
|
|
||||||
import it.integry.ems_model.exception.*;
|
import it.integry.ems_model.exception.*;
|
||||||
import it.integry.ems_model.resolver.PropertyTypeResolver;
|
import it.integry.ems_model.resolver.PropertyTypeResolver;
|
||||||
import it.integry.ems_model.resolver.SqlFieldHolder;
|
import it.integry.ems_model.resolver.SqlFieldHolder;
|
||||||
@@ -45,6 +44,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.apache.commons.lang3.time.DateUtils;
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
String wherePK;
|
String wherePK;
|
||||||
|
|
||||||
if ((getOperation() == OperationType.SUBSTITUTE || getOperation() == OperationType.DELETE_THEN_INSERT) && getOldPk() != null) {
|
if ((getOperation() == OperationType.SUBSTITUTE || getOperation() == OperationType.DELETE_THEN_INSERT) && getOldPk() != null) {
|
||||||
wherePK = getWhereCondOldPk();
|
wherePK = getWhereCondOldPk(null);
|
||||||
} else {
|
} else {
|
||||||
wherePK = getEntityHolder().getWherePK(this);
|
wherePK = getEntityHolder().getWherePK(this);
|
||||||
}
|
}
|
||||||
@@ -499,7 +499,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
if (!entity.getOnlyPkMaster() && entity.getOperation() == OperationType.SELECT_OBJECT) {
|
if (!entity.getOnlyPkMaster() && entity.getOperation() == OperationType.SELECT_OBJECT) {
|
||||||
where = getEntityHolder().getWhereCondFields(entity);
|
where = getEntityHolder().getWhereCondFields(entity);
|
||||||
} else if (entity.getOldPk() != null) {
|
} else if (entity.getOldPk() != null) {
|
||||||
where = entity.getWhereCondOldPk();
|
where = entity.getWhereCondOldPk(null);
|
||||||
} else {
|
} else {
|
||||||
where = getEntityHolder().getWherePK(entity);
|
where = getEntityHolder().getWherePK(entity);
|
||||||
}
|
}
|
||||||
@@ -525,29 +525,23 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
whereConds = "";
|
whereConds = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
String query;
|
final List<EntityHierarchy.Field> rowEntityFields = getEntityHolder().getEntityFields(rowClass, EntityHierarchy.Field::isSqlField);
|
||||||
|
|
||||||
String wherePK;
|
String wherePK;
|
||||||
|
|
||||||
|
|
||||||
if ((entity.getOperation() == OperationType.SUBSTITUTE || entity.getOperation() == OperationType.DELETE_THEN_INSERT) && entity.getOldPk() != null) {
|
if ((entity.getOperation() == OperationType.SUBSTITUTE || entity.getOperation() == OperationType.DELETE_THEN_INSERT) && entity.getOldPk() != null) {
|
||||||
wherePK = entity.getWhereCondOldPk();
|
wherePK = entity.getWhereCondOldPk(rowClass);
|
||||||
} else {
|
} else {
|
||||||
wherePK = getEntityHolder().getWherePK(entity);
|
wherePK = getEntityHolder().getWherePK(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap fieldToSqlMap = getEntityHolder().getColumnMap(rowClass, true);
|
String columnList = Joiner.on(",")
|
||||||
String columnList = Joiner.on(",").withKeyValueSeparator(" as ").join(fieldToSqlMap);
|
.join(rowEntityFields.stream()
|
||||||
|
.map(x -> x.getSqlField().value())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
query = "SELECT " + columnList + " FROM " + tableName + " WHERE " + wherePK + whereConds;
|
String query = "SELECT " + columnList + " FROM " + tableName + " WHERE " + wherePK + whereConds;
|
||||||
|
|
||||||
PreparedStatement ps = connection.prepareStatement(query);
|
|
||||||
ps.setQueryTimeout(queryTimeoutSeconds);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
ResultSetMapper mapper = new ResultSetMapper();
|
|
||||||
List<EntityBase> entityRows = (List<EntityBase>) mapper.mapResultSetToList(rs, rowClass);
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
|
List<? extends EntityBase> entityRows = UtilityDB.executeSimpleQueryDTO(connection, query, rowClass, queryTimeoutSeconds);
|
||||||
return entityRows;
|
return entityRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,7 +932,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
EntityBase clonedEntity = (EntityBase) deepClone();
|
EntityBase clonedEntity = (EntityBase) deepClone();
|
||||||
clonedEntity.setOnlyPkMaster(false);
|
clonedEntity.setOnlyPkMaster(false);
|
||||||
|
|
||||||
final List<Field> childs = entityHolder.getEntityChildrenFields(getClass());
|
final List<Field> childs = getEntityHolder().getEntityChildrenFields(getClass());
|
||||||
|
|
||||||
for (Field entityChildField : childs) {
|
for (Field entityChildField : childs) {
|
||||||
entityChildField.setAccessible(true);
|
entityChildField.setAccessible(true);
|
||||||
@@ -1562,7 +1556,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
if (getOldPk() != null) {
|
if (getOldPk() != null) {
|
||||||
updateSQL
|
updateSQL
|
||||||
.append(" WHERE ")
|
.append(" WHERE ")
|
||||||
.append(getWhereCondOldPk());
|
.append(getWhereCondOldPk(null));
|
||||||
} else if (!whereCondData.isEmpty()) {
|
} else if (!whereCondData.isEmpty()) {
|
||||||
updateSQL
|
updateSQL
|
||||||
.append(" WHERE ");
|
.append(" WHERE ");
|
||||||
@@ -1611,42 +1605,6 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
|
|
||||||
String a = "";
|
String a = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// OLD
|
|
||||||
|
|
||||||
// List<Field> fields = getEntityHolder().getFields(this.getClass());
|
|
||||||
//
|
|
||||||
// List<String> campi = new ArrayList<>();
|
|
||||||
// List<String> where = new ArrayList<>();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Map<Integer, Object> mapLob = getFieldToUpdate(fields, campi, where);
|
|
||||||
//
|
|
||||||
// if (!campi.isEmpty()) {
|
|
||||||
// String sql = "UPDATE " + getTableName() + " SET " + StringUtils.join(campi, ",");
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (getOldPk() != null) {
|
|
||||||
// whereCond = getWhereCondOldPk();
|
|
||||||
// } else if (whereCond == null || (whereCond.split(" AND ").length != where.size() && !where.isEmpty())) {
|
|
||||||
// whereCond = StringUtils.join(where, " AND ");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// sql += " WHERE " + whereCond;
|
|
||||||
//
|
|
||||||
// logger.trace("Query tracing: {}", sql);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// PreparedStatement pstm = connection.prepareStatement(sql);
|
|
||||||
// setupBinaryParams(mapLob, pstm);
|
|
||||||
//
|
|
||||||
// pstm.setQueryTimeout(queryTimeoutSeconds);
|
|
||||||
// pstm.executeUpdate();
|
|
||||||
// pstm.close();
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// throw new EntityException(e, this, sql);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentPKAndImportFromParent(EntityBase parent, Boolean isChild) throws InvocationTargetException, IllegalAccessException {
|
public void setParentPKAndImportFromParent(EntityBase parent, Boolean isChild) throws InvocationTargetException, IllegalAccessException {
|
||||||
@@ -1794,9 +1752,9 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private String getWhereCondDelete() throws Exception {
|
private String getWhereCondDelete() throws Exception {
|
||||||
Field[] fields = this.getClass().getDeclaredFields();
|
List<EntityHierarchy.Field> fields = getEntityHolder().getEntityFields(this.getClass(), null);
|
||||||
List<String> where = getPkWhereCond(fields, this);
|
List<String> where = getPkWhereCond(this, fields, null);
|
||||||
String whereCondOldPk = getWhereCondOldPk(where);
|
String whereCondOldPk = getWhereCondOldPk(where, null);
|
||||||
String whereCondDel = "";
|
String whereCondDel = "";
|
||||||
if (UtilityString.isNullOrEmpty(whereCondOldPk)) {
|
if (UtilityString.isNullOrEmpty(whereCondOldPk)) {
|
||||||
if (whereCond != null) {
|
if (whereCond != null) {
|
||||||
@@ -1821,8 +1779,8 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public String getPkWhereCond() throws IllegalAccessException {
|
public String getPkWhereCond() throws IllegalAccessException {
|
||||||
Field[] fields = this.getClass().getDeclaredFields();
|
List<EntityHierarchy.Field> fields = getEntityHolder().getEntityFields(this.getClass(), null);
|
||||||
List<String> where = getPkWhereCond(fields, this);
|
List<String> where = getPkWhereCond(this, fields, null);
|
||||||
|
|
||||||
if (whereCond == null) {
|
if (whereCond == null) {
|
||||||
whereCond = StringUtils.join(where, " AND ");
|
whereCond = StringUtils.join(where, " AND ");
|
||||||
@@ -1832,22 +1790,26 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getPkWhereCond(Field[] fields, EntityBase parent) throws IllegalAccessException {
|
private List<String> getPkWhereCond(EntityBase parent, List<EntityHierarchy.Field> fields, Map<String, String> parentToChildMappings) throws IllegalAccessException {
|
||||||
List<String> where = new ArrayList<String>();
|
List<String> where = new ArrayList<>();
|
||||||
|
|
||||||
List<Field> listPK = Stream.of(fields).filter(x -> x.isAnnotationPresent(SqlField.class) && x.isAnnotationPresent(PK.class)).toList();
|
@NotNull List<EntityHierarchy.Field> listPK = fields.stream()
|
||||||
|
.filter(x -> x.isSqlField() && x.isPrimaryKey())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (Field field : listPK) {
|
for (EntityHierarchy.Field field : listPK) {
|
||||||
field.setAccessible(true);
|
SqlField sqlField = field.getSqlField();
|
||||||
SqlField sqlField = field.getAnnotation(SqlField.class);
|
|
||||||
String sqlColumn = SqlFieldHolder.getSqlValue(sqlField.value(), field);
|
|
||||||
|
|
||||||
Object obj = field.get(parent);
|
String customMappingSqlField = parentToChildMappings != null ? parentToChildMappings.getOrDefault(field.getFieldName(), null) : null;
|
||||||
|
|
||||||
|
String sqlColumn = SqlFieldHolder.getSqlValue(UtilityString.isNull(customMappingSqlField, sqlField.value()), field.getField());
|
||||||
|
|
||||||
|
Object obj = field.getField().get(parent);
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
Object dato = SqlFieldHolder.getSqlValueFieldAsString(obj);
|
Object dato = SqlFieldHolder.getSqlValueFieldAsString(obj);
|
||||||
where.add(sqlColumn + " = " + dato);
|
where.add(sqlColumn + " = " + dato);
|
||||||
} else if (this.getOperation() != OperationType.DELETE) {
|
} else if (this.getOperation() != OperationType.DELETE) {
|
||||||
where.add(sqlColumn + " IS null ");
|
where.add(sqlColumn + " IS NULL ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return where;
|
return where;
|
||||||
@@ -1923,37 +1885,54 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public String getWhereCondOldPk() throws IllegalAccessException, IOException, FieldMissingException {
|
public String getWhereCondOldPk(Class<? extends EntityBase> entityRowClass) throws IllegalAccessException, IOException, FieldMissingException {
|
||||||
Field[] fields = this.getClass().getDeclaredFields();
|
Map<String, String> currentEntityToChildSqlMappings = null;
|
||||||
List<String> where = getPkWhereCond(fields, this);
|
if (entityRowClass != null) {
|
||||||
return getWhereCondOldPk(where);
|
final List<EntityHierarchy.Field> rowEntityFields = getEntityHolder().getEntityFields(entityRowClass, EntityHierarchy.Field::isSqlField);
|
||||||
|
|
||||||
|
currentEntityToChildSqlMappings = rowEntityFields.stream()
|
||||||
|
.filter(x -> x.isImportFromParent() &&
|
||||||
|
(x.getImportFromParent().parentEntity() == EntityBase.class ||
|
||||||
|
x.getImportFromParent().parentEntity().equals(this.getClass())))
|
||||||
|
.collect(Collectors.toMap(x -> x.getImportFromParent().value(), x -> x.getSqlField().value()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<EntityHierarchy.Field> currentEntityFields = getEntityHolder().getEntityFields(this.getClass(), null);
|
||||||
|
List<String> where = getPkWhereCond(this, currentEntityFields, currentEntityToChildSqlMappings);
|
||||||
|
|
||||||
|
return getWhereCondOldPk(where, currentEntityToChildSqlMappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getWhereCondOldPk(List<String> where) throws FieldMissingException, IOException {
|
private String getWhereCondOldPk(List<String> where, Map<String, String> parentToChildMappings) throws FieldMissingException, IOException {
|
||||||
Field[] fields = this.getClass().getDeclaredFields();
|
List<EntityHierarchy.Field> fields = getEntityHolder().getEntityFields(this.getClass(), null);
|
||||||
String whereCondOldPk = null;
|
|
||||||
if (this.getOldPk() != null) {
|
if (this.getOldPk() != null) {
|
||||||
Set<Entry<String, Object>> map = this.getOldPk().entrySet();
|
Set<Entry<String, Object>> map = this.getOldPk().entrySet();
|
||||||
|
|
||||||
for (Entry<String, Object> stringObjectEntry : map) {
|
for (Entry<String, Object> stringObjectEntry : map) {
|
||||||
final String campo = stringObjectEntry.getKey();
|
final String campo = stringObjectEntry.getKey();
|
||||||
Optional<Field> fieldOptional = Stream.of(fields).filter(field -> field.getName().equalsIgnoreCase(campo) && field.getAnnotation(SqlField.class) != null).findFirst();
|
java.util.Optional<EntityHierarchy.Field> fieldOptional = fields.stream()
|
||||||
|
.filter(field -> field.getFieldName().equalsIgnoreCase(campo) && field.isSqlField())
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
if (fieldOptional.isEmpty()) {
|
if (fieldOptional.isEmpty()) {
|
||||||
throw new FieldMissingException(campo);
|
throw new FieldMissingException(campo);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String sqlField = SqlFieldHolder.getSqlValue(fieldOptional.get().getAnnotation(SqlField.class).value(), fieldOptional.get());
|
final EntityHierarchy.Field field = fieldOptional.get();
|
||||||
// final String sqlField = fieldOptional.get().getAnnotation(SqlField.class).value();
|
|
||||||
|
|
||||||
Optional<String> matchedField = Stream.of(where).filter(value -> value.toLowerCase().contains(sqlField.toLowerCase())).findFirst();
|
|
||||||
|
|
||||||
if (matchedField.isPresent()) {
|
String customMappingSqlField = parentToChildMappings != null ? parentToChildMappings.getOrDefault(field.getFieldName(), null) : null;
|
||||||
where.remove(matchedField.get());
|
final String sqlField = SqlFieldHolder.getSqlValue(UtilityString.isNull(customMappingSqlField, field.getSqlField().value()), field.getField());
|
||||||
}
|
|
||||||
|
java.util.Optional<String> matchedField = where.stream()
|
||||||
|
.filter(value -> value.toLowerCase().contains(sqlField.toLowerCase()))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
matchedField.ifPresent(where::remove);
|
||||||
|
|
||||||
Object valore = this.getOldPk().get(campo);
|
Object valore = this.getOldPk().get(campo);
|
||||||
if ((fieldOptional.get().getType() == Date.class || fieldOptional.get().getType() == Timestamp.class) && valore instanceof String) {
|
if ((field.getField().getType() == Date.class || field.getField().getType() == Timestamp.class) && valore instanceof String) {
|
||||||
valore = UtilityString.parseDate(valore.toString());
|
valore = UtilityString.parseDate(valore.toString());
|
||||||
}
|
}
|
||||||
Object valueSql = SqlFieldHolder.getSqlValueFieldAsString(valore);
|
Object valueSql = SqlFieldHolder.getSqlValueFieldAsString(valore);
|
||||||
@@ -1961,7 +1940,7 @@ public abstract class EntityBase implements Serializable, Cloneable, EntityInter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
whereCondOldPk = StringUtils.join(where, " AND ");
|
String whereCondOldPk = StringUtils.join(where, " AND ");
|
||||||
|
|
||||||
return whereCondOldPk;
|
return whereCondOldPk;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ public class EntityPropertyHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Field declaredField : declaredFields) {
|
for (Field declaredField : declaredFields) {
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
|
||||||
analyzedFields.add(new EntityHierarchy.Field()
|
analyzedFields.add(new EntityHierarchy.Field()
|
||||||
.setField(declaredField)
|
.setField(declaredField)
|
||||||
.setPrimaryKey(declaredField.getAnnotation(PK.class))
|
.setPrimaryKey(declaredField.getAnnotation(PK.class))
|
||||||
@@ -405,9 +407,9 @@ public class EntityPropertyHolder {
|
|||||||
public String getWherePK(EntityBase entity) throws IllegalAccessException {
|
public String getWherePK(EntityBase entity) throws IllegalAccessException {
|
||||||
List<String> where = new ArrayList<>();
|
List<String> where = new ArrayList<>();
|
||||||
|
|
||||||
List<Field> fieldsPK = Stream.of(entity.getClass().getDeclaredFields())
|
List<Field> fieldsPK = Arrays.stream(entity.getClass().getDeclaredFields())
|
||||||
.filter(y -> y.isAnnotationPresent(SqlField.class) && y.isAnnotationPresent(PK.class))
|
.filter(y -> y.isAnnotationPresent(SqlField.class) && y.isAnnotationPresent(PK.class))
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
boolean pkIdentityNull = false;
|
boolean pkIdentityNull = false;
|
||||||
for (Field field : fieldsPK) {
|
for (Field field : fieldsPK) {
|
||||||
@@ -535,25 +537,6 @@ public class EntityPropertyHolder {
|
|||||||
return StringUtils.join(colList, ", ");
|
return StringUtils.join(colList, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public HashMap<String, String> getColumnMap(Class clazz, Boolean isSql) {
|
|
||||||
|
|
||||||
HashBiMap<Field, String> fieldToSqlMap =
|
|
||||||
(HashBiMap<Field, String>) classMap.get(clazz.getSimpleName());
|
|
||||||
|
|
||||||
HashMap<String, String> columnsMap = new HashMap<String, String>();
|
|
||||||
for (Field field : fieldToSqlMap.keySet()) {
|
|
||||||
String val = fieldToSqlMap.get(field);
|
|
||||||
if (!isSql) {
|
|
||||||
columnsMap.put(field.getName(), val);
|
|
||||||
} else {
|
|
||||||
columnsMap.put(val, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return columnsMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Field getRigaField(Class clazz) {
|
public Field getRigaField(Class clazz) {
|
||||||
List<Field> list = (List<Field>) classMap.get(clazz.getSimpleName() + "_DETAIL_ID");
|
List<Field> list = (List<Field>) classMap.get(clazz.getSimpleName() + "_DETAIL_ID");
|
||||||
|
|||||||
@@ -1672,13 +1672,13 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
|||||||
JrlSchmacDoc jrlSchmacDoc = new JrlSchmacDoc();
|
JrlSchmacDoc jrlSchmacDoc = new JrlSchmacDoc();
|
||||||
jrlSchmacDoc.deleteAllEntities(connection, this);
|
jrlSchmacDoc.deleteAllEntities(connection, this);
|
||||||
String sql = "UPDATE mtb_invent SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null, flag_stato = 1 ";
|
String sql = "UPDATE mtb_invent SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null, flag_stato = 1 ";
|
||||||
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(), false);
|
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(null), false);
|
||||||
connection.createStatement().executeUpdate(sql);
|
connection.createStatement().executeUpdate(sql);
|
||||||
/*for (MtbColt mtbColt : getMtbColt()) {
|
/*for (MtbColt mtbColt : getMtbColt()) {
|
||||||
mtbColt.manageWithParentConnection(connection, mtbColt.getOperation(), dataCompleting, entityHolder);
|
mtbColt.manageWithParentConnection(connection, mtbColt.getOperation(), dataCompleting, entityHolder);
|
||||||
} */
|
} */
|
||||||
sql = "UPDATE mtb_colt SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null ";
|
sql = "UPDATE mtb_colt SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null ";
|
||||||
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(), false);
|
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(null), false);
|
||||||
connection.createStatement().executeUpdate(sql);
|
connection.createStatement().executeUpdate(sql);
|
||||||
if ("S".equals(getGeneraMovCont())) {
|
if ("S".equals(getGeneraMovCont())) {
|
||||||
if (getWhereCond() == null) {
|
if (getWhereCond() == null) {
|
||||||
|
|||||||
@@ -1242,8 +1242,7 @@ public class DocumentService {
|
|||||||
|
|
||||||
public void chkInvioFE() throws Exception {
|
public void chkInvioFE() throws Exception {
|
||||||
|
|
||||||
for (AvailableConnectionsModel model : settingsModel.getAvailableConnections()) {
|
for (AvailableConnectionsModel model : settingsModel.getAvailableConnections(true)) {
|
||||||
if (model.getInternalDb()) {
|
|
||||||
|
|
||||||
DataSource ds = new DataSource();
|
DataSource ds = new DataSource();
|
||||||
ds.initialize(model.getProfileName());
|
ds.initialize(model.getProfileName());
|
||||||
@@ -1303,7 +1302,6 @@ public class DocumentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ds.forceClose();
|
ds.forceClose();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user