view flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1673:68260e38029a

Modified code to determine the elevation model of Wsts in the LongitudinalSectionGenerator. flys-artifacts/trunk@2886 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 04 Oct 2011 15:30:09 +0000
parents 4aec853a2f85
children 71d369ab789d
line wrap: on
line source
package de.intevation.flys.artifacts;

import de.intevation.artifactdatabase.state.Facet;
import de.intevation.artifactdatabase.state.Output;

import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.CallMeta;

import de.intevation.flys.artifacts.states.DefaultState;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;


/**
 * Clone of an WINFOArtifact to expose waterlevels only.
 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa).
 */
public class WaterlevelArtifact extends WINFOArtifact {

    /** The logger for this class. */
    private static Logger logger = Logger.getLogger(WaterlevelArtifact.class);

    /** The name of the artifact. */
    public static final String ARTIFACT_NAME = "waterlevel";


    /**
     * The default constructor.
     */
    public WaterlevelArtifact() {
    }


    /**
     * Clone important stuff of an WINFOArtifact (called from factory).
     */
    protected void initialize(Artifact artifact,
              Object context,
              CallMeta meta) {
        WINFOArtifact winfo = (WINFOArtifact) artifact;
        this.data = winfo.cloneData();
	logger.debug("Cloned data of winfo artifact.");
        // Statically add Facets.
        List<Facet> fs = new ArrayList<Facet>();
        DefaultState state = (DefaultState) getCurrentState(context);
        state.computeInit(this, hash(), context, meta, fs);
        if (!fs.isEmpty()) { 
            logger.debug("Facets to add in WaterlevelArtifact.initialize ."); 
            facets.put(getCurrentStateId(), fs); 
        } 
        else { 
            logger.debug("No facets to add in WaterlevelArtifact.initialize ("+state.getID()+")."); 
        }
	this.filterFacets = null;
    }


    /**
     * Prevent filtering from taking place.
     */
    @Override
    protected List<Output> filterOutputs(List<Output> outs) {
       return outs;
    }


    /**
     * Returns the name of the concrete artifact.
     *
     * @return the name of the concrete artifact.
     */
    public String getName() {
        return ARTIFACT_NAME;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org