Class

ReceivedOrderManager

Managers.ReceivedOrderManager(participantManager, callbackopt)

Constructor

# new ReceivedOrderManager(participantManager, callbackopt)

Received Order Manager Class - concrete OrderManager for receivedOrders.

Received Order Manager Class - concrete OrderManager for receivedOrders.

Manager Classes in this context should do the bridge between the controllers and the services exposing only the necessary api to the controllers while encapsulating all business logic.

All Manager Classes should be singletons.

This complete separation of concerts is very beneficial for 2 reasons:

  • Allows for testing since there's no browser dependent code (i think) since the DSUStorage can be 'mocked'
  • Allows for different controllers access different business logic when necessary (while benefiting from the singleton behaviour)
Parameters:
Name Type Attributes Description
participantManager ParticipantManager
callback function <optional>

optional callback for when the assurance that the table has already been indexed is required.

View Source managers/ReceivedOrderManager.js, line 7

Extends

Methods

# protected _genCompostKey(otherActorId, orderId) → {string}

generates the db's key for the Order

.

generates the db's key for the Order

Parameters:
Name Type Description
otherActorId string | number
orderId string | number
Inherited From:

View Source managers/OrderManager.js, line 44

string

# protected _getDSUInfo(keySSI, callback)

Util function that loads a OrderDSU and reads its information

.

Util function that loads a OrderDSU and reads its information

Parameters:
Name Type Description
keySSI string | KeySSI
callback function
Inherited From:

View Source managers/OrderManager.js, line 55

# protected _indexItem(key, item, record) → {object}

Must wrap the entry in an object like:

    {
        index1: ...

Must wrap the entry in an object like:

    {
        index1: ...
        index2: ...
        value: item
    }

so the DB can be queried by each of the indexes and still allow for lazy loading

Parameters:
Name Type Description
key string
item Order
record string | object
Inherited From:

View Source managers/OrderManager.js, line 76

the indexed object to be stored in the db

object

# fromModel(model) → {Order}

Convert the OrderController view model into an Order.

Convert the OrderController view model into an Order.

Parameters:
Name Type Description
model
Inherited From:

View Source managers/OrderManager.js, line 143

Order

# toModel(object, model) → {Object}

Convert an Order into a OrderControler view model.

Convert an Order into a OrderControler view model. The order.orderLines are converted to a special format. See locale.js

Parameters:
Name Type Description
object Order

the business model object

model

the Controller's model object

Inherited From:

View Source managers/OrderManager.js, line 171

Object

# update(keyopt, newOrder, callback)

updates an item

.

updates an item

Parameters:
Name Type Attributes Description
key string <optional>

key is optional so child classes can override them

newOrder object
callback function
Inherited From:

View Source managers/OrderManager.js, line 92