Ejemplo n.º 1
0
  @Override
  public void onLoad() {
    final Collection<SavedStatus> savedStatuses = new ArrayList<SavedStatus>();
    final Collection<AccountItem> accountItems = new ArrayList<AccountItem>();
    Cursor cursor = StatusTable.getInstance().list();
    try {
      if (cursor.moveToFirst()) {
        do {
          savedStatuses.add(
              new SavedStatus(
                  StatusTable.getStatusMode(cursor), StatusTable.getStatusText(cursor)));
        } while (cursor.moveToNext());
      }
    } finally {
      cursor.close();
    }

    cursor = AccountTable.getInstance().list();
    try {
      if (cursor.moveToFirst()) {
        do {
          AccountItem accountItem =
              new AccountItem(
                  AccountTable.getProtocol(cursor),
                  AccountTable.isCustom(cursor),
                  AccountTable.getHost(cursor),
                  AccountTable.getPort(cursor),
                  AccountTable.getServerName(cursor),
                  AccountTable.getUserName(cursor),
                  AccountTable.getResource(cursor),
                  AccountTable.isStorePassword(cursor),
                  AccountTable.getPassword(cursor),
                  AccountTable.getColorIndex(cursor),
                  AccountTable.getPriority(cursor),
                  AccountTable.getStatusMode(cursor),
                  AccountTable.getStatusText(cursor),
                  AccountTable.isEnabled(cursor),
                  AccountTable.isSaslEnabled(cursor),
                  AccountTable.getTLSMode(cursor),
                  AccountTable.isCompression(cursor),
                  AccountTable.getProxyType(cursor),
                  AccountTable.getProxyHost(cursor),
                  AccountTable.getProxyPort(cursor),
                  AccountTable.getProxyUser(cursor),
                  AccountTable.getProxyPassword(cursor),
                  AccountTable.isSyncable(cursor),
                  AccountTable.getKeyPair(cursor),
                  AccountTable.getLastSync(cursor),
                  AccountTable.getArchiveMode(cursor));
          accountItem.setId(AccountTable.getId(cursor));
          accountItems.add(accountItem);
        } while (cursor.moveToNext());
      }
    } finally {
      cursor.close();
    }

    Application.getInstance()
        .runOnUiThread(
            new Runnable() {
              @Override
              public void run() {
                onLoaded(savedStatuses, accountItems);
              }
            });
  }
  public AnnualOrderTableModel(ArrayList orders, AccountTable fbAccounts, AccountTable zvAccounts) {
    super();

    String[] colheads = {
      "Datum",
      "Typ",
      "Phase",
      "Besteller",
      "Auftraggeber",
      "Fachbereichshauptkonto",
      "Zentralverwaltungskonto",
      "Bestellwert",
      "Aktion"
    };

    setColumnIdentifiers(colheads);
    if (orders != null) {

      this.orders = orders;

      for (int i = 0; i < orders.size(); i++) {
        Bestellung order = (Bestellung) orders.get(i);
        Object[] data = new Object[9];

        data[0] = order.getDatum();

        if (order.getTyp() == '0') data[1] = "Standardbestellung";
        else if (order.getTyp() == '1') data[1] = "ASK-Bestellung";
        else if (order.getTyp() == '2') data[1] = "Zahlungsanforderung";
        else data[1] = "n.a.";

        if (order.getPhase() == '0') data[2] = "Sondierung";
        else if (order.getPhase() == '1') data[2] = "Abwicklung";
        else if (order.getPhase() == '2') data[2] = "Abgeschlossen";
        else if (order.getPhase() == '3') data[2] = "Storniert";
        else data[2] = "unbekannt";

        data[3] = order.getBesteller().getName() + ", " + order.getBesteller().getVorname();
        data[4] = order.getAuftraggeber().getName() + ", " + order.getAuftraggeber().getVorname();

        if (order.getFbkonto() instanceof FBHauptkonto) {
          FBHauptkonto acc = (FBHauptkonto) order.getFbkonto();
          data[5] =
              acc.getInstitut().getKostenstelle()
                  + "-"
                  + acc.getHauptkonto()
                  + "   "
                  + acc.getBezeichnung();
          fbRowReferences.add(new Integer(fbAccounts.getRowOfAccount(acc.getId())));
        } else {
          data[5] = "";
          fbRowReferences.add(new Integer(-1));
        }

        if (order.getZvtitel() instanceof ZVTitel) {
          ZVKonto acc = ((ZVTitel) order.getZvtitel()).getZVKonto();
          data[6] =
              acc.getKapitel()
                  + (acc.getTitelgruppe().equalsIgnoreCase("")
                      ? "      "
                      : "/" + acc.getTitelgruppe())
                  + "   "
                  + acc.getBezeichnung();
          zvRowReferences.add(new Integer(zvAccounts.getRowOfAccount(acc.getId())));
        } else {
          data[6] = "";
          zvRowReferences.add(new Integer(-1));
        }
        data[7] = new Float(order.getBestellwert());
        data[8] = new String("");

        addRow(data);
      }
    }
  }
Ejemplo n.º 3
0
 @Override
 public void onWipe() {
   AccountTable.getInstance().wipe();
 }