All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.prevayler.demos.memento.commands.AccountCreation Maven / Gradle / Ivy

The newest version!
package org.prevayler.demos.memento.commands;

import java.io.Serializable;
import org.prevayler.util.memento.MementoCollector;
import org.prevayler.util.memento.MementoTransaction;
import org.prevayler.demos.memento.Account;
import org.prevayler.demos.memento.Bank;

public class AccountCreation extends MementoTransaction {
  private final String holder;
  
  /**
   * Set by findObjects(...)
   */  
  protected transient Bank bank;
  
  public AccountCreation(String holder) {
    this.holder = holder;
  }
  
  protected void findObjects(Object prevalentSystem) {
    bank = (Bank)prevalentSystem;
  }
  
  protected void checkPrecondition() {
  }
  
  protected void createMementos(MementoCollector collector) {
    bank.createMemento(collector);
  }
  
  protected Serializable execute(MementoCollector collector) throws Account.InvalidHolder {
    return bank.createAccount(holder);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy