Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWQKmsArtifact.java @ 6598:ca56c4e6a755
Mark staticwqkms that are loaded as officiallines recommendation as official
This allows special case handling of them.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 18 Jul 2013 13:12:39 +0200 |
parents | 2e57fb04aa6f |
children | 08527cc6341f |
comparison
equal
deleted
inserted
replaced
6597:27f5182996ea | 6598:ca56c4e6a755 |
---|---|
57 public static final String STATIC_STATE_NAME = | 57 public static final String STATIC_STATE_NAME = |
58 "state.additional_wqkms.static"; | 58 "state.additional_wqkms.static"; |
59 | 59 |
60 private static final String NAME = "staticwqkms"; | 60 private static final String NAME = "staticwqkms"; |
61 | 61 |
62 private boolean official = false; | |
63 | |
62 static { | 64 static { |
63 // TODO: Move to configuration. | 65 // TODO: Move to configuration. |
64 FacetActivity.Registry.getInstance().register( | 66 FacetActivity.Registry.getInstance().register( |
65 NAME, | 67 NAME, |
66 new FacetActivity() { | 68 new FacetActivity() { |
83 } | 85 } |
84 | 86 |
85 | 87 |
86 /** | 88 /** |
87 * Gets called from factory, to set things up. | 89 * Gets called from factory, to set things up. |
90 * | |
91 * If the id's string starts with official- it will be treated as | |
92 * an Artifact containing official data for the according special | |
93 * case handling. | |
88 */ | 94 */ |
89 @Override | 95 @Override |
90 public void setup( | 96 public void setup( |
91 String identifier, | 97 String identifier, |
92 ArtifactFactory factory, | 98 ArtifactFactory factory, |
103 | 109 |
104 String code = getDatacageIDValue(data); | 110 String code = getDatacageIDValue(data); |
105 addStringData("ids", code); | 111 addStringData("ids", code); |
106 if (code != null) { | 112 if (code != null) { |
107 String [] parts = code.split("-"); | 113 String [] parts = code.split("-"); |
114 | |
115 if (parts.length >= 1) { | |
116 official = parts[0].toLowerCase().equals("official"); | |
117 } | |
108 | 118 |
109 if (parts.length >= 4) { | 119 if (parts.length >= 4) { |
110 int col = Integer.parseInt(parts[2]); | 120 int col = Integer.parseInt(parts[2]); |
111 int wst = Integer.parseInt(parts[3]); | 121 int wst = Integer.parseInt(parts[3]); |
112 | 122 |
220 } | 230 } |
221 | 231 |
222 return Lines.createWaterLines(points, wAtKm); | 232 return Lines.createWaterLines(points, wAtKm); |
223 } | 233 } |
224 // TODO implement deepCopy. | 234 // TODO implement deepCopy. |
235 | |
236 public boolean isOfficial() | |
237 { | |
238 return official; | |
239 } | |
225 } | 240 } |
226 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 241 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |