Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 1895:1be3a4636ee3
New convenience function to copy data from one artifact to another.
flys-artifacts/trunk@3255 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 15 Nov 2011 14:45:57 +0000 |
parents | f6a190f6aaff |
children | 9d5f339d83a3 |
comparison
equal
deleted
inserted
replaced
1894:d5e51cc7da23 | 1895:1be3a4636ee3 |
---|---|
181 | 181 |
182 protected List<String> clonePreviousStateIds() { | 182 protected List<String> clonePreviousStateIds() { |
183 return new ArrayList<String>(previousStateIds); | 183 return new ArrayList<String>(previousStateIds); |
184 } | 184 } |
185 | 185 |
186 /** | |
187 * Copies data item from other artifact to this artifact. | |
188 * @param other Artifact from which to get data. | |
189 * @param name Name of data. | |
190 */ | |
191 protected void importData(FLYSArtifact other, final String name) { | |
192 if (other == null) { | |
193 logger.error("No other art. to import data " + name + " from."); | |
194 } | |
195 | |
196 StateData sd = other.getData(name); | |
197 | |
198 if (sd == null) { | |
199 logger.warn("Other artifact has no data " + name + "."); | |
200 return; | |
201 } | |
202 | |
203 this.addData(name, sd); | |
204 } | |
186 | 205 |
187 protected Map<String, StateData> cloneData() { | 206 protected Map<String, StateData> cloneData() { |
188 Map<String, StateData> copy = new TreeMap<String, StateData>(); | 207 Map<String, StateData> copy = new TreeMap<String, StateData>(); |
189 | 208 |
190 for (Map.Entry<String, StateData> entry: data.entrySet()) { | 209 for (Map.Entry<String, StateData> entry: data.entrySet()) { |