view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java @ 9176:1614cb14308f

Work on calculations for S-Info flood duration workflow
author mschaefer
date Mon, 25 Jun 2018 19:21:11 +0200
parents 95643dffd006
children 51b316de0d64
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.sinfo.flood_duration;

import java.util.ArrayList;
import java.util.List;

import org.dive4elements.river.artifacts.states.RadioSelect;
import org.dive4elements.river.model.Attribute.AttributeKey;

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

    private static final long serialVersionUID = 1L;

    /***** TYPES *****/

    public enum RiversideChoiceKey {
        NONE("", AttributeKey.NONE), //
        LEFT("state.sinfo.riverside.left", AttributeKey.LEFT), //
        RIGHT("state.sinfo.riverside.right", AttributeKey.RIGHT), //
        BOTH("state.sinfo.riverside.both", AttributeKey.UNKNOWN);

        private final String key;
        private final AttributeKey attributeKey;

        RiversideChoiceKey(final String key, final AttributeKey attributeKey) {
            this.key = key;
            this.attributeKey = attributeKey;
        }

        public static RiversideChoiceKey fromKey(final String key) {
            for (final RiversideChoiceKey v : values()) {
                if (key.equalsIgnoreCase(v.key))
                    return v;
            }
            return NONE;
        }

        public String getKey() {
            return this.key;
        }

        public AttributeKey getAttributeKey() {
            return this.attributeKey;
        }
    }

    /***** CONSTRUCTORS *****/

    public RiversideRadioChoice() {
        super();
    }

    /***** METHODS *****/

    @Override
    protected List<String> makeEntries() {
        final List<String> entries = new ArrayList<>();
        entries.add(RiversideChoiceKey.LEFT.getKey());
        entries.add(RiversideChoiceKey.RIGHT.getKey());
        entries.add(RiversideChoiceKey.BOTH.getKey());
        return entries;
    }

}

http://dive4elements.wald.intevation.org