package uk.org.sappho.kmymoney.data;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;

import uk.org.sappho.kmymoney.rawdata.DataNode;
import uk.org.sappho.kmymoney.rawdata.DataNodeException;
import uk.org.sappho.kmymoney.rawdata.Value;

public class KMyMoneyData {

    private final AccountGroup accounts;
    private final PayeeGroup payees;
    private final TransactionGroup transactions;
    private final CurrencyGroup currencies;
    private final PriceGroup prices;
    private final Value lastUpdated;
    private final long version;
    private final long fixVersion;

    public KMyMoneyData(DataNode node) throws DataNodeException, IllegalArgumentException,
            SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {

        node.checkTag("KMYMONEY-FILE");
        accounts = new AccountGroup(node.getChildNode(AccountGroup.tag));
        payees = new PayeeGroup(node.getChildNode(PayeeGroup.tag));
        transactions = new TransactionGroup(node.getChildNode(TransactionGroup.tag));
        currencies = new CurrencyGroup(node.getChildNode(CurrencyGroup.tag));
        prices = new PriceGroup(node.getChildNode(PriceGroup.tag));
        DataNode infoNode = node.getChildNode("FILEINFO");
        lastUpdated = infoNode.getChildNode("LAST_MODIFIED_DATE").getAttribute("date");
        version = infoNode.getChildNode("VERSION").getAttribute("id").getLong();
        fixVersion = infoNode.getChildNode("FIXVERSION").getAttribute("id").getLong();
    }

    public AccountGroup getAccounts() {

        return accounts;
    }

    public PayeeGroup getPayees() {

        return payees;
    }

    public TransactionGroup getTransactions() {

        return transactions;
    }

    public CurrencyGroup getCurrencies() {

        return currencies;
    }

    public PriceGroup getPrices() {

        return prices;
    }

    public Date getLastUpdated() throws DataNodeException {

        return lastUpdated.getDate();
    }

    public long getVersion() throws DataNodeException {

        return version;
    }

    public long getFixVersion() throws DataNodeException {

        return fixVersion;
    }
}

@@ -284,16 +284,37 @@
 neyData 
+extends AbstractItem 
 %7B%0A%0A    p
@@ -867,37 +867,18 @@
     
-node.checkTag(%22KMYMONEY-FILE%22
+super(node
 );%0A 
@@ -2228,11 +2228,97 @@
 n;%0A    %7D
+%0A%0A    @Override%0A    protected String getTag() %7B%0A%0A        return %22KMYMONEY-FILE%22;%0A    %7D
 %0A%7D%0A

Set up basics of kmymoney4j.