-
Notifications
You must be signed in to change notification settings - Fork 9
[Java] Support Upload status in Attachments #394
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
base: develop
Are you sure you want to change the base?
Conversation
sdm/src/main/java/com/sap/cds/sdm/handler/applicationservice/SDMReadAttachmentsHandler.java
Fixed
Show fixed
Hide fixed
sdm/src/main/java/com/sap/cds/sdm/handler/applicationservice/SDMReadAttachmentsHandler.java
Fixed
Show fixed
Hide fixed
| "\"%s\" contains unsupported characters (‘/’ or ‘\\’). Rename and try again."; | ||
| public static final String SINGLE_DUPLICATE_FILENAME = | ||
| "An object named \"%s\" already exists. Rename the object and try again."; | ||
| public static final String VIRUS_DETECTED_ERROR_MSG = |
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.
Don't these messages to support internationalisation?
| && cmisDocument | ||
| .getUploadStatus() | ||
| .equalsIgnoreCase(SDMConstants.UPLOAD_STATUS_VIRUS_DETECTED)) | ||
| throw new ServiceException("Virus Detected in this file kindly delete it."); |
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.
Please update the error messages to use the SDMErrorMessages file and make it compatible for internationalisation
| long totalSize = cmisDocument.getContentLength(); | ||
| int chunkSize = SDMConstants.CHUNK_SIZE; | ||
|
|
||
| CdsModel model = eventContext.getModel(); |
|
|
||
| @Before | ||
| @HandlerOrder(OrderConstants.Before.CHECK_CAPABILITIES) | ||
| void processBeforeForDraft(CdsCreateEventContext context, List<CdsData> data) { |
|
|
||
| @Before | ||
| @HandlerOrder(OrderConstants.Before.CHECK_CAPABILITIES) | ||
| void processBeforeForDraft(CdsCreateEventContext context, List<CdsData> data) { |
|
|
||
| @Before | ||
| @HandlerOrder(OrderConstants.Before.CHECK_CAPABILITIES) | ||
| void processBeforeForDraft(CdsCreateEventContext context, List<CdsData> data) { |
|
|
||
| @Before | ||
| @HandlerOrder(OrderConstants.Before.CHECK_CAPABILITIES) | ||
| void processBeforeForDraft(CdsCreateEventContext context, List<CdsData> data) { |
| String sdmUrl, | ||
| int chunkSize, | ||
| boolean isSystemUser, | ||
| CdsEntity entity, |
| int chunkSize, | ||
| boolean isSystemUser, | ||
| CdsEntity entity, | ||
| PersistenceService persistenceService) |
| Result r = | ||
| dbQuery.updateUploadStatusByScanStatus( | ||
| attachmentDraftEntity, persistenceService, objectId, scanStatusEnum); |
| doc.get("uploadStatus") | ||
| .eq(SDMConstants.UPLOAD_STATUS_IN_PROGRESS)))); | ||
|
|
||
| Result r = persistenceService.run(updateQuery); |
| SDMAttachmentsService service = spy(new SDMAttachmentsService()); | ||
| doNothing().when(service).emit(any()); | ||
| CreateAttachmentInput input = mock(CreateAttachmentInput.class); | ||
| MediaData mediaData = MediaData.create(); |
Describe your changes
As a user of CAP Application, I am able to see the status of upload of attachments so that I have transparency of documents in the SDM Backend.
SDM backend is implementing async virus scan on documents when they are uploaded on object store using Trend Micro scan. This is planned specifically for large files as Malware service has a limitation of 400 MB. SDM Tenants will have one bucket per tenant and Trend Micro is a bucket configuration. Currently this is scan only supported in GCP.
As a plugin, we will have a generic column for upload status. This will be a common and general behavior irrespective of the virus scan feature and data center.
This column will show the status for all the below use cases
Upload of attachment (Success)
Malware scanning service result (Virus scanning in Progress, Virus detected?, Success)
Trend Micro (Virus scanning in Progress, Virus detected, Success)
Any documentation
Type of change
Please delete options that are not relevant.
Checklist before requesting a review
Upload Screenshots/lists of the scenarios tested