Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation.java @ 710:cded0924193d
Added generator and facet for error reports.
flys-artifacts/trunk@2166 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 20 Jun 2011 13:47:59 +0000 |
parents | 3b7e9ddf6bb1 |
children | c09c9e05ecfa |
comparison
equal
deleted
inserted
replaced
709:3b7e9ddf6bb1 | 710:cded0924193d |
---|---|
5 | 5 |
6 import java.util.List; | 6 import java.util.List; |
7 import java.util.ArrayList; | 7 import java.util.ArrayList; |
8 | 8 |
9 import java.io.Serializable; | 9 import java.io.Serializable; |
10 | |
11 import de.intevation.artifacts.CallMeta; | |
10 | 12 |
11 public class Calculation | 13 public class Calculation |
12 implements Serializable | 14 implements Serializable |
13 { | 15 { |
14 public static class Problem | 16 public static class Problem |
27 public Problem(double km, String msg) { | 29 public Problem(double km, String msg) { |
28 this.km = km; | 30 this.km = km; |
29 this.msg = msg; | 31 this.msg = msg; |
30 } | 32 } |
31 | 33 |
32 public Element toXML(Document document) { | 34 public Element toXML(Document document, CallMeta meta) { |
35 // TODO: i18n | |
33 Element problem = document.createElement("problem"); | 36 Element problem = document.createElement("problem"); |
34 if (km != null) { | 37 if (km != null) { |
35 problem.setAttribute("km", String.valueOf(km)); | 38 problem.setAttribute("km", String.valueOf(km)); |
36 } | 39 } |
37 problem.setTextContent(msg); | 40 problem.setTextContent(msg); |
73 | 76 |
74 public List<Problem> getProblems() { | 77 public List<Problem> getProblems() { |
75 return problems; | 78 return problems; |
76 } | 79 } |
77 | 80 |
78 public void toXML(Document document) { | 81 public void toXML(Document document, CallMeta meta) { |
79 | 82 |
80 Element root = document.createElement("problems"); | 83 Element root = document.createElement("problems"); |
81 | 84 |
82 if (hasProblems()) { | 85 if (hasProblems()) { |
83 for (Problem problem: problems) { | 86 for (Problem problem: problems) { |
84 root.appendChild(problem.toXML(document)); | 87 root.appendChild(problem.toXML(document, meta)); |
85 } | 88 } |
86 } | 89 } |
87 | 90 |
88 document.appendChild(root); | 91 document.appendChild(root); |
89 } | 92 } |