Search in sources :

Example 1 with DestatisCPIFeed

use of name.abuchen.portfolio.online.DestatisCPIFeed in project portfolio by buchen.

the class UpdateCPIJob method run.

@Override
protected IStatus run(IProgressMonitor monitor) {
    monitor.beginTask(Messages.JobLabelUpdateCPI, 1);
    CPIFeed feed = new DestatisCPIFeed();
    List<IStatus> errors = new ArrayList<IStatus>();
    try {
        List<ConsumerPriceIndex> prices = feed.getConsumerPriceIndices();
        boolean isDirty = getClient().setConsumerPriceIndices(prices);
        if (isDirty)
            getClient().markDirty();
    } catch (IOException e) {
        errors.add(new Status(IStatus.ERROR, PortfolioPlugin.PLUGIN_ID, e.getMessage(), e));
    }
    if (!errors.isEmpty()) {
        PortfolioPlugin.log(new MultiStatus(PortfolioPlugin.PLUGIN_ID, -1, errors.toArray(new IStatus[0]), Messages.JobMsgErrorUpdatingIndices, null));
    }
    return Status.OK_STATUS;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus) Status(org.eclipse.core.runtime.Status) CPIFeed(name.abuchen.portfolio.online.CPIFeed) DestatisCPIFeed(name.abuchen.portfolio.online.DestatisCPIFeed) IStatus(org.eclipse.core.runtime.IStatus) ConsumerPriceIndex(name.abuchen.portfolio.model.ConsumerPriceIndex) ArrayList(java.util.ArrayList) MultiStatus(org.eclipse.core.runtime.MultiStatus) IOException(java.io.IOException) DestatisCPIFeed(name.abuchen.portfolio.online.DestatisCPIFeed)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ConsumerPriceIndex (name.abuchen.portfolio.model.ConsumerPriceIndex)1 CPIFeed (name.abuchen.portfolio.online.CPIFeed)1 DestatisCPIFeed (name.abuchen.portfolio.online.DestatisCPIFeed)1 IStatus (org.eclipse.core.runtime.IStatus)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 Status (org.eclipse.core.runtime.Status)1