Package net.sourceforge.wampum.finance.entities

Examples of net.sourceforge.wampum.finance.entities.Account


      boolean isSelected, int row, int column) {
    if (value == null)
      return this;
    boolean found = false;
    int count = 0;
    Account listAccount = null;
    while (!found && count<accountList.size()) {
      listAccount = (Account)accountList.get(count);
      if (listAccount.getAccountID().equals(((Account)value).getAccountID())) {
        found = true;
        this.setSelectedIndex(count);
      }
      count++;
    }
View Full Code Here


                    transSplit.setParentTransaction(null);

                resultSet.getString("ACCOUNT_ID");
                if (!resultSet.wasNull()) {
                    if (lazyLoad) {
                        Account parentAccount = new Account();
                        parentAccount.setAccountID(new String(resultSet.getString("ACCOUNT_ID")));
                        transSplit.setAccount(parentAccount);
                    }
                    else {
                        String accountID = new String(resultSet.getString("ACCOUNT_ID"));
                        if (!resultSet.wasNull()) {
                            String accountWhere = "WHERE ACCOUNT_ID = '" + accountID.toString() + "' ";
                            DAO dao = daoFactory.getDAO("account");
                            List accountList = dao.load(accountWhere, null, true);
                            if (accountList.size()>0) {
                                Account parentAccount = (Account)accountList.get(0);
                                transSplit.setAccount(parentAccount);
                            }
                       }
                    }
                }
View Full Code Here

  public TransactionController(JPanel contentPanel, AccountsController accountsController) {
    super();
    this.accountsController = accountsController;
    this.contentPanel = contentPanel;
    this.trans = new Transaction();
    this.account = new Account();
    initGUI();
  }
View Full Code Here

      public void setValueAt(Object value, int row, int column) {
        if (row >= transSplitList.size()) {
          transSplit = new TransSplit();
          transSplit.setAmount(new Double(0));
          if (column == 1) {
            Account account = (Account)value;
            transSplit.setAccount(account);
          }
          else if (column == 2) {
            if (value == null)
              transSplit.setAmount(new Double(0));
            else
              transSplit.setAmount((Double)value);
          }
          else if (column == 3) {
            if (value == null)
              transSplit.setAmount(null);
            else
              transSplit.setAmount(new Double(-((Double)value).doubleValue()));
          }
          transSplitList.add(transSplit);
        }
        else {
          transSplit = (TransSplit)transSplitList.get(row);
          if (column == 0) {
            transSplitList.remove(row);
            fireTableDataChanged();
//            splitTable.updateUI();
          }
          else if (column == 1) {
            Account account = (Account)value;
            transSplit.setAccount(account);
          }
          else if (column == 2) {
            if (value == null &&
                transSplit.getAmount() != null &&
View Full Code Here

    public void setAccountID(Account account) {
        this.accountID = account;
    }

    public void setAccountIDAccountID(String accountID) {
        Account account = new Account();
        account.setAccountID(accountID);
        this.accountID = account;
    }
View Full Code Here

              if (!createTrans)
                return;
            }
           
            AccountDAO accountDAO = (AccountDAO)factory.getDAO("account");
            Account newAccount = (Account)accountDAO.load("WHERE TITLE = 'Imbalance-USD'", null, true).get(0);
            TransSplit transSplit = new TransSplit();
            transSplit.setParentTransaction(trans);
            Account account = new Account();
            account.setAccountID(accountID);
            transSplit.setAccount(account);
            transSplit.setAmount(new Double(amount));
            trans.appendTransSplit(transSplit);
         
            TransSplit newSplit = new TransSplit();
View Full Code Here

              trans.appendTransSplit(newSplit);
            }
          }
          else {
            AccountDAO accountDAO = (AccountDAO)factory.getDAO("account");
            Account newAccount = (Account)accountDAO.load("WHERE TITLE = 'Imbalance-USD'", null, true).get(0);
            TransSplit transSplit = new TransSplit();
            transSplit.setParentTransaction(trans);
            Account account = new Account();
            account.setAccountID(accountID);
            transSplit.setAccount(account);
            transSplit.setAmount(new Double(amount));
            trans.appendTransSplit(transSplit);
         
            TransSplit newSplit = new TransSplit();
View Full Code Here

 
  public void startElement(String uri, String localName, String qName,
      Attributes atts) throws SAXException {
    if (qName.equalsIgnoreCase("gnc:account")) {
      recordType = "account";
      currentAccount = new Account();
    }
    else if (qName.equalsIgnoreCase("gnc:transaction")) {
      recordType = "transaction";
      currentTransaction = new Transaction();
      transSplitList = new ArrayList();
View Full Code Here

        }
        else if (qName.equalsIgnoreCase("act:description")) {
          currentAccount.setDescription(tagData);
        }
        else if (qName.equalsIgnoreCase("act:parent")) {
          Account parent = new Account();
          parent.setAccountID(tagData);
          currentAccount.setParentAccount(parent);
        }
      }
      else if (recordType.equalsIgnoreCase("transaction")) {
        if (subRecordType.equalsIgnoreCase("date-posted")) {
          if (qName.equalsIgnoreCase("ts:date")) {
            currentTransaction.setDatePosted(convertToCalendar(tagData));
          }
          subRecordType = "";
        }
        else if (subRecordType.equalsIgnoreCase("date-entered")) {
          if (qName.equalsIgnoreCase("ts:date")) {
            currentTransaction.setDateEntered(convertToCalendar(tagData));
          }
          subRecordType = "";
        }
        else {
          if (qName.equalsIgnoreCase("trn:id")) {
            currentTransaction.setTransactionID(tagData);
          }
          else if (qName.equalsIgnoreCase("trn:description")) {
            currentTransaction.setDescription(tagData);
          }
          else if (qName.equalsIgnoreCase("slot:key")) {
            slotKey = tagData;
          }
          else if (qName.equalsIgnoreCase("slot:value")) {
            slotValue = tagData;
          }
          else if (qName.equalsIgnoreCase("slot")) {
            if (slotKey != null && slotKey.equalsIgnoreCase("online_id")) {
              currentTransaction.setFitID(slotValue);
            }
            else if (slotKey != null && slotKey.equalsIgnoreCase("notes")) {
              currentTransaction.setMemo(slotValue);
            }
          }
        }
      }
      else if (recordType.equalsIgnoreCase("split")) {
        if (subRecordType.equalsIgnoreCase("reconcile-date")) {
          if (qName.equalsIgnoreCase("ts:date")) {
            currentTransSplit.setReconcileDate(convertToCalendar(tagData));
          }
          subRecordType = "";
        }
        else {
          if (qName.equalsIgnoreCase("split:id")) {
            currentTransSplit.setTransSplitID(tagData);
          }
          else if (qName.equalsIgnoreCase("split:memo")) {
            currentTransSplit.setMemo(tagData);
          }
          else if (qName.equalsIgnoreCase("split:reconciled-state")) {
            currentTransSplit.setReconciledState(tagData);
          }
          else if (qName.equalsIgnoreCase("split:value")) {
            String[] amountStrings = tagData.split("/");
            Double amount = new Double(Double.parseDouble(amountStrings[0]) / Double.parseDouble(amountStrings[1]));
            currentTransSplit.setAmount(amount);
          }
          else if (qName.equalsIgnoreCase("split:account")) {
            Account account = new Account();
            account.setAccountID(tagData);
            currentTransSplit.setAccount(account);
          }
        }
      }
    }
View Full Code Here

        return newDocument;
    }

    public static Account loadFromXML(Document dom) {
        Account retVal = new Account();
        Element root = dom.getDocumentElement();
        if (!root.getTagName().equals("Account"))
           return retVal;

        NodeList childNodes = root.getChildNodes();
        Node childNode = null;
        String tagName = null;
        String nodeValue = null;
        for (int i=0; i<childNodes.getLength(); i++) {
          childNode = childNodes.item(i);
          if (childNode.getNodeName().equalsIgnoreCase("#text"))
            continue;
          tagName = childNode.getNodeName();
          if (childNode.getFirstChild() != null)
            nodeValue = childNode.getFirstChild().getNodeValue();
          else
            nodeValue = null;
            if (tagName.equals("accountID")) {
                retVal.setAccountID(nodeValue);
            }
            else if (tagName.equals("title")) {
                retVal.setTitle(nodeValue);
            }
            else if (tagName.equals("accountType")) {
                retVal.setAccountType(nodeValue);
            }
            else if (tagName.equals("description")) {
                retVal.setDescription(nodeValue);
            }
            else if (tagName.equals("openBalance")) {
                retVal.setOpenBalance((nodeValue != null ? new Double(nodeValue) : null));
            }
            else if (tagName.equals("active")) {
                retVal.setActive(new Boolean((nodeValue != null && nodeValue.equalsIgnoreCase("true")?true:false)));
            }
            else if (tagName.equals("lastUpdate")) {
                retVal.setLastUpdate((nodeValue != null ? CalendarUtil.parseDate(nodeValue):null));
            }
            else if (tagName.equals("lastUserID")) {
                retVal.setLastUserID((nodeValue != null ? new Integer(nodeValue) : null));
            }
            else if (tagName.equals("accountList")) {
                NodeList accountNodes = childNode.getChildNodes();
                for (int j=0; j<accountNodes.getLength(); j++) {
                   Node accountNode = accountNodes.item(j);
                   if (accountNode.getNodeName().equalsIgnoreCase("Account")) {
                        Document accountDoc = XMLUtil.newDocument(accountNode);
                     Account account = AccountXML.loadFromXML(accountDoc);
                     retVal.appendAccount(account);
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.wampum.finance.entities.Account

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.