use of io.lumeer.storage.api.dao.LinkDataDao in project engine by Lumeer.
the class FileAttachmentFacade method filterLinkAttachments.
private List<FileAttachment> filterLinkAttachments(final List<FileAttachment> attachments, final String linkTypeId) {
LinkType linkType = linkTypeDao.getLinkType(linkTypeId);
Set<String> linkIds = attachments.stream().map(FileAttachment::getDocumentId).collect(Collectors.toSet());
List<LinkInstance> linkInstances = linkInstanceDao.getLinkInstances(linkIds);
Map<String, LinkInstance> linkInstanceMap = LinkInstanceUtils.loadLinkInstancesData(linkDataDao, linkType, linkInstances).stream().collect(Collectors.toMap(LinkInstance::getId, doc -> doc));
return attachments.stream().filter(fileAttachment -> permissionsChecker.canReadLinkInstance(linkType, linkInstanceMap.get(fileAttachment.getDocumentId()))).collect(Collectors.toList());
}
use of io.lumeer.storage.api.dao.LinkDataDao in project engine by Lumeer.
the class AuditFacade method getAuditRecordsForLink.
public List<AuditRecord> getAuditRecordsForLink(final String linkTypeId, final String linkInstanceId) {
final LinkType linkType = linkTypeDao.getLinkType(linkTypeId);
final LinkInstance linkInstance = LinkInstanceUtils.loadLinkInstanceWithData(linkInstanceDao, linkDataDao, linkInstanceId);
permissionsChecker.checkEditLinkInstance(linkType, linkInstance);
return auditAdapter.getAuditRecords(linkTypeId, ResourceType.LINK, linkInstanceId, getServiceLevel()).stream().peek(link -> decode(linkType, link)).collect(toList());
}
Aggregations