Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
-
fbdd9e09
by Tony CHEMIT at 2018-03-09T13:33:47Z
27 changed files:
- .gitlab-ci.yml
- pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractOceanTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
- − t3-input-avdthv33/.mvn/load-test-data
- t3-input-avdthv33/pom.xml
- − t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionIT.java
- − t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionIT.java
- − t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV33Test.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
- t3-web/src/main/resources/i18n/t3-web_en_GB.properties
- t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
Changes:
| ... | ... | @@ -28,13 +28,13 @@ image: registry.gitlab.com/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/docker:lat |
| 28 | 28 |
environment:
|
| 29 | 29 |
name: test
|
| 30 | 30 |
script:
|
| 31 |
- - if [ -n "${BUILD_FOR_RELEASE}" ]; then ultreiaio-maven-execute 'clean verify -U -DperformRelease -Dmaven.source.skip -Dmaven.javadoc.skip'; fi
|
|
| 31 |
+ - if [ -n "${BUILD_FOR_RELEASE}" ]; then ultreiaio-maven-execute 'clean verify -U -DperformRelease -Psnapshot'; fi
|
|
| 32 | 32 |
|
| 33 | 33 |
.deploy-snapshot: &deploy-snapshot
|
| 34 | 34 |
environment:
|
| 35 | 35 |
name: snapshot
|
| 36 | 36 |
script:
|
| 37 |
- - if [ -n "${DEPLOY_SNAPSHOT}" ]; then ultreiaio-maven-execute 'clean deploy -am -pl t3-domain -DperformRelease -Dmaven.source.skip -Dmaven.javadoc.skip'; fi
|
|
| 37 |
+ - if [ -n "${DEPLOY_SNAPSHOT}" ]; then ultreiaio-maven-execute 'clean deploy -am -pl t3-domain -DperformRelease -Psnapshot'; fi
|
|
| 38 | 38 |
|
| 39 | 39 |
.publish-site: &publish-site
|
| 40 | 40 |
environment:
|
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 |
<parent>
|
| 24 | 24 |
<groupId>io.ultreia.maven</groupId>
|
| 25 | 25 |
<artifactId>pom</artifactId>
|
| 26 |
- <version>2018.21</version>
|
|
| 26 |
+ <version>2018.22</version>
|
|
| 27 | 27 |
</parent>
|
| 28 | 28 |
|
| 29 | 29 |
<groupId>fr.ird.t3</groupId>
|
| ... | ... | @@ -145,14 +145,6 @@ |
| 145 | 145 |
<dependencies>
|
| 146 | 146 |
|
| 147 | 147 |
<dependency>
|
| 148 |
- <groupId>com.healthmarketscience.jackcess</groupId>
|
|
| 149 |
- <artifactId>jackcess</artifactId>
|
|
| 150 |
- <version>1.2.0</version>
|
|
| 151 |
- </dependency>
|
|
| 152 |
- |
|
| 153 |
- <!-- Struts 2 -->
|
|
| 154 |
- |
|
| 155 |
- <dependency>
|
|
| 156 | 148 |
<groupId>org.apache.struts</groupId>
|
| 157 | 149 |
<artifactId>struts2-core</artifactId>
|
| 158 | 150 |
<version>${struts2Version}</version>
|
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| ... | ... | @@ -43,22 +43,42 @@ public class AnalyzeInputSourceConfiguration implements InputSourceConfiguration |
| 43 | 43 |
protected boolean createVirtualVessel;
|
| 44 | 44 |
protected T3InputProvider inputProvider;
|
| 45 | 45 |
protected File inputFile;
|
| 46 |
+ /**
|
|
| 47 |
+ * Flag to load only samples only trips
|
|
| 48 |
+ *
|
|
| 49 |
+ * @see TripType#SAMPLEONLY
|
|
| 50 |
+ */
|
|
| 51 |
+ private boolean useSamplesOnly;
|
|
| 52 |
+ /**
|
|
| 53 |
+ * Flag to authorize virtual activity creation (when logbooks are missing).
|
|
| 54 |
+ * <p>
|
|
| 55 |
+ * By default, let's always authorize it.
|
|
| 56 |
+ * <p>
|
|
| 57 |
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
|
|
| 58 |
+ *
|
|
| 59 |
+ * @see TripType#LOGBOOKMISSING
|
|
| 60 |
+ * @see TripType#STANDARD
|
|
| 61 |
+ */
|
|
| 62 |
+ private boolean canCreateVirtualActivity;
|
|
| 46 | 63 |
private TripType tripType;
|
| 47 | 64 |
|
| 48 | 65 |
public static AnalyzeInputSourceConfiguration newConfiguration(
|
| 49 | 66 |
T3InputProvider inputProvider,
|
| 50 | 67 |
File inputFile,
|
| 51 | 68 |
boolean useWells,
|
| 52 |
- TripType tripType,
|
|
| 53 | 69 |
boolean canCreateVessel,
|
| 54 |
- boolean createVirtualVessel) {
|
|
| 70 |
+ boolean createVirtualVessel,
|
|
| 71 |
+ boolean useSamplesOnly,
|
|
| 72 |
+ boolean canCreateVirtualActivity) {
|
|
| 55 | 73 |
AnalyzeInputSourceConfiguration result = new AnalyzeInputSourceConfiguration();
|
| 56 | 74 |
result.setInputFile(inputFile);
|
| 57 | 75 |
result.setInputProvider(inputProvider);
|
| 58 | 76 |
result.setUseWells(useWells);
|
| 59 |
- result.setTripType(tripType);
|
|
| 77 |
+ result.setTripType(TripType.getTripType(useSamplesOnly, canCreateVirtualActivity));
|
|
| 60 | 78 |
result.setCanCreateVessel(canCreateVessel);
|
| 61 | 79 |
result.setCreateVirtualVessel(createVirtualVessel);
|
| 80 |
+ result.setCanCreateVirtualActivity(canCreateVirtualActivity);
|
|
| 81 |
+ result.setUseSamplesOnly(useSamplesOnly);
|
|
| 62 | 82 |
return result;
|
| 63 | 83 |
}
|
| 64 | 84 |
|
| ... | ... | @@ -127,12 +147,34 @@ public class AnalyzeInputSourceConfiguration implements InputSourceConfiguration |
| 127 | 147 |
return l(locale, "t3.input.AnalyzeInputSource");
|
| 128 | 148 |
}
|
| 129 | 149 |
|
| 150 |
+ @Override
|
|
| 151 |
+ public boolean isUseSamplesOnly() {
|
|
| 152 |
+ return useSamplesOnly;
|
|
| 153 |
+ }
|
|
| 154 |
+ |
|
| 155 |
+ @Override
|
|
| 156 |
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
|
|
| 157 |
+ this.useSamplesOnly = useSamplesOnly;
|
|
| 158 |
+ }
|
|
| 159 |
+ |
|
| 160 |
+ @Override
|
|
| 161 |
+ public boolean isCanCreateVirtualActivity() {
|
|
| 162 |
+ return canCreateVirtualActivity;
|
|
| 163 |
+ }
|
|
| 164 |
+ |
|
| 165 |
+ @Override
|
|
| 166 |
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
|
|
| 167 |
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
|
|
| 168 |
+ }
|
|
| 169 |
+ |
|
| 130 | 170 |
T3InputConfiguration toInputConfiguration() {
|
| 131 | 171 |
T3InputConfiguration result = new T3InputConfiguration();
|
| 132 | 172 |
result.setCanCreateVessel(canCreateVessel);
|
| 133 | 173 |
result.setCreateVirtualVessel(createVirtualVessel);
|
| 134 | 174 |
result.setTripType(tripType);
|
| 135 | 175 |
result.setUseWells(useWells);
|
| 176 |
+ result.setCanCreateVirtualActivity(canCreateVirtualActivity);
|
|
| 177 |
+ result.setUseSamplesOnly(useSamplesOnly);
|
|
| 136 | 178 |
result.setInputFile(inputFile);
|
| 137 | 179 |
return result;
|
| 138 | 180 |
}
|
| ... | ... | @@ -25,7 +25,6 @@ import fr.ird.t3.entities.T3EntityEnum; |
| 25 | 25 |
import fr.ird.t3.entities.T3TopiaApplicationContext;
|
| 26 | 26 |
import fr.ird.t3.entities.T3TopiaPersistenceContext;
|
| 27 | 27 |
import fr.ird.t3.entities.data.Activity;
|
| 28 |
-import fr.ird.t3.entities.data.ActivityTopiaDao;
|
|
| 29 | 28 |
import fr.ird.t3.entities.data.T3DataEntity;
|
| 30 | 29 |
import fr.ird.t3.entities.data.Trip;
|
| 31 | 30 |
import fr.ird.t3.entities.data.TripTopiaDao;
|
| ... | ... | @@ -60,15 +59,11 @@ import static org.nuiton.i18n.I18n.l; |
| 60 | 59 |
*/
|
| 61 | 60 |
public class ImportInputSourceAction extends T3Action<ImportInputSourceConfiguration> {
|
| 62 | 61 |
|
| 63 |
- // public static final String PARAM_TRIPS_TO_IMPORT = "tripsToImport";
|
|
| 64 |
-// public static final String PARAM_TRIPS_TO_DELETE = "tripsToDelete";
|
|
| 65 | 62 |
private static final Log log = LogFactory.getLog(ImportInputSourceAction.class);
|
| 66 | 63 |
@InjectDAO(entityType = Trip.class)
|
| 67 | 64 |
private TripTopiaDao tripDAO;
|
| 68 | 65 |
@InjectDAO(entityType = Vessel.class)
|
| 69 | 66 |
private VesselTopiaDao vesselDAO;
|
| 70 |
- @InjectDAO(entityType = Activity.class)
|
|
| 71 |
- private ActivityTopiaDao activityDAO;
|
|
| 72 | 67 |
@InjectDAO(entityType = Ocean.class)
|
| 73 | 68 |
private OceanTopiaDao oceanDAO;
|
| 74 | 69 |
private Set<Trip> tripToDelete;
|
| ... | ... | @@ -88,13 +83,10 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura |
| 88 | 83 |
|
| 89 | 84 |
@Override
|
| 90 | 85 |
protected boolean executeAction() {
|
| 91 |
- |
|
| 92 | 86 |
if (CollectionUtils.isEmpty(trips)) {
|
| 93 |
- // no trips at all to import
|
|
| 94 |
- // no commit to do, skip the action
|
|
| 87 |
+ // no trips at all to import, no commit to do, skip the action
|
|
| 95 | 88 |
return false;
|
| 96 | 89 |
}
|
| 97 |
- |
|
| 98 | 90 |
int nbSteps = 0;
|
| 99 | 91 |
if (CollectionUtils.isNotEmpty(trips)) {
|
| 100 | 92 |
nbSteps += trips.size();
|
| ... | ... | @@ -102,7 +94,6 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura |
| 102 | 94 |
if (CollectionUtils.isNotEmpty(tripToDelete)) {
|
| 103 | 95 |
nbSteps += tripToDelete.size();
|
| 104 | 96 |
}
|
| 105 |
- |
|
| 106 | 97 |
setNbSteps(nbSteps);
|
| 107 | 98 |
log.info(String.format("Nb steps : %d", getNbSteps()));
|
| 108 | 99 |
if (CollectionUtils.isNotEmpty(tripToDelete)) {
|
| ... | ... | @@ -154,8 +145,6 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura |
| 154 | 145 |
|
| 155 | 146 |
// Need to flush as we are going to query new data
|
| 156 | 147 |
getT3TopiaPersistenceContext().get().getHibernateSupport().getHibernateSession().flush();
|
| 157 |
- |
|
| 158 |
- String prefix = Activity.class.getName() + "#";
|
|
| 159 | 148 |
for (Activity activity : ids) {
|
| 160 | 149 |
Ocean ocean = oceanDAO.findOceanByActivity(activity);
|
| 161 | 150 |
activity.setOcean(ocean);
|
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| ... | ... | @@ -45,6 +45,23 @@ public class ImportInputSourceConfiguration implements InputSourceConfiguration |
| 45 | 45 |
protected boolean createVirtualVessel;
|
| 46 | 46 |
protected T3InputProvider inputProvider;
|
| 47 | 47 |
protected File inputFile;
|
| 48 |
+ /**
|
|
| 49 |
+ * Flag to load only samples only trips
|
|
| 50 |
+ *
|
|
| 51 |
+ * @see TripType#SAMPLEONLY
|
|
| 52 |
+ */
|
|
| 53 |
+ private boolean useSamplesOnly;
|
|
| 54 |
+ /**
|
|
| 55 |
+ * Flag to authorize virtual activity creation (when logbooks are missing).
|
|
| 56 |
+ * <p>
|
|
| 57 |
+ * By default, let's always authorize it.
|
|
| 58 |
+ * <p>
|
|
| 59 |
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
|
|
| 60 |
+ *
|
|
| 61 |
+ * @see TripType#LOGBOOKMISSING
|
|
| 62 |
+ * @see TripType#STANDARD
|
|
| 63 |
+ */
|
|
| 64 |
+ private boolean canCreateVirtualActivity;
|
|
| 48 | 65 |
private Set<Trip> tripsToImport;
|
| 49 | 66 |
private Set<Trip> tripsToDelete;
|
| 50 | 67 |
|
| ... | ... | @@ -124,6 +141,27 @@ public class ImportInputSourceConfiguration implements InputSourceConfiguration |
| 124 | 141 |
return l(locale, "t3.input.ImportInputSource");
|
| 125 | 142 |
}
|
| 126 | 143 |
|
| 144 |
+ |
|
| 145 |
+ @Override
|
|
| 146 |
+ public boolean isUseSamplesOnly() {
|
|
| 147 |
+ return useSamplesOnly;
|
|
| 148 |
+ }
|
|
| 149 |
+ |
|
| 150 |
+ @Override
|
|
| 151 |
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
|
|
| 152 |
+ this.useSamplesOnly = useSamplesOnly;
|
|
| 153 |
+ }
|
|
| 154 |
+ |
|
| 155 |
+ @Override
|
|
| 156 |
+ public boolean isCanCreateVirtualActivity() {
|
|
| 157 |
+ return canCreateVirtualActivity;
|
|
| 158 |
+ }
|
|
| 159 |
+ |
|
| 160 |
+ @Override
|
|
| 161 |
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
|
|
| 162 |
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
|
|
| 163 |
+ }
|
|
| 164 |
+ |
|
| 127 | 165 |
public Set<Trip> getTripsToImport() {
|
| 128 | 166 |
return tripsToImport;
|
| 129 | 167 |
}
|
| ... | ... | @@ -50,6 +50,14 @@ public interface InputSourceConfiguration extends T3ActionConfiguration { |
| 50 | 50 |
|
| 51 | 51 |
void setCreateVirtualVessel(boolean createVirtualVessel);
|
| 52 | 52 |
|
| 53 |
+ boolean isUseSamplesOnly();
|
|
| 54 |
+ |
|
| 55 |
+ void setUseSamplesOnly(boolean useSamplesOnly);
|
|
| 56 |
+ |
|
| 57 |
+ boolean isCanCreateVirtualActivity();
|
|
| 58 |
+ |
|
| 59 |
+ void setCanCreateVirtualActivity(boolean canCreateVirtualActivity);
|
|
| 60 |
+ |
|
| 53 | 61 |
T3InputProvider getInputProvider();
|
| 54 | 62 |
|
| 55 | 63 |
void setInputProvider(T3InputProvider inputProvider);
|
| ... | ... | @@ -94,7 +94,7 @@ public abstract class AnalyzeInputSourceActionITSupport { |
| 94 | 94 |
if (doIt) {
|
| 95 | 95 |
String dbName = msConfig.dbName;
|
| 96 | 96 |
log.debug("Do test for db " + dbName);
|
| 97 |
- outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb","-result.txt"));
|
|
| 97 |
+ outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb", "-result.txt"));
|
|
| 98 | 98 |
log.info("Will save result in file : " + outputFile);
|
| 99 | 99 |
outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
|
| 100 | 100 |
File workingDirectory = serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
|
| ... | ... | @@ -116,12 +116,14 @@ public abstract class AnalyzeInputSourceActionITSupport { |
| 116 | 116 |
log.info(new String(Files.readAllBytes(outputFile.toPath())));
|
| 117 | 117 |
}
|
| 118 | 118 |
}
|
| 119 |
+ |
|
| 119 | 120 |
void testExecute(OceanFixtures fixture) throws Exception {
|
| 120 | 121 |
testExecute(fixture, TripType.STANDARD);
|
| 121 | 122 |
}
|
| 123 |
+ |
|
| 122 | 124 |
void testExecute(OceanFixtures fixture, TripType tripType) throws Exception {
|
| 123 | 125 |
serviceContext.getMsConfig().setUseWells(false);
|
| 124 |
- testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType, false, false);
|
|
| 126 |
+ testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType);
|
|
| 125 | 127 |
// serviceContext.getMsConfig().setUseWells(true);
|
| 126 | 128 |
// testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
|
| 127 | 129 |
}
|
| ... | ... | @@ -136,9 +138,7 @@ public abstract class AnalyzeInputSourceActionITSupport { |
| 136 | 138 |
nbUnsafe,
|
| 137 | 139 |
nbSafeWithoutWell,
|
| 138 | 140 |
nbUnsafeWithoutWell,
|
| 139 |
- TripType.STANDARD,
|
|
| 140 |
- false,
|
|
| 141 |
- false
|
|
| 141 |
+ TripType.STANDARD
|
|
| 142 | 142 |
);
|
| 143 | 143 |
}
|
| 144 | 144 |
|
| ... | ... | @@ -146,14 +146,18 @@ public abstract class AnalyzeInputSourceActionITSupport { |
| 146 | 146 |
int nbUnsafe,
|
| 147 | 147 |
int nbSafeWithoutWell,
|
| 148 | 148 |
int nbUnsafeWithoutWell,
|
| 149 |
- TripType tripType,
|
|
| 150 |
- boolean canCreateVessel,
|
|
| 151 |
- boolean createVirtualVessel) throws Exception {
|
|
| 149 |
+ TripType tripType) throws Exception {
|
|
| 152 | 150 |
MSAccessTestConfiguration msConfig = serviceContext.getMsConfig();
|
| 153 | 151 |
if (msConfig.doTest(serviceContext.getTestName())) {
|
| 154 | 152 |
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
| 155 | 153 |
AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
| 156 |
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel);
|
|
| 154 |
+ inputProvider,
|
|
| 155 |
+ target,
|
|
| 156 |
+ msConfig.isUseWells(),
|
|
| 157 |
+ false,
|
|
| 158 |
+ false,
|
|
| 159 |
+ tripType != null && tripType == TripType.SAMPLEONLY,
|
|
| 160 |
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
|
|
| 157 | 161 |
T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
|
| 158 | 162 |
outputWriter.write("----------------------------------------------------\n");
|
| 159 | 163 |
outputWriter.write(msConfig.accessFile + "\n");
|
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| ... | ... | @@ -89,22 +89,25 @@ public abstract class ImportInputSourceActionITSupport { |
| 89 | 89 |
}
|
| 90 | 90 |
|
| 91 | 91 |
public void testExecute(OceanFixtures fixtures) throws Exception {
|
| 92 |
- testExecute(fixtures.nbSafeWithoutWell(), fixtures.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
|
|
| 92 |
+ testExecute(fixtures.nbSafeWithoutWell(), fixtures.nbUnsafeWithoutWell(), TripType.STANDARD);
|
|
| 93 | 93 |
}
|
| 94 | 94 |
|
| 95 | 95 |
public void testExecute(int nbSafe, int nbUnsafe) throws Exception {
|
| 96 |
- testExecute(nbSafe, nbUnsafe, TripType.STANDARD, false, false);
|
|
| 96 |
+ testExecute(nbSafe, nbUnsafe, TripType.STANDARD);
|
|
| 97 | 97 |
}
|
| 98 | 98 |
|
| 99 | 99 |
public void testExecute(int nbSafe, int nbUnsafe,
|
| 100 |
- TripType tripType,
|
|
| 101 |
- boolean canCreateVessel,
|
|
| 102 |
- boolean createVirtualVessel) throws Exception {
|
|
| 100 |
+ TripType tripType) throws Exception {
|
|
| 103 | 101 |
MSAccessTestConfiguration msConfig = serviceContext.getMsConfig();
|
| 104 | 102 |
if (msConfig.doTest(serviceContext.getTestName())) {
|
| 105 | 103 |
AnalyzeInputSourceConfiguration analyzeActionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
| 106 |
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel);
|
|
| 107 |
- |
|
| 104 |
+ inputProvider,
|
|
| 105 |
+ target,
|
|
| 106 |
+ msConfig.isUseWells(),
|
|
| 107 |
+ false,
|
|
| 108 |
+ false,
|
|
| 109 |
+ tripType != null && tripType == TripType.SAMPLEONLY,
|
|
| 110 |
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
|
|
| 108 | 111 |
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
| 109 | 112 |
|
| 110 | 113 |
T3ActionContext<AnalyzeInputSourceConfiguration> analyzeContext = serviceFactory.newT3ActionContext(analyzeActionConfiguration, serviceContext);
|
| ... | ... | @@ -119,7 +119,13 @@ public abstract class AnalyzeAvdthTestSupport { |
| 119 | 119 |
|
| 120 | 120 |
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
| 121 | 121 |
AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
| 122 |
- getInputProvider(), getTarget(), useWells, tripType, false, false);
|
|
| 122 |
+ inputProvider,
|
|
| 123 |
+ target,
|
|
| 124 |
+ msConfig.isUseWells(),
|
|
| 125 |
+ false,
|
|
| 126 |
+ false,
|
|
| 127 |
+ tripType == TripType.SAMPLEONLY,
|
|
| 128 |
+ tripType == TripType.LOGBOOKMISSING);
|
|
| 123 | 129 |
|
| 124 | 130 |
T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
|
| 125 | 131 |
|
| ... | ... | @@ -100,9 +100,7 @@ public abstract class AnalyzeInputSourceActionTestSupport { |
| 100 | 100 |
fixture.nbUnsafe(),
|
| 101 | 101 |
fixture.nbSafeWithoutWell(),
|
| 102 | 102 |
fixture.nbUnsafeWithoutWell(),
|
| 103 |
- tripType,
|
|
| 104 |
- false,
|
|
| 105 |
- false);
|
|
| 103 |
+ tripType);
|
|
| 106 | 104 |
}
|
| 107 | 105 |
|
| 108 | 106 |
public FakeT3AvdthServiceContext getServiceContext() {
|
| ... | ... | @@ -129,16 +127,20 @@ public abstract class AnalyzeInputSourceActionTestSupport { |
| 129 | 127 |
int nbUnsafe,
|
| 130 | 128 |
int nbSafeWithoutWell,
|
| 131 | 129 |
int nbUnsafeWithoutWell,
|
| 132 |
- TripType tripType,
|
|
| 133 |
- boolean canCreateVessel,
|
|
| 134 |
- boolean createVirtualVessel) throws Exception {
|
|
| 130 |
+ TripType tripType) throws Exception {
|
|
| 135 | 131 |
|
| 136 | 132 |
MSAccessTestConfiguration msConfig = getMsConfig();
|
| 137 | 133 |
FakeT3AvdthServiceContext serviceContext = getServiceContext();
|
| 138 | 134 |
if (msConfig.doTest(serviceContext.getTestName())) {
|
| 139 | 135 |
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
| 140 | 136 |
AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
| 141 |
- getInputProvider(), getTarget(), true, tripType, canCreateVessel, createVirtualVessel);
|
|
| 137 |
+ inputProvider,
|
|
| 138 |
+ target,
|
|
| 139 |
+ msConfig.isUseWells(),
|
|
| 140 |
+ false,
|
|
| 141 |
+ false,
|
|
| 142 |
+ tripType != null && tripType == TripType.SAMPLEONLY,
|
|
| 143 |
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
|
|
| 142 | 144 |
T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
|
| 143 | 145 |
|
| 144 | 146 |
BufferedWriter outputWriter = getOutputWriter();
|
| ... | ... | @@ -184,55 +186,4 @@ public abstract class AnalyzeInputSourceActionTestSupport { |
| 184 | 186 |
}
|
| 185 | 187 |
}
|
| 186 | 188 |
|
| 187 |
- protected void testExecute2(OceanFixtures fixture, TripType tripType) throws Exception {
|
|
| 188 |
- |
|
| 189 |
- MSAccessTestConfiguration msConfig = getMsConfig();
|
|
| 190 |
- boolean useWells = msConfig.isUseWells();
|
|
| 191 |
- int nbSafe = fixture.nbSafe(useWells);
|
|
| 192 |
- int nbUnsafe = fixture.nbUnsafe(useWells);
|
|
| 193 |
- |
|
| 194 |
- FakeT3AvdthServiceContext serviceContext = getServiceContext();
|
|
| 195 |
- |
|
| 196 |
- T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
|
| 197 |
- AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
|
| 198 |
- getInputProvider(), getTarget(), useWells, tripType, false, false);
|
|
| 199 |
- |
|
| 200 |
- T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
|
|
| 201 |
- |
|
| 202 |
- BufferedWriter outputWriter = getOutputWriter();
|
|
| 203 |
- outputWriter.write("----------------------------------------------------\n");
|
|
| 204 |
- outputWriter.write(msConfig.getAccessFile() + "\n");
|
|
| 205 |
- T3Action<AnalyzeInputSourceConfiguration> action;
|
|
| 206 |
- |
|
| 207 |
- action = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, context);
|
|
| 208 |
- Assert.assertNotNull(action);
|
|
| 209 |
- action.run();
|
|
| 210 |
- |
|
| 211 |
- Set<Trip> safeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
|
|
| 212 |
- Assert.assertNotNull(safeTrips);
|
|
| 213 |
- outputWriter.write(String.format("found %d safe trip(s).\n", safeTrips.size()));
|
|
| 214 |
- Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
|
|
| 215 |
- Assert.assertNotNull(unsafeTrips);
|
|
| 216 |
- outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
|
|
| 217 |
- List<String> messages;
|
|
| 218 |
- if (msConfig.isLogWarnings() && log.isWarnEnabled()) {
|
|
| 219 |
- messages = action.getWarnMessages();
|
|
| 220 |
- if (CollectionUtils.isNotEmpty(messages)) {
|
|
| 221 |
- for (String message : messages) {
|
|
| 222 |
- outputWriter.write(String.format("[WARNING] %s\n", message));
|
|
| 223 |
- }
|
|
| 224 |
- }
|
|
| 225 |
- }
|
|
| 226 |
- if (log.isErrorEnabled()) {
|
|
| 227 |
- messages = action.getErrorMessages();
|
|
| 228 |
- if (CollectionUtils.isNotEmpty(messages)) {
|
|
| 229 |
- for (String message : messages) {
|
|
| 230 |
- outputWriter.write(String.format("[ERROR] %s\n", message));
|
|
| 231 |
- }
|
|
| 232 |
- }
|
|
| 233 |
- }
|
|
| 234 |
- log.info(String.format("\n[%s] (useWells?%b) safe : %d - unsafe : %d\n", msConfig.getDbName(), useWells, safeTrips.size(), unsafeTrips.size()));
|
|
| 235 |
- Assert.assertEquals(nbSafe, safeTrips.size());
|
|
| 236 |
- Assert.assertEquals(nbUnsafe, unsafeTrips.size());
|
|
| 237 |
- }
|
|
| 238 | 189 |
}
|
| ... | ... | @@ -85,18 +85,21 @@ public abstract class ImportInputSourceActionTestSupport { |
| 85 | 85 |
}
|
| 86 | 86 |
|
| 87 | 87 |
protected void testExecute(OceanFixtures fixture, TripType tripType) throws Exception {
|
| 88 |
- testExecute(fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType, false, false);
|
|
| 88 |
+ testExecute(fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType);
|
|
| 89 | 89 |
}
|
| 90 | 90 |
|
| 91 |
- public void testExecute(int nbSafe, int nbUnsafe,
|
|
| 92 |
- TripType tripType,
|
|
| 93 |
- boolean canCreateVessel,
|
|
| 94 |
- boolean createVirtualVessel) throws Exception {
|
|
| 91 |
+ public void testExecute(int nbSafe, int nbUnsafe, TripType tripType) throws Exception {
|
|
| 95 | 92 |
|
| 96 | 93 |
MSAccessTestConfiguration msConfig = serviceContext.getMsConfig();
|
| 97 | 94 |
if (msConfig.doTest(serviceContext.getTestName())) {
|
| 98 | 95 |
AnalyzeInputSourceConfiguration analyzeActionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
| 99 |
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel);
|
|
| 96 |
+ inputProvider,
|
|
| 97 |
+ target,
|
|
| 98 |
+ msConfig.isUseWells(),
|
|
| 99 |
+ false,
|
|
| 100 |
+ false,
|
|
| 101 |
+ tripType != null && tripType == TripType.SAMPLEONLY,
|
|
| 102 |
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
|
|
| 100 | 103 |
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
| 101 | 104 |
T3ActionContext<AnalyzeInputSourceConfiguration> analyzeContext =
|
| 102 | 105 |
serviceFactory.newT3ActionContext(analyzeActionConfiguration, serviceContext);
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.t3.entities.data; |
| 10 | 10 |
* it under the terms of the GNU Affero General Public License as published by
|
| 11 | 11 |
* the Free Software Foundation, either version 3 of the License, or
|
| 12 | 12 |
* (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU Affero General Public License
|
| 20 | 20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | 21 |
* #L%
|
| ... | ... | @@ -23,13 +23,21 @@ package fr.ird.t3.entities.data; |
| 23 | 23 |
|
| 24 | 24 |
import fr.ird.t3.t3.domain.I18nEnumHelper;
|
| 25 | 25 |
|
| 26 |
-import static org.nuiton.i18n.I18n.t;
|
|
| 27 |
- |
|
| 28 | 26 |
public enum TripType {
|
| 29 | 27 |
STANDARD,
|
| 30 | 28 |
SAMPLEONLY,
|
| 31 | 29 |
LOGBOOKMISSING;
|
| 32 | 30 |
|
| 31 |
+ public static TripType getTripType(boolean useSamplesOnly, boolean canCreateVirtualActivity) {
|
|
| 32 |
+ TripType tripType;
|
|
| 33 |
+ if (useSamplesOnly) {
|
|
| 34 |
+ tripType = SAMPLEONLY;
|
|
| 35 |
+ } else {
|
|
| 36 |
+ tripType = canCreateVirtualActivity ? LOGBOOKMISSING : STANDARD;
|
|
| 37 |
+ }
|
|
| 38 |
+ return tripType;
|
|
| 39 |
+ }
|
|
| 40 |
+ |
|
| 33 | 41 |
public String getLabel() {
|
| 34 | 42 |
return I18nEnumHelper.getLabel(this);
|
| 35 | 43 |
}
|
| ... | ... | @@ -59,16 +59,16 @@ public class AbstractOceanTopiaDao<E extends Ocean> extends GeneratedOceanTopiaD |
| 59 | 59 |
}
|
| 60 | 60 |
|
| 61 | 61 |
public E findOceanByActivity(Activity activity) {
|
| 62 |
- GetOceanIdByActivityCoordinateQuery query = new GetOceanIdByActivityCoordinateQuery(activity.getTopiaId());
|
|
| 62 |
+ GetOceanIdByCoordinateQuery query = new GetOceanIdByCoordinateQuery(activity.getTopiaId());
|
|
| 63 | 63 |
String oceanId = topiaSqlSupport.findSingleResult(query);
|
| 64 | 64 |
return forTopiaIdEquals(oceanId).findUnique();
|
| 65 | 65 |
}
|
| 66 | 66 |
|
| 67 |
- private static class GetOceanIdByActivityCoordinateQuery extends TopiaSqlQuery<String> {
|
|
| 67 |
+ private static class GetOceanIdByCoordinateQuery extends TopiaSqlQuery<String> {
|
|
| 68 | 68 |
|
| 69 | 69 |
private final String activity;
|
| 70 | 70 |
|
| 71 |
- GetOceanIdByActivityCoordinateQuery(String activity) {
|
|
| 71 |
+ GetOceanIdByCoordinateQuery(String activity) {
|
|
| 72 | 72 |
this.activity = activity;
|
| 73 | 73 |
}
|
| 74 | 74 |
|
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| ... | ... | @@ -33,15 +33,13 @@ import java.io.File; |
| 33 | 33 |
*/
|
| 34 | 34 |
public class T3InputConfiguration {
|
| 35 | 35 |
|
| 36 |
- protected boolean useWells;
|
|
| 37 |
- |
|
| 38 |
- protected boolean canCreateVessel;
|
|
| 39 |
- |
|
| 40 |
- protected boolean createVirtualVessel;
|
|
| 41 |
- |
|
| 42 |
- protected TripType tripType;
|
|
| 43 |
- |
|
| 44 |
- protected File inputFile;
|
|
| 36 |
+ private boolean useWells;
|
|
| 37 |
+ private boolean canCreateVessel;
|
|
| 38 |
+ private boolean createVirtualVessel;
|
|
| 39 |
+ private boolean useSamplesOnly;
|
|
| 40 |
+ private boolean canCreateVirtualActivity;
|
|
| 41 |
+ private TripType tripType;
|
|
| 42 |
+ private File inputFile;
|
|
| 45 | 43 |
|
| 46 | 44 |
private T3TopiaApplicationContext topiaApplicationContext;
|
| 47 | 45 |
|
| ... | ... | @@ -85,6 +83,22 @@ public class T3InputConfiguration { |
| 85 | 83 |
this.inputFile = inputFile;
|
| 86 | 84 |
}
|
| 87 | 85 |
|
| 86 |
+ public boolean isUseSamplesOnly() {
|
|
| 87 |
+ return useSamplesOnly;
|
|
| 88 |
+ }
|
|
| 89 |
+ |
|
| 90 |
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
|
|
| 91 |
+ this.useSamplesOnly = useSamplesOnly;
|
|
| 92 |
+ }
|
|
| 93 |
+ |
|
| 94 |
+ public boolean isCanCreateVirtualActivity() {
|
|
| 95 |
+ return canCreateVirtualActivity;
|
|
| 96 |
+ }
|
|
| 97 |
+ |
|
| 98 |
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
|
|
| 99 |
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
|
|
| 100 |
+ }
|
|
| 101 |
+ |
|
| 88 | 102 |
public T3TopiaApplicationContext getTopiaApplicationContext() {
|
| 89 | 103 |
return topiaApplicationContext;
|
| 90 | 104 |
}
|
| ... | ... | @@ -18,7 +18,8 @@ |
| 18 | 18 |
along with this program. If not, see <http://www.gnu.org/licenses />.
|
| 19 | 19 |
#L%
|
| 20 | 20 |
-->
|
| 21 |
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
| 21 |
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
| 22 |
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
| 22 | 23 |
<modelVersion>4.0.0</modelVersion>
|
| 23 | 24 |
|
| 24 | 25 |
<parent>
|
| ... | ... | @@ -47,11 +48,6 @@ |
| 47 | 48 |
</dependency>
|
| 48 | 49 |
<dependency>
|
| 49 | 50 |
<groupId>${project.groupId}</groupId>
|
| 50 |
- <artifactId>t3-actions</artifactId>
|
|
| 51 |
- <version>${project.version}</version>
|
|
| 52 |
- </dependency>
|
|
| 53 |
- <dependency>
|
|
| 54 |
- <groupId>${project.groupId}</groupId>
|
|
| 55 | 51 |
<artifactId>t3-msaccess-importer</artifactId>
|
| 56 | 52 |
<version>${project.version}</version>
|
| 57 | 53 |
</dependency>
|
| ... | ... | @@ -68,14 +64,6 @@ |
| 68 | 64 |
<groupId>commons-logging</groupId>
|
| 69 | 65 |
<artifactId>commons-logging</artifactId>
|
| 70 | 66 |
</dependency>
|
| 71 |
- <dependency>
|
|
| 72 |
- <groupId>commons-collections</groupId>
|
|
| 73 |
- <artifactId>commons-collections</artifactId>
|
|
| 74 |
- </dependency>
|
|
| 75 |
- <dependency>
|
|
| 76 |
- <groupId>commons-io</groupId>
|
|
| 77 |
- <artifactId>commons-io</artifactId>
|
|
| 78 |
- </dependency>
|
|
| 79 | 67 |
|
| 80 | 68 |
<dependency>
|
| 81 | 69 |
<groupId>com.google.guava</groupId>
|
| ... | ... | @@ -128,65 +116,7 @@ |
| 128 | 116 |
<artifactId>postgresql</artifactId>
|
| 129 | 117 |
<scope>test</scope>
|
| 130 | 118 |
</dependency>
|
| 131 |
-
|
|
| 119 |
+ |
|
| 132 | 120 |
</dependencies>
|
| 133 | 121 |
|
| 134 |
- <build>
|
|
| 135 |
- <pluginManagement>
|
|
| 136 |
- <plugins>
|
|
| 137 |
- <plugin>
|
|
| 138 |
- <artifactId>maven-surefire-plugin</artifactId>
|
|
| 139 |
- <configuration>
|
|
| 140 |
- <environmentVariables>
|
|
| 141 |
- <doAccessImport>${doAccessImport}</doAccessImport>
|
|
| 142 |
- <executeAll>${executeAll}</executeAll>
|
|
| 143 |
- <lastYear>${lastYear}</lastYear>
|
|
| 144 |
- <exactYear>${exactYear}</exactYear>
|
|
| 145 |
- <!--<jvm>-Xmx2048m</jvm>-->
|
|
| 146 |
- </environmentVariables>
|
|
| 147 |
- </configuration>
|
|
| 148 |
- </plugin>
|
|
| 149 |
- </plugins>
|
|
| 150 |
- </pluginManagement>
|
|
| 151 |
- </build>
|
|
| 152 |
- |
|
| 153 |
- <profiles>
|
|
| 154 |
- |
|
| 155 |
- <profile>
|
|
| 156 |
- <id>run-access-its</id>
|
|
| 157 |
- <activation>
|
|
| 158 |
- <property>
|
|
| 159 |
- <name>performRelease</name>
|
|
| 160 |
- <value>true</value>
|
|
| 161 |
- </property>
|
|
| 162 |
- </activation>
|
|
| 163 |
- <build>
|
|
| 164 |
- |
|
| 165 |
- <defaultGoal>integration-test</defaultGoal>
|
|
| 166 |
- <plugins>
|
|
| 167 |
- |
|
| 168 |
- <plugin>
|
|
| 169 |
- <artifactId>maven-surefire-plugin</artifactId>
|
|
| 170 |
- <executions>
|
|
| 171 |
- |
|
| 172 |
- <execution>
|
|
| 173 |
- <id>all-integration-tests</id>
|
|
| 174 |
- <phase>integration-test</phase>
|
|
| 175 |
- <goals>
|
|
| 176 |
- <goal>test</goal>
|
|
| 177 |
- </goals>
|
|
| 178 |
- <configuration>
|
|
| 179 |
- <skip>${skipITs}</skip>
|
|
| 180 |
- <includes>
|
|
| 181 |
- <include>**/*IT.java</include>
|
|
| 182 |
- </includes>
|
|
| 183 |
- </configuration>
|
|
| 184 |
- </execution>
|
|
| 185 |
- </executions>
|
|
| 186 |
- </plugin>
|
|
| 187 |
- </plugins>
|
|
| 188 |
- </build>
|
|
| 189 |
- </profile>
|
|
| 190 |
- |
|
| 191 |
- </profiles>
|
|
| 192 | 122 |
</project>
|
| 1 |
-/*
|
|
| 2 |
- * #%L
|
|
| 3 |
- * T3 :: Input AVDTH v 33
|
|
| 4 |
- * %%
|
|
| 5 |
- * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
- * %%
|
|
| 7 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 8 |
- * it under the terms of the GNU Affero General Public License as published by
|
|
| 9 |
- * the Free Software Foundation, either version 3 of the License, or
|
|
| 10 |
- * (at your option) any later version.
|
|
| 11 |
- *
|
|
| 12 |
- * This program is distributed in the hope that it will be useful,
|
|
| 13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
- * GNU General Public License for more details.
|
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU Affero General Public License
|
|
| 18 |
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
| 19 |
- * #L%
|
|
| 20 |
- */
|
|
| 21 |
-package fr.ird.t3.actions.io.input.it;
|
|
| 22 |
- |
|
| 23 |
-import fr.ird.t3.actions.T3Action;
|
|
| 24 |
-import fr.ird.t3.actions.T3ActionContext;
|
|
| 25 |
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
|
|
| 26 |
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceConfiguration;
|
|
| 27 |
-import fr.ird.t3.actions.io.input.test.FakeT3AvdthServiceContext;
|
|
| 28 |
-import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
|
|
| 29 |
-import fr.ird.t3.entities.data.Trip;
|
|
| 30 |
-import fr.ird.t3.entities.data.TripType;
|
|
| 31 |
-import fr.ird.t3.io.input.T3InputProvider;
|
|
| 32 |
-import fr.ird.t3.io.input.avdth.v33.T3InputProviderAvdth33;
|
|
| 33 |
-import fr.ird.t3.services.T3InputService;
|
|
| 34 |
-import fr.ird.t3.services.T3ServiceFactory;
|
|
| 35 |
-import org.apache.commons.collections.CollectionUtils;
|
|
| 36 |
-import org.apache.commons.io.FileUtils;
|
|
| 37 |
-import org.apache.commons.logging.Log;
|
|
| 38 |
-import org.apache.commons.logging.LogFactory;
|
|
| 39 |
-import org.junit.After;
|
|
| 40 |
-import org.junit.Assert;
|
|
| 41 |
-import org.junit.Assume;
|
|
| 42 |
-import org.junit.Before;
|
|
| 43 |
-import org.junit.Rule;
|
|
| 44 |
-import org.junit.Test;
|
|
| 45 |
- |
|
| 46 |
-import java.io.BufferedWriter;
|
|
| 47 |
-import java.io.File;
|
|
| 48 |
-import java.io.FileOutputStream;
|
|
| 49 |
-import java.io.OutputStreamWriter;
|
|
| 50 |
-import java.util.List;
|
|
| 51 |
-import java.util.Set;
|
|
| 52 |
- |
|
| 53 |
-/**
|
|
| 54 |
- * Tests the action {@link AnalyzeInputSourceAction}.
|
|
| 55 |
- *
|
|
| 56 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 57 |
- * @since 1.0
|
|
| 58 |
- */
|
|
| 59 |
-public class AnalyzeInputSourceActionIT implements T3AVDTHV33Test {
|
|
| 60 |
- |
|
| 61 |
- /** Logger */
|
|
| 62 |
- private static final Log log = LogFactory.getLog(AnalyzeInputSourceActionIT.class);
|
|
| 63 |
- protected static boolean useWells;
|
|
| 64 |
- protected BufferedWriter outputWriter;
|
|
| 65 |
- private final MSAccessTestConfiguration msConfig = new MSAccessTestConfiguration("testExecute_([^_]*)_(.*)", "%s_%s_V33.mdb", T3InputProviderAvdth33.ID);
|
|
| 66 |
- @Rule
|
|
| 67 |
- public final FakeT3AvdthServiceContext serviceContext = new FakeT3AvdthServiceContext(true, msConfig);
|
|
| 68 |
- private File target;
|
|
| 69 |
- |
|
| 70 |
- private T3InputProvider inputProvider;
|
|
| 71 |
- |
|
| 72 |
- @Before
|
|
| 73 |
- public void setUp() throws Exception {
|
|
| 74 |
- |
|
| 75 |
- boolean initOk = serviceContext.isInitOk();
|
|
| 76 |
- Assume.assumeTrue("Could not init db", initOk);
|
|
| 77 |
- |
|
| 78 |
- boolean doIt = msConfig.setup(serviceContext.getTestName());
|
|
| 79 |
- |
|
| 80 |
- if (doIt) {
|
|
| 81 |
- |
|
| 82 |
- String dbName = msConfig.dbName;
|
|
| 83 |
- |
|
| 84 |
- if (log.isDebugEnabled()) {
|
|
| 85 |
- log.debug("Do test for db " + dbName);
|
|
| 86 |
- }
|
|
| 87 |
- |
|
| 88 |
- File outputFile = new File(serviceContext.getTestDir(), "result.txt");
|
|
| 89 |
- |
|
| 90 |
- if (log.isInfoEnabled()) {
|
|
| 91 |
- log.info("Will save result in file : " + outputFile);
|
|
| 92 |
- }
|
|
| 93 |
- |
|
| 94 |
- outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
|
|
| 95 |
- |
|
| 96 |
- File workingDirectory =
|
|
| 97 |
- serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
|
|
| 98 |
- |
|
| 99 |
- // push in treatment directory the base to import
|
|
| 100 |
- |
|
| 101 |
- target = new File(workingDirectory, dbName);
|
|
| 102 |
- if (log.isDebugEnabled()) {
|
|
| 103 |
- log.debug("Will copy msaccess from " + msConfig.accessFile + " to " + target);
|
|
| 104 |
- }
|
|
| 105 |
- FileUtils.copyFile(msConfig.accessFile, target);
|
|
| 106 |
- |
|
| 107 |
- inputProvider = serviceContext.newService(T3InputService.class).getProvider(T3InputProviderAvdth33.ID);
|
|
| 108 |
- }
|
|
| 109 |
- |
|
| 110 |
- }
|
|
| 111 |
- |
|
| 112 |
- @After
|
|
| 113 |
- public void tearDown() throws Exception {
|
|
| 114 |
- |
|
| 115 |
- serviceContext.close();
|
|
| 116 |
- |
|
| 117 |
- if (outputWriter != null) {
|
|
| 118 |
- |
|
| 119 |
- outputWriter.flush();
|
|
| 120 |
- outputWriter.close();
|
|
| 121 |
- |
|
| 122 |
- }
|
|
| 123 |
- }
|
|
| 124 |
- |
|
| 125 |
- public void testExecute(int nbSafe,
|
|
| 126 |
- int nbUnsafe,
|
|
| 127 |
- int nbSafeWithoutWell,
|
|
| 128 |
- int nbUnsafeWithoutWell) throws Exception {
|
|
| 129 |
- testExecute(
|
|
| 130 |
- nbSafe,
|
|
| 131 |
- nbUnsafe,
|
|
| 132 |
- nbSafeWithoutWell,
|
|
| 133 |
- nbUnsafeWithoutWell,
|
|
| 134 |
- TripType.STANDARD,
|
|
| 135 |
- false,
|
|
| 136 |
- false
|
|
| 137 |
- );
|
|
| 138 |
- }
|
|
| 139 |
- |
|
| 140 |
- public void testExecute(int nbSafe,
|
|
| 141 |
- int nbUnsafe,
|
|
| 142 |
- int nbSafeWithoutWell,
|
|
| 143 |
- int nbUnsafeWithoutWell,
|
|
| 144 |
- TripType tripType,
|
|
| 145 |
- boolean canCreateVessel,
|
|
| 146 |
- boolean createVirtualVessel) throws Exception {
|
|
| 147 |
- |
|
| 148 |
- if (msConfig.doTest(serviceContext.getTestName())) {
|
|
| 149 |
- |
|
| 150 |
- T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
|
| 151 |
- |
|
| 152 |
- AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
|
| 153 |
- inputProvider, target, useWells, tripType, canCreateVessel, createVirtualVessel
|
|
| 154 |
- );
|
|
| 155 |
- T3ActionContext<AnalyzeInputSourceConfiguration> context =
|
|
| 156 |
- serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
|
|
| 157 |
- |
|
| 158 |
- |
|
| 159 |
- outputWriter.write("----------------------------------------------------\n");
|
|
| 160 |
- outputWriter.write(msConfig.accessFile + "\n");
|
|
| 161 |
- T3Action<AnalyzeInputSourceConfiguration> action;
|
|
| 162 |
- |
|
| 163 |
- action = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, context);
|
|
| 164 |
- |
|
| 165 |
- Assert.assertNotNull(action);
|
|
| 166 |
- |
|
| 167 |
- action.run();
|
|
| 168 |
- |
|
| 169 |
- Set<Trip> safeTrips = action.getResultAsSet(
|
|
| 170 |
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
|
|
| 171 |
- Trip.class
|
|
| 172 |
- );
|
|
| 173 |
- Assert.assertNotNull(safeTrips);
|
|
| 174 |
- outputWriter.write("found " + safeTrips.size() + " safe trip(s).\n");
|
|
| 175 |
- Set<Trip> unsafeTrips = action.getResultAsSet(
|
|
| 176 |
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
|
|
| 177 |
- Trip.class
|
|
| 178 |
- );
|
|
| 179 |
- Assert.assertNotNull(unsafeTrips);
|
|
| 180 |
- outputWriter.write("found " + unsafeTrips.size() + " unsafe trip(s).\n");
|
|
| 181 |
- List<String> messages;
|
|
| 182 |
- |
|
| 183 |
- if (log.isWarnEnabled()) {
|
|
| 184 |
- messages = action.getWarnMessages();
|
|
| 185 |
- if (CollectionUtils.isNotEmpty(messages)) {
|
|
| 186 |
- for (String message : messages) {
|
|
| 187 |
- outputWriter.write("[WARNING] " + message + "\n");
|
|
| 188 |
- }
|
|
| 189 |
- }
|
|
| 190 |
- }
|
|
| 191 |
- |
|
| 192 |
- if (log.isErrorEnabled()) {
|
|
| 193 |
- messages = action.getErrorMessages();
|
|
| 194 |
- if (CollectionUtils.isNotEmpty(messages)) {
|
|
| 195 |
- for (String message : messages) {
|
|
| 196 |
- outputWriter.write("[ERROR] " + message + "\n");
|
|
| 197 |
- }
|
|
| 198 |
- }
|
|
| 199 |
- }
|
|
| 200 |
- |
|
| 201 |
- if (log.isInfoEnabled()) {
|
|
| 202 |
- log.info("\n[" + msConfig.dbName + "] safe : " + safeTrips.size() +
|
|
| 203 |
- " - unsafe : " + unsafeTrips.size() + "\n");
|
|
| 204 |
- }
|
|
| 205 |
- |
|
| 206 |
- if (useWells) {
|
|
| 207 |
- Assert.assertEquals(nbSafe, safeTrips.size());
|
|
| 208 |
- Assert.assertEquals(nbUnsafe, unsafeTrips.size());
|
|
| 209 |
- } else {
|
|
| 210 |
- Assert.assertEquals(nbSafeWithoutWell, safeTrips.size());
|
|
| 211 |
- Assert.assertEquals(nbUnsafeWithoutWell, unsafeTrips.size());
|
|
| 212 |
- }
|
|
| 213 |
- |
|
| 214 |
- }
|
|
| 215 |
- |
|
| 216 |
- |
|
| 217 |
- }
|
|
| 218 |
- |
|
| 219 |
- public void testExecute(int nbSafe, int nbUnsafe) throws Exception {
|
|
| 220 |
- testExecute(nbSafe, nbUnsafe, nbSafe, nbUnsafe);
|
|
| 221 |
- }
|
|
| 222 |
- |
|
| 223 |
- @Test
|
|
| 224 |
- @Override
|
|
| 225 |
- public void testExecute_OI_2000() throws Exception {
|
|
| 226 |
- testExecute(155, 65, 220, 0);
|
|
| 227 |
- }
|
|
| 228 |
- |
|
| 229 |
- @Test
|
|
| 230 |
- @Override
|
|
| 231 |
- public void testExecute_OI_2001() throws Exception {
|
|
| 232 |
- testExecute(70, 118, 188, 0);
|
|
| 233 |
- }
|
|
| 234 |
- |
|
| 235 |
- @Test
|
|
| 236 |
- @Override
|
|
| 237 |
- public void testExecute_OI_2002() throws Exception {
|
|
| 238 |
- testExecute(103, 125, 227, 1);
|
|
| 239 |
- }
|
|
| 240 |
- |
|
| 241 |
- @Test
|
|
| 242 |
- @Override
|
|
| 243 |
- public void testExecute_OI_2003() throws Exception {
|
|
| 244 |
- testExecute(83, 136, 219, 0);
|
|
| 245 |
- }
|
|
| 246 |
- |
|
| 247 |
- @Test
|
|
| 248 |
- @Override
|
|
| 249 |
- public void testExecute_OI_2004() throws Exception {
|
|
| 250 |
- testExecute(78, 118, 196, 0);
|
|
| 251 |
- }
|
|
| 252 |
- |
|
| 253 |
- @Test
|
|
| 254 |
- @Override
|
|
| 255 |
- public void testExecute_OI_2005() throws Exception {
|
|
| 256 |
- testExecute(78, 110, 186, 2);
|
|
| 257 |
- }
|
|
| 258 |
- |
|
| 259 |
- @Test
|
|
| 260 |
- @Override
|
|
| 261 |
- public void testExecute_OI_2006() throws Exception {
|
|
| 262 |
- testExecute(181, 12, 188, 5);
|
|
| 263 |
- }
|
|
| 264 |
- |
|
| 265 |
- @Test
|
|
| 266 |
- @Override
|
|
| 267 |
- public void testExecute_OI_2007() throws Exception {
|
|
| 268 |
- testExecute(155, 12, 162, 5);
|
|
| 269 |
- }
|
|
| 270 |
- |
|
| 271 |
- @Test
|
|
| 272 |
- @Override
|
|
| 273 |
- public void testExecute_OI_2008() throws Exception {
|
|
| 274 |
- testExecute(146, 34, 174, 6);
|
|
| 275 |
- }
|
|
| 276 |
- |
|
| 277 |
- @Test
|
|
| 278 |
- @Override
|
|
| 279 |
- public void testExecute_OI_2009() throws Exception {
|
|
| 280 |
- testExecute(122, 19, 141, 0);
|
|
| 281 |
- }
|
|
| 282 |
- |
|
| 283 |
- @Test
|
|
| 284 |
- @Override
|
|
| 285 |
- public void testExecute_OI_2011() throws Exception {
|
|
| 286 |
- testExecute(141, 0, 126, 0);
|
|
| 287 |
- }
|
|
| 288 |
- |
|
| 289 |
- @Test
|
|
| 290 |
- @Override
|
|
| 291 |
- public void testExecute_ATL_2000() throws Exception {
|
|
| 292 |
- testExecute(318, 36, 354, 0);
|
|
| 293 |
- }
|
|
| 294 |
- |
|
| 295 |
- @Test
|
|
| 296 |
- @Override
|
|
| 297 |
- public void testExecute_ATL_2001() throws Exception {
|
|
| 298 |
- testExecute(298, 63, 361, 0);
|
|
| 299 |
- }
|
|
| 300 |
- |
|
| 301 |
- @Test
|
|
| 302 |
- @Override
|
|
| 303 |
- public void testExecute_ATL_2002() throws Exception {
|
|
| 304 |
- testExecute(184, 133, 317, 0);
|
|
| 305 |
- }
|
|
| 306 |
- |
|
| 307 |
- @Test
|
|
| 308 |
- @Override
|
|
| 309 |
- public void testExecute_ATL_2003() throws Exception {
|
|
| 310 |
- testExecute(218, 157, 375, 0);
|
|
| 311 |
- }
|
|
| 312 |
- |
|
| 313 |
- @Test
|
|
| 314 |
- @Override
|
|
| 315 |
- public void testExecute_ATL_2004() throws Exception {
|
|
| 316 |
- testExecute(121, 61, 182, 0);
|
|
| 317 |
- }
|
|
| 318 |
- |
|
| 319 |
- @Test
|
|
| 320 |
- @Override
|
|
| 321 |
- public void testExecute_ATL_2005() throws Exception {
|
|
| 322 |
- testExecute(93, 31, 124, 0);
|
|
| 323 |
- }
|
|
| 324 |
- |
|
| 325 |
- @Test
|
|
| 326 |
- @Override
|
|
| 327 |
- public void testExecute_ATL_2006() throws Exception {
|
|
| 328 |
- testExecute(70, 27, 97, 0);
|
|
| 329 |
- }
|
|
| 330 |
- |
|
| 331 |
- @Test
|
|
| 332 |
- @Override
|
|
| 333 |
- public void testExecute_ATL_2007() throws Exception {
|
|
| 334 |
- testExecute(53, 27, 80, 0);
|
|
| 335 |
- }
|
|
| 336 |
- |
|
| 337 |
- @Test
|
|
| 338 |
- @Override
|
|
| 339 |
- public void testExecute_ATL_2008() throws Exception {
|
|
| 340 |
- testExecute(46, 14, 60, 0);
|
|
| 341 |
- }
|
|
| 342 |
- |
|
| 343 |
- @Test
|
|
| 344 |
- @Override
|
|
| 345 |
- public void testExecute_ATL_2009() throws Exception {
|
|
| 346 |
- testExecute(64, 21, 85, 0);
|
|
| 347 |
- }
|
|
| 348 |
- |
|
| 349 |
- @Test
|
|
| 350 |
- @Override
|
|
| 351 |
- public void testExecute_ATL_2010() throws Exception {
|
|
| 352 |
- testExecute(75, 13, 80, 8);
|
|
| 353 |
- }
|
|
| 354 |
- |
|
| 355 |
- @Test
|
|
| 356 |
- @Override
|
|
| 357 |
- public void testExecute_ESATL_2006() throws Exception {
|
|
| 358 |
- testExecute(70, 27, 97, 0, TripType.SAMPLEONLY, true, true);
|
|
| 359 |
- }
|
|
| 360 |
- |
|
| 361 |
- @Test
|
|
| 362 |
- @Override
|
|
| 363 |
- public void testExecute_ESATL_2007() throws Exception {
|
|
| 364 |
- testExecute(273, 27, 238, 0, TripType.SAMPLEONLY, true, true);
|
|
| 365 |
- }
|
|
| 366 |
- |
|
| 367 |
- @Test
|
|
| 368 |
- @Override
|
|
| 369 |
- public void testExecute_ESATL_2008() throws Exception {
|
|
| 370 |
- testExecute(46, 14, 60, 0, TripType.SAMPLEONLY, true, true);
|
|
| 371 |
- }
|
|
| 372 |
- |
|
| 373 |
- @Test
|
|
| 374 |
- @Override
|
|
| 375 |
- public void testExecute_ESATL_2009() throws Exception {
|
|
| 376 |
- testExecute(64, 21, 85, 0, TripType.SAMPLEONLY, true, true);
|
|
| 377 |
- }
|
|
| 378 |
- |
|
| 379 |
- @Test
|
|
| 380 |
- @Override
|
|
| 381 |
- public void testExecute_ESATL_2010() throws Exception {
|
|
| 382 |
- testExecute(75, 13, 80, 8, TripType.SAMPLEONLY, true, true);
|
|
| 383 |
- }
|
|
| 384 |
-}
|
| 1 |
-/*
|
|
| 2 |
- * #%L
|
|
| 3 |
- * T3 :: Input AVDTH v 33
|
|
| 4 |
- * %%
|
|
| 5 |
- * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
- * %%
|
|
| 7 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 8 |
- * it under the terms of the GNU Affero General Public License as published by
|
|
| 9 |
- * the Free Software Foundation, either version 3 of the License, or
|
|
| 10 |
- * (at your option) any later version.
|
|
| 11 |
- *
|
|
| 12 |
- * This program is distributed in the hope that it will be useful,
|
|
| 13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
- * GNU General Public License for more details.
|
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU Affero General Public License
|
|
| 18 |
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
| 19 |
- * #L%
|
|
| 20 |
- */
|
|
| 21 |
-package fr.ird.t3.actions.io.input.it;
|
|
| 22 |
- |
|
| 23 |
-import fr.ird.t3.actions.T3ActionContext;
|
|
| 24 |
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
|
|
| 25 |
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceConfiguration;
|
|
| 26 |
-import fr.ird.t3.actions.io.input.ImportInputSourceAction;
|
|
| 27 |
-import fr.ird.t3.actions.io.input.ImportInputSourceConfiguration;
|
|
| 28 |
-import fr.ird.t3.actions.io.input.test.FakeT3AvdthServiceContext;
|
|
| 29 |
-import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
|
|
| 30 |
-import fr.ird.t3.entities.data.Trip;
|
|
| 31 |
-import fr.ird.t3.entities.data.TripType;
|
|
| 32 |
-import fr.ird.t3.io.input.T3InputProvider;
|
|
| 33 |
-import fr.ird.t3.io.input.avdth.v33.T3InputProviderAvdth33;
|
|
| 34 |
-import fr.ird.t3.services.T3InputService;
|
|
| 35 |
-import fr.ird.t3.services.T3ServiceFactory;
|
|
| 36 |
-import org.apache.commons.io.FileUtils;
|
|
| 37 |
-import org.apache.commons.logging.Log;
|
|
| 38 |
-import org.apache.commons.logging.LogFactory;
|
|
| 39 |
-import org.junit.After;
|
|
| 40 |
-import org.junit.Assert;
|
|
| 41 |
-import org.junit.Assume;
|
|
| 42 |
-import org.junit.Before;
|
|
| 43 |
-import org.junit.Rule;
|
|
| 44 |
-import org.junit.Test;
|
|
| 45 |
- |
|
| 46 |
-import java.io.File;
|
|
| 47 |
-import java.util.Set;
|
|
| 48 |
- |
|
| 49 |
-/**
|
|
| 50 |
- * Tests the action {@link AnalyzeInputSourceAction}.
|
|
| 51 |
- *
|
|
| 52 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 53 |
- * @since 1.0
|
|
| 54 |
- */
|
|
| 55 |
-public class ImportInputSourceActionIT implements T3AVDTHV33Test {
|
|
| 56 |
- |
|
| 57 |
- /** Logger */
|
|
| 58 |
- private static final Log log =
|
|
| 59 |
- LogFactory.getLog(ImportInputSourceActionIT.class);
|
|
| 60 |
- |
|
| 61 |
- private static final MSAccessTestConfiguration msConfig = new MSAccessTestConfiguration("testExecute_([^_]*)_(.*)", "%s_%s_V33.mdb", T3InputProviderAvdth33.ID);
|
|
| 62 |
- |
|
| 63 |
- @Rule
|
|
| 64 |
- public final FakeT3AvdthServiceContext serviceContext = new FakeT3AvdthServiceContext(true, msConfig);
|
|
| 65 |
- |
|
| 66 |
- private T3InputProvider inputProvider;
|
|
| 67 |
- |
|
| 68 |
- private File target;
|
|
| 69 |
- |
|
| 70 |
- @Before
|
|
| 71 |
- public void setUp() throws Exception {
|
|
| 72 |
- |
|
| 73 |
- boolean initOk = serviceContext.isInitOk();
|
|
| 74 |
- Assume.assumeTrue("Could not init db", initOk);
|
|
| 75 |
- |
|
| 76 |
- boolean doIt = msConfig.setup(serviceContext.getTestName());
|
|
| 77 |
- Assume.assumeTrue("Could not init msaccess configuration", doIt);
|
|
| 78 |
- |
|
| 79 |
- String dbName = msConfig.dbName;
|
|
| 80 |
- |
|
| 81 |
- if (log.isDebugEnabled()) {
|
|
| 82 |
- log.debug("Do test for db " + dbName);
|
|
| 83 |
- }
|
|
| 84 |
- |
|
| 85 |
- File workingDirectory =
|
|
| 86 |
- serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
|
|
| 87 |
- |
|
| 88 |
- // push in treatment directory the base to import
|
|
| 89 |
- |
|
| 90 |
- target = new File(workingDirectory, dbName);
|
|
| 91 |
- if (log.isDebugEnabled()) {
|
|
| 92 |
- log.debug("Will copy msaccess from " + msConfig.accessFile + " to " + target);
|
|
| 93 |
- }
|
|
| 94 |
- FileUtils.copyFile(msConfig.accessFile, target);
|
|
| 95 |
- |
|
| 96 |
- inputProvider = serviceContext.newService(T3InputService.class).getProvider(msConfig.getProviderId());
|
|
| 97 |
- |
|
| 98 |
- }
|
|
| 99 |
- |
|
| 100 |
- @After
|
|
| 101 |
- public void tearDown() {
|
|
| 102 |
- |
|
| 103 |
- serviceContext.close();
|
|
| 104 |
- }
|
|
| 105 |
- |
|
| 106 |
- public void testExecute(int nbSafe, int nbUnsafe) throws Exception {
|
|
| 107 |
- testExecute(nbSafe, nbUnsafe, TripType.STANDARD, false, false);
|
|
| 108 |
- }
|
|
| 109 |
- |
|
| 110 |
- public void testExecute(int nbSafe, int nbUnsafe,
|
|
| 111 |
- TripType tripType,
|
|
| 112 |
- boolean canCreateVessel,
|
|
| 113 |
- boolean createVirtualVessel) throws Exception {
|
|
| 114 |
- |
|
| 115 |
- if (msConfig.doTest(serviceContext.getTestName())) {
|
|
| 116 |
- |
|
| 117 |
- AnalyzeInputSourceConfiguration analyzeActionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
|
|
| 118 |
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel
|
|
| 119 |
- );
|
|
| 120 |
- |
|
| 121 |
- T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
|
|
| 122 |
- |
|
| 123 |
- T3ActionContext<AnalyzeInputSourceConfiguration> analyzeContext =
|
|
| 124 |
- serviceFactory.newT3ActionContext(analyzeActionConfiguration, serviceContext);
|
|
| 125 |
- |
|
| 126 |
- AnalyzeInputSourceAction analyzeAction;
|
|
| 127 |
- |
|
| 128 |
- analyzeAction = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, analyzeContext);
|
|
| 129 |
- |
|
| 130 |
- Assert.assertNotNull(analyzeAction);
|
|
| 131 |
- analyzeAction.run();
|
|
| 132 |
- |
|
| 133 |
- Set<Trip> safeTrips = analyzeAction.getResultAsSet(
|
|
| 134 |
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
|
|
| 135 |
- Trip.class
|
|
| 136 |
- );
|
|
| 137 |
- Assert.assertNotNull(safeTrips);
|
|
| 138 |
- Assert.assertEquals(nbSafe, safeTrips.size());
|
|
| 139 |
- |
|
| 140 |
- Set<Trip> unsafeTrips = analyzeAction.getResultAsSet(
|
|
| 141 |
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
|
|
| 142 |
- Trip.class
|
|
| 143 |
- );
|
|
| 144 |
- Assert.assertNotNull(unsafeTrips);
|
|
| 145 |
- Assert.assertEquals(nbUnsafe, unsafeTrips.size());
|
|
| 146 |
- |
|
| 147 |
- if (log.isInfoEnabled()) {
|
|
| 148 |
- log.info("[" + msConfig.dbName + "] safe : " + safeTrips.size() + " - unsafe : " + unsafeTrips.size());
|
|
| 149 |
- }
|
|
| 150 |
- |
|
| 151 |
- ImportInputSourceConfiguration importActionConfiguration = ImportInputSourceConfiguration.newConfiguration(
|
|
| 152 |
- analyzeActionConfiguration
|
|
| 153 |
- );
|
|
| 154 |
- importActionConfiguration.setTripsToImport(safeTrips);
|
|
| 155 |
- |
|
| 156 |
- T3ActionContext<ImportInputSourceConfiguration> importContext =
|
|
| 157 |
- serviceFactory.newT3ActionContext(importActionConfiguration, serviceContext);
|
|
| 158 |
- |
|
| 159 |
- // input db is safe, import it in h2 db
|
|
| 160 |
- |
|
| 161 |
- long oldNbTrips;
|
|
| 162 |
- long newNbTrips;
|
|
| 163 |
- |
|
| 164 |
- importActionConfiguration.setTripsToImport(safeTrips);
|
|
| 165 |
- |
|
| 166 |
- oldNbTrips = serviceContext.getT3TopiaPersistenceContext().get().getTripDao().count();
|
|
| 167 |
- |
|
| 168 |
- ImportInputSourceAction importAction =
|
|
| 169 |
- serviceFactory.newT3Action(ImportInputSourceAction.class, importContext);
|
|
| 170 |
- |
|
| 171 |
- importAction.run();
|
|
| 172 |
- |
|
| 173 |
- newNbTrips = serviceContext.getT3TopiaPersistenceContext().get().getTripDao().count();
|
|
| 174 |
- |
|
| 175 |
- Assert.assertEquals(oldNbTrips + safeTrips.size(), newNbTrips);
|
|
| 176 |
- |
|
| 177 |
- }
|
|
| 178 |
- |
|
| 179 |
- |
|
| 180 |
- }
|
|
| 181 |
- |
|
| 182 |
- @Override
|
|
| 183 |
- @Test
|
|
| 184 |
- public void testExecute_ATL_2000() throws Exception {
|
|
| 185 |
- testExecute(347, 7);
|
|
| 186 |
- }
|
|
| 187 |
- |
|
| 188 |
- @Override
|
|
| 189 |
- @Test
|
|
| 190 |
- public void testExecute_ATL_2001() throws Exception {
|
|
| 191 |
- testExecute(351, 10);
|
|
| 192 |
- }
|
|
| 193 |
- |
|
| 194 |
- @Override
|
|
| 195 |
- @Test
|
|
| 196 |
- public void testExecute_ATL_2002() throws Exception {
|
|
| 197 |
- testExecute(310, 7);
|
|
| 198 |
- }
|
|
| 199 |
- |
|
| 200 |
- @Override
|
|
| 201 |
- @Test
|
|
| 202 |
- public void testExecute_ATL_2003() throws Exception {
|
|
| 203 |
- testExecute(373, 2);
|
|
| 204 |
- }
|
|
| 205 |
- |
|
| 206 |
- @Override
|
|
| 207 |
- @Test
|
|
| 208 |
- public void testExecute_ATL_2004() throws Exception {
|
|
| 209 |
- testExecute(179, 3);
|
|
| 210 |
- }
|
|
| 211 |
- |
|
| 212 |
- @Override
|
|
| 213 |
- @Test
|
|
| 214 |
- public void testExecute_ATL_2005() throws Exception {
|
|
| 215 |
- testExecute(123, 1);
|
|
| 216 |
- }
|
|
| 217 |
- |
|
| 218 |
- @Override
|
|
| 219 |
- @Test
|
|
| 220 |
- public void testExecute_ATL_2006() throws Exception {
|
|
| 221 |
- testExecute(95, 2);
|
|
| 222 |
- }
|
|
| 223 |
- |
|
| 224 |
- @Override
|
|
| 225 |
- @Test
|
|
| 226 |
- public void testExecute_ATL_2007() throws Exception {
|
|
| 227 |
- testExecute(80, 0);
|
|
| 228 |
- }
|
|
| 229 |
- |
|
| 230 |
- @Override
|
|
| 231 |
- @Test
|
|
| 232 |
- public void testExecute_ATL_2008() throws Exception {
|
|
| 233 |
- testExecute(59, 1);
|
|
| 234 |
- }
|
|
| 235 |
- |
|
| 236 |
- @Override
|
|
| 237 |
- @Test
|
|
| 238 |
- public void testExecute_ATL_2009() throws Exception {
|
|
| 239 |
- testExecute(81, 4);
|
|
| 240 |
- }
|
|
| 241 |
- |
|
| 242 |
- @Override
|
|
| 243 |
- @Test
|
|
| 244 |
- public void testExecute_ATL_2010() throws Exception {
|
|
| 245 |
- testExecute(80, 8);
|
|
| 246 |
- }
|
|
| 247 |
- |
|
| 248 |
- @Override
|
|
| 249 |
- @Test
|
|
| 250 |
- public void testExecute_OI_2000() throws Exception {
|
|
| 251 |
- testExecute(217, 3);
|
|
| 252 |
- }
|
|
| 253 |
- |
|
| 254 |
- @Override
|
|
| 255 |
- @Test
|
|
| 256 |
- public void testExecute_OI_2001() throws Exception {
|
|
| 257 |
- testExecute(169, 19);
|
|
| 258 |
- }
|
|
| 259 |
- |
|
| 260 |
- @Override
|
|
| 261 |
- @Test
|
|
| 262 |
- public void testExecute_OI_2002() throws Exception {
|
|
| 263 |
- testExecute(116, 112);
|
|
| 264 |
- }
|
|
| 265 |
- |
|
| 266 |
- @Override
|
|
| 267 |
- @Test
|
|
| 268 |
- public void testExecute_OI_2003() throws Exception {
|
|
| 269 |
- testExecute(99, 120);
|
|
| 270 |
- }
|
|
| 271 |
- |
|
| 272 |
- @Override
|
|
| 273 |
- @Test
|
|
| 274 |
- public void testExecute_OI_2004() throws Exception {
|
|
| 275 |
- testExecute(81, 115);
|
|
| 276 |
- }
|
|
| 277 |
- |
|
| 278 |
- @Override
|
|
| 279 |
- @Test
|
|
| 280 |
- public void testExecute_OI_2005() throws Exception {
|
|
| 281 |
- testExecute(78, 110);
|
|
| 282 |
- }
|
|
| 283 |
- |
|
| 284 |
- @Override
|
|
| 285 |
- @Test
|
|
| 286 |
- public void testExecute_OI_2006() throws Exception {
|
|
| 287 |
- testExecute(181, 12);
|
|
| 288 |
- }
|
|
| 289 |
- |
|
| 290 |
- @Override
|
|
| 291 |
- @Test
|
|
| 292 |
- public void testExecute_OI_2007() throws Exception {
|
|
| 293 |
- testExecute(156, 11);
|
|
| 294 |
- }
|
|
| 295 |
- |
|
| 296 |
- @Override
|
|
| 297 |
- @Test
|
|
| 298 |
- public void testExecute_OI_2008() throws Exception {
|
|
| 299 |
- testExecute(148, 32);
|
|
| 300 |
- }
|
|
| 301 |
- |
|
| 302 |
- @Override
|
|
| 303 |
- @Test
|
|
| 304 |
- public void testExecute_OI_2009() throws Exception {
|
|
| 305 |
- testExecute(127, 14);
|
|
| 306 |
- }
|
|
| 307 |
- |
|
| 308 |
- @Test
|
|
| 309 |
- @Override
|
|
| 310 |
- public void testExecute_OI_2011() throws Exception {
|
|
| 311 |
- testExecute(126, 0);
|
|
| 312 |
- }
|
|
| 313 |
- |
|
| 314 |
- @Test
|
|
| 315 |
- @Override
|
|
| 316 |
- public void testExecute_ESATL_2006() throws Exception {
|
|
| 317 |
- testExecute(70, 27, TripType.SAMPLEONLY, true, true);
|
|
| 318 |
- }
|
|
| 319 |
- |
|
| 320 |
- @Test
|
|
| 321 |
- @Override
|
|
| 322 |
- public void testExecute_ESATL_2007() throws Exception {
|
|
| 323 |
- testExecute(53, 27, TripType.SAMPLEONLY, true, true);
|
|
| 324 |
- }
|
|
| 325 |
- |
|
| 326 |
- @Test
|
|
| 327 |
- @Override
|
|
| 328 |
- public void testExecute_ESATL_2008() throws Exception {
|
|
| 329 |
- testExecute(46, 14, TripType.SAMPLEONLY, true, true);
|
|
| 330 |
- }
|
|
| 331 |
- |
|
| 332 |
- @Test
|
|
| 333 |
- @Override
|
|
| 334 |
- public void testExecute_ESATL_2009() throws Exception {
|
|
| 335 |
- testExecute(64, 21, TripType.SAMPLEONLY, true, true);
|
|
| 336 |
- }
|
|
| 337 |
- |
|
| 338 |
- @Test
|
|
| 339 |
- @Override
|
|
| 340 |
- public void testExecute_ESATL_2010() throws Exception {
|
|
| 341 |
- testExecute(75, 13, TripType.SAMPLEONLY, true, true);
|
|
| 342 |
- }
|
|
| 343 |
-}
|
| 1 |
-/*
|
|
| 2 |
- * #%L
|
|
| 3 |
- * T3 :: Input AVDTH v 33
|
|
| 4 |
- * %%
|
|
| 5 |
- * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
- * %%
|
|
| 7 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 8 |
- * it under the terms of the GNU Affero General Public License as published by
|
|
| 9 |
- * the Free Software Foundation, either version 3 of the License, or
|
|
| 10 |
- * (at your option) any later version.
|
|
| 11 |
- *
|
|
| 12 |
- * This program is distributed in the hope that it will be useful,
|
|
| 13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
- * GNU General Public License for more details.
|
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU Affero General Public License
|
|
| 18 |
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
| 19 |
- * #L%
|
|
| 20 |
- */
|
|
| 21 |
-package fr.ird.t3.actions.io.input.it;
|
|
| 22 |
- |
|
| 23 |
-/**
|
|
| 24 |
- * Contract to use for all tests on avdth database
|
|
| 25 |
- *
|
|
| 26 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 27 |
- * @since 1.0
|
|
| 28 |
- */
|
|
| 29 |
-public interface T3AVDTHV33Test {
|
|
| 30 |
- |
|
| 31 |
- void testExecute_OI_2000() throws Exception;
|
|
| 32 |
- |
|
| 33 |
- void testExecute_OI_2001() throws Exception;
|
|
| 34 |
- |
|
| 35 |
- void testExecute_OI_2002() throws Exception;
|
|
| 36 |
- |
|
| 37 |
- void testExecute_OI_2003() throws Exception;
|
|
| 38 |
- |
|
| 39 |
- void testExecute_OI_2004() throws Exception;
|
|
| 40 |
- |
|
| 41 |
- void testExecute_OI_2005() throws Exception;
|
|
| 42 |
- |
|
| 43 |
- void testExecute_OI_2006() throws Exception;
|
|
| 44 |
- |
|
| 45 |
- void testExecute_OI_2007() throws Exception;
|
|
| 46 |
- |
|
| 47 |
- void testExecute_OI_2008() throws Exception;
|
|
| 48 |
- |
|
| 49 |
- void testExecute_OI_2009() throws Exception;
|
|
| 50 |
- |
|
| 51 |
- void testExecute_OI_2011() throws Exception;
|
|
| 52 |
- |
|
| 53 |
- void testExecute_ATL_2000() throws Exception;
|
|
| 54 |
- |
|
| 55 |
- void testExecute_ATL_2001() throws Exception;
|
|
| 56 |
- |
|
| 57 |
- void testExecute_ATL_2002() throws Exception;
|
|
| 58 |
- |
|
| 59 |
- void testExecute_ATL_2003() throws Exception;
|
|
| 60 |
- |
|
| 61 |
- void testExecute_ATL_2004() throws Exception;
|
|
| 62 |
- |
|
| 63 |
- void testExecute_ATL_2005() throws Exception;
|
|
| 64 |
- |
|
| 65 |
- void testExecute_ATL_2006() throws Exception;
|
|
| 66 |
- |
|
| 67 |
- void testExecute_ATL_2007() throws Exception;
|
|
| 68 |
- |
|
| 69 |
- void testExecute_ATL_2008() throws Exception;
|
|
| 70 |
- |
|
| 71 |
- void testExecute_ATL_2009() throws Exception;
|
|
| 72 |
- |
|
| 73 |
- void testExecute_ATL_2010() throws Exception;
|
|
| 74 |
- |
|
| 75 |
- void testExecute_ESATL_2006() throws Exception;
|
|
| 76 |
- |
|
| 77 |
- void testExecute_ESATL_2007() throws Exception;
|
|
| 78 |
- |
|
| 79 |
- void testExecute_ESATL_2008() throws Exception;
|
|
| 80 |
- |
|
| 81 |
- void testExecute_ESATL_2009() throws Exception;
|
|
| 82 |
- |
|
| 83 |
- void testExecute_ESATL_2010() throws Exception;
|
|
| 84 |
-}
|
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| ... | ... | @@ -27,13 +27,14 @@ import fr.ird.t3.entities.data.Trip; |
| 27 | 27 |
import fr.ird.t3.io.input.T3InputProvider;
|
| 28 | 28 |
import fr.ird.t3.services.DecoratorService;
|
| 29 | 29 |
import fr.ird.t3.web.actions.AbstractRunAction;
|
| 30 |
+import org.apache.commons.collections.CollectionUtils;
|
|
| 31 |
+import org.apache.commons.collections.MapUtils;
|
|
| 32 |
+ |
|
| 30 | 33 |
import java.util.Collections;
|
| 31 | 34 |
import java.util.Date;
|
| 32 | 35 |
import java.util.List;
|
| 33 | 36 |
import java.util.Map;
|
| 34 | 37 |
import java.util.Set;
|
| 35 |
-import org.apache.commons.collections.CollectionUtils;
|
|
| 36 |
-import org.apache.commons.collections.MapUtils;
|
|
| 37 | 38 |
|
| 38 | 39 |
/**
|
| 39 | 40 |
* Analyze the given input source.
|
| ... | ... | @@ -45,15 +46,11 @@ public class AnalyzeImportDataAction extends AbstractRunAction<AnalyzeInputSourc |
| 45 | 46 |
|
| 46 | 47 |
private static final long serialVersionUID = 1L;
|
| 47 | 48 |
|
| 48 |
- protected int nbUnsafeTrips;
|
|
| 49 |
- |
|
| 50 |
- protected int nbSafeTrips;
|
|
| 51 |
- |
|
| 52 |
- protected int nbTripsToReplace;
|
|
| 53 |
- |
|
| 54 |
- protected boolean needReplace;
|
|
| 55 |
- |
|
| 56 |
- protected boolean valid;
|
|
| 49 |
+ private int nbUnsafeTrips;
|
|
| 50 |
+ private int nbSafeTrips;
|
|
| 51 |
+ private int nbTripsToReplace;
|
|
| 52 |
+ private boolean needReplace;
|
|
| 53 |
+ private boolean valid;
|
|
| 57 | 54 |
|
| 58 | 55 |
/** List of all known input providers. */
|
| 59 | 56 |
private List<T3InputProvider> inputProviders;
|
| ... | ... | @@ -64,111 +61,75 @@ public class AnalyzeImportDataAction extends AbstractRunAction<AnalyzeInputSourc |
| 64 | 61 |
|
| 65 | 62 |
@Override
|
| 66 | 63 |
public void prepare() throws Exception {
|
| 67 |
- |
|
| 68 | 64 |
getT3Session().removeTripListModel();
|
| 69 |
- |
|
| 70 | 65 |
super.prepare();
|
| 71 |
- |
|
| 72 | 66 |
inputProviders = Collections.singletonList(getConfiguration().getInputProvider());
|
| 73 | 67 |
}
|
| 74 | 68 |
|
| 75 |
- public final List<T3InputProvider> getInputProviders() {
|
|
| 76 |
- return inputProviders;
|
|
| 77 |
- }
|
|
| 78 |
- |
|
| 79 | 69 |
public String prepareResult() {
|
| 80 |
- |
|
| 81 |
- T3ActionContext<AnalyzeInputSourceConfiguration> context =
|
|
| 82 |
- getT3ActionContext();
|
|
| 83 |
- |
|
| 84 |
- Set<Trip> safeTrips = context.getResultAsSet(
|
|
| 85 |
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
|
|
| 86 |
- Trip.class
|
|
| 87 |
- );
|
|
| 70 |
+ T3ActionContext<AnalyzeInputSourceConfiguration> context = getT3ActionContext();
|
|
| 71 |
+ Set<Trip> safeTrips = context.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
|
|
| 88 | 72 |
nbSafeTrips = safeTrips.size();
|
| 89 |
- |
|
| 90 |
- Set<Trip> unsafeTrips = context.getResultAsSet(
|
|
| 91 |
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
|
|
| 92 |
- Trip.class
|
|
| 93 |
- );
|
|
| 73 |
+ Set<Trip> unsafeTrips = context.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
|
|
| 94 | 74 |
nbUnsafeTrips = unsafeTrips.size();
|
| 95 |
- |
|
| 96 |
- boolean canImport = CollectionUtils.isEmpty(unsafeTrips) &&
|
|
| 97 |
- CollectionUtils.isNotEmpty(safeTrips);
|
|
| 98 |
- |
|
| 75 |
+ boolean canImport = CollectionUtils.isEmpty(unsafeTrips) && CollectionUtils.isNotEmpty(safeTrips);
|
|
| 99 | 76 |
// action is valid, only if there is some safe trips and no unsafe trip
|
| 100 | 77 |
valid = canImport;
|
| 101 |
- |
|
| 102 | 78 |
Map<Trip, Trip> tripsToReplace;
|
| 103 |
- |
|
| 104 | 79 |
if (canImport) {
|
| 105 |
- |
|
| 106 | 80 |
// find out if there is some existing trip to re-import
|
| 107 |
- |
|
| 108 |
- tripsToReplace = context.getResultAsMap(
|
|
| 109 |
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
|
|
| 110 |
- );
|
|
| 81 |
+ tripsToReplace = context.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
|
|
| 111 | 82 |
} else {
|
| 112 |
- |
|
| 113 | 83 |
// no trip to replace
|
| 114 | 84 |
tripsToReplace = Collections.emptyMap();
|
| 115 | 85 |
}
|
| 116 |
- |
|
| 117 | 86 |
nbTripsToReplace = tripsToReplace.size();
|
| 118 |
- |
|
| 119 | 87 |
needReplace = MapUtils.isNotEmpty(tripsToReplace);
|
| 120 |
- |
|
| 121 | 88 |
return INPUT;
|
| 122 | 89 |
}
|
| 123 | 90 |
|
| 91 |
+ @Override
|
|
| 92 |
+ protected Map<String, Object> prepareResumeParameters(AnalyzeInputSourceAction action, Exception error, Date startDate, Date endDate) {
|
|
| 93 |
+ Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
|
|
| 94 |
+ T3ActionContext<AnalyzeInputSourceConfiguration> actionContext = getT3ActionContext();
|
|
| 95 |
+ Set<Trip> safeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
|
|
| 96 |
+ map.put(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, safeTrips);
|
|
| 97 |
+ Set<Trip> unsafeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
|
|
| 98 |
+ map.put(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, unsafeTrips);
|
|
| 99 |
+ Map<Trip, Trip> tripsToReplace = actionContext.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
|
|
| 100 |
+ map.put(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE, tripsToReplace);
|
|
| 101 |
+ map.put("tripDecorator", getDecorator(Trip.class));
|
|
| 102 |
+ map.put("tripDecorator2", getDecorator(Trip.class, DecoratorService.WITH_ID));
|
|
| 103 |
+ return map;
|
|
| 104 |
+ }
|
|
| 105 |
+ |
|
| 106 |
+ @SuppressWarnings("unused")
|
|
| 107 |
+ public List<T3InputProvider> getInputProviders() {
|
|
| 108 |
+ return inputProviders;
|
|
| 109 |
+ }
|
|
| 110 |
+ |
|
| 111 |
+ @SuppressWarnings("unused")
|
|
| 124 | 112 |
public int getNbUnsafeTrips() {
|
| 125 | 113 |
return nbUnsafeTrips;
|
| 126 | 114 |
}
|
| 127 | 115 |
|
| 116 |
+ @SuppressWarnings("unused")
|
|
| 128 | 117 |
public int getNbSafeTrips() {
|
| 129 | 118 |
return nbSafeTrips;
|
| 130 | 119 |
}
|
| 131 | 120 |
|
| 121 |
+ @SuppressWarnings("unused")
|
|
| 132 | 122 |
public int getNbTripsToReplace() {
|
| 133 | 123 |
return nbTripsToReplace;
|
| 134 | 124 |
}
|
| 135 | 125 |
|
| 126 |
+ @SuppressWarnings("unused")
|
|
| 136 | 127 |
public boolean isValid() {
|
| 137 | 128 |
return valid;
|
| 138 | 129 |
}
|
| 139 | 130 |
|
| 131 |
+ @SuppressWarnings("unused")
|
|
| 140 | 132 |
public boolean isNeedReplace() {
|
| 141 | 133 |
return needReplace;
|
| 142 | 134 |
}
|
| 143 |
- |
|
| 144 |
- @Override
|
|
| 145 |
- protected Map<String, Object> prepareResumeParameters(AnalyzeInputSourceAction action,
|
|
| 146 |
- Exception error,
|
|
| 147 |
- Date startDate,
|
|
| 148 |
- Date endDate) {
|
|
| 149 |
- Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
|
|
| 150 |
- |
|
| 151 |
- T3ActionContext<AnalyzeInputSourceConfiguration> actionContext = getT3ActionContext();
|
|
| 152 |
- |
|
| 153 |
- Set<Trip> safeTrips = actionContext.getResultAsSet(
|
|
| 154 |
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
|
|
| 155 |
- Trip.class
|
|
| 156 |
- );
|
|
| 157 |
- map.put(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, safeTrips);
|
|
| 158 |
- Set<Trip> unsafeTrips = actionContext.getResultAsSet(
|
|
| 159 |
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
|
|
| 160 |
- Trip.class
|
|
| 161 |
- );
|
|
| 162 |
- map.put(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, unsafeTrips);
|
|
| 163 |
- Map<Trip, Trip> tripsToReplace = actionContext.getResultAsMap(
|
|
| 164 |
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
|
|
| 165 |
- );
|
|
| 166 |
- map.put(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE, tripsToReplace);
|
|
| 167 |
- |
|
| 168 |
- map.put("tripDecorator", getDecorator(Trip.class));
|
|
| 169 |
- |
|
| 170 |
- map.put("tripDecorator2",
|
|
| 171 |
- getDecorator(Trip.class, DecoratorService.WITH_ID));
|
|
| 172 |
- return map;
|
|
| 173 |
- }
|
|
| 174 | 135 |
}
|
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 |
* it under the terms of the GNU Affero General Public License as published by
|
| 9 | 9 |
* the Free Software Foundation, either version 3 of the License, or
|
| 10 | 10 |
* (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 16 |
+ *
|
|
| 17 | 17 |
* You should have received a copy of the GNU Affero General Public License
|
| 18 | 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
* #L%
|
| ... | ... | @@ -55,22 +55,21 @@ import java.util.zip.ZipFile; |
| 55 | 55 |
*/
|
| 56 | 56 |
public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeInputSourceConfiguration> {
|
| 57 | 57 |
|
| 58 |
- // public static final String RELOAD_ACTION = "reload";
|
|
| 59 | 58 |
private static final long serialVersionUID = 1L;
|
| 60 | 59 |
private static final Log log = LogFactory.getLog(ConfigureImportDataAction.class);
|
| 61 | 60 |
|
| 62 |
- /** Input file that was just uploaded on server */
|
|
| 61 |
+ /**
|
|
| 62 |
+ * Input file that was just uploaded on server.
|
|
| 63 |
+ */
|
|
| 63 | 64 |
private File sourceToLoad;
|
| 64 |
- /** Name of file to upload */
|
|
| 65 |
+ /**
|
|
| 66 |
+ * Name of file to upload.
|
|
| 67 |
+ */
|
|
| 65 | 68 |
private String sourceToLoadFileName;
|
| 66 |
- /** flag to use strict mode with wells. */
|
|
| 67 |
- private boolean useWells;
|
|
| 68 | 69 |
/**
|
| 69 |
- * Trip type to use
|
|
| 70 |
- *
|
|
| 71 |
- * @since 2.3
|
|
| 70 |
+ * Flag to use strict mode with wells.
|
|
| 72 | 71 |
*/
|
| 73 |
- private TripType tripType = TripType.STANDARD;
|
|
| 72 |
+ private boolean useWells;
|
|
| 74 | 73 |
/**
|
| 75 | 74 |
* flag to authorize creation of missing vessels.
|
| 76 | 75 |
*
|
| ... | ... | @@ -83,6 +82,24 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn |
| 83 | 82 |
* @since 1.3.1
|
| 84 | 83 |
*/
|
| 85 | 84 |
private boolean createVirtualVessel;
|
| 85 |
+ /**
|
|
| 86 |
+ * Flag to load only samples only trips
|
|
| 87 |
+ *
|
|
| 88 |
+ * @see TripType#SAMPLEONLY
|
|
| 89 |
+ */
|
|
| 90 |
+ private boolean useSamplesOnly;
|
|
| 91 |
+ /**
|
|
| 92 |
+ * Flag to authorize virtual activity creation (when logbooks are missing).
|
|
| 93 |
+ * <p>
|
|
| 94 |
+ * By default, let's always authorize it.
|
|
| 95 |
+ * <p>
|
|
| 96 |
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
|
|
| 97 |
+ *
|
|
| 98 |
+ * @see TripType#LOGBOOKMISSING
|
|
| 99 |
+ * @see TripType#STANDARD
|
|
| 100 |
+ */
|
|
| 101 |
+ private boolean canCreateVirtualActivity;
|
|
| 102 |
+ |
|
| 86 | 103 |
private long maxSize;
|
| 87 | 104 |
/** List of all known input providers. */
|
| 88 | 105 |
private List<T3InputProvider> inputProviders;
|
| ... | ... | @@ -100,139 +117,79 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn |
| 100 | 117 |
super(AnalyzeInputSourceConfiguration.class);
|
| 101 | 118 |
}
|
| 102 | 119 |
|
| 103 |
- public String getMaxSize() {
|
|
| 104 |
- return StringUtil.convertMemory(maxSize);
|
|
| 105 |
- }
|
|
| 106 |
- |
|
| 107 |
- @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
|
|
| 108 |
- public void setMaxSize(String maxSize) {
|
|
| 109 |
- this.maxSize = Long.parseLong(maxSize);
|
|
| 110 |
- }
|
|
| 111 |
- |
|
| 112 | 120 |
@Override
|
| 113 | 121 |
public void prepare() throws Exception {
|
| 114 |
- |
|
| 115 | 122 |
injectOnly(InjectDAO.class);
|
| 116 |
- |
|
| 117 | 123 |
if (!isConfigurationInSession()) {
|
| 118 |
- |
|
| 119 | 124 |
// no yet configuration, can use all input providers
|
| 120 | 125 |
inputProviders = Arrays.asList(getT3InputService().getProviders());
|
| 121 |
- |
|
| 122 | 126 |
} else {
|
| 123 |
- // as soon as there is a configuration, can only use the
|
|
| 124 |
- // inputProvider from it
|
|
| 125 |
- |
|
| 127 |
+ // as soon as there is a configuration, can only use the inputProvider from it
|
|
| 126 | 128 |
inputProviders = Collections.singletonList(getConfiguration().getInputProvider());
|
| 127 | 129 |
}
|
| 128 |
- |
|
| 129 | 130 |
injectOnly(InjectDecoratedBeans.class);
|
| 130 |
- |
|
| 131 | 131 |
if (getTreatmentDirectoryPath() == null) {
|
| 132 |
- |
|
| 133 | 132 |
// first time coming here get a new treatment directory path
|
| 134 |
- |
|
| 135 | 133 |
File workingDirectory = getApplicationConfig().getTreatmentWorkingDirectory();
|
| 136 |
- |
|
| 137 | 134 |
long l = System.nanoTime();
|
| 138 |
- |
|
| 139 | 135 |
File treatmentDirectory = new File(workingDirectory, "importData-" + l);
|
| 140 |
- |
|
| 141 | 136 |
FileUtil.createDirectoryIfNecessary(treatmentDirectory);
|
| 142 |
- |
|
| 143 |
- if (log.isInfoEnabled()) {
|
|
| 144 |
- log.info(String.format("Create a new treatment directory path : %s", treatmentDirectory));
|
|
| 145 |
- }
|
|
| 146 |
- |
|
| 137 |
+ log.info(String.format("Create a new treatment directory path : %s", treatmentDirectory));
|
|
| 147 | 138 |
setTreatmentDirectoryPath(treatmentDirectory.getAbsolutePath());
|
| 148 | 139 |
} else {
|
| 149 |
- |
|
| 150 |
- if (log.isInfoEnabled()) {
|
|
| 151 |
- log.info(String.format("Use existing treatment directory %s", getTreatmentDirectoryPath()));
|
|
| 152 |
- }
|
|
| 140 |
+ log.info(String.format("Use existing treatment directory %s", getTreatmentDirectoryPath()));
|
|
| 153 | 141 |
}
|
| 154 | 142 |
}
|
| 155 | 143 |
|
| 156 | 144 |
public String doAddSource() throws Exception {
|
| 157 |
- |
|
| 158 |
- // this action execution purpose is to add a new source to the
|
|
| 159 |
- // treatment configuration
|
|
| 160 |
- // It will upload the file and place it the correct place (says the
|
|
| 161 |
- // temporary directory of the treatment configuration)
|
|
| 162 |
- |
|
| 163 |
- // file uploaded on server
|
|
| 145 |
+ // this action execution purpose is to add a new source to the treatment configuration
|
|
| 146 |
+ // It will upload the file and place it the correct place (says the temporary directory of the treatment configuration)
|
|
| 164 | 147 |
File upload = getSourceToLoad();
|
| 165 |
- |
|
| 166 | 148 |
if (upload == null) {
|
| 167 |
- |
|
| 168 | 149 |
String message = t("t3.error.required.file.to.upload");
|
| 169 | 150 |
addFieldError("sourceToLoad", message);
|
| 170 | 151 |
log.error(message);
|
| 171 | 152 |
return ERROR;
|
| 172 | 153 |
}
|
| 173 |
- |
|
| 174 | 154 |
// treatment directory
|
| 175 | 155 |
File targetDirectory = getTreatmentDirectory();
|
| 176 |
- |
|
| 177 | 156 |
String filename = getSourceToLoadFileName();
|
| 178 |
- |
|
| 179 | 157 |
if (ZipUtil.isZipFile(upload)) {
|
| 180 |
- |
|
| 181 | 158 |
// let's decompress input stream it
|
| 182 | 159 |
ZipFile zipfile = new ZipFile(upload);
|
| 183 |
- |
|
| 184 | 160 |
Enumeration<? extends ZipEntry> entries = zipfile.entries();
|
| 185 |
- |
|
| 186 | 161 |
if (!entries.hasMoreElements()) {
|
| 187 | 162 |
String message = t("t3.error.required.one.entry.in.zip.to.upload");
|
| 188 | 163 |
addFieldError("sourceToLoad", message);
|
| 189 | 164 |
log.error(message);
|
| 190 | 165 |
return ERROR;
|
| 191 | 166 |
}
|
| 192 |
- |
|
| 193 | 167 |
// get first entry
|
| 194 | 168 |
ZipEntry zipEntry = entries.nextElement();
|
| 195 |
- |
|
| 196 | 169 |
// keep the filename of the zip entry
|
| 197 | 170 |
filename = zipEntry.getName();
|
| 198 |
- |
|
| 199 | 171 |
File target = new File(targetDirectory, filename);
|
| 200 |
- |
|
| 201 |
- if (log.isInfoEnabled()) {
|
|
| 202 |
- log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target));
|
|
| 203 |
- }
|
|
| 172 |
+ log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target));
|
|
| 204 | 173 |
try (InputStream in = zipfile.getInputStream(zipEntry)) {
|
| 205 | 174 |
FileUtils.copyInputStreamToFile(in, target);
|
| 206 | 175 |
}
|
| 207 | 176 |
} else {
|
| 208 |
- |
|
| 209 | 177 |
// target file
|
| 210 | 178 |
File target = new File(targetDirectory, filename);
|
| 211 |
- |
|
| 212 |
- if (log.isInfoEnabled()) {
|
|
| 213 |
- log.info(String.format("Will copy loaded file %s to treatment configuration directory %s", upload, target));
|
|
| 214 |
- }
|
|
| 215 |
- |
|
| 179 |
+ log.info(String.format("Will copy loaded file %s to treatment configuration directory %s", upload, target));
|
|
| 216 | 180 |
// just copy file
|
| 217 | 181 |
FileUtils.copyFile(upload, target);
|
| 218 | 182 |
}
|
| 219 |
- |
|
| 220 | 183 |
// add the new file to the sources
|
| 221 | 184 |
setLoadedSource(filename);
|
| 222 |
- |
|
| 223 | 185 |
// go back to the configuration definition
|
| 224 | 186 |
return INPUT;
|
| 225 | 187 |
}
|
| 226 | 188 |
|
| 227 | 189 |
public String doDeleteSource() throws Exception {
|
| 228 |
- |
|
| 229 | 190 |
String filename = getLoadedSource();
|
| 230 |
- |
|
| 231 | 191 |
File targetDirectory = getTreatmentDirectory();
|
| 232 |
- |
|
| 233 |
- if (log.isInfoEnabled()) {
|
|
| 234 |
- log.info(String.format("Will delete loaded file %s from %s", filename, targetDirectory));
|
|
| 235 |
- }
|
|
| 192 |
+ log.info(String.format("Will delete loaded file %s from %s", filename, targetDirectory));
|
|
| 236 | 193 |
File f = new File(targetDirectory, filename);
|
| 237 | 194 |
if (f.exists()) {
|
| 238 | 195 |
boolean delete = f.delete();
|
| ... | ... | @@ -240,9 +197,7 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn |
| 240 | 197 |
throw new IOException(String.format("Could not delete file %s on server.", f));
|
| 241 | 198 |
}
|
| 242 | 199 |
}
|
| 243 |
- |
|
| 244 | 200 |
setLoadedSource(null);
|
| 245 |
- |
|
| 246 | 201 |
// go back to the configuration definition
|
| 247 | 202 |
return INPUT;
|
| 248 | 203 |
}
|
| ... | ... | @@ -251,107 +206,143 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn |
| 251 | 206 |
T3InputProvider inputProvider = getT3InputService().getProvider(getInputProviderId());
|
| 252 | 207 |
File path = getTreatmentDirectory();
|
| 253 | 208 |
String name = getLoadedSource();
|
| 254 |
- |
|
| 255 | 209 |
File inputFile = new File(path, name);
|
| 256 |
- |
|
| 257 |
- if (log.isInfoEnabled()) {
|
|
| 258 |
- log.info(String.format("Will use input provider : %s", inputProvider));
|
|
| 259 |
- log.info(String.format("Will use input file : %s", inputFile));
|
|
| 260 |
- }
|
|
| 261 |
- |
|
| 262 |
- // prepare a new action configuration
|
|
| 263 |
- configuration = AnalyzeInputSourceConfiguration.newConfiguration(
|
|
| 264 |
- inputProvider,
|
|
| 265 |
- inputFile,
|
|
| 266 |
- useWells,
|
|
| 267 |
- tripType,
|
|
| 268 |
- canCreateVessel,
|
|
| 269 |
- createVirtualVessel);
|
|
| 270 |
- |
|
| 210 |
+ TripType tripType = TripType.getTripType(useSamplesOnly, canCreateVirtualActivity);
|
|
| 211 |
+ log.info(String.format("input provider : %s", inputProvider));
|
|
| 212 |
+ log.info(String.format("input file : %s", inputFile));
|
|
| 213 |
+ log.info(String.format("userWells : %s", useWells));
|
|
| 214 |
+ log.info(String.format("tripType : %s", tripType));
|
|
| 215 |
+ log.info(String.format("canCreateVessel : %s", canCreateVessel));
|
|
| 216 |
+ log.info(String.format("createVirtualVessel : %s", createVirtualVessel));
|
|
| 217 |
+ log.info(String.format("canCreateVirtualActivity : %s", canCreateVirtualActivity));
|
|
| 218 |
+ log.info(String.format("useSamplesOnly : %s", useSamplesOnly));
|
|
| 219 |
+ configuration = AnalyzeInputSourceConfiguration.newConfiguration(inputProvider, inputFile, useWells, canCreateVessel, createVirtualVessel, useSamplesOnly, canCreateVirtualActivity);
|
|
| 271 | 220 |
prepareActionContext();
|
| 272 | 221 |
return SUCCESS;
|
| 273 | 222 |
}
|
| 274 | 223 |
|
| 275 |
- public TripType getTripType() {
|
|
| 276 |
- return tripType;
|
|
| 224 |
+ @SuppressWarnings("unused")
|
|
| 225 |
+ public String getMaxSize() {
|
|
| 226 |
+ return StringUtil.convertMemory(maxSize);
|
|
| 277 | 227 |
}
|
| 278 | 228 |
|
| 279 |
- public void setTripType(TripType tripType) {
|
|
| 280 |
- this.tripType = tripType;
|
|
| 229 |
+ @SuppressWarnings("unused")
|
|
| 230 |
+ @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
|
|
| 231 |
+ public void setMaxSize(String maxSize) {
|
|
| 232 |
+ this.maxSize = Long.parseLong(maxSize);
|
|
| 281 | 233 |
}
|
| 282 | 234 |
|
| 235 |
+ @SuppressWarnings("unused")
|
|
| 283 | 236 |
public Map<String, String> getTripTypes() {
|
| 284 | 237 |
return tripTypes;
|
| 285 | 238 |
}
|
| 286 | 239 |
|
| 240 |
+ @SuppressWarnings("unused")
|
|
| 287 | 241 |
public void setTripTypes(Map<String, String> tripTypes) {
|
| 288 | 242 |
this.tripTypes = tripTypes;
|
| 289 | 243 |
}
|
| 290 | 244 |
|
| 245 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 291 | 246 |
public File getSourceToLoad() {
|
| 292 | 247 |
return sourceToLoad;
|
| 293 | 248 |
}
|
| 294 | 249 |
|
| 250 |
+ @SuppressWarnings("unused")
|
|
| 295 | 251 |
public void setSourceToLoad(File sourceToLoad) {
|
| 296 | 252 |
this.sourceToLoad = sourceToLoad;
|
| 297 | 253 |
}
|
| 298 | 254 |
|
| 255 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 299 | 256 |
public String getSourceToLoadFileName() {
|
| 300 | 257 |
return sourceToLoadFileName;
|
| 301 | 258 |
}
|
| 302 | 259 |
|
| 260 |
+ @SuppressWarnings("unused")
|
|
| 303 | 261 |
public void setSourceToLoadFileName(String sourceToLoadFileName) {
|
| 304 | 262 |
this.sourceToLoadFileName = sourceToLoadFileName;
|
| 305 | 263 |
}
|
| 306 | 264 |
|
| 265 |
+ @SuppressWarnings("unused")
|
|
| 307 | 266 |
public boolean isUseWells() {
|
| 308 | 267 |
return useWells;
|
| 309 | 268 |
}
|
| 310 | 269 |
|
| 270 |
+ @SuppressWarnings("unused")
|
|
| 311 | 271 |
public void setUseWells(boolean useWells) {
|
| 312 | 272 |
this.useWells = useWells;
|
| 313 | 273 |
}
|
| 314 | 274 |
|
| 275 |
+ @SuppressWarnings("unused")
|
|
| 315 | 276 |
public boolean isCanCreateVessel() {
|
| 316 | 277 |
return canCreateVessel;
|
| 317 | 278 |
}
|
| 318 | 279 |
|
| 280 |
+ @SuppressWarnings("unused")
|
|
| 319 | 281 |
public void setCanCreateVessel(boolean canCreateVessel) {
|
| 320 | 282 |
this.canCreateVessel = canCreateVessel;
|
| 321 | 283 |
}
|
| 322 | 284 |
|
| 285 |
+ @SuppressWarnings("unused")
|
|
| 323 | 286 |
public boolean isCreateVirtualVessel() {
|
| 324 | 287 |
return createVirtualVessel;
|
| 325 | 288 |
}
|
| 326 | 289 |
|
| 290 |
+ @SuppressWarnings("unused")
|
|
| 327 | 291 |
public void setCreateVirtualVessel(boolean createVirtualVessel) {
|
| 328 | 292 |
this.createVirtualVessel = createVirtualVessel;
|
| 329 | 293 |
}
|
| 330 | 294 |
|
| 295 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 331 | 296 |
public String getInputProviderId() {
|
| 332 | 297 |
return inputProviderId;
|
| 333 | 298 |
}
|
| 334 | 299 |
|
| 300 |
+ @SuppressWarnings("unused")
|
|
| 335 | 301 |
public void setInputProviderId(String inputProviderId) {
|
| 336 | 302 |
this.inputProviderId = inputProviderId;
|
| 337 | 303 |
}
|
| 338 | 304 |
|
| 305 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 339 | 306 |
public String getLoadedSource() {
|
| 340 | 307 |
return loadedSource;
|
| 341 | 308 |
}
|
| 342 | 309 |
|
| 310 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 343 | 311 |
public void setLoadedSource(String loadedSource) {
|
| 344 | 312 |
this.loadedSource = loadedSource;
|
| 345 | 313 |
}
|
| 346 | 314 |
|
| 315 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 347 | 316 |
public String getTreatmentDirectoryPath() {
|
| 348 | 317 |
return treatmentDirectoryPath;
|
| 349 | 318 |
}
|
| 350 | 319 |
|
| 320 |
+ @SuppressWarnings({"unused", "WeakerAccess"})
|
|
| 351 | 321 |
public void setTreatmentDirectoryPath(String treatmentDirectoryPath) {
|
| 352 | 322 |
this.treatmentDirectoryPath = treatmentDirectoryPath;
|
| 353 | 323 |
}
|
| 354 | 324 |
|
| 325 |
+ @SuppressWarnings("unused")
|
|
| 326 |
+ public boolean isUseSamplesOnly() {
|
|
| 327 |
+ return useSamplesOnly;
|
|
| 328 |
+ }
|
|
| 329 |
+ |
|
| 330 |
+ @SuppressWarnings("unused")
|
|
| 331 |
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
|
|
| 332 |
+ this.useSamplesOnly = useSamplesOnly;
|
|
| 333 |
+ }
|
|
| 334 |
+ |
|
| 335 |
+ @SuppressWarnings("unused")
|
|
| 336 |
+ public boolean isCanCreateVirtualActivity() {
|
|
| 337 |
+ return canCreateVirtualActivity;
|
|
| 338 |
+ }
|
|
| 339 |
+ |
|
| 340 |
+ @SuppressWarnings("unused")
|
|
| 341 |
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
|
|
| 342 |
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
|
|
| 343 |
+ }
|
|
| 344 |
+ |
|
| 345 |
+ @SuppressWarnings("unused")
|
|
| 355 | 346 |
public final List<T3InputProvider> getInputProviders() {
|
| 356 | 347 |
return inputProviders;
|
| 357 | 348 |
}
|
| ... | ... | @@ -49,15 +49,15 @@ import java.util.Set; |
| 49 | 49 |
public class ImportDataAction extends AbstractRunAction<ImportInputSourceConfiguration, ImportInputSourceAction> {
|
| 50 | 50 |
|
| 51 | 51 |
private static final long serialVersionUID = 1L;
|
| 52 |
- |
|
| 53 | 52 |
private static final Log log = LogFactory.getLog(ImportDataAction.class);
|
| 54 | 53 |
|
| 55 | 54 |
private boolean replaceTrip;
|
| 56 | 55 |
private boolean valid;
|
| 57 | 56 |
private int nbImportedTrips;
|
| 58 | 57 |
private int nbDeletedTrips;
|
| 59 |
- |
|
| 60 |
- /** List of all known input providers. */
|
|
| 58 |
+ /**
|
|
| 59 |
+ * List of all known input providers.
|
|
| 60 |
+ */
|
|
| 61 | 61 |
private List<T3InputProvider> inputProviders;
|
| 62 | 62 |
|
| 63 | 63 |
public ImportDataAction() {
|
| ... | ... | @@ -70,132 +70,101 @@ public class ImportDataAction extends AbstractRunAction<ImportInputSourceConfigu |
| 70 | 70 |
inputProviders = Collections.singletonList(getIncomingConfiguration().getInputProvider());
|
| 71 | 71 |
}
|
| 72 | 72 |
|
| 73 |
- public final List<T3InputProvider> getInputProviders() {
|
|
| 74 |
- return inputProviders;
|
|
| 75 |
- }
|
|
| 76 |
- |
|
| 77 |
- public InputSourceConfiguration getIncomingConfiguration() {
|
|
| 78 |
- Object configuration = getT3ActionContext().getConfiguration();
|
|
| 79 |
- return (InputSourceConfiguration) configuration;
|
|
| 80 |
- }
|
|
| 81 |
- |
|
| 82 | 73 |
public String prepareImport() {
|
| 83 |
- |
|
| 84 | 74 |
// get the action context from analyze
|
| 85 |
- |
|
| 86 |
- T3ActionContext<ImportInputSourceConfiguration> actionContext =
|
|
| 87 |
- getT3ActionContext();
|
|
| 88 |
- |
|
| 89 |
- Set<Trip> safeTrips = actionContext.getResultAsSet(
|
|
| 90 |
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
|
|
| 91 |
- Trip.class);
|
|
| 92 |
- |
|
| 93 |
- Map<Trip, Trip> tripToReplace = actionContext.getResultAsMap(
|
|
| 94 |
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
|
|
| 95 |
- );
|
|
| 96 |
- |
|
| 97 |
- if (log.isInfoEnabled()) {
|
|
| 98 |
- log.info("--> Prepare import");
|
|
| 99 |
- log.info("Input provider : " + getIncomingConfiguration().getInputProvider());
|
|
| 100 |
- log.info("Input file : " + getIncomingConfiguration().getInputFile());
|
|
| 101 |
- log.info("Use well : " + getIncomingConfiguration().isUseWells());
|
|
| 102 |
- log.info("Trip type : " + getIncomingConfiguration().getTripType());
|
|
| 103 |
- log.info("Can Create vessel: " + getIncomingConfiguration().isCanCreateVessel());
|
|
| 104 |
- if (getIncomingConfiguration().isCanCreateVessel()) {
|
|
| 105 |
- log.info("Create virtual vessel: " + getIncomingConfiguration().isCreateVirtualVessel());
|
|
| 106 |
- }
|
|
| 107 |
- log.info("Trips to import : " + safeTrips.size());
|
|
| 108 |
- log.info("Trips to replace : " + tripToReplace.size());
|
|
| 75 |
+ T3ActionContext<ImportInputSourceConfiguration> actionContext = getT3ActionContext();
|
|
| 76 |
+ Set<Trip> safeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
|
|
| 77 |
+ Map<Trip, Trip> tripToReplace = actionContext.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
|
|
| 78 |
+ log.info("--> Prepare import");
|
|
| 79 |
+ log.info("Input provider : " + getIncomingConfiguration().getInputProvider());
|
|
| 80 |
+ log.info("Input file : " + getIncomingConfiguration().getInputFile());
|
|
| 81 |
+ log.info("Use well : " + getIncomingConfiguration().isUseWells());
|
|
| 82 |
+ log.info("Trip type : " + getIncomingConfiguration().getTripType());
|
|
| 83 |
+ log.info("Can Create vessel: " + getIncomingConfiguration().isCanCreateVessel());
|
|
| 84 |
+ if (getIncomingConfiguration().isCanCreateVessel()) {
|
|
| 85 |
+ log.info("Create virtual vessel: " + getIncomingConfiguration().isCreateVirtualVessel());
|
|
| 109 | 86 |
}
|
| 110 |
- |
|
| 87 |
+ log.info("Trips to import : " + safeTrips.size());
|
|
| 88 |
+ log.info("Trips to replace : " + tripToReplace.size());
|
|
| 111 | 89 |
Set<Trip> toImportTrips = new HashSet<>();
|
| 112 | 90 |
Set<Trip> toDeleteTrips = new HashSet<>();
|
| 113 |
- |
|
| 114 | 91 |
if (isReplaceTrip()) {
|
| 115 |
- |
|
| 116 |
- // will replace existing trips
|
|
| 117 |
- // so need to delete before all old trips
|
|
| 92 |
+ // will replace existing trips, so need to delete before all old trips
|
|
| 118 | 93 |
toDeleteTrips.addAll(tripToReplace.keySet());
|
| 119 |
- |
|
| 120 | 94 |
// can import all safe trips
|
| 121 | 95 |
toImportTrips.addAll(safeTrips);
|
| 122 |
- |
|
| 123 | 96 |
} else {
|
| 124 |
- |
|
| 125 | 97 |
// do NOT replace old trip
|
| 126 |
- |
|
| 127 | 98 |
// get all importable trips
|
| 128 | 99 |
toImportTrips.addAll(safeTrips);
|
| 129 |
- |
|
| 130 | 100 |
if (MapUtils.isNotEmpty(tripToReplace)) {
|
| 131 |
- |
|
| 132 | 101 |
// remove the one which reflect existing trips
|
| 133 | 102 |
toImportTrips.removeAll(tripToReplace.values());
|
| 134 | 103 |
}
|
| 135 | 104 |
}
|
| 136 |
- |
|
| 137 | 105 |
// creates the new configuration
|
| 138 |
- |
|
| 139 | 106 |
ImportInputSourceConfiguration configuration = ImportInputSourceConfiguration.newConfiguration(getIncomingConfiguration());
|
| 140 |
- |
|
| 141 | 107 |
configuration.setTripsToImport(toImportTrips);
|
| 142 |
- |
|
| 143 | 108 |
configuration.setTripsToDelete(toDeleteTrips);
|
| 144 |
- |
|
| 145 |
- t3ActionContext = getServiceFactory().newT3ActionContext(configuration, getServiceContext()
|
|
| 146 |
- );
|
|
| 147 |
- if (log.isInfoEnabled()) {
|
|
| 148 |
- log.info("Created action context " + t3ActionContext);
|
|
| 149 |
- }
|
|
| 109 |
+ t3ActionContext = getServiceFactory().newT3ActionContext(configuration, getServiceContext());
|
|
| 110 |
+ log.info("Created action context " + t3ActionContext);
|
|
| 150 | 111 |
getT3Session().setActionContext(t3ActionContext);
|
| 151 |
- |
|
| 152 | 112 |
return SUCCESS;
|
| 153 | 113 |
}
|
| 154 | 114 |
|
| 155 | 115 |
public String prepareResult() {
|
| 156 |
- |
|
| 157 | 116 |
Set<Trip> importedTrips = getConfiguration().getTripsToImport();
|
| 158 |
- |
|
| 159 | 117 |
nbImportedTrips = importedTrips.size();
|
| 118 |
+ Set<Trip> deletedTrips = getConfiguration().getTripsToDelete();
|
|
| 119 |
+ nbDeletedTrips = deletedTrips.size();
|
|
| 120 |
+ return INPUT;
|
|
| 121 |
+ }
|
|
| 160 | 122 |
|
| 161 |
- Set<Trip> deletedeTrips = getConfiguration().getTripsToDelete();
|
|
| 123 |
+ @Override
|
|
| 124 |
+ protected Map<String, Object> prepareResumeParameters(ImportInputSourceAction action, Exception error, Date startDate, Date endDate) {
|
|
| 125 |
+ Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
|
|
| 126 |
+ map.put("tripDecorator", getDecorator(Trip.class, DecoratorService.WITH_ID));
|
|
| 127 |
+ return map;
|
|
| 128 |
+ }
|
|
| 162 | 129 |
|
| 163 |
- nbDeletedTrips = deletedeTrips.size();
|
|
| 130 |
+ @SuppressWarnings("unused")
|
|
| 131 |
+ public List<T3InputProvider> getInputProviders() {
|
|
| 132 |
+ return inputProviders;
|
|
| 133 |
+ }
|
|
| 164 | 134 |
|
| 165 |
- return INPUT;
|
|
| 135 |
+ @SuppressWarnings("WeakerAccess")
|
|
| 136 |
+ public InputSourceConfiguration getIncomingConfiguration() {
|
|
| 137 |
+ Object configuration = getT3ActionContext().getConfiguration();
|
|
| 138 |
+ return (InputSourceConfiguration) configuration;
|
|
| 166 | 139 |
}
|
| 167 | 140 |
|
| 141 |
+ @SuppressWarnings("unused")
|
|
| 168 | 142 |
public boolean isValid() {
|
| 169 | 143 |
return valid;
|
| 170 | 144 |
}
|
| 171 | 145 |
|
| 146 |
+ @SuppressWarnings("unused")
|
|
| 172 | 147 |
public void setValid(boolean valid) {
|
| 173 | 148 |
this.valid = valid;
|
| 174 | 149 |
}
|
| 175 | 150 |
|
| 151 |
+ @SuppressWarnings("unused")
|
|
| 176 | 152 |
public int getNbImportedTrips() {
|
| 177 | 153 |
return nbImportedTrips;
|
| 178 | 154 |
}
|
| 179 | 155 |
|
| 156 |
+ @SuppressWarnings("unused")
|
|
| 180 | 157 |
public int getNbDeletedTrips() {
|
| 181 | 158 |
return nbDeletedTrips;
|
| 182 | 159 |
}
|
| 183 | 160 |
|
| 161 |
+ @SuppressWarnings("WeakerAccess")
|
|
| 184 | 162 |
public boolean isReplaceTrip() {
|
| 185 | 163 |
return replaceTrip;
|
| 186 | 164 |
}
|
| 187 | 165 |
|
| 166 |
+ @SuppressWarnings("unused")
|
|
| 188 | 167 |
public void setReplaceTrip(boolean replaceTrip) {
|
| 189 | 168 |
this.replaceTrip = replaceTrip;
|
| 190 | 169 |
}
|
| 191 |
- |
|
| 192 |
- @Override
|
|
| 193 |
- protected Map<String, Object> prepareResumeParameters(ImportInputSourceAction action,
|
|
| 194 |
- Exception error,
|
|
| 195 |
- Date startDate,
|
|
| 196 |
- Date endDate) {
|
|
| 197 |
- Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
|
|
| 198 |
- map.put("tripDecorator", getDecorator(Trip.class, DecoratorService.WITH_ID));
|
|
| 199 |
- return map;
|
|
| 200 |
- }
|
|
| 201 | 170 |
}
|
| ... | ... | @@ -44,6 +44,7 @@ t3.common.available.harbours=Ports disponibles |
| 44 | 44 |
t3.common.available.vesselSimpleTypes=Types simplifiés de navire disponibles
|
| 45 | 45 |
t3.common.available.vessels=Navires disponibles
|
| 46 | 46 |
t3.common.canCreateVessel=Authorise to create vessels
|
| 47 |
+t3.common.canCreateVirtualActivity=Authorize to create virtaul activities (for trips with missing logbook)
|
|
| 47 | 48 |
t3.common.catchFleet=Flotte des captures
|
| 48 | 49 |
t3.common.checkPassword=repeat password
|
| 49 | 50 |
t3.common.configuration=Préférences
|
| ... | ... | @@ -44,6 +44,7 @@ t3.common.available.harbours=Ports disponibles |
| 44 | 44 |
t3.common.available.vesselSimpleTypes=Types simplifiés de navire disponibles
|
| 45 | 45 |
t3.common.available.vessels=Navires disponibles
|
| 46 | 46 |
t3.common.canCreateVessel=Autoriser la création de bateaux
|
| 47 |
+t3.common.canCreateVirtualActivity=Autoriser la création d'acitivités fictive (pour les marées sans livre de bord)
|
|
| 47 | 48 |
t3.common.catchFleet=Flotte des captures
|
| 48 | 49 |
t3.common.checkPassword=Répéter le mot de passe
|
| 49 | 50 |
t3.common.configuration=Préférences
|
| ... | ... | @@ -29,9 +29,7 @@ |
| 29 | 29 |
<jsp:include page="importDataConfigResume.jsp"/>
|
| 30 | 30 |
|
| 31 | 31 |
<s:if test="valid">
|
| 32 |
- |
|
| 33 | 32 |
<%-- Can do the import --%>
|
| 34 |
- |
|
| 35 | 33 |
<p>
|
| 36 | 34 |
<s:text name="t3.label.message.trips.safe.to.import">
|
| 37 | 35 |
<s:param>
|
| ... | ... | @@ -39,27 +37,20 @@ |
| 39 | 37 |
</s:param>
|
| 40 | 38 |
</s:text>
|
| 41 | 39 |
</p>
|
| 42 |
-
|
|
| 43 |
- <s:form method="post" validate="true" namespace="/io">
|
|
| 44 | 40 |
|
| 41 |
+ <s:form method="post" validate="true" namespace="/io">
|
|
| 45 | 42 |
<s:if test="needReplace">
|
| 46 | 43 |
<strong>
|
| 47 |
- <s:text name="t3.label.message.trips.to.replace">
|
|
| 48 |
- <s:param>
|
|
| 49 |
- <s:property value="%{nbTripsToReplace}"/>
|
|
| 50 |
- </s:param>
|
|
| 51 |
- </s:text>
|
|
| 44 |
+ <s:text name="t3.label.message.trips.to.replace">
|
|
| 45 |
+ <s:param>
|
|
| 46 |
+ <s:property value="%{nbTripsToReplace}"/>
|
|
| 47 |
+ </s:param>
|
|
| 48 |
+ </s:text>
|
|
| 52 | 49 |
</strong>
|
| 53 | 50 |
<s:checkbox name="replaceTrip" key="t3.question.confirm.to.replace.trip" value="%{false}"/>
|
| 54 |
- |
|
| 55 | 51 |
</s:if>
|
| 56 |
- |
|
| 57 |
- <s:submit action="prepareImportData"
|
|
| 58 |
- key="t3.action.importData.doImport"
|
|
| 59 |
- align="right"/>
|
|
| 60 |
- |
|
| 52 |
+ <s:submit action="prepareImportData" key="t3.action.importData.doImport" align="right"/>
|
|
| 61 | 53 |
</s:form>
|
| 62 |
- |
|
| 63 | 54 |
</s:if>
|
| 64 | 55 |
<s:else>
|
| 65 | 56 |
<p>
|
| ... | ... | @@ -25,41 +25,47 @@ |
| 25 | 25 |
|
| 26 | 26 |
<script type="text/javascript">
|
| 27 | 27 |
|
| 28 |
- jQuery(document).ready(function () {
|
|
| 29 |
- |
|
| 30 |
- function changeCanCreateVessel(val) {
|
|
| 31 |
- var container = $('[name="createVirtualVessel"]');
|
|
| 32 |
- if (val) {
|
|
| 33 |
- container.attr('disabled', false);
|
|
| 34 |
- container.prop('checked', true);
|
|
| 35 |
- } else {
|
|
| 36 |
- container.attr('disabled', true);
|
|
| 37 |
- }
|
|
| 38 |
- }
|
|
| 39 |
- |
|
| 40 |
- $('[name="canCreateVessel"]').change(function () {
|
|
| 41 |
- changeCanCreateVessel($(this).prop('checked'));
|
|
| 28 |
+ jQuery(document).ready(function () {
|
|
| 29 |
+ function changeCanCreateVessel(val) {
|
|
| 30 |
+ var container = $('[name="createVirtualVessel"]');
|
|
| 31 |
+ if (val) {
|
|
| 32 |
+ container.attr('disabled', false);
|
|
| 33 |
+ container.prop('checked', true);
|
|
| 34 |
+ } else {
|
|
| 35 |
+ container.attr('disabled', true);
|
|
| 36 |
+ }
|
|
| 37 |
+ }
|
|
| 38 |
+ function changeUseSamplesOnly(val) {
|
|
| 39 |
+ var container = $('[name="canCreateVirtualActivity"]');
|
|
| 40 |
+ if (val) {
|
|
| 41 |
+ container.attr('disabled', false);
|
|
| 42 |
+ container.prop('checked', true);
|
|
| 43 |
+ } else {
|
|
| 44 |
+ container.attr('disabled', true);
|
|
| 45 |
+ container.attr('checked', true);
|
|
| 46 |
+ }
|
|
| 47 |
+ }
|
|
| 48 |
+ |
|
| 49 |
+ $('[name="canCreateVessel"]').change(function () {
|
|
| 50 |
+ changeCanCreateVessel($(this).prop('checked'));
|
|
| 51 |
+ });
|
|
| 52 |
+ $('[name="useSamplesOnly"]').change(function () {
|
|
| 53 |
+ changeUseSamplesOnly($(this).prop('checked'));
|
|
| 54 |
+ });
|
|
| 55 |
+ changeCanCreateVessel(<s:property value="%{canCreateVessel}"/>);
|
|
| 56 |
+ changeUseSamplesOnly(<s:property value="%{useSamplesOnly}"/>);
|
|
| 42 | 57 |
});
|
| 43 |
- |
|
| 44 |
- changeCanCreateVessel(<s:property value="%{canCreateVessel}"/>);
|
|
| 45 |
- });
|
|
| 46 | 58 |
</script>
|
| 47 | 59 |
<title><s:text name="t3.label.data.configureImportData"/></title>
|
| 48 |
- |
|
| 49 | 60 |
<h2><s:text name="t3.label.data.configureImportData"/></h2>
|
| 50 | 61 |
|
| 51 | 62 |
<s:form method="post" validate="true" enctype="multipart/form-data" namespace="/io">
|
| 52 |
- |
|
| 53 | 63 |
<s:hidden key="treatmentDirectoryPath" label=''/>
|
| 54 |
- |
|
| 55 |
- <s:select key="inputProviderId" list="inputProviders" label='%{getText("t3.common.inputProvider")}' listKey="id" listValue="libelle" requiredLabel="true"/>
|
|
| 56 |
- |
|
| 64 |
+ <s:select key="inputProviderId" list="inputProviders" label='%{getText("t3.common.inputProvider")}' listKey="id"
|
|
| 65 |
+ listValue="libelle" requiredLabel="true"/>
|
|
| 57 | 66 |
<s:if test="loadedSource==null">
|
| 58 |
- |
|
| 59 | 67 |
<s:hidden name="useWells" value="%{useWells}"/>
|
| 60 |
- |
|
| 61 | 68 |
<s:file name="sourceToLoad" requiredLabel="true" label='%{getText("t3.common.sourceToUpload")} (*)'/>
|
| 62 |
- |
|
| 63 | 69 |
<s:submit action="configureImportData!doAddSource" key="t3.action.importData.addSource" align="right"/>
|
| 64 | 70 |
<br/>
|
| 65 | 71 |
|
| ... | ... | @@ -68,17 +74,14 @@ |
| 68 | 74 |
<s:param value="%{maxSize}"/>
|
| 69 | 75 |
</s:text>
|
| 70 | 76 |
</div>
|
| 71 |
- |
|
| 72 | 77 |
</s:if>
|
| 73 | 78 |
<s:else>
|
| 74 |
- |
|
| 75 | 79 |
<s:hidden key="loadedSource" label=''/>
|
| 76 |
- |
|
| 77 |
- <s:textfield value="%{loadedSource}" key="t3.common.uploaded.source" disabled="true" requiredLabel="true" size="40"/>
|
|
| 78 |
- |
|
| 80 |
+ <s:textfield value="%{loadedSource}" key="t3.common.uploaded.source" disabled="true" requiredLabel="true"
|
|
| 81 |
+ size="40"/>
|
|
| 79 | 82 |
<s:checkbox key="useWells" label='%{getText("t3.common.force.useWells")}'/>
|
| 80 |
- |
|
| 81 |
- <s:select key="tripType" list="tripTypes" label='%{getText("t3.common.tripType")}' requiredLabel="true"/>
|
|
| 83 |
+ <s:checkbox key="samplesOnly" label='%{getText("t3.common.useSamplesOnly")}'/>
|
|
| 84 |
+ <s:checkbox key="canCreateVirtualActivity" label='%{getText("t3.common.canCreateVirtualActivity")}'/>
|
|
| 82 | 85 |
<s:checkbox key="canCreateVessel" label='%{getText("t3.common.canCreateVessel")}'/>
|
| 83 | 86 |
<s:checkbox key="createVirtualVessel" label='%{getText("t3.common.createVirtualVessel")}'/>
|
| 84 | 87 |
<s:submit action="configureImportData!doDeleteSource" key="t3.action.importData.deleteSource" align="right"/>
|
| ... | ... | @@ -22,21 +22,23 @@ |
| 22 | 22 |
<%@ taglib prefix="s" uri="/struts-tags" %>
|
| 23 | 23 |
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
|
| 24 | 24 |
<fieldset>
|
| 25 |
- |
|
| 26 | 25 |
<legend>
|
| 27 | 26 |
<s:text name="t3.label.importData.config.resume"/>
|
| 28 | 27 |
</legend>
|
| 29 |
- |
|
| 30 | 28 |
<s:form>
|
| 31 |
- <s:select key="t3.common.inputProvider" list="inputProviders" listKey="id" listValue="libelle" value="%{configuration.inputProvider.id}" disabled="true"/>
|
|
| 29 |
+ <s:select key="t3.common.inputProvider" list="inputProviders" listKey="id" listValue="libelle"
|
|
| 30 |
+ value="%{configuration.inputProvider.id}" disabled="true"/>
|
|
| 32 | 31 |
<s:textfield value="%{configuration.inputFile.name}" key="t3.common.uploaded.source" disabled="true" size="40"/>
|
| 33 | 32 |
<s:label key="t3.common.useWells" value=""/>
|
| 34 | 33 |
<s:checkbox name="useWells" value="%{configuration.useWells}" disabled="true" key="t3.common.force.useWells"/>
|
| 35 |
- <s:select key="tripType" list="tripTypes" label='%{getText("t3.common.tripType")}' disabled="true" value="%{configuration.tripType}" />
|
|
| 36 |
- <s:checkbox name="canCreateVessel" value="%{configuration.canCreateVessel}" disabled="true" key="t3.common.canCreateVessel"/>
|
|
| 34 |
+ <s:checkbox name="samplesOnly" value="%{configuration.samplesOnly}" disabled="true" key="t3.common.samplesOnly"/>
|
|
| 35 |
+ <s:checkbox name="canCreateVirtualActivity" value="%{configuration.canCreateVirtualActivity}" disabled="true"
|
|
| 36 |
+ key="t3.common.canCreateVirtualActivity"/>
|
|
| 37 |
+ <s:checkbox name="canCreateVessel" value="%{configuration.canCreateVessel}" disabled="true"
|
|
| 38 |
+ key="t3.common.canCreateVessel"/>
|
|
| 37 | 39 |
<s:if test="configuration.canCreateVessel">
|
| 38 |
- <s:checkbox name="createVirtualVessel" value="%{configuration.createVirtualVessel}" disabled="true" key="t3.common.createVirtualVessel"/>
|
|
| 40 |
+ <s:checkbox name="createVirtualVessel" value="%{configuration.createVirtualVessel}" disabled="true"
|
|
| 41 |
+ key="t3.common.createVirtualVessel"/>
|
|
| 39 | 42 |
</s:if>
|
| 40 | 43 |
</s:form>
|
| 41 |
- |
|
| 42 | 44 |
</fieldset>
|