felix@1825: package de.intevation.flys.artifacts.model;
felix@1825: 
felix@2124: import org.apache.log4j.Logger;
felix@2124: 
felix@1825: import de.intevation.artifacts.Artifact;
felix@1825: import de.intevation.artifacts.CallContext;
felix@1825: 
felix@1825: import de.intevation.flys.artifacts.StaticWQKmsArtifact;
felix@1825: 
felix@2124: import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
felix@2124: 
felix@2124: 
felix@1825: /**
felix@1825:  * Facet to show W|Q|km Values.
felix@2124:  * We have following 'Types' (from FacetTypes):
felix@2124:  *   String STATIC_WQKMS = "other.wqkms";
felix@2124:  *   String STATIC_WQMS_W = "other.wqkms.w";
felix@2124:  *   String STATIC_WQKMS_Q = "other.wqkms.q";
felix@1825:  */
felix@1825: public class WQKmsFacet
felix@2124: extends      DataFacet
felix@1825: implements   FacetTypes {
felix@1825: 
felix@2124:     /** House logger. */
felix@2124:     private static Logger logger = Logger.getLogger(WQKmsFacet.class);
felix@2124: 
felix@1825:     /** Trivial Constructor. */
felix@1825:     public WQKmsFacet(String description) {
felix@1825:         this(STATIC_WQKMS, description);
felix@1825:     }
felix@1825: 
felix@2124: 
felix@2124:     /**
felix@2124:      * @param name Name of this facet (we have at least two flavors (w and q).
felix@2124:      */
felix@1825:     public WQKmsFacet(String name, String description) {
felix@2124:         super(0, name, description, ComputeType.FEED, null, null);
felix@1825:     }
felix@1825: 
felix@1825: 
felix@1825:     /**
felix@1825:      * Returns the data this facet requires.
felix@1825:      *
felix@1825:      * @param artifact the owner artifact.
felix@1825:      * @param context  the CallContext (ignored).
felix@1825:      *
felix@1825:      * @return the data.
felix@1825:      */
felix@1825:     @Override
felix@1825:     public Object getData(Artifact artifact, CallContext context) {
felix@2124:         logger.debug("WQKmsFacet.getData");
felix@2124: 
felix@1825:         StaticWQKmsArtifact staticData =
felix@1825:             (StaticWQKmsArtifact) artifact;
felix@2124:         Object res = staticData.compute(context, hash, stateId, type, false);
felix@2124: 
felix@2124:         return res;
felix@1825:     }
felix@1825: 
felix@1825: 
felix@1825:     /**
felix@1825:      * Create a deep copy of this Facet.
felix@1825:      * @return a deep copy.
felix@1825:      */
felix@1825:     @Override
felix@1825:     public WQKmsFacet deepCopy() {
felix@1825:         WQKmsFacet copy = new WQKmsFacet(description);
felix@1825:         copy.set(this);
felix@1825:         return copy;
felix@1825:     }
felix@1825: }
felix@1825: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :