Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java @ 488:83ee2c6a53b6
Add boundToOut property to facet and default facet
This allows a facet to know for which out it should be relevant
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 31 May 2013 14:59:39 +0200 |
parents | 415df0fc4fa1 |
children | 97dc9b8ae68a |
comparison
equal
deleted
inserted
replaced
487:968f3c2e58aa | 488:83ee2c6a53b6 |
---|---|
23 /** The index of this facet. */ | 23 /** The index of this facet. */ |
24 protected int index; | 24 protected int index; |
25 | 25 |
26 /** The name of this facet. */ | 26 /** The name of this facet. */ |
27 protected String name; | 27 protected String name; |
28 | |
29 /** The out this facet is bound to. */ | |
30 protected String boundToOut; | |
28 | 31 |
29 /** The description of this facet. */ | 32 /** The description of this facet. */ |
30 protected String description; | 33 protected String description; |
31 | 34 |
32 | 35 |
73 | 76 |
74 | 77 |
75 /** Returns the description (e.g. displayed in gui). */ | 78 /** Returns the description (e.g. displayed in gui). */ |
76 public String getDescription() { | 79 public String getDescription() { |
77 return description; | 80 return description; |
81 } | |
82 | |
83 | |
84 /** | |
85 * Returns the name of the out this facet is bound to. | |
86 * | |
87 * @return the name of the out this facet is bound to. | |
88 */ | |
89 public String getBoundToOut() { | |
90 return boundToOut; | |
91 } | |
92 | |
93 | |
94 /** | |
95 * Binds this facet to an out. | |
96 */ | |
97 public void setBoundToOut(String value) { | |
98 boundToOut = value; | |
78 } | 99 } |
79 | 100 |
80 | 101 |
81 /** | 102 /** |
82 * @return null | 103 * @return null |
131 | 152 |
132 Element facet = ec.create("facet"); | 153 Element facet = ec.create("facet"); |
133 ec.addAttr(facet, "description", description, true); | 154 ec.addAttr(facet, "description", description, true); |
134 ec.addAttr(facet, "name", name, true); | 155 ec.addAttr(facet, "name", name, true); |
135 ec.addAttr(facet, "index", String.valueOf(index), true); | 156 ec.addAttr(facet, "index", String.valueOf(index), true); |
157 ec.addAttr(facet, "boundToOut", boundToOut, true); | |
136 | 158 |
137 return facet; | 159 return facet; |
138 } | 160 } |
139 | 161 |
140 | 162 |
141 /** Create a string representation. */ | 163 /** Create a string representation. */ |
142 public String toString() { | 164 public String toString() { |
143 return new StringBuilder("name = '") | 165 return new StringBuilder("name = '") |
144 .append(name).append("', index = ") | 166 .append(name).append("', index = ") |
145 .append(index).append(", description = '") | 167 .append(index).append(", description = '") |
146 .append(description).append("'") | 168 .append(description).append("', bound_out = '") |
169 .append(boundToOut).append("'") | |
147 .toString(); | 170 .toString(); |
148 } | 171 } |
149 | 172 |
150 | 173 |
151 /** | 174 /** |
153 */ | 176 */ |
154 public void set(Facet other) { | 177 public void set(Facet other) { |
155 index = other.getIndex(); | 178 index = other.getIndex(); |
156 name = other.getName(); | 179 name = other.getName(); |
157 description = other.getDescription(); | 180 description = other.getDescription(); |
181 boundToOut = other.getBoundToOut(); | |
158 } | 182 } |
159 | 183 |
160 | 184 |
161 /** Create a deep copy of this facet. */ | 185 /** Create a deep copy of this facet. */ |
162 public Facet deepCopy() { | 186 public Facet deepCopy() { |