view flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java @ 2763:2f7fed1eb4bf

Removed needless imports. flys-artifacts/trunk@4499 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 24 May 2012 08:00:14 +0000
parents 938e2f6c0c9a
children 9c147bbffc36
line wrap: on
line source
package de.intevation.flys.artifacts.services;

import de.intevation.artifacts.CallMeta;
import de.intevation.artifacts.GlobalContext;

import de.intevation.artifacts.common.utils.XMLUtils;

import de.intevation.flys.artifacts.model.FixingsFilterBuilder;

import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter;

import de.intevation.flys.artifacts.model.FixingsOverview.Range;

import de.intevation.flys.artifacts.model.FixingsOverview;
import de.intevation.flys.artifacts.model.FixingsOverviewFactory;

import org.apache.log4j.Logger;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class FixingsOverviewService
extends      FLYSService
{
    private static Logger log =
        Logger.getLogger(FixingsOverviewService.class);

    public FixingsOverviewService() {
    }

    @Override
    public Document doProcess(
        Document      data,
        GlobalContext globalContext,
        CallMeta      callMeta
    ) {
        log.debug("FixingsOverviewService.doProcess");

        Document document = XMLUtils.newDocument();

        NodeList nodes = data.getElementsByTagName("river");

        String river = nodes.getLength() > 0
            ? ((Element)nodes.item(0)).getAttribute("name")
            : "";

        FixingsOverview overview = FixingsOverviewFactory.getOverview(river);

        if (overview != null) {
            FixingsFilterBuilder ffb = new FixingsFilterBuilder(data);
            Range  range  = ffb.getRange();
            Filter filter = ffb.getFilter();
            overview.generateOverview(document, range, filter);
        }
        else {
            log.warn("No overview for river '" + river + "' available.");
        }

        return document;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org