Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixingsFacet.java @ 5094:6da542572ab1 dami
Use HWSLines data for HWS and Lines.
This is a quick fix to keep compatibility. Both Artifacts will
be replaced by a HWSLineArtifact.
Patch provided by Raimund Renkert <rrenkert@intevation.de>
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 25 Feb 2013 12:38:55 +0100 |
parents | b195fede1c3b |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.model.fixings; import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; /** * Facet to access the current Km from the context safely * * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> */ public class FixingsFacet extends DataFacet { public static final Double INVALID_KM = Double.valueOf(-1d); public static final String CURRENT_KM = "currentKm"; public FixingsFacet() { } public FixingsFacet(String name, String description) { super(0, name, description, ComputeType.ADVANCE, null, null); } public FixingsFacet( int index, String name, String description, ComputeType type, String hash, String stateId ) { super(index, name, description, type, hash, stateId); } /** * Returns the current km from the context. * If the context is null or doesn't contain a currentKm then a double value of -1 will * be returned. * @param context The CallContext instance * @return the current km as double */ protected double getCurrentKm(CallContext context) { if (context == null) { return INVALID_KM; } Double dkm = (Double)context.getContextValue(CURRENT_KM); if (dkm == null) { return INVALID_KM; } return dkm.doubleValue(); } }