comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java @ 519:97dc9b8ae68a facet-metadata

Introduced facet metadata.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 21 May 2014 11:23:45 +0200
parents 83ee2c6a53b6
children ab13ab6acc5c
comparison
equal deleted inserted replaced
515:22d66b405b24 519:97dc9b8ae68a
1 package org.dive4elements.artifactdatabase.state; 1 package org.dive4elements.artifactdatabase.state;
2 2
3 import java.util.HashMap;
3 import java.util.List; 4 import java.util.List;
5 import java.util.Map;
4 6
5 import org.w3c.dom.Document; 7 import org.w3c.dom.Document;
6 import org.w3c.dom.Element; 8 import org.w3c.dom.Element;
7 import org.w3c.dom.Node; 9 import org.w3c.dom.Node;
8 10
30 protected String boundToOut; 32 protected String boundToOut;
31 33
32 /** The description of this facet. */ 34 /** The description of this facet. */
33 protected String description; 35 protected String description;
34 36
37 /** The meta data this facet provides. */
38 protected Map<String, String> metaData;
35 39
36 /** Trivial, empty constructor. */ 40 /** Trivial, empty constructor. */
37 public DefaultFacet() { 41 public DefaultFacet() {
42 this.metaData = new HashMap<String, String>();
38 } 43 }
39 44
40 45
41 /** 46 /**
42 * The default constructor to create new Facet objects. 47 * The default constructor to create new Facet objects.
58 */ 63 */
59 public DefaultFacet(int index, String name, String description) { 64 public DefaultFacet(int index, String name, String description) {
60 this.index = index; 65 this.index = index;
61 this.name = name; 66 this.name = name;
62 this.description = description; 67 this.description = description;
68 this.metaData = new HashMap<String, String>();
63 } 69 }
64 70
65 71
66 /** Get index. */ 72 /** Get index. */
67 public int getIndex() { 73 public int getIndex() {
104 */ 110 */
105 public Object getData(Artifact artifact, CallContext context) { 111 public Object getData(Artifact artifact, CallContext context) {
106 return null; 112 return null;
107 } 113 }
108 114
115
116 /**
117 * Returns the meta data this facet provides.
118 *
119 * @param artifact The owner artifact.
120 * @param context The CallContext.
121 *
122 * @return the meta data.
123 */
124 @Override
125 public Map<String, String> getMetaData(
126 Artifact artifact,
127 CallContext context)
128 {
129 return this.metaData;
130 }
131
132 @Override
133 public Map<String, String> getMetaData() {
134 return this.metaData;
135 }
109 136
110 /** 137 /**
111 * (Do not) provide data. 138 * (Do not) provide data.
112 * Override to allow other facets to access your data. 139 * Override to allow other facets to access your data.
113 * @return always null. 140 * @return always null.
177 public void set(Facet other) { 204 public void set(Facet other) {
178 index = other.getIndex(); 205 index = other.getIndex();
179 name = other.getName(); 206 name = other.getName();
180 description = other.getDescription(); 207 description = other.getDescription();
181 boundToOut = other.getBoundToOut(); 208 boundToOut = other.getBoundToOut();
209 metaData = other.getMetaData();
182 } 210 }
183 211
184 212
185 /** Create a deep copy of this facet. */ 213 /** Create a deep copy of this facet. */
186 public Facet deepCopy() { 214 public Facet deepCopy() {

http://dive4elements.wald.intevation.org