void CommandImpl::initializeBalanceEvent(Operation* operation, Client* client) { initializeEvent(balanceEvent, operation); cassandra_exemple::OperationStatus status = operation->getStatus()->getStatus(); const Decimal& oldBalance = (status == cassandra_exemple::OperationStatus::provisioned ? client->getBalance() : client->getBalanceErp()); balanceEvent->setOldBalance(oldBalance); balanceEvent->setBalanceImpact(operation->getAmount().getValue() * operation->getDirection()); }
// Schedules an event in the event list; returns a pointer to the scheduled // event suitable for chaining if desired. Event *Events::queue(Event *event) { Event *queuedEvent; queuedEvent = _eventList.pushBack(*event).operator->(); initializeEvent(queuedEvent); return queuedEvent; }
EventColumns *Events::chain(EventColumns *eventColumns, const Event &event) { if (eventColumns == NULL) { EventColumns tmp; _eventList.push_back(tmp); eventColumns = &_eventList.back(); } eventColumns->push_back(event); initializeEvent(eventColumns->back()); return eventColumns; }
// Places a 'add_event' on the end of an event chain given by 'head_event' // (head_event may be in any position in the event chain) Event *Events::chain(Event *headEvent, Event *addEvent) { if (headEvent == NULL) { return queue(addEvent); } Event *walkEvent; for (walkEvent = headEvent; walkEvent->chain != NULL; walkEvent = walkEvent->chain) { continue; } walkEvent->chain = (Event *)malloc(sizeof(*walkEvent->chain)); *walkEvent->chain = *addEvent; initializeEvent(walkEvent->chain); return walkEvent->chain; }
void CommandImpl::initializeStatusEvent(Operation* operation) { statusEvent->setOldStatus(statusEvent->getNewStatus()); initializeEvent(statusEvent, operation); }