From 4b5d5a082f74c94df04cf5f992e9b7446e0af34f Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Wed, 6 Oct 2021 16:54:59 +0200 Subject: [PATCH] improved the logs --- .../ConvertToDataViewModel.java | 60 ++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataViewModel.java b/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataViewModel.java index 9ab6128..a19bb6e 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataViewModel.java +++ b/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataViewModel.java @@ -62,11 +62,15 @@ public class ConvertToDataViewModel { * @throws Exception the exception */ public static ConcessioneDV toConcessione(Concessione concessione) throws Exception { - LOG.debug("called toConcessione for: " + concessione); + LOG.debug("toConcessione called"); if (concessione == null) return null; + LOG.debug("toConcessione called for concessione with mongoId: " + concessione.getMongo_id()); + if (LOG.isTraceEnabled()) + LOG.trace("Source concessione is: " + concessione); + try { ConcessioneDV theConcessione = new ConcessioneDV(); @@ -141,7 +145,11 @@ public class ConvertToDataViewModel { theConcessione.setPosizionamentoScavo(thePosizScavo); } - LOG.debug("Returning concessione: " + theConcessione); + LOG.debug("Returning concessioneDV with id: " + theConcessione.getItemId()); + + if (LOG.isTraceEnabled()) + LOG.trace("Returning: " + theConcessione); + return theConcessione; } catch (Exception e) { LOG.error("Error on converting concessione: " + concessione, e); @@ -160,11 +168,16 @@ public class ConvertToDataViewModel { */ public static ConcessioneDV toMetadataConcessione(Concessione concessione, boolean includeValidationReport) throws Exception { - LOG.debug("called toConcessione for: " + concessione); + LOG.debug("toMetadataConcessione called"); if (concessione == null) return null; + LOG.debug("toMetadataConcessione called for concessione with [mongoId: " + concessione.getMongo_id() + + ", includeValidationReport: " + includeValidationReport + "]"); + if (LOG.isTraceEnabled()) + LOG.trace("Source concessione is: " + concessione); + try { ConcessioneDV theConcessione = new ConcessioneDV(); @@ -202,7 +215,11 @@ public class ConvertToDataViewModel { theConcessione.setValidationStatus(theConcessione.getValidationReport().getStatus()); } - LOG.debug("Returning base concessione: " + theConcessione); + LOG.info("Returning concessioneDV with id: " + theConcessione.getItemId()); + + if (LOG.isTraceEnabled()) + LOG.trace("Returning: " + theConcessione); + return theConcessione; } catch (Exception e) { LOG.error("Error on converting concessione: " + concessione, e); @@ -219,17 +236,20 @@ public class ConvertToDataViewModel { * @throws Exception the exception */ public static ValidationReportDV toValidationReport(ValidationReport validationReport) throws Exception { - LOG.debug("called toValidationReport for: " + validationReport); + LOG.debug("toValidationReport called"); if (validationReport == null) return null; - + + LOG.debug("toValidationReport called for: "+validationReport); + ValidationReportDV theVR = new ValidationReportDV(); theVR.setErrorMessages(validationReport.getErrorMessages()); theVR.setObjectName(validationReport.getObjectName()); theVR.setStatus(ValidationStatus.valueOf(validationReport.getStatus().name())); theVR.setWarningMessages(validationReport.getWarningMessages()); theVR.setAsJSONString(toJSON(validationReport)); + LOG.debug("Returning: "+theVR); return theVR; } @@ -241,10 +261,14 @@ public class ConvertToDataViewModel { * @throws Exception the exception */ public static BaseConcessioneDV toBaseConcessione(Concessione concessione) throws Exception { - LOG.debug("called toBaseConcessione for: " + concessione); + LOG.debug("toBaseConcessione called"); if (concessione == null) return null; + + LOG.debug("toBaseConcessione called for concessione with mongoId: " + concessione.getMongo_id()); + if (LOG.isTraceEnabled()) + LOG.trace("Source concessione is: " + concessione); try { @@ -262,7 +286,11 @@ public class ConvertToDataViewModel { theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser())); theConcessione.setLicenzaID(concessione.getLicenzaID()); - LOG.debug("Returning base concessione: " + theConcessione); + LOG.debug("Returning BaseConcessioneDV with id: " + theConcessione.getItemId()); + + if (LOG.isTraceEnabled()) + LOG.trace("Returning: " + theConcessione); + return theConcessione; } catch (Exception e) { LOG.error("Error on converting concessione: " + concessione, e); @@ -342,7 +370,8 @@ public class ConvertToDataViewModel { * @return the abstract relazione scavo DV */ public static AbstractRelazioneScavoDV toAbstractRelazioneScavo(AbstractRelazione abstractRelazione) { - + LOG.debug("toAbstractRelazioneScavo called"); + if (abstractRelazione == null) return null; @@ -379,7 +408,8 @@ public class ConvertToDataViewModel { * @return the relazione scavo data view */ public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo) { - + LOG.debug("toRelazioneScavo called"); + if (relazioneScavo == null) return null; @@ -416,7 +446,8 @@ public class ConvertToDataViewModel { * @return the uploaded image data-view */ public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage) { - + LOG.debug("toUploadedImage called"); + if (uploadedImage == null) return null; @@ -455,6 +486,8 @@ public class ConvertToDataViewModel { * @return the workspace content DV */ public static WorkspaceContentDV toWorkspaceContent(WorkspaceContent wContent) { + LOG.debug("toWorkspaceContent called"); + if (wContent == null) return null; @@ -566,10 +599,9 @@ public class ConvertToDataViewModel { } public static FileSetPathsDV getFileSetPaths() { - - FileSetPathsDV fsp = new FileSetPathsDV(); - LOG.info("readFileSetPaths called"); + + FileSetPathsDV fsp = new FileSetPathsDV(); List fileSetPaths = new ArrayList(); fileSetPaths.add(Concessione.Paths.ABSTRACT_RELAZIONE); fileSetPaths.add(Concessione.Paths.RELAZIONE);