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             * ID for Serialization.
018             */
019            private static final long serialVersionUID = -4980523266307469497L;
020    
021       /**
022        * Performes the transition.
023        * @param sp - current process
024        * @param user - current user of this process
025        * 
026        * @return the new <code>Gate</code> which should be shown after the transition    
027        */   
028       public Gate perform(SaleProcess sp, User user) {
029          SaleProcessRent saleProcess = (SaleProcessRent) sp;
030          saleProcess.getBasket().rollbackSubBasket(SaleProcessRent.SUB_TMP_MONEY);
031              return saleProcess.restart();
032       }
033    
034    }