Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/validation/rules/probe/DeskriptorToUmwelt.java @ 1336:18c789672b14
Made validator messages more verbose for importer.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 06 Apr 2017 10:10:39 +0200 |
parents | 186d602e031a |
children |
comparison
equal
deleted
inserted
replaced
1335:b9eb9229df21 | 1336:18c789672b14 |
---|---|
102 new QueryBuilder<DeskriptorUmwelt>( | 102 new QueryBuilder<DeskriptorUmwelt>( |
103 repository.entityManager("stamm"), DeskriptorUmwelt.class); | 103 repository.entityManager("stamm"), DeskriptorUmwelt.class); |
104 | 104 |
105 if (media.size() == 0) { | 105 if (media.size() == 0) { |
106 Violation violation = new Violation(); | 106 Violation violation = new Violation(); |
107 violation.addWarning("umwId", 632); | 107 violation.addWarning("umwId#" + umwId, 632); |
108 return violation; | 108 return violation; |
109 } | 109 } |
110 | 110 |
111 int size = 1; | 111 int size = 1; |
112 for (int i = size; i >= 0; i--) { | 112 for (int i = size; i >= 0; i--) { |
119 Response response = repository.filter(builder.getQuery(), "stamm"); | 119 Response response = repository.filter(builder.getQuery(), "stamm"); |
120 @SuppressWarnings("unchecked") | 120 @SuppressWarnings("unchecked") |
121 List<DeskriptorUmwelt> data = (List<DeskriptorUmwelt>)response.getData(); | 121 List<DeskriptorUmwelt> data = (List<DeskriptorUmwelt>)response.getData(); |
122 if (data.isEmpty()) { | 122 if (data.isEmpty()) { |
123 Violation violation = new Violation(); | 123 Violation violation = new Violation(); |
124 violation.addWarning("umwId", 632); | 124 violation.addWarning("umwId#" + umwId, 632); |
125 return violation; | 125 return violation; |
126 } | 126 } |
127 | 127 |
128 boolean unique = isUnique(data); | 128 boolean unique = isUnique(data); |
129 if (unique && umwId.equals(data.get(0).getUmwId())) { | 129 if (unique && umwId.equals(data.get(0).getUmwId())) { |
130 return null; | 130 return null; |
131 } | 131 } |
132 else if (unique && !umwId.equals(data.get(0).getUmwId())) { | 132 else if (unique && !umwId.equals(data.get(0).getUmwId())) { |
133 Violation violation = new Violation(); | 133 Violation violation = new Violation(); |
134 violation.addWarning("umwId", 632); | 134 violation.addWarning("umwId#" + umwId, 632); |
135 return violation; | 135 return violation; |
136 } | 136 } |
137 else { | 137 else { |
138 Violation violation = new Violation(); | 138 Violation violation = new Violation(); |
139 violation.addWarning("umwId", 632); | 139 violation.addWarning("umwId#" + umwId, 632); |
140 boolean found = false; | 140 boolean found = false; |
141 for (int i = 0; i < data.size(); i++) { | 141 for (int i = 0; i < data.size(); i++) { |
142 if (!data.get(i).getUmwId().equals(umwId)) { | 142 if (!data.get(i).getUmwId().equals(umwId)) { |
143 continue; | 143 continue; |
144 } | 144 } |