# HG changeset patch # User Felix Wolfsteller # Date 1366108862 -7200 # Node ID 187762f5e90511ec6f7f8581b03ad83e337c9a42 # Parent c08f691652cfcc052e024fafdecb3439d5532407 New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet. diff -r c08f691652cf -r 187762f5e905 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixEventFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixEventFacet.java Tue Apr 16 12:41:02 2013 +0200 @@ -0,0 +1,62 @@ +package de.intevation.flys.artifacts.model.fixings; + +import org.apache.log4j.Logger; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; + +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.model.DataFacet; +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.WQKmsFactory; +import de.intevation.flys.artifacts.access.FixRealizingAccess; + +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; + + +/** + * Facet to show W|Q|km Values. + */ +public class FixEventFacet +extends DataFacet +implements FacetTypes { + + /** House logger. */ + private static Logger logger = Logger.getLogger(FixEventFacet.class); + + + public FixEventFacet(int index, String name, String description) { + super(index, name, description, ComputeType.FEED, null, null); + } + + + /** + * Returns the data this facet requires. + * + * @param artifact the owner artifact. + * @param context the CallContext (ignored). + * + * @return the data. + */ + @Override + public Object getData(Artifact artifact, CallContext context) { + logger.debug("FixEventFacet.getData"); + + FixRealizingAccess access = new FixRealizingAccess((FLYSArtifact) artifact, context); + int wstColID = access.getEvents()[index]; + return WQKmsFactory.getWQKmsCID(wstColID); + } + + + /** + * Create a deep copy of this Facet. + * @return a deep copy. + */ + @Override + public FixEventFacet deepCopy() { + FixEventFacet copy = new FixEventFacet(index, name, description); + copy.set(this); + return copy; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :