コード例 #1
0
  public static synchronized boolean StopTransaction() {
    if (Opened && !isCanceled()) {
      try {
        session.store(transaction);
        session.commit();

      } catch (Exception e) {
        CancelTransaction("Finishing transaction error", "error in storing transaction");
        Opened = false;
        return false;
      }

      for (Command c : transaction.getCommands())
        if (c.getTargetLayer().toString().equals(CommandTargetLayer.VIEW.toString()))
          ((ModelMusts) c.getSource())
              .notifyObjectListener(
                  c.getSource(),
                  c.getType(),
                  c.getoldObjectID(),
                  c.getoldObject(),
                  c.getObject(),
                  c.getoldNeiborID(),
                  c.getOldNeibor(),
                  c.getNeibor());

      Opened = false;
      return true;

    } else Opened = false;
    return false;
  }
コード例 #2
0
  public static synchronized void addSpecialCommand(Command command) {
    AndroidTransaction transaction = new AndroidTransaction();
    transaction.getCommands().add(command);

    ObjectContainer sess = Database.OpenDB();
    sess.store(transaction);
    sess.commit();
  }
コード例 #3
0
 public synchronized List<Command> getTransactionCommands(AndroidTransaction transaction) {
   return transaction.getCommands();
 }
コード例 #4
0
 public static synchronized void AddCommand(Command command) {
   if (Opened) {
     transaction.getCommands().add(command);
   }
 }