Package org.springmodules.prevayler.transaction

Source Code of org.springmodules.prevayler.transaction.CompositeTransactionCommand

package org.springmodules.prevayler.transaction;

import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.prevayler.Transaction;
import org.springmodules.prevayler.callback.PrevaylerCallback;
import org.springmodules.prevayler.system.PrevalentSystem;

/**
* Composite Prevayler transaction command for executing a list of {@link org.springmodules.prevayler.PrevaylerCallback}s.
*
* @author Sergio Bossa
*/
public class CompositeTransactionCommand implements Transaction {
   
    private static final long serialVersionUID = 476105999506330034L;
   
    private List callbacks;
   
    public CompositeTransactionCommand(List callbacks) {
        this.callbacks = callbacks;
    }
   
    public void executeOn(Object object, Date date) {
        PrevalentSystem system= (PrevalentSystem) object;
        Iterator it = this.callbacks.iterator();
        while (it.hasNext()) {
            PrevaylerCallback callback = (PrevaylerCallback) it.next();
            callback.doInTransaction(system);
        }
    }
}
TOP

Related Classes of org.springmodules.prevayler.transaction.CompositeTransactionCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.