package org.prevayler.util.clock;

import java.util.Date;
import java.io.ObjectOutputStream;
import java.io.IOException;

import org.prevayler.util.clock.ClockedSystem;
import org.prevayler.util.TransactionWithQuery;
import org.prevayler.Prevayler;

public abstract class ClockedTransaction extends TransactionWithQuery {
    static final long serialVersionUID = -7058059425197071976L;

    public Date timeOfExecution;

    public Object executeUsing(Prevayler prevayler) throws Exception {
        return super.executeUsing(prevayler);
    }

    protected final Object executeAndQuery(Object prevalentSystem) throws Exception {
        ClockedSystem clockedSystem = (ClockedSystem) prevalentSystem;
        clockedSystem.advanceClockTo(timeOfExecution != null ? timeOfExecution : new Date());
        return executeClocked(clockedSystem);
    }

    protected abstract Object executeClocked(ClockedSystem clockedSystem) throws Exception;

    private void writeObject(ObjectOutputStream out) throws IOException {
        if (timeOfExecution == null) {
            timeOfExecution = new Date();
        }
        out.defaultWriteObject();
    }
}

@@ -385,21 +385,22 @@
 ;%0A%0A    p
-ublic
+rivate
  Date ti
@@ -419,132 +419,8 @@
 n;%0A%0A
-    public Object executeUsing(Prevayler prevayler) throws Exception %7B%0A        return super.executeUsing(prevayler);%0A    %7D%0A%0A
     

remove unnecessary overriding of executeUsing() method and changed "timeOfExecution" instance variable to private instead of public. No change to functionality.