view flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1660:804c58c56422

Extracted/use StringUtil.wWrap . flys-artifacts/trunk@2859 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 28 Sep 2011 15:37:59 +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