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@2001: felix@2001: import java.util.List; felix@2001: felix@2001: import org.apache.log4j.Logger; felix@2001: teichmann@5831: import org.dive4elements.artifacts.CallContext; felix@2001: teichmann@5831: import org.dive4elements.river.artifacts.model.AreaFacet; felix@2001: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; teichmann@5831: teichmann@5831: import org.dive4elements.river.artifacts.FLYSArtifact; teichmann@5831: import org.dive4elements.river.artifacts.AreaArtifact; teichmann@5831: import org.dive4elements.river.artifacts.model.FacetTypes; felix@2001: felix@2001: felix@2022: /** Trivial state to create areafacets, no caching. */ felix@2001: public class AreaCreationState felix@2001: extends DefaultState felix@2001: implements FacetTypes felix@2001: { felix@2001: /** The logger that is used in this state. */ felix@2001: private static Logger logger = Logger.getLogger(AreaCreationState.class); felix@2001: felix@2001: felix@2001: /** felix@2001: * From this state can only be continued trivially. felix@2001: */ felix@2001: @Override felix@2001: protected String getUIProvider() { felix@2001: return "continue"; felix@2001: } felix@2001: felix@2001: felix@2010: /** Just reproduce the Facet. */ felix@2001: protected Object compute( felix@2010: FLYSArtifact areaArtifact, felix@2001: CallContext cc, felix@2001: String hash, felix@2001: List facets, felix@2001: Object old felix@2001: ) { felix@2001: logger.debug("AreaCreationState.compute"); felix@2010: felix@2001: if (facets != null) { felix@2018: AreaArtifact aArt = (AreaArtifact) areaArtifact; felix@2018: felix@2018: facets.add(new AreaFacet(0, aArt.getFacetName(), aArt.getAreaName())); felix@2001: } felix@2001: felix@2001: // TODO use compute to exploit caching strategies. felix@2001: felix@2001: return null; felix@2001: } felix@2001: felix@2001: felix@2001: /** felix@2001: */ felix@2001: @Override felix@2001: public Object computeFeed( felix@2001: FLYSArtifact artifact, felix@2001: String hash, felix@2001: CallContext context, felix@2001: List facets, felix@2001: Object old felix@2001: ) { felix@2001: return compute((FLYSArtifact) artifact, context, hash, facets, old); felix@2001: } felix@2001: felix@2001: felix@2001: /** felix@2001: * felix@2001: */ felix@2001: @Override felix@2001: public Object computeAdvance( felix@2001: FLYSArtifact artifact, felix@2001: String hash, felix@2001: CallContext context, felix@2001: List facets, felix@2001: Object old felix@2001: ) { felix@2001: return compute((FLYSArtifact) artifact, context, hash, facets, old); felix@2001: } felix@2001: } felix@2001: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :