Fixing deleteFileSetRoutine
This commit is contained in:
parent
f0488d5c73
commit
a8b14a911b
|
@ -1243,8 +1243,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
JSONPathWrapper wrapper = new JSONPathWrapper(doc.getTheDocument().toJson());
|
JSONPathWrapper wrapper = new JSONPathWrapper(doc.getTheDocument().toJson());
|
||||||
List<String> matchingPaths = wrapper.getMatchingPaths(path);
|
List<String> matchingPaths = wrapper.getMatchingPaths(path);
|
||||||
|
|
||||||
log.info("matchingPaths is: "+matchingPaths);
|
log.info("matchingPaths is: " + matchingPaths);
|
||||||
|
|
||||||
String error = null;
|
String error = null;
|
||||||
if (matchingPaths.isEmpty()) {
|
if (matchingPaths.isEmpty()) {
|
||||||
error = "No Registered FileSet found at " + path;
|
error = "No Registered FileSet found at " + path;
|
||||||
|
@ -1263,8 +1263,22 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisteredFileSet fs = Serialization.convert(wrapper.getByPath(path).get(0), RegisteredFileSet.class);
|
// Updated by Francesco
|
||||||
log.debug("Going to delete {}", fs);
|
RegisteredFileSet fs = null;
|
||||||
|
try {
|
||||||
|
List<Object> deleteList = wrapper.getByPath(path);
|
||||||
|
if (deleteList == null || deleteList.isEmpty()) {
|
||||||
|
log.info("List of object going to delete is null or empty, retuning input doc");
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object toFileSet = deleteList.get(0); // expected one
|
||||||
|
fs = Serialization.convert(toFileSet, RegisteredFileSet.class);
|
||||||
|
log.info("Going to delete {}", fs);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Error on getting the RegisteredFileSet for path {}", path);
|
||||||
|
log.debug("Error is: ", e);
|
||||||
|
}
|
||||||
|
|
||||||
// Updated by Francesco. See #24902
|
// Updated by Francesco. See #24902
|
||||||
doc = triggerEvent(doc, EventExecutionRequest.Events.ON_DELETE_FILESET,
|
doc = triggerEvent(doc, EventExecutionRequest.Events.ON_DELETE_FILESET,
|
||||||
|
|
Loading…
Reference in New Issue