Mercurial > dive4elements > framework
view artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java @ 358:03a8f9796571
Added interfaces for a Settings hierachy currently used for Outputs.
artifacts/trunk@3408 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 14 Dec 2011 09:41:44 +0000 |
parents | 1d11a0531242 |
children | 6431b7efe240 |
line wrap: on
line source
package de.intevation.artifactdatabase.state; import java.util.List; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; /** * The default implementation of a Facet. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultFacet implements Facet { /** The index of this facet. */ protected int index; /** The name of this facet. */ protected String name; /** The description of this facet. */ protected String description; /** Trivial, empty constructor. */ public DefaultFacet() { } /** * The default constructor to create new Facet objects. * * @param name The name of this new facet. * @param description The description of this new facet. */ public DefaultFacet(String name, String description) { this(0, name, description); } /** * The default constructor to create new Facet objects. * * @param index The index of this new facet. * @param name The name of this new facet. * @param description The description of this new facet. */ public DefaultFacet(int index, String name, String description) { this.index = index; this.name = name; this.description = description; } /** * Copies name, index and description of other facet. */ public void set(Facet other) { index = other.getIndex(); name = other.getName(); description = other.getDescription(); } public Facet deepCopy() { DefaultFacet copy = new DefaultFacet(); copy.set(this); return copy; } public int getIndex() { return index; } public String getName() { return name; } public String getDescription() { return description; } /** * @return null */ public Object getData(Artifact artifact, CallContext context) { return null; } /** * (Do not) provide data. * Override to allow other facets to access your data. * @return always null. */ public Object provideBlackboardData( Artifact artifact, Object key, Object param, CallContext context ) { return null; } /** * Return list of keys (objects) for which this facet can provide data * ("external parameterization"), for other facets, via blackboard. * @param artifact that this facet belongs to. */ public List getDataProviderKeys(Artifact artifact) { return null; } public String toString() { return new StringBuilder("name = '") .append(name).append("', index = ") .append(index).append(", description = '") .append(description).append("'") .toString(); } public Node toXML(Document doc) { ElementCreator ec = new ElementCreator( doc, ArtifactNamespaceContext.NAMESPACE_URI, ArtifactNamespaceContext.NAMESPACE_PREFIX); Element facet = ec.create("facet"); ec.addAttr(facet, "description", description, true); ec.addAttr(facet, "name", name, true); ec.addAttr(facet, "index", String.valueOf(index), true); return facet; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :