Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/MINFOArtifact.java @ 3211:a1a434c163a4
FixA: Fixed parameter name
flys-artifacts/trunk@4832 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 28 Jun 2012 16:20:33 +0000 |
parents | 2f922be407ea |
children | b888c5eb65b3 |
line wrap: on
line source
package de.intevation.flys.artifacts; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.states.SoundingsSelect; import de.intevation.flys.utils.FLYSUtils; import gnu.trove.TIntArrayList; import org.apache.log4j.Logger; /** * The default MINFO artifact. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class MINFOArtifact extends FLYSArtifact implements FacetTypes { /** The logger for this class. */ private static Logger logger = Logger.getLogger(MINFOArtifact.class); /** The name of the artifact. */ public static final String ARTIFACT_NAME = "minfo"; /** XPath */ public static final String XPATH_STATIC_UI ="/art:result/art:ui/art:static"; /** * The default constructor. */ public MINFOArtifact() { } /** * Returns the name of the concrete artifact. * * @return the name of the concrete artifact. */ @Override public String getName() { return ARTIFACT_NAME; } public int[] getMainChannels() { String data = getDataAsString("main.channel"); if (data == null) { logger.warn("No 'main.channel' parameter specified!"); return null; } return FLYSUtils.intArrayFromString(data); } public int[] getTotalChannels() { String data = getDataAsString("total.channel"); if (data == null) { logger.warn("No 'total.channel' parameter specified!"); return null; } return FLYSUtils.intArrayFromString(data); } public int[] getBedHeightSingleIDs() { String data = getDataAsString("soundings"); if (data == null) { logger.warn("No 'soundings' parameter specified!"); return null; } String[] parts = data.split(";"); TIntArrayList ids = new TIntArrayList(); for (String part: parts) { if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, ""); try { ids.add(Integer.parseInt(tmp)); } catch (NumberFormatException nfe) { logger.warn("Cannot parse int from string: '" + tmp + "'"); } } } return ids.toNativeArray(); } public int[] getBedHeightEpochIDs() { String data = getDataAsString("soundings"); if (data == null) { logger.warn("No 'soundings' parameter specified!"); return null; } String[] parts = data.split(";"); TIntArrayList ids = new TIntArrayList(); for (String part: parts) { if (part.indexOf(SoundingsSelect.PREFIX_EPOCH) >= 0) { String tmp = part.replace(SoundingsSelect.PREFIX_EPOCH, ""); try { ids.add(Integer.parseInt(tmp)); } catch (NumberFormatException nfe) { logger.warn("Cannot parse int from string: '" + tmp + "'"); } } } return ids.toNativeArray(); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :