view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java @ 1999:02ce03329ef5

Some optimizations during out() operation of FLYSArtifactCollection. flys-artifacts/trunk@3437 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 16 Dec 2011 11:47:57 +0000
parents 741d2067cfe1
children 94c4dd5aaf20
line wrap: on
line source
package de.intevation.flys.artifacts.states;

import java.util.List;

import org.apache.log4j.Logger;

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

import de.intevation.artifactdatabase.state.Facet;
import de.intevation.artifactdatabase.state.DefaultOutput;

import de.intevation.flys.artifacts.FLYSArtifact;

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

/**
 * Yet, a non-abstract DefaultState.
 */
public class StaticState
extends      DefaultState
implements   FacetTypes
{
    /** The logger that is used in this state. */
    private static final Logger logger = Logger.getLogger(StaticState.class);


    /**
     * Trivial constructor, sets id and description.
     * @param id String used for both id and description.
     */
    public StaticState(String id) {
        this(id, id);
    }


    public StaticState(String id, String description) {
        super();
        setID(id);
        setDescription(description);
    }

    public void addDefaultChartOutput(String nameDesc, List<Facet> facets) {
        DefaultOutput output = new DefaultOutput(nameDesc,
            nameDesc, "image/png", facets, "chart");
        getOutputs().add(output);
    }


    /**
     * Do nothing (override to include your logic).
     * @param facets List of facets (to add to).
     */
    public Object staticCompute(List<Facet> facets) {
        return null;
    }


    /** Call staticCompute to allow easy adjustments. */
    @Override
    public Object computeAdvance(
        FLYSArtifact artifact,
        String       hash,
        CallContext  context,
        List<Facet>  facets,
        Object       old
    ) {
        return staticCompute(facets);
    }


    /** Call staticCompute to allow easy adjustments. */
    @Override
    public Object computeFeed(
        FLYSArtifact artifact,
        String       hash,
        CallContext  context,
        List<Facet>  facets,
        Object       old
    ) {
        return staticCompute(facets);
    }


    /** Call staticCompute to allow easy adjustments. */
    @Override
    public Object computeInit(
        FLYSArtifact artifact,
        String       hash,
        Object       context,
        CallMeta     meta,
        List<Facet>  facets
    ) {
        return staticCompute(facets);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org