Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Resolution input now supports an optional "ids" field to start the jo…
…b by document _id(s) by index. In the first iteration of a job, documents are fetched by _id(s) by index and the attributes of those documents are acquired. Any _id supplied to "ids" is assumed to be representative of the entity. Jobs must have either or both of "ids" and "attributes" to run.
- Loading branch information
Showing
with
375 additions
and 42 deletions.
- +18 −0 src/main/java/io/zentity/common/Json.java
- +32 −25 src/main/java/io/zentity/resolution/Job.java
- +56 −5 src/main/java/io/zentity/resolution/input/Input.java
- +1 −3 src/main/java/org/elasticsearch/plugin/zentity/ResolutionAction.java
- +98 −3 src/test/java/io/zentity/resolution/JobIT.java
- +170 −6 src/test/java/org/elasticsearch/plugin/zentity/ResolutionActionTest.java
@@ -1,11 +1,29 @@ | ||
package io.zentity.common; | ||
|
||
import com.fasterxml.jackson.core.io.JsonStringEncoder; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
|
||
public class Json { | ||
|
||
public static final ObjectMapper MAPPER = new ObjectMapper(); | ||
public static final ObjectMapper ORDERED_MAPPER = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); | ||
private static final JsonStringEncoder STRING_ENCODER = new JsonStringEncoder(); | ||
|
||
public static String quoteString(String value) { | ||
return jsonStringFormat(value); | ||
} | ||
|
||
private static String jsonStringEscape(String value) { | ||
return new String(STRING_ENCODER.quoteAsString(value)); | ||
} | ||
|
||
private static String jsonStringQuote(String value) { | ||
return "\"" + value + "\""; | ||
} | ||
|
||
private static String jsonStringFormat(String value) { | ||
return jsonStringQuote(jsonStringEscape(value)); | ||
} | ||
|
||
} |
Oops, something went wrong.