Untitled

mail@pastecode.io avatar
unknown
java
a year ago
498 B
2
Indexable
Never
private void isSupplyExistentAndActive(Long id) {
        Supplies supplies = suppliesRepository
            .findById(id)
            .orElseThrow(() -> new BadRequestAlertException(Translator.toLocal("entity.not.found"), ENTITY_NAME, "idnotfound"));

        if (Objects.equals(supplies.getStatus(), Constants.STATUS.DELETE)) throw new BadRequestAlertException(
            Translator.toLocal("entity.not.active"),
            ENTITY_NAME,
            "entityNotActive"
        );
    }