view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java @ 4174:eaf83d4ae6b1

Sorted gauges for reference gauge selection in historical discharge calculation based on their name. Now, Gauge implements the Java Comparable interface and takes its name into account.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 18 Oct 2012 13:12:24 +0200
parents 6442f317a0c7
children e8a4d2fd25cc
line wrap: on
line source
package de.intevation.flys.artifacts.states;

import java.util.List;

import org.apache.log4j.Logger;

import de.intevation.artifacts.CallMeta;
import de.intevation.artifacts.CallContext;

import de.intevation.artifactdatabase.state.Facet;

import de.intevation.flys.artifacts.FLYSArtifact;
import de.intevation.flys.artifacts.QSectorArtifact;

import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.QSectorFacet;

import de.intevation.flys.artifacts.resources.Resources;

/**
 * The only state for an QSectorArtifact.
 */
public class QSectorSingleState
extends      DefaultState
implements   FacetTypes
{
    /** Developer-centric description of facet. */
    public static final String I18N_DESCRIPTION
        = "facet.qsector";

    /** The logger that is used in this state. */
    private static final Logger logger =
        Logger.getLogger(QSectorSingleState.class);


    /**
     * Add QSectorFacets to list of Facets.
     *
     * @param artifact Ignored.
     * @param hash Ignored.
     * @param meta CallMeta to be used for internationalization.
     * @param facets List to add QSectorFacet to.
     *
     * @return null.
     */
    public Object compute(
        FLYSArtifact artifact,
        String       hash,
        CallMeta     meta,
        List<Facet>  facets
    ) {
        logger.debug("QSectorSingleState.compute()");
        QSectorArtifact points = (QSectorArtifact) artifact;

        QSectorFacet qfacet = new QSectorFacet(
            0,
            QSECTOR,
            Resources.getMsg(meta, "qsectors", "Q Sectors"));

        facets.add(qfacet);

        return null;
    }


    /** Call compute. */
    @Override
    public Object computeInit(
        FLYSArtifact artifact,
        String       hash,
        Object       context,
        CallMeta     meta,
        List<Facet>  facets
     ) {
        return compute(artifact, hash, meta, facets);
    }


    /** Call compute. */
    @Override
    public Object computeFeed(
        FLYSArtifact artifact,
        String hash,
        CallContext context,
        List<Facet> facets,
        Object old
    ) {
        return compute(artifact, hash, context.getMeta(), facets);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org