コード例 #1
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();
  }
コード例 #2
0
 public static synchronized void CancelTransaction(String ErrorTittle, String ErroMessage) {
   if (Opened) {
     Opened = false;
     TransactionCanceled = true;
     transaction.setErrorTittle(ErrorTittle);
     transaction.addErrorMessage(ErroMessage);
     session.rollback();
   }
 }
コード例 #3
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;
  }
コード例 #4
0
 public synchronized List<Command> getTransactionCommands(AndroidTransaction transaction) {
   return transaction.getCommands();
 }
コード例 #5
0
 public static synchronized void AddCommand(Command command) {
   if (Opened) {
     transaction.getCommands().add(command);
   }
 }
コード例 #6
0
 public static synchronized void ShowErrorMessage(Activity activity) {
   UtilNavigate.showWarning(
       activity, transaction.getErrorTittle(), transaction.getErrorMessage().toString());
 }