1 //Prevayler(TM) - The Free-Software Prevalence Layer. 2 //Copyright (C) 2001-2003 Klaus Wuestefeld 3 //This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 4 5 package org.prevayler; 6 7 import java.io.Serializable; 8 import java.util.Date; 9 10 /** A Transaction that also returns a result or throws an Exception after executing. <br><br>A "PersonCreation" Transaction, for example, may return the Person it created. Without this, to retrieve the newly created Person, the caller would have to issue a Query like: "What was the last Person I created?". <br><br>Looking at the Prevayler demos is by far the best way to learn how to use this class. 11 * @see Transaction 12 */ 13 public interface TransactionWithQuery extends Serializable { 14 15 /** Performs the necessary modifications on the given prevalentSystem and also returns an Object or throws an Exception. 16 * This method is called by Prevayler.execute(TransactionWithQuery) to execute this TransactionWithQuery on the given Prevalent System. See org.prevayler.demos for usage examples. 17 * @param prevalentSystem The system on which this TransactionWithQuery will execute. 18 * @param executionTime The time at which this TransactionWithQuery is being executed. Every Transaction executes completely within a single moment in time. Logically, a Prevalent System's time does not pass during the execution of a Transaction. 19 */ 20 public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception; 21 22 } 23