use of de.metas.attachments.AttachmentEntry in project metasfresh-webui-api by metasfresh.
the class DocumentAttachments method getEntry.
public IDocumentAttachmentEntry getEntry(final DocumentId id) {
final IPair<String, Integer> prefixAndId = toPrefixAndEntryId(id);
final String idPrefix = prefixAndId.getLeft();
final int entryId = prefixAndId.getRight();
if (ID_PREFIX_Attachment.equals(idPrefix)) {
final AttachmentEntry entry = attachmentsBL.getEntryById(recordRef, entryId);
if (entry == null) {
throw new EntityNotFoundException(id.toJson());
}
return DocumentAttachmentEntry.of(id, entry);
} else if (ID_PREFIX_Archive.equals(idPrefix)) {
final I_AD_Archive archive = Services.get(IArchiveDAO.class).retrieveArchiveOrNull(Env.getCtx(), recordRef, entryId);
if (archive == null) {
throw new EntityNotFoundException(id.toJson());
}
return DocumentArchiveEntry.of(id, archive);
} else {
throw new EntityNotFoundException(id.toJson());
}
}
Aggregations