use of de.metas.ui.web.attachments.json.JSONAttachment in project metasfresh-webui-api by metasfresh.
the class DocumentAttachmentsRestController method getAttachments.
@GetMapping
public List<JSONAttachment> getAttachments(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentId) {
userSession.assertLoggedIn();
final DocumentPath documentPath = DocumentPath.rootDocumentPath(WindowId.fromJson(windowIdStr), documentId);
if (documentPath.isComposedKey()) {
// document with composed keys does not support attachments
return ImmutableList.of();
}
final boolean allowDelete = isAllowDeletingAttachments();
final List<JSONAttachment> attachments = getDocumentAttachments(documentPath).toJson();
attachments.forEach(attachment -> attachment.setAllowDelete(allowDelete));
return attachments;
}
Aggregations