felix@1072: package de.intevation.flys.artifacts.states; felix@1072: felix@1968: import java.util.List; felix@1968: felix@1072: import org.apache.log4j.Logger; felix@1072: felix@1072: import de.intevation.flys.artifacts.model.FacetTypes; felix@1072: felix@1968: import de.intevation.artifactdatabase.state.Facet; felix@1968: import de.intevation.artifactdatabase.state.DefaultOutput; bjoern@3935: import de.intevation.artifactdatabase.state.Output; felix@1968: felix@1971: import de.intevation.flys.artifacts.FLYSArtifact; felix@1971: felix@1971: import de.intevation.artifacts.CallContext; felix@1971: import de.intevation.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: felix@1787: 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: */ felix@2004: public Object staticCompute(List facets, FLYSArtifact 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( felix@1971: FLYSArtifact 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( felix@1971: FLYSArtifact 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( felix@1971: FLYSArtifact 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: } felix@1072: } felix@1968: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :