annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation.java @ 4873:2b371e42a9af

Add HWS Lines parameters and ogr_connection example
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 25 Jan 2013 10:34:47 +0100
parents 32bd5af17eda
children 470460bfb5fc
rev   line source
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import org.w3c.dom.Document;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import org.w3c.dom.Element;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.List;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import java.util.ArrayList;
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
8 import java.util.Arrays;
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import java.io.Serializable;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 709
diff changeset
12 import de.intevation.artifacts.CallMeta;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 709
diff changeset
13
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
14 import de.intevation.flys.artifacts.resources.Resources;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
15
2290
6f4a1f513e89 Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2211
diff changeset
16 import de.intevation.flys.utils.Formatter;
6f4a1f513e89 Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2211
diff changeset
17
4274
f46caf95ab7f Minor javadoc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2624
diff changeset
18 /** A calculation that can have result and problems. */
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 public class Calculation
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 implements Serializable
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 {
4274
f46caf95ab7f Minor javadoc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2624
diff changeset
22 /** Problem of a calculation.
f46caf95ab7f Minor javadoc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2624
diff changeset
23 * Has location and message. */
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 710
diff changeset
24 public static class Problem
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 implements Serializable
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 {
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
27 protected Double km;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
28 protected String msg;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
29 protected Object [] args;
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public Problem() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public Problem(String msg) {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 this.msg = msg;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
38 public Problem(String msg, Object [] args) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
39 this.msg = msg;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
40 this.args = args;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
41 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
42
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 public Problem(double km, String msg) {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 this.km = km;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 this.msg = msg;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
48 public Problem(double km, String msg, Object [] args) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
49 this.km = km;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
50 this.msg = msg;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
51 this.args = args;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
52 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
53
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 709
diff changeset
54 public Element toXML(Document document, CallMeta meta) {
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 Element problem = document.createElement("problem");
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 if (km != null) {
2290
6f4a1f513e89 Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2211
diff changeset
57 problem.setAttribute(
6f4a1f513e89 Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2211
diff changeset
58 "km",
6f4a1f513e89 Calculation error report: i18n the km of the error report.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2211
diff changeset
59 Formatter.getCalculationKm(meta).format(km));
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 }
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
61 String text = args != null
2211
5400631d2f96 Fixed problems with unformatted numbers in error message.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2166
diff changeset
62 ? Resources.getMsg(meta, msg, msg, args)
5400631d2f96 Fixed problems with unformatted numbers in error message.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2166
diff changeset
63 : Resources.getMsg(meta, msg, msg);
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
64 problem.setTextContent(text);
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 return problem;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 }
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
67
4275
32bd5af17eda Made message of Calculation.Problem accessible via getter.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4274
diff changeset
68 public String getMsg() {
32bd5af17eda Made message of Calculation.Problem accessible via getter.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4274
diff changeset
69 return msg;
32bd5af17eda Made message of Calculation.Problem accessible via getter.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4274
diff changeset
70 }
32bd5af17eda Made message of Calculation.Problem accessible via getter.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4274
diff changeset
71
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
72 @Override
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
73 public boolean equals(Object other) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
74 if (!(other instanceof Problem)) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
75 return false;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
76 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
77 Problem o = (Problem)other;
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
78 return !(!msg.equals(o.msg)
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
79 || (km == null && o.km != null)
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
80 || (km != null && o.km == null)
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
81 || (km != null && !km.equals(o.km))
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
82 || !Arrays.equals(args, o.args));
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
83 }
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 } // class Problem
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 protected List<Problem> problems;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 public Calculation() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
709
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
91 public Calculation(String msg) {
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
92 addProblem(msg);
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
93 }
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
94
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 protected List<Problem> checkProblems() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 if (problems == null) {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 problems = new ArrayList<Problem>();
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 return problems;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
2624
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
102 public void addProblems(Calculation other) {
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
103 List<Problem> otherProblems = other.problems;
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
104 if (otherProblems != null) {
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
105 List<Problem> problems = checkProblems();
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
106 for (Problem problem: otherProblems) {
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
107 if (!problems.contains(problem)) {
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
108 problems.add(problem);
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
109 }
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
110 }
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
111 }
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
112 }
3f24865082da Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2290
diff changeset
113
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
114 public void addProblem(Problem problem) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
115 List<Problem> problems = checkProblems();
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
116 if (!problems.contains(problem)) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
117 problems.add(problem);
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
118 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
119 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
120
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 public void addProblem(String msg) {
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
122 addProblem(new Problem(msg));
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
123 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
124
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
125 public void addProblem(String msg, Object ... args) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
126 addProblem(new Problem(msg, args));
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 public void addProblem(double km, String msg) {
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
130 addProblem(new Problem(km, msg));
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
131 }
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
132
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
133 public void addProblem(double km, String msg, Object ... args) {
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 742
diff changeset
134 addProblem(new Problem(km, msg, args));
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 public boolean hasProblems() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 return problems != null && !problems.isEmpty();
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 public int numProblems() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 return problems != null ? problems.size() : 0;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 public List<Problem> getProblems() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 return problems;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 709
diff changeset
149 public void toXML(Document document, CallMeta meta) {
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 Element root = document.createElement("problems");
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 if (hasProblems()) {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 for (Problem problem: problems) {
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 709
diff changeset
155 root.appendChild(problem.toXML(document, meta));
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 document.appendChild(root);
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org