AbstractCustomer problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

AbstractCustomer problem

I'm developing a new customer plugin for a course at my university.
Therefore I'm extending the existing AbstractCustomer class (I had to
because methods like tariffMarketService.subscribeToTariff()
depend on AbstractCustomer).
If I run a competition with AbstractCustomer and my customer the
following problem occurs:
My plugin runs as expected. The AbstractCustomer doesn't,
AbstractCustomerService always finds and runs my customer.
The reason for this is the method AbstractCustomerService.activate().
To trigger the next step the service searches instances of AbstractCustomer
using def abstractCustomerList = AbstractCustomer.list().
It looks like AbstractCustomer.list() also finds my class which extends
AbstractCustomer. A quick an dirty fix for this could be replacing the
method with something like

void activate(Instant now, int phase) {
log.info "Activate"
def abstractCustomerList = AbstractCustomer.list()
if (abstractCustomerList.size() > 0) {
if (phase == 1) {
log.info "Phase 1"
abstractCustomerList.each { customer ->
if(customer.class == AbstractCustomer) {
else {
// should never get here
log.info "Phase 2"

Reply | Threaded
Open this post in threaded view

Re: AbstractCustomer problem

Hello there.

My name is Antonios and I'm mostly responsible for the implementation of the AbstractCustomer as well as the Household Customers up to now.

I have both the household customers and the abstract customers and they seem to work just fine (the Villages are calling the step() function only once, even though you would think that they should be called twice). You can run the server and see for yourself.

I would suggest that if you want to do more thinks during each call, you better implement them in a better overriding step() function in your models, and do not change the activate function.

Every question you may have I would be glad to answer.