Jackson deserialization for ReconDiscardJudgmentsOperation
This commit is contained in:
parent
e40d68afaf
commit
408703f13c
@ -33,12 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.recon;
|
package com.google.refine.operations.recon;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
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.EngineConfig;
|
import com.google.refine.browsing.EngineConfig;
|
||||||
@ -54,20 +56,23 @@ 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 ReconDiscardJudgmentsOperation extends EngineDependentMassCellOperation {
|
public class ReconDiscardJudgmentsOperation extends EngineDependentMassCellOperation {
|
||||||
final protected boolean _clearData;
|
final protected boolean _clearData;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
||||||
JSONObject engineConfig = obj.getJSONObject("engineConfig");
|
return ParsingUtilities.mapper.readValue(obj.toString(), ReconDiscardJudgmentsOperation.class);
|
||||||
return new ReconDiscardJudgmentsOperation(
|
|
||||||
EngineConfig.reconstruct(engineConfig),
|
|
||||||
obj.getString("columnName"),
|
|
||||||
obj.has("clearData") && obj.getBoolean("clearData")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReconDiscardJudgmentsOperation(EngineConfig engineConfig, String columnName, boolean clearData) {
|
@JsonCreator
|
||||||
|
public ReconDiscardJudgmentsOperation(
|
||||||
|
@JsonProperty("engineConfig")
|
||||||
|
EngineConfig engineConfig,
|
||||||
|
@JsonProperty("columnName")
|
||||||
|
String columnName,
|
||||||
|
@JsonProperty("clearData")
|
||||||
|
boolean clearData) {
|
||||||
super(engineConfig, columnName, false);
|
super(engineConfig, columnName, false);
|
||||||
_clearData = clearData;
|
_clearData = clearData;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user