svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.library / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.buffer.api / src / main / java / org / gvsig / raster / lib / buffer / api / operations / InvalidLookupParametersException.java @ 43862
History | View | Annotate | Download (3.25 KB)
1 | 43803 | fdiaz | /* gvSIG. Desktop Geographic Information System.
|
---|---|---|---|
2 | *
|
||
3 | * Copyright ? 2007-2018 gvSIG Association
|
||
4 | *
|
||
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
18 | * MA 02110-1301, USA.
|
||
19 | *
|
||
20 | * For any additional information, do not hesitate to contact us
|
||
21 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
22 | */
|
||
23 | package org.gvsig.raster.lib.buffer.api.operations; |
||
24 | |||
25 | import java.util.Iterator; |
||
26 | import java.util.List; |
||
27 | |||
28 | |||
29 | /**
|
||
30 | * @author fdiaz
|
||
31 | *
|
||
32 | */
|
||
33 | public class InvalidLookupParametersException extends Exception { |
||
34 | |||
35 | /**
|
||
36 | *
|
||
37 | */
|
||
38 | private static final long serialVersionUID = -3346605304349172330L; |
||
39 | |||
40 | /**
|
||
41 | * @author fdiaz
|
||
42 | *
|
||
43 | */
|
||
44 | 43862 | jjdelcerro | public static class Problem { |
45 | 43803 | fdiaz | |
46 | 43862 | jjdelcerro | private final String operation; |
47 | private final String parameterName; |
||
48 | private final String lookupParameterName; |
||
49 | 43803 | fdiaz | |
50 | /**
|
||
51 | * @param operation
|
||
52 | * @param parameterName
|
||
53 | * @param lookupParameterName
|
||
54 | */
|
||
55 | public Problem(String operation, String parameterName, String lookupParameterName){ |
||
56 | this.operation = operation;
|
||
57 | this.parameterName = parameterName;
|
||
58 | this.lookupParameterName = lookupParameterName;
|
||
59 | |||
60 | } |
||
61 | /**
|
||
62 | * @return
|
||
63 | */
|
||
64 | public String getOperation(){ |
||
65 | return this.operation; |
||
66 | } |
||
67 | |||
68 | /**
|
||
69 | * @return
|
||
70 | */
|
||
71 | public String getParameterName() { |
||
72 | return this.parameterName; |
||
73 | } |
||
74 | |||
75 | /**
|
||
76 | * @return
|
||
77 | */
|
||
78 | public String getLookupParameterName() { |
||
79 | return this.lookupParameterName; |
||
80 | } |
||
81 | |||
82 | } |
||
83 | |||
84 | private List<Problem> problems; |
||
85 | |||
86 | /**
|
||
87 | * @param problems
|
||
88 | *
|
||
89 | */
|
||
90 | public InvalidLookupParametersException(List<Problem> problems) { |
||
91 | this.setProblems(problems);
|
||
92 | } |
||
93 | |||
94 | /**
|
||
95 | * @return the problems
|
||
96 | */
|
||
97 | public List<Problem> getProblems() { |
||
98 | return problems;
|
||
99 | } |
||
100 | |||
101 | /**
|
||
102 | * @param problems the problems to set
|
||
103 | */
|
||
104 | private void setProblems(List<Problem> problems) { |
||
105 | this.problems = problems;
|
||
106 | } |
||
107 | |||
108 | @Override
|
||
109 | public String getMessage() { |
||
110 | StringBuilder message = new StringBuilder("Problems to validate lookup parameters:\n"); |
||
111 | 43862 | jjdelcerro | for (Problem problem : problems) {
|
112 | 43803 | fdiaz | message.append("The parameter ");
|
113 | message.append(problem.parameterName); |
||
114 | message.append("of the operation ");
|
||
115 | message.append(problem.operation); |
||
116 | message.append(" can't be set because can't lookup the parameter ");
|
||
117 | message.append(problem.lookupParameterName); |
||
118 | message.append(" .\n");
|
||
119 | } |
||
120 | return message.toString();
|
||
121 | } |
||
122 | |||
123 | } |