-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(drive): upload and download file #3872
base: main
Are you sure you want to change the base?
Conversation
d4d176c
to
4ccbc16
Compare
...ectors/google/google-drive/src/main/java/io/camunda/connector/gdrive/GoogleDriveService.java
Outdated
Show resolved
Hide resolved
...ectors/google/google-drive/src/main/java/io/camunda/connector/gdrive/GoogleDriveService.java
Outdated
Show resolved
Hide resolved
...oogle/google-drive/src/main/java/io/camunda/connector/gdrive/model/request/DownloadData.java
Outdated
Show resolved
Hide resolved
...oogle/google-drive/src/main/java/io/camunda/connector/gdrive/model/request/DownloadData.java
Outdated
Show resolved
Hide resolved
...ectors/google/google-drive/src/main/java/io/camunda/connector/gdrive/GoogleDriveService.java
Show resolved
Hide resolved
8f73cb5
to
602fb6a
Compare
602fb6a
to
d750d5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor questions
File file = createRequest.execute(); | ||
return new GoogleDriveResult(file.getId(), MimeTypeUrl.getFileUrl(file.getId())); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a log here before rethrowing? We could also add a message to this RuntimeException("the message", e)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return documentMapper.mapToDocument(outputStream.toByteArray(), fileMetaData); | ||
} | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
...ectors/google/google-drive/src/main/java/io/camunda/connector/gdrive/GoogleDriveService.java
Show resolved
Hide resolved
...ectors/google/google-drive/src/main/java/io/camunda/connector/gdrive/GoogleDriveService.java
Outdated
Show resolved
Hide resolved
Drive.Files.Create createRequest = drive.files().create(fileMetaData, content); | ||
|
||
if (document.metadata().getSize() > MAX_DIRECT_UPLOAD_FILE_SIZE_BYTES) { | ||
createRequest.getMediaHttpUploader().setProgressListener(new LoggerProgressListener()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this part, we have a MAX SIZE, but we can still upload the file if the size is exceeded? If so, we should rename the variable because it might be confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, this is done to pay tribute to the documentation. Just to show the difference between the two types uploading (multipart and resumable). But from a code point of view, everything except the listener is identical. https://developers.google.com/drive/api/guides/manage-uploads
https://developers.google.com/api-client-library/java/google-api-java-client/media-upload#implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see, then maybe just a javadoc comment on MAX_DIRECT_UPLOAD_FILE_SIZE_BYTES
explaining that beyond this size the upload is handled differently etc should be enough
public record DownloadData( | ||
@TemplateProperty( | ||
group = "operationDetails", | ||
label = "File ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no description, is it excepted or can we guide the user somehow?
.../google/google-drive/src/main/java/io/camunda/connector/gdrive/model/request/UploadData.java
Show resolved
Hide resolved
reviewing connector. |
dd46ee2
to
b4e2978
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last comment to add a javadoc comment, otherwise all green :)
b4e2978
to
d2a54e3
Compare
Description
Added the ability to download and upload files.
Related issues
issue
element-template PR
doc PR
drive.mov