Jackson deserialization for ReconMarkNewTopicsOperation
This commit is contained in:
parent
3271e53ecf
commit
d908635c1f
@ -33,12 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package com.google.refine.operations.recon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import com.google.refine.browsing.EngineConfig;
|
||||
@ -55,21 +57,23 @@ import com.google.refine.model.changes.CellChange;
|
||||
import com.google.refine.model.changes.ReconChange;
|
||||
import com.google.refine.model.recon.ReconConfig;
|
||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||
import com.google.refine.util.ParsingUtilities;
|
||||
|
||||
public class ReconMarkNewTopicsOperation extends EngineDependentMassCellOperation {
|
||||
final protected boolean _shareNewTopics;
|
||||
|
||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
||||
JSONObject engineConfig = obj.getJSONObject("engineConfig");
|
||||
|
||||
return new ReconMarkNewTopicsOperation(
|
||||
EngineConfig.reconstruct(engineConfig),
|
||||
obj.getString("columnName"),
|
||||
obj.has("shareNewTopics") ? obj.getBoolean("shareNewTopics") : false
|
||||
);
|
||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconMarkNewTopicsOperation.class);
|
||||
}
|
||||
|
||||
public ReconMarkNewTopicsOperation(EngineConfig engineConfig, String columnName, boolean shareNewTopics) {
|
||||
@JsonCreator
|
||||
public ReconMarkNewTopicsOperation(
|
||||
@JsonProperty("engineConfig")
|
||||
EngineConfig engineConfig,
|
||||
@JsonProperty("columnName")
|
||||
String columnName,
|
||||
@JsonProperty("shareNewTopics")
|
||||
boolean shareNewTopics) {
|
||||
super(engineConfig, columnName, false);
|
||||
_shareNewTopics = shareNewTopics;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user