use of org.compiere.model.I_AD_Archive in project metasfresh-webui-api by metasfresh.
the class DocumentAttachments method deleteEntry.
public void deleteEntry(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)) {
attachmentsBL.deleteEntryForModel(recordRef, entryId);
notifyRelatedDocumentTabsChanged();
} 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());
}
InterfaceWrapperHelper.delete(archive);
} else {
throw new EntityNotFoundException(id.toJson());
}
}
use of org.compiere.model.I_AD_Archive 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