Migrate gdata extension importers to Jackson
This commit is contained in:
parent
1eaadc30b7
commit
5b153dcfba
@ -40,7 +40,6 @@ import com.google.api.client.http.HttpRequestFactory;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.http.HttpTransport;
|
||||
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||
|
||||
import com.google.refine.commands.Command;
|
||||
|
||||
public class DeAuthorizeCommand extends Command {
|
||||
|
@ -32,13 +32,11 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.api.services.fusiontables.Fusiontables;
|
||||
import com.google.api.services.fusiontables.model.Column;
|
||||
import com.google.api.services.fusiontables.model.Sqlresponse;
|
||||
import com.google.api.services.fusiontables.model.Table;
|
||||
|
||||
import com.google.refine.importers.TabularImportingParserBase;
|
||||
import com.google.refine.importers.TabularImportingParserBase.TableDataReader;
|
||||
import com.google.refine.importing.ImportingJob;
|
||||
@ -60,7 +58,7 @@ public class FusionTableImporter {
|
||||
ProjectMetadata metadata,
|
||||
final ImportingJob job,
|
||||
int limit,
|
||||
JSONObject options,
|
||||
ObjectNode options,
|
||||
List<Exception> exceptions) {
|
||||
|
||||
Fusiontables service = FusionTableHandler.getFusionTablesService(token);
|
||||
@ -206,7 +204,7 @@ public class FusionTableImporter {
|
||||
ProjectMetadata metadata,
|
||||
final ImportingJob job,
|
||||
int limit,
|
||||
JSONObject options,
|
||||
ObjectNode options,
|
||||
List<Exception> exceptions) {
|
||||
|
||||
String docUrlString = JSONUtilities.getString(options, "docUrl", null);
|
||||
|
@ -5,13 +5,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import com.google.api.client.http.AbstractInputStreamContent;
|
||||
import com.google.api.client.http.ByteArrayContent;
|
||||
import com.google.api.client.http.HttpResponseException;
|
||||
import com.google.api.services.fusiontables.Fusiontables;
|
||||
|
||||
import com.google.refine.exporters.CustomizableTabularExporterConfiguration;
|
||||
import com.google.refine.exporters.TabularSerializer;
|
||||
|
||||
final class FusionTableSerializer implements TabularSerializer {
|
||||
|
@ -6,15 +6,14 @@ import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.api.services.sheets.v4.Sheets;
|
||||
import com.google.api.services.sheets.v4.model.Sheet;
|
||||
import com.google.api.services.sheets.v4.model.Spreadsheet;
|
||||
import com.google.api.services.sheets.v4.model.ValueRange;
|
||||
|
||||
import com.google.refine.importers.TabularImportingParserBase;
|
||||
import com.google.refine.importers.TabularImportingParserBase.TableDataReader;
|
||||
import com.google.refine.importing.ImportingJob;
|
||||
@ -31,7 +30,7 @@ public class GDataImporter {
|
||||
ProjectMetadata metadata,
|
||||
final ImportingJob job,
|
||||
int limit,
|
||||
JSONObject options,
|
||||
ObjectNode options,
|
||||
List<Exception> exceptions) throws IOException {
|
||||
|
||||
String docType = JSONUtilities.getString(options, "docType", null);
|
||||
@ -64,7 +63,7 @@ public class GDataImporter {
|
||||
ProjectMetadata metadata,
|
||||
final ImportingJob job,
|
||||
int limit,
|
||||
JSONObject options,
|
||||
ObjectNode options,
|
||||
List<Exception> exceptions) {
|
||||
|
||||
String docUrlString = JSONUtilities.getString(options, "docUrl", null);
|
||||
@ -100,7 +99,7 @@ public class GDataImporter {
|
||||
URL docURL,
|
||||
int worksheetIndex,
|
||||
int limit,
|
||||
JSONObject options,
|
||||
ObjectNode options,
|
||||
List<Exception> exceptions) {
|
||||
|
||||
try {
|
||||
|
@ -18,7 +18,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.api.services.drive.Drive;
|
||||
import com.google.api.services.drive.model.File;
|
||||
import com.google.api.services.drive.model.FileList;
|
||||
@ -29,7 +29,6 @@ import com.google.api.services.fusiontables.model.TableList;
|
||||
import com.google.api.services.sheets.v4.Sheets;
|
||||
import com.google.api.services.sheets.v4.model.Sheet;
|
||||
import com.google.api.services.sheets.v4.model.Spreadsheet;
|
||||
|
||||
import com.google.refine.ProjectManager;
|
||||
import com.google.refine.RefineServlet;
|
||||
import com.google.refine.commands.HttpUtilities;
|
||||
@ -237,7 +236,7 @@ public class GDataImportingController implements ImportingController {
|
||||
|
||||
job.updating = true;
|
||||
try {
|
||||
JSONObject optionObj = ParsingUtilities.evaluateJsonStringToObject(
|
||||
ObjectNode optionObj = ParsingUtilities.evaluateJsonStringToObjectNode(
|
||||
request.getParameter("options"));
|
||||
|
||||
List<Exception> exceptions = new LinkedList<Exception>();
|
||||
@ -301,7 +300,7 @@ public class GDataImportingController implements ImportingController {
|
||||
|
||||
job.updating = true;
|
||||
try {
|
||||
final JSONObject optionObj = ParsingUtilities.evaluateJsonStringToObject(
|
||||
final ObjectNode optionObj = ParsingUtilities.evaluateJsonStringToObjectNode(
|
||||
request.getParameter("options"));
|
||||
|
||||
final List<Exception> exceptions = new LinkedList<Exception>();
|
||||
|
@ -25,7 +25,6 @@ import com.google.api.services.drive.DriveScopes;
|
||||
import com.google.api.services.fusiontables.FusiontablesScopes;
|
||||
import com.google.api.services.sheets.v4.Sheets;
|
||||
import com.google.api.services.sheets.v4.SheetsScopes;
|
||||
|
||||
import com.google.refine.ProjectManager;
|
||||
import com.google.refine.preference.PreferenceStore;
|
||||
import com.google.refine.util.ParsingUtilities;
|
||||
|
@ -10,7 +10,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import com.google.api.services.sheets.v4.Sheets;
|
||||
import com.google.api.services.sheets.v4.model.AppendCellsRequest;
|
||||
import com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest;
|
||||
@ -18,8 +17,6 @@ import com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetResponse;
|
||||
import com.google.api.services.sheets.v4.model.ExtendedValue;
|
||||
import com.google.api.services.sheets.v4.model.Request;
|
||||
import com.google.api.services.sheets.v4.model.RowData;
|
||||
|
||||
import com.google.refine.exporters.CustomizableTabularExporterConfiguration;
|
||||
import com.google.refine.exporters.TabularSerializer;
|
||||
|
||||
final class SpreadsheetSerializer implements TabularSerializer {
|
||||
|
@ -14,19 +14,17 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
|
||||
import com.google.api.client.http.FileContent;
|
||||
import com.google.api.services.drive.Drive;
|
||||
import com.google.api.services.drive.model.File;
|
||||
import com.google.api.services.drive.model.File.ContentHints;
|
||||
import com.google.api.services.drive.model.File.ContentHints.Thumbnail;
|
||||
|
||||
import com.google.refine.ProjectManager;
|
||||
import com.google.refine.browsing.Engine;
|
||||
import com.google.refine.commands.Command;
|
||||
|
Loading…
Reference in New Issue
Block a user