Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java @ 204:734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
gnv-artifacts/trunk@259 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Thu, 22 Oct 2009 08:50:21 +0000 |
parents | 63f65fb9f210 |
children | d87347142702 |
comparison
equal
deleted
inserted
replaced
203:226091ed3cbd | 204:734ac082c8d1 |
---|---|
115 /** | 115 /** |
116 * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node) | 116 * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node) |
117 */ | 117 */ |
118 public void setup(Node configuration) { | 118 public void setup(Node configuration) { |
119 log.debug("TransitionBase.setup"); | 119 log.debug("TransitionBase.setup"); |
120 this.id = Config.getStringXPath(configuration, "@id"); | 120 this.id = ((Element)configuration).getAttribute("id"); |
121 this.description = Config.getStringXPath(configuration, "@description"); | 121 this.description = ((Element)configuration).getAttribute("description"); |
122 | 122 |
123 log.info("Transition-ID = " + this.id); | 123 log.info("Transition-ID = " + this.id); |
124 NodeList nodes = Config.getNodeSetXPath(configuration, | 124 NodeList nodes = Config.getNodeSetXPath(configuration, |
125 "reachableTransitions/transition"); | 125 "reachableTransitions/transition"); |
126 this.reachableTransitions = new ArrayList<String>(nodes.getLength()); | 126 this.reachableTransitions = new ArrayList<String>(nodes.getLength()); |
136 this.inputValues = new HashMap<String, InputValue>(inputValuesNodes | 136 this.inputValues = new HashMap<String, InputValue>(inputValuesNodes |
137 .getLength()); | 137 .getLength()); |
138 this.inputValueNames = new ArrayList<String>(inputValuesNodes | 138 this.inputValueNames = new ArrayList<String>(inputValuesNodes |
139 .getLength()); | 139 .getLength()); |
140 for (int i = 0; i < inputValuesNodes.getLength(); i++) { | 140 for (int i = 0; i < inputValuesNodes.getLength(); i++) { |
141 Node inputValueNode = inputValuesNodes.item(i); | 141 Element inputValueNode = (Element)inputValuesNodes.item(i); |
142 String usedinQueryValue = Config.getStringXPath(inputValueNode, | 142 String usedinQueryValue = inputValueNode.getAttribute("usedinquery"); |
143 "@usedinquery"); | |
144 int usedinQuery = 1; | 143 int usedinQuery = 1; |
145 if (usedinQueryValue != null) { | 144 if (usedinQueryValue != null) { |
146 try { | 145 try { |
147 usedinQuery = Integer.parseInt(usedinQueryValue); | 146 usedinQuery = Integer.parseInt(usedinQueryValue); |
148 } catch (NumberFormatException e) { | 147 } catch (NumberFormatException e) { |
149 log | 148 log |
150 .warn("Used in Query Value cannot be transformed into a Number"); | 149 .warn("Used in Query Value cannot be transformed into a Number"); |
151 } | 150 } |
152 } | 151 } |
153 InputValue inputValue = new DefaultInputValue(Config | 152 InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"), |
154 .getStringXPath(inputValueNode, "@name"), Config | 153 inputValueNode.getAttribute("type"), |
155 .getStringXPath(inputValueNode, "@type"), Boolean | 154 Boolean.parseBoolean(inputValueNode. |
156 .parseBoolean(Config.getStringXPath(inputValueNode, | 155 getAttribute("multiselect")), usedinQuery); |
157 "@multiselect")), usedinQuery); | |
158 log.debug(inputValue.toString()); | 156 log.debug(inputValue.toString()); |
159 this.inputValues.put(inputValue.getName(), inputValue); | 157 this.inputValues.put(inputValue.getName(), inputValue); |
160 this.inputValueNames.add(inputValue.getName()); | 158 this.inputValueNames.add(inputValue.getName()); |
161 } | 159 } |
162 | 160 |