Finish Hotfix-1
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:
@@ -148,12 +148,13 @@ public class HttpRestWrapper {
|
||||
}
|
||||
|
||||
public static int callGeneric(String url, String username, String password, String jsonBody, ContentType contentType, StringBuilder bodyResponse) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
return callGeneric(url, username, password, jsonBody, contentType, bodyResponse, null,0);
|
||||
return callGeneric(url, username, password, jsonBody, contentType, bodyResponse, null, 0);
|
||||
}
|
||||
|
||||
public static int callGeneric(String url, String username, String password, String jsonBody, ContentType contentType, StringBuilder bodyResponse, HashMap<String, String> queryParams) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
return callGeneric(url, username, password, jsonBody, contentType, bodyResponse, queryParams, RequestMethod.POST, 0);
|
||||
}
|
||||
|
||||
public static int callGeneric(String url, String username, String password, String jsonBody, ContentType contentType, StringBuilder bodyResponse, HashMap<String, String> queryParams, Integer timeout) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
return callGeneric(url, username, password, jsonBody, contentType, bodyResponse, queryParams, RequestMethod.POST, timeout);
|
||||
}
|
||||
@@ -244,28 +245,43 @@ public class HttpRestWrapper {
|
||||
final WebTarget resource = client.target(endPoint)
|
||||
.path(EmsRestConstants.PATH_EXPORT);
|
||||
|
||||
Response response = resource
|
||||
|
||||
// Serializza l'entity usando jsonObjectMapper se necessario
|
||||
Entity<?> serializedEntity = entity;
|
||||
if (entity != null && entity.getEntity() != null) {
|
||||
try {
|
||||
String jsonBody = jsonObjectMapper.writeValueAsString(entity.getEntity());
|
||||
serializedEntity = Entity.json(jsonBody);
|
||||
} catch (Exception e) {
|
||||
// Se la serializzazione fallisce, usa l'entity originale
|
||||
serializedEntity = entity;
|
||||
}
|
||||
}
|
||||
|
||||
try (Response response = resource
|
||||
.queryParam(CommonConstants.PROFILE_DB, profileDb)
|
||||
.queryParam(EmsRestConstants.TYPE, type)
|
||||
.queryParam(EmsRestConstants.FORMAT, format)
|
||||
.request()
|
||||
//.header("Authorization", "Basic " + auth)
|
||||
.header("username", username)
|
||||
.post(entity);
|
||||
.post(serializedEntity)) {
|
||||
|
||||
int status = response.getStatus();
|
||||
int status = response.getStatus();
|
||||
|
||||
if(status != 200)
|
||||
throw new InternalRestCallException(status);
|
||||
if (status != 200)
|
||||
throw new InternalRestCallException(status);
|
||||
|
||||
String stringResponse = response.readEntity(String.class);
|
||||
String stringResponse = response.readEntity(String.class);
|
||||
|
||||
final ServiceRestResponse serviceRestResponse = jsonObjectMapper.readValue(stringResponse, ServiceRestResponse.class);
|
||||
final ServiceRestResponse serviceRestResponse = jsonObjectMapper.readValue(stringResponse, ServiceRestResponse.class);
|
||||
|
||||
if (serviceRestResponse.getEsito() == EsitoType.OK || serviceRestResponse.getEsito() == EsitoType.WARNING) {
|
||||
return serviceRestResponse.getJsonObject();
|
||||
} else {
|
||||
throw new ExportException(serviceRestResponse.getErrorMessage());
|
||||
|
||||
if (serviceRestResponse.getEsito() == EsitoType.OK || serviceRestResponse.getEsito() == EsitoType.WARNING) {
|
||||
return serviceRestResponse.getJsonObject();
|
||||
} else {
|
||||
throw new ExportException(serviceRestResponse.getErrorMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,8 +315,9 @@ public class HttpRestWrapper {
|
||||
|
||||
|
||||
private static Client makeDefaultConfig() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
return makeDefaultConfig(0);
|
||||
return makeDefaultConfig(0);
|
||||
}
|
||||
|
||||
private static Client makeDefaultConfig(Integer timeout) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
|
||||
@@ -23,10 +23,7 @@ import it.integry.ems_model.entity.NtbVariazioniExportLog;
|
||||
import it.integry.ems_model.entity.WtbUsersInfo;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.entity.ContentType;
|
||||
@@ -203,8 +200,9 @@ public class VariazioniPvExportServices {
|
||||
UtilityFile.directoryCreate(pathFile);
|
||||
}
|
||||
}
|
||||
String fileName = new SimpleDateFormat("yyyyMMdd").format(variazioniPvDTO.getDataValidita()) + "-" +
|
||||
new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + suffix;
|
||||
|
||||
String fileName = UtilityLocalDate.formatDate(variazioniPvDTO.getDataValidita(), "yyyyMMdd") + "-" +
|
||||
UtilityLocalDate.formatDate(UtilityLocalDate.getNowTime(), "yyyyMMddHHmmss") + suffix;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(wtbUsersInfo.getFileName())) {
|
||||
fileName = UtilityString.replaceSubString(wtbUsersInfo.getFileName(), "%", fileName);
|
||||
|
||||
Reference in New Issue
Block a user