Remove use of deprecated jackson operations
Change-Id: I6bfe7a2934c8378951acfe8dca5f77189a9f5119
diff --git a/src/main/java/de/ids_mannheim/korap/KrillMeta.java b/src/main/java/de/ids_mannheim/korap/KrillMeta.java
index dbd814f..b1636fb 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillMeta.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillMeta.java
@@ -404,14 +404,14 @@
json.put("timeout", this.getTimeOut());
// Add context attribute
- json.put("context", this.getContext().toJsonNode());
+ json.set("context", this.getContext().toJsonNode());
// Add fields attribute
ArrayNode fieldNode = mapper.createArrayNode();
Iterator<String> field = this.fields.iterator();
while (field.hasNext())
fieldNode.add(field.next());
- json.put("fields", fieldNode);
+ json.set("fields", fieldNode);
// Add itemsPerResource attribute
if (this.itemsPerResource > 0)
@@ -421,7 +421,7 @@
if (!this.highlights.isEmpty()) {
ArrayNode highlightNode = mapper.createArrayNode();
highlightNode.addPOJO(this.highlights);
- json.put("highlight", highlightNode);
+ json.set("highlight", highlightNode);
};
return json;
diff --git a/src/main/java/de/ids_mannheim/korap/KrillQuery.java b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
index 6729521..2746c35 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
@@ -323,12 +323,12 @@
JsonNode wrap = json.get("wrap");
JsonNode attrNode = json.get("attr");
if (wrap.has("foundry")) {
- ((ObjectNode)attrNode).put("foundry", wrap.get("foundry"));
+ ((ObjectNode)attrNode).set("foundry", wrap.get("foundry"));
};
if (wrap.has("layer")) {
- ((ObjectNode)attrNode).put("layer", wrap.get("layer"));
+ ((ObjectNode)attrNode).set("layer", wrap.get("layer"));
};
- ((ObjectNode)json.get("wrap")).put("attr",attrNode);
+ ((ObjectNode)json.get("wrap")).set("attr",attrNode);
};
// Get wrapped token
@@ -352,12 +352,12 @@
JsonNode wrap = json.get("wrap");
JsonNode attrNode = json.get("attr");
if (wrap.has("foundry")) {
- ((ObjectNode)attrNode).put("foundry", wrap.get("foundry"));
+ ((ObjectNode)attrNode).set("foundry", wrap.get("foundry"));
};
if (wrap.has("layer")) {
- ((ObjectNode)attrNode).put("layer", wrap.get("layer"));
+ ((ObjectNode)attrNode).set("layer", wrap.get("layer"));
};
- ((ObjectNode)json.get("wrap")).put("attr",attrNode);
+ ((ObjectNode)json.get("wrap")).set("attr",attrNode);
};
// This is an ugly hack
diff --git a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
index 3ab8aef..b0d5be7 100644
--- a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
@@ -447,7 +447,7 @@
@Override
public JsonNode toJsonNode () {
ObjectNode json = (ObjectNode) super.toJsonNode();
- json.putAll((ObjectNode) mapper.valueToTree(this));
+ json.setAll((ObjectNode) mapper.valueToTree(this));
if (this.getUID() == 0)
json.remove("UID");
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index 7a0df8a..0e5dde6 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -2126,7 +2126,7 @@
ObjectNode json = (ObjectNode) super.toJsonNode();
if (this.context != null)
- json.put("context", this.getContext().toJsonNode());
+ json.set("context", this.getContext().toJsonNode());
if (this.version != null)
json.put("version", this.getVersion());
@@ -2137,14 +2137,14 @@
if (this.endPage != -1 && this.endPage != this.startPage)
pages.add(this.endPage);
- json.put("pages", pages);
+ json.set("pages", pages);
};
if (this.hasSnippet)
json.put("snippet", this.getSnippetHTML());
if (this.hasTokens)
- json.put("tokens", this.getSnippetTokens());
+ json.set("tokens", this.getSnippetTokens());
return json;
};
diff --git a/src/main/java/de/ids_mannheim/korap/response/Notifications.java b/src/main/java/de/ids_mannheim/korap/response/Notifications.java
index 722dc6e..542d869 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Notifications.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Notifications.java
@@ -492,11 +492,11 @@
// Add messages
if (this.hasWarnings())
- json.put("warnings", this.getWarnings().toJsonNode());
+ json.set("warnings", this.getWarnings().toJsonNode());
if (this.hasErrors())
- json.put("errors", this.getErrors().toJsonNode());
+ json.set("errors", this.getErrors().toJsonNode());
if (this.hasMessages())
- json.put("messages", this.getMessages().toJsonNode());
+ json.set("messages", this.getMessages().toJsonNode());
return (JsonNode) json;
};
diff --git a/src/main/java/de/ids_mannheim/korap/response/Response.java b/src/main/java/de/ids_mannheim/korap/response/Response.java
index 55a97eb..46c51c1 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Response.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Response.java
@@ -512,7 +512,7 @@
if (this.meta != null) {
JsonNode metaNode = this.meta.toJsonNode();
if (metaNode != null)
- json.put("meta", metaNode);
+ json.set("meta", metaNode);
};
ObjectNode meta = json.has("meta") ? (ObjectNode) json.get("meta")
@@ -543,14 +543,14 @@
// Add json fields as passed to the object
if (this.jsonFields != null) {
- json.putAll(this.jsonFields);
+ json.setAll(this.jsonFields);
};
// KoralQuery query object
if (this.query != null) {
JsonNode queryNode = this.getQuery().toJsonNode();
if (queryNode != null)
- json.put("query", queryNode);
+ json.set("query", queryNode);
};
// KoralQuery collection object
@@ -558,7 +558,7 @@
// && this.collection.getFilters().toArray().length > 0) {
JsonNode collNode = this.collection.toJsonNode();
if (collNode != null)
- json.put("collection", collNode);
+ json.set("collection", collNode);
};
return (JsonNode) json;
diff --git a/src/main/java/de/ids_mannheim/korap/response/Result.java b/src/main/java/de/ids_mannheim/korap/response/Result.java
index 873f137..e478fdf 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Result.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Result.java
@@ -360,10 +360,10 @@
meta.put("itemsPerPage", this.itemsPerPage);
if (json.has("meta")) {
- ((ObjectNode) json.get("meta")).putAll(meta);
+ ((ObjectNode) json.get("meta")).setAll(meta);
}
else {
- json.put("meta", meta);
+ json.set("meta", meta);
};
};
};
diff --git a/src/main/java/de/ids_mannheim/korap/response/SearchContext.java b/src/main/java/de/ids_mannheim/korap/response/SearchContext.java
index 092cd67..ab38b41 100644
--- a/src/main/java/de/ids_mannheim/korap/response/SearchContext.java
+++ b/src/main/java/de/ids_mannheim/korap/response/SearchContext.java
@@ -161,8 +161,8 @@
rightContext.add(this.right.getLength());
ObjectNode context = mapper.createObjectNode();
- context.put("left", leftContext);
- context.put("right", rightContext);
+ context.set("left", leftContext);
+ context.set("right", rightContext);
return context;
};