Fix deserialization of MassEditOperation
This commit is contained in:
parent
2873035ee2
commit
5cf58d874b
@ -77,7 +77,7 @@ public class MassEditOperation extends EngineDependentMassCellOperation {
|
|||||||
boolean fromError,
|
boolean fromError,
|
||||||
Serializable to) {
|
Serializable to) {
|
||||||
this.from = from;
|
this.from = from;
|
||||||
this.fromBlank = fromBlank;
|
this.fromBlank = fromBlank || (from.size() == 1 && from.get(0).length() == 0);
|
||||||
this.fromError = fromError;
|
this.fromError = fromError;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,16 @@ public class MassEditOperation extends EngineDependentMassCellOperation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MassEditOperation(EngineConfig engineConfig, String columnName, String expression, List<Edit> edits) {
|
@JsonCreator
|
||||||
|
public MassEditOperation(
|
||||||
|
@JsonProperty("engineConfig")
|
||||||
|
EngineConfig engineConfig,
|
||||||
|
@JsonProperty("columnName")
|
||||||
|
String columnName,
|
||||||
|
@JsonProperty("expression")
|
||||||
|
String expression,
|
||||||
|
@JsonProperty("edits")
|
||||||
|
List<Edit> edits) {
|
||||||
super(engineConfig, columnName, true);
|
super(engineConfig, columnName, true);
|
||||||
_expression = expression;
|
_expression = expression;
|
||||||
_edits = edits;
|
_edits = edits;
|
||||||
|
@ -93,7 +93,7 @@ public class MassOperationTests extends RefineTest {
|
|||||||
public void testReconstructEditDate() throws Exception {
|
public void testReconstructEditDate() throws Exception {
|
||||||
editsString = "[{\"from\":[\"2018-10-04T00:00:00Z\"],\"to\":\"newString\",\"type\":\"text\"}]";
|
editsString = "[{\"from\":[\"2018-10-04T00:00:00Z\"],\"to\":\"newString\",\"type\":\"text\"}]";
|
||||||
|
|
||||||
editList = ParsingUtilities.mapper.readValue(ParsingUtilities.evaluateJsonStringToArray(editsString).toString(), new TypeReference<List<Edit>>() {});
|
editList = ParsingUtilities.mapper.readValue(editsString, new TypeReference<List<Edit>>() {});
|
||||||
|
|
||||||
Assert.assertEquals(editList.get(0).from.get(0), "2018-10-04T00:00:00Z");
|
Assert.assertEquals(editList.get(0).from.get(0), "2018-10-04T00:00:00Z");
|
||||||
Assert.assertEquals(editList.get(0).to,"newString" );
|
Assert.assertEquals(editList.get(0).to,"newString" );
|
||||||
@ -105,7 +105,7 @@ public class MassOperationTests extends RefineTest {
|
|||||||
public void testReconstructEditEmpty() throws Exception {
|
public void testReconstructEditEmpty() throws Exception {
|
||||||
editsString = "[{\"from\":[\"\"],\"to\":\"newString\",\"type\":\"text\"}]";
|
editsString = "[{\"from\":[\"\"],\"to\":\"newString\",\"type\":\"text\"}]";
|
||||||
|
|
||||||
editList = ParsingUtilities.mapper.readValue(ParsingUtilities.evaluateJsonStringToArray(editsString).toString(), new TypeReference<List<Edit>>() {});
|
editList = ParsingUtilities.mapper.readValue(editsString, new TypeReference<List<Edit>>() {});
|
||||||
|
|
||||||
Assert.assertEquals(editList.get(0).from.size(), 1);
|
Assert.assertEquals(editList.get(0).from.size(), 1);
|
||||||
Assert.assertEquals(editList.get(0).from.get(0), "");
|
Assert.assertEquals(editList.get(0).from.get(0), "");
|
||||||
|
Loading…
Reference in New Issue
Block a user