teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5863: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5863: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.states; felix@1072: felix@1968: import java.util.List; felix@1968: felix@1072: import org.apache.log4j.Logger; felix@1072: teichmann@5831: import org.dive4elements.river.artifacts.model.FacetTypes; felix@1072: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; teichmann@5831: import org.dive4elements.artifactdatabase.state.DefaultOutput; teichmann@5831: import org.dive4elements.artifactdatabase.state.Output; felix@1968: teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; felix@1971: teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5831: import org.dive4elements.artifacts.CallMeta; felix@1971: felix@1072: /** felix@1072: * Yet, a non-abstract DefaultState. felix@1072: */ felix@1072: public class StaticState felix@1072: extends DefaultState felix@1072: implements FacetTypes felix@1072: { felix@1072: /** The logger that is used in this state. */ felix@1072: private static final Logger logger = Logger.getLogger(StaticState.class); felix@1112: bjoern@4035: private static String uiprovider; bjoern@4035: felix@1787: bjoern@3996: public StaticState() { bjoern@3996: super(); bjoern@3996: } bjoern@3996: felix@1787: /** felix@1787: * Trivial constructor, sets id and description. felix@1787: * @param id String used for both id and description. felix@1787: */ felix@1787: public StaticState(String id) { felix@1787: this(id, id); felix@1787: } felix@1787: felix@1787: felix@1112: public StaticState(String id, String description) { felix@1112: super(); felix@1112: setID(id); felix@1112: setDescription(description); felix@1112: } felix@1968: felix@1968: public void addDefaultChartOutput(String nameDesc, List facets) { felix@1968: DefaultOutput output = new DefaultOutput(nameDesc, felix@1968: nameDesc, "image/png", facets, "chart"); felix@1968: getOutputs().add(output); felix@1968: } felix@1971: felix@2004: public static void addDefaultChartOutput( felix@2004: DefaultState state, felix@2004: String nameDesc, felix@2004: List facets felix@2004: ) { felix@2004: DefaultOutput output = new DefaultOutput(nameDesc, felix@2004: nameDesc, "image/png", facets, "chart"); felix@2004: state.getOutputs().add(output); felix@2004: } felix@2004: felix@1971: felix@1971: /** felix@1971: * Do nothing (override to include your logic). felix@1971: * @param facets List of facets (to add to). felix@1971: */ teichmann@5867: public Object staticCompute(List facets, D4EArtifact artifact) { felix@2004: return staticCompute(facets); felix@2004: } felix@2004: felix@1971: public Object staticCompute(List facets) { felix@1971: return null; felix@1971: } felix@1971: felix@1971: felix@1971: /** Call staticCompute to allow easy adjustments. */ felix@1971: @Override felix@1971: public Object computeAdvance( teichmann@5867: D4EArtifact artifact, felix@1971: String hash, felix@1971: CallContext context, felix@1971: List facets, felix@1971: Object old felix@1971: ) { felix@2004: return staticCompute(facets, artifact); felix@1971: } felix@1971: felix@1971: felix@1971: /** Call staticCompute to allow easy adjustments. */ felix@1971: @Override felix@1971: public Object computeFeed( teichmann@5867: D4EArtifact artifact, felix@1971: String hash, felix@1971: CallContext context, felix@1971: List facets, felix@1971: Object old felix@1971: ) { felix@2004: return staticCompute(facets, artifact); felix@1971: } felix@1971: felix@1971: felix@1971: /** Call staticCompute to allow easy adjustments. */ felix@1971: @Override felix@1971: public Object computeInit( teichmann@5867: D4EArtifact artifact, felix@1971: String hash, felix@1971: Object context, felix@1971: CallMeta meta, felix@1971: List facets felix@1971: ) { felix@2004: return staticCompute(facets, artifact); felix@1971: } bjoern@3935: bjoern@3935: public void addOutput(Output out) { bjoern@3935: super.addOutput(out); bjoern@3935: } bjoern@4035: bjoern@4035: @Override bjoern@4035: protected String getUIProvider() { bjoern@4035: return this.uiprovider; bjoern@4035: } bjoern@4035: bjoern@4035: /** bjoern@4035: * Allow to set the uiprovider for displaying the static data bjoern@4035: */ bjoern@4035: public void setUIProvider(String uiprovider) { bjoern@4035: this.uiprovider = uiprovider; bjoern@4035: } felix@1072: } felix@1968: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :