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@2124: felix@2124: import java.util.List; felix@2124: felix@2124: import org.apache.log4j.Logger; felix@2124: teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5831: import org.dive4elements.artifacts.CallMeta; felix@2124: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; felix@2124: teichmann@5831: import org.dive4elements.river.artifacts.FLYSArtifact; teichmann@5831: import org.dive4elements.river.artifacts.StaticWQKmsArtifact; teichmann@5831: teichmann@5831: import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; teichmann@5831: import org.dive4elements.river.artifacts.model.FacetTypes; teichmann@5831: import org.dive4elements.river.artifacts.model.RelativePointFacet; teichmann@5831: import org.dive4elements.river.artifacts.model.WQKms; teichmann@5831: import org.dive4elements.river.artifacts.model.WQKmsFacet; felix@2124: felix@2124: /** felix@2124: * Only state of WQKmsArtifact. felix@2124: */ felix@2124: public class StaticWQKmsState felix@2124: extends DefaultState felix@2124: implements FacetTypes felix@2124: { felix@2124: /** The logger that is used in this state. */ felix@2124: private static Logger logger = Logger.getLogger(StaticWQKmsState.class); felix@2124: felix@2124: felix@2124: /** felix@2124: * From this state can not be continued. felix@2124: */ felix@2124: @Override felix@2124: protected String getUIProvider() { felix@2124: return "noinput"; felix@2124: } felix@2124: felix@2124: felix@2124: /** felix@2124: * Compute, create Facets, do the same stuff as all the other states do. felix@2124: */ felix@2124: protected Object compute( felix@2124: StaticWQKmsArtifact winfo, felix@2124: CallMeta metaLocale, felix@2124: String hash, felix@2124: List facets, felix@2124: Object old felix@2124: ) { felix@2124: String id = getID(); felix@2124: felix@2124: WQKms res = old instanceof WQKms felix@2124: ? (WQKms)old felix@2124: : winfo.getWQKms(); felix@2124: felix@2124: WQKms wqkms = res; felix@2124: felix@2124: if (facets == null) { felix@2124: return res; felix@2124: } felix@2124: felix@2124: /* felix@2124: * TODO: re-enable HEIGHTMARKS_POINTS-thing felix@2124: felix@2124: String name; felix@2124: if (parts[0].equals(HEIGHTMARKS_POINTS)) { felix@2124: name = HEIGHTMARKS_POINTS; felix@2124: } felix@2124: else { felix@2124: name = STATIC_WQKMS; felix@2124: } felix@2124: */ felix@2124: felix@2124: String wkmsName = wqkms.getName(); felix@2124: Facet qfacet = new WQKmsFacet( felix@2124: STATIC_WQKMS_Q, felix@2124: wkmsName felix@2124: // TODO re-enable translations. felix@2124: /* felix@2124: Resources.getMsg( felix@2124: metaLocale, felix@2124: wkmsName, felix@2124: wkmsName)*/); felix@2124: facets.add(qfacet); felix@2124: felix@5799: Facet rpFacet = new RelativePointFacet(wkmsName); felix@5799: facets.add(rpFacet); felix@5799: felix@2124: wkmsName = "W (" + wkmsName + ")"; felix@2124: felix@5799: Facet csFacet = new CrossSectionWaterLineFacet(0, felix@5799: wkmsName); felix@5799: facets.add(csFacet); felix@5799: felix@2124: Facet wfacet = new WQKmsFacet( felix@2124: STATIC_WQKMS_W, felix@2124: wkmsName felix@2124: /* felix@2124: // TODO re-enable translations. felix@2124: Resources.getMsg( felix@2124: metaLocale, felix@2124: wkmsName, felix@2124: wkmsName)*/); felix@2124: facets.add(wfacet); felix@2124: felix@2124: return res; felix@2124: } felix@2124: felix@2124: felix@2124: /** felix@2124: * Get data, create the facets. felix@2124: * felix@2124: * @param context Ignored. felix@2124: */ felix@2124: @Override felix@2124: public Object computeFeed( felix@2124: FLYSArtifact artifact, felix@2124: String hash, felix@2124: CallContext context, felix@2124: List facets, felix@2124: Object old felix@2124: ) { felix@2124: return compute((StaticWQKmsArtifact) artifact, context.getMeta(), felix@2124: hash, facets, old); felix@2124: } felix@2124: felix@2124: felix@2124: /** felix@2124: * Create the facets. felix@2124: * @param context Ignored. felix@2124: */ felix@2124: @Override felix@2124: public Object computeInit( felix@2124: FLYSArtifact artifact, felix@2124: String hash, felix@2124: Object context, felix@2124: CallMeta meta, felix@2124: List facets felix@2124: ) { felix@2124: return compute((StaticWQKmsArtifact) artifact, meta, hash, facets, felix@2124: null); felix@2124: } felix@2124: } felix@2124: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :