diff --git a/main/src/com/google/refine/operations/row/RowRemovalOperation.java b/main/src/com/google/refine/operations/row/RowRemovalOperation.java index 3445fadfe..ba2dd823f 100644 --- a/main/src/com/google/refine/operations/row/RowRemovalOperation.java +++ b/main/src/com/google/refine/operations/row/RowRemovalOperation.java @@ -33,11 +33,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.refine.operations.row; - import java.util.ArrayList; + import java.io.IOException; +import java.util.ArrayList; import java.util.List; import org.json.JSONObject; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + import com.google.refine.browsing.Engine; import com.google.refine.browsing.EngineConfig; import com.google.refine.browsing.FilteredRows; @@ -48,17 +52,17 @@ import com.google.refine.model.Project; import com.google.refine.model.Row; import com.google.refine.model.changes.RowRemovalChange; import com.google.refine.operations.EngineDependentOperation; +import com.google.refine.util.ParsingUtilities; public class RowRemovalOperation extends EngineDependentOperation { - static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception { - JSONObject engineConfig = obj.getJSONObject("engineConfig"); - - return new RowRemovalOperation( - EngineConfig.reconstruct(engineConfig) - ); + static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException { + return ParsingUtilities.mapper.readValue(obj.toString(), RowRemovalOperation.class); } - public RowRemovalOperation(EngineConfig engineConfig) { + @JsonCreator + public RowRemovalOperation( + @JsonProperty("engineConfig") + EngineConfig engineConfig) { super(engineConfig); } diff --git a/main/tests/server/src/com/google/refine/tests/operations/row/RowRemovalOperationTests.java b/main/tests/server/src/com/google/refine/tests/operations/row/RowRemovalOperationTests.java index 375e2aca9..4be80efd3 100644 --- a/main/tests/server/src/com/google/refine/tests/operations/row/RowRemovalOperationTests.java +++ b/main/tests/server/src/com/google/refine/tests/operations/row/RowRemovalOperationTests.java @@ -2,6 +2,8 @@ package com.google.refine.tests.operations.row; import static org.mockito.Mockito.mock; +import java.io.IOException; + import org.json.JSONException; import org.json.JSONObject; import org.testng.annotations.BeforeSuite; @@ -20,7 +22,7 @@ public class RowRemovalOperationTests extends RefineTest { } @Test - public void serializeRowRemovalOperation() throws JSONException, Exception { + public void serializeRowRemovalOperation() throws JSONException, IOException { Project project = mock(Project.class); String json = "{" + "\"op\":\"core/row-removal\","