use of com.formkiq.stacks.dynamodb.DocumentTagToDynamicDocumentTag in project formkiq-core by formkiq.
the class DocumentsS3Update method getObjectTags.
/**
* Get Object Tags from S3.
*
* @param s3 {@link S3Client}
* @param item {@link DocumentItem}
* @param bucket {@link String}
* @param documentId {@link String}
* @return {@link List} {@link DynamicDocumentTag}
*/
private List<DynamicDocumentTag> getObjectTags(final S3Client s3, final DocumentItem item, final String bucket, final String documentId) {
GetObjectTaggingResponse objectTags = this.s3service.getObjectTags(s3, bucket, documentId);
List<DocumentTag> tags = objectTags.tagSet().stream().map(t -> new DocumentTag(documentId, t.key(), t.value(), item.getInsertedDate(), item.getUserId())).collect(Collectors.toList());
// Any System Defined Tags in the S3 Metadata, set them to SystemDefined.
tags.stream().filter(t -> SYSTEM_DEFINED_TAGS.contains(t.getKey())).forEach(t -> t.setType(DocumentTagType.SYSTEMDEFINED));
List<DynamicDocumentTag> dtags = tags.stream().map(t -> new DocumentTagToDynamicDocumentTag().apply(t)).collect(Collectors.toList());
return dtags;
}
Aggregations