Class BasketInvoiceRestController
java.lang.Object
sk.iway.iwcm.system.datatable.DatatableRestControllerV2<BasketInvoiceEntity,Long>
sk.iway.iwcm.components.basket.rest.BasketInvoiceRestController
@RestController
@RequestMapping("/admin/rest/eshop/basket")
@PreAuthorize("@WebjetSecurityService.hasPermission(\'cmp_basket\')")
public class BasketInvoiceRestController
extends DatatableRestControllerV2<BasketInvoiceEntity,Long>
Manages basket invoices in the administration DataTable and exposes invoice lookup options.
-
Constructor Summary
ConstructorsConstructorDescriptionBasketInvoiceRestController(BasketInvoicesRepository bir, BasketInvoiceItemsRepository biir, BasketInvoicePaymentsRepository bipr, PaymentMethodsService pms, DeliveryMethodsService dms) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSpecSearch(Map<String, String> params, List<jakarta.persistence.criteria.Predicate> predicates, jakarta.persistence.criteria.Root<BasketInvoiceEntity> root, jakarta.persistence.criteria.CriteriaBuilder builder) Adds domain isolation and combined contact-or-delivery name predicates to table search.voidafterDelete(BasketInvoiceEntity entity, long id) Removes invoice items and payments after the invoice itself is deleted.voidafterSave(BasketInvoiceEntity entity, BasketInvoiceEntity saved) Recalculates invoice totals and optionally sends the configured status notification.voidbeforeDuplicate(BasketInvoiceEntity entity) Rejects invoice duplication through the administration DataTable.booleandeleteItem(BasketInvoiceEntity entity, long id) Deletes an invoice only when it has the cancelled status.org.springframework.data.domain.Page<BasketInvoiceEntity>getAllItems(org.springframework.data.domain.Pageable pageable) Loads invoices and adds localized payment, delivery, status, and country options.getPriceInfo(Long invoiceId) insertItem(BasketInvoiceEntity entity) Rejects invoice creation through the administration DataTable.processFromEntity(BasketInvoiceEntity entity, ProcessItemAction action) Prepares editor fields and converts displayed invoice totals to the requested currency.Methods inherited from class sk.iway.iwcm.system.datatable.DatatableRestControllerV2
action, add, addNotify, addNotify, addSpecSort, afterDuplicate, afterImportChunk, allowGeneratedIdOnCreate, beforeDelete, beforeDuplicate, beforeSave, checkAccessAllowed, checkItemPerms, checkRowReorderScope, copyEntityIntoOriginal, delete, edit, editItem, findByColumns, findItemBy, getAll, getAllItemsIncludeSpecSearch, getCleanKey, getCleanValue, getCustomFieldsSearchDto, getDomainId, getImportedColumns, getImportMode, getInvalidImportedRows, getLastImportedRow, getOne, getOneItem, getOptions, getParamsMap, getProp, getRepo, getRequest, getSearchConditions, getSearchProperties, getSum, getUpdateByColumn, getUser, handleEditor, hasNotify, initBinder, isDuplicate, isExporting, isForceReload, isImporting, isSkipWrongData, jpaToBoolean, preImportDataEdit, processAction, processFromEntity, processFromEntity, processFromEntity, processToEntity, rowReorder, searchItem, setForceReload, setRedirect, setRequest, setValidator, sumItems, throwConstraintViolation, throwError, throwError, throwError, throwError, throwError, throwError, validateEditor, validateEditorForCustomFields
-
Constructor Details
-
BasketInvoiceRestController
@Autowired public BasketInvoiceRestController(BasketInvoicesRepository bir, BasketInvoiceItemsRepository biir, BasketInvoicePaymentsRepository bipr, PaymentMethodsService pms, DeliveryMethodsService dms)
-
-
Method Details
-
getAllItems
public org.springframework.data.domain.Page<BasketInvoiceEntity> getAllItems(org.springframework.data.domain.Pageable pageable) Loads invoices and adds localized payment, delivery, status, and country options.- Overrides:
getAllItemsin classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
pageable- requested page and sorting information- Returns:
- invoice page enriched with editor options
-
addSpecSearch
public void addSpecSearch(Map<String, String> params, List<jakarta.persistence.criteria.Predicate> predicates, jakarta.persistence.criteria.Root<BasketInvoiceEntity> root, jakarta.persistence.criteria.CriteriaBuilder builder) Adds domain isolation and combined contact-or-delivery name predicates to table search.- Overrides:
addSpecSearchin classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
params- submitted search parameterspredicates- predicates to extendroot- invoice query rootbuilder- criteria builder used to create predicates
-
afterSave
Recalculates invoice totals and optionally sends the configured status notification.- Overrides:
afterSavein classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
entity- submitted invoice values, including transient editor fieldssaved- persisted invoice
-
processFromEntity
Prepares editor fields and converts displayed invoice totals to the requested currency.- Overrides:
processFromEntityin classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
entity- invoice being prepared for the responseaction- DataTable action that triggered the conversion- Returns:
- prepared invoice entity
-
deleteItem
Deletes an invoice only when it has the cancelled status.- Overrides:
deleteItemin classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
entity- invoice requested for deletionid- invoice identifier- Returns:
- result of deleting the cancelled invoice
-
afterDelete
Removes invoice items and payments after the invoice itself is deleted.- Overrides:
afterDeletein classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
entity- deleted invoiceid- deleted invoice identifier
-
insertItem
Rejects invoice creation through the administration DataTable.- Overrides:
insertItemin classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
entity- submitted invoice- Returns:
- always
nullafter registering a permission error
-
beforeDuplicate
Rejects invoice duplication through the administration DataTable.- Overrides:
beforeDuplicatein classDatatableRestControllerV2<BasketInvoiceEntity,Long> - Parameters:
entity- invoice requested for duplication
-
getListOfSupportedCurrencies
-
getListOfSupportedStatuses
-
getPriceInfo
-