001 package videoautomat.transition;
002 import sale.Gate;
003 import sale.SaleProcess;
004 import sale.Transition;
005 import users.User;
006 import videoautomat.SaleProcessRent;
007
008 /**
009 * <code>Transition</code> that rollback the money-transactions and leads back to the
010 * {@link SaleProcessRent#getInitialGate()}
011 *
012 * @author Tobias Ruch
013 */
014 public class RentPayRollbackTransition implements Transition {
015
016 /**
017 * Performes the transition.
018 * @param sp - current process
019 * @param user - current user of this process
020 *
021 * @return the new <code>Gate</code> which should be shown after the transition
022 */
023 public Gate perform(SaleProcess sp, User user) {
024 SaleProcessRent saleProcess = (SaleProcessRent) sp;
025 saleProcess.getBasket().rollbackSubBasket(SaleProcessRent.SUB_TMP_MONEY);
026 return saleProcess.restart();
027 }
028
029 }