comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1079:ef756e166154

Improved implementation of MainValueArtifact#MainValueFacet . flys-artifacts/trunk@2576 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 25 Aug 2011 10:42:23 +0000
parents 048517d67215
children fa01c3602f66
comparison
equal deleted inserted replaced
1078:048517d67215 1079:ef756e166154
138 state.getOutputs().add(mainValuesOutput); 138 state.getOutputs().add(mainValuesOutput);
139 return state; 139 return state;
140 } 140 }
141 141
142 142
143 /* FACET IMPLEMENTATION */ 143 /* FACET IMPLEMENTATION */
144 class MainValuesFacet extends DefaultFacet { 144 // TODO evaluate whether DefaultFacet can do.
145 static class MainValuesFacet
146 extends DefaultFacet
147 implements FacetTypes {
145 148
146 public MainValuesFacet() 149 public MainValuesFacet() {
147 { 150 description = "facet.discharge_curves.mainvalues.description";
148 description = "facet.mainvalues"; 151 name = COMPUTED_DISCHARGE_MAINVALUES;
149 name = "facet.mainvalues"; 152 //Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION));
150 index = 0; 153 index = 0;
151 } 154 }
152 155
153 // TODO implement; what is index used for? 156
154 /**
155 * Returns the index of this facet.
156 *
157 * @return the index of this facet.
158 */
159 public int getIndex() {
160 return 0;
161 }
162
163
164 /**
165 * Returns the name of this facet.
166 *
167 * @return the name of this facet.
168 */
169 public String getName() {
170 // TODO define, static
171 // TODO remove, is part of DefaultFacet.
172 return "facet.mainvalue";
173 }
174
175
176 /** 157 /**
177 * Returns the description of this facet. 158 * Returns the description of this facet.
178 * 159 *
179 * @return the description of this facet. 160 * @return the description of this facet.
180 */ 161 */
162 @Override
181 public String getDescription() { 163 public String getDescription() {
182 // TODO remove, is part of DefaultFacet. 164 // TODO remove, is part of DefaultFacet.
183 return "facet.mainvalues"; 165 return "facet.mainvalues";
184 } 166 }
185 167
186 168
187 /** 169 /**
188 * Returns the data this facet requires. 170 * Returns the data this facet requires.
189 * 171 *
190 * @param artifact The owner artifact. 172 * @param artifact the owner artifact.
191 * @param context The CallContext. 173 * @param context the CallContext (ignored).
192 * 174 *
193 * @return the data. 175 * @return the data.
194 */ 176 */
177 @Override
195 public Object getData(Artifact artifact, CallContext context) { 178 public Object getData(Artifact artifact, CallContext context) {
196 return null; 179 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact;
180 return mvArtifact.getMainValues();
197 } 181 }
198 182
199 183
200 /** 184 /**
201 * Create a deep copy of this Facet. 185 * Create a deep copy of this Facet.
202 * @return a deep copy. 186 * @return a deep copy.
203 */ 187 */
188 @Override
204 public MainValuesFacet deepCopy() { 189 public MainValuesFacet deepCopy() {
205 MainValuesFacet copy = new MainValuesFacet(); 190 MainValuesFacet copy = new MainValuesFacet();
206 copy.set(this); 191 copy.set(this);
207 return copy; 192 return copy;
208 } 193 }

http://dive4elements.wald.intevation.org