Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/services/ModuleService.java @ 9415:9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
The facets also put the valid station range into their xml-metadata
author | gernotbelger |
---|---|
date | Thu, 16 Aug 2018 16:27:53 +0200 |
parents | c26fb37899ca |
children |
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.services; import java.util.List; import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.artifacts.CallMeta; import org.dive4elements.artifacts.GlobalContext; import org.dive4elements.artifacts.ArtifactNamespaceContext; import org.dive4elements.river.artifacts.model.Module; import org.dive4elements.river.artifacts.context.RiverContext; import org.dive4elements.river.artifacts.resources.Resources; public class ModuleService extends D4EService { private static final String MODULE = "module"; private static Logger log = Logger.getLogger(ModuleService.class); @Override protected Document doProcess( Document data, GlobalContext globalContext, CallMeta callMeta ) { log.debug("ModuleService.process"); final Document result = XMLUtils.newDocument(); final XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( result, ArtifactNamespaceContext.NAMESPACE_URI, ArtifactNamespaceContext.NAMESPACE_PREFIX); final Element em = ec.create("modules"); final List<Module> modules = (List<Module>)globalContext.get( RiverContext.MODULES); for (final Module module : modules) { final Element m = ec.create("module"); ec.addAttr(m, "name", module.getName(), true); final String localname = Resources.getMsg(callMeta, MODULE + "." + module.getName(), module.getName()); ec.addAttr(m, "localname", localname, true); for (final String river : module.getRivers()) { final Element r = ec.create("river"); r.setAttribute("uuid", river); m.appendChild(r); } if (module.isSelected()) { ec.addAttr(m, "selected", "true", true); } final String group = module.getGroup(); if( group != null ) { final String groupLabel = Resources.getMsg(callMeta, group); ec.addAttr(m, "groupId", group, true); ec.addAttr(m, "groupLabel", groupLabel, true); } em.appendChild(m); } result.appendChild(em); return result; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80: