Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
-
70318fcc
by Tony CHEMIT at 2018-03-08T12:55:59Z
11 changed files:
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/data/level3/Level3Action_en.ftl
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/WeightCategoryTreatmentImplTest.java
- t3-web/src/main/java/fr/ird/t3/web/actions/T3ActionSupport.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/output/ExportConfigureAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/json/GetOutputProviderOperationsAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/json/GetZoneVersionsAction.java
- t3-web/src/main/resources/i18n/t3-web_en_GB.properties
Changes:
| ... | ... | @@ -30,7 +30,7 @@ Time step: ${configuration.timeStep} |
| 30 | 30 |
|
| 31 | 31 |
Treatment to apply to catches with samples:
|
| 32 | 32 |
<#if configuration.useAllSamplesOfStratum>
|
| 33 |
-Apply length structures from the sample statrum
|
|
| 33 |
+Apply length structures from the sample stratum
|
|
| 34 | 34 |
<#else>
|
| 35 | 35 |
Keep their own samples (do nothing)
|
| 36 | 36 |
</#if>
|
| ... | ... | @@ -49,6 +49,7 @@ import java.sql.PreparedStatement; |
| 49 | 49 |
import java.sql.ResultSet;
|
| 50 | 50 |
import java.sql.SQLException;
|
| 51 | 51 |
import java.util.ArrayList;
|
| 52 |
+import java.util.Arrays;
|
|
| 52 | 53 |
import java.util.Collection;
|
| 53 | 54 |
import java.util.Collections;
|
| 54 | 55 |
import java.util.Comparator;
|
| ... | ... | @@ -69,12 +70,43 @@ import java.util.stream.StreamSupport; |
| 69 | 70 |
public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao<E> {
|
| 70 | 71 |
|
| 71 | 72 |
public static final Ocean EMPTY_OCEAN = new OceanImpl();
|
| 73 |
+ private static final int TRIP_WITHOUT_LOGBOOK = 0;
|
|
| 74 |
+ private static final int TRIP_WITH_LOGBOOK = 1;
|
|
| 72 | 75 |
private static final Log log = LogFactory.getLog(AbstractTripTopiaDao.class);
|
| 73 | 76 |
|
| 74 | 77 |
static {
|
| 75 | 78 |
EMPTY_OCEAN.setTopiaId("fr.ird.t3.entities.reference.Ocean#EMPTY#EMPTY");
|
| 76 | 79 |
}
|
| 77 | 80 |
|
| 81 |
+ /**
|
|
| 82 |
+ * Check that a standard trip ({@link TripType#STANDARD}) is consistent around {@link Trip#getLogBookAvailability()}.
|
|
| 83 |
+ *
|
|
| 84 |
+ * @param trip trip to check
|
|
| 85 |
+ * @param pKey primary key of this trip
|
|
| 86 |
+ */
|
|
| 87 |
+ public static void checkStandardTrip(Trip trip, Object[] pKey) {
|
|
| 88 |
+ int logBookAvailability = trip.getLogBookAvailability();
|
|
| 89 |
+ if (AbstractTripTopiaDao.TRIP_WITHOUT_LOGBOOK == logBookAvailability && trip.isActivityNotEmpty()) {
|
|
| 90 |
+ throw new IllegalStateException(String.format("Trip [%s] has some logBook but logBookAvailability says the opposite, please fix this trip..", Arrays.toString(pKey)));
|
|
| 91 |
+ }
|
|
| 92 |
+ if (AbstractTripTopiaDao.TRIP_WITH_LOGBOOK == logBookAvailability && trip.isActivityEmpty()) {
|
|
| 93 |
+ throw new IllegalStateException(String.format("Trip [%s] has some logBook but logBookAvailability says the opposite, please fix this trip..", Arrays.toString(pKey)));
|
|
| 94 |
+ }
|
|
| 95 |
+ }
|
|
| 96 |
+ |
|
| 97 |
+ /**
|
|
| 98 |
+ * Check that a standard trip ({@link TripType#LOGBOOKMISSING}) is consistent around {@link Trip#getLogBookAvailability()}.
|
|
| 99 |
+ *
|
|
| 100 |
+ * @param trip trip to check
|
|
| 101 |
+ * @param pKey primary key of this trip
|
|
| 102 |
+ */
|
|
| 103 |
+ public static void checkLogbookMissingTrip(Trip trip, Object[] pKey) {
|
|
| 104 |
+ int logBookAvailability = trip.getLogBookAvailability();
|
|
| 105 |
+ if (AbstractTripTopiaDao.TRIP_WITH_LOGBOOK == logBookAvailability) {
|
|
| 106 |
+ throw new IllegalStateException(String.format("Trip [%s] has no logBook but logBookAvailability says the opposite, please fix this trip.", Arrays.toString(pKey)));
|
|
| 107 |
+ }
|
|
| 108 |
+ }
|
|
| 109 |
+ |
|
| 78 | 110 |
public static String getSamplesOnlyFilter(String prefix, Boolean samplesOnly) {
|
| 79 | 111 |
if (samplesOnly == null) {
|
| 80 | 112 |
return "";
|
| ... | ... | @@ -25,6 +25,7 @@ import fr.ird.t3.entities.ReferenceEntityMap; |
| 25 | 25 |
import fr.ird.t3.entities.T3EntityEnum;
|
| 26 | 26 |
import fr.ird.t3.entities.T3EntityMap;
|
| 27 | 27 |
import fr.ird.t3.entities.data.Trip;
|
| 28 |
+import fr.ird.t3.entities.data.TripTopiaDao;
|
|
| 28 | 29 |
import fr.ird.t3.entities.data.TripType;
|
| 29 | 30 |
import fr.ird.t3.entities.reference.Vessel;
|
| 30 | 31 |
import fr.ird.t3.io.input.MissingForeignKey;
|
| ... | ... | @@ -42,6 +43,7 @@ import java.io.File; |
| 42 | 43 |
import java.util.Arrays;
|
| 43 | 44 |
import java.util.HashMap;
|
| 44 | 45 |
import java.util.HashSet;
|
| 46 |
+import java.util.LinkedHashMap;
|
|
| 45 | 47 |
import java.util.List;
|
| 46 | 48 |
import java.util.Map;
|
| 47 | 49 |
import java.util.Set;
|
| ... | ... | @@ -91,11 +93,7 @@ public abstract class AbstractT3InputMSAccess implements T3Input { |
| 91 | 93 |
T3AccessHitModel hitModel = new T3AccessHitModel();
|
| 92 | 94 |
hitModel.addPropertyChangeListener(new LoadDbPropertyChangeListener(t3DataTypes));
|
| 93 | 95 |
// analyse data source
|
| 94 |
- if (configuration.getTripType() == TripType.LOGBOOKMISSING) {
|
|
| 95 |
- dataSource.analyzeDb(TripType.LOGBOOKMISSING, hitModel);
|
|
| 96 |
- } else {
|
|
| 97 |
- dataSource.analyzeDb(hitModel);
|
|
| 98 |
- }
|
|
| 96 |
+ dataSource.analyzeDb(hitModel);
|
|
| 99 | 97 |
if (dataSource.hasError()) {
|
| 100 | 98 |
errors = dataSource.getErrors();
|
| 101 | 99 |
}
|
| ... | ... | @@ -168,7 +166,7 @@ public abstract class AbstractT3InputMSAccess implements T3Input { |
| 168 | 166 |
T3EntityEnum constant = T3EntityEnum.valueOf(Trip.class);
|
| 169 | 167 |
T3AccessEntityMeta meta = dataSource.getMeta(constant);
|
| 170 | 168 |
List<Trip> entities = dataSource.loadEntities(meta);
|
| 171 |
- Map<Trip, T3EntityMap> result = Maps.newLinkedHashMap();
|
|
| 169 |
+ Map<Trip, T3EntityMap> result = new LinkedHashMap<>();
|
|
| 172 | 170 |
missingFK = new HashMap<>();
|
| 173 | 171 |
T3DataEntityVisitor dataVisitor = newDataVisitor(dataSource, safeReferences);
|
| 174 | 172 |
try {
|
| ... | ... | @@ -242,7 +240,29 @@ public abstract class AbstractT3InputMSAccess implements T3Input { |
| 242 | 240 |
// remove proxy on data
|
| 243 | 241 |
Trip loadedTrip = visitor.doVisit(trip);
|
| 244 | 242 |
// set tripType flag
|
| 245 |
- loadedTrip.setTripType(tripType);
|
|
| 243 |
+ T3AccessEntity a = (T3AccessEntity) trip;
|
|
| 244 |
+ int logBookAvailability = loadedTrip.getLogBookAvailability();
|
|
| 245 |
+ Object[] pKey = a.getPKey();
|
|
| 246 |
+ switch (tripType) {
|
|
| 247 |
+ case STANDARD:
|
|
| 248 |
+ TripTopiaDao.checkStandardTrip(loadedTrip, pKey);
|
|
| 249 |
+ loadedTrip.setTripType(TripType.STANDARD);
|
|
| 250 |
+ break;
|
|
| 251 |
+ case SAMPLEONLY:
|
|
| 252 |
+ // no check
|
|
| 253 |
+ loadedTrip.setTripType(TripType.SAMPLEONLY);
|
|
| 254 |
+ break;
|
|
| 255 |
+ case LOGBOOKMISSING:
|
|
| 256 |
+ if (TripType.LOGBOOKMISSING == loadedTrip.getTripType()) {
|
|
| 257 |
+ // That trip was marked to be without logbook, check that
|
|
| 258 |
+ TripTopiaDao.checkLogbookMissingTrip(loadedTrip, pKey);
|
|
| 259 |
+ } else {
|
|
| 260 |
+ // standard trip, just check logBookAvailability value is correct
|
|
| 261 |
+ TripTopiaDao.checkStandardTrip(loadedTrip, pKey);
|
|
| 262 |
+ loadedTrip.setTripType(TripType.STANDARD);
|
|
| 263 |
+ }
|
|
| 264 |
+ break;
|
|
| 265 |
+ }
|
|
| 246 | 266 |
if (trip.getVessel() == null && canCreateVessel) {
|
| 247 | 267 |
// use new created vessel
|
| 248 | 268 |
Vessel vessel = getNewVessels().get(vesselCode);
|
| ... | ... | @@ -22,7 +22,6 @@ package fr.ird.t3.io.input.access; |
| 22 | 22 |
|
| 23 | 23 |
import fr.ird.msaccess.importer.AbstractAccessDataSource;
|
| 24 | 24 |
import fr.ird.t3.entities.T3EntityEnum;
|
| 25 |
-import fr.ird.t3.entities.data.TripType;
|
|
| 26 | 25 |
import fr.ird.t3.entities.reference.T3ReferenceEntity;
|
| 27 | 26 |
import org.apache.commons.logging.Log;
|
| 28 | 27 |
import org.apache.commons.logging.LogFactory;
|
| ... | ... | @@ -99,10 +98,6 @@ public class T3AccessDataSource extends AbstractAccessDataSource<T3EntityEnum, T |
| 99 | 98 |
}
|
| 100 | 99 |
|
| 101 | 100 |
public void analyzeDb(T3AccessHitModel hits) throws Exception {
|
| 102 |
- analyzeDb(null, hits);
|
|
| 103 |
- }
|
|
| 104 |
- |
|
| 105 |
- public void analyzeDb(TripType tripType, T3AccessHitModel hits) throws Exception {
|
|
| 106 | 101 |
// always init the data source
|
| 107 | 102 |
init();
|
| 108 | 103 |
Set<String> tables = getTableNames();
|
| ... | ... | @@ -78,6 +78,7 @@ public abstract class T3AvdthDataEntityVisitor extends T3DataEntityVisitor { |
| 78 | 78 |
activity.setSchoolType(Objects.requireNonNull(sampleSet.getActivitySchoolType()));
|
| 79 | 79 |
sampleSet.setActivity(endActivity(activity));
|
| 80 | 80 |
parent.addActivity(activity);
|
| 81 |
+ parent.setTripType(TripType.LOGBOOKMISSING);
|
|
| 81 | 82 |
}
|
| 82 | 83 |
};
|
| 83 | 84 |
} else {
|
| ... | ... | @@ -20,7 +20,6 @@ |
| 20 | 20 |
*/
|
| 21 | 21 |
package fr.ird.t3.entities.reference;
|
| 22 | 22 |
|
| 23 |
-import com.google.common.collect.Maps;
|
|
| 24 | 23 |
import fr.ird.t3.entities.AbstractDatabaseTest;
|
| 25 | 24 |
import fr.ird.t3.entities.T3TopiaPersistenceContext;
|
| 26 | 25 |
import org.junit.Assert;
|
| ... | ... | @@ -28,6 +27,7 @@ import org.junit.Test; |
| 28 | 27 |
|
| 29 | 28 |
import java.util.ArrayList;
|
| 30 | 29 |
import java.util.Comparator;
|
| 30 |
+import java.util.LinkedHashMap;
|
|
| 31 | 31 |
import java.util.List;
|
| 32 | 32 |
import java.util.Map;
|
| 33 | 33 |
|
| ... | ... | @@ -154,7 +154,7 @@ public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest { |
| 154 | 154 |
catUnbound.setMax(null);
|
| 155 | 155 |
|
| 156 | 156 |
Map<WeightCategoryTreatment, Integer> weightCategories =
|
| 157 |
- Maps.newLinkedHashMap();
|
|
| 157 |
+ new LinkedHashMap<>();
|
|
| 158 | 158 |
|
| 159 | 159 |
weightCategories.put(catBound, 20);
|
| 160 | 160 |
weightCategories.put(catUnbound, Integer.MAX_VALUE);
|
| ... | ... | @@ -208,7 +208,7 @@ public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest { |
| 208 | 208 |
catUnbound.setMax(null);
|
| 209 | 209 |
|
| 210 | 210 |
Map<WeightCategoryTreatment, Integer> weightCategories =
|
| 211 |
- Maps.newLinkedHashMap();
|
|
| 211 |
+ new LinkedHashMap<>();
|
|
| 212 | 212 |
|
| 213 | 213 |
weightCategories.put(catBound, 20);
|
| 214 | 214 |
weightCategories.put(catBound2, 40);
|
| ... | ... | @@ -21,7 +21,6 @@ |
| 21 | 21 |
package fr.ird.t3.web.actions;
|
| 22 | 22 |
|
| 23 | 23 |
import com.google.common.collect.ImmutableMap;
|
| 24 |
-import com.google.common.collect.Maps;
|
|
| 25 | 24 |
import com.google.common.collect.Multimap;
|
| 26 | 25 |
import com.opensymphony.xwork2.ActionContext;
|
| 27 | 26 |
import com.opensymphony.xwork2.ActionSupport;
|
| ... | ... | @@ -63,6 +62,7 @@ import java.util.ArrayList; |
| 63 | 62 |
import java.util.Arrays;
|
| 64 | 63 |
import java.util.Collection;
|
| 65 | 64 |
import java.util.Date;
|
| 65 |
+import java.util.LinkedHashMap;
|
|
| 66 | 66 |
import java.util.List;
|
| 67 | 67 |
import java.util.Map;
|
| 68 | 68 |
import java.util.function.Supplier;
|
| ... | ... | @@ -261,7 +261,7 @@ public class T3ActionSupport extends ActionSupport implements T3TopiaPersistence |
| 261 | 261 |
}
|
| 262 | 262 |
|
| 263 | 263 |
protected Map<String, String> createTimeSteps() {
|
| 264 |
- Map<String, String> timeSteps = Maps.newLinkedHashMap();
|
|
| 264 |
+ Map<String, String> timeSteps = new LinkedHashMap<>();
|
|
| 265 | 265 |
for (int i = 1; i < 13; i++) {
|
| 266 | 266 |
timeSteps.put("" + i, "" + i);
|
| 267 | 267 |
}
|
| ... | ... | @@ -8,19 +8,18 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| 20 | 20 |
*/
|
| 21 | 21 |
package fr.ird.t3.web.actions.io.output;
|
| 22 | 22 |
|
| 23 |
-import com.google.common.collect.Maps;
|
|
| 24 | 23 |
import fr.ird.t3.actions.io.output.ExportConfiguration;
|
| 25 | 24 |
import fr.ird.t3.entities.T3EntityHelper;
|
| 26 | 25 |
import fr.ird.t3.entities.data.Trip;
|
| ... | ... | @@ -49,6 +48,7 @@ import java.util.ArrayList; |
| 49 | 48 |
import java.util.Arrays;
|
| 50 | 49 |
import java.util.Collection;
|
| 51 | 50 |
import java.util.HashMap;
|
| 51 |
+import java.util.LinkedHashMap;
|
|
| 52 | 52 |
import java.util.List;
|
| 53 | 53 |
import java.util.Map;
|
| 54 | 54 |
|
| ... | ... | @@ -116,14 +116,13 @@ public class ExportConfigureAction extends AbstractConfigureAction<ExportConfigu |
| 116 | 116 |
// make sur configuration is inited before all
|
| 117 | 117 |
getConfiguration();
|
| 118 | 118 |
|
| 119 |
- operations = Maps.newLinkedHashMap();
|
|
| 119 |
+ operations = new LinkedHashMap<>();
|
|
| 120 | 120 |
|
| 121 |
- for (T3OutputOperation operation :
|
|
| 122 |
- getT3OutputService().getOperations(configuration.getOutputProviderId())) {
|
|
| 121 |
+ for (T3OutputOperation operation : getT3OutputService().getOperations(configuration.getOutputProviderId())) {
|
|
| 123 | 122 |
operations.put(operation.getId(), operation.getLibelle(getLocale()));
|
| 124 | 123 |
}
|
| 125 | 124 |
|
| 126 |
- // inject everything needed (daos, ...)
|
|
| 125 |
+ // inject everything needed (dao, ...)
|
|
| 127 | 126 |
injectExcept(InjectDecoratedBeans.class);
|
| 128 | 127 |
|
| 129 | 128 |
boolean configurationInSession = isConfigurationInSession();
|
| ... | ... | @@ -8,24 +8,24 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| 20 | 20 |
*/
|
| 21 | 21 |
package fr.ird.t3.web.actions.json;
|
| 22 | 22 |
|
| 23 |
-import com.google.common.collect.Maps;
|
|
| 24 | 23 |
import fr.ird.t3.io.output.T3OutputOperation;
|
| 25 | 24 |
import fr.ird.t3.web.actions.T3ActionSupport;
|
| 26 | 25 |
import org.apache.commons.logging.Log;
|
| 27 | 26 |
import org.apache.commons.logging.LogFactory;
|
| 28 | 27 |
|
| 28 |
+import java.util.LinkedHashMap;
|
|
| 29 | 29 |
import java.util.Map;
|
| 30 | 30 |
|
| 31 | 31 |
|
| ... | ... | @@ -39,13 +39,10 @@ public class GetOutputProviderOperationsAction extends T3ActionSupport { |
| 39 | 39 |
|
| 40 | 40 |
private static final long serialVersionUID = 1L;
|
| 41 | 41 |
|
| 42 |
- /** Logger. */
|
|
| 43 |
- private static final Log log =
|
|
| 44 |
- LogFactory.getLog(GetOutputProviderOperationsAction.class);
|
|
| 42 |
+ private static final Log log = LogFactory.getLog(GetOutputProviderOperationsAction.class);
|
|
| 45 | 43 |
|
| 46 |
- protected String outputProviderId;
|
|
| 47 |
- |
|
| 48 |
- protected Map<String, String> operations;
|
|
| 44 |
+ private String outputProviderId;
|
|
| 45 |
+ private Map<String, String> operations;
|
|
| 49 | 46 |
|
| 50 | 47 |
public void setOutputProviderId(String outputProviderId) {
|
| 51 | 48 |
this.outputProviderId = outputProviderId;
|
| ... | ... | @@ -57,18 +54,11 @@ public class GetOutputProviderOperationsAction extends T3ActionSupport { |
| 57 | 54 |
|
| 58 | 55 |
@Override
|
| 59 | 56 |
public String execute() {
|
| 60 |
- |
|
| 61 |
- if (log.isInfoEnabled()) {
|
|
| 62 |
- log.info("outputProviderId = " + outputProviderId);
|
|
| 63 |
- }
|
|
| 64 |
- |
|
| 65 |
- operations = Maps.newLinkedHashMap();
|
|
| 66 |
- |
|
| 67 |
- for (T3OutputOperation operation :
|
|
| 68 |
- getT3OutputService().getOperations(outputProviderId)) {
|
|
| 57 |
+ log.info(String.format("outputProviderId = %s", outputProviderId));
|
|
| 58 |
+ operations = new LinkedHashMap<>();
|
|
| 59 |
+ for (T3OutputOperation operation : getT3OutputService().getOperations(outputProviderId)) {
|
|
| 69 | 60 |
operations.put(operation.getId(), operation.getLibelle(getLocale()));
|
| 70 | 61 |
}
|
| 71 |
- |
|
| 72 | 62 |
return SUCCESS;
|
| 73 | 63 |
}
|
| 74 | 64 |
}
|
| ... | ... | @@ -8,19 +8,18 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| 20 | 20 |
*/
|
| 21 | 21 |
package fr.ird.t3.web.actions.json;
|
| 22 | 22 |
|
| 23 |
-import com.google.common.collect.Maps;
|
|
| 24 | 23 |
import fr.ird.t3.entities.reference.zone.ZoneStratumAwareMeta;
|
| 25 | 24 |
import fr.ird.t3.entities.reference.zone.ZoneVersion;
|
| 26 | 25 |
import fr.ird.t3.web.actions.T3ActionSupport;
|
| ... | ... | @@ -28,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; |
| 28 | 27 |
import org.apache.commons.logging.Log;
|
| 29 | 28 |
import org.apache.commons.logging.LogFactory;
|
| 30 | 29 |
|
| 30 |
+import java.util.LinkedHashMap;
|
|
| 31 | 31 |
import java.util.List;
|
| 32 | 32 |
import java.util.Map;
|
| 33 | 33 |
|
| ... | ... | @@ -41,14 +41,11 @@ public class GetZoneVersionsAction extends T3ActionSupport { |
| 41 | 41 |
|
| 42 | 42 |
private static final long serialVersionUID = 1L;
|
| 43 | 43 |
|
| 44 |
- /** Logger. */
|
|
| 45 |
- private static final Log log =
|
|
| 46 |
- LogFactory.getLog(GetZoneVersionsAction.class);
|
|
| 44 |
+ private static final Log log = LogFactory.getLog(GetZoneVersionsAction.class);
|
|
| 47 | 45 |
|
| 48 | 46 |
/** Selected zoneTypeId. */
|
| 49 |
- protected String zoneTypeId;
|
|
| 50 |
- |
|
| 51 |
- protected Map<String, String> zoneVersions;
|
|
| 47 |
+ private String zoneTypeId;
|
|
| 48 |
+ private Map<String, String> zoneVersions;
|
|
| 52 | 49 |
|
| 53 | 50 |
public void setZoneTypeId(String zoneTypeId) {
|
| 54 | 51 |
this.zoneTypeId = zoneTypeId;
|
| ... | ... | @@ -60,23 +57,12 @@ public class GetZoneVersionsAction extends T3ActionSupport { |
| 60 | 57 |
|
| 61 | 58 |
@Override
|
| 62 | 59 |
public String execute() {
|
| 63 |
- |
|
| 64 |
- if (log.isInfoEnabled()) {
|
|
| 65 |
- log.info("zoneTypeId = " + zoneTypeId);
|
|
| 66 |
- }
|
|
| 67 |
- |
|
| 68 |
- zoneVersions = Maps.newLinkedHashMap();
|
|
| 69 |
- |
|
| 60 |
+ log.info(String.format("zoneTypeId = %s", zoneTypeId));
|
|
| 61 |
+ zoneVersions = new LinkedHashMap<>();
|
|
| 70 | 62 |
if (!StringUtils.isEmpty(zoneTypeId)) {
|
| 71 |
- |
|
| 72 |
- ZoneStratumAwareMeta zoneType =
|
|
| 73 |
- getZoneStratumService().getZoneMetaById(zoneTypeId);
|
|
| 74 |
- |
|
| 75 |
- List<ZoneVersion> allVersions =
|
|
| 76 |
- zoneType.getAllZoneVersions(getT3TopiaPersistenceContext().get());
|
|
| 77 |
- |
|
| 63 |
+ ZoneStratumAwareMeta zoneType = getZoneStratumService().getZoneMetaById(zoneTypeId);
|
|
| 64 |
+ List<ZoneVersion> allVersions = zoneType.getAllZoneVersions(getT3TopiaPersistenceContext().get());
|
|
| 78 | 65 |
zoneVersions = sortAndDecorateIdAbles(allVersions);
|
| 79 |
- |
|
| 80 | 66 |
}
|
| 81 | 67 |
return SUCCESS;
|
| 82 | 68 |
}
|
| ... | ... | @@ -267,7 +267,7 @@ t3.label.data.level3.configuration.samplesToUse=Treatment to apply to catches wi |
| 267 | 267 |
t3.label.data.level3.configuration.step1=Level 3 configuration step 1
|
| 268 | 268 |
t3.label.data.level3.configuration.step2=Level 3 configuration step 2
|
| 269 | 269 |
t3.label.data.level3.configuration.useAllSamples=Keep their own sample (do nothing)
|
| 270 |
-t3.label.data.level3.configuration.useCatchSamples=Apply length structures from the sample statrum
|
|
| 270 |
+t3.label.data.level3.configuration.useCatchSamples=Apply length structures from the sample stratum
|
|
| 271 | 271 |
t3.label.data.level3.configuration.useWeightCategories=Use weight categories
|
| 272 | 272 |
t3.label.data.level3.configuration.useWeightCategoriesOrNot=Extrapolation method
|
| 273 | 273 |
t3.label.data.treatment.level0=Level 0 treatment
|