コード例 #1
0
ファイル: Transaction.java プロジェクト: youp911/modelibra
 public boolean execute() {
   boolean executed = actions.executeAll();
   if (executed) {
     setStatus("executed");
   } else {
     actions.undoAll();
   }
   return executed;
 }
コード例 #2
0
ファイル: Transaction.java プロジェクト: youp911/modelibra
 public boolean undo() {
   if (!isExecuted()) {
     String error = "A transaction must be executed first.";
     throw new RuntimeException(error);
   }
   boolean undone = actions.undoAll();
   if (undone) {
     setStatus("undone");
   } else {
     actions.executeAll();
   }
   return undone;
 }