view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MinMaxState.java @ 2199:7bac5afb9892

Skip 'inactive' points in output generation. flys-artifacts/trunk@3815 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 30 Jan 2012 08:37:01 +0000
parents 2792d2617be9
children d1660809daab
line wrap: on
line source
package de.intevation.flys.artifacts.states;

import org.w3c.dom.Element;

import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.CallContext;

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

import de.intevation.artifactdatabase.ProtocolUtils;

import de.intevation.flys.artifacts.FLYSArtifact;


/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public abstract class MinMaxState extends DefaultState {

    @Override
    protected void appendItems(
        Artifact       artifact,
        ElementCreator creator,
        String         name,
        CallContext    context,
        Element        select
    ) {
        FLYSArtifact flys = (FLYSArtifact) artifact;

        select.setAttributeNS(
            ArtifactNamespaceContext.NAMESPACE_URI,
            "art:type",
            getType());

        Element min = ProtocolUtils.createArtNode(
            creator,
            "min",
            new String[] { "value" },
            new String[] { String.valueOf(getLower(flys)) });

        Element max = ProtocolUtils.createArtNode(
            creator,
            "max",
            new String[] { "value" },
            new String[] { String.valueOf(getUpper(flys)) });

        select.appendChild(min);
        select.appendChild(max);
    }


    protected abstract Object getLower(FLYSArtifact flys);

    protected abstract Object getUpper(FLYSArtifact flys);

    protected abstract String getType();
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org