Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/1190#discussion_r216728030
--- Diff:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/HBaseDao.java
---
@@ -309,28 +311,28 @@ public void addCommentToAlert(CommentAddRemoveRequest
request, Document latest)
Document newVersion = new Document(latest);
newVersion.getDocument().put(COMMENTS_FIELD, commentsMap);
- update(newVersion, Optional.empty());
+ return update(newVersion, Optional.empty());
}
@Override
@SuppressWarnings("unchecked")
- public void removeCommentFromAlert(CommentAddRemoveRequest request)
+ public Document removeCommentFromAlert(CommentAddRemoveRequest request)
throws IOException {
Document latest = getLatest(request.getGuid(),
request.getSensorType());
- removeCommentFromAlert(request, latest);
+ return removeCommentFromAlert(request, latest);
}
@Override
@SuppressWarnings("unchecked")
- public void removeCommentFromAlert(CommentAddRemoveRequest request,
Document latest)
+ public Document removeCommentFromAlert(CommentAddRemoveRequest request,
Document latest)
throws IOException {
if (latest == null || latest.getDocument() == null) {
throw new IOException("Unable to remove comment document that
doesn't exist");
}
List<Map<String, Object>> commentMap = (List<Map<String, Object>>)
latest.getDocument().get(COMMENTS_FIELD);
// Can't remove anything if there's nothing there
if (commentMap == null) {
- return;
+ return null;
--- End diff --
Should we also treat this as an exceptional condition?
---