T3-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 424 discussions
[Git][ultreiaio/ird-t3][develop] 3 commits: let's use a password, otherwise can't open test db in IDEA, what a shame...
by Tony CHEMIT 20 Feb '18
by Tony CHEMIT 20 Feb '18
20 Feb '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
9d608f1e by Tony CHEMIT at 2018-02-20T19:29:19+01:00
let's use a password, otherwise can't open test db in IDEA, what a shame...
- - - - -
92556d11 by Tony CHEMIT at 2018-02-20T20:40:10+01:00
Improve persistences tests
- - - - -
9c95acac by Tony CHEMIT at 2018-02-20T20:40:17+01:00
[N0] Calcul des temps de pêche (Closes #240)
- - - - -
22 changed files:
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/ActivityImpl.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractCountryTopiaDao.java
- + t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_2.java
- + t3-domain/src/main/resources/db/migration/V2_2_07_add-Route-table.sql
- t3-domain/src/main/xmi/t3-persistence.properties
- t3-domain/src/main/xmi/t3-persistence.zargo
- + t3-domain/src/test/java/fr/ird/t3/entities/T3PersistenceFixtures.java
- t3-domain/src/test/java/fr/ird/t3/entities/data/TripTopiaDaoTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/CountryTopiaDaoTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/HarbourTopiaDaoTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/LengthWeightConversionHelperTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/OceanTopiaDaoTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/SpecieDAOImplTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselTopiaDaoTest.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/WeightCategoryTreatmentImplTest.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
- t3-input-avdthv35/src/test/resources/t3-TopiaContextImpl.properties
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
Changes:
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
@@ -36,6 +36,7 @@ import fr.ird.t3.entities.T3Functions;
import fr.ird.t3.entities.T3Predicates;
import fr.ird.t3.entities.reference.Harbour;
import fr.ird.t3.entities.reference.Ocean;
+import fr.ird.t3.entities.reference.OceanImpl;
import fr.ird.t3.entities.reference.OceanTopiaDao;
import fr.ird.t3.entities.reference.Vessel;
import fr.ird.t3.entities.type.T3Date;
@@ -127,19 +128,21 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao<
// query = createQuery("t")
// .setSelect("t.id")
// .addWhere("size(t." + Trip.PROPERTY_ACTIVITY + ") = 0");
- hql = "SELECT t.id FROM TripImpl t WHERE size(t.activity) = 0";
+ hql = "SELECT t.id FROM TripImpl as t WHERE size(t.route) = 0";
// params = Collections.emptyList();
} else {
// query = new TopiaQuery(Activity.class, "a")
// .setSelect("distinct(a.trip.id)")
// .addWhere("a.ocean", TopiaQuery.Op.EQ, ocean);
- hql = "SELECT DISTINCT(a.trip.id) FROM ActivityImpl a WHERE a.ocean = :ocean";
+ hql = "SELECT DISTINCT(a.route.trip.id) FROM ActivityImpl a WHERE a.ocean = :ocean";
paramsBuilder.put("ocean", ocean);
// params = Lists.<Object>newArrayList("ocean", ocean);
}
return findAll(hql, paramsBuilder.build());
}
+ public static final Ocean EMPTY_OCEAN = new OceanImpl();
+
public Multimap<Ocean, String> findAllIdsByOcean() throws TopiaException {
Set<Ocean> oceans = topiaDaoSupplier.getDao(Ocean.class, OceanTopiaDao.class).findAllUsedInActivity();
@@ -154,7 +157,7 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao<
// add trips with no ocean (http://forge.codelutin.com/issues/1134)
List<String> tripsWithNoOcean = findAllIdsByOcean(null);
if (CollectionUtils.isNotEmpty(tripsWithNoOcean)) {
- result.putAll(null, tripsWithNoOcean);
+ result.putAll(EMPTY_OCEAN, tripsWithNoOcean);
}
return result;
}
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/ActivityImpl.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/ActivityImpl.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/ActivityImpl.java
@@ -26,12 +26,13 @@ import fr.ird.t3.entities.reference.VesselActivity;
import fr.ird.t3.entities.type.T3Point;
import fr.ird.t3.entities.type.T3PointImpl;
import fr.ird.type.CoordinateHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* Implementation of {@link Activity} with manual quadrant
@@ -60,6 +61,11 @@ public class ActivityImpl extends ActivityAbstract {
protected Integer quadrant;
@Override
+ public Trip getTrip() {
+ return getRoute().getTrip();
+ }
+
+ @Override
public Integer getQuadrant() {
if (quadrant == null) {
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java
@@ -30,9 +30,17 @@ import fr.ird.t3.entities.reference.Ocean;
import fr.ird.t3.entities.reference.Species;
import fr.ird.t3.entities.reference.Vessel;
import fr.ird.t3.entities.reference.VesselImpl;
+import org.nuiton.util.DateUtil;
import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static org.nuiton.i18n.I18n.n;
@@ -480,4 +488,73 @@ public class TripImpl extends TripAbstract {
ComputedDataHelper.deleteComputedDataLevel3(getWell());
}
+ @Override
+ public int sizeActivity() {
+ return (int) activityStream().count();
+ }
+
+ @Override
+ public boolean isActivityEmpty() {
+ return isRouteEmpty() || activityStream().count() == 0;
+ }
+
+ @Override
+ public boolean isActivityNotEmpty() {
+ return isRouteNotEmpty() && activityStream().count() > 0;
+ }
+
+ @Override
+ public List<Activity> getActivity() {
+ return activityStream().collect(Collectors.toList());
+ }
+
+ @Override
+ public void setActivity(List<Activity> activities) {
+ clearRoute();
+ for (Activity activity : activities) {
+ addActivity(activity);
+ }
+ }
+
+ @Override
+ public Activity getActivityByTopiaId(String topiaId) {
+ return activityStream().filter(a -> topiaId.equals(a.getTopiaId())).findFirst().orElse(null);
+ }
+
+ @Override
+ public Collection<String> getActivityTopiaIds() {
+ return activityStream().map(Activity::getTopiaId).collect(Collectors.toList());
+ }
+
+ @Override
+ public void addActivity(Activity activity) {
+ Date date = DateUtil.getDay(activity.getDate());
+ Optional<Route> optionalRoute = routeStream().filter(r -> Objects.equals(r.getDate(), date)).findFirst();
+ Route route;
+ if (optionalRoute.isPresent()) {
+ route = optionalRoute.get();
+ } else {
+ route = new RouteImpl();
+ route.setDate(date);
+ addRoute(route);
+ }
+ route.addActivity(activity);
+ }
+
+ @Override
+ public List<Route> getRoute() {
+ List<Route> route = super.getRoute();
+ if (route == null) {
+ setRoute(route = new LinkedList<>());
+ }
+ return route;
+ }
+
+ private Stream<Route> routeStream() {
+ return getRoute().stream();
+ }
+
+ private Stream<Activity> activityStream() {
+ return routeStream().flatMap(r -> r.getActivity().stream());
+ }
}
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractCountryTopiaDao.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractCountryTopiaDao.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractCountryTopiaDao.java
@@ -126,7 +126,7 @@ public class AbstractCountryTopiaDao<E extends Country> extends GeneratedCountry
// .addParam("oceanId", oceanId);
String hql = "SELECT DISTINCT(c) " +
- "FROM CountryImpl c, TripImpl t LEFT JOIN t.activity as a " +
+ "FROM CountryImpl c, TripImpl t LEFT JOIN t.route as r LEFT JOIN r.activity as a " +
"WHERE t.vessel.fleetCountry = c.id AND a.ocean.id = :oceanId";
// FIXME : trouvé pk cela est aussi long...
// .addWhere("(SELECT count(*) FROM " + SetSpeciesFrequencyImpl.class.getSimpleName() + " s WHERE s." + SetSpeciesFrequency.PROPERTY_ACTIVITY + " = a.id) > 0")
@@ -155,7 +155,7 @@ public class AbstractCountryTopiaDao<E extends Country> extends GeneratedCountry
// .addParam("oceanId", oceanId);
String hql = "SELECT DISTINCT(c) " +
- "FROM CountryImpl c, TripImpl t LEFT JOIN t.activity as a " +
+ "FROM CountryImpl c, TripImpl t LEFT JOIN t.route as r LEFT JOIN r.activity as a " +
"WHERE t.vessel.flagCountry = c.id AND a.ocean.id = :oceanId";
// FIXME : trouvé pk cela est aussi long...
// .addWhere("(SELECT count(*) FROM " + SetSpeciesFrequencyImpl.class.getSimpleName() + " s WHERE s." + SetSpeciesFrequency.PROPERTY_ACTIVITY + " = a.id) >0")
=====================================
t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_2.java
=====================================
--- /dev/null
+++ b/t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_2.java
@@ -0,0 +1,133 @@
+package fr.ird.t3.services.migration;
+
+/*
+ * #%L
+ * T3 :: Domain
+ * %%
+ * Copyright (C) 2010 - 2017 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.auto.service.AutoService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
+import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.persistence.support.TopiaSqlQuery;
+import org.nuiton.topia.persistence.support.TopiaSqlSupport;
+import org.nuiton.util.DateUtil;
+import org.nuiton.version.Versions;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Created by tchemit on 18/02/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+@AutoService(TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion.class)
+public class T3MigrationCallbackV2_2 extends T3MigrationCallbackSupport {
+
+ private static final Log log = LogFactory.getLog(T3MigrationCallbackV2_2.class);
+
+ public T3MigrationCallbackV2_2() {
+ super(Versions.valueOf("2.2"));
+ }
+
+ @Override
+ protected void prepareMigrationScript(TopiaSqlSupport sqlSupport, List<String> queries, boolean showSql, boolean showProgression) throws TopiaException {
+ addScript("07", "add-Route-table", queries);
+
+
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+
+ List<String> tripList = sqlSupport.findMultipleResult(new TopiaSqlQuery<String>() {
+ @Override
+ public PreparedStatement prepareQuery(Connection connection) throws SQLException {
+ return connection.prepareStatement("SELECT DISTINCT(a.trip) FROM activity a");
+ }
+
+ @Override
+ public String prepareResult(ResultSet set) throws SQLException {
+ return set.getString(1);
+ }
+ });
+
+ for (String tripId : tripList) {
+
+ int i = tripId.indexOf('#');
+ String routeIdPrefix = "fr.ird.t3.entities.data.Route#" + tripId.substring(i + 1, tripId.lastIndexOf('#') + 1);
+
+ log.info("Route prefix: " + routeIdPrefix);
+ List<TripActivity> activityList = sqlSupport.findMultipleResult(new TopiaSqlQuery<TripActivity>() {
+ @Override
+ public PreparedStatement prepareQuery(Connection connection) throws SQLException {
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT a.topiaId, a.date FROM activity a WHERE a.trip = ?");
+ preparedStatement.setString(1, tripId);
+ return preparedStatement;
+ }
+
+ @Override
+ public TripActivity prepareResult(ResultSet set) throws SQLException {
+ return new TripActivity(set.getString(1), set.getDate(2));
+ }
+ });
+
+
+ Set<Date> days = new LinkedHashSet<>();
+ for (TripActivity activity : activityList) {
+
+ String dayDateStr = df.format(activity.date);
+ String routeId = routeIdPrefix + dayDateStr.replaceAll("-", "");
+
+ if (days.add(activity.date)) {
+
+ log.info(String.format("[%s] new Route: %s", tripId, routeId));
+ // create new route
+ queries.add(String.format("INSERT INTO Route(topiaId, topiaVersion, topiaCreateDate, trip, date) VALUES('%s', 0, CURRENT_TIMESTAMP, '%s', to_date('%s', 'YYY-MM-DD'));", routeId, tripId, dayDateStr));
+ }
+ queries.add(String.format("UPDATE Activity SET route = '%s', topiaVersion = topiaVersion + 1 WHERE topiaId = '%s';", routeId, activity.activity));
+ }
+
+ if (!activityList.isEmpty()) {
+ queries.add(String.format("UPDATE Trip SET effortComputed = false, topiaVersion = topiaVersion + 1 WHERE topiaId = '%s';", tripId));
+ }
+ }
+
+ queries.add("ALTER TABLE Activity DROP COLUMN trip;");
+ queries.add("ALTER TABLE Activity DROP COLUMN date;");
+ }
+
+ private static class TripActivity {
+
+ private final String activity;
+ private final Date date;
+
+ private TripActivity(String activity, Date date) {
+ this.activity = activity;
+ this.date = DateUtil.getDay(date);
+ }
+ }
+
+}
=====================================
t3-domain/src/main/resources/db/migration/V2_2_07_add-Route-table.sql
=====================================
--- /dev/null
+++ b/t3-domain/src/main/resources/db/migration/V2_2_07_add-Route-table.sql
@@ -0,0 +1,28 @@
+---
+-- #%L
+-- T3 :: Domain
+-- %%
+-- Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+-- %%
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU Affero General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU Affero General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+-- #L%
+---
+CREATE TABLE Route( topiaid VARCHAR(255) PRIMARY KEY NOT NULL, topiaversion BIGINT NOT NULL, topiacreatedate TIMESTAMP NOT NULL, trip VARCHAR(255) NOT NULL, date DATE NOT NULL, computedFishingTimeN0 REAL, computedSearchTimeN0 REAL, computedTimeAtSeaN0 REAL);
+CREATE UNIQUE INDEX uk_route ON Route(trip, date);
+ALTER TABLE Route ADD CONSTRAINT fk_route_trip FOREIGN KEY (trip) REFERENCES Trip(topiaid);
+CREATE INDEX idx_route_trip ON Route(trip);
+
+ALTER TABLE Activity ADD COLUMN route VARCHAR(255);
+ALTER TABLE Activity ADD CONSTRAINT fk_activity_route FOREIGN KEY (route) REFERENCES Route(topiaid);
+CREATE INDEX idx_activity_route ON Activity(route);
=====================================
t3-domain/src/main/xmi/t3-persistence.properties
=====================================
--- a/t3-domain/src/main/xmi/t3-persistence.properties
+++ b/t3-domain/src/main/xmi/t3-persistence.properties
@@ -22,11 +22,17 @@
model.tagValue.notGenerateToString=true
model.tagValue.generateOperatorForDAOHelper=true
model.tagValue.constantPrefix=PROPERTY_
-model.tagValue.version=2.1
+model.tagValue.version=2.2
model.tagValue.indexForeignKeys=true
-fr.ird.t3.entities.data.Trip.attribute.activity.stereotype=ordered
-fr.ird.t3.entities.data.Trip.attribute.activity.tagvalue.orderBy=date
+fr.ird.t3.entities.data.Trip.attribute.route.stereotype=ordered
+fr.ird.t3.entities.data.Route.attribute.activity.stereotype=ordered
+
+fr.ird.t3.entities.data.Trip.attribute.route.tagvalue.orderBy=date
+fr.ird.t3.entities.data.Route.attribute.activity.tagvalue.orderBy=date
+
+fr.ird.t3.entities.data.Route.attribute.date.tagvalue.hibernateAttributeType.java.util.Date=date
+fr.ird.t3.entities.data.Activity.attribute.time.tagvalue.hibernateAttributeType.java.util.Date=time
fr.ird.t3.entities.data.Activity.attribute.comment.tagvalue.sqlType=text
fr.ird.t3.entities.data.LocalMarketBatch.attribute.origin.tagvalue.sqlType=text
=====================================
t3-domain/src/main/xmi/t3-persistence.zargo
=====================================
Binary files a/t3-domain/src/main/xmi/t3-persistence.zargo and b/t3-domain/src/main/xmi/t3-persistence.zargo differ
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/T3PersistenceFixtures.java
=====================================
--- /dev/null
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/T3PersistenceFixtures.java
@@ -0,0 +1,90 @@
+package fr.ird.t3.entities;
+
+import fr.ird.t3.entities.data.Activity;
+import fr.ird.t3.entities.data.Trip;
+import fr.ird.t3.entities.reference.Country;
+import fr.ird.t3.entities.reference.Harbour;
+import fr.ird.t3.entities.reference.Ocean;
+import fr.ird.t3.entities.reference.Species;
+import fr.ird.t3.entities.reference.Vessel;
+import fr.ird.t3.entities.reference.VesselSimpleType;
+import fr.ird.t3.entities.reference.VesselType;
+
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * Created by tchemit on 20/02/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public class T3PersistenceFixtures {
+
+ public static Activity newActivity(T3TopiaPersistenceContext tx, Ocean ocean) {
+ return newActivity(tx, ocean, new Date());
+ }
+
+ public static Ocean newOcean(T3TopiaPersistenceContext tx) {
+ return newOcean(tx, 0);
+ }
+
+ public static Ocean newOcean(T3TopiaPersistenceContext tx, int code) {
+ return tx.getOceanDao().create(Ocean.PROPERTY_CODE, code);
+ }
+
+ public static Country newCountry(T3TopiaPersistenceContext tx, int code) {
+ return tx.getCountryDao().create(Country.PROPERTY_CODE, code);
+ }
+
+ public static Activity newActivity(T3TopiaPersistenceContext tx, Ocean ocean, Date date) {
+ return Objects.requireNonNull(tx.getActivityDao()).create(Activity.PROPERTY_OCEAN, Objects.requireNonNull(ocean), Activity.PROPERTY_DATE, Objects.requireNonNull(date));
+ }
+
+ public static Trip newTrip(T3TopiaPersistenceContext tx) {
+ return tx.getTripDao().create();
+ }
+
+ public static Trip newTrip(T3TopiaPersistenceContext tx, Vessel vessel) {
+ return tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel);
+ }
+
+ public static Trip newTrip(T3TopiaPersistenceContext tx, Harbour harbour) {
+ return tx.getTripDao().create(Trip.PROPERTY_LANDING_HARBOUR, harbour);
+ }
+
+ public static Trip newTrip(T3TopiaPersistenceContext tx, int code, Date date) {
+ return tx.getTripDao().create(Trip.PROPERTY_CODE, code, Trip.PROPERTY_LANDING_DATE, date);
+ }
+
+ public static Trip newTrip(T3TopiaPersistenceContext tx, int code, Date date, boolean sampleOnly) {
+ return tx.getTripDao().create(Trip.PROPERTY_CODE, code, Trip.PROPERTY_LANDING_DATE, date, Trip.PROPERTY_SAMPLES_ONLY, sampleOnly);
+ }
+
+ public static Harbour newHarbour(T3TopiaPersistenceContext tx, int code) {
+ return tx.getHarbourDao().create(Harbour.PROPERTY_CODE, code);
+ }
+
+ public static Species newSpecies(T3TopiaPersistenceContext tx, int code) {
+ return tx.getSpeciesDao().create(Species.PROPERTY_CODE, code);
+ }
+
+ public static Vessel newVessel(T3TopiaPersistenceContext tx, int code) {
+ return tx.getVesselDao().create(Vessel.PROPERTY_CODE, code);
+ }
+
+ public static VesselType newVesselType(T3TopiaPersistenceContext tx, int code, VesselSimpleType vesselSimpleType) {
+ return tx.getVesselTypeDao().create(VesselType.PROPERTY_CODE, code, VesselType.PROPERTY_VESSEL_SIMPLE_TYPE, vesselSimpleType);
+ }
+
+ public static VesselSimpleType newVesselSimpleType(T3TopiaPersistenceContext tx, int code) {
+ return tx.getVesselSimpleTypeDao().create(VesselSimpleType.PROPERTY_CODE, code);
+ }
+
+ public static Vessel newVessel(T3TopiaPersistenceContext tx, Country country, int code) {
+ return tx.getVesselDao().create(Vessel.PROPERTY_FLAG_COUNTRY, country, Vessel.PROPERTY_FLEET_COUNTRY, country, Vessel.PROPERTY_CODE, code);
+ }
+
+ public static Vessel newVessel(T3TopiaPersistenceContext tx, VesselType vesselType, int code) {
+ return tx.getVesselDao().create(Vessel.PROPERTY_VESSEL_TYPE, vesselType, Vessel.PROPERTY_CODE, code);
+ }
+}
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/data/TripTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/data/TripTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/data/TripTopiaDaoTest.java
@@ -22,17 +22,19 @@ package fr.ird.t3.entities.data;
import com.google.common.collect.Multimap;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.reference.Ocean;
-import fr.ird.t3.entities.reference.OceanTopiaDao;
import fr.ird.t3.entities.type.T3Date;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
/**
* Tests the trip dao {@link TripTopiaDao}.
@@ -42,36 +44,23 @@ import org.junit.Test;
*/
public class TripTopiaDaoTest extends AbstractDatabaseTest {
- T3TopiaPersistenceContext tx;
-
- TripTopiaDao dao;
-
- OceanTopiaDao oceanDAO;
-
- ActivityTopiaDao activitDAO;
+ private T3TopiaPersistenceContext tx;
+ private TripTopiaDao dao;
@Before
- public void setUp() throws Exception {
-
+ public void setUp() {
tx = beginTransaction();
dao = tx.getTripDao();
- oceanDAO = tx.getOceanDao();
- activitDAO = tx.getActivityDao();
}
@Test
- public void findAllBetweenLandingDate() throws Exception {
+ public void findAllBetweenLandingDate() {
T3Date startDate = T3Date.newDate(1, 2010);
T3Date endDate = T3Date.newDate(1, 2011);
- Trip trip = dao.create(Trip.PROPERTY_CODE, 0,
- Trip.PROPERTY_LANDING_DATE, startDate.toBeginDate(),
- Trip.PROPERTY_SAMPLES_ONLY, false
- );
- Trip trip1 = dao.create(Trip.PROPERTY_CODE, 1,
- Trip.PROPERTY_LANDING_DATE, endDate.toBeginDate(),
- Trip.PROPERTY_SAMPLES_ONLY, true);
+ Trip trip = T3PersistenceFixtures.newTrip(tx, 0, startDate.toBeginDate(), false);
+ Trip trip1 = T3PersistenceFixtures.newTrip(tx, 1, endDate.toBeginDate(), true);
List<Trip> result;
@@ -103,20 +92,20 @@ public class TripTopiaDaoTest extends AbstractDatabaseTest {
}
@Test
- public void getFirstLandingDate() throws Exception {
+ public void getFirstLandingDate() {
T3Date startDate = T3Date.newDate(1, 2010);
T3Date endDate = T3Date.newDate(1, 2011);
T3Date result;
- dao.create(Trip.PROPERTY_CODE, 1, Trip.PROPERTY_LANDING_DATE, endDate.toBeginDate());
+ T3PersistenceFixtures.newTrip(tx, 1, endDate.toBeginDate());
result = dao.getFirstLandingDate();
Assert.assertNotNull(result);
Assert.assertEquals(endDate, result);
- dao.create(Trip.PROPERTY_CODE, 0, Trip.PROPERTY_LANDING_DATE, startDate.toBeginDate());
+ T3PersistenceFixtures.newTrip(tx, 0, startDate.toBeginDate());
result = dao.getFirstLandingDate();
Assert.assertNotNull(result);
@@ -124,20 +113,20 @@ public class TripTopiaDaoTest extends AbstractDatabaseTest {
}
@Test
- public void getLastLandingDate() throws Exception {
+ public void getLastLandingDate() {
T3Date startDate = T3Date.newDate(1, 2010);
T3Date endDate = T3Date.newDate(1, 2011);
T3Date result;
- dao.create(Trip.PROPERTY_CODE, 0, Trip.PROPERTY_LANDING_DATE, startDate.toBeginDate());
+ T3PersistenceFixtures.newTrip(tx, 0, startDate.toBeginDate());
result = dao.getLastLandingDate();
Assert.assertNotNull(result);
Assert.assertEquals(startDate, result);
- dao.create(Trip.PROPERTY_CODE, 1, Trip.PROPERTY_LANDING_DATE, endDate.toBeginDate());
+ T3PersistenceFixtures.newTrip(tx, 1, endDate.toBeginDate());
result = dao.getLastLandingDate();
Assert.assertNotNull(result);
@@ -145,20 +134,20 @@ public class TripTopiaDaoTest extends AbstractDatabaseTest {
}
@Test
- public void findAllYearsUsedInTrip() throws Exception {
+ public void findAllYearsUsedInTrip() {
T3Date startDate = T3Date.newDate(1, 2010);
T3Date endDate = T3Date.newDate(1, 2011);
List<Integer> result;
- dao.create(Trip.PROPERTY_CODE, 1, Trip.PROPERTY_LANDING_DATE, endDate.toBeginDate());
+ T3PersistenceFixtures.newTrip(tx, 1, endDate.toBeginDate());
result = dao.findAllYearsUsedInTrip();
Assert.assertNotNull(result);
- Assert.assertEquals(Arrays.asList(2011), result);
+ Assert.assertEquals(Collections.singletonList(2011), result);
- dao.create(Trip.PROPERTY_CODE, 0, Trip.PROPERTY_LANDING_DATE, startDate.toBeginDate());
+ T3PersistenceFixtures.newTrip(tx, 0, startDate.toBeginDate());
result = dao.findAllYearsUsedInTrip();
Assert.assertNotNull(result);
@@ -230,22 +219,22 @@ public class TripTopiaDaoTest extends AbstractDatabaseTest {
// }
@Test
- public void findAllIdsByOcean() throws Exception {
+ public void findAllIdsByOcean() {
- Ocean ocean1 = oceanDAO.create(Ocean.PROPERTY_CODE, 1);
- Ocean ocean2 = oceanDAO.create(Ocean.PROPERTY_CODE, 2);
+ Ocean ocean1 = T3PersistenceFixtures.newOcean(tx, 1);
+ Ocean ocean2 = T3PersistenceFixtures.newOcean(tx, 2);
- Trip trip1 = dao.create(Trip.PROPERTY_CODE, 1, Trip.PROPERTY_LANDING_DATE, new Date());
- Activity activity1 = activitDAO.create(Activity.PROPERTY_OCEAN, ocean1);
+ Trip trip1 = T3PersistenceFixtures.newTrip(tx, 1, new Date());
+ Activity activity1 = T3PersistenceFixtures.newActivity(tx, ocean1);
trip1.addActivity(activity1);
- Activity activity11 = activitDAO.create(Activity.PROPERTY_OCEAN, ocean2);
+ Activity activity11 = T3PersistenceFixtures.newActivity(tx, ocean2);
trip1.addActivity(activity11);
- Trip trip2 = dao.create(Trip.PROPERTY_CODE, 2, Trip.PROPERTY_LANDING_DATE, new Date());
- Activity activity2 = activitDAO.create(Activity.PROPERTY_OCEAN, ocean2);
+ Trip trip2 = T3PersistenceFixtures.newTrip(tx, 2, new Date());
+ Activity activity2 = T3PersistenceFixtures.newActivity(tx, ocean2);
trip2.addActivity(activity2);
- Trip trip3 = dao.create(Trip.PROPERTY_CODE, 3, Trip.PROPERTY_LANDING_DATE, new Date());
+ Trip trip3 = T3PersistenceFixtures.newTrip(tx, 3, new Date());
Multimap<Ocean, String> result = dao.findAllIdsByOcean();
@@ -263,7 +252,7 @@ public class TripTopiaDaoTest extends AbstractDatabaseTest {
Assert.assertTrue(trips.contains(trip1.getTopiaId()));
Assert.assertTrue(trips.contains(trip2.getTopiaId()));
- trips = result.get(null);
+ trips = result.get(TripTopiaDao.EMPTY_OCEAN);
Assert.assertNotNull(trips);
Assert.assertEquals(1, trips.size());
Assert.assertTrue(trips.contains(trip3.getTopiaId()));
@@ -283,25 +272,24 @@ public class TripTopiaDaoTest extends AbstractDatabaseTest {
}
@Test
- public void findAllByIds() throws Exception {
-
- Ocean ocean1 = oceanDAO.create(Ocean.PROPERTY_CODE, 1);
- Ocean ocean2 = oceanDAO.create(Ocean.PROPERTY_CODE, 2);
+ public void findAllByIds() {
+ Ocean ocean1 = T3PersistenceFixtures.newOcean(tx, 1);
+ Ocean ocean2 = T3PersistenceFixtures.newOcean(tx, 2);
- Trip trip1 = dao.create(Trip.PROPERTY_CODE, 1, Trip.PROPERTY_LANDING_DATE, new Date());
- Activity activity1 = activitDAO.create(Activity.PROPERTY_OCEAN, ocean1);
+ Trip trip1 = T3PersistenceFixtures.newTrip(tx, 1, new Date());
+ Activity activity1 = T3PersistenceFixtures.newActivity(tx, ocean1);
trip1.addActivity(activity1);
- Activity activity11 = activitDAO.create(Activity.PROPERTY_OCEAN, ocean2);
+ Activity activity11 = T3PersistenceFixtures.newActivity(tx, ocean2);
trip1.addActivity(activity11);
- Trip trip2 = dao.create(Trip.PROPERTY_CODE, 2, Trip.PROPERTY_LANDING_DATE, new Date());
- Activity activity2 = activitDAO.create(Activity.PROPERTY_OCEAN, ocean2);
+ Trip trip2 = T3PersistenceFixtures.newTrip(tx, 2, new Date());
+ Activity activity2 = T3PersistenceFixtures.newActivity(tx, ocean2);
trip2.addActivity(activity2);
List<Trip> result;
- result = dao.findAllByIds(Arrays.asList(trip1.getTopiaId()));
+ result = dao.findAllByIds(Collections.singletonList(trip1.getTopiaId()));
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/CountryTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/CountryTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/CountryTopiaDaoTest.java
@@ -21,14 +21,17 @@
package fr.ird.t3.entities.reference;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.data.Activity;
import fr.ird.t3.entities.data.CorrectedElementaryCatch;
import fr.ird.t3.entities.data.Trip;
-import java.util.Set;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import java.util.Set;
+
/**
* Test the user dao {@link AbstractCountryTopiaDao}.
*
@@ -37,44 +40,44 @@ import org.junit.Test;
*/
public class CountryTopiaDaoTest extends AbstractDatabaseTest {
- @Test
- public void findAllFleetUsedInTrip() throws Exception {
-
- T3TopiaPersistenceContext tx = beginTransaction();
+ private Country country;
+ private Vessel vessel;
+ private Vessel vessel2;
+ private Ocean ocean;
+ private T3TopiaPersistenceContext tx;
+ private CountryTopiaDao dao;
+
+ @Before
+ public void setUp() {
+ tx = beginTransaction();
+ dao = tx.getCountryDao();
+ country = T3PersistenceFixtures.newCountry(tx, 0);
+ Country country2 = T3PersistenceFixtures.newCountry(tx, 1);
+ vessel = T3PersistenceFixtures.newVessel(tx, country, 0);
+ vessel2 = T3PersistenceFixtures.newVessel(tx, country2, 1);
+ ocean = T3PersistenceFixtures.newOcean(tx, 0);
+ }
- CountryTopiaDao dao = tx.getCountryDao();
+ @Test
+ public void findAllFleetUsedInTrip() {
- Country country = dao.create(Country.PROPERTY_CODE, 0);
- Country country2 = dao.create(Country.PROPERTY_CODE, 1);
- Vessel vessel = tx.getVesselDao().create(Vessel.PROPERTY_FLEET_COUNTRY, country, Vessel.PROPERTY_CODE, 0);
- Vessel vessel2 = tx.getVesselDao().create(Vessel.PROPERTY_FLEET_COUNTRY, country2, Vessel.PROPERTY_CODE, 1);
- Trip trip = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel);
+ T3PersistenceFixtures.newTrip(tx, vessel);
- Set<Country> result = dao.findAllFleetUsedInTrip();
+ Set<Country> result = tx.getCountryDao().findAllFleetUsedInTrip();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
Assert.assertEquals(country, result.iterator().next());
}
@Test
- public void findAllFleetUsedInCatch() throws Exception {
-
- T3TopiaPersistenceContext tx = beginTransaction();
-
- CountryTopiaDao dao = tx.getCountryDao();
+ public void findAllFleetUsedInCatch() {
- Country country = dao.create(Country.PROPERTY_CODE, 0);
- Country country2 = dao.create(Country.PROPERTY_CODE, 1);
- Vessel vessel = tx.getVesselDao().create(Vessel.PROPERTY_FLEET_COUNTRY, country, Vessel.PROPERTY_CODE, 0);
- Vessel vessel2 = tx.getVesselDao().create(Vessel.PROPERTY_FLEET_COUNTRY, country2, Vessel.PROPERTY_CODE, 1);
- Trip trip = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel);
+ Trip trip = T3PersistenceFixtures.newTrip(tx, vessel);
- // create another trip without any activity (so withou also any corrected catches)
- Trip trip2 = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel2);
+ // create another trip without any activity (so without also any corrected catches)
+ T3PersistenceFixtures.newTrip(tx, vessel2);
- Activity activity = tx.getActivityDao().create(
- Activity.PROPERTY_TRIP, trip
- );
+ Activity activity = T3PersistenceFixtures.newActivity(tx, ocean);
trip.addActivity(activity);
CorrectedElementaryCatch catche = tx.getCorrectedElementaryCatchDao().create();
@@ -89,27 +92,15 @@ public class CountryTopiaDaoTest extends AbstractDatabaseTest {
}
@Test
- public void findAllFleetUsedInSample() throws Exception {
-
- T3TopiaPersistenceContext tx = beginTransaction();
+ public void findAllFleetUsedInSample() {
- Ocean ocean = tx.getOceanDao().create();
+ Trip trip = T3PersistenceFixtures.newTrip(tx, vessel);
- CountryTopiaDao dao = tx.getCountryDao();
- Country country = dao.create(Country.PROPERTY_CODE, 0);
- Country country2 = dao.create(Country.PROPERTY_CODE, 1);
- Vessel vessel = tx.getVesselDao().create(Vessel.PROPERTY_FLEET_COUNTRY, country, Vessel.PROPERTY_CODE, 0);
- Vessel vessel2 = tx.getVesselDao().create(Vessel.PROPERTY_FLEET_COUNTRY, country2, Vessel.PROPERTY_CODE, 1);
- Trip trip = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel);
+ // create another trip without any activity (so without also any corrected catches)
+ T3PersistenceFixtures.newTrip(tx, vessel2);
- // create another trip without any activity (so withou also any corrected catches)
- Trip trip2 = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel2);
-
- Activity activity = tx.getActivityDao().create(
- Activity.PROPERTY_TRIP, trip,
- Activity.PROPERTY_OCEAN, ocean
- );
+ Activity activity = T3PersistenceFixtures.newActivity(tx, ocean);
trip.addActivity(activity);
Set<Country> result;
@@ -132,32 +123,17 @@ public class CountryTopiaDaoTest extends AbstractDatabaseTest {
}
@Test
- public void findAllFlagUsedInSample() throws Exception {
-
- T3TopiaPersistenceContext tx = beginTransaction();
-
- Ocean ocean = tx.getOceanDao().create();
+ public void findAllFlagUsedInSample() {
- CountryTopiaDao dao = tx.getCountryDao();
-
- Country country = dao.create(Country.PROPERTY_CODE, 0);
- Country country2 = dao.create(Country.PROPERTY_CODE, 1);
- Vessel vessel = tx.getVesselDao().create(Vessel.PROPERTY_FLAG_COUNTRY, country, Vessel.PROPERTY_CODE, 0);
- Vessel vessel2 = tx.getVesselDao().create(Vessel.PROPERTY_FLAG_COUNTRY, country2, Vessel.PROPERTY_CODE, 1);
- Trip trip = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel);
+ Trip trip = T3PersistenceFixtures.newTrip(tx, vessel);
// create another trip without any activity (so withou also any corrected catches)
- Trip trip2 = tx.getTripDao().create(Trip.PROPERTY_VESSEL, vessel2);
+ T3PersistenceFixtures.newTrip(tx, vessel2);
- Activity activity = tx.getActivityDao().create(
- Activity.PROPERTY_TRIP, trip,
- Activity.PROPERTY_OCEAN, ocean
- );
+ Activity activity = T3PersistenceFixtures.newActivity(tx, ocean);
trip.addActivity(activity);
- Set<Country> result;
-
- result = dao.findAllFlagUsedInSample(ocean.getTopiaId());
+ Set<Country> result = dao.findAllFlagUsedInSample(ocean.getTopiaId());
Assert.assertNotNull(result);
//FIXME Should be zero when we will fix the request...
// Assert.assertEquals(0, result.size());
@@ -166,10 +142,10 @@ public class CountryTopiaDaoTest extends AbstractDatabaseTest {
// SetSpeciesFrequency f =
// tx.getSetSpeciesFrequencyDAO(tx).create(SetSpeciesFrequency.PROPERTY_ACTIVITY, activity);
- result = dao.findAllFlagUsedInSample(ocean.getTopiaId());
- Assert.assertNotNull(result);
- Assert.assertEquals(1, result.size());
- Assert.assertEquals(country, result.iterator().next());
+// result = dao.findAllFlagUsedInSample(ocean.getTopiaId());
+// Assert.assertNotNull(result);
+// Assert.assertEquals(1, result.size());
+// Assert.assertEquals(country, result.iterator().next());
}
}
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/HarbourTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/HarbourTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/HarbourTopiaDaoTest.java
@@ -21,12 +21,13 @@
package fr.ird.t3.entities.reference;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
-import fr.ird.t3.entities.data.Trip;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Set;
+
/**
* Test the user dao {@link AbstractHarbourTopiaDao}.
*
@@ -36,20 +37,14 @@ import org.junit.Test;
public class HarbourTopiaDaoTest extends AbstractDatabaseTest {
@Test
- public void findAllUsedInLandingTrip() throws Exception {
-
+ public void findAllUsedInLandingTrip() {
T3TopiaPersistenceContext tx = beginTransaction();
- HarbourTopiaDao dao = tx.getHarbourDao();
-
- Harbour harbour = dao.create(Harbour.PROPERTY_CODE, 1);
- Harbour harbour2 = dao.create(Harbour.PROPERTY_CODE, 2);
-
- Trip trip = tx.getTripDao().create(
- Trip.PROPERTY_LANDING_HARBOUR, harbour
- );
+ Harbour harbour = T3PersistenceFixtures.newHarbour(tx, 1);
+ T3PersistenceFixtures.newHarbour(tx, 2);
+ T3PersistenceFixtures.newTrip(tx, harbour);
- Set<Harbour> result = dao.findAllUsedInLandingTrip();
+ Set<Harbour> result = tx.getHarbourDao().findAllUsedInLandingTrip();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
Assert.assertEquals(harbour, result.iterator().next());
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/LengthWeightConversionHelperTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/LengthWeightConversionHelperTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/LengthWeightConversionHelperTest.java
@@ -28,15 +28,16 @@ import com.google.common.collect.Sets;
import fr.ird.t3.entities.AbstractDatabaseTest;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.type.T3Date;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* tests the {@link LengthWeightConversionHelper}.
*
@@ -46,13 +47,13 @@ import org.nuiton.topia.persistence.TopiaException;
public class LengthWeightConversionHelperTest extends AbstractDatabaseTest {
@Before
- public void setUp() throws Exception {
+ public void setUp() {
db.loadClassPathScript("/db/LengthWeightConversionHelperTest.sql");
}
@Test
- public void testGetConversionsAtlantique() throws Exception {
+ public void testGetConversionsAtlantique() {
T3TopiaPersistenceContext tx = beginTransaction();
@@ -63,7 +64,7 @@ public class LengthWeightConversionHelperTest extends AbstractDatabaseTest {
}
@Test
- public void testGetConversionsIndian() throws Exception {
+ public void testGetConversionsIndian() {
T3TopiaPersistenceContext tx = beginTransaction();
@@ -73,8 +74,7 @@ public class LengthWeightConversionHelperTest extends AbstractDatabaseTest {
}
- protected void testConversionForOcean(T3TopiaPersistenceContext tx,
- Ocean ocean) throws TopiaException {
+ private void testConversionForOcean(T3TopiaPersistenceContext tx, Ocean ocean) throws TopiaException {
Date date = T3Date.newDate(1, 2010).toBeginDate();
LengthWeightConversionHelper conversionHelper =
@@ -130,10 +130,10 @@ public class LengthWeightConversionHelperTest extends AbstractDatabaseTest {
}
Range<Integer> open = Range.open(0, 1000);
- List<Integer> lenghtClasses = Lists.newArrayList(ContiguousSet.create(open,DiscreteDomain.integers()));
+ List<Integer> lengthClasses = Lists.newArrayList(ContiguousSet.create(open,DiscreteDomain.integers()));
Map<Integer, WeightCategoryTreatment> distribution =
- conversionHelper.getWeightCategoriesDistribution(conversion, allCategories, lenghtClasses);
+ conversionHelper.getWeightCategoriesDistribution(conversion, allCategories, lengthClasses);
Assert.assertNotNull(distribution);
Set<WeightCategoryTreatment> usedweithCategories = Sets.newHashSet(distribution.values());
// all categories must be used (except the undefined one
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/OceanTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/OceanTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/OceanTopiaDaoTest.java
@@ -21,13 +21,15 @@
package fr.ird.t3.entities.reference;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.data.Activity;
import fr.ird.t3.entities.data.Trip;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Set;
+
/**
* Test the user dao {@link AbstractOceanTopiaDao}.
*
@@ -37,21 +39,18 @@ import org.junit.Test;
public class OceanTopiaDaoTest extends AbstractDatabaseTest {
@Test
- public void findAllUsedInActivity() throws Exception {
+ public void findAllUsedInActivity() {
T3TopiaPersistenceContext tx = beginTransaction();
- OceanTopiaDao dao = tx.getOceanDao();
- Ocean ocean = dao.create(Ocean.PROPERTY_CODE, 0);
- Trip trip = tx.getTripDao().create();
- Activity activity = tx.getActivityDao().create(
- Activity.PROPERTY_OCEAN, ocean,
- Activity.PROPERTY_TRIP, trip
- );
+ Ocean ocean = T3PersistenceFixtures.newOcean(tx);
+ Trip trip = T3PersistenceFixtures.newTrip(tx);
+ Activity activity = T3PersistenceFixtures.newActivity(tx, ocean);
trip.addActivity(activity);
- Set<Ocean> result = dao.findAllUsedInActivity();
+ Set<Ocean> result = tx.getOceanDao().findAllUsedInActivity();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
Assert.assertEquals(ocean, result.iterator().next());
}
+
}
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/SpecieDAOImplTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/SpecieDAOImplTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/SpecieDAOImplTest.java
@@ -21,14 +21,16 @@
package fr.ird.t3.entities.reference;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.data.Activity;
import fr.ird.t3.entities.data.CorrectedElementaryCatch;
import fr.ird.t3.entities.data.Trip;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Set;
+
/**
* Test the user dao {@link AbstractSpeciesTopiaDao}.
*
@@ -38,28 +40,23 @@ import org.junit.Test;
public class SpecieDAOImplTest extends AbstractDatabaseTest {
@Test
- public void findAllSpecieUsedInCatch() throws Exception {
+ public void findAllSpecieUsedInCatch() {
T3TopiaPersistenceContext tx = beginTransaction();
SpeciesTopiaDao dao = tx.getSpeciesDao();
- Species species = dao.create(Species.PROPERTY_CODE, 0);
- Species species2 = dao.create(Species.PROPERTY_CODE, 1);
+ Species species = T3PersistenceFixtures.newSpecies(tx, 0);
+ T3PersistenceFixtures.newSpecies(tx, 1);
- Trip trip = tx.getTripDao().create();
+ Trip trip = T3PersistenceFixtures.newTrip(tx);
- // create another trip without any activity (so withou also any corrected catches)
- Trip trip2 = tx.getTripDao().create();
+ // create another trip without any activity (so without also any corrected catches)
+ T3PersistenceFixtures.newTrip(tx, T3PersistenceFixtures.newVessel(tx, 0));
- Activity activity = tx.getActivityDao().create(
- Activity.PROPERTY_TRIP, trip
- );
+ Activity activity = T3PersistenceFixtures.newActivity(tx, T3PersistenceFixtures.newOcean(tx));
trip.addActivity(activity);
-
- CorrectedElementaryCatch catche =
- tx.getCorrectedElementaryCatchDao().create(CorrectedElementaryCatch.PROPERTY_SPECIES, species);
- activity.addCorrectedElementaryCatch(catche);
+ activity.addCorrectedElementaryCatch(tx.getCorrectedElementaryCatchDao().create(CorrectedElementaryCatch.PROPERTY_SPECIES, species));
Set<Species> result = dao.findAllSpeciesUsedInCatch();
Assert.assertNotNull(result);
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
@@ -21,12 +21,13 @@
package fr.ird.t3.entities.reference;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
-import fr.ird.t3.entities.data.Trip;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Set;
+
/**
* Test the user dao {@link AbstractVesselSimpleTypeTopiaDao}.
*
@@ -36,26 +37,21 @@ import org.junit.Test;
public class VesselSimpleTypeTopiaDaoTest extends AbstractDatabaseTest {
@Test
- public void findAllUsedInTrip() throws Exception {
+ public void findAllUsedInTrip() {
T3TopiaPersistenceContext tx = beginTransaction();
- VesselSimpleTypeTopiaDao dao = tx.getVesselSimpleTypeDao();
- VesselSimpleType vesselSimpleType = dao.create(VesselSimpleType.PROPERTY_CODE, 1);
- VesselSimpleType vesselSimpleType2 = dao.create(VesselSimpleType.PROPERTY_CODE, 2);
+ VesselSimpleType vesselSimpleType = T3PersistenceFixtures.newVesselSimpleType(tx, 1);
+ VesselSimpleType vesselSimpleType2 = T3PersistenceFixtures.newVesselSimpleType(tx, 2);
- VesselTypeTopiaDao vesselTypeDAO = tx.getVesselTypeDao();
- VesselType vesselType = vesselTypeDAO.create(VesselType.PROPERTY_CODE, 1, VesselType.PROPERTY_VESSEL_SIMPLE_TYPE, vesselSimpleType);
- VesselType vesselType2 = vesselTypeDAO.create(VesselType.PROPERTY_CODE, 2, VesselType.PROPERTY_VESSEL_SIMPLE_TYPE, vesselSimpleType2);
+ VesselType vesselType = T3PersistenceFixtures.newVesselType(tx, 1, vesselSimpleType);
+ VesselType vesselType2 = T3PersistenceFixtures.newVesselType(tx, 2, vesselSimpleType2);
- VesselTopiaDao vesselDAO = tx.getVesselDao();
- Vessel vessel = vesselDAO.create(Vessel.PROPERTY_CODE, 1, Vessel.PROPERTY_VESSEL_TYPE, vesselType);
- Vessel vessel2 = vesselDAO.create(Vessel.PROPERTY_CODE, 2, Vessel.PROPERTY_VESSEL_TYPE, vesselType2);
+ Vessel vessel = T3PersistenceFixtures.newVessel(tx, vesselType, 1);
+ T3PersistenceFixtures.newVessel(tx, vesselType2, 2);
- Trip trip = tx.getTripDao().create(
- Trip.PROPERTY_VESSEL, vessel
- );
- Set<VesselSimpleType> result = dao.findAllUsedInTrip(null);
+ T3PersistenceFixtures.newTrip(tx, vessel);
+ Set<VesselSimpleType> result = tx.getVesselSimpleTypeDao().findAllUsedInTrip(null);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
Assert.assertEquals(vesselSimpleType, result.iterator().next());
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselTopiaDaoTest.java
@@ -21,13 +21,15 @@
package fr.ird.t3.entities.reference;
import fr.ird.t3.entities.AbstractDatabaseTest;
+import fr.ird.t3.entities.T3PersistenceFixtures;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.data.Activity;
import fr.ird.t3.entities.data.Trip;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Set;
+
/**
* Test the user dao {@link AbstractVesselTopiaDao}.
*
@@ -37,22 +39,17 @@ import org.junit.Test;
public class VesselTopiaDaoTest extends AbstractDatabaseTest {
@Test
- public void findAllUsedInTrip() throws Exception {
+ public void findAllUsedInTrip() {
T3TopiaPersistenceContext tx = beginTransaction();
- VesselTopiaDao dao = tx.getVesselDao();
- Vessel vessel = dao.create(Vessel.PROPERTY_CODE, 1);
- Vessel vessel2 = dao.create(Vessel.PROPERTY_CODE, 2);
+ Vessel vessel = T3PersistenceFixtures.newVessel(tx, 1);
+ T3PersistenceFixtures.newVessel(tx, 2);
- Trip trip = tx.getTripDao().create(
- Trip.PROPERTY_VESSEL, vessel
- );
- Activity activity = tx.getActivityDao().create(
- Activity.PROPERTY_TRIP, trip
- );
+ Trip trip = T3PersistenceFixtures.newTrip(tx, vessel);
+ Activity activity = T3PersistenceFixtures.newActivity(tx, T3PersistenceFixtures.newOcean(tx));
trip.addActivity(activity);
- Set<Vessel> result = dao.findAllUsedInTrip();
+ Set<Vessel> result = tx.getVesselDao().findAllUsedInTrip();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
Assert.assertEquals(vessel, result.iterator().next());
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/WeightCategoryTreatmentImplTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/WeightCategoryTreatmentImplTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/WeightCategoryTreatmentImplTest.java
@@ -39,7 +39,7 @@ import org.junit.Test;
public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest {
@Test
- public void testGetOldCategoryCode() throws Exception {
+ public void testGetOldCategoryCode() {
db.loadClassPathScript("/db/WeightCategoryTreatmentImplTest.sql");
try (T3TopiaPersistenceContext tx = beginTransaction()) {
@@ -52,7 +52,7 @@ public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest {
}
@Test
- public void testWeightCategoryTreatmentComparator() throws Exception {
+ public void testWeightCategoryTreatmentComparator() {
WeightCategoryTreatment catInconnu = new WeightCategoryTreatmentImpl();
@@ -83,7 +83,7 @@ public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest {
}
@Test
- public void testWeightCategoryTreatmentComparator2() throws Exception {
+ public void testWeightCategoryTreatmentComparator2() {
WeightCategoryTreatment catInconnu = new WeightCategoryTreatmentImpl();
@@ -135,7 +135,7 @@ public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest {
}
@Test
- public void getWeightCategoryTreatment() throws Exception {
+ public void getWeightCategoryTreatment() {
WeightCategoryTreatment catInconnu = new WeightCategoryTreatmentImpl();
@@ -184,7 +184,7 @@ public class WeightCategoryTreatmentImplTest extends AbstractDatabaseTest {
}
@Test
- public void getWeightCategoryTreatment2() throws Exception {
+ public void getWeightCategoryTreatment2() {
WeightCategoryTreatment catInconnu = new WeightCategoryTreatmentImpl();
=====================================
t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
=====================================
--- a/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
+++ b/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
@@ -55,11 +55,12 @@ import fr.ird.t3.io.input.access.T3AccessEntityMeta;
import fr.ird.t3.io.input.access.T3AccessEntityMetaProvider;
import fr.ird.t3.io.input.access.T3AccessReferentielEntityMeta;
import fr.ird.t3.io.input.access.type.IntToBoolean;
-import java.util.Date;
-import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.util.Date;
+import java.util.Set;
+
/**
* Provider of {@link T3AccessEntityMeta}.
*
@@ -86,9 +87,7 @@ public class T3AccessEntityMetaProviderAvdth33 implements T3AccessEntityMetaProv
Activity.PROPERTY_ACTIVITY_FISHING_CONTEXT, ActivityFishingContext.class,
Activity.PROPERTY_ELEMENTARY_CATCH, ElementaryCatch.class
},
- new Object[]{
- Activity.PROPERTY_TRIP, Trip.class
- },
+ new Object[]{ /* Nothing to do any longer */},
Activity.PROPERTY_DATE, Date.class, "D_ACT",
Activity.PROPERTY_NUMBER, Integer.class, "N_ACT",
Activity.PROPERTY_OCEAN, Ocean.class, "C_OCEA",
=====================================
t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
=====================================
--- a/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
+++ b/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
@@ -34,9 +34,9 @@ import fr.ird.t3.entities.data.LocalMarketSampleSpeciesFrequency;
import fr.ird.t3.entities.data.LocalMarketSampleWell;
import fr.ird.t3.entities.data.LocalMarketSurvey;
import fr.ird.t3.entities.data.Sample;
+import fr.ird.t3.entities.data.SampleSet;
import fr.ird.t3.entities.data.SampleSpecies;
import fr.ird.t3.entities.data.SampleSpeciesFrequency;
-import fr.ird.t3.entities.data.SampleSet;
import fr.ird.t3.entities.data.Trip;
import fr.ird.t3.entities.data.Well;
import fr.ird.t3.entities.data.WellPlan;
@@ -98,9 +98,7 @@ public class T3AccessEntityMetaProviderAvdth35 implements T3AccessEntityMetaProv
Activity.PROPERTY_ACTIVITY_FISHING_CONTEXT, ActivityFishingContext.class,
Activity.PROPERTY_ELEMENTARY_CATCH, ElementaryCatch.class
},
- new Object[]{
- Activity.PROPERTY_TRIP, Trip.class
- },
+ new Object[]{/* Nothing to do any longer */},
Activity.PROPERTY_DATE, Date.class, "D_ACT",
Activity.PROPERTY_NUMBER, Integer.class, "N_ACT",
Activity.PROPERTY_OCEAN, Ocean.class, "C_OCEA",
=====================================
t3-input-avdthv35/src/test/resources/t3-TopiaContextImpl.properties
=====================================
--- a/t3-input-avdthv35/src/test/resources/t3-TopiaContextImpl.properties
+++ b/t3-input-avdthv35/src/test/resources/t3-TopiaContextImpl.properties
@@ -24,7 +24,7 @@ hibernate.show_sql=false
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.username=sa
-hibernate.connection.password=
+hibernate.connection.password=sa
hibernate.connection.driver_class=org.h2.Driver
# tchemit 2010-11-28 : comment this line, each test must define his own db path
#hibernate.connection.url=jdbc:h2:file:target/surefire-workdir/h2data
=====================================
t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
=====================================
--- a/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
+++ b/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
@@ -34,9 +34,9 @@ import fr.ird.t3.entities.data.LocalMarketSampleSpeciesFrequency;
import fr.ird.t3.entities.data.LocalMarketSampleWell;
import fr.ird.t3.entities.data.LocalMarketSurvey;
import fr.ird.t3.entities.data.Sample;
+import fr.ird.t3.entities.data.SampleSet;
import fr.ird.t3.entities.data.SampleSpecies;
import fr.ird.t3.entities.data.SampleSpeciesFrequency;
-import fr.ird.t3.entities.data.SampleSet;
import fr.ird.t3.entities.data.Trip;
import fr.ird.t3.entities.data.Well;
import fr.ird.t3.entities.data.WellPlan;
@@ -100,9 +100,7 @@ public class T3AccessEntityMetaProviderAvdth36 implements T3AccessEntityMetaProv
Activity.PROPERTY_ACTIVITY_FISHING_CONTEXT, ActivityFishingContext.class,
Activity.PROPERTY_ELEMENTARY_CATCH, ElementaryCatch.class
},
- new Object[]{
- Activity.PROPERTY_TRIP, Trip.class
- },
+ new Object[]{ /* Nothing to do any longer */},
Activity.PROPERTY_DATE, Date.class, "D_ACT",
Activity.PROPERTY_NUMBER, Integer.class, "N_ACT",
Activity.PROPERTY_OCEAN, Ocean.class, "C_OCEA",
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/896731cf2ee1936293340e4c2e25c73…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/896731cf2ee1936293340e4c2e25c73…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] [N0] Marée Echantillons seulement et gestion de l'UI du N0 (Closes #85)
by Tony CHEMIT 20 Feb '18
by Tony CHEMIT 20 Feb '18
20 Feb '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
896731cf by Tony CHEMIT at 2018-02-20T15:44:56+01:00
[N0] Marée Echantillons seulement et gestion de l'UI du N0 (Closes #85)
- - - - -
3 changed files:
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractVesselSimpleTypeTopiaDao.java
- t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level0/AbstractLevel0ConfigureAction.java
Changes:
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractVesselSimpleTypeTopiaDao.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractVesselSimpleTypeTopiaDao.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractVesselSimpleTypeTopiaDao.java
@@ -21,9 +21,10 @@
package fr.ird.t3.entities.reference;
+import org.nuiton.topia.persistence.TopiaException;
+
import java.util.HashSet;
import java.util.Set;
-import org.nuiton.topia.persistence.TopiaException;
/**
* {@link VesselSimpleType} user dao operations.
@@ -36,10 +37,11 @@ public class AbstractVesselSimpleTypeTopiaDao<E extends VesselSimpleType> extend
/**
* Obtains all vessel simple types used by all trips in the database.
*
+ * @param sampleOnly if null no filter else filter on value
* @return the set of used vessel simple types in trips in the database
* @throws TopiaException if any problem while querying the database
*/
- public Set<E> findAllUsedInTrip() throws TopiaException {
+ public Set<E> findAllUsedInTrip(Boolean sampleOnly) throws TopiaException {
// TopiaQuery query = createQuery("vst")
// .addFrom(Trip.class, "t")
@@ -48,7 +50,8 @@ public class AbstractVesselSimpleTypeTopiaDao<E extends VesselSimpleType> extend
// Vessel.PROPERTY_VESSEL_TYPE + "." +
// VesselType.PROPERTY_VESSEL_SIMPLE_TYPE + " = vst.id");
- String hql = "SELECT DISTINCT(vst) FROM VesselSimpleTypeImpl vst, TripImpl t WHERE t.vessel.vesselType.vesselSimpleType = vst.id";
+ String sampleOnlyFilter = sampleOnly == null ? "" : (" AND t.sampleOnly = " + sampleOnly);
+ String hql = "SELECT DISTINCT(vst) FROM VesselSimpleTypeImpl vst, TripImpl t WHERE t.vessel.vesselType.vesselSimpleType = vst.id" + sampleOnlyFilter;
return new HashSet<>(findAll(hql));
// return T3EntityHelper.querytoSet(hql, this);
}
=====================================
t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
=====================================
--- a/t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
+++ b/t3-domain/src/test/java/fr/ird/t3/entities/reference/VesselSimpleTypeTopiaDaoTest.java
@@ -55,7 +55,7 @@ public class VesselSimpleTypeTopiaDaoTest extends AbstractDatabaseTest {
Trip trip = tx.getTripDao().create(
Trip.PROPERTY_VESSEL, vessel
);
- Set<VesselSimpleType> result = dao.findAllUsedInTrip();
+ Set<VesselSimpleType> result = dao.findAllUsedInTrip(null);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
Assert.assertEquals(vesselSimpleType, result.iterator().next());
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/data/level0/AbstractLevel0ConfigureAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/data/level0/AbstractLevel0ConfigureAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/data/level0/AbstractLevel0ConfigureAction.java
@@ -67,7 +67,7 @@ public abstract class AbstractLevel0ConfigureAction<C extends AbstractLevel0Conf
@InjectDecoratedBeans(beanType = VesselSimpleType.class)
protected Map<String, String> vesselSimpleTypes;
- @InjectDecoratedBeans(beanType = Country.class)
+ @InjectDecoratedBeans(beanType = Country.class, pathIds = "configuration.")
protected Map<String, String> fleets;
protected AbstractLevel0ConfigureAction(Class<C> configurationType) {
@@ -142,7 +142,7 @@ public abstract class AbstractLevel0ConfigureAction<C extends AbstractLevel0Conf
T3Date maxDate = tripDAO.getLastLandingDate();
config.setMaxDate(maxDate);
config.setEndDate(maxDate);
- config.setVesselSimpleTypes(sortToList(vesselSimpleTypeDAO.findAllUsedInTrip()));
+ config.setVesselSimpleTypes(sortToList(vesselSimpleTypeDAO.findAllUsedInTrip(false)));
config.setFleets(sortToList(countryDAO.findAllFleetUsedInTrip()));
if (log.isInfoEnabled()) {
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/896731cf2ee1936293340e4c2e25c732…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/896731cf2ee1936293340e4c2e25c732…
You're receiving this email because of your account on gitlab.com.
1
0
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
0e572a52 by Tony CHEMIT at 2018-02-20T15:11:14+01:00
Use ird-t3-data 1.2
- - - - -
1 changed file:
- pom.xml
Changes:
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -99,8 +99,8 @@
<organizationId>ultreiaio</organizationId>
<projectId>ird-t3</projectId>
<applicationName>t3</applicationName>
+ <t3-data.version>1.2</t3-data.version>
- <t3-data.version>1.2-SNAPSHOT</t3-data.version>
<env>dev</env>
<!-- libraries version -->
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/0e572a52db71bf2193b35601e80c1fbc…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/0e572a52db71bf2193b35601e80c1fbc…
You're receiving this email because of your account on gitlab.com.
1
0
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
ac92b53b by Tony CHEMIT at 2018-02-20T13:11:39+01:00
Let's go to version 2.1
- - - - -
21 changed files:
- CONTRIBUTING.md
- pom.xml
- t3-actions/pom.xml
- t3-domain/pom.xml
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV3_0.java → t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_1.java
- t3-domain/src/main/resources/db/migration/V3_0_01_add-Harbour-country-link.sql → t3-domain/src/main/resources/db/migration/V2_1_01_add-Harbour-country-link.sql
- t3-domain/src/main/resources/db/migration/V3_0_02_remove-LocalMarketPackaging-status.sql → t3-domain/src/main/resources/db/migration/V2_1_02_remove-LocalMarketPackaging-status.sql
- t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql → t3-domain/src/main/resources/db/migration/V2_1_03_fix-LocalMarketPackagingType-ids.sql
- t3-domain/src/main/resources/db/migration/V3_0_04_rename-SampleWell-table.sql → t3-domain/src/main/resources/db/migration/V2_1_04_rename-SampleWell-table.sql
- t3-domain/src/main/resources/db/migration/V3_0_05_rename-SampleSpecies-fields.sql → t3-domain/src/main/resources/db/migration/V2_1_05_rename-SampleSpecies-fields.sql
- t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql → t3-domain/src/main/resources/db/migration/V2_1_06_referential-i18n.sql
- t3-domain/src/main/xmi/t3-persistence.properties
- t3-input-avdthv33/pom.xml
- t3-input-avdthv35/pom.xml
- t3-input-avdthv36/pom.xml
- t3-installer/pom.xml
- t3-msaccess-importer/pom.xml
- t3-output-balbayav32/pom.xml
- t3-test/pom.xml
- t3-web/pom.xml
- t3/pom.xml
Changes:
=====================================
CONTRIBUTING.md
=====================================
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,39 +1,3 @@
-# Release (without stage)
+# How does it works ?
-```
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/close-milestone.sh | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/create-stage.sh | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/close-and-release-stage.sh | sed 's/$1/frirdt3/' | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/update-changelog.sh | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/create-milestone.sh | bash
-```
-
-# Release (with stage)
-
-Create stage
-
-```
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/close-milestone.sh | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/create-stage.sh | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/close-stage.sh | sed 's/$1/frirdt3/' | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/update-staging-changelog.sh | sed 's/$1/frirdt3/' | bash
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/create-milestone.sh | bash
-```
-
-And to release stage
-
-```
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/release-stage.sh | sed 's/$1/frirdt3/' | bash
-```
-
-# Regenerate changelog
-
-```
-wget -q -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/update-changelog.sh | bash
-```
-
-# Generate site
-
-```
-mvn clean verify site -DperformRelease scm-publish:publish-scm
-```
\ No newline at end of file
+See [Ultreiaio/scripts](https://gitlab.com/ultreiaio/scripts/blob/master/README.….
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>T3 :: Pom</name>
=====================================
t3-actions/pom.xml
=====================================
--- a/t3-actions/pom.xml
+++ b/t3-actions/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-actions</artifactId>
=====================================
t3-domain/pom.xml
=====================================
--- a/t3-domain/pom.xml
+++ b/t3-domain/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-domain</artifactId>
=====================================
t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV3_0.java → t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_1.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV3_0.java
+++ b/t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_1.java
@@ -35,30 +35,20 @@ import java.util.List;
* @author Tony Chemit - dev(a)tchemit.fr
*/
@AutoService(TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion.class)
-public class T3MigrationCallbackV3_0 extends T3MigrationCallbackSupport {
+public class T3MigrationCallbackV2_1 extends T3MigrationCallbackSupport {
- public T3MigrationCallbackV3_0() {
- super(Versions.valueOf("3.0"));
+ public T3MigrationCallbackV2_1() {
+ super(Versions.valueOf("2.1"));
}
@Override
protected void prepareMigrationScript(TopiaSqlSupport sqlSupport, List<String> queries, boolean showSql, boolean showProgression) throws TopiaException {
-
addScript("01", "add-Harbour-country-link", queries);
addScript("02", "remove-LocalMarketPackaging-status", queries);
addScript("03", "fix-LocalMarketPackagingType-ids", queries);
addScript("04", "rename-SampleWell-table", queries);
addScript("05", "rename-SampleSpecies-fields", queries);
addScript("06", "referential-i18n", queries);
-// addScript("07", "", queries);
-// addScript("08", "", queries);
-// addScript("09", "", queries);
-// addScript("10", "", queries);
-// addScript("11", "", queries);
-// addScript("12", "", queries);
-// addScript("13", "", queries);
-// addScript("14", "", queries);
-
}
}
=====================================
t3-domain/src/main/resources/db/migration/V3_0_01_add-Harbour-country-link.sql → t3-domain/src/main/resources/db/migration/V2_1_01_add-Harbour-country-link.sql
=====================================
=====================================
t3-domain/src/main/resources/db/migration/V3_0_02_remove-LocalMarketPackaging-status.sql → t3-domain/src/main/resources/db/migration/V2_1_02_remove-LocalMarketPackaging-status.sql
=====================================
=====================================
t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql → t3-domain/src/main/resources/db/migration/V2_1_03_fix-LocalMarketPackagingType-ids.sql
=====================================
=====================================
t3-domain/src/main/resources/db/migration/V3_0_04_rename-SampleWell-table.sql → t3-domain/src/main/resources/db/migration/V2_1_04_rename-SampleWell-table.sql
=====================================
=====================================
t3-domain/src/main/resources/db/migration/V3_0_05_rename-SampleSpecies-fields.sql → t3-domain/src/main/resources/db/migration/V2_1_05_rename-SampleSpecies-fields.sql
=====================================
=====================================
t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql → t3-domain/src/main/resources/db/migration/V2_1_06_referential-i18n.sql
=====================================
=====================================
t3-domain/src/main/xmi/t3-persistence.properties
=====================================
--- a/t3-domain/src/main/xmi/t3-persistence.properties
+++ b/t3-domain/src/main/xmi/t3-persistence.properties
@@ -22,7 +22,7 @@
model.tagValue.notGenerateToString=true
model.tagValue.generateOperatorForDAOHelper=true
model.tagValue.constantPrefix=PROPERTY_
-model.tagValue.version=3.0
+model.tagValue.version=2.1
model.tagValue.indexForeignKeys=true
fr.ird.t3.entities.data.Trip.attribute.activity.stereotype=ordered
=====================================
t3-input-avdthv33/pom.xml
=====================================
--- a/t3-input-avdthv33/pom.xml
+++ b/t3-input-avdthv33/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-input-avdthv33</artifactId>
=====================================
t3-input-avdthv35/pom.xml
=====================================
--- a/t3-input-avdthv35/pom.xml
+++ b/t3-input-avdthv35/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-input-avdthv35</artifactId>
=====================================
t3-input-avdthv36/pom.xml
=====================================
--- a/t3-input-avdthv36/pom.xml
+++ b/t3-input-avdthv36/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-input-avdthv36</artifactId>
=====================================
t3-installer/pom.xml
=====================================
--- a/t3-installer/pom.xml
+++ b/t3-installer/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-installer</artifactId>
=====================================
t3-msaccess-importer/pom.xml
=====================================
--- a/t3-msaccess-importer/pom.xml
+++ b/t3-msaccess-importer/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-msaccess-importer</artifactId>
=====================================
t3-output-balbayav32/pom.xml
=====================================
--- a/t3-output-balbayav32/pom.xml
+++ b/t3-output-balbayav32/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-output-balbayav32</artifactId>
=====================================
t3-test/pom.xml
=====================================
--- a/t3-test/pom.xml
+++ b/t3-test/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-test</artifactId>
=====================================
t3-web/pom.xml
=====================================
--- a/t3-web/pom.xml
+++ b/t3-web/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3-web</artifactId>
=====================================
t3/pom.xml
=====================================
--- a/t3/pom.xml
+++ b/t3/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>fr.ird.t3</groupId>
<artifactId>ird-t3</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.1-SNAPSHOT</version>
</parent>
<artifactId>t3</artifactId>
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/ac92b53b88b3fdfd4579824b2ce9d770…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/ac92b53b88b3fdfd4579824b2ce9d770…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] 3 commits: Améliorations dans la gestion des profils utilisateurs (Pour la création on…
by Tony CHEMIT 20 Feb '18
by Tony CHEMIT 20 Feb '18
20 Feb '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
ce678d47 by Tony CHEMIT at 2018-02-20T12:17:58+01:00
Améliorations dans la gestion des profils utilisateurs (Pour la création on deamdne aussi une confirmation du mot de passe) (See #251)
- - - - -
f886e0cf by Tony CHEMIT at 2018-02-20T12:18:05+01:00
improve configurations (for migration purpose)
- - - - -
4a76939e by Tony CHEMIT at 2018-02-20T12:18:05+01:00
fix migrations + add a test for migraiton
- - - - -
8 changed files:
- t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
- t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
- t3-domain/src/main/resources/t3-datadb.properties
- t3-domain/src/main/resources/t3-log4j.conf
- t3-domain/src/main/xmi/t3-persistence.properties
- + t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
- t3-domain/src/test/resources/log4j.properties
- t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
Changes:
=====================================
t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
=====================================
--- a/t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
+++ b/t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
@@ -18,14 +18,14 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- #L%
---
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.1', 0, '2016-01-28 00:00:00', 1, 'Vrac pesé ou non (multispécifique) (sondage)', true);
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.2', 0, '2016-01-28 00:00:00', 2, 'Pesée (monospécifique) (pas de sondage)', true);
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.3', 0, '2016-01-28 00:00:00', 3, 'Espèce unité (monospécifique) (pas de sondage)', true);
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.4', 0, '2016-01-28 00:00:00', 4, 'Paquet non pesé (monospécifique) (pas de sondage)', true);
-
+-- Trick (we add 1000 to code, we will subtract them later)
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.1', 0, '2016-01-28 00:00:00', 1001, 'Vrac pesé ou non (multispécifique) (sondage)', true);
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.2', 0, '2016-01-28 00:00:00', 1002, 'Pesée (monospécifique) (pas de sondage)', true);
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.3', 0, '2016-01-28 00:00:00', 1003, 'Espèce unité (monospécifique) (pas de sondage)', true);
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.4', 0, '2016-01-28 00:00:00', 1004, 'Paquet non pesé (monospécifique) (pas de sondage)', true);
UPDATE Localmarketpackaging SET localmarketpackagingtype = replace(localmarketpackagingtype,'LocalMarketPackaging', 'LocalMarketPackagingType');
-
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.1';
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.2';
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.3';
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.4';
+UPDATE LocalmarketpackagingType SET code = code -1000;
\ No newline at end of file
=====================================
t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
=====================================
--- a/t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
+++ b/t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
@@ -51,7 +51,6 @@ ALTER TABLE zoneee RENAME COLUMN libelle TO label1;
ALTER TABLE zoneee RENAME COLUMN versionlibelle TO versionLabel;
ALTER TABLE zonefao RENAME COLUMN libelle TO label1;
ALTER TABLE zonefao RENAME COLUMN versionlibelle TO versionLabel;
-
ALTER TABLE country ADD COLUMN label2 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label2 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label2 VARCHAR(255);
@@ -78,7 +77,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label2 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label2 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label2 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label2 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label3 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label3 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label3 VARCHAR(255);
@@ -105,7 +103,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label3 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label3 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label3 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label3 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label4 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label4 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label4 VARCHAR(255);
@@ -132,7 +129,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label4 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label4 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label4 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label4 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label5 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label5 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label5 VARCHAR(255);
@@ -159,7 +155,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label5 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label5 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label5 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label5 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label6 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label6 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label6 VARCHAR(255);
@@ -186,7 +181,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label6 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label6 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label6 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label6 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label7 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label7 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label7 VARCHAR(255);
@@ -213,7 +207,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label7 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label7 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label7 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label7 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label8 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label8 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label8 VARCHAR(255);
@@ -239,4 +232,4 @@ ALTER TABLE localMarketPackaging ADD COLUMN label8 VARCHAR(255);
ALTER TABLE ElementaryCatchFate ADD COLUMN label8 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label8 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label8 VARCHAR(255);
-ALTER TABLE zonefao ADD COLUMN label8 VARCHAR(255);
+ALTER TABLE zonefao ADD COLUMN label8 VARCHAR(255);
\ No newline at end of file
=====================================
t3-domain/src/main/resources/t3-datadb.properties
=====================================
--- a/t3-domain/src/main/resources/t3-datadb.properties
+++ b/t3-domain/src/main/resources/t3-datadb.properties
@@ -37,4 +37,5 @@ hibernate.hikari.registerMbeans=true
topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback
topia.service.migration.showSql=true
+topia.service.migration.showProgression=true
=====================================
t3-domain/src/main/resources/t3-log4j.conf
=====================================
--- a/t3-domain/src/main/resources/t3-log4j.conf
+++ b/t3-domain/src/main/resources/t3-log4j.conf
@@ -20,6 +20,7 @@ log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (
log4j.logger.fr.ird.t3=INFO
log4j.logger.fr.ird.t3.services.ioc=WARN
log4j.logger.org.nuiton=WARN
+log4j.logger.org.nuiton.topia.migration=INFO
log4j.logger.org.hibernate.orm.deprecation=ERROR
log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
=====================================
t3-domain/src/main/xmi/t3-persistence.properties
=====================================
--- a/t3-domain/src/main/xmi/t3-persistence.properties
+++ b/t3-domain/src/main/xmi/t3-persistence.properties
@@ -22,7 +22,7 @@
model.tagValue.notGenerateToString=true
model.tagValue.generateOperatorForDAOHelper=true
model.tagValue.constantPrefix=PROPERTY_
-model.tagValue.version=2.0
+model.tagValue.version=3.0
model.tagValue.indexForeignKeys=true
fr.ird.t3.entities.data.Trip.attribute.activity.stereotype=ordered
=====================================
t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
=====================================
--- /dev/null
+++ b/t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
@@ -0,0 +1,55 @@
+package fr.ird.t3.services.migration;
+
+/*-
+ * #%L
+ * T3 :: Domain
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ird.t3.entities.T3TopiaApplicationContext;
+import fr.ird.t3.entities.user.JdbcConfiguration;
+import fr.ird.t3.entities.user.JdbcConfigurationHelper;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Created by tchemit on 20/02/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+@Ignore
+public class T3MigrationTest {
+
+ @Test
+ public void migratePostgres() {
+
+ String url = "jdbc:postgresql:t3";
+ String login = "t3-admin";
+ String password = "a";
+
+ JdbcConfiguration jdbcConfiguration = JdbcConfigurationHelper.newJdbcConfiguration();
+ jdbcConfiguration.setUrl(url);
+ jdbcConfiguration.setLogin(login);
+ jdbcConfiguration.setPassword(password);
+ try (T3TopiaApplicationContext rootContext = T3TopiaApplicationContext.newDb(jdbcConfiguration)) {
+ Assert.assertNotNull(rootContext);
+ }
+
+ }
+}
=====================================
t3-domain/src/test/resources/log4j.properties
=====================================
--- a/t3-domain/src/test/resources/log4j.properties
+++ b/t3-domain/src/test/resources/log4j.properties
@@ -27,3 +27,4 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia.migration=INFO
\ No newline at end of file
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
@@ -130,15 +130,14 @@
<s:hidden key="userEditAction" label=""/>
<s:textfield key="user.login" label="%{getText('t3.common.login')}"
size="40" requiredLabel="true"/>
- <s:textfield key="user.password" label="%{getText('t3.common.password')}"
- size="40" requiredLabel="true"/>
+ <s:textfield key="user.password" label="%{getText('t3.common.password')}" size="40" requiredLabel="true"/>
+ <s:textfield name="checkPassword" value="" key="t3.common.checkPassword" size="40" requiredLabel="true"/>
<s:checkbox key="user.admin" label="%{getText('t3.common.admin')}"/>
</fieldset>
<br/>
<s:submit action="userForm!doCreate" key="t3.action.create" align="right"/>
<s:if test="userIsAdmin">
- <s:submit action="userList" key="t3.label.admin.backToUserList"
- align="right"/>
+ <s:submit action="userList" key="t3.label.admin.backToUserList" align="right"/>
</s:if>
</s:form>
</s:if>
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/53c09a9e30ff1c1e2c391b72310c416…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/53c09a9e30ff1c1e2c391b72310c416…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] 2 commits: improve configurations (for migration purpose)
by Tony CHEMIT 20 Feb '18
by Tony CHEMIT 20 Feb '18
20 Feb '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
d2fbcd9e by Tony CHEMIT at 2018-02-20T12:15:18+01:00
improve configurations (for migration purpose)
- - - - -
53c09a9e by Tony CHEMIT at 2018-02-20T12:15:43+01:00
fix migrations + add a test for migraiton
- - - - -
7 changed files:
- t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
- t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
- t3-domain/src/main/resources/t3-datadb.properties
- t3-domain/src/main/resources/t3-log4j.conf
- t3-domain/src/main/xmi/t3-persistence.properties
- + t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
- t3-domain/src/test/resources/log4j.properties
Changes:
=====================================
t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
=====================================
--- a/t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
+++ b/t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql
@@ -18,14 +18,14 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- #L%
---
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.1', 0, '2016-01-28 00:00:00', 1, 'Vrac pesé ou non (multispécifique) (sondage)', true);
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.2', 0, '2016-01-28 00:00:00', 2, 'Pesée (monospécifique) (pas de sondage)', true);
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.3', 0, '2016-01-28 00:00:00', 3, 'Espèce unité (monospécifique) (pas de sondage)', true);
-INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.4', 0, '2016-01-28 00:00:00', 4, 'Paquet non pesé (monospécifique) (pas de sondage)', true);
-
+-- Trick (we add 1000 to code, we will subtract them later)
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.1', 0, '2016-01-28 00:00:00', 1001, 'Vrac pesé ou non (multispécifique) (sondage)', true);
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.2', 0, '2016-01-28 00:00:00', 1002, 'Pesée (monospécifique) (pas de sondage)', true);
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.3', 0, '2016-01-28 00:00:00', 1003, 'Espèce unité (monospécifique) (pas de sondage)', true);
+INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.4', 0, '2016-01-28 00:00:00', 1004, 'Paquet non pesé (monospécifique) (pas de sondage)', true);
UPDATE Localmarketpackaging SET localmarketpackagingtype = replace(localmarketpackagingtype,'LocalMarketPackaging', 'LocalMarketPackagingType');
-
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.1';
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.2';
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.3';
DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.4';
+UPDATE LocalmarketpackagingType SET code = code -1000;
\ No newline at end of file
=====================================
t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
=====================================
--- a/t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
+++ b/t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql
@@ -51,7 +51,6 @@ ALTER TABLE zoneee RENAME COLUMN libelle TO label1;
ALTER TABLE zoneee RENAME COLUMN versionlibelle TO versionLabel;
ALTER TABLE zonefao RENAME COLUMN libelle TO label1;
ALTER TABLE zonefao RENAME COLUMN versionlibelle TO versionLabel;
-
ALTER TABLE country ADD COLUMN label2 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label2 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label2 VARCHAR(255);
@@ -78,7 +77,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label2 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label2 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label2 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label2 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label3 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label3 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label3 VARCHAR(255);
@@ -105,7 +103,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label3 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label3 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label3 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label3 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label4 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label4 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label4 VARCHAR(255);
@@ -132,7 +129,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label4 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label4 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label4 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label4 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label5 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label5 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label5 VARCHAR(255);
@@ -159,7 +155,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label5 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label5 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label5 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label5 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label6 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label6 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label6 VARCHAR(255);
@@ -186,7 +181,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label6 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label6 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label6 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label6 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label7 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label7 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label7 VARCHAR(255);
@@ -213,7 +207,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label7 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label7 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label7 VARCHAR(255);
ALTER TABLE zonefao ADD COLUMN label7 VARCHAR(255);
-
ALTER TABLE country ADD COLUMN label8 VARCHAR(255);
ALTER TABLE schoolType ADD COLUMN label8 VARCHAR(255);
ALTER TABLE fishingContext ADD COLUMN label8 VARCHAR(255);
@@ -239,4 +232,4 @@ ALTER TABLE localMarketPackaging ADD COLUMN label8 VARCHAR(255);
ALTER TABLE ElementaryCatchFate ADD COLUMN label8 VARCHAR(255);
ALTER TABLE zoneet ADD COLUMN label8 VARCHAR(255);
ALTER TABLE zoneee ADD COLUMN label8 VARCHAR(255);
-ALTER TABLE zonefao ADD COLUMN label8 VARCHAR(255);
+ALTER TABLE zonefao ADD COLUMN label8 VARCHAR(255);
\ No newline at end of file
=====================================
t3-domain/src/main/resources/t3-datadb.properties
=====================================
--- a/t3-domain/src/main/resources/t3-datadb.properties
+++ b/t3-domain/src/main/resources/t3-datadb.properties
@@ -37,4 +37,5 @@ hibernate.hikari.registerMbeans=true
topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback
topia.service.migration.showSql=true
+topia.service.migration.showProgression=true
=====================================
t3-domain/src/main/resources/t3-log4j.conf
=====================================
--- a/t3-domain/src/main/resources/t3-log4j.conf
+++ b/t3-domain/src/main/resources/t3-log4j.conf
@@ -20,6 +20,7 @@ log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (
log4j.logger.fr.ird.t3=INFO
log4j.logger.fr.ird.t3.services.ioc=WARN
log4j.logger.org.nuiton=WARN
+log4j.logger.org.nuiton.topia.migration=INFO
log4j.logger.org.hibernate.orm.deprecation=ERROR
log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
=====================================
t3-domain/src/main/xmi/t3-persistence.properties
=====================================
--- a/t3-domain/src/main/xmi/t3-persistence.properties
+++ b/t3-domain/src/main/xmi/t3-persistence.properties
@@ -22,7 +22,7 @@
model.tagValue.notGenerateToString=true
model.tagValue.generateOperatorForDAOHelper=true
model.tagValue.constantPrefix=PROPERTY_
-model.tagValue.version=2.0
+model.tagValue.version=3.0
model.tagValue.indexForeignKeys=true
fr.ird.t3.entities.data.Trip.attribute.activity.stereotype=ordered
=====================================
t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
=====================================
--- /dev/null
+++ b/t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
@@ -0,0 +1,55 @@
+package fr.ird.t3.services.migration;
+
+/*-
+ * #%L
+ * T3 :: Domain
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ird.t3.entities.T3TopiaApplicationContext;
+import fr.ird.t3.entities.user.JdbcConfiguration;
+import fr.ird.t3.entities.user.JdbcConfigurationHelper;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Created by tchemit on 20/02/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+@Ignore
+public class T3MigrationTest {
+
+ @Test
+ public void migratePostgres() {
+
+ String url = "jdbc:postgresql:t3";
+ String login = "t3-admin";
+ String password = "a";
+
+ JdbcConfiguration jdbcConfiguration = JdbcConfigurationHelper.newJdbcConfiguration();
+ jdbcConfiguration.setUrl(url);
+ jdbcConfiguration.setLogin(login);
+ jdbcConfiguration.setPassword(password);
+ try (T3TopiaApplicationContext rootContext = T3TopiaApplicationContext.newDb(jdbcConfiguration)) {
+ Assert.assertNotNull(rootContext);
+ }
+
+ }
+}
=====================================
t3-domain/src/test/resources/log4j.properties
=====================================
--- a/t3-domain/src/test/resources/log4j.properties
+++ b/t3-domain/src/test/resources/log4j.properties
@@ -27,3 +27,4 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia.migration=INFO
\ No newline at end of file
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/3688cd0e15bbbf8d26572e633037bec…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/3688cd0e15bbbf8d26572e633037bec…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] Améliorations dans la gestion des profils utilisateurs (Pour la création on…
by Tony CHEMIT 20 Feb '18
by Tony CHEMIT 20 Feb '18
20 Feb '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
3688cd0e by Tony CHEMIT at 2018-02-20T11:23:03+01:00
Améliorations dans la gestion des profils utilisateurs (Pour la création on deamdne aussi une confirmation du mot de passe)
- - - - -
1 changed file:
- t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
Changes:
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp
@@ -130,15 +130,14 @@
<s:hidden key="userEditAction" label=""/>
<s:textfield key="user.login" label="%{getText('t3.common.login')}"
size="40" requiredLabel="true"/>
- <s:textfield key="user.password" label="%{getText('t3.common.password')}"
- size="40" requiredLabel="true"/>
+ <s:textfield key="user.password" label="%{getText('t3.common.password')}" size="40" requiredLabel="true"/>
+ <s:textfield name="checkPassword" value="" key="t3.common.checkPassword" size="40" requiredLabel="true"/>
<s:checkbox key="user.admin" label="%{getText('t3.common.admin')}"/>
</fieldset>
<br/>
<s:submit action="userForm!doCreate" key="t3.action.create" align="right"/>
<s:if test="userIsAdmin">
- <s:submit action="userList" key="t3.label.admin.backToUserList"
- align="right"/>
+ <s:submit action="userList" key="t3.label.admin.backToUserList" align="right"/>
</s:if>
</s:form>
</s:if>
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/3688cd0e15bbbf8d26572e633037bec4…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/3688cd0e15bbbf8d26572e633037bec4…
You're receiving this email because of your account on gitlab.com.
1
0
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
a6239505 by Tony CHEMIT at 2018-02-20T11:15:55+01:00
use auto-service
- - - - -
30 changed files:
- t3-domain/pom.xml
- t3-domain/src/main/java/fr/ird/t3/entities/reference/zone/ZoneETMeta.java
- t3-domain/src/main/java/fr/ird/t3/services/ioc/InjectorDAO.java
- t3-domain/src/main/java/fr/ird/t3/services/ioc/InjectorDecoratedBeans.java
- t3-domain/src/main/java/fr/ird/t3/services/ioc/InjectorEntitiesById.java
- t3-domain/src/main/java/fr/ird/t3/services/ioc/InjectorEntityById.java
- t3-domain/src/main/java/fr/ird/t3/services/ioc/InjectorFromDAO.java
- t3-domain/src/main/java/fr/ird/t3/services/ioc/InjectorInternalDAO.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_0_1.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_1.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_2.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_3.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_3_1.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_3_2.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_4.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_5.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV1_6.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_0.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV3_0.java
- − t3-domain/src/main/resources/META-INF/services/fr.ird.t3.entities.reference.zone.ZoneStratumAwareMeta
- − t3-domain/src/main/resources/META-INF/services/fr.ird.t3.services.ioc.Injector
- − t3-domain/src/main/resources/META-INF/services/org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG$MigrationCallBackForVersion
- t3-input-avdthv33/pom.xml
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputProviderAvdth33.java
- − t3-input-avdthv33/src/main/resources/META-INF/services/fr.ird.t3.io.input.T3InputProvider
- t3-input-avdthv35/pom.xml
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputProviderAvdth35.java
- − t3-input-avdthv35/src/main/resources/META-INF/services/fr.ird.t3.io.input.T3InputProvider
- t3-input-avdthv36/pom.xml
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputProviderAvdth36.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/a6239505d1240451181a85e3b9db70bb…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/a6239505d1240451181a85e3b9db70bb…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] [WIN] Windows/Mauvais affichage des caractères accentués dans le navigateur (See #154)
by Tony CHEMIT 19 Feb '18
by Tony CHEMIT 19 Feb '18
19 Feb '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
021baffa by Tony CHEMIT at 2018-02-19T09:15:21+01:00
[WIN] Windows/Mauvais affichage des caractères accentués dans le navigateur (See #154)
- - - - -
1 changed file:
- t3-web/src/main/java/fr/ird/t3/web/validators/CheckJdbcConnectionValidator.java
Changes:
=====================================
t3-web/src/main/java/fr/ird/t3/web/validators/CheckJdbcConnectionValidator.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/validators/CheckJdbcConnectionValidator.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/validators/CheckJdbcConnectionValidator.java
@@ -24,6 +24,10 @@ import com.opensymphony.xwork2.validator.ValidationException;
import fr.ird.t3.entities.T3EntityHelper;
import fr.ird.t3.entities.user.JdbcConfiguration;
+import java.nio.charset.StandardCharsets;
+
+import static org.nuiton.i18n.I18n.t;
+
/**
* Check the incoming jdbc configuration connection.
*
@@ -38,20 +42,14 @@ public class CheckJdbcConnectionValidator extends T3BaseFieldValidatorSupport {
if (!getValidatorContext().hasFieldErrors()) {
String fieldName = getFieldName();
- JdbcConfiguration db =
- (JdbcConfiguration) getFieldValue(fieldName, object);
-
- // check jdbc connection
+ JdbcConfiguration db = (JdbcConfiguration) getFieldValue(fieldName, object);
try {
-
T3EntityHelper.checkJDBCConnection(db);
-
} catch (Exception e) {
// can not connect to database
- addFieldError(
- "database.url",
- _("t3.error.invalid.jdbc.connexion", e.getMessage()));
+ String errorMessage = new String(e.getMessage().getBytes(), StandardCharsets.UTF_8);
+ addFieldError("database.url", t("t3.error.invalid.jdbc.connexion", errorMessage));
}
}
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/021baffa81402dd53c69d2922104cb3f…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/021baffa81402dd53c69d2922104cb3f…
You're receiving this email because of your account on gitlab.com.
1
0
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
6ed5a91e by Tony CHEMIT at 2018-02-19T08:47:14+01:00
reformat code
- - - - -
879a47c3 by Tony CHEMIT at 2018-02-19T08:48:51+01:00
Probleme de calcul de rf1 (See #283)
- - - - -
1 changed file:
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
Changes:
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
@@ -158,7 +158,7 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
}
@Override
- protected boolean executeAction() throws Exception {
+ protected boolean executeAction() {
Set<Vessel> allVessel = tripsByVessel.keySet();
@@ -174,29 +174,24 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
log.debug("Treat vessel " + vessel.getLabel1());
}
- List<Trip> tripsForVessel =
- Lists.newArrayList(tripsByVessel.get(vessel));
+ List<Trip> tripsForVessel = Lists.newArrayList(tripsByVessel.get(vessel));
TripTopiaDao.sortTrips(tripsForVessel);
result |= doExecuteForVessel(vessel, tripsForVessel);
}
- addInfoMessage(l(locale, "t3.level0.computeRF1.totalCatchWeightRF1",
- totalCatchWeightRF1));
- addInfoMessage(l(locale, "t3.level0.computeRF1.totalLandingWeight",
- totalLandingWeight));
+ addInfoMessage(l(locale, "t3.level0.computeRF1.totalCatchWeightRF1", totalCatchWeightRF1));
+ addInfoMessage(l(locale, "t3.level0.computeRF1.totalLandingWeight", totalLandingWeight));
}
return result;
}
- protected boolean doExecuteForVessel(Vessel vessel,
- List<Trip> tripList) throws Exception {
+ protected boolean doExecuteForVessel(Vessel vessel, List<Trip> tripList) {
incrementsProgression();
String vesselStr = decorate(vessel);
- addInfoMessage(l(locale, "t3.level0.computeRF1.treat.vessel",
- vesselStr));
+ addInfoMessage(l(locale, "t3.level0.computeRF1.treat.vessel", vesselStr));
if (CollectionUtils.isEmpty(tripList)) {
@@ -205,8 +200,7 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
return false;
}
- addInfoMessage(l(locale, "t3.level0.computeRF1.trips.to.use.for.vessel",
- tripList.size(), vesselStr));
+ addInfoMessage(l(locale, "t3.level0.computeRF1.trips.to.use.for.vessel", tripList.size(), vesselStr));
// get country of the vessel (always use the fleet country)
Country country = vessel.getFleetCountry();
@@ -228,13 +222,12 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
// there is some species to use for rf1 computation
StringBuilder sb = new StringBuilder();
- for (Species specy : species) {
- sb.append(", ").append(decorate(specy));
+ for (Species aSpecies : species) {
+ sb.append(", ").append(decorate(aSpecies));
}
String message = l(locale, "t3.level0.computeRF1.species.to.use",
- species.size(), sb.substring(2)
- );
+ species.size(), sb.substring(2));
if (log.isInfoEnabled()) {
log.info(message);
}
@@ -247,20 +240,15 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
// split trips by complete trips
List<CompleteTrip> completeTrips = tripDAO.toCompleteTrip(tripList);
- addInfoMessage(
- l(locale, "t3.level0.computeRF1.complete.trips.to.use.for.vessel",
- completeTrips.size(), vesselStr));
+ addInfoMessage(l(locale, "t3.level0.computeRF1.complete.trips.to.use.for.vessel",
+ completeTrips.size(), vesselStr));
nbCompleteTrips += completeTrips.size();
for (CompleteTrip completeTrip : completeTrips) {
// consume the completeTrip
- treatCompleteTrip(completeTrip,
- species,
- minimumRate,
- maximumRate
- );
+ treatCompleteTrip(completeTrip, species, minimumRate, maximumRate);
// complete trip was consumed
completeTrip.removeTrips(tripList);
@@ -288,10 +276,7 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
return true;
}
- private void treatCompleteTrip(CompleteTrip completeTrip,
- Collection<Species> species,
- float minimumRate,
- float maximumRate) {
+ private void treatCompleteTrip(CompleteTrip completeTrip, Collection<Species> species, float minimumRate, float maximumRate) {
int completionStatus;
@@ -306,9 +291,9 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
}
applyCompletionStatus(completeTrip, completionStatus);
- boolean allwithLogBook = TripTopiaDao.isTripsAllWithLogBook(completeTrip);
+ boolean allWithLogBook = TripTopiaDao.isTripsAllWithLogBook(completeTrip);
- if (!allwithLogBook) {
+ if (!allWithLogBook) {
// there is some trips with no log book
// reject all the complete trip
@@ -350,8 +335,7 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
completeTrip.getDepartureTrip().getVesselLabel(),
DecoratorService.formatDate(completeTrip.getDepartureTrip().getDepartureDate()),
DecoratorService.formatDate(completeTrip.getLandingTrip().getLandingDate()),
- rf1,
- minimumRate);
+ rf1, minimumRate);
addWarningMessage(warnMessage);
nbCompleteAcceptedTripsWithBadRF1++;
}
@@ -363,8 +347,7 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
completeTrip.getDepartureTrip().getVesselLabel(),
DecoratorService.formatDate(completeTrip.getDepartureTrip().getDepartureDate()),
DecoratorService.formatDate(completeTrip.getLandingTrip().getLandingDate()),
- rf1,
- maximumRate);
+ rf1, maximumRate);
addWarningMessage(warnMessage);
nbCompleteAcceptedTripsWithBadRF1++;
}
@@ -377,18 +360,13 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
}
}
- private void applyCompletionStatus(Iterable<Trip> trips,
- int completionStatus) {
-
+ private void applyCompletionStatus(Iterable<Trip> trips, int completionStatus) {
for (Trip trip : trips) {
-
trip.setCompletionStatus(completionStatus);
}
}
- private void applyRF1(Float rf1,
- CompleteTrip trips,
- Collection<Species> species) {
+ private void applyRF1(Float rf1, CompleteTrip trips, Collection<Species> species) {
for (Trip trip : trips) {
@@ -400,42 +378,30 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
// means can not apply any rf1 : rf1 must stay at null...
rf1ToUse = null;
- addWarningMessage(
- l(locale, "t3.level0.computeRF1.warning.no.logbook",
- tripStr)
- );
+ addWarningMessage(l(locale, "t3.level0.computeRF1.warning.no.logbook", tripStr));
}
trip.applyRf1(rf1ToUse, species);
markTripAsTreated(trip);
- addInfoMessage(
- l(locale, "t3.level0.computeRF1.resume.rf1.for.trip",
- tripStr, rf1ToUse)
- );
+ addInfoMessage(l(locale, "t3.level0.computeRF1.resume.rf1.for.trip", tripStr, rf1ToUse));
}
}
- protected void updateTotalWeights(CompleteTrip completeTrip,
- Collection<Species> species) {
+ protected void updateTotalWeights(CompleteTrip completeTrip, Collection<Species> species) {
- float tripTotalCatchWeightRf1 =
- completeTrip.getElementaryCatchTotalWeightRf1(species);
+ float tripTotalCatchWeightRf1 = completeTrip.getElementaryCatchTotalWeightRf1(species);
totalCatchWeightRF1 += tripTotalCatchWeightRf1;
- float tripTotalLandingWeight =
- completeTrip.getElementaryLandingTotalWeight(species);
+ float tripTotalLandingWeight = completeTrip.getElementaryLandingTotalWeight(species);
totalLandingWeight += tripTotalLandingWeight;
if (log.isInfoEnabled()) {
-
- log.info("After trip " + decorate(completeTrip.getLandingTrip()) +
- " tripTotalCatchWeightRf1 = " + tripTotalCatchWeightRf1 +
- " tripTotalLandingWeight = " + tripTotalLandingWeight);
+ log.info(String.format("After trip %s tripTotalCatchWeightRf1 = %s tripTotalLandingWeight = %s",
+ decorate(completeTrip.getLandingTrip()), tripTotalCatchWeightRf1, tripTotalLandingWeight));
}
if (log.isDebugEnabled()) {
- log.debug("After trip " + decorate(completeTrip.getLandingTrip()) +
- " totalCatchWeightRF1 = " + totalCatchWeightRF1 +
- " totalLandingWeight = " + totalLandingWeight);
+ log.debug(String.format("After trip %s totalCatchWeightRF1 = %s totalLandingWeight = %s",
+ decorate(completeTrip.getLandingTrip()), totalCatchWeightRF1, totalLandingWeight));
}
// for (Trip trip : completeTrip) {
//
@@ -461,8 +427,7 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
// }
}
- protected float computeRF1ForCompleteTrip(Iterable<Trip> completeTrip,
- Collection<Species> speciesList) {
+ protected float computeRF1ForCompleteTrip(Iterable<Trip> completeTrip, Collection<Species> speciesList) {
// do the computation of rf1 for all trips of the complete trip
float sumLanding = 0;
@@ -477,10 +442,8 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
log.debug("Start count for trip " + tripStr);
}
- float elementaryLandingTotalWeight =
- trip.getElementaryLandingTotalWeight(speciesList);
- float elementaryCatchTotalWeight =
- trip.getElementaryCatchTotalWeight(speciesList);
+ float elementaryLandingTotalWeight = trip.getElementaryLandingTotalWeight(speciesList);
+ float elementaryCatchTotalWeight = trip.getElementaryCatchTotalWeight(speciesList);
if (elementaryCatchTotalWeight == 0 &&
elementaryLandingTotalWeight > 0) {
@@ -488,24 +451,19 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
// Add a warning, seems not possible to have no catches and landing :
// the logBookAvaibility flag should be setted to 0.
- addWarningMessage(
- l(locale, "t3.level0.computeRF1.warning.no.catches.but.some.landings",
- tripStr, elementaryLandingTotalWeight)
- );
+ addWarningMessage(l(locale, "t3.level0.computeRF1.warning.no.catches.but.some.landings",
+ tripStr, elementaryLandingTotalWeight));
}
if (elementaryCatchTotalWeight > 0 && elementaryLandingTotalWeight == 0) {
// Special case : no landing
-
// do not take account of the catch weight
- elementaryCatchTotalWeight = 0;
+ // in fact (see https://gitlab.com/ultreiaio/ird-t3/issues/283) we do not want to loose this catches
+ //elementaryCatchTotalWeight = 0;
- addWarningMessage(
- l(locale, "t3.level0.computeRF1.warning.no.landings.but.some.catches",
- tripStr,
- elementaryLandingTotalWeight)
- );
+ addWarningMessage(l(locale, "t3.level0.computeRF1.warning.no.landings.but.some.catches",
+ tripStr, elementaryLandingTotalWeight));
}
float localMarketTotalWeight = trip.getFalseFishesWeight();
@@ -536,10 +494,8 @@ public class ComputeRF1Action extends AbstractLevel0Action<ComputeRF1Configurati
log.debug("Computed rf1 " + rf1);
}
- addInfoMessage(
- l(locale, "t3.level0.computeRF1.resume.for.complete.trip",
+ addInfoMessage(l(locale, "t3.level0.computeRF1.resume.for.complete.trip",
sumCatch, sumLanding, sumLocalMarket, sumLocalMarketDetailled, rf1));
-
return rf1;
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/334460dbc1efdd9b7d84b493eeeced1…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/334460dbc1efdd9b7d84b493eeeced1…
You're receiving this email because of your account on gitlab.com.
1
0