updated send notification checks
This commit is contained in:
parent
bab16ad14d
commit
3913019df3
|
@ -24,6 +24,8 @@ import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
|||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.document.access.Access;
|
||||
import org.gcube.application.geoportal.common.model.document.accounting.AccountingInfo;
|
||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation.Status;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
||||
|
@ -115,6 +117,9 @@ public class ProfiledDocuments {
|
|||
}
|
||||
}.execute().getResult();
|
||||
|
||||
Status status = theNewProject.getLifecycleInformation().getLastOperationStatus();
|
||||
// IF last operation status is not ERROR, notify PROJECT_CREATED event
|
||||
if (status != null && !status.equals(LifecycleInformation.Status.ERROR)) {
|
||||
// notifying the Event.PROJECT_CREATED;
|
||||
ItemObserved<Project> item = new ItemObserved<Project>();
|
||||
EventManager.Event event = Event.PROJECT_CREATED;
|
||||
|
@ -125,6 +130,7 @@ public class ProfiledDocuments {
|
|||
item.setProject(theNewProject);
|
||||
log.info("By notifying event ({}, ID {})", event, item.getProjectId());
|
||||
eventManager.notify(event, item);
|
||||
}
|
||||
|
||||
return theNewProject;
|
||||
}
|
||||
|
@ -149,6 +155,10 @@ public class ProfiledDocuments {
|
|||
}
|
||||
}.execute().getResult();
|
||||
|
||||
Status status = theUpdatedProject.getLifecycleInformation().getLastOperationStatus();
|
||||
// IF last operation status is not ERROR, notify PROJECT_UPDATED event
|
||||
if (status != null && !status.equals(LifecycleInformation.Status.ERROR)) {
|
||||
|
||||
ItemObserved<Project> item = new ItemObserved<Project>();
|
||||
EventManager.Event event = Event.PROJECT_UPDATED;
|
||||
AccountingInfo user = UserUtils.getCurrent().asInfo();
|
||||
|
@ -158,6 +168,7 @@ public class ProfiledDocuments {
|
|||
item.setProject(theUpdatedProject);
|
||||
log.info("By notifying event ({}, ID {})", event, item.getProjectId());
|
||||
eventManager.notify(event, item);
|
||||
}
|
||||
|
||||
return theUpdatedProject;
|
||||
}
|
||||
|
@ -206,6 +217,8 @@ public class ProfiledDocuments {
|
|||
}
|
||||
}.execute().getResult();
|
||||
|
||||
// IF deleted, notify PROJECT_DELETED event
|
||||
if (deleted) {
|
||||
ItemObserved<Project> item = new ItemObserved<Project>();
|
||||
EventManager.Event event = Event.PROJECT_DELETED;
|
||||
AccountingInfo user = UserUtils.getCurrent().asInfo();
|
||||
|
@ -219,6 +232,7 @@ public class ProfiledDocuments {
|
|||
item.setProject(deletedProject);
|
||||
log.info("By notifying event ({}, ID {})", event, item.getProjectId());
|
||||
eventManager.notify(event, item);
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
@ -298,6 +312,9 @@ public class ProfiledDocuments {
|
|||
}
|
||||
}.execute().getResult();
|
||||
|
||||
Status status = theProject.getLifecycleInformation().getLastOperationStatus();
|
||||
// IF last operation status is not ERROR, notify LIFECYCLE_STEP_PERFORMED event
|
||||
if (status != null && !status.equals(LifecycleInformation.Status.ERROR)) {
|
||||
ItemObserved<Project> item = new ItemObserved<Project>();
|
||||
EventManager.Event event = Event.LIFECYCLE_STEP_PERFORMED;
|
||||
AccountingInfo user = UserUtils.getCurrent().asInfo();
|
||||
|
@ -307,6 +324,7 @@ public class ProfiledDocuments {
|
|||
item.setProject(theProject);
|
||||
log.info("By notifying event ({}, ID {})", event, item.getProjectId());
|
||||
eventManager.notify(event, item);
|
||||
}
|
||||
|
||||
return theProject;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue