Jackson deserialization for RowFlagOperation
This commit is contained in:
parent
3b9fd23b9c
commit
5f19628618
@ -38,6 +38,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import com.google.refine.browsing.Engine;
|
import com.google.refine.browsing.Engine;
|
||||||
@ -52,21 +53,21 @@ import com.google.refine.model.Row;
|
|||||||
import com.google.refine.model.changes.MassChange;
|
import com.google.refine.model.changes.MassChange;
|
||||||
import com.google.refine.model.changes.RowFlagChange;
|
import com.google.refine.model.changes.RowFlagChange;
|
||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class RowFlagOperation extends EngineDependentOperation {
|
public class RowFlagOperation extends EngineDependentOperation {
|
||||||
final protected boolean _flagged;
|
final protected boolean _flagged;
|
||||||
|
|
||||||
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(), RowFlagOperation.class);
|
||||||
boolean flagged = obj.getBoolean("flagged");
|
|
||||||
|
|
||||||
return new RowFlagOperation(
|
|
||||||
EngineConfig.reconstruct(engineConfig),
|
|
||||||
flagged
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowFlagOperation(EngineConfig engineConfig, boolean flagged) {
|
@JsonCreator
|
||||||
|
public RowFlagOperation(
|
||||||
|
@JsonProperty("engineConfig")
|
||||||
|
EngineConfig engineConfig,
|
||||||
|
@JsonProperty("flagged")
|
||||||
|
boolean flagged) {
|
||||||
super(engineConfig);
|
super(engineConfig);
|
||||||
_flagged = flagged;
|
_flagged = flagged;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user