Search in sources :

Example 1 with ImportSecurity

use of jgnash.convert.importat.ImportSecurity in project jgnash by ccavanaugh.

the class OfxV2Parser method parseSecurity.

private void parseSecurity(final XMLStreamReader reader) throws XMLStreamException {
    logger.entering(OfxV2Parser.class.getName(), "parseSecurity");
    final QName parsingElement = reader.getName();
    final ImportSecurity importSecurity = new ImportSecurity();
    parse: while (reader.hasNext()) {
        final int event = reader.next();
        switch(event) {
            case XMLStreamConstants.START_ELEMENT:
                switch(reader.getLocalName()) {
                    case FIID:
                    case // consume it:
                    SECID:
                        break;
                    case UNIQUEIDTYPE:
                        importSecurity.idType = reader.getElementText().trim();
                        break;
                    case UNIQUEID:
                        importSecurity.setId(reader.getElementText().trim());
                        break;
                    case SECNAME:
                        importSecurity.setSecurityName(reader.getElementText().trim());
                        break;
                    case TICKER:
                        importSecurity.setTicker(reader.getElementText().trim());
                        break;
                    case UNITPRICE:
                        importSecurity.setUnitPrice(parseAmount(reader.getElementText()));
                        break;
                    case DTASOF:
                        importSecurity.setLocalDate(parseDate(reader.getElementText()));
                        break;
                    // consume the currency aggregate for unit price and handle here
                    case CURRENCY:
                    case ORIGCURRENCY:
                        break;
                    case // consume, not used
                    RATING:
                        break;
                    case CURSYM:
                        importSecurity.setCurrency(reader.getElementText().trim());
                        break;
                    case CURRATE:
                        importSecurity.setCurrencyRate(parseAmount(reader.getElementText()));
                        break;
                    default:
                        logger.log(Level.WARNING, "Unknown SECINFO element: {0}", reader.getLocalName());
                        break;
                }
                break;
            case XMLStreamConstants.END_ELEMENT:
                if (reader.getName().equals(parsingElement)) {
                    logger.fine("Found the end of the security info");
                    break parse;
                }
            default:
        }
    }
    bank.addSecurity(importSecurity);
    logger.exiting(OfxV2Parser.class.getName(), "parseSecurity");
}
Also used : QName(javax.xml.namespace.QName) ImportSecurity(jgnash.convert.importat.ImportSecurity)

Example 2 with ImportSecurity

use of jgnash.convert.importat.ImportSecurity in project jgnash by ccavanaugh.

the class OfxBank method toString.

@Override
public String toString() {
    StringBuilder b = new StringBuilder();
    b.append("statusCode: ").append(statusCode).append('\n');
    b.append("statusSeverity: ").append(statusSeverity).append('\n');
    b.append("statusMessage: ").append(statusMessage).append('\n');
    b.append("currency: ").append(currency).append('\n');
    b.append("bankId: ").append(bankId).append('\n');
    b.append("branchId: ").append(branchId).append('\n');
    b.append("accountId: ").append(accountId).append('\n');
    b.append("accountType: ").append(accountType).append('\n');
    b.append("dateStart: ").append(dateStart).append('\n');
    b.append("dateEnd: ").append(dateEnd).append('\n');
    b.append("ledgerBalance: ").append(ledgerBalance).append('\n');
    b.append("ledgerBalanceDate: ").append(ledgerBalanceDate).append('\n');
    if (availBalance != null) {
        b.append("availBalance: ").append(availBalance).append('\n');
    }
    if (availBalanceDate != null) {
        b.append("availBalanceDate: ").append(availBalanceDate).append('\n');
    }
    for (final ImportTransaction t : getTransactions()) {
        b.append(t).append('\n');
    }
    for (final ImportSecurity importSecurity : securityList) {
        b.append(importSecurity.toString()).append('\n');
    }
    return b.toString();
}
Also used : ImportSecurity(jgnash.convert.importat.ImportSecurity) ImportTransaction(jgnash.convert.importat.ImportTransaction)

Aggregations

ImportSecurity (jgnash.convert.importat.ImportSecurity)2 QName (javax.xml.namespace.QName)1 ImportTransaction (jgnash.convert.importat.ImportTransaction)1