comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 3634:001e35349203

Fix issue829, wst col indices start with 0. flys-artifacts/trunk@5342 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Sat, 01 Sep 2012 15:44:38 +0000
parents c105b4466b4e
children a2735a4bf75e
comparison
equal deleted inserted replaced
3633:ebfce31c7eec 3634:001e35349203
41 { 41 {
42 /** The logger for this class. */ 42 /** The logger for this class. */
43 private static Logger logger = 43 private static Logger logger =
44 Logger.getLogger(WQKmsInterpolArtifact.class); 44 Logger.getLogger(WQKmsInterpolArtifact.class);
45 45
46 /** State name. */
46 public static final String STATIC_STATE_NAME = 47 public static final String STATIC_STATE_NAME =
47 "state.additional_wqkms.interpol.static"; 48 "state.additional_wqkms.interpol.static";
48 49
50 /** Artifact name. */
49 private static final String NAME = "staticwqkmsinterpol"; 51 private static final String NAME = "staticwqkmsinterpol";
50 52
51 static { 53 static {
52 // TODO: Move to configuration. 54 // TODO: Move to configuration.
53 FacetActivity.Registry.getInstance() 55 FacetActivity.Registry.getInstance()
64 public WQKmsInterpolArtifact() { 66 public WQKmsInterpolArtifact() {
65 logger.debug("WQKmsInterpolArtifact.WQKmsInterpolArtifact"); 67 logger.debug("WQKmsInterpolArtifact.WQKmsInterpolArtifact");
66 } 68 }
67 69
68 70
71 /** Return fixed artifact (types) name. */
69 @Override 72 @Override
70 public String getName() { 73 public String getName() {
71 return NAME; 74 return NAME;
72 } 75 }
73 76
93 // TODO Go for JSON, one day. 96 // TODO Go for JSON, one day.
94 //ex.: flood_protection-wstv-114-12 97 //ex.: flood_protection-wstv-114-12
95 if (code != null) { 98 if (code != null) {
96 String [] parts = code.split("-"); 99 String [] parts = code.split("-");
97 100
101 logger.debug("WQKmsInterpolArtifact.setup: code " + code);
102
98 if (parts.length >= 4) { 103 if (parts.length >= 4) {
99 int wst = Integer.parseInt(parts[3]); 104 int wst = Integer.parseInt(parts[3]);
100 int col = -1; 105 int col = -1;
101 String colpos = parts[2]; 106 String colpos = parts[2];
102 // Are we interested in a single column or in all columns? 107 // Are we interested in a single column or in all columns?
106 else { 111 else {
107 col = Integer.parseInt(colpos); 112 col = Integer.parseInt(colpos);
108 addStringData("col_pos", parts[2]); 113 addStringData("col_pos", parts[2]);
109 } 114 }
110 addStringData("wst_id", parts[3]); 115 addStringData("wst_id", parts[3]);
111 String wkmsName = (col > 0) 116 String wkmsName = (col >= 0)
112 ? WKmsFactory.getWKmsName(col, wst) 117 ? WKmsFactory.getWKmsName(col, wst)
113 : WKmsFactory.getWKmsName(wst); 118 : WKmsFactory.getWKmsName(wst);
114 String name; 119 String name;
115 if (parts[0].startsWith("height")){ 120 if (parts[0].startsWith("height")){
116 name = STATIC_WQ_ANNOTATIONS; 121 name = STATIC_WQ_ANNOTATIONS;
128 wkmsName, 133 wkmsName,
129 wkmsName)); 134 wkmsName));
130 fs.add(wQFacet); 135 fs.add(wQFacet);
131 facets.put(state.getID(), fs); 136 facets.put(state.getID(), fs);
132 } 137 }
138 }
139 else {
140 logger.warn("WQKmsInterpolArtifact: no code");
133 } 141 }
134 142
135 spawnState(); 143 spawnState();
136 super.setup(identifier, factory, context, callMeta, data); 144 super.setup(identifier, factory, context, callMeta, data);
137 } 145 }

http://dive4elements.wald.intevation.org