diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/reports/EventExecutionReport.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/reports/EventExecutionReport.java index 97b14d0..421ac03 100644 --- a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/reports/EventExecutionReport.java +++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/reports/EventExecutionReport.java @@ -1,16 +1,28 @@ package org.gcube.application.cms.plugins.reports; import lombok.ToString; +import lombok.extern.slf4j.Slf4j; import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException; import org.gcube.application.cms.plugins.requests.EventExecutionRequest; import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation; @ToString(callSuper = true) +@Slf4j public class EventExecutionReport extends DocumentHandlingReport{ public EventExecutionReport(EventExecutionRequest req) throws InvalidPluginRequestException { super(req); - this.setToSetLifecycleInformation(theRequest.getDocument().getLifecycleInformation().cleanState()); + try{ + if(theRequest.getDocument().getLifecycleInformation()!=null) + this.setToSetLifecycleInformation(theRequest.getDocument().getLifecycleInformation().cleanState()); + else theRequest.getDocument().setLifecycleInformation(new LifecycleInformation().cleanState()); + }catch(Throwable t){ + log.warn("Cannot to clean state for lifecycle information {} in {} : {}", + theRequest.getDocument().getLifecycleInformation(), + theRequest.getDocument().getProfileID(), + theRequest.getDocument().getId(), + t); + } this.getToSetLifecycleInformation().setLastOperationStatus(LifecycleInformation.Status.OK); }