Remove reconstruct method on operations
This commit is contained in:
parent
ebcc7b51b5
commit
d012ea7f8d
@ -36,6 +36,7 @@ package com.google.refine.operations;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import com.google.refine.browsing.Engine;
|
import com.google.refine.browsing.Engine;
|
||||||
@ -50,7 +51,9 @@ import com.google.refine.model.changes.CellChange;
|
|||||||
import com.google.refine.model.changes.MassCellChange;
|
import com.google.refine.model.changes.MassCellChange;
|
||||||
|
|
||||||
abstract public class EngineDependentMassCellOperation extends EngineDependentOperation {
|
abstract public class EngineDependentMassCellOperation extends EngineDependentOperation {
|
||||||
|
@JsonIgnore
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
|
@JsonIgnore
|
||||||
final protected boolean _updateRowContextDependencies;
|
final protected boolean _updateRowContextDependencies;
|
||||||
|
|
||||||
protected EngineDependentMassCellOperation(
|
protected EngineDependentMassCellOperation(
|
||||||
|
@ -35,8 +35,6 @@ package com.google.refine.operations.cell;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -44,21 +42,15 @@ import com.google.refine.browsing.Engine.Mode;
|
|||||||
import com.google.refine.browsing.EngineConfig;
|
import com.google.refine.browsing.EngineConfig;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.expr.ExpressionUtils;
|
import com.google.refine.expr.ExpressionUtils;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.CellChange;
|
import com.google.refine.model.changes.CellChange;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class BlankDownOperation extends EngineDependentMassCellOperation {
|
public class BlankDownOperation extends EngineDependentMassCellOperation {
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), BlankDownOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public BlankDownOperation(
|
public BlankDownOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -35,8 +35,6 @@ package com.google.refine.operations.cell;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -45,21 +43,15 @@ import com.google.refine.browsing.Engine.Mode;
|
|||||||
import com.google.refine.browsing.EngineConfig;
|
import com.google.refine.browsing.EngineConfig;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.expr.ExpressionUtils;
|
import com.google.refine.expr.ExpressionUtils;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.CellChange;
|
import com.google.refine.model.changes.CellChange;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class FillDownOperation extends EngineDependentMassCellOperation {
|
public class FillDownOperation extends EngineDependentMassCellOperation {
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), FillDownOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public FillDownOperation(
|
public FillDownOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,14 +33,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.cell;
|
package com.google.refine.operations.cell;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
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 com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -52,17 +49,12 @@ import com.google.refine.model.Column;
|
|||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.MassRowColumnChange;
|
import com.google.refine.model.changes.MassRowColumnChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class KeyValueColumnizeOperation extends AbstractOperation {
|
public class KeyValueColumnizeOperation extends AbstractOperation {
|
||||||
final protected String _keyColumnName;
|
final protected String _keyColumnName;
|
||||||
final protected String _valueColumnName;
|
final protected String _valueColumnName;
|
||||||
final protected String _noteColumnName;
|
final protected String _noteColumnName;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), KeyValueColumnizeOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public KeyValueColumnizeOperation(
|
public KeyValueColumnizeOperation(
|
||||||
@JsonProperty("keyColumnName")
|
@JsonProperty("keyColumnName")
|
||||||
|
@ -40,8 +40,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -50,7 +48,6 @@ import com.google.refine.browsing.RowVisitor;
|
|||||||
import com.google.refine.expr.Evaluable;
|
import com.google.refine.expr.Evaluable;
|
||||||
import com.google.refine.expr.ExpressionUtils;
|
import com.google.refine.expr.ExpressionUtils;
|
||||||
import com.google.refine.expr.MetaParser;
|
import com.google.refine.expr.MetaParser;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -106,10 +103,6 @@ public class MassEditOperation extends EngineDependentMassCellOperation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), MassEditOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MassEditOperation(EngineConfig engineConfig, String columnName, String expression, List<Edit> edits) {
|
public MassEditOperation(EngineConfig engineConfig, String columnName, String expression, List<Edit> edits) {
|
||||||
super(engineConfig, columnName, true);
|
super(engineConfig, columnName, true);
|
||||||
_expression = expression;
|
_expression = expression;
|
||||||
|
@ -36,8 +36,6 @@ package com.google.refine.operations.cell;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -49,17 +47,12 @@ import com.google.refine.model.Column;
|
|||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.MassRowChange;
|
import com.google.refine.model.changes.MassRowChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class MultiValuedCellJoinOperation extends AbstractOperation {
|
public class MultiValuedCellJoinOperation extends AbstractOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
final protected String _keyColumnName;
|
final protected String _keyColumnName;
|
||||||
final protected String _separator;
|
final protected String _separator;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), MultiValuedCellJoinOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public MultiValuedCellJoinOperation(
|
public MultiValuedCellJoinOperation(
|
||||||
@JsonProperty("columnName")
|
@JsonProperty("columnName")
|
||||||
|
@ -38,7 +38,6 @@ import java.util.List;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@ -52,7 +51,6 @@ import com.google.refine.model.Column;
|
|||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.MassRowChange;
|
import com.google.refine.model.changes.MassRowChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class MultiValuedCellSplitOperation extends AbstractOperation {
|
public class MultiValuedCellSplitOperation extends AbstractOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
@ -63,10 +61,6 @@ public class MultiValuedCellSplitOperation extends AbstractOperation {
|
|||||||
|
|
||||||
final protected int[] _fieldLengths;
|
final protected int[] _fieldLengths;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), MultiValuedCellSplitOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public static MultiValuedCellSplitOperation deserialize(
|
public static MultiValuedCellSplitOperation deserialize(
|
||||||
@JsonProperty("columnName")
|
@JsonProperty("columnName")
|
||||||
|
@ -37,8 +37,6 @@ import java.io.Serializable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -48,7 +46,6 @@ import com.google.refine.expr.Evaluable;
|
|||||||
import com.google.refine.expr.ExpressionUtils;
|
import com.google.refine.expr.ExpressionUtils;
|
||||||
import com.google.refine.expr.MetaParser;
|
import com.google.refine.expr.MetaParser;
|
||||||
import com.google.refine.expr.WrappedCell;
|
import com.google.refine.expr.WrappedCell;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -56,7 +53,6 @@ import com.google.refine.model.Row;
|
|||||||
import com.google.refine.model.changes.CellChange;
|
import com.google.refine.model.changes.CellChange;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
import com.google.refine.operations.OnError;
|
import com.google.refine.operations.OnError;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class TextTransformOperation extends EngineDependentMassCellOperation {
|
public class TextTransformOperation extends EngineDependentMassCellOperation {
|
||||||
@JsonProperty("expression")
|
@JsonProperty("expression")
|
||||||
@ -68,10 +64,6 @@ public class TextTransformOperation extends EngineDependentMassCellOperation {
|
|||||||
@JsonProperty("repeatCount")
|
@JsonProperty("repeatCount")
|
||||||
final protected int _repeatCount;
|
final protected int _repeatCount;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), TextTransformOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
static public OnError stringToOnError(String s) {
|
static public OnError stringToOnError(String s) {
|
||||||
if ("set-to-blank".equalsIgnoreCase(s)) {
|
if ("set-to-blank".equalsIgnoreCase(s)) {
|
||||||
return OnError.SetToBlank;
|
return OnError.SetToBlank;
|
||||||
|
@ -36,8 +36,6 @@ package com.google.refine.operations.cell;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@ -51,7 +49,6 @@ import com.google.refine.model.Column;
|
|||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.MassRowColumnChange;
|
import com.google.refine.model.changes.MassRowColumnChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class TransposeColumnsIntoRowsOperation extends AbstractOperation {
|
public class TransposeColumnsIntoRowsOperation extends AbstractOperation {
|
||||||
@JsonProperty("startColumnName")
|
@JsonProperty("startColumnName")
|
||||||
@ -82,10 +79,6 @@ public class TransposeColumnsIntoRowsOperation extends AbstractOperation {
|
|||||||
return _combinedColumnName == null ? null : _prependColumnName;
|
return _combinedColumnName == null ? null : _prependColumnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), TransposeColumnsIntoRowsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
static public TransposeColumnsIntoRowsOperation deserialize(
|
static public TransposeColumnsIntoRowsOperation deserialize(
|
||||||
@JsonProperty("combinedColumnName")
|
@JsonProperty("combinedColumnName")
|
||||||
|
@ -36,8 +36,6 @@ package com.google.refine.operations.cell;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -48,16 +46,11 @@ import com.google.refine.model.Column;
|
|||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.MassRowColumnChange;
|
import com.google.refine.model.changes.MassRowColumnChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class TransposeRowsIntoColumnsOperation extends AbstractOperation {
|
public class TransposeRowsIntoColumnsOperation extends AbstractOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
final protected int _rowCount;
|
final protected int _rowCount;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), TransposeRowsIntoColumnsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public TransposeRowsIntoColumnsOperation(
|
public TransposeRowsIntoColumnsOperation(
|
||||||
@JsonProperty("columnName")
|
@JsonProperty("columnName")
|
||||||
|
@ -46,7 +46,6 @@ import java.util.Properties;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@ -65,7 +64,6 @@ import com.google.refine.expr.ExpressionUtils;
|
|||||||
import com.google.refine.expr.MetaParser;
|
import com.google.refine.expr.MetaParser;
|
||||||
import com.google.refine.expr.WrappedCell;
|
import com.google.refine.expr.WrappedCell;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -107,10 +105,6 @@ public class ColumnAdditionByFetchingURLsOperation extends EngineDependentOperat
|
|||||||
final protected boolean _cacheResponses;
|
final protected boolean _cacheResponses;
|
||||||
final protected List<HttpHeader> _httpHeadersJson;
|
final protected List<HttpHeader> _httpHeadersJson;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnAdditionByFetchingURLsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ColumnAdditionByFetchingURLsOperation(
|
public ColumnAdditionByFetchingURLsOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,14 +33,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.column;
|
package com.google.refine.operations.column;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -54,7 +51,6 @@ import com.google.refine.expr.MetaParser;
|
|||||||
import com.google.refine.expr.WrappedCell;
|
import com.google.refine.expr.WrappedCell;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -63,7 +59,6 @@ import com.google.refine.model.changes.CellAtRow;
|
|||||||
import com.google.refine.model.changes.ColumnAdditionChange;
|
import com.google.refine.model.changes.ColumnAdditionChange;
|
||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
import com.google.refine.operations.OnError;
|
import com.google.refine.operations.OnError;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ColumnAdditionOperation extends EngineDependentOperation {
|
public class ColumnAdditionOperation extends EngineDependentOperation {
|
||||||
final protected String _baseColumnName;
|
final protected String _baseColumnName;
|
||||||
@ -73,10 +68,6 @@ public class ColumnAdditionOperation extends EngineDependentOperation {
|
|||||||
final protected String _newColumnName;
|
final protected String _newColumnName;
|
||||||
final protected int _columnInsertIndex;
|
final protected int _columnInsertIndex;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnAdditionOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ColumnAdditionOperation(
|
public ColumnAdditionOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,10 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.column;
|
package com.google.refine.operations.column;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -45,16 +41,11 @@ import com.google.refine.history.HistoryEntry;
|
|||||||
import com.google.refine.model.AbstractOperation;
|
import com.google.refine.model.AbstractOperation;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.changes.ColumnMoveChange;
|
import com.google.refine.model.changes.ColumnMoveChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ColumnMoveOperation extends AbstractOperation {
|
public class ColumnMoveOperation extends AbstractOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
final protected int _index;
|
final protected int _index;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnMoveOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ColumnMoveOperation(
|
public ColumnMoveOperation(
|
||||||
@JsonProperty("columnName")
|
@JsonProperty("columnName")
|
||||||
|
@ -33,10 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.column;
|
package com.google.refine.operations.column;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -46,15 +42,10 @@ import com.google.refine.model.AbstractOperation;
|
|||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.changes.ColumnRemovalChange;
|
import com.google.refine.model.changes.ColumnRemovalChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ColumnRemovalOperation extends AbstractOperation {
|
public class ColumnRemovalOperation extends AbstractOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnRemovalOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ColumnRemovalOperation(
|
public ColumnRemovalOperation(
|
||||||
@JsonProperty("columnName")
|
@JsonProperty("columnName")
|
||||||
|
@ -33,8 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.column;
|
package com.google.refine.operations.column;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
@ -47,13 +45,6 @@ public class ColumnRenameOperation extends AbstractOperation {
|
|||||||
final protected String _oldColumnName;
|
final protected String _oldColumnName;
|
||||||
final protected String _newColumnName;
|
final protected String _newColumnName;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return new ColumnRenameOperation(
|
|
||||||
obj.getString("oldColumnName"),
|
|
||||||
obj.getString("newColumnName")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColumnRenameOperation(
|
public ColumnRenameOperation(
|
||||||
String oldColumnName,
|
String oldColumnName,
|
||||||
String newColumnName
|
String newColumnName
|
||||||
|
@ -35,8 +35,6 @@ package com.google.refine.operations.column;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -44,13 +42,8 @@ import com.google.refine.history.HistoryEntry;
|
|||||||
import com.google.refine.model.AbstractOperation;
|
import com.google.refine.model.AbstractOperation;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.changes.ColumnReorderChange;
|
import com.google.refine.model.changes.ColumnReorderChange;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ColumnReorderOperation extends AbstractOperation {
|
public class ColumnReorderOperation extends AbstractOperation {
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnReorderOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
final protected List<String> _columnNames;
|
final protected List<String> _columnNames;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
|
@ -33,14 +33,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.column;
|
package com.google.refine.operations.column;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@ -55,13 +53,11 @@ import com.google.refine.expr.ExpressionUtils;
|
|||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.importers.ImporterUtilities;
|
import com.google.refine.importers.ImporterUtilities;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.ColumnSplitChange;
|
import com.google.refine.model.changes.ColumnSplitChange;
|
||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ColumnSplitOperation extends EngineDependentOperation {
|
public class ColumnSplitOperation extends EngineDependentOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
@ -75,10 +71,6 @@ public class ColumnSplitOperation extends EngineDependentOperation {
|
|||||||
|
|
||||||
final protected int[] _fieldLengths;
|
final protected int[] _fieldLengths;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnSplitOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public static ColumnSplitOperation deserialize(
|
public static ColumnSplitOperation deserialize(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -42,7 +42,6 @@ import java.util.Properties;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@ -52,7 +51,6 @@ import com.google.refine.browsing.EngineConfig;
|
|||||||
import com.google.refine.browsing.FilteredRows;
|
import com.google.refine.browsing.FilteredRows;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -68,7 +66,6 @@ import com.google.refine.model.recon.ReconciledDataExtensionJob.DataExtensionCon
|
|||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
import com.google.refine.process.LongRunningProcess;
|
import com.google.refine.process.LongRunningProcess;
|
||||||
import com.google.refine.process.Process;
|
import com.google.refine.process.Process;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ExtendDataOperation extends EngineDependentOperation {
|
public class ExtendDataOperation extends EngineDependentOperation {
|
||||||
@JsonProperty("baseColumnName")
|
@JsonProperty("baseColumnName")
|
||||||
@ -85,10 +82,6 @@ public class ExtendDataOperation extends EngineDependentOperation {
|
|||||||
final protected int _columnInsertIndex;
|
final protected int _columnInsertIndex;
|
||||||
|
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ExtendDataOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ExtendDataOperation(
|
public ExtendDataOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,18 +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.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
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;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -52,15 +48,10 @@ 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 ReconClearSimilarCellsOperation extends EngineDependentMassCellOperation {
|
public class ReconClearSimilarCellsOperation extends EngineDependentMassCellOperation {
|
||||||
final protected String _similarValue;
|
final protected String _similarValue;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconClearSimilarCellsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconClearSimilarCellsOperation(
|
public ReconClearSimilarCellsOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,7 +33,6 @@ 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.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -42,7 +41,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@ -52,7 +50,6 @@ import com.google.refine.browsing.EngineConfig;
|
|||||||
import com.google.refine.browsing.FilteredRows;
|
import com.google.refine.browsing.FilteredRows;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -62,8 +59,6 @@ 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.MassChange;
|
import com.google.refine.model.changes.MassChange;
|
||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
import com.google.refine.util.JSONUtilities;
|
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ReconCopyAcrossColumnsOperation extends EngineDependentOperation {
|
public class ReconCopyAcrossColumnsOperation extends EngineDependentOperation {
|
||||||
final protected String _fromColumnName;
|
final protected String _fromColumnName;
|
||||||
@ -71,10 +66,6 @@ public class ReconCopyAcrossColumnsOperation extends EngineDependentOperation {
|
|||||||
final protected String[] _judgments;
|
final protected String[] _judgments;
|
||||||
final protected boolean _applyToJudgedCells;
|
final protected boolean _applyToJudgedCells;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconCopyAcrossColumnsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconCopyAcrossColumnsOperation(
|
public ReconCopyAcrossColumnsOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,20 +33,16 @@ 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 com.fasterxml.jackson.annotation.JsonCreator;
|
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;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -56,15 +52,10 @@ 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 IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconDiscardJudgmentsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconDiscardJudgmentsOperation(
|
public ReconDiscardJudgmentsOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,13 +33,10 @@ 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 com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
@ -49,7 +46,6 @@ import com.google.refine.browsing.EngineConfig;
|
|||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.expr.ExpressionUtils;
|
import com.google.refine.expr.ExpressionUtils;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -61,7 +57,6 @@ 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.model.recon.ReconConfig;
|
import com.google.refine.model.recon.ReconConfig;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ReconJudgeSimilarCellsOperation extends EngineDependentMassCellOperation {
|
public class ReconJudgeSimilarCellsOperation extends EngineDependentMassCellOperation {
|
||||||
final protected String _similarValue;
|
final protected String _similarValue;
|
||||||
@ -69,10 +64,6 @@ public class ReconJudgeSimilarCellsOperation extends EngineDependentMassCellOper
|
|||||||
final protected ReconCandidate _match;
|
final protected ReconCandidate _match;
|
||||||
final protected boolean _shareNewTopics;
|
final protected boolean _shareNewTopics;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconJudgeSimilarCellsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconJudgeSimilarCellsOperation(
|
public ReconJudgeSimilarCellsOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,20 +33,16 @@ 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 com.fasterxml.jackson.annotation.JsonCreator;
|
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;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -57,15 +53,10 @@ 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.model.recon.ReconConfig;
|
import com.google.refine.model.recon.ReconConfig;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ReconMarkNewTopicsOperation extends EngineDependentMassCellOperation {
|
public class ReconMarkNewTopicsOperation extends EngineDependentMassCellOperation {
|
||||||
final protected boolean _shareNewTopics;
|
final protected boolean _shareNewTopics;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconMarkNewTopicsOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconMarkNewTopicsOperation(
|
public ReconMarkNewTopicsOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -37,15 +37,12 @@ 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 com.fasterxml.jackson.annotation.JsonCreator;
|
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;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -56,13 +53,8 @@ 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 ReconMatchBestCandidatesOperation extends EngineDependentMassCellOperation {
|
public class ReconMatchBestCandidatesOperation extends EngineDependentMassCellOperation {
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconMatchBestCandidatesOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconMatchBestCandidatesOperation(
|
public ReconMatchBestCandidatesOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -37,8 +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.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@ -46,7 +44,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.google.refine.browsing.EngineConfig;
|
import com.google.refine.browsing.EngineConfig;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -57,7 +54,6 @@ 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 {
|
||||||
|
|
||||||
@ -91,10 +87,6 @@ public class ReconMatchSpecificTopicOperation extends EngineDependentMassCellOpe
|
|||||||
@JsonProperty("schemaSpace")
|
@JsonProperty("schemaSpace")
|
||||||
final protected String schemaSpace;
|
final protected String schemaSpace;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconMatchSpecificTopicOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconMatchSpecificTopicOperation(
|
public ReconMatchSpecificTopicOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -40,7 +40,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -76,10 +75,6 @@ public class ReconOperation extends EngineDependentOperation {
|
|||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
final protected ReconConfig _reconConfig;
|
final protected ReconConfig _reconConfig;
|
||||||
|
|
||||||
static public ReconOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public ReconOperation(
|
public ReconOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package com.google.refine.operations.recon;
|
package com.google.refine.operations.recon;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@ -25,7 +22,6 @@ 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.model.recon.StandardReconConfig;
|
import com.google.refine.model.recon.StandardReconConfig;
|
||||||
import com.google.refine.operations.EngineDependentMassCellOperation;
|
import com.google.refine.operations.EngineDependentMassCellOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class ReconUseValuesAsIdentifiersOperation extends EngineDependentMassCellOperation {
|
public class ReconUseValuesAsIdentifiersOperation extends EngineDependentMassCellOperation {
|
||||||
|
|
||||||
@ -58,10 +54,6 @@ public class ReconUseValuesAsIdentifiersOperation extends EngineDependentMassCel
|
|||||||
this.reconConfig = new StandardReconConfig(service, identifierSpace, schemaSpace, null, null, true, Collections.emptyList());
|
this.reconConfig = new StandardReconConfig(service, identifierSpace, schemaSpace, null, null, true, Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static public ReconUseValuesAsIdentifiersOperation reconstruct(JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), ReconUseValuesAsIdentifiersOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBriefDescription(Project project) {
|
public String getBriefDescription(Project project) {
|
||||||
return "Use values as reconciliation identifiers in column " + _columnName;
|
return "Use values as reconciliation identifiers in column " + _columnName;
|
||||||
|
@ -36,8 +36,6 @@ package com.google.refine.operations.row;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
@ -50,10 +48,6 @@ import com.google.refine.model.Row;
|
|||||||
import com.google.refine.model.changes.MassRowChange;
|
import com.google.refine.model.changes.MassRowChange;
|
||||||
|
|
||||||
public class DenormalizeOperation extends AbstractOperation {
|
public class DenormalizeOperation extends AbstractOperation {
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
|
||||||
return new DenormalizeOperation();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public DenormalizeOperation() {
|
public DenormalizeOperation() {
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@ package com.google.refine.operations.row;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -47,21 +45,15 @@ import com.google.refine.browsing.FilteredRows;
|
|||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
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 {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), RowFlagOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public RowFlagOperation(
|
public RowFlagOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,12 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.row;
|
package com.google.refine.operations.row;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -47,18 +44,12 @@ import com.google.refine.browsing.EngineConfig;
|
|||||||
import com.google.refine.browsing.FilteredRows;
|
import com.google.refine.browsing.FilteredRows;
|
||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.model.changes.RowRemovalChange;
|
import com.google.refine.model.changes.RowRemovalChange;
|
||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class RowRemovalOperation extends EngineDependentOperation {
|
public class RowRemovalOperation extends EngineDependentOperation {
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), RowRemovalOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public RowRemovalOperation(
|
public RowRemovalOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -33,12 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.row;
|
package com.google.refine.operations.row;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -55,13 +52,8 @@ import com.google.refine.model.changes.RowReorderChange;
|
|||||||
import com.google.refine.sorting.SortingConfig;
|
import com.google.refine.sorting.SortingConfig;
|
||||||
import com.google.refine.sorting.SortingRecordVisitor;
|
import com.google.refine.sorting.SortingRecordVisitor;
|
||||||
import com.google.refine.sorting.SortingRowVisitor;
|
import com.google.refine.sorting.SortingRowVisitor;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class RowReorderOperation extends AbstractOperation {
|
public class RowReorderOperation extends AbstractOperation {
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), RowReorderOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
final protected Mode _mode;
|
final protected Mode _mode;
|
||||||
final protected SortingConfig _sorting;
|
final protected SortingConfig _sorting;
|
||||||
|
|
||||||
|
@ -33,12 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.row;
|
package com.google.refine.operations.row;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@ -48,21 +45,15 @@ import com.google.refine.browsing.FilteredRows;
|
|||||||
import com.google.refine.browsing.RowVisitor;
|
import com.google.refine.browsing.RowVisitor;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.history.HistoryEntry;
|
import com.google.refine.history.HistoryEntry;
|
||||||
import com.google.refine.model.AbstractOperation;
|
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.Row;
|
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.RowStarChange;
|
import com.google.refine.model.changes.RowStarChange;
|
||||||
import com.google.refine.operations.EngineDependentOperation;
|
import com.google.refine.operations.EngineDependentOperation;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
|
||||||
|
|
||||||
public class RowStarOperation extends EngineDependentOperation {
|
public class RowStarOperation extends EngineDependentOperation {
|
||||||
final protected boolean _starred;
|
final protected boolean _starred;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
|
||||||
return ParsingUtilities.mapper.readValue(obj.toString(), RowStarOperation.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public RowStarOperation(
|
public RowStarOperation(
|
||||||
@JsonProperty("engineConfig")
|
@JsonProperty("engineConfig")
|
||||||
|
@ -1,18 +1,11 @@
|
|||||||
package com.google.refine.tests.model.changes;
|
package com.google.refine.tests.model.changes;
|
||||||
|
|
||||||
import com.google.refine.model.ModelException;
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.model.changes.DataExtensionChange;
|
|
||||||
import com.google.refine.model.changes.MassChange;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.LineNumberReader;
|
import java.io.LineNumberReader;
|
||||||
import java.io.Reader;
|
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
@ -20,6 +13,9 @@ import org.testng.annotations.BeforeTest;
|
|||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
|
import com.google.refine.model.ModelException;
|
||||||
|
import com.google.refine.model.Project;
|
||||||
|
import com.google.refine.model.changes.DataExtensionChange;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.util.Pool;
|
import com.google.refine.util.Pool;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import com.google.refine.operations.cell.FillDownOperation;
|
|||||||
import com.google.refine.process.Process;
|
import com.google.refine.process.Process;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
import com.google.refine.util.Pool;
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class BlankDownTests extends RefineTest {
|
public class BlankDownTests extends RefineTest {
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class BlankDownTests extends RefineTest {
|
|||||||
+ "\"description\":\"Blank down cells in column my column\","
|
+ "\"description\":\"Blank down cells in column my column\","
|
||||||
+ "\"engineConfig\":{\"mode\":\"record-based\",\"facets\":[]},"
|
+ "\"engineConfig\":{\"mode\":\"record-based\",\"facets\":[]},"
|
||||||
+ "\"columnName\":\"my column\"}";
|
+ "\"columnName\":\"my column\"}";
|
||||||
AbstractOperation op = BlankDownOperation.reconstruct(project, new JSONObject(json));
|
AbstractOperation op = ParsingUtilities.mapper.readValue(json, BlankDownOperation.class);
|
||||||
TestUtils.isSerializedTo(op, json);
|
TestUtils.isSerializedTo(op, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,6 @@ public class BlankDownTests extends RefineTest {
|
|||||||
"second");
|
"second");
|
||||||
Process process = op.createProcess(project, new Properties());
|
Process process = op.createProcess(project, new Properties());
|
||||||
process.performImmediate();
|
process.performImmediate();
|
||||||
//project.saveToOutputStream(System.out, new Pool());
|
|
||||||
|
|
||||||
Assert.assertEquals("c", project.rows.get(0).cells.get(3).value);
|
Assert.assertEquals("c", project.rows.get(0).cells.get(3).value);
|
||||||
Assert.assertNull(project.rows.get(1).cells.get(3));
|
Assert.assertNull(project.rows.get(1).cells.get(3));
|
||||||
|
@ -20,9 +20,10 @@ import com.google.refine.model.Project;
|
|||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.cell.FillDownOperation;
|
import com.google.refine.operations.cell.FillDownOperation;
|
||||||
|
import com.google.refine.process.Process;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
import com.google.refine.process.Process;
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class FillDownTests extends RefineTest {
|
public class FillDownTests extends RefineTest {
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ public class FillDownTests extends RefineTest {
|
|||||||
+ "\"description\":\"Fill down cells in column my key\","
|
+ "\"description\":\"Fill down cells in column my key\","
|
||||||
+ "\"engineConfig\":{\"mode\":\"record-based\",\"facets\":[]},"
|
+ "\"engineConfig\":{\"mode\":\"record-based\",\"facets\":[]},"
|
||||||
+ "\"columnName\":\"my key\"}";
|
+ "\"columnName\":\"my key\"}";
|
||||||
TestUtils.isSerializedTo(FillDownOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, FillDownOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -36,7 +36,6 @@ package com.google.refine.tests.operations.cell;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
@ -51,6 +50,7 @@ import com.google.refine.operations.cell.MultiValuedCellJoinOperation;
|
|||||||
import com.google.refine.process.Process;
|
import com.google.refine.process.Process;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class JoinMultiValuedCellsTests extends RefineTest {
|
public class JoinMultiValuedCellsTests extends RefineTest {
|
||||||
@ -85,7 +85,7 @@ public class JoinMultiValuedCellsTests extends RefineTest {
|
|||||||
+ "\"columnName\":\"value column\","
|
+ "\"columnName\":\"value column\","
|
||||||
+ "\"keyColumnName\":\"key column\","
|
+ "\"keyColumnName\":\"key column\","
|
||||||
+ "\"separator\":\",\"}";
|
+ "\"separator\":\",\"}";
|
||||||
TestUtils.isSerializedTo(MultiValuedCellJoinOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, MultiValuedCellJoinOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ import com.google.refine.process.Process;
|
|||||||
import com.google.refine.tests.RefineServletStub;
|
import com.google.refine.tests.RefineServletStub;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class KeyValueColumnizeTests extends RefineTest {
|
public class KeyValueColumnizeTests extends RefineTest {
|
||||||
@ -119,14 +120,14 @@ public class KeyValueColumnizeTests extends RefineTest {
|
|||||||
+ "\"keyColumnName\":\"key column\","
|
+ "\"keyColumnName\":\"key column\","
|
||||||
+ "\"valueColumnName\":\"value column\","
|
+ "\"valueColumnName\":\"value column\","
|
||||||
+ "\"noteColumnName\":null}";
|
+ "\"noteColumnName\":null}";
|
||||||
TestUtils.isSerializedTo(KeyValueColumnizeOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, KeyValueColumnizeOperation.class), json);
|
||||||
|
|
||||||
String jsonFull = "{\"op\":\"core/key-value-columnize\","
|
String jsonFull = "{\"op\":\"core/key-value-columnize\","
|
||||||
+ "\"description\":\"Columnize by key column key column and value column value column with note column note column\","
|
+ "\"description\":\"Columnize by key column key column and value column value column with note column note column\","
|
||||||
+ "\"keyColumnName\":\"key column\","
|
+ "\"keyColumnName\":\"key column\","
|
||||||
+ "\"valueColumnName\":\"value column\","
|
+ "\"valueColumnName\":\"value column\","
|
||||||
+ "\"noteColumnName\":\"note column\"}";
|
+ "\"noteColumnName\":\"note column\"}";
|
||||||
TestUtils.isSerializedTo(KeyValueColumnizeOperation.reconstruct(project, new JSONObject(jsonFull)), jsonFull);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(jsonFull, KeyValueColumnizeOperation.class), jsonFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,15 +3,12 @@ package com.google.refine.tests.operations.cell;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.cell.MassEditOperation;
|
import com.google.refine.operations.cell.MassEditOperation;
|
||||||
import com.google.refine.operations.cell.MassEditOperation.Edit;
|
import com.google.refine.operations.cell.MassEditOperation.Edit;
|
||||||
@ -31,13 +28,12 @@ public class MassOperationTests extends RefineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeMassEditOperation() throws JSONException, Exception {
|
public void serializeMassEditOperation() throws JSONException, Exception {
|
||||||
Project project = mock(Project.class);
|
|
||||||
String json = "{\"op\":\"core/mass-edit\","
|
String json = "{\"op\":\"core/mass-edit\","
|
||||||
+ "\"description\":\"Mass edit cells in column my column\","
|
+ "\"description\":\"Mass edit cells in column my column\","
|
||||||
+ "\"engineConfig\":{\"mode\":\"record-based\",\"facets\":[]},"
|
+ "\"engineConfig\":{\"mode\":\"record-based\",\"facets\":[]},"
|
||||||
+ "\"columnName\":\"my column\",\"expression\":\"value\","
|
+ "\"columnName\":\"my column\",\"expression\":\"value\","
|
||||||
+ "\"edits\":[{\"fromBlank\":false,\"fromError\":false,\"from\":[\"String\"],\"to\":\"newString\"}]}";
|
+ "\"edits\":[{\"fromBlank\":false,\"fromError\":false,\"from\":[\"String\"],\"to\":\"newString\"}]}";
|
||||||
TestUtils.isSerializedTo(MassEditOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, MassEditOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -37,7 +37,6 @@ package com.google.refine.tests.operations.cell;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
@ -51,6 +50,7 @@ import com.google.refine.operations.cell.MultiValuedCellSplitOperation;
|
|||||||
import com.google.refine.process.Process;
|
import com.google.refine.process.Process;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class SplitMultiValuedCellsTests extends RefineTest {
|
public class SplitMultiValuedCellsTests extends RefineTest {
|
||||||
@ -80,7 +80,7 @@ public class SplitMultiValuedCellsTests extends RefineTest {
|
|||||||
+ "\"mode\":\"separator\","
|
+ "\"mode\":\"separator\","
|
||||||
+ "\"separator\":\":\","
|
+ "\"separator\":\":\","
|
||||||
+ "\"regex\":false}";
|
+ "\"regex\":false}";
|
||||||
TestUtils.isSerializedTo(MultiValuedCellSplitOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, MultiValuedCellSplitOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -91,7 +91,7 @@ public class SplitMultiValuedCellsTests extends RefineTest {
|
|||||||
+ "\"keyColumnName\":\"Key\","
|
+ "\"keyColumnName\":\"Key\","
|
||||||
+ "\"mode\":\"lengths\","
|
+ "\"mode\":\"lengths\","
|
||||||
+ "\"fieldLengths\":[1,1]}";
|
+ "\"fieldLengths\":[1,1]}";
|
||||||
TestUtils.isSerializedTo(MultiValuedCellSplitOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, MultiValuedCellSplitOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,19 +33,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.tests.operations.cell;
|
package com.google.refine.tests.operations.cell;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.cell.TransposeRowsIntoColumnsOperation;
|
import com.google.refine.operations.cell.TransposeRowsIntoColumnsOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class TransposeTests extends RefineTest {
|
public class TransposeTests extends RefineTest {
|
||||||
|
|
||||||
@ -62,8 +59,7 @@ public class TransposeTests extends RefineTest {
|
|||||||
+ "\"description\":\"Transpose every 3 cells in column start column into separate columns\","
|
+ "\"description\":\"Transpose every 3 cells in column start column into separate columns\","
|
||||||
+ "\"columnName\":\"start column\","
|
+ "\"columnName\":\"start column\","
|
||||||
+ "\"rowCount\":3}";
|
+ "\"rowCount\":3}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, TransposeRowsIntoColumnsOperation.class), json);
|
||||||
TestUtils.isSerializedTo(TransposeRowsIntoColumnsOperation.reconstruct(project , new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ import com.google.refine.process.Process;
|
|||||||
import com.google.refine.process.ProcessManager;
|
import com.google.refine.process.ProcessManager;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class ColumnAdditionByFetchingURLsOperationTests extends RefineTest {
|
public class ColumnAdditionByFetchingURLsOperationTests extends RefineTest {
|
||||||
@ -125,12 +126,12 @@ public class ColumnAdditionByFetchingURLsOperationTests extends RefineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeColumnAdditionByFetchingURLsOperation() throws JSONException, Exception {
|
public void serializeColumnAdditionByFetchingURLsOperation() throws JSONException, Exception {
|
||||||
TestUtils.isSerializedTo(ColumnAdditionByFetchingURLsOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ColumnAdditionByFetchingURLsOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeUrlFetchingProcess() throws Exception {
|
public void serializeUrlFetchingProcess() throws Exception {
|
||||||
AbstractOperation op = ColumnAdditionByFetchingURLsOperation.reconstruct(project, new JSONObject(json));
|
AbstractOperation op = ParsingUtilities.mapper.readValue(json, ColumnAdditionByFetchingURLsOperation.class);
|
||||||
Process process = op.createProcess(project, new Properties());
|
Process process = op.createProcess(project, new Properties());
|
||||||
TestUtils.isSerializedTo(process, String.format(processJson, process.hashCode()));
|
TestUtils.isSerializedTo(process, String.format(processJson, process.hashCode()));
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package com.google.refine.tests.operations.column;
|
package com.google.refine.tests.operations.column;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.column.ColumnAdditionOperation;
|
import com.google.refine.operations.column.ColumnAdditionOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ColumnAdditionOperationTests extends RefineTest {
|
public class ColumnAdditionOperationTests extends RefineTest {
|
||||||
|
|
||||||
@ -28,7 +25,6 @@ public class ColumnAdditionOperationTests extends RefineTest {
|
|||||||
+ " \"expression\":\"grel:value.parseJson()[\\\"employment-summary\\\"].join('###')\","
|
+ " \"expression\":\"grel:value.parseJson()[\\\"employment-summary\\\"].join('###')\","
|
||||||
+ " \"onError\":\"set-to-blank\""
|
+ " \"onError\":\"set-to-blank\""
|
||||||
+ "}";
|
+ "}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ColumnAdditionOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ColumnAdditionOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package com.google.refine.tests.operations.column;
|
package com.google.refine.tests.operations.column;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.column.ColumnMoveOperation;
|
import com.google.refine.operations.column.ColumnMoveOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ColumnMoveOperationTests extends RefineTest {
|
public class ColumnMoveOperationTests extends RefineTest {
|
||||||
|
|
||||||
@ -26,7 +23,6 @@ public class ColumnMoveOperationTests extends RefineTest {
|
|||||||
+ "\"description\":\"Move column my column to position 3\","
|
+ "\"description\":\"Move column my column to position 3\","
|
||||||
+ "\"columnName\":\"my column\","
|
+ "\"columnName\":\"my column\","
|
||||||
+ "\"index\":3}";
|
+ "\"index\":3}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ColumnMoveOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ColumnMoveOperation.reconstruct(project , new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package com.google.refine.tests.operations.column;
|
package com.google.refine.tests.operations.column;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.column.ColumnRemovalOperation;
|
import com.google.refine.operations.column.ColumnRemovalOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class ColumnRemovalOperationTests extends RefineTest {
|
public class ColumnRemovalOperationTests extends RefineTest {
|
||||||
@ -26,7 +23,6 @@ public class ColumnRemovalOperationTests extends RefineTest {
|
|||||||
String json = "{\"op\":\"core/column-removal\","
|
String json = "{\"op\":\"core/column-removal\","
|
||||||
+ "\"description\":\"Remove column my column\","
|
+ "\"description\":\"Remove column my column\","
|
||||||
+ "\"columnName\":\"my column\"}";
|
+ "\"columnName\":\"my column\"}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ColumnRemovalOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ColumnRemovalOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package com.google.refine.tests.operations.column;
|
package com.google.refine.tests.operations.column;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.column.ColumnRenameOperation;
|
import com.google.refine.operations.column.ColumnRenameOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
@ -27,7 +24,10 @@ public class ColumnRenameOperationTests extends RefineTest {
|
|||||||
+ "\"description\":\"Rename column old name to new name\","
|
+ "\"description\":\"Rename column old name to new name\","
|
||||||
+ "\"oldColumnName\":\"old name\","
|
+ "\"oldColumnName\":\"old name\","
|
||||||
+ "\"newColumnName\":\"new name\"}";
|
+ "\"newColumnName\":\"new name\"}";
|
||||||
Project project = mock(Project.class);
|
JSONObject obj = new JSONObject(json);
|
||||||
TestUtils.isSerializedTo(ColumnRenameOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(new ColumnRenameOperation(
|
||||||
|
obj.getString("oldColumnName"),
|
||||||
|
obj.getString("newColumnName")
|
||||||
|
), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package com.google.refine.tests.operations.column;
|
package com.google.refine.tests.operations.column;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.column.ColumnSplitOperation;
|
import com.google.refine.operations.column.ColumnSplitOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ColumnSplitOperationTests extends RefineTest {
|
public class ColumnSplitOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -36,8 +33,7 @@ public class ColumnSplitOperationTests extends RefineTest {
|
|||||||
" \"regex\": false,\n" +
|
" \"regex\": false,\n" +
|
||||||
" \"maxColumns\": 0\n" +
|
" \"maxColumns\": 0\n" +
|
||||||
" }";
|
" }";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ColumnSplitOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ColumnSplitOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -55,7 +51,6 @@ public class ColumnSplitOperationTests extends RefineTest {
|
|||||||
" \"mode\": \"lengths\",\n" +
|
" \"mode\": \"lengths\",\n" +
|
||||||
" \"fieldLengths\": [1,1]\n" +
|
" \"fieldLengths\": [1,1]\n" +
|
||||||
" }";
|
" }";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ColumnSplitOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ColumnSplitOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ import com.google.refine.process.Process;
|
|||||||
import com.google.refine.process.ProcessManager;
|
import com.google.refine.process.ProcessManager;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class ExtendDataOperationTests extends RefineTest {
|
public class ExtendDataOperationTests extends RefineTest {
|
||||||
@ -165,12 +166,12 @@ public class ExtendDataOperationTests extends RefineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeExtendDataOperation() throws JSONException, Exception {
|
public void serializeExtendDataOperation() throws JSONException, Exception {
|
||||||
TestUtils.isSerializedTo(ExtendDataOperation.reconstruct(project, new JSONObject(operationJson)), operationJson);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(operationJson, ExtendDataOperation.class), operationJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeExtendDataProcess() throws JSONException, Exception {
|
public void serializeExtendDataProcess() throws JSONException, Exception {
|
||||||
Process p = ExtendDataOperation.reconstruct(project, new JSONObject(operationJson))
|
Process p = ParsingUtilities.mapper.readValue(operationJson, ExtendDataOperation.class)
|
||||||
.createProcess(project, new Properties());
|
.createProcess(project, new Properties());
|
||||||
TestUtils.isSerializedTo(p, String.format(processJson, p.hashCode()));
|
TestUtils.isSerializedTo(p, String.format(processJson, p.hashCode()));
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconClearSimilarCellsOperation;
|
import com.google.refine.operations.recon.ReconClearSimilarCellsOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconClearSimilarCellsOperationTests extends RefineTest {
|
public class ReconClearSimilarCellsOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -24,7 +21,6 @@ public class ReconClearSimilarCellsOperationTests extends RefineTest {
|
|||||||
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]},"
|
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]},"
|
||||||
+ "\"columnName\":\"my column\","
|
+ "\"columnName\":\"my column\","
|
||||||
+ "\"similarValue\":\"some value\"}";
|
+ "\"similarValue\":\"some value\"}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconClearSimilarCellsOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ReconClearSimilarCellsOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconCopyAcrossColumnsOperation;
|
import com.google.refine.operations.recon.ReconCopyAcrossColumnsOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconCopyAcrossColumnsOperationTests extends RefineTest {
|
public class ReconCopyAcrossColumnsOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -26,7 +23,6 @@ public class ReconCopyAcrossColumnsOperationTests extends RefineTest {
|
|||||||
+ "\"toColumnNames\":[\"first\",\"second\"],"
|
+ "\"toColumnNames\":[\"first\",\"second\"],"
|
||||||
+ "\"judgments\":[\"matched\",\"new\"],"
|
+ "\"judgments\":[\"matched\",\"new\"],"
|
||||||
+ "\"applyToJudgedCells\":true}";
|
+ "\"applyToJudgedCells\":true}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconCopyAcrossColumnsOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ReconCopyAcrossColumnsOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconDiscardJudgmentsOperation;
|
import com.google.refine.operations.recon.ReconDiscardJudgmentsOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconDiscardJudgmentsOperationTests extends RefineTest {
|
public class ReconDiscardJudgmentsOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -29,7 +26,6 @@ public class ReconDiscardJudgmentsOperationTests extends RefineTest {
|
|||||||
" \"columnName\": \"researcher\",\n" +
|
" \"columnName\": \"researcher\",\n" +
|
||||||
" \"clearData\": true\n" +
|
" \"clearData\": true\n" +
|
||||||
" }";
|
" }";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconDiscardJudgmentsOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ReconDiscardJudgmentsOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconJudgeSimilarCellsOperation;
|
import com.google.refine.operations.recon.ReconJudgeSimilarCellsOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconJudgeSimilarCellsOperationTests extends RefineTest {
|
public class ReconJudgeSimilarCellsOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -26,6 +24,6 @@ public class ReconJudgeSimilarCellsOperationTests extends RefineTest {
|
|||||||
+ "\"judgment\":\"matched\","
|
+ "\"judgment\":\"matched\","
|
||||||
+ "\"match\":{\"id\":\"Q7884717\",\"name\":\"Unicef Indonesia\",\"score\":71.42857142857143,\"types\":[\"Q43229\"]},"
|
+ "\"match\":{\"id\":\"Q7884717\",\"name\":\"Unicef Indonesia\",\"score\":71.42857142857143,\"types\":[\"Q43229\"]},"
|
||||||
+ "\"shareNewTopics\":false}";
|
+ "\"shareNewTopics\":false}";
|
||||||
TestUtils.isSerializedTo(ReconJudgeSimilarCellsOperation.reconstruct(mock(Project.class), new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconJudgeSimilarCellsOperation.class), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.google.refine.tests.operations.recon;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -26,6 +25,7 @@ import com.google.refine.operations.recon.ReconJudgeSimilarCellsOperation;
|
|||||||
import com.google.refine.process.Process;
|
import com.google.refine.process.Process;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconJudgeSimilarCellsTests extends RefineTest {
|
public class ReconJudgeSimilarCellsTests extends RefineTest {
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public class ReconJudgeSimilarCellsTests extends RefineTest {
|
|||||||
+ "\"similarValue\":\"foo\","
|
+ "\"similarValue\":\"foo\","
|
||||||
+ "\"judgment\":\"new\","
|
+ "\"judgment\":\"new\","
|
||||||
+ "\"shareNewTopics\":true}";
|
+ "\"shareNewTopics\":true}";
|
||||||
TestUtils.isSerializedTo(ReconJudgeSimilarCellsOperation.reconstruct(mock(Project.class), new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconJudgeSimilarCellsOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -61,7 +61,7 @@ public class ReconJudgeSimilarCellsTests extends RefineTest {
|
|||||||
+ "\"match\":{\"id\":\"Q42\",\"name\":\"Douglas Adams\",\"types\":[\"Q5\"],\"score\":85},"
|
+ "\"match\":{\"id\":\"Q42\",\"name\":\"Douglas Adams\",\"types\":[\"Q5\"],\"score\":85},"
|
||||||
+ "\"shareNewTopics\":false"
|
+ "\"shareNewTopics\":false"
|
||||||
+ "}";
|
+ "}";
|
||||||
TestUtils.isSerializedTo(ReconJudgeSimilarCellsOperation.reconstruct(mock(Project.class), new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconJudgeSimilarCellsOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconMarkNewTopicsOperation;
|
import com.google.refine.operations.recon.ReconMarkNewTopicsOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconMarkNewTopicsOperationTests extends RefineTest {
|
public class ReconMarkNewTopicsOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -26,7 +23,6 @@ public class ReconMarkNewTopicsOperationTests extends RefineTest {
|
|||||||
+ "\"shareNewTopics\":true,"
|
+ "\"shareNewTopics\":true,"
|
||||||
+ "\"description\":\"Mark to create new items for cells in column my column, one item for each group of similar cells\""
|
+ "\"description\":\"Mark to create new items for cells in column my column, one item for each group of similar cells\""
|
||||||
+ "}";
|
+ "}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconMarkNewTopicsOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ReconMarkNewTopicsOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconMatchBestCandidatesOperation;
|
import com.google.refine.operations.recon.ReconMatchBestCandidatesOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconMatchBestCandidatesOperationTests extends RefineTest {
|
public class ReconMatchBestCandidatesOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -28,7 +25,6 @@ public class ReconMatchBestCandidatesOperationTests extends RefineTest {
|
|||||||
+ "]},"
|
+ "]},"
|
||||||
+ "\"columnName\":\"organization_name\""
|
+ "\"columnName\":\"organization_name\""
|
||||||
+ "}";
|
+ "}";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconMatchBestCandidatesOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ReconMatchBestCandidatesOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.google.refine.tests.operations.recon;
|
package com.google.refine.tests.operations.recon;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.recon.ReconMatchSpecificTopicOperation;
|
import com.google.refine.operations.recon.ReconMatchSpecificTopicOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ReconMatchSpecificTopicOperationTests extends RefineTest {
|
public class ReconMatchSpecificTopicOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -37,7 +34,6 @@ public class ReconMatchSpecificTopicOperationTests extends RefineTest {
|
|||||||
" \"identifierSpace\": \"http://www.wikidata.org/entity/\",\n" +
|
" \"identifierSpace\": \"http://www.wikidata.org/entity/\",\n" +
|
||||||
" \"schemaSpace\": \"http://www.wikidata.org/prop/direct/\"\n" +
|
" \"schemaSpace\": \"http://www.wikidata.org/prop/direct/\"\n" +
|
||||||
" }";
|
" }";
|
||||||
Project project = mock(Project.class);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconMatchSpecificTopicOperation.class), json);
|
||||||
TestUtils.isSerializedTo(ReconMatchSpecificTopicOperation.reconstruct(project, new JSONObject(json)), json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import static org.mockito.Mockito.mock;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@ -16,6 +15,7 @@ import com.google.refine.operations.OperationRegistry;
|
|||||||
import com.google.refine.operations.recon.ReconOperation;
|
import com.google.refine.operations.recon.ReconOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class ReconOperationTests extends RefineTest {
|
public class ReconOperationTests extends RefineTest {
|
||||||
@ -74,12 +74,12 @@ public class ReconOperationTests extends RefineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeReconOperation() throws JSONException, Exception {
|
public void serializeReconOperation() throws JSONException, Exception {
|
||||||
TestUtils.isSerializedTo(ReconOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeReconProcess() throws JSONException, Exception {
|
public void serializeReconProcess() throws JSONException, Exception {
|
||||||
ReconOperation op = ReconOperation.reconstruct(project, new JSONObject(json));
|
ReconOperation op = ParsingUtilities.mapper.readValue(json, ReconOperation.class);
|
||||||
com.google.refine.process.Process process = op.createProcess(project, new Properties());
|
com.google.refine.process.Process process = op.createProcess(project, new Properties());
|
||||||
TestUtils.isSerializedTo(process, String.format(processJson, process.hashCode()));
|
TestUtils.isSerializedTo(process, String.format(processJson, process.hashCode()));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import static org.testng.Assert.assertNull;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@ -16,6 +15,7 @@ import com.google.refine.operations.OperationRegistry;
|
|||||||
import com.google.refine.operations.recon.ReconUseValuesAsIdentifiersOperation;
|
import com.google.refine.operations.recon.ReconUseValuesAsIdentifiersOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
|
|
||||||
public class ReconUseValuesAsIdsOperationTests extends RefineTest {
|
public class ReconUseValuesAsIdsOperationTests extends RefineTest {
|
||||||
@ -36,7 +36,7 @@ public class ReconUseValuesAsIdsOperationTests extends RefineTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializeReconUseValuesAsIdentifiersOperation() throws JSONException, Exception {
|
public void serializeReconUseValuesAsIdentifiersOperation() throws JSONException, Exception {
|
||||||
TestUtils.isSerializedTo(ReconUseValuesAsIdentifiersOperation.reconstruct(new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, ReconUseValuesAsIdentifiersOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -45,7 +45,7 @@ public class ReconUseValuesAsIdsOperationTests extends RefineTest {
|
|||||||
+ "Q343,hello\n"
|
+ "Q343,hello\n"
|
||||||
+ ",world\n"
|
+ ",world\n"
|
||||||
+ "Q31,test");
|
+ "Q31,test");
|
||||||
ReconUseValuesAsIdentifiersOperation op = ReconUseValuesAsIdentifiersOperation.reconstruct(new JSONObject(json));
|
ReconUseValuesAsIdentifiersOperation op = ParsingUtilities.mapper.readValue(json, ReconUseValuesAsIdentifiersOperation.class);
|
||||||
op.createProcess(project, new Properties()).performImmediate();
|
op.createProcess(project, new Properties()).performImmediate();
|
||||||
|
|
||||||
assertEquals("Q343", project.rows.get(0).cells.get(0).recon.match.id);
|
assertEquals("Q343", project.rows.get(0).cells.get(0).recon.match.id);
|
||||||
|
@ -3,7 +3,6 @@ package com.google.refine.tests.operations.row;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@ -26,6 +25,6 @@ public class DenormalizeOperationTests extends RefineTest {
|
|||||||
String json = "{"
|
String json = "{"
|
||||||
+ "\"op\":\"core/denormalize\","
|
+ "\"op\":\"core/denormalize\","
|
||||||
+ "\"description\":\"Denormalize\"}";
|
+ "\"description\":\"Denormalize\"}";
|
||||||
TestUtils.isSerializedTo(DenormalizeOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(new DenormalizeOperation(), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.google.refine.tests.operations.row;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@ -12,6 +11,7 @@ import com.google.refine.operations.OperationRegistry;
|
|||||||
import com.google.refine.operations.row.RowFlagOperation;
|
import com.google.refine.operations.row.RowFlagOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class RowFlagOperationTests extends RefineTest {
|
public class RowFlagOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -27,6 +27,6 @@ public class RowFlagOperationTests extends RefineTest {
|
|||||||
+ "\"description\":\"Flag rows\","
|
+ "\"description\":\"Flag rows\","
|
||||||
+ "\"flagged\":true,"
|
+ "\"flagged\":true,"
|
||||||
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]}}";
|
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]}}";
|
||||||
TestUtils.isSerializedTo(RowFlagOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, RowFlagOperation.class), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import static org.mockito.Mockito.mock;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@ -14,6 +13,7 @@ import com.google.refine.operations.OperationRegistry;
|
|||||||
import com.google.refine.operations.row.RowRemovalOperation;
|
import com.google.refine.operations.row.RowRemovalOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class RowRemovalOperationTests extends RefineTest {
|
public class RowRemovalOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -28,6 +28,6 @@ public class RowRemovalOperationTests extends RefineTest {
|
|||||||
+ "\"op\":\"core/row-removal\","
|
+ "\"op\":\"core/row-removal\","
|
||||||
+ "\"description\":\"Remove rows\","
|
+ "\"description\":\"Remove rows\","
|
||||||
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]}}";
|
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]}}";
|
||||||
TestUtils.isSerializedTo(RowRemovalOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, RowRemovalOperation.class), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import com.google.refine.process.Process;
|
|||||||
import com.google.refine.sorting.SortingConfig;
|
import com.google.refine.sorting.SortingConfig;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class RowReorderOperationTests extends RefineTest {
|
public class RowReorderOperationTests extends RefineTest {
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ public class RowReorderOperationTests extends RefineTest {
|
|||||||
" ]\n" +
|
" ]\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }";
|
" }";
|
||||||
TestUtils.isSerializedTo(RowReorderOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, RowReorderOperation.class), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,15 @@ package com.google.refine.tests.operations.row;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.operations.OperationRegistry;
|
import com.google.refine.operations.OperationRegistry;
|
||||||
import com.google.refine.operations.row.RowStarOperation;
|
import com.google.refine.operations.row.RowStarOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class RowStarOperationTests extends RefineTest {
|
public class RowStarOperationTests extends RefineTest {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
@ -26,6 +27,6 @@ public class RowStarOperationTests extends RefineTest {
|
|||||||
+ "\"description\":\"Star rows\","
|
+ "\"description\":\"Star rows\","
|
||||||
+ "\"starred\":true,"
|
+ "\"starred\":true,"
|
||||||
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]}}";
|
+ "\"engineConfig\":{\"mode\":\"row-based\",\"facets\":[]}}";
|
||||||
TestUtils.isSerializedTo(RowStarOperation.reconstruct(project, new JSONObject(json)), json);
|
TestUtils.isSerializedTo(ParsingUtilities.mapper.readValue(json, RowStarOperation.class), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user