From 4960b50795d017ae118be9e66f6173aac78738da Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 30 Mar 2023 11:34:31 +0200 Subject: [PATCH 1/7] Enabled DEV dependencies --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 976fa89..db482aa 100644 --- a/pom.xml +++ b/pom.xml @@ -23,16 +23,16 @@ https://code-repo.d4science.org/gCubeSystem - 2.0.2 - 2.1.1 - 3.6.3 - [1.0.0,2.0.0-SNAPSHOT) + + + + - - - - + 2.1.0-SNAPSHOT + 2.2.0-SNAPSHOT + 3.7.0-SNAPSHOT + [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT) 1.0.3 -- 2.17.1 From cc84875c2387c9b9ce28ba9f7d635d28e21304c2 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 31 Mar 2023 12:09:06 +0200 Subject: [PATCH 2/7] Bug fixing issue #24902. Added parameter "fileSetPath" to Document --- geoportal-service/CHANGELOG.md | 1 + .../geoportal/service/engine/mongo/ProfiledMongoManager.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/geoportal-service/CHANGELOG.md b/geoportal-service/CHANGELOG.md index f91a6e3..2a8e73b 100644 --- a/geoportal-service/CHANGELOG.md +++ b/geoportal-service/CHANGELOG.md @@ -3,6 +3,7 @@ ## [v1.0.14-SNAPSHOT] - Fixed deploying of multiple versions of the default-lc-managers [#24875] +- Bug fixing the 'deleteFileSet' function [#24902] ## [v1.0.13] - 2023-02-23 - Integrating new facilities and bug fixing released in the Plugins diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java index c1b0e09..2a16725 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java @@ -807,7 +807,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< RegisteredFileSet fs = Serialization.convert(wrapper.getByPath(path).get(0), RegisteredFileSet.class); log.debug("Going to delete {}", fs); - doc = triggerEvent(doc,EventExecutionRequest.Events.ON_DELETE_FILESET,new Document("force",force).append("path",path)); + //Updated by Francesco. See #24902 + doc = triggerEvent(doc,EventExecutionRequest.Events.ON_DELETE_FILESET,new Document("force",force).append("path",path).append("fileSetPath", path)); // Actually delete only if event was ok if(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) { -- 2.17.1 From 42cfe8e600ecb7f75c746f0b4aac100d6cefae3e Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 31 Mar 2023 15:56:40 +0200 Subject: [PATCH 3/7] Only updated the DOC --- .../geoportal/service/rest/ProfiledDocuments.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/ProfiledDocuments.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/ProfiledDocuments.java index fa3dfc3..acaa286 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/ProfiledDocuments.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/ProfiledDocuments.java @@ -124,6 +124,20 @@ public class ProfiledDocuments { }.execute().getResult(); } + + /** + * Delete file set. + * the Authorization must be a VRE token + * + * @param id the id + * @param force the force + * @param path the path must be passed as text in the body + * @return the project + */ + @RequestHeaders({ + @RequestHeader( name = "Authorization", description = "VRE Bearer token, see https://dev.d4science.org/how-to-access-resources"), + @RequestHeader( name = "Content-Type", description = "application/json") + }) @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -- 2.17.1 From cb9ae340340f772d18fc261106dc86a57fc32ee6 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 4 Apr 2023 15:45:57 +0200 Subject: [PATCH 4/7] Trying to fix issue #24902#note-13 --- .../engine/mongo/ProfiledMongoManager.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java index 2a16725..1786db7 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java @@ -809,18 +809,28 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< //Updated by Francesco. See #24902 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 if(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) { // Delete from storage if(fs.getFolderId()!=null) { - log.info("Deleting Fileset Folder ID {} ",fs.getFolderId()); - new WorkspaceManager().deleteItem(fs.getFolderId()); + try { + 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); // Delete from document 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; } -- 2.17.1 From a65c4a86da857e42feece3bd34c9cbebf564b204 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 4 Apr 2023 16:12:43 +0200 Subject: [PATCH 5/7] improved the code catching error on deleting VRE folder ID, see #24902 --- .../service/engine/mongo/ProfiledMongoManager.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java index 1786db7..2735eb6 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java @@ -820,6 +820,13 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< log.info("Deleting Fileset Folder ID {} ",fs.getFolderId()); new WorkspaceManager().deleteItem(fs.getFolderId()); }catch (Exception e) { + //Updated by Francesco. See #24902 + LifecycleInformation info = doc.getLifecycleInformation(); + if(info==null) { + info = new LifecycleInformation(); + } + info.addErrorMessage("Unable to delete the Folder ID "+fs.getFolderId()+" in the VRE Folder"); + info.setLastOperationStatus(LifecycleInformation.Status.WARNING); log.warn("Error on deleting the Folder ID {} in the VRE Folder",fs.getFolderId(), e); } } -- 2.17.1 From 261d8f31c804b3af6531959235279ea2ed4bfa46 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 4 Apr 2023 16:59:13 +0200 Subject: [PATCH 6/7] Fixing 'onDeleteFileSet' calling deIndex (before was index..) --- .../cms/plugins/implementations/Default3PhaseManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java b/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java index 5315e73..80f9bea 100644 --- a/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java +++ b/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java @@ -73,7 +73,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life parameters = getPublicIndexParams(theReport.getTheRequest()); if(parameters!= null) for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest())) - theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest())); + theReport = deIndex(theReport,indexer,getPublicIndexParams(theReport.getTheRequest())); return theReport; } -- 2.17.1 From 7081772f1908cd72d62a2c43c548c4c88f792e26 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 4 Apr 2023 17:05:14 +0200 Subject: [PATCH 7/7] Added comment bug fixing #24902 --- .../cms/plugins/implementations/Default3PhaseManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java b/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java index 80f9bea..be142fe 100644 --- a/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java +++ b/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/Default3PhaseManager.java @@ -71,9 +71,12 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life parameters =getInternalIndexParams(theReport.getTheRequest()); if(phase.equals(Phases.PUBLISHED)) parameters = getPublicIndexParams(theReport.getTheRequest()); - if(parameters!= null) - for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest())) + if(parameters!= null) { + //Fixed by Francesco, see #24902. Now is calling deIndex + for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest())) { theReport = deIndex(theReport,indexer,getPublicIndexParams(theReport.getTheRequest())); + } + } return theReport; } -- 2.17.1