Trying to fix issue #24902#note-13

This commit is contained in:
Francesco Mangiacrapa 2023-04-04 15:45:57 +02:00
parent 42cfe8e600
commit cb9ae34034
1 changed files with 13 additions and 3 deletions

View File

@ -809,18 +809,28 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
//Updated by Francesco. See #24902 //Updated by Francesco. See #24902
doc = triggerEvent(doc,EventExecutionRequest.Events.ON_DELETE_FILESET,new Document("force",force).append("path",path).append("fileSetPath", path)); doc = triggerEvent(doc,EventExecutionRequest.Events.ON_DELETE_FILESET,new Document("force",force).append("path",path).append("fileSetPath", path));
//reloading the document in the wrapper
wrapper = new JSONPathWrapper(doc.getTheDocument().toJson());
// Actually delete only if event was ok // Actually delete only if event was ok
if(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) { if(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) {
// Delete from storage // Delete from storage
if(fs.getFolderId()!=null) { if(fs.getFolderId()!=null) {
log.info("Deleting Fileset Folder ID {} ",fs.getFolderId()); try {
new WorkspaceManager().deleteItem(fs.getFolderId()); log.info("Deleting Fileset Folder ID {} ",fs.getFolderId());
new WorkspaceManager().deleteItem(fs.getFolderId());
}catch (Exception e) {
log.warn("Error on deleting the Folder ID {} in the VRE Folder",fs.getFolderId(), e);
}
} }
log.debug("Removing FS from document [ID : ] by path {}", doc.getId(), path); log.debug("Removing FS from document [ID : ] by path {}", doc.getId(), path);
// Delete from document // Delete from document
wrapper.setElement(path, null); wrapper.setElement(path, null);
} }
//Updated by Francesco. See #24902
log.debug("Setting result on profiled document");
doc.setTheDocument(Document.parse(wrapper.getValueCTX().jsonString()));
return doc; return doc;
} }