Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java @ 3318:dbe2f85bf160
merged flys-artifacts/2.8
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:35 +0200 |
parents | 9c147bbffc36 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java Fri Sep 28 12:14:35 2012 +0200 @@ -0,0 +1,63 @@ +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.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 :