Finish Hotfix-61
This commit is contained in:
@@ -373,7 +373,7 @@ public class EmsServices {
|
||||
if (tmpResult != null) {
|
||||
finalResult.addAll(tmpResult);
|
||||
anyError = Stream.of(tmpResult)
|
||||
.filter(x-> x !=null)
|
||||
.filter(x -> x != null)
|
||||
.anyMatch(x -> x.getException() != null);
|
||||
}
|
||||
|
||||
@@ -479,14 +479,8 @@ public class EmsServices {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (headless) {
|
||||
List<EntityBase> entityBases = new ArrayList<EntityBase>();
|
||||
EntityBase entityBase = new EntityBase() {
|
||||
};
|
||||
EntityException newEx = new EntityException(ex.getMessage());
|
||||
newEx.setStackTrace(ex.getStackTrace());
|
||||
entityBase.setException(newEx);
|
||||
entityBases.add(entityBase);
|
||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, "EXPORT_" + type, format, "Esportazione entity", entityBases, null, null, null);
|
||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, "EXPORT_" + type, format,
|
||||
"Esportazione entity", null, null, null, Collections.singletonList(ex));
|
||||
throw ex;
|
||||
} else {
|
||||
throw ex;
|
||||
|
||||
@@ -275,12 +275,11 @@ public class MailService {
|
||||
}
|
||||
|
||||
|
||||
public void sendErrorMailByGestNameSection(MultiDBTransactionManager multiDBTransactionManager, String emailDestination, String gestName, String section,
|
||||
String mailTitle, List<EntityBase> entitiesList, byte[] fileInput, String fileName, List<AnomalieDTO> anomalie) throws Exception {
|
||||
public void sendErrorMailByGestNameSection(MultiDBTransactionManager multiDBTransactionManager, String gestName, String section,
|
||||
String mailTitle, List<EntityBase> entitiesList, List<EmailFileAttachment> attachments, List<AnomalieDTO> anomalie, List<Exception> customExceptions) throws Exception {
|
||||
|
||||
|
||||
List<EmailFileAttachment> attachments = new ArrayList<>();
|
||||
attachments.add(new EmailFileAttachment(fileName, fileInput));
|
||||
// GET DESTINATION
|
||||
String emailDestination = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), gestName, section, "EMAIL_FOR_LOG");
|
||||
|
||||
sendErrorMail(multiDBTransactionManager, emailDestination,
|
||||
mailTitle,
|
||||
@@ -288,7 +287,7 @@ public class MailService {
|
||||
entitiesList,
|
||||
attachments,
|
||||
anomalie,
|
||||
null);
|
||||
customExceptions);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@ public class EntityException extends Exception {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public EntityException(Exception innerException) {
|
||||
super(innerException.getMessage());
|
||||
|
||||
this.mInnerException = innerException;
|
||||
}
|
||||
|
||||
public EntityException(Exception e, EntityBase entity, String query) {
|
||||
super("Impossibile salvare la entity " + entity.getTableName() + ".\n " +
|
||||
e.getMessage() + "\n" +
|
||||
|
||||
@@ -126,7 +126,7 @@ public class TrasformaPrevServices {
|
||||
if (headless) {
|
||||
logger.error("Trasformazione preventivi: ", firstError.get().getException());
|
||||
try {
|
||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, to, gestName, section, "Trasformazione preventivi",
|
||||
mailService.sendErrorMail(multiDBTransactionManager, to, "Trasformazione preventivi", String.format("%s %s", gestName, section),
|
||||
Collections.singletonList(firstError.get()), null, null, null);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -237,7 +237,7 @@ public class Slim2kLogisticService {
|
||||
respList.add(new ServiceRestResponse(EsitoType.KO, entity.getException().getMessage()));
|
||||
|
||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, type, format, null,
|
||||
Collections.singletonList(entity), null, null, null);
|
||||
Collections.singletonList(entity), (byte[]) null, null, null);
|
||||
} else {
|
||||
respList.add(new ServiceRestResponse(EsitoType.OK, entity, multiDBTransactionManager.getPrimaryDatasource().getProfile()));
|
||||
}
|
||||
@@ -498,7 +498,7 @@ public class Slim2kLogisticService {
|
||||
|
||||
if (!entitiesWithErrors.isEmpty()) {
|
||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, type, format, null,
|
||||
entitiesWithErrors, null, null, null);
|
||||
entitiesWithErrors, (byte[]) null, null, null);
|
||||
}
|
||||
|
||||
for (EntityBase entity : colli) {
|
||||
|
||||
Reference in New Issue
Block a user