# HG changeset patch # User Sascha L. Teichmann # Date 1308319409 0 # Node ID 32ed5d789e5048ad35e014795b6df0bdc8a62170 # Parent dad1a2c88f9fc5db2fd7e507344e4c5eaab3d480 Add facet to access raw computed data. flys-artifacts/branches/facets-slt@2153 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r dad1a2c88f9f -r 32ed5d789e50 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java Fri Jun 17 14:03:29 2011 +0000 @@ -0,0 +1,43 @@ +package de.intevation.flys.artifacts.model; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; + +import de.intevation.artifactdatabase.state.DefaultFacet; + +import de.intevation.flys.artifacts.FLYSArtifact; + +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; + +public class DataFacet +extends DefaultFacet +{ + protected ComputeType type; + protected String hash; + + public DataFacet(String name, String description) { + this(name, description, ComputeType.ADVANCE); + } + + public DataFacet(String name, String description, ComputeType type) { + this(name, description, type, null); + } + + public DataFacet( + String name, + String description, + ComputeType type, + String hash + ) { + super(name, description); + this.type = type; + this.hash = hash; + } + + public Object getData(Artifact artifact, CallContext context) { + FLYSArtifact flys = (FLYSArtifact)artifact; + return flys.compute( + context, hash != null ? hash : flys.hash(), type); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :