Jackson deserialization for ReconMatchSpecificTopicOperation
This commit is contained in:
parent
fb584e0b5f
commit
08c2b8fb2b
@ -37,7 +37,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@ -58,6 +57,7 @@ import com.google.refine.model.Row;
|
|||||||
import com.google.refine.model.changes.CellChange;
|
import com.google.refine.model.changes.CellChange;
|
||||||
import com.google.refine.model.changes.ReconChange;
|
import com.google.refine.model.changes.ReconChange;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconMatchSpecificTopicOperation extends EngineDependentMassCellOperation {
|
public class ReconMatchSpecificTopicOperation extends EngineDependentMassCellOperation {
|
||||||
|
|
||||||
@ -92,34 +92,20 @@ public class ReconMatchSpecificTopicOperation extends EngineDependentMassCellOpe
|
|||||||
final protected String schemaSpace;
|
final protected String schemaSpace;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
||||||
JSONObject engineConfig = obj.getJSONObject("engineConfig");
|
return ParsingUtilities.mapper.readValue(obj.toString(), ReconMatchSpecificTopicOperation.class);
|
||||||
|
|
||||||
JSONObject match = obj.getJSONObject("match");
|
|
||||||
|
|
||||||
JSONArray types = match.getJSONArray("types");
|
|
||||||
String[] typeIDs = new String[types.length()];
|
|
||||||
for (int i = 0; i < typeIDs.length; i++) {
|
|
||||||
typeIDs[i] = types.getString(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ReconMatchSpecificTopicOperation(
|
|
||||||
EngineConfig.reconstruct(engineConfig),
|
|
||||||
obj.getString("columnName"),
|
|
||||||
new ReconItem(
|
|
||||||
match.getString("id"),
|
|
||||||
match.getString("name"),
|
|
||||||
typeIDs
|
|
||||||
),
|
|
||||||
obj.getString("identifierSpace"),
|
|
||||||
obj.getString("schemaSpace")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
public ReconMatchSpecificTopicOperation(
|
public ReconMatchSpecificTopicOperation(
|
||||||
|
@JsonProperty("engineConfig")
|
||||||
EngineConfig engineConfig,
|
EngineConfig engineConfig,
|
||||||
|
@JsonProperty("columnName")
|
||||||
String columnName,
|
String columnName,
|
||||||
|
@JsonProperty("match")
|
||||||
ReconItem match,
|
ReconItem match,
|
||||||
|
@JsonProperty("identifierSpace")
|
||||||
String identifierSpace,
|
String identifierSpace,
|
||||||
|
@JsonProperty("schemaSpace")
|
||||||
String schemaSpace
|
String schemaSpace
|
||||||
) {
|
) {
|
||||||
super(engineConfig, columnName, false);
|
super(engineConfig, columnName, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user