Interface OrderService

    • Method Detail

      • calculateOrder

        @Deprecated(since="ages",
                    forRemoval=true)
        boolean calculateOrder​(AbstractOrderModel order)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since ages - UseCalculationService to calculate orders.
        Calculates the given order and returns true if each entry and after this the AbstractOrderModel was calculated. Thereby any invalid entry will be automatically removed.

        The default implementation delegates to the OrderCalculation.calculate(AbstractOrderModel) strategy. Please check the API doc of your current calculation strategy.

        Parameters:
        order - the AbstractOrderModel
        Returns:
        false if the order was already calculated.
      • addNewEntry

        OrderEntryModel addNewEntry​(OrderModel order,
                                    ProductModel product,
                                    long qty,
                                    UnitModel unit,
                                    int number,
                                    boolean addToPresent)
        Adds a new order entry to the given order on the required entry number. The new entry is neither saved nor calculated. If requested entryNumber collide with existing entry, an AmbiguousIdentifierException will be thrown.
        Specified by:
        addNewEntry in interface AbstractOrderService<OrderModel,​OrderEntryModel>
        Parameters:
        order - - target order
        product - -product to add, must not be null
        qty - - quantity
        unit - - must not be null
        number - - entry number of the new entry in the order. Entries are indexed starting from 0. Set number to -1 if you want to append the entry as the last one. You can request any non-negative, that is not already occupied by existing order entry.
        addToPresent - - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created
        Returns:
        AbstractOrderEntryModel - newly created order entry
        Throws:
        java.lang.IllegalArgumentException - if either order or product is null or quantity is negative.
        AmbiguousIdentifierException - if there is already entry with the requested number.
        See Also:
        AbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)
      • addNewEntry

        AbstractOrderEntryModel addNewEntry​(ComposedTypeModel entryType,
                                            OrderModel order,
                                            ProductModel product,
                                            long qty,
                                            UnitModel unit,
                                            int number,
                                            boolean addToPresent)
        Adds a new entry of the given ComposedTypeModel to the given order. The new entry is neither saved nor calculated. If requested entryNumber collide with existing entry, an AmbiguousIdentifierException will be thrown.
        Specified by:
        addNewEntry in interface AbstractOrderService<OrderModel,​OrderEntryModel>
        Parameters:
        entryType - - the requested sub-type AbstractOrderEntry
        order - - target order
        product - -product to add, must not be null
        qty - - quantity
        unit - - must not be null
        number - - entry number of the new entry in the order. Entries are indexed starting from 0. Set number to -1 if you want to append the entry as the last one. You can request any non-negative, that is not already occupied by existing order entry.
        addToPresent - - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created
        Returns:
        AbstractOrderEntryModel - newly created order entry
        Throws:
        java.lang.IllegalArgumentException - if either entryType or order or product is null or quantity is negative.
        AmbiguousIdentifierException - if there is already entry with the requested number.