Aggiornato client MaxiData
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-09-12 18:21:37 +02:00
parent eaf10604ef
commit c9ee41a1b1
12 changed files with 816 additions and 685 deletions

View File

@@ -363,6 +363,11 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.20</version> <!-- Versione scritta a mano perché qui non hanno usato lo 0 finale -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>

View File

@@ -4,12 +4,13 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import it.integry.common.var.CommonConstants;
import it.integry.ems_model.annotation.*;
import it.integry.ems_model.base.EntityBase;
import org.kie.api.definition.type.PropertyReactive;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
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.Date;
import java.util.List;
@Master
@PropertyReactive
@@ -86,6 +87,13 @@ public class StbGestSetup extends EntityBase {
super(logger);
}
public StbGestSetup(String gestName, String section, String keySection) {
this();
this.gestName = gestName;
this.section = section;
this.keySection = keySection;
}
public String getGestName() {
return gestName;
}

View File

@@ -98,7 +98,7 @@ public class ApiClient extends JavaTimeFormatter {
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
// Set default User-Agent.
setUserAgent("Integry-Rest-Client/1.0.0/java");
setUserAgent("Integry-Java-Client");
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
@@ -720,7 +720,7 @@ public class ApiClient extends JavaTimeFormatter {
protected String buildCookieHeader(MultiValueMap<String, String> cookies) {
final StringBuilder cookieValue = new StringBuilder();
String delimiter = "";
for (final Entry<String, List<String>> entry : cookies.entrySet()) {
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
final String value = entry.getValue().get(entry.getValue().size() - 1);
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
delimiter = "; ";

View File

@@ -0,0 +1,100 @@
/*
* Autenticazione
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: V4-R1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package it.integry.maxidata.client.invoker;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature;
import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
import java.io.IOException;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAccessor;
import java.util.function.BiFunction;
import java.util.function.Function;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0")
public class RFC3339InstantDeserializer<T extends Temporal> extends InstantDeserializer<T> {
private static final long serialVersionUID = 1L;
private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault();
private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
= JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault();
public static final RFC3339InstantDeserializer<Instant> INSTANT = new RFC3339InstantDeserializer<>(
Instant.class, DateTimeFormatter.ISO_INSTANT,
Instant::from,
a -> Instant.ofEpochMilli(a.value),
a -> Instant.ofEpochSecond(a.integer, a.fraction),
null,
true, // yes, replace zero offset with Z
DEFAULT_NORMALIZE_ZONE_ID,
DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
);
public static final RFC3339InstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>(
OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME,
OffsetDateTime::from,
a -> OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId),
a -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId),
(d, z) -> (d.isEqual(OffsetDateTime.MIN) || d.isEqual(OffsetDateTime.MAX) ?
d :
d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()))),
true, // yes, replace zero offset with Z
DEFAULT_NORMALIZE_ZONE_ID,
DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
);
public static final RFC3339InstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new RFC3339InstantDeserializer<>(
ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME,
ZonedDateTime::from,
a -> ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId),
a -> ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId),
ZonedDateTime::withZoneSameInstant,
false, // keep zero offset and Z separate since zones explicitly supported
DEFAULT_NORMALIZE_ZONE_ID,
DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
);
protected RFC3339InstantDeserializer(
Class<T> supportedType,
DateTimeFormatter formatter,
Function<TemporalAccessor, T> parsedToValue,
Function<FromIntegerArguments, T> fromMilliseconds,
Function<FromDecimalArguments, T> fromNanoseconds,
BiFunction<T, ZoneId, T> adjust,
boolean replaceZeroOffsetAsZ,
boolean normalizeZoneId,
boolean readNumericStringsAsTimestamp) {
super(
supportedType,
formatter,
parsedToValue,
fromMilliseconds,
fromNanoseconds,
adjust,
replaceZeroOffsetAsZ,
normalizeZoneId,
readNumericStringsAsTimestamp
);
}
@Override
protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException {
return super._fromString(p, ctxt, string0.replace(' ', 'T'));
}
}

View File

@@ -14,6 +14,10 @@ package it.integry.maxidata.client.invoker;
import com.fasterxml.jackson.databind.module.SimpleModule;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0")
public class RFC3339JavaTimeModule extends SimpleModule {
private static final long serialVersionUID = 1L;
@@ -25,6 +29,10 @@ public class RFC3339JavaTimeModule extends SimpleModule {
@Override
public void setupModule(SetupContext context) {
super.setupModule(context);
addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT);
addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME);
addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME);
}
}

View File

@@ -134,7 +134,7 @@ public class MaxidataCFGBILoginV4BLLLoginType implements Serializable {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
}

View File

@@ -33,174 +33,174 @@ import java.util.Objects;
@JsonTypeName("Maxidata.CFG.BI.Login.v4.BLL.Module_Type")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0")
public class MaxidataCFGBILoginV4BLLModuleType implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
public static final String JSON_PROPERTY_I_D = "ID";
@javax.annotation.Nullable
private String ID;
public static final String JSON_PROPERTY_I_D = "ID";
@javax.annotation.Nullable
private String ID;
public static final String JSON_PROPERTY_GROUP = "Group";
@javax.annotation.Nullable
private String group;
public static final String JSON_PROPERTY_GROUP = "Group";
@javax.annotation.Nullable
private String group;
public static final String JSON_PROPERTY_DESCRIPTION = "Description";
@javax.annotation.Nullable
private String description;
public static final String JSON_PROPERTY_DESCRIPTION = "Description";
@javax.annotation.Nullable
private String description;
public static final String JSON_PROPERTY_VALUE = "Value";
@javax.annotation.Nullable
private Integer value;
public static final String JSON_PROPERTY_VALUE = "Value";
@javax.annotation.Nullable
private Integer value;
public MaxidataCFGBILoginV4BLLModuleType() {
public MaxidataCFGBILoginV4BLLModuleType() {
}
public MaxidataCFGBILoginV4BLLModuleType ID(@javax.annotation.Nullable String ID) {
this.ID = ID;
return this;
}
/**
* Modulo ID
*
* @return ID
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_I_D)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getID() {
return ID;
}
@JsonProperty(JSON_PROPERTY_I_D)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setID(@javax.annotation.Nullable String ID) {
this.ID = ID;
}
public MaxidataCFGBILoginV4BLLModuleType group(@javax.annotation.Nullable String group) {
this.group = group;
return this;
}
/**
* Grouppo
*
* @return group
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_GROUP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getGroup() {
return group;
}
@JsonProperty(JSON_PROPERTY_GROUP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setGroup(@javax.annotation.Nullable String group) {
this.group = group;
}
public MaxidataCFGBILoginV4BLLModuleType description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Descrizione
*
* @return description
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DESCRIPTION)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getDescription() {
return description;
}
@JsonProperty(JSON_PROPERTY_DESCRIPTION)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public MaxidataCFGBILoginV4BLLModuleType value(@javax.annotation.Nullable Integer value) {
this.value = value;
return this;
}
/**
* Valore
*
* @return value
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getValue() {
return value;
}
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setValue(@javax.annotation.Nullable Integer value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
public MaxidataCFGBILoginV4BLLModuleType ID(@javax.annotation.Nullable String ID) {
this.ID = ID;
return this;
if (o == null || getClass() != o.getClass()) {
return false;
}
MaxidataCFGBILoginV4BLLModuleType maxidataCFGBILoginV4BLLModuleType = (MaxidataCFGBILoginV4BLLModuleType) o;
return Objects.equals(this.ID, maxidataCFGBILoginV4BLLModuleType.ID) &&
Objects.equals(this.group, maxidataCFGBILoginV4BLLModuleType.group) &&
Objects.equals(this.description, maxidataCFGBILoginV4BLLModuleType.description) &&
Objects.equals(this.value, maxidataCFGBILoginV4BLLModuleType.value);
}
/**
* Modulo ID
*
* @return ID
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_I_D)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@Override
public int hashCode() {
return Objects.hash(ID, group, description, value);
}
public String getID() {
return ID;
}
@JsonProperty(JSON_PROPERTY_I_D)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setID(@javax.annotation.Nullable String ID) {
this.ID = ID;
}
public MaxidataCFGBILoginV4BLLModuleType group(@javax.annotation.Nullable String group) {
this.group = group;
return this;
}
/**
* Grouppo
*
* @return group
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_GROUP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getGroup() {
return group;
}
@JsonProperty(JSON_PROPERTY_GROUP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setGroup(@javax.annotation.Nullable String group) {
this.group = group;
}
public MaxidataCFGBILoginV4BLLModuleType description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Descrizione
*
* @return description
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DESCRIPTION)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getDescription() {
return description;
}
@JsonProperty(JSON_PROPERTY_DESCRIPTION)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public MaxidataCFGBILoginV4BLLModuleType value(@javax.annotation.Nullable Integer value) {
this.value = value;
return this;
}
/**
* Valore
*
* @return value
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getValue() {
return value;
}
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setValue(@javax.annotation.Nullable Integer value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MaxidataCFGBILoginV4BLLModuleType maxidataCFGBILoginV4BLLModuleType = (MaxidataCFGBILoginV4BLLModuleType) o;
return Objects.equals(this.ID, maxidataCFGBILoginV4BLLModuleType.ID) &&
Objects.equals(this.group, maxidataCFGBILoginV4BLLModuleType.group) &&
Objects.equals(this.description, maxidataCFGBILoginV4BLLModuleType.description) &&
Objects.equals(this.value, maxidataCFGBILoginV4BLLModuleType.value);
}
@Override
public int hashCode() {
return Objects.hash(ID, group, description, value);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class MaxidataCFGBILoginV4BLLModuleType {\n");
sb.append(" ID: ").append(toIndentedString(ID)).append("\n");
sb.append(" group: ").append(toIndentedString(group)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class MaxidataCFGBILoginV4BLLModuleType {\n");
sb.append(" ID: ").append(toIndentedString(ID)).append("\n");
sb.append(" group: ").append(toIndentedString(group)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -231,9 +231,9 @@ public class MaxidataLibrerie2WebServicesRestAPIErrorException implements Serial
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -1,8 +1,13 @@
package it.integry.maxidata.service;
import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.entity.StbGestSetup;
import it.integry.ems_model.types.OperationType;
import it.integry.maxidata.client.api.AutenticazioneApi;
import it.integry.maxidata.client.invoker.ApiClient;
import it.integry.maxidata.client.model.MaxidataCFGBILoginV4BLLLoginType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -12,20 +17,29 @@ public class MaxiDataApiService {
private ApiClient apiClient;
@Autowired
private EntityProcessor entityProcessor;
@PostConstruct
public void init() {
}
public void test() {
public void test(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
this.apiClient = new ApiClient();
this.apiClient.setBasePath("https://bluetech02.maxidata.net/uve2k.blue.SRV1/");
this.apiClient.setDebugging(true);
AutenticazioneApi autenticazioneApi = new AutenticazioneApi(this.apiClient);
final MaxidataCFGBILoginV4BLLLoginType integryLoginResponse =
autenticazioneApi.login("Integry_test", "uve2k.Blue", "Bt02Mes#2025", null, "MAXI.MAXI.LAMON.00001");
autenticazioneApi.login("Integry.Lamonarca",
"uve2k.Blue", "Bt02Mes#2025", null, "MAXI.MAXI.LAMON.00001");
StbGestSetup stbGestSetup = new StbGestSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_JWT_ACCESS_TOKEN")
.setValue(integryLoginResponse.getJwt());
stbGestSetup.setOperation(OperationType.UPDATE);
entityProcessor.processEntity(stbGestSetup, multiDBTransactionManager);
String a = "";

View File

@@ -32,7 +32,7 @@ public class OrdiniMaxiDataImportService {
public List<EntityBase> importProduzioni() throws Exception {
Connection conn = multiDBTransactionManager.getPrimaryConnection();
maxiDataApiService.test();
maxiDataApiService.test(multiDBTransactionManager);
// MaxiDataConfigDataDTO maxiDataConfigDataDTO = retrieveUve2kConfiguration(conn);

View File

@@ -36,7 +36,7 @@
<drools.version>6.4.0.Final</drools.version>
<spring.version>5.3.34</spring.version>
<security.version>5.8.12</security.version>
<jackson.version>2.17.0</jackson.version>
<jackson.version>2.20.0</jackson.version>
<resteasy.version>3.15.6.Final</resteasy.version>
<swagger.version>3.0.0</swagger.version>
<ems.war.name>ems</ems.war.name>