Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
-
b1ffee7e
by Tony CHEMIT at 2018-02-21T14:06:48+01:00
-
89e03ab7
by Tony CHEMIT at 2018-02-21T15:48:15+01:00
-
5ce68d04
by Tony CHEMIT at 2018-02-21T15:50:10+01:00
16 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/Level2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level3/Level3Action.java
- t3-domain/src/main/java/fr/ird/t3/actions/stratum/LevelConfigurationWithStratum.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractCountryTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractVesselTopiaDao.java
- t3-web/src/main/java/fr/ird/t3/web/actions/T3ActionSupport.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level2/ConfigureLevel2Step1Action.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level2/Level2ConfigureAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level2/Level2RunAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level3/ConfigureLevel3Step1Action.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level3/Level3ConfigureAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/data/level3/Level3RunAction.java
- t3-web/src/main/webapp/WEB-INF/jsp/admin/tripList.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/data/level2/level2ConfigurationStep1.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/data/level3/level3ConfigurationStep1.jsp
Changes:
| ... | ... | @@ -52,7 +52,6 @@ import fr.ird.t3.services.DecoratorService; |
| 52 | 52 |
import fr.ird.t3.services.ZoneStratumService;
|
| 53 | 53 |
import fr.ird.t3.services.ioc.InjectDAO;
|
| 54 | 54 |
import fr.ird.t3.services.ioc.InjectEntitiesById;
|
| 55 |
-import fr.ird.t3.services.ioc.InjectEntityById;
|
|
| 56 | 55 |
import fr.ird.t3.services.ioc.InjectFromDAO;
|
| 57 | 56 |
import org.apache.commons.io.IOUtils;
|
| 58 | 57 |
import org.apache.commons.logging.Log;
|
| ... | ... | @@ -83,8 +82,7 @@ import static org.nuiton.i18n.I18n.l; |
| 83 | 82 |
*/
|
| 84 | 83 |
public class Level2Action extends T3Action<Level2Configuration> {
|
| 85 | 84 |
|
| 86 |
- public static final String PARAM_LEVEL_CONFIGURATION = "levelConfiguration";
|
|
| 87 |
- /** Logger. */
|
|
| 85 |
+ // public static final String PARAM_LEVEL_CONFIGURATION = "levelConfiguration";
|
|
| 88 | 86 |
private static final Log log = LogFactory.getLog(Level2Action.class);
|
| 89 | 87 |
/**
|
| 90 | 88 |
* Cache of activity (to avoid to reload them for catch and sample stratum).
|
| ... | ... | @@ -93,6 +91,28 @@ public class Level2Action extends T3Action<Level2Configuration> { |
| 93 | 91 |
*/
|
| 94 | 92 |
private final LoadingCache<String, Activity> activityCache;
|
| 95 | 93 |
private final Map<String, OceanContext> oceanContext;
|
| 94 |
+ /**
|
|
| 95 |
+ * Input Weight composition
|
|
| 96 |
+ * (based on {@link CorrectedElementaryCatch#getCatchWeight()}) for all
|
|
| 97 |
+ * species found in catches.
|
|
| 98 |
+ *
|
|
| 99 |
+ * @since 1.3
|
|
| 100 |
+ */
|
|
| 101 |
+ WeightCompositionAggregateModel inputCatchModelForAllSpecies;
|
|
| 102 |
+ /**
|
|
| 103 |
+ * Output Weight composition
|
|
| 104 |
+ * (based on {@link CorrectedElementaryCatch#getCorrectedCatchWeight()}) for all
|
|
| 105 |
+ * species found in catches.
|
|
| 106 |
+ *
|
|
| 107 |
+ * @since 1.3
|
|
| 108 |
+ */
|
|
| 109 |
+ WeightCompositionAggregateModel outputCatchModelForAllSpecies;
|
|
| 110 |
+ /**
|
|
| 111 |
+ * For each stratum gets his result.
|
|
| 112 |
+ *
|
|
| 113 |
+ * @since 1.3
|
|
| 114 |
+ */
|
|
| 115 |
+ Collection<L2StratumResult> stratumsResult;
|
|
| 96 | 116 |
@InjectDAO(entityType = Activity.class)
|
| 97 | 117 |
private ActivityTopiaDao activityDAO;
|
| 98 | 118 |
@InjectDAO(entityType = WeightCategoryTreatment.class)
|
| ... | ... | @@ -105,8 +125,8 @@ public class Level2Action extends T3Action<Level2Configuration> { |
| 105 | 125 |
private ZoneVersion zoneVersion;
|
| 106 | 126 |
@InjectFromDAO(entityType = SchoolType.class, method = "findAllForStratum")
|
| 107 | 127 |
private Set<SchoolType> schoolTypes;
|
| 108 |
- @InjectEntityById(entityType = Country.class)
|
|
| 109 |
- private Country catchFleet;
|
|
| 128 |
+ @InjectEntitiesById(entityType = Country.class)
|
|
| 129 |
+ private Set<Country> catchFleets;
|
|
| 110 | 130 |
@InjectEntitiesById(entityType = Ocean.class)
|
| 111 | 131 |
private Set<Ocean> oceans;
|
| 112 | 132 |
@InjectEntitiesById(entityType = Species.class, path = "configuration.speciesIds")
|
| ... | ... | @@ -116,8 +136,6 @@ public class Level2Action extends T3Action<Level2Configuration> { |
| 116 | 136 |
@InjectEntitiesById(entityType = Country.class)
|
| 117 | 137 |
private Collection<Country> sampleFlags;
|
| 118 | 138 |
private Set<T3Date> startDates;
|
| 119 |
- // private Multimap<SchoolType, WeightCategoryTreatment> weightCategoriesBySchoolType;
|
|
| 120 |
-// private Multimap<SchoolType, ZoneStratumAware> zoneBySchoolType;
|
|
| 121 | 139 |
private Set<Vessel> possibleCatchVessels;
|
| 122 | 140 |
private Set<Vessel> possibleSampleVessels;
|
| 123 | 141 |
private int nbStratums;
|
| ... | ... | @@ -125,28 +143,6 @@ public class Level2Action extends T3Action<Level2Configuration> { |
| 125 | 143 |
private long totalCatchWeight;
|
| 126 | 144 |
private long totalCatchActivities;
|
| 127 | 145 |
private long totalCatchActivitiesWithSample;
|
| 128 |
- /**
|
|
| 129 |
- * Input Weight composition
|
|
| 130 |
- * (based on {@link CorrectedElementaryCatch#getCatchWeight()}) for all
|
|
| 131 |
- * species found in catches.
|
|
| 132 |
- *
|
|
| 133 |
- * @since 1.3
|
|
| 134 |
- */
|
|
| 135 |
- WeightCompositionAggregateModel inputCatchModelForAllSpecies;
|
|
| 136 |
- /**
|
|
| 137 |
- * Output Weight composition
|
|
| 138 |
- * (based on {@link CorrectedElementaryCatch#getCorrectedCatchWeight()}) for all
|
|
| 139 |
- * species found in catches.
|
|
| 140 |
- *
|
|
| 141 |
- * @since 1.3
|
|
| 142 |
- */
|
|
| 143 |
- WeightCompositionAggregateModel outputCatchModelForAllSpecies;
|
|
| 144 |
- /**
|
|
| 145 |
- * For each stratum gets his result.
|
|
| 146 |
- *
|
|
| 147 |
- * @since 1.3
|
|
| 148 |
- */
|
|
| 149 |
- Collection<L2StratumResult> stratumsResult;
|
|
| 150 | 146 |
|
| 151 | 147 |
public Level2Action() {
|
| 152 | 148 |
activityCache = CacheBuilder.newBuilder().build(
|
| ... | ... | @@ -189,7 +185,7 @@ public class Level2Action extends T3Action<Level2Configuration> { |
| 189 | 185 |
setStartDates(T3Date.getStartDates(configuration.getBeginDate(), configuration.getEndDate(), configuration.getTimeStep()));
|
| 190 | 186 |
|
| 191 | 187 |
// get possible vessels for catch stratum
|
| 192 |
- setPossibleCatchVessels(vesselDAO.getPossibleCatchVessels(catchFleet));
|
|
| 188 |
+ setPossibleCatchVessels(vesselDAO.getPossibleCatchVessels(catchFleets));
|
|
| 193 | 189 |
|
| 194 | 190 |
// get possible vessels for sample stratum
|
| 195 | 191 |
setPossibleSampleVessels(vesselDAO.getPossibleSampleVessels(sampleFleets, sampleFlags));
|
| ... | ... | @@ -102,13 +102,12 @@ import static org.nuiton.i18n.I18n.n; |
| 102 | 102 |
*/
|
| 103 | 103 |
public class Level3Action extends T3Action<Level3Configuration> {
|
| 104 | 104 |
|
| 105 |
- public static final String BEFORE_LEVEL3 = n("t3.level3.nbFishesBeforeLevel3");
|
|
| 106 |
- public static final String AFTER_LEVEL3 = n("t3.level3.nbFishesAfterLevel3");
|
|
| 107 |
- public static final String INSERT_QUERY =
|
|
| 105 |
+ private static final String BEFORE_LEVEL3 = n("t3.level3.nbFishesBeforeLevel3");
|
|
| 106 |
+ private static final String AFTER_LEVEL3 = n("t3.level3.nbFishesAfterLevel3");
|
|
| 107 |
+ private static final String INSERT_QUERY =
|
|
| 108 | 108 |
"INSERT INTO ExtrapolatedAllSetSpeciesFrequency(TOPIAID, TOPIAVERSION, TOPIACREATEDATE, ACTIVITY, SPECIES, LFLENGTHCLASS, NUMBER) VALUES ('%s', 0, TIMESTAMP '%s 00:00:00.0', '%s','%s', %s, %s);\n";
|
| 109 |
- public static final String UPDATE_QUERY =
|
|
| 109 |
+ private static final String UPDATE_QUERY =
|
|
| 110 | 110 |
"UPDATE ExtrapolatedAllSetSpeciesFrequency SET NUMBER = NUMBER + %s WHERE TOPIAID = '%s';\n";
|
| 111 |
- /** Logger. */
|
|
| 112 | 111 |
private static final Log log = LogFactory.getLog(Level3Action.class);
|
| 113 | 112 |
/**
|
| 114 | 113 |
* Cache of activity (to avoid to reload them for catch and smaple stratum).
|
| ... | ... | @@ -117,7 +116,25 @@ public class Level3Action extends T3Action<Level3Configuration> { |
| 117 | 116 |
*/
|
| 118 | 117 |
private final LoadingCache<String, Activity> activityCache;
|
| 119 | 118 |
private final Map<String, OceanContext> oceanContext;
|
| 120 |
- Map<String, Map<String, String>> activityWithMultiZones = new TreeMap<>();
|
|
| 119 |
+ /**
|
|
| 120 |
+ * Global total fishes count for all stratums.
|
|
| 121 |
+ * <p/>
|
|
| 122 |
+ * We store two count here :
|
|
| 123 |
+ * <ul>
|
|
| 124 |
+ * <li>{@link #BEFORE_LEVEL3} : total fishes count before level 3</li>
|
|
| 125 |
+ * <li>{@link #AFTER_LEVEL3} : total fishes count after level 3</li>
|
|
| 126 |
+ * </ul>
|
|
| 127 |
+ *
|
|
| 128 |
+ * @since 1.3.1
|
|
| 129 |
+ */
|
|
| 130 |
+ SpeciesCountAggregateModel totalFishesCount;
|
|
| 131 |
+ /**
|
|
| 132 |
+ * For each stratum gets his result.
|
|
| 133 |
+ *
|
|
| 134 |
+ * @since 1.3.1
|
|
| 135 |
+ */
|
|
| 136 |
+ Collection<L3StratumResult> stratumsResult;
|
|
| 137 |
+ private Map<String, Map<String, String>> activityWithMultiZones;
|
|
| 121 | 138 |
@InjectDAO(entityType = Activity.class)
|
| 122 | 139 |
private ActivityTopiaDao activityDAO;
|
| 123 | 140 |
@InjectDAO(entityType = LengthWeightConversion.class)
|
| ... | ... | @@ -136,12 +153,10 @@ public class Level3Action extends T3Action<Level3Configuration> { |
| 136 | 153 |
private ZoneVersion zoneVersion;
|
| 137 | 154 |
@InjectFromDAO(entityType = SchoolType.class, method = "findAllForStratum")
|
| 138 | 155 |
private Set<SchoolType> schoolTypes;
|
| 139 |
- // private Multimap<SchoolType, ZoneStratumAware> zoneBySchoolType;
|
|
| 140 | 156 |
@InjectEntityById(entityType = Ocean.class)
|
| 141 | 157 |
private Ocean ocean;
|
| 142 |
- @InjectEntityById(entityType = Country.class)
|
|
| 143 |
- private Country catchFleet;
|
|
| 144 |
- // private Multimap<SchoolType, WeightCategoryTreatment> weightCategoriesBySchoolType;
|
|
| 158 |
+ @InjectEntitiesById(entityType = Country.class)
|
|
| 159 |
+ private Set<Country> catchFleets;
|
|
| 145 | 160 |
@InjectEntitiesById(entityType = Species.class, path = "configuration.speciesIds")
|
| 146 | 161 |
private Collection<Species> species;
|
| 147 | 162 |
@InjectEntitiesById(entityType = Country.class)
|
| ... | ... | @@ -153,30 +168,11 @@ public class Level3Action extends T3Action<Level3Configuration> { |
| 153 | 168 |
private Set<T3Date> startDates;
|
| 154 | 169 |
private Set<Vessel> possibleCatchVessels;
|
| 155 | 170 |
private Set<Vessel> possibleSampleVessels;
|
| 156 |
- // private LengthWeightConversionHelper conversionHelper;
|
|
| 157 | 171 |
private Map<SchoolType, Map<String, Integer>> stratumMinimumSampleCountBySchoolType;
|
| 158 | 172 |
private int nbStratums;
|
| 159 | 173 |
private long nbCatchActivities;
|
| 160 | 174 |
private long nbCatchActivitiesWithSample;
|
| 161 | 175 |
/**
|
| 162 |
- * Global total fishes count for all stratums.
|
|
| 163 |
- * <p/>
|
|
| 164 |
- * We store two count here :
|
|
| 165 |
- * <ul>
|
|
| 166 |
- * <li>{@link #BEFORE_LEVEL3} : total fishes count before level 3</li>
|
|
| 167 |
- * <li>{@link #AFTER_LEVEL3} : total fishes count after level 3</li>
|
|
| 168 |
- * </ul>
|
|
| 169 |
- *
|
|
| 170 |
- * @since 1.3.1
|
|
| 171 |
- */
|
|
| 172 |
- SpeciesCountAggregateModel totalFishesCount;
|
|
| 173 |
- /**
|
|
| 174 |
- * For each stratum gets his result.
|
|
| 175 |
- *
|
|
| 176 |
- * @since 1.3.1
|
|
| 177 |
- */
|
|
| 178 |
- Collection<L3StratumResult> stratumsResult;
|
|
| 179 |
- /**
|
|
| 180 | 176 |
* Predicate to filter only species selected in configuration.
|
| 181 | 177 |
*
|
| 182 | 178 |
* @since 1.4
|
| ... | ... | @@ -196,6 +192,7 @@ public class Level3Action extends T3Action<Level3Configuration> { |
| 196 | 192 |
}
|
| 197 | 193 |
);
|
| 198 | 194 |
oceanContext = new TreeMap<>();
|
| 195 |
+ activityWithMultiZones = new TreeMap<>();
|
|
| 199 | 196 |
}
|
| 200 | 197 |
|
| 201 | 198 |
@Override
|
| ... | ... | @@ -249,7 +246,7 @@ public class Level3Action extends T3Action<Level3Configuration> { |
| 249 | 246 |
}
|
| 250 | 247 |
|
| 251 | 248 |
// get possible vessels for catch stratum
|
| 252 |
- setPossibleCatchVessels(vesselDAO.getPossibleCatchVessels(catchFleet));
|
|
| 249 |
+ setPossibleCatchVessels(vesselDAO.getPossibleCatchVessels(catchFleets));
|
|
| 253 | 250 |
|
| 254 | 251 |
// get possible vessels for sample stratum
|
| 255 | 252 |
setPossibleSampleVessels(vesselDAO.getPossibleSampleVessels(sampleFleets, sampleFlags));
|
| ... | ... | @@ -51,8 +51,8 @@ public abstract class LevelConfigurationWithStratum implements T3ActionConfigura |
| 51 | 51 |
/** Id of selected version of ZoneImpl. */
|
| 52 | 52 |
private String zoneVersionId;
|
| 53 | 53 |
|
| 54 |
- /** Selected fleet id (for catch filtering). */
|
|
| 55 |
- private String catchFleetId;
|
|
| 54 |
+ /** Selected fleet ids (for catch filtering). */
|
|
| 55 |
+ private Set<String> catchFleetIds;
|
|
| 56 | 56 |
|
| 57 | 57 |
/** Number of months to define a stratus. */
|
| 58 | 58 |
private int timeStep;
|
| ... | ... | @@ -172,12 +172,12 @@ public abstract class LevelConfigurationWithStratum implements T3ActionConfigura |
| 172 | 172 |
this.endDate = endDate;
|
| 173 | 173 |
}
|
| 174 | 174 |
|
| 175 |
- public String getCatchFleetId() {
|
|
| 176 |
- return catchFleetId;
|
|
| 175 |
+ public Set<String> getCatchFleetIds() {
|
|
| 176 |
+ return catchFleetIds == null ? catchFleetIds = new LinkedHashSet<>() : catchFleetIds;
|
|
| 177 | 177 |
}
|
| 178 | 178 |
|
| 179 |
- public void setCatchFleetId(String catchFleetId) {
|
|
| 180 |
- this.catchFleetId = catchFleetId;
|
|
| 179 |
+ public void setCatchFleetIds(Set<String> catchFleetIds) {
|
|
| 180 |
+ this.catchFleetIds = catchFleetIds;
|
|
| 181 | 181 |
}
|
| 182 | 182 |
|
| 183 | 183 |
public Set<String> getSampleFleetIds() {
|
| ... | ... | @@ -143,6 +143,9 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao< |
| 143 | 143 |
}
|
| 144 | 144 |
|
| 145 | 145 |
public static final Ocean EMPTY_OCEAN = new OceanImpl();
|
| 146 |
+ static {
|
|
| 147 |
+ EMPTY_OCEAN.setTopiaId("fr.ird.t3.entities.reference.Ocean#EMPTY#EMPTY");
|
|
| 148 |
+ }
|
|
| 146 | 149 |
|
| 147 | 150 |
public Multimap<Ocean, String> findAllIdsByOcean() throws TopiaException {
|
| 148 | 151 |
|
| ... | ... | @@ -60,6 +60,11 @@ public class AbstractCountryTopiaDao<E extends Country> extends GeneratedCountry |
| 60 | 60 |
// return T3EntityHelper.querytoSet(hql, this);
|
| 61 | 61 |
}
|
| 62 | 62 |
|
| 63 |
+ public Set<E> findAllFleetUsedInTrip() throws TopiaException {
|
|
| 64 |
+ return findAllFleetUsedInTrip(null);
|
|
| 65 |
+ }
|
|
| 66 |
+ |
|
| 67 |
+ |
|
| 63 | 68 |
/**
|
| 64 | 69 |
* Obtains all countries used as flag for any trip in the database.
|
| 65 | 70 |
*
|
| ... | ... | @@ -28,12 +28,12 @@ import com.google.common.collect.Sets; |
| 28 | 28 |
import fr.ird.t3.entities.T3Functions;
|
| 29 | 29 |
import fr.ird.t3.entities.T3Predicates;
|
| 30 | 30 |
import fr.ird.t3.entities.data.Trip;
|
| 31 |
-import java.util.Arrays;
|
|
| 31 |
+import org.nuiton.topia.persistence.TopiaException;
|
|
| 32 |
+ |
|
| 32 | 33 |
import java.util.Collection;
|
| 33 | 34 |
import java.util.HashSet;
|
| 34 | 35 |
import java.util.List;
|
| 35 | 36 |
import java.util.Set;
|
| 36 |
-import org.nuiton.topia.persistence.TopiaException;
|
|
| 37 | 37 |
|
| 38 | 38 |
/**
|
| 39 | 39 |
* {@link Vessel} user dao operations.
|
| ... | ... | @@ -62,8 +62,7 @@ public class AbstractVesselTopiaDao<E extends Vessel> extends GeneratedVesselTop |
| 62 | 62 |
}
|
| 63 | 63 |
|
| 64 | 64 |
/**
|
| 65 |
- * Obtain the set of possible vessels usable from the configuration to
|
|
| 66 |
- * obtain catches of the catch stratum.
|
|
| 65 |
+ * Obtain the set of possible vessels usable from the configuration to obtain catches of the catch stratum.
|
|
| 67 | 66 |
* <p/>
|
| 68 | 67 |
* Vessels must verifiy two conditions :
|
| 69 | 68 |
* <ul>
|
| ... | ... | @@ -71,23 +70,19 @@ public class AbstractVesselTopiaDao<E extends Vessel> extends GeneratedVesselTop |
| 71 | 70 |
* <li>Be in the selected fleet (from the configuration)</li>
|
| 72 | 71 |
* </ul>
|
| 73 | 72 |
*
|
| 74 |
- * @param country level 2 configuration
|
|
| 75 |
- * @return set of possible vessels usable for activity (so trips) of the
|
|
| 76 |
- * catch stratum
|
|
| 73 |
+ * @param countries selected countries
|
|
| 74 |
+ * @return set of possible vessels usable for activity (so trips) of the catch stratum
|
|
| 77 | 75 |
* @throws TopiaException if any problem while loading data
|
| 78 | 76 |
*/
|
| 79 |
- public Set<E> getPossibleCatchVessels(Country country) throws TopiaException {
|
|
| 77 |
+ public Set<E> getPossibleCatchVessels(Collection<Country> countries) throws TopiaException {
|
|
| 80 | 78 |
|
| 81 | 79 |
List<E> vessels = forProperties(
|
| 82 | 80 |
Vessel.PROPERTY_VESSEL_TYPE + "." +
|
| 83 | 81 |
VesselType.PROPERTY_VESSEL_SIMPLE_TYPE + "." +
|
| 84 | 82 |
VesselSimpleType.PROPERTY_CODE, 1).findAll();
|
| 85 | 83 |
|
| 86 |
- Predicate<Vessel> predicate =
|
|
| 87 |
- T3Predicates.vesselUsingFleetCountry(Arrays.asList(country));
|
|
| 88 |
- |
|
| 89 |
- return Sets.newHashSet(
|
|
| 90 |
- Collections2.filter(vessels, predicate));
|
|
| 84 |
+ Predicate<Vessel> predicate = T3Predicates.vesselUsingFleetCountry(countries);
|
|
| 85 |
+ return Sets.newHashSet(Collections2.filter(vessels, predicate));
|
|
| 91 | 86 |
}
|
| 92 | 87 |
|
| 93 | 88 |
/**
|
| ... | ... | @@ -51,24 +51,26 @@ import fr.ird.t3.web.T3InternalTransactionFilter; |
| 51 | 51 |
import fr.ird.t3.web.T3Session;
|
| 52 | 52 |
import fr.ird.t3.web.T3UserTransactionFilter;
|
| 53 | 53 |
import fr.ird.t3.web.actions.admin.TripListModel;
|
| 54 |
+import org.apache.commons.logging.Log;
|
|
| 55 |
+import org.apache.commons.logging.LogFactory;
|
|
| 56 |
+import org.apache.struts2.StrutsStatics;
|
|
| 57 |
+import org.nuiton.decorator.Decorator;
|
|
| 58 |
+import org.nuiton.topia.persistence.TopiaEntity;
|
|
| 59 |
+import org.nuiton.topia.persistence.TopiaException;
|
|
| 60 |
+import org.nuiton.util.TimeLog;
|
|
| 61 |
+ |
|
| 62 |
+import javax.servlet.http.HttpServletRequest;
|
|
| 54 | 63 |
import java.io.File;
|
| 55 | 64 |
import java.io.FileWriter;
|
| 56 | 65 |
import java.io.IOException;
|
| 57 | 66 |
import java.text.SimpleDateFormat;
|
| 67 |
+import java.util.ArrayList;
|
|
| 58 | 68 |
import java.util.Arrays;
|
| 59 | 69 |
import java.util.Collection;
|
| 60 | 70 |
import java.util.Date;
|
| 61 | 71 |
import java.util.List;
|
| 62 | 72 |
import java.util.Map;
|
| 63 | 73 |
import java.util.function.Supplier;
|
| 64 |
-import javax.servlet.http.HttpServletRequest;
|
|
| 65 |
-import org.apache.commons.logging.Log;
|
|
| 66 |
-import org.apache.commons.logging.LogFactory;
|
|
| 67 |
-import org.apache.struts2.StrutsStatics;
|
|
| 68 |
-import org.nuiton.decorator.Decorator;
|
|
| 69 |
-import org.nuiton.topia.persistence.TopiaEntity;
|
|
| 70 |
-import org.nuiton.topia.persistence.TopiaException;
|
|
| 71 |
-import org.nuiton.util.TimeLog;
|
|
| 72 | 74 |
|
| 73 | 75 |
|
| 74 | 76 |
|
| ... | ... | @@ -353,29 +355,26 @@ public class T3ActionSupport extends ActionSupport implements T3TopiaPersistence |
| 353 | 355 |
result.setTripIdsByOcean(allByOcean);
|
| 354 | 356 |
getT3Session().setTripListModel(result);
|
| 355 | 357 |
|
| 356 |
- List<Ocean> allOceans = Lists.newArrayList(allByOcean.keySet());
|
|
| 358 |
+ List<Ocean> allOceans = new ArrayList<>(allByOcean.keySet());
|
|
| 357 | 359 |
|
| 358 |
- if (allOceans.contains(null)) {
|
|
| 360 |
+ if (allOceans.contains(TripTopiaDao.EMPTY_OCEAN)) {
|
|
| 359 | 361 |
|
| 360 | 362 |
// there is some trips with no oceans
|
| 361 | 363 |
Ocean nullOcean = new OceanImpl();
|
| 362 | 364 |
nullOcean.setLabel1(t("t3.common.nullOcean"));
|
| 363 | 365 |
nullOcean.setTopiaId("null");
|
| 364 | 366 |
|
| 367 |
+ Collection<String> ids = allByOcean.get(TripTopiaDao.EMPTY_OCEAN);
|
|
| 365 | 368 |
if (log.isInfoEnabled()) {
|
| 366 |
- log.info("Add a nullOcean : " + nullOcean.getLabel1() +
|
|
| 367 |
- " for " + allByOcean.get(null).size() +
|
|
| 368 |
- " trip(s).");
|
|
| 369 |
+ log.info(String.format("Add a nullOcean : %s for %d trip(s).", nullOcean.getLabel1(), ids.size()));
|
|
| 369 | 370 |
}
|
| 370 | 371 |
allOceans.remove(null);
|
| 371 | 372 |
allOceans.add(nullOcean);
|
| 372 | 373 |
|
| 373 |
- Collection<String> ids = allByOcean.get(null);
|
|
| 374 | 374 |
allByOcean.putAll(nullOcean, ids);
|
| 375 |
- allByOcean.removeAll(null);
|
|
| 375 |
+ allByOcean.removeAll(TripTopiaDao.EMPTY_OCEAN);
|
|
| 376 | 376 |
}
|
| 377 |
- TIME_LOG.log(t0, "loadTripListModel for " + result.getNbTrips() +
|
|
| 378 |
- " trips.");
|
|
| 377 |
+ TIME_LOG.log(t0, String.format("loadTripListModel for %d trips.", result.getNbTrips()));
|
|
| 379 | 378 |
|
| 380 | 379 |
allOceans = sortToList(allOceans);
|
| 381 | 380 |
result.setOceans(allOceans);
|
| ... | ... | @@ -139,7 +139,7 @@ public class ConfigureLevel2Step1Action extends AbstractConfigureAction<Level2Co |
| 139 | 139 |
injectOnly(InjectDecoratedBeans.class);
|
| 140 | 140 |
|
| 141 | 141 |
if (CollectionUtils.isEmpty(conf.getCatchFleets())) {
|
| 142 |
- addFieldError("configuration.catchFleetId", t("t3.error.no.catch.fleet.found"));
|
|
| 142 |
+ addFieldError("configuration.catchFleetIds", t("t3.error.no.catch.fleet.found"));
|
|
| 143 | 143 |
missingDatas = true;
|
| 144 | 144 |
}
|
| 145 | 145 |
|
| ... | ... | @@ -188,7 +188,7 @@ public class ConfigureLevel2Step1Action extends AbstractConfigureAction<Level2Co |
| 188 | 188 |
|
| 189 | 189 |
if (log.isInfoEnabled()) {
|
| 190 | 190 |
log.info("Selected species : " + conf.getSpeciesIds());
|
| 191 |
- log.info("Selected catch fleet country : " + conf.getCatchFleetId());
|
|
| 191 |
+ log.info("Selected catch fleets : " + conf.getCatchFleetIds());
|
|
| 192 | 192 |
log.info("Selected ocean : " + conf.getOceanIds());
|
| 193 | 193 |
log.info("Selected begin date : " + conf.getBeginDate());
|
| 194 | 194 |
log.info("Selected end date : " + conf.getEndDate());
|
| ... | ... | @@ -217,8 +217,8 @@ public class ConfigureLevel2Step1Action extends AbstractConfigureAction<Level2Co |
| 217 | 217 |
addFieldError("zoneVersionId", t("t3.error.no.zoneVersion.selected"));
|
| 218 | 218 |
}
|
| 219 | 219 |
|
| 220 |
- if (StringUtils.isEmpty(config.getCatchFleetId())) {
|
|
| 221 |
- addFieldError("configuration.catchFleetId", t("t3.error.no.catch.fleet.selected"));
|
|
| 220 |
+ if (CollectionUtils.isEmpty(config.getCatchFleetIds())) {
|
|
| 221 |
+ addFieldError("configuration.catchFleetIds", t("t3.error.no.catch.fleet.selected"));
|
|
| 222 | 222 |
}
|
| 223 | 223 |
|
| 224 | 224 |
boolean speciesOk = true;
|
| ... | ... | @@ -43,15 +43,15 @@ public class Level2ConfigureAction extends AbstractConfigureAction<Level2Configu |
| 43 | 43 |
|
| 44 | 44 |
private final Map<String, String> timeSteps = createTimeSteps();
|
| 45 | 45 |
|
| 46 |
- @InjectDecoratedBeans(beanType = Country.class, filterById = true, filterBySingleId = true)
|
|
| 47 |
- private Map<String, String> catchFleets;
|
|
| 48 |
- |
|
| 49 | 46 |
@InjectDecoratedBeans(beanType = ZoneStratumAwareMeta.class)
|
| 50 | 47 |
private Map<String, String> zoneTypes;
|
| 51 | 48 |
|
| 52 | 49 |
@InjectDecoratedBeans(beanType = ZoneVersion.class)
|
| 53 | 50 |
private Map<String, String> zoneVersions;
|
| 54 | 51 |
|
| 52 |
+ @InjectDecoratedBeans(beanType = Country.class, filterById = true)
|
|
| 53 |
+ private Map<String, String> catchFleets;
|
|
| 54 |
+ |
|
| 55 | 55 |
@InjectDecoratedBeans(beanType = Ocean.class, filterById = true)
|
| 56 | 56 |
private Map<String, String> oceans;
|
| 57 | 57 |
|
| ... | ... | @@ -45,15 +45,15 @@ public class Level2RunAction extends AbstractRunAction<Level2Configuration, Leve |
| 45 | 45 |
|
| 46 | 46 |
private final Map<String, String> timeSteps = createTimeSteps();
|
| 47 | 47 |
|
| 48 |
- @InjectDecoratedBeans(beanType = Country.class, filterById = true, filterBySingleId = true)
|
|
| 49 |
- private Map<String, String> catchFleets;
|
|
| 50 |
- |
|
| 51 | 48 |
@InjectDecoratedBeans(beanType = ZoneStratumAwareMeta.class)
|
| 52 | 49 |
private Map<String, String> zoneTypes;
|
| 53 | 50 |
|
| 54 | 51 |
@InjectDecoratedBeans(beanType = ZoneVersion.class)
|
| 55 | 52 |
private Map<String, String> zoneVersions;
|
| 56 | 53 |
|
| 54 |
+ @InjectDecoratedBeans(beanType = Country.class, filterById = true)
|
|
| 55 |
+ private Map<String, String> catchFleets;
|
|
| 56 |
+ |
|
| 57 | 57 |
@InjectDecoratedBeans(beanType = Ocean.class, filterById = true)
|
| 58 | 58 |
private Map<String, String> oceans;
|
| 59 | 59 |
|
| ... | ... | @@ -141,7 +141,7 @@ public class ConfigureLevel3Step1Action extends AbstractConfigureAction<Level3Co |
| 141 | 141 |
injectOnly(InjectDecoratedBeans.class);
|
| 142 | 142 |
|
| 143 | 143 |
if (CollectionUtils.isEmpty(conf.getCatchFleets())) {
|
| 144 |
- addFieldError("configuration.catchFleetId", t("t3.error.no.catch.fleet.found"));
|
|
| 144 |
+ addFieldError("configuration.catchFleetIds", t("t3.error.no.catch.fleet.found"));
|
|
| 145 | 145 |
missingDatas = true;
|
| 146 | 146 |
}
|
| 147 | 147 |
|
| ... | ... | @@ -187,13 +187,13 @@ public class ConfigureLevel3Step1Action extends AbstractConfigureAction<Level3Co |
| 187 | 187 |
|
| 188 | 188 |
if (log.isInfoEnabled()) {
|
| 189 | 189 |
log.info("Selected species : " + conf.getSpeciesIds());
|
| 190 |
- log.info("Selected catch fleet country : " + conf.getCatchFleetId());
|
|
| 190 |
+ log.info("Selected catch fleets : " + conf.getCatchFleetIds());
|
|
| 191 | 191 |
log.info("Selected ocean : " + conf.getOceanIds());
|
| 192 | 192 |
log.info("Selected begin date : " + conf.getBeginDate());
|
| 193 | 193 |
log.info("Selected end date : " + conf.getEndDate());
|
| 194 | 194 |
log.info("Selected time step : " + conf.getTimeStep());
|
| 195 | 195 |
log.info("Selected zone type : " + conf.getZoneTypeId());
|
| 196 |
- log.info("Selected zone version : " + conf.getZoneVersionId());
|
|
| 196 |
+ log.info("Selected zone version : " + conf.getZoneVersionId());
|
|
| 197 | 197 |
}
|
| 198 | 198 |
}
|
| 199 | 199 |
|
| ... | ... | @@ -217,8 +217,8 @@ public class ConfigureLevel3Step1Action extends AbstractConfigureAction<Level3Co |
| 217 | 217 |
addFieldError("zoneVersionId", t("t3.error.no.zoneVersion.selected"));
|
| 218 | 218 |
}
|
| 219 | 219 |
|
| 220 |
- if (StringUtils.isEmpty(config.getCatchFleetId())) {
|
|
| 221 |
- addFieldError("configuration.catchFleetId", t("t3.error.no.catch.fleet.selected"));
|
|
| 220 |
+ if (CollectionUtils.isEmpty(config.getCatchFleetIds())) {
|
|
| 221 |
+ addFieldError("configuration.catchFleetIds", t("t3.error.no.catch.fleet.selected"));
|
|
| 222 | 222 |
}
|
| 223 | 223 |
|
| 224 | 224 |
T3Date beginDate = config.getBeginDate();
|
| ... | ... | @@ -48,10 +48,6 @@ public class Level3ConfigureAction extends AbstractConfigureAction<Level3Configu |
| 48 | 48 |
|
| 49 | 49 |
private final Map<String, String> timeSteps = createTimeSteps();
|
| 50 | 50 |
|
| 51 |
- /** all fleet Countries. */
|
|
| 52 |
- @InjectDecoratedBeans(beanType = Country.class, filterById = true, filterBySingleId = true)
|
|
| 53 |
- private Map<String, String> catchFleets;
|
|
| 54 |
- |
|
| 55 | 51 |
/** all zoneTypes. */
|
| 56 | 52 |
@InjectDecoratedBeans(beanType = ZoneStratumAwareMeta.class)
|
| 57 | 53 |
private Map<String, String> zoneTypes;
|
| ... | ... | @@ -60,6 +56,10 @@ public class Level3ConfigureAction extends AbstractConfigureAction<Level3Configu |
| 60 | 56 |
@InjectDecoratedBeans(beanType = ZoneVersion.class)
|
| 61 | 57 |
private Map<String, String> zoneVersions;
|
| 62 | 58 |
|
| 59 |
+ /** all fleet Countries. */
|
|
| 60 |
+ @InjectDecoratedBeans(beanType = Country.class, filterById = true)
|
|
| 61 |
+ private Map<String, String> catchFleets;
|
|
| 62 |
+ |
|
| 63 | 63 |
/** all oceans. */
|
| 64 | 64 |
@InjectDecoratedBeans(beanType = Ocean.class, filterById = true)
|
| 65 | 65 |
private Map<String, String> oceans;
|
| ... | ... | @@ -47,10 +47,6 @@ public class Level3RunAction extends AbstractRunAction<Level3Configuration, Leve |
| 47 | 47 |
|
| 48 | 48 |
private final Map<String, String> timeSteps = createTimeSteps();
|
| 49 | 49 |
|
| 50 |
- /** all fleet Countries. */
|
|
| 51 |
- @InjectDecoratedBeans(beanType = Country.class, filterById = true, filterBySingleId = true)
|
|
| 52 |
- private Map<String, String> catchFleets;
|
|
| 53 |
- |
|
| 54 | 50 |
/** all zoneTypes. */
|
| 55 | 51 |
@InjectDecoratedBeans(beanType = ZoneStratumAwareMeta.class)
|
| 56 | 52 |
private Map<String, String> zoneTypes;
|
| ... | ... | @@ -59,8 +55,12 @@ public class Level3RunAction extends AbstractRunAction<Level3Configuration, Leve |
| 59 | 55 |
@InjectDecoratedBeans(beanType = ZoneVersion.class)
|
| 60 | 56 |
private Map<String, String> zoneVersions;
|
| 61 | 57 |
|
| 58 |
+ /** all fleet Countries. */
|
|
| 59 |
+ @InjectDecoratedBeans(beanType = Country.class, filterById = true)
|
|
| 60 |
+ private Map<String, String> catchFleets;
|
|
| 61 |
+ |
|
| 62 | 62 |
/** all oceans. */
|
| 63 |
- @InjectDecoratedBeans(beanType = Ocean.class, filterById = true, filterBySingleId = true)
|
|
| 63 |
+ @InjectDecoratedBeans(beanType = Ocean.class, filterById = true)
|
|
| 64 | 64 |
private Map<String, String> oceans;
|
| 65 | 65 |
|
| 66 | 66 |
/** all species. */
|
| ... | ... | @@ -26,6 +26,18 @@ |
| 26 | 26 |
<title><s:text name="t3.label.admin.trip.list"/></title>
|
| 27 | 27 |
<s:set var="userIsAdmin" value="%{#session.t3Session.user.admin}"/>
|
| 28 | 28 |
|
| 29 |
+<style type="text/css">
|
|
| 30 |
+ .wwlbl {
|
|
| 31 |
+ width: auto;
|
|
| 32 |
+ }
|
|
| 33 |
+ .wwgrp {
|
|
| 34 |
+ width: auto;
|
|
| 35 |
+ }
|
|
| 36 |
+ .filterClass {
|
|
| 37 |
+ width:150px;
|
|
| 38 |
+ }
|
|
| 39 |
+</style>
|
|
| 40 |
+ |
|
| 29 | 41 |
<script type="text/javascript">
|
| 30 | 42 |
|
| 31 | 43 |
jQuery(document).ready(function () {
|
| ... | ... | @@ -84,10 +84,10 @@ |
| 84 | 84 |
<sj:select key="zoneVersionId" list="zoneVersions" href="%{jsonUrl}"
|
| 85 | 85 |
label='%{getText("t3.common.zoneVersion")}' requiredLabel="true"/>
|
| 86 | 86 |
|
| 87 |
- <%-- selected catch fleet --%>
|
|
| 88 |
- <s:select key="configuration.catchFleetId" list="catchFleets" headerKey=""
|
|
| 89 |
- headerValue="" label='%{getText("t3.common.catchFleet")}'
|
|
| 90 |
- requiredLabel="true"/>
|
|
| 87 |
+ <%-- selected catch fleets --%>
|
|
| 88 |
+ <s:checkboxlist key="configuration.catchFleetIds" list="catchFleets"
|
|
| 89 |
+ label='%{getText("t3.common.catchFleet")}' requiredLabel="true"
|
|
| 90 |
+ template="mycheckboxlist"/>
|
|
| 91 | 91 |
|
| 92 | 92 |
<%-- selected time step --%>
|
| 93 | 93 |
<s:select key="configuration.timeStep" list="timeSteps"
|
| ... | ... | @@ -84,10 +84,10 @@ |
| 84 | 84 |
<sj:select key="zoneVersionId" list="zoneVersions" href="%{jsonUrl}"
|
| 85 | 85 |
label='%{getText("t3.common.zoneVersion")}' requiredLabel="true"/>
|
| 86 | 86 |
|
| 87 |
- <%-- selected catch fleet --%>
|
|
| 88 |
- <s:select key="configuration.catchFleetId" list="catchFleets" headerKey=""
|
|
| 89 |
- headerValue="" label='%{getText("t3.common.catchFleet")}'
|
|
| 90 |
- requiredLabel="true"/>
|
|
| 87 |
+ <%-- selected catch fleets --%>
|
|
| 88 |
+ <s:checkboxlist key="configuration.catchFleetIds" list="catchFleets"
|
|
| 89 |
+ label='%{getText("t3.common.catchFleet")}' requiredLabel="true"
|
|
| 90 |
+ template="mycheckboxlist"/>
|
|
| 91 | 91 |
|
| 92 | 92 |
<%-- selected time step --%>
|
| 93 | 93 |
<s:select key="configuration.timeStep" list="timeSteps"
|