comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/sq/SQStaticState.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 9a5b3079aad4
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8855:d7c005e12af0 8856:5e38e2924c07
61 int ms = -1; 61 int ms = -1;
62 try { 62 try {
63 ms = Integer.parseInt(measurementStation); 63 ms = Integer.parseInt(measurementStation);
64 } 64 }
65 catch (NumberFormatException nfe) { 65 catch (NumberFormatException nfe) {
66 log.error("Unparseable measurement station: " + measurementStation); 66 log.error("Unparseable measurement station: "
67 + measurementStation);
67 return null; 68 return null;
68 } 69 }
69 log.debug("Parsed measurement station: " + ms); 70 log.debug("Parsed measurement station: " + ms);
70 71
71 sqRelations = StaticSQFactory.getSQRelationsForLocation(river, ms); 72 sqRelations = StaticSQFactory.getSQRelationsForLocation(river, ms);
72 DateFormat df = new SimpleDateFormat("yyyy"); 73 DateFormat df = new SimpleDateFormat("yyyy");
73 74
74 for (StaticSQRelation.Parameter p: StaticSQRelation.Parameter.values()) { 75 for (
76 StaticSQRelation.Parameter p: StaticSQRelation.Parameter.values()
77 ) {
75 log.debug("parameter: " + p.toString()); 78 log.debug("parameter: " + p.toString());
76 List<StaticSQRelation> relations = 79 List<StaticSQRelation> relations =
77 sqRelations.getRelationsByParameter(p); 80 sqRelations.getRelationsByParameter(p);
78 81
79 if (!relations.isEmpty()) { 82 if (!relations.isEmpty()) {
80 int count = 0; 83 int count = 0;
81 84
82 for (StaticSQRelation relation : relations) { 85 for (StaticSQRelation relation : relations) {
83 log.debug("add facet for " + p.toString().toLowerCase()); 86 log.debug("add facet for " + p.toString().toLowerCase());
84 String name = "sq_" + p.toString().toLowerCase() + "_curve"; 87 String name = "sq_" + p.toString().toLowerCase()
88 + "_curve";
85 String desc = 89 String desc =
86 Resources.getMsg(context.getMeta(), 90 Resources.getMsg(context.getMeta(),
87 FACET_DESCRIPTION, 91 FACET_DESCRIPTION,
88 FACET_DESCRIPTION, 92 FACET_DESCRIPTION,
89 new Object[] { 93 new Object[] {
123 static_desc = id_parts[1]; 127 static_desc = id_parts[1];
124 } 128 }
125 } 129 }
126 130
127 if (static_id != -1) { 131 if (static_id != -1) {
128 // If the next line fails a traceback is the best debug output anyhow 132 // If next line fails a traceback is the best debug output anyhow
129 sqRelations = StaticSQFactory.getDistinctRelation(static_id); 133 sqRelations = StaticSQFactory.getDistinctRelation(static_id);
130 log.debug("Got a distinct relation" + sqRelations); 134 log.debug("Got a distinct relation" + sqRelations);
131 } else { 135 } else {
132 StaticSQRelationAccess access = new StaticSQRelationAccess(artifact); 136 StaticSQRelationAccess access =
137 new StaticSQRelationAccess(artifact);
133 String river = access.getRiverName(); 138 String river = access.getRiverName();
134 String measurementStation = access.getMeasurementStation(); 139 String measurementStation = access.getMeasurementStation();
135 140
136 int ms = -1; 141 int ms = -1;
137 try { 142 try {
138 ms = Integer.parseInt(measurementStation); 143 ms = Integer.parseInt(measurementStation);
139 } 144 }
140 catch (NumberFormatException nfe) { 145 catch (NumberFormatException nfe) {
141 log.error("Unparseable measurement station: " + measurementStation); 146 log.error("Unparseable measurement station: "
147 + measurementStation);
142 return null; 148 return null;
143 } 149 }
144 log.debug("Parsed measurement station: " + ms); 150 log.debug("Parsed measurement station: " + ms);
145 151
146 sqRelations = StaticSQFactory.getSQRelationsForLocation(river, ms); 152 sqRelations = StaticSQFactory.getSQRelationsForLocation(river, ms);
147 } 153 }
148 154
149 DateFormat df = new SimpleDateFormat("yyyy"); 155 DateFormat df = new SimpleDateFormat("yyyy");
150 156
151 for (StaticSQRelation.Parameter p: StaticSQRelation.Parameter.values()) { 157 for (
158 StaticSQRelation.Parameter p: StaticSQRelation.Parameter.values()
159 ) {
152 160
153 List<StaticSQRelation> relations = 161 List<StaticSQRelation> relations =
154 sqRelations.getRelationsByParameter(p); 162 sqRelations.getRelationsByParameter(p);
155 163
156 if (!relations.isEmpty()) { 164 if (!relations.isEmpty()) {
157 int count = 0; 165 int count = 0;
158 166
159 for (StaticSQRelation relation : relations) { 167 for (StaticSQRelation relation : relations) {
160 String name = "sq_" + p.toString().toLowerCase() + "_curve"; 168 String name = "sq_" + p.toString().toLowerCase()
169 + "_curve";
161 String desc = static_desc == null ? 170 String desc = static_desc == null ?
162 Resources.getMsg(meta, 171 Resources.getMsg(meta,
163 FACET_DESCRIPTION, 172 FACET_DESCRIPTION,
164 FACET_DESCRIPTION, 173 FACET_DESCRIPTION,
165 new Object[] { 174 new Object[] {

http://dive4elements.wald.intevation.org