use of org.talend.components.google.drive.GoogleDriveMimeTypes.MimeType in project components by Talend.
the class GoogleDriveGetReader method start.
@Override
public boolean start() throws IOException {
super.start();
//
String resourceId = properties.fileAccessMethod.getValue().equals(AccessMethod.Id) ? properties.file.getValue() : utils.getFileId(properties.file.getValue());
Map<String, MimeType> mimes = GoogleDriveMimeTypes.newDefaultMimeTypesSupported();
mimes.put(MIME_TYPE_GOOGLE_DOCUMENT, properties.exportDocument.getValue());
mimes.put(MIME_TYPE_GOOGLE_DRAWING, properties.exportDrawing.getValue());
mimes.put(MIME_TYPE_GOOGLE_PRESENTATION, properties.exportPresentation.getValue());
mimes.put(MIME_TYPE_GOOGLE_SPREADSHEET, properties.exportSpreadsheet.getValue());
GoogleDriveGetParameters p = new GoogleDriveGetParameters(resourceId, mimes, properties.storeToLocal.getValue(), properties.outputFileName.getValue(), properties.setOutputExt.getValue());
//
GoogleDriveGetResult r = utils.getResource(p);
fileId = r.getId();
byte[] content = r.getContent();
record = new Record(properties.schemaMain.schema.getValue());
record.put(0, content);
result.totalCount++;
result.successCount++;
return true;
}
use of org.talend.components.google.drive.GoogleDriveMimeTypes.MimeType in project components by Talend.
the class GoogleDriveGetRuntime method getFile.
public void getFile(RuntimeContainer container) {
try {
String resourceId = properties.fileAccessMethod.getValue().equals(AccessMethod.Id) ? properties.file.getValue() : getDriveUtils().getFileId(properties.file.getValue());
Map<String, MimeType> mimes = GoogleDriveMimeTypes.newDefaultMimeTypesSupported();
mimes.put(MIME_TYPE_GOOGLE_DOCUMENT, properties.exportDocument.getValue());
mimes.put(MIME_TYPE_GOOGLE_DRAWING, properties.exportDrawing.getValue());
mimes.put(MIME_TYPE_GOOGLE_PRESENTATION, properties.exportPresentation.getValue());
mimes.put(MIME_TYPE_GOOGLE_SPREADSHEET, properties.exportSpreadsheet.getValue());
GoogleDriveGetParameters p = new GoogleDriveGetParameters(resourceId, mimes, properties.storeToLocal.getValue(), properties.outputFileName.getValue(), properties.setOutputExt.getValue());
//
GoogleDriveGetResult r = getDriveUtils().getResource(p);
fileId = r.getId();
} catch (IOException | GeneralSecurityException e) {
LOG.error(e.getMessage());
throw new ComponentException(e);
}
}
Aggregations