Remove AbstractOperation.reconstruct

This commit is contained in:
Antonin Delpeuch 2018-10-22 14:25:19 +01:00
parent d012ea7f8d
commit 59f322d607
5 changed files with 5 additions and 10 deletions

View File

@ -47,7 +47,6 @@ import org.json.JSONObject;
import com.google.refine.commands.Command;
import com.google.refine.model.AbstractOperation;
import com.google.refine.model.Project;
import com.google.refine.operations.OperationRegistry;
import com.google.refine.process.Process;
import com.google.refine.util.ParsingUtilities;
@ -79,7 +78,7 @@ public class ApplyOperationsCommand extends Command {
}
protected void reconstructOperation(Project project, JSONObject obj) throws IOException {
AbstractOperation operation = OperationRegistry.reconstruct(project, obj);
AbstractOperation operation = ParsingUtilities.mapper.readValue(obj.toString(), AbstractOperation.class);
if (operation != null) {
try {
Process process = operation.createProcess(project, new Properties());

View File

@ -49,7 +49,6 @@ import com.fasterxml.jackson.annotation.JsonView;
import com.google.refine.ProjectManager;
import com.google.refine.model.AbstractOperation;
import com.google.refine.model.Project;
import com.google.refine.operations.OperationRegistry;
import com.google.refine.util.JsonViews;
import com.google.refine.util.ParsingUtilities;
@ -159,7 +158,7 @@ public class HistoryEntry {
AbstractOperation operation = null;
if (obj.has(OPERATION) && !obj.isNull(OPERATION)) {
operation = OperationRegistry.reconstruct(project, obj.getJSONObject(OPERATION));
operation = ParsingUtilities.mapper.readValue(obj.getJSONObject(OPERATION).toString(), AbstractOperation.class);
}
return new HistoryEntry(

View File

@ -41,6 +41,7 @@ import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
import com.google.refine.history.HistoryEntry;
import com.google.refine.operations.OperationRegistry;
import com.google.refine.operations.OperationResolver;
import com.google.refine.process.Process;
import com.google.refine.process.QuickHistoryEntryProcess;

View File

@ -82,8 +82,4 @@ public abstract class OperationRegistry {
}
return null;
}
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
return ParsingUtilities.mapper.readValue(obj.toString(), AbstractOperation.class);
}
}

View File

@ -1,4 +1,4 @@
package com.google.refine.model;
package com.google.refine.operations;
import java.io.IOException;
@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.google.refine.operations.OperationRegistry;
import com.google.refine.model.AbstractOperation;
public class OperationResolver extends TypeIdResolverBase {