Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 464:70df44021a9f
Next step of changing the concept how to use the user interface. Adapted namespaces and replaced FISArtifact with a ProxyArtifact.
gnv-artifacts/trunk@525 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Sat, 09 Jan 2010 17:55:45 +0000 |
parents | 3ddc22aab764 |
children | b7bb66440cc8 |
comparison
equal
deleted
inserted
replaced
463:07672838fa5f | 464:70df44021a9f |
---|---|
25 import de.intevation.artifacts.ArtifactFactory; | 25 import de.intevation.artifacts.ArtifactFactory; |
26 import de.intevation.artifacts.ArtifactNamespaceContext; | 26 import de.intevation.artifacts.ArtifactNamespaceContext; |
27 import de.intevation.artifacts.CallContext; | 27 import de.intevation.artifacts.CallContext; |
28 import de.intevation.artifacts.CallMeta; | 28 import de.intevation.artifacts.CallMeta; |
29 import de.intevation.gnv.artifacts.context.GNVArtifactContext; | 29 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
30 import de.intevation.gnv.artifacts.fis.product.Product; | |
31 import de.intevation.gnv.artifacts.ressource.RessourceFactory; | |
30 import de.intevation.gnv.state.DefaultInputData; | 32 import de.intevation.gnv.state.DefaultInputData; |
31 import de.intevation.gnv.state.InputData; | 33 import de.intevation.gnv.state.InputData; |
32 import de.intevation.gnv.state.InputValue; | 34 import de.intevation.gnv.state.InputValue; |
33 import de.intevation.gnv.state.OutputMode; | 35 import de.intevation.gnv.state.OutputMode; |
34 import de.intevation.gnv.state.OutputState; | 36 import de.intevation.gnv.state.OutputState; |
39 import de.intevation.gnv.transition.TransitionFactory; | 41 import de.intevation.gnv.transition.TransitionFactory; |
40 import de.intevation.gnv.utils.ArtifactXMLUtilities; | 42 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
41 | 43 |
42 /** | 44 /** |
43 * @author Tim Englich <tim.englich@intevation.de> | 45 * @author Tim Englich <tim.englich@intevation.de> |
46 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> | |
44 * | 47 * |
45 */ | 48 */ |
46 public abstract class GNVArtifactBase extends DefaultArtifact { | 49 public abstract class GNVArtifactBase extends DefaultArtifact { |
47 /** | 50 /** |
48 * the logger, used to log exceptions and additonaly information | 51 * the logger, used to log exceptions and additonaly information |
63 */ | 66 */ |
64 public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='" | 67 public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='" |
65 + XPATH_IDENTIFIER_REPLACE | 68 + XPATH_IDENTIFIER_REPLACE |
66 + "']"; | 69 + "']"; |
67 | 70 |
71 public static final String XPATH_STATIC_NODE = "/art:result/art:ui/art:static"; | |
72 | |
73 public static final String XPATH_INPUT_DATA = "/art:action/art:data/art:input"; | |
74 | |
75 public static final String XPATH_INCLUDE_UI = "/art:action/art:include-ui"; | |
76 | |
77 public static final String XPATH_TARGET_NAME = "/art:action/art:target/@name"; | |
78 | |
79 public static final String XPATH_OUTPUT_NAME = "/art:action/art:out/@name"; | |
80 | |
81 public static final String XPATH_OUTPUT_PARAMS = "/art:action/art:out/art:params/art:input"; | |
82 | |
68 /** | 83 /** |
69 * The current State | 84 * The current State |
70 */ | 85 */ |
71 protected State current = null; | 86 protected State current = null; |
72 | 87 |
77 | 92 |
78 /** | 93 /** |
79 * The Transitions which can switch between the different States. | 94 * The Transitions which can switch between the different States. |
80 */ | 95 */ |
81 protected Collection<Transition> transitions = null; | 96 protected Collection<Transition> transitions = null; |
97 | |
98 | |
99 /** | |
100 * The current product | |
101 */ | |
102 protected Product product; | |
82 | 103 |
83 /** | 104 /** |
84 * The Name of the Artifact | 105 * The Name of the Artifact |
85 */ | 106 */ |
86 protected String name = null; | 107 protected String name = null; |
181 } | 202 } |
182 return result; | 203 return result; |
183 } | 204 } |
184 | 205 |
185 protected String readStateName(Document document) { | 206 protected String readStateName(Document document) { |
186 String returnValue = Config.getStringXPath(document, | 207 String returnValue = XMLUtils.xpathString( |
187 "action/target/@name"); | 208 document, XPATH_TARGET_NAME, ArtifactNamespaceContext.INSTANCE); |
188 return returnValue; | 209 return returnValue; |
189 } | 210 } |
190 | 211 |
191 protected Node getConfigurationFragment(Document document) { | 212 protected Node getConfigurationFragment(Document document) { |
192 log.debug("GNVArtifactBase.getConfigurationFragment"); | 213 log.debug("GNVArtifactBase.getConfigurationFragment"); |
213 public Document feed(Document target, CallContext context) { | 234 public Document feed(Document target, CallContext context) { |
214 log.debug("GNVArtifactBase.feed"); | 235 log.debug("GNVArtifactBase.feed"); |
215 Document result = XMLUtils.newDocument(); | 236 Document result = XMLUtils.newDocument(); |
216 try { | 237 try { |
217 if (this.current != null) { | 238 if (this.current != null) { |
218 Collection<InputData> inputData = this.parseInputData(target, | 239 Collection<InputData> inputData = this.parseInputData( |
219 "/action/data/input"); | 240 target, |
241 XPATH_INPUT_DATA); | |
242 | |
220 if (!inputData.isEmpty()){ | 243 if (!inputData.isEmpty()){ |
221 this.current.putInputData(inputData, super.identifier); | 244 this.current.putInputData(inputData, super.identifier); |
222 result = new ArtifactXMLUtilities().createSuccessReport( | 245 result = new ArtifactXMLUtilities().createSuccessReport( |
223 "Feed success", XMLUtils.newDocument()); | 246 "Feed success", XMLUtils.newDocument()); |
224 }else{ | 247 }else{ |
237 log.error(e, e); | 260 log.error(e, e); |
238 result = new ArtifactXMLUtilities().createExceptionReport(e | 261 result = new ArtifactXMLUtilities().createExceptionReport(e |
239 .getLocalizedMessage(), XMLUtils.newDocument()); | 262 .getLocalizedMessage(), XMLUtils.newDocument()); |
240 } | 263 } |
241 return result; | 264 return result; |
265 } | |
266 | |
267 | |
268 /** | |
269 * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext) | |
270 */ | |
271 @Override | |
272 public Document describe(Document data, CallContext context) { | |
273 log.debug("GNVArtifactBase.describe"); | |
274 | |
275 Document document = createDescibeOutput( | |
276 context.getMeta(), | |
277 identifier, | |
278 getIncludeUIFromDocument(data) | |
279 ); | |
280 | |
281 // insert node for rendering product field | |
282 Element staticNode = (Element) XMLUtils.xpath( | |
283 document, | |
284 XPATH_STATIC_NODE, | |
285 XPathConstants.NODE, | |
286 ArtifactNamespaceContext.INSTANCE | |
287 ); | |
288 | |
289 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( | |
290 document, | |
291 XMLUtils.XFORM_URL, | |
292 XMLUtils.XFORM_PREFIX | |
293 ); | |
294 | |
295 if (staticNode != null) { | |
296 Element staticUI = createSelectBox(creator, document, context); | |
297 staticNode.insertBefore(staticUI, staticNode.getFirstChild()); | |
298 } | |
299 | |
300 return document; | |
242 } | 301 } |
243 | 302 |
244 /** | 303 /** |
245 * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String, | 304 * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String, |
246 * java.lang.Object) | 305 * java.lang.Object) |
288 } | 347 } |
289 | 348 |
290 } | 349 } |
291 } | 350 } |
292 | 351 |
293 | |
294 | 352 |
295 protected Document createDescibeOutput(CallMeta callMeta, String uuid, boolean incudeUI) { | 353 protected Document createDescibeOutput(CallMeta callMeta, String uuid, boolean incudeUI) { |
296 log.debug("GNVArtifactBase.createDescibeOutput"); | 354 log.debug("GNVArtifactBase.createDescibeOutput"); |
297 Document document = XMLUtils.newDocument(); | 355 Document document = XMLUtils.newDocument(); |
356 | |
357 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( | |
358 document, | |
359 ArtifactNamespaceContext.NAMESPACE_URI, | |
360 ArtifactNamespaceContext.NAMESPACE_PREFIX | |
361 ); | |
298 Element rootNode = this.createRootNode(document); | 362 Element rootNode = this.createRootNode(document); |
299 this.createHeader(rootNode, document, "describe"); | 363 this.createHeader(creator, rootNode, document, "describe"); |
300 this.createOutputs(rootNode, document); | 364 this.createOutputs(creator, rootNode, document); |
301 this.createCurrentState(rootNode, document); | 365 this.createCurrentState(creator, rootNode, document); |
302 this.createReachableStates(rootNode, document); | 366 this.createReachableStates(creator, rootNode, document); |
303 this.createModel(rootNode, document); | 367 this.createModel(creator, rootNode, document); |
304 if (incudeUI){ | 368 if (incudeUI){ |
305 this.createUserInterface(rootNode, document, callMeta, uuid); | 369 this.createUserInterface(creator, rootNode, document, callMeta, uuid); |
306 } | 370 } |
371 | |
307 return document; | 372 return document; |
308 } | 373 } |
309 | 374 |
310 protected boolean getIncludeUIFromDocument(Document document){ | 375 protected boolean getIncludeUIFromDocument(Document document){ |
311 String value = Config.getStringXPath(document, "action/include-ui"); | 376 String value = XMLUtils.xpathString( |
377 document, XPATH_INCLUDE_UI, ArtifactNamespaceContext.INSTANCE); | |
378 | |
312 boolean includeUI = false; | 379 boolean includeUI = false; |
313 if (value != null){ | 380 if (value != null){ |
314 includeUI = Boolean.parseBoolean(value); | 381 includeUI = Boolean.parseBoolean(value); |
315 } | 382 } |
383 log.debug("INCLUDE UI? " + includeUI); | |
316 return includeUI; | 384 return includeUI; |
317 } | 385 } |
318 | 386 |
319 protected Element createRootNode(Document document) { | 387 protected Element createRootNode(Document document) { |
320 Element rootNode = xmlUtilities.createArtifactElement(document, | 388 Element rootNode = xmlUtilities.createArtifactElement(document, |
321 "result"); | 389 "result"); |
322 document.appendChild(rootNode); | 390 document.appendChild(rootNode); |
323 return rootNode; | 391 return rootNode; |
324 } | 392 } |
325 | 393 |
326 protected void createHeader(Element parent, Document document, | 394 protected void createHeader( |
327 String documentType) { | 395 XMLUtils.ElementCreator creator, |
328 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); | 396 Element parent, |
329 typeNode.setAttribute("name", documentType); | 397 Document document, |
398 String documentType | |
399 ) { | |
400 Element typeNode = creator.create("type"); | |
401 creator.addAttr(typeNode, "name", documentType); | |
330 parent.appendChild(typeNode); | 402 parent.appendChild(typeNode); |
331 | 403 |
332 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); | 404 Element uuidNode = creator.create("uuid"); |
333 uuidNode.setAttribute("value", super.identifier); | 405 creator.addAttr(uuidNode, "value", super.identifier); |
334 parent.appendChild(uuidNode); | 406 parent.appendChild(uuidNode); |
335 | 407 |
336 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); | 408 Element hashNode = creator.create("hash"); |
337 hashNode.setAttribute("value", this.hash()); | 409 creator.addAttr(hashNode, "value", this.hash()); |
338 parent.appendChild(hashNode); | 410 parent.appendChild(hashNode); |
339 } | 411 } |
340 | 412 |
341 protected void createReachableStates(Element parent, Document document) { | 413 protected Element createSelectBox( |
342 Element stateNode = xmlUtilities.createArtifactElement(document, | 414 XMLUtils.ElementCreator creator, |
343 "reachable-states"); | 415 Document document, |
416 CallContext context | |
417 ) { | |
418 RessourceFactory resource = RessourceFactory.getInstance(); | |
419 CallMeta callMeta = (CallMeta) context.getMeta(); | |
420 String productName = product.getName(); | |
421 | |
422 Element selectNode = creator.create("select1"); | |
423 creator.addAttr(selectNode, "ref", "product"); | |
424 | |
425 Element labelNode = creator.create("label"); | |
426 labelNode.setTextContent( | |
427 resource.getRessource(callMeta.getLanguages(), "product", "product") | |
428 ); | |
429 | |
430 Element choicesNode = creator.create("choices"); | |
431 | |
432 Element itemNode = creator.create("item"); | |
433 creator.addAttr(itemNode, "selected", "true"); | |
434 | |
435 Element choiceLabel = creator.create("label"); | |
436 choiceLabel.setTextContent(resource.getRessource( | |
437 callMeta.getLanguages(), | |
438 productName, | |
439 productName | |
440 )); | |
441 | |
442 Element choiceValue = creator.create("value"); | |
443 choiceValue.setTextContent(productName); | |
444 | |
445 itemNode.appendChild(choiceLabel); | |
446 itemNode.appendChild(choiceValue); | |
447 choicesNode.appendChild(itemNode); | |
448 | |
449 selectNode.appendChild(labelNode); | |
450 selectNode.appendChild(choicesNode); | |
451 | |
452 return selectNode; | |
453 } | |
454 | |
455 protected void createReachableStates( | |
456 XMLUtils.ElementCreator creator, | |
457 Element parent, | |
458 Document document | |
459 ) { | |
460 Element stateNode = creator.create("reachable-states"); | |
344 if (this.current != null) { | 461 if (this.current != null) { |
345 Iterator<Transition> transitions = this.transitions.iterator(); | 462 Iterator<Transition> transitions = this.transitions.iterator(); |
346 while (transitions.hasNext()) { | 463 while (transitions.hasNext()) { |
347 Transition tmpTransition = transitions.next(); | 464 Transition tmpTransition = transitions.next(); |
348 if (tmpTransition.getFrom().equals(current.getID()) && | 465 if (tmpTransition.getFrom().equals(current.getID()) && |
349 tmpTransition.isValid(this.current)){ | 466 tmpTransition.isValid(this.current)){ |
350 Element currentNode = xmlUtilities.createArtifactElement( | 467 Element currentNode = creator.create("state"); |
351 document, "state"); | 468 creator.addAttr(currentNode, "name", tmpTransition.getTo()); |
352 currentNode.setAttribute("name", tmpTransition.getTo()); | |
353 log.debug("Reachable State: " + tmpTransition.getTo()); | 469 log.debug("Reachable State: " + tmpTransition.getTo()); |
354 currentNode.setAttribute("description", | 470 creator.addAttr( |
355 this.states.get(tmpTransition.getTo()) | 471 currentNode, |
356 .getDescription()); | 472 "description", |
473 this.states.get(tmpTransition.getTo()).getDescription()); | |
357 stateNode.appendChild(currentNode); | 474 stateNode.appendChild(currentNode); |
358 } | 475 } |
359 } | 476 } |
360 } | 477 } |
361 parent.appendChild(stateNode); | 478 parent.appendChild(stateNode); |
362 } | 479 } |
363 | 480 |
364 protected void createCurrentState(Element parent, Document document) { | 481 protected void createCurrentState( |
365 Element stateNode = xmlUtilities.createArtifactElement(document, | 482 XMLUtils.ElementCreator creator, |
366 "state"); | 483 Element parent, |
367 stateNode.setAttribute("name", this.current.getID()); | 484 Document document |
368 stateNode.setAttribute("description", this.current.getDescription()); | 485 ) { |
486 Element stateNode = creator.create("state"); | |
487 creator.addAttr(stateNode, "name", this.current.getID()); | |
488 creator.addAttr(stateNode, "description", this.current.getDescription()); | |
369 parent.appendChild(stateNode); | 489 parent.appendChild(stateNode); |
370 } | 490 } |
371 | 491 |
372 protected void createModel(Element parent, Document document) { | 492 protected void createModel( |
373 Element modelNode = xmlUtilities.createArtifactElement(document, | 493 XMLUtils.ElementCreator creator, |
374 "model"); | 494 Element parent, |
495 Document document | |
496 ) { | |
497 Element modelNode = creator.create("model"); | |
375 if (this.current != null) { | 498 if (this.current != null) { |
376 Collection<InputValue> inputValues = this.current | 499 Collection<InputValue> inputValues = this.current |
377 .getRequiredInputValues(); | 500 .getRequiredInputValues(); |
378 if (inputValues != null) { | 501 if (inputValues != null) { |
379 Iterator<InputValue> it = inputValues.iterator(); | 502 Iterator<InputValue> it = inputValues.iterator(); |
380 while (it.hasNext()) { | 503 while (it.hasNext()) { |
381 InputValue inputValue = it.next(); | 504 InputValue inputValue = it.next(); |
382 Element inputNode = xmlUtilities.createArtifactElement( | 505 Element inputNode = creator.create("input"); |
383 document, "input"); | 506 creator.addAttr(inputNode, "name", inputValue.getName()); |
384 inputNode.setAttribute("name", inputValue.getName()); | 507 creator.addAttr(inputNode, "type", inputValue.getType()); |
385 inputNode.setAttribute("type", inputValue.getType()); | |
386 modelNode.appendChild(inputNode); | 508 modelNode.appendChild(inputNode); |
387 } | 509 } |
388 } | 510 } |
389 } | 511 } |
390 parent.appendChild(modelNode); | 512 parent.appendChild(modelNode); |
391 } | 513 } |
392 | 514 |
393 protected void createUserInterface(Element parent, Document document, | 515 protected void createUserInterface( |
394 CallMeta callMeta, String uuid) { | 516 XMLUtils.ElementCreator creator, |
395 Element uiNode = xmlUtilities.createArtifactElement(document, "ui"); | 517 Element parent, |
518 Document document, | |
519 CallMeta callMeta, | |
520 String uuid | |
521 ) { | |
522 Element uiNode = creator.create("ui"); | |
396 | 523 |
397 if (this.current != null) { | 524 if (this.current != null) { |
398 this.current.describe(document, uiNode, callMeta, uuid); | 525 this.current.describe(document, uiNode, callMeta, uuid); |
399 } | 526 } |
400 | 527 |
401 parent.appendChild(uiNode); | 528 parent.appendChild(uiNode); |
402 } | 529 } |
403 | 530 |
404 protected void createOutputs(Element parent, Document document) { | 531 protected void createOutputs( |
532 XMLUtils.ElementCreator creator, | |
533 Element parent, | |
534 Document document | |
535 ) { | |
405 log.debug("GNVArtifactBase.createOutputs"); | 536 log.debug("GNVArtifactBase.createOutputs"); |
406 Element outputsNode = xmlUtilities.createArtifactElement(document, | 537 Element outputsNode = creator.create("outputs"); |
407 "outputs"); | |
408 if (this.current instanceof OutputState) { | 538 if (this.current instanceof OutputState) { |
409 Collection<OutputMode> outputModes = ((OutputState) this.current) | 539 Collection<OutputMode> outputModes = ((OutputState) this.current) |
410 .getOutputModes(); | 540 .getOutputModes(); |
411 if (outputModes != null) { | 541 if (outputModes != null) { |
412 Iterator<OutputMode> it = outputModes.iterator(); | 542 Iterator<OutputMode> it = outputModes.iterator(); |
413 while (it.hasNext()) { | 543 while (it.hasNext()) { |
414 OutputMode outputMode = it.next(); | 544 OutputMode outputMode = it.next(); |
415 log.debug("Write Outputnode for " + outputMode.toString()); | 545 log.debug("Write Outputnode for " + outputMode.toString()); |
416 Element outputModeNode = xmlUtilities | 546 Element outputModeNode = creator.create("output"); |
417 .createArtifactElement(document, "output"); | 547 creator.addAttr( |
418 outputModeNode.setAttribute("name", outputMode.getName()); | 548 outputModeNode, "name", outputMode.getName()); |
419 outputModeNode.setAttribute("description", outputMode | 549 creator.addAttr( |
420 .getDescription()); | 550 outputModeNode, "description", outputMode.getDescription()); |
421 outputModeNode.setAttribute("mime-type", outputMode | 551 creator.addAttr( |
422 .getMimeType()); | 552 outputModeNode, "mime-type", outputMode.getMimeType()); |
423 outputsNode.appendChild(outputModeNode); | 553 outputsNode.appendChild(outputModeNode); |
424 | 554 |
425 Collection<InputValue> inputParameters = outputMode | 555 Collection<InputValue> inputParameters = outputMode |
426 .getInputParameters(); | 556 .getInputParameters(); |
427 if (inputParameters != null) { | 557 if (inputParameters != null) { |
428 Element inputParametersNode = xmlUtilities | 558 Element inputParametersNode = creator.create("parameter"); |
429 .createArtifactElement(document, "parameter"); | |
430 outputModeNode.appendChild(inputParametersNode); | 559 outputModeNode.appendChild(inputParametersNode); |
431 Iterator<InputValue> it2 = inputParameters.iterator(); | 560 Iterator<InputValue> it2 = inputParameters.iterator(); |
432 while (it2.hasNext()) { | 561 while (it2.hasNext()) { |
433 InputValue inputValue = it2.next(); | 562 InputValue inputValue = it2.next(); |
434 Element inputParameterNode = xmlUtilities | 563 Element inputParameterNode = |
435 .createArtifactElement(document, | 564 creator.create("parameter"); |
436 "parameter"); | 565 creator.addAttr( |
566 inputParameterNode, "name", inputValue.getName()); | |
567 creator.addAttr( | |
568 inputParameterNode, "type", inputValue.getType()); | |
569 creator.addAttr( | |
570 inputParameterNode, "value", inputValue.getDefaultValue()); | |
437 inputParametersNode.appendChild(inputParameterNode); | 571 inputParametersNode.appendChild(inputParameterNode); |
438 inputParameterNode.setAttribute("name", inputValue | |
439 .getName()); | |
440 inputParameterNode.setAttribute("type", inputValue | |
441 .getType()); | |
442 inputParameterNode.setAttribute("value", inputValue | |
443 .getDefaultValue()); | |
444 } | 572 } |
445 } | 573 } |
446 } | 574 } |
447 } else { | 575 } else { |
448 log.warn("No Outputmodes given."); | 576 log.warn("No Outputmodes given."); |
451 parent.appendChild(outputsNode); | 579 parent.appendChild(outputsNode); |
452 } | 580 } |
453 | 581 |
454 protected Collection<InputData> parseInputData(Document document, | 582 protected Collection<InputData> parseInputData(Document document, |
455 String xPath) { | 583 String xPath) { |
456 log.debug("GNVArtifactBase.parseInputData"); | |
457 HashMap<String, InputData> returnValue = null; | 584 HashMap<String, InputData> returnValue = null; |
458 | 585 |
459 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); | |
460 | |
461 NodeList inputElemets = (NodeList) XMLUtils.xpath(document, xPath, | 586 NodeList inputElemets = (NodeList) XMLUtils.xpath(document, xPath, |
462 XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);// Config.getNodeSetXPath(document, | 587 XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE); |
463 // ""); | |
464 if (inputElemets != null) { | 588 if (inputElemets != null) { |
465 returnValue = new HashMap<String, InputData>(inputElemets | 589 returnValue = new HashMap<String, InputData>(); |
466 .getLength()); | 590 |
467 for (int i = 0; i < inputElemets.getLength(); i++) { | 591 for (int i = 0; i < inputElemets.getLength(); i++) { |
468 Element inputDataNode = (Element)inputElemets.item(i); | 592 Element inputDataNode = (Element)inputElemets.item(i); |
469 String name = inputDataNode.getAttribute("name"); | 593 String name = inputDataNode.getAttribute("name"); |
470 String value = inputDataNode.getAttribute("value"); | 594 String value = inputDataNode.getAttribute("value"); |
471 | 595 |
495 try { | 619 try { |
496 | 620 |
497 if (current != null && current instanceof OutputState) { | 621 if (current != null && current instanceof OutputState) { |
498 ((OutputState) current) | 622 ((OutputState) current) |
499 .out(format, this.parseInputData( | 623 .out(format, this.parseInputData( |
500 format, "/action/out/params/input"), | 624 format, XPATH_OUTPUT_PARAMS), |
501 outputStream, super.identifier, context); | 625 outputStream, super.identifier, context); |
502 } | 626 } |
503 } catch (StateException e) { | 627 } catch (StateException e) { |
504 log.error(e, e); | 628 log.error(e, e); |
505 throw new IOException(e.getMessage()); | 629 throw new IOException(e.getMessage()); |
506 } | 630 } |
507 } | 631 } |
508 | 632 |
509 protected String readOutputType(Document document) { | 633 protected String readOutputType(Document document) { |
510 String value = Config.getStringXPath(document, "action/out/@name"); | 634 String value = XMLUtils.xpathString( |
635 document, XPATH_OUTPUT_NAME, ArtifactNamespaceContext.INSTANCE); | |
511 return value; | 636 return value; |
512 } | 637 } |
638 | |
639 | |
640 public void setProduct(Product product) { | |
641 this.product = product; | |
642 } | |
513 } | 643 } |
644 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |