Tutti-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- 4130 discussions
r191 - in trunk/tutti-persistence-adagio/src: main/java/fr/ifremer/tutti/persistence main/java/fr/ifremer/tutti/persistence/service test/java/fr/ifremer/tutti/persistence/service
by blavenier@users.forge.codelutin.com 14 Jan '13
by blavenier@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: blavenier
Date: 2013-01-14 16:35:44 +0100 (Mon, 14 Jan 2013)
New Revision: 191
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/191
Log:
fix vessel loading (and query param statusValid, statusTemporary)
fix cruise loading to pass Unit test
change enumeration on Status into String (= code but not an id)
Modified:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 13:55:40 UTC (rev 190)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 15:35:44 UTC (rev 191)
@@ -117,10 +117,10 @@
public final Integer RECTANGLE_STATISTIQUE_MED = null;
@Value("${StatusCode.ENABLE}")
- public final Integer STATUS_VALID_CODE = null;
+ public final String STATUS_VALID_CODE = null;
@Value("${StatusCode.TEMPORARY}")
- public final Integer STATUS_TEMPORARY_CODE = null;
+ public final String STATUS_TEMPORARY_CODE = null;
@Value("${PersonId.UNKNOWN_RECORDER_PERSON}")
public final Integer PERSON_ID_UNKNOWN_RECORDER_PERSON = null;
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-01-14 15:35:44 UTC (rev 191)
@@ -45,10 +45,13 @@
import org.hibernate.type.IntegerType;
import org.hibernate.type.StringType;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+
+import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -119,6 +122,9 @@
"cruiseId", IntegerType.INSTANCE, Integer.valueOf(id),
"countryLocationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_COUNTRY);
+ if (source == null) {
+ throw new DataRetrievalFailureException("Could not retrieve cruise with id=" + id);
+ }
Cruise result = new Cruise();
result.setId(id);
@@ -138,45 +144,95 @@
c.setLabel(countryLabel);
result.setCountry(c);
- result.setBeginDate((Date) source[6]);
+ Timestamp beginDate = (Timestamp) source[6];
+ if (beginDate != null && result.getYear() != null) {
+ calendar.setTimeInMillis(0);
+ calendar.set(Calendar.YEAR, result.getYear());
+ calendar.add(Calendar.MILLISECOND, 1);
+ // Comparison with getTime() is need, to keep millisecond precision
+ if (beginDate.getTime() == calendar.getTimeInMillis()) {
+ // if BeginDate is fake : set to null (see createCruise for details)
+ result.setBeginDate(null);
+ }
+ else {
+ result.setBeginDate(new Date(beginDate.getTime()));
+ }
+ }
+
result.setEndDate((Date) source[7]);
-
- List<Vessel> vessels = Lists.newArrayList();
-
+
String vesselCode = (String) source[8];
Vessel vessel = referentielService.getVessel(vesselCode);
- vessels.add(vessel);
+ result.setVessel(Lists.newArrayList(vessel));
Integer managerId = (Integer) source[9];
- Person manager = referentielService.getPerson(managerId);
- result.setHeadOfMission(Lists.newArrayList(manager));
+ if (managerId != null && managerId.equals(enumeration.PERSON_ID_UNKNOWN_RECORDER_PERSON)) {
+ result.setHeadOfMission(null);
+ }
+ else {
+ Person manager = referentielService.getPerson(managerId);
+ result.setHeadOfMission(Lists.newArrayList(manager));
+ }
+
result.setComment((String) source[10]);
-
- // get gears
- Iterator<Integer> gearIds = queryListTyped(
- "allCruiseGears",
- "cruiseId", IntegerType.INSTANCE, Integer.valueOf(id));
-
- List<Gear> gears = Lists.newArrayList();
- while (gearIds.hasNext()) {
- Integer gearCode = gearIds.next();
- Gear target = referentielService.getGear(gearCode);
- gears.add(target);
+
+ String miscData = (String) source[11];
+ if (miscData != null && miscData.length() > 0) {
+
+ // Retrieve gears :
+ int gearTagIndex = miscData.indexOf(CRUISE_MISC_DATA_GEARS_TAG);
+ if (gearTagIndex == -1) {
+ result.setGear(null);
+ }
+ else {
+ String gearIdsStr = miscData.substring(gearTagIndex + CRUISE_MISC_DATA_GEARS_TAG.length()).trim();
+ miscData = miscData.substring(0, gearTagIndex);
+ if (gearIdsStr.isEmpty()) {
+ result.setGear(null);
+ }
+ else {
+ List<Gear> gears = Lists.newArrayList();
+ String[] gearIds = gearIdsStr.split(",");
+ for (int i = 0; i < gearIds.length; i++) {
+ Integer gearId = Integer.valueOf(gearIds[i]);
+ gears.add(referentielService.getGear(gearId));
+ }
+ result.setGear(gears);
+ }
+ }
+
+ // Retrieve secondary vessels :
+ int vesselTagIndex = miscData.indexOf(CRUISE_MISC_DATA_VESSELS_TAG);
+ if (vesselTagIndex != -1) {
+ String vesselCodesStr = miscData.substring(vesselTagIndex + CRUISE_MISC_DATA_VESSELS_TAG.length()).trim();
+ if (!vesselCodesStr.isEmpty()) {
+ String[] vesselCodes = vesselCodesStr.split(",");
+ for (int i = 0; i < vesselCodes.length; i++) {
+ vesselCode = vesselCodes[i];
+ result.addVessel(referentielService.getVessel(vesselCode));
+ }
+ }
+ }
}
-
- // get secondary vessels
- Iterator<String> vesselIds = queryListTyped(
- "allCruiseSecondaryVessels",
- "cruiseId", IntegerType.INSTANCE, Integer.valueOf(id));
-
- while (vesselIds.hasNext()) {
- String vesselId = vesselIds.next();
- vessel = referentielService.getVessel(vesselId);
- vessels.add(vessel);
+
+ // get secondary gears from fishingOperation (first load from Allegro DB only)
+ if (result.getGear() == null) {
+ Iterator<Object[]> list = queryList(
+ "cruiseGears",
+ "cruiseId", StringType.INSTANCE, id);
+
+ List<Gear> gears = Lists.newArrayList();
+ while (list.hasNext()) {
+ Object[] zoneSource = list.next();
+ Gear target = new Gear();
+ target.setId(String.valueOf(zoneSource[0]));
+ target.setLabel((String) zoneSource[1]);
+ target.setName((String) zoneSource[2]);
+ gears.add(target);
+ }
+ result.setGear(gears);
}
-
- result.setVessel(vessels);
return result;
}
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 15:35:44 UTC (rev 191)
@@ -155,7 +155,10 @@
Object[] source = queryUniqueWithStatus(
"vessel",
"vesselCode", StringType.INSTANCE, vesselCode,
- "refDate", DateType.INSTANCE, new Date());
+ "refDate", DateType.INSTANCE, new Date(),
+ "statusValidCode", StringType.INSTANCE, enumeration.STATUS_VALID_CODE,
+ "statusTemporaryCode", StringType.INSTANCE, enumeration.STATUS_TEMPORARY_CODE
+ );
Vessel result = loadVessel(source);
return result;
}
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java 2013-01-14 13:55:40 UTC (rev 190)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java 2013-01-14 15:35:44 UTC (rev 191)
@@ -89,7 +89,6 @@
Assert.assertNotNull(result);
}
- @Ignore
@Test
public void createCruise(/*Cruise bean*/) {
String programCode = dbResource.getFixtures().programCode();
1
0
r190 - in trunk: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service tutti-persistence-adagio tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service tutti-persistence-adagio/src/main/resources tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service
by tchemit@users.forge.codelutin.com 14 Jan '13
by tchemit@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: tchemit
Date: 2013-01-14 14:55:40 +0100 (Mon, 14 Jan 2013)
New Revision: 190
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/190
Log:
add ReferentialPersistenceService#getGear method
fix Cruise loading
fix somes tests
add svn missing properties and license header
Modified:
trunk/tutti-persistence-adagio/README.txt
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.Program;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import java.util.List;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -125,4 +125,5 @@
Person getPerson(Integer personId);
+ Gear getGear(Integer gearId);
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/README.txt
===================================================================
--- trunk/tutti-persistence-adagio/README.txt 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/README.txt 2013-01-14 13:55:40 UTC (rev 190)
@@ -4,7 +4,6 @@
java -jar ~/.m2/repository/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar --inlineRC URL=jdbc:hsqldb:file:src/test/db/allegro,USER=sa
-(cd src/test ; ./connectDb.sh)
Pour lancer la base en mode serveur
-----------------------------------
@@ -13,7 +12,6 @@
On peut ensuite accéder à la base via l'url jdbc:hsqldb://localhost/allegro
-
Se connecter à une superbe ui swing de requétage
------------------------------------------------
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.base.Preconditions;
import fr.ifremer.adagio.core.dao.administration.programStrategy.ProgramDao;
import fr.ifremer.tutti.persistence.TuttiEnumerationFile;
@@ -63,6 +87,14 @@
return result;
}
+ protected <T> Iterator<T> queryListTyped(String queryName, Object... params) {
+
+ Query query = createQuery(queryName, params);
+
+ Iterator result = query.iterate();
+ return result;
+ }
+
protected Query createQuery(String queryName, Object... params) {
Query query = getCurrentSession().getNamedQuery(queryName);
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.collect.Lists;
import fr.ifremer.adagio.core.dao.administration.user.PersonDao;
import fr.ifremer.adagio.core.dao.data.survey.fishingTrip.FishingTrip;
@@ -130,29 +154,25 @@
result.setComment((String) source[10]);
// get gears
- Iterator<Object[]> list = queryList(
+ Iterator<Integer> gearIds = queryListTyped(
"allCruiseGears",
"cruiseId", IntegerType.INSTANCE, Integer.valueOf(id));
List<Gear> gears = Lists.newArrayList();
- while (list.hasNext()) {
- Object[] zoneSource = list.next();
- Gear target = new Gear();
- target.setId((String) zoneSource[0]);
- target.setLabel((String) zoneSource[1]);
- target.setName((String) zoneSource[2]);
+ while (gearIds.hasNext()) {
+ Integer gearCode = gearIds.next();
+ Gear target = referentielService.getGear(gearCode);
gears.add(target);
}
// get secondary vessels
- list = queryList(
+ Iterator<String> vesselIds = queryListTyped(
"allCruiseSecondaryVessels",
"cruiseId", IntegerType.INSTANCE, Integer.valueOf(id));
- while (list.hasNext()) {
- Object[] zoneSource = list.next();
- vesselCode = (String) zoneSource[0];
- vessel = referentielService.getVessel(vesselCode);
+ while (vesselIds.hasNext()) {
+ String vesselId = vesselIds.next();
+ vessel = referentielService.getVessel(vesselId);
vessels.add(vessel);
}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -216,6 +216,15 @@
}
@Override
+ public Gear getGear(Integer gearId) {
+ Object[] source = queryUnique(
+ "gear",
+ "gearId", IntegerType.INSTANCE, gearId);
+ Gear result = loadGear(source);
+ return result;
+ }
+
+ @Override
public List<Species> getAllSpecies() {
TaxonRefTaxVO[] sources = taxonNameDao.getAllTaxonRefTax();
@@ -411,13 +420,6 @@
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected <E extends AbstractTuttiReferentialEntity> void setStatus(fr.ifremer.adagio.core.dao.referential.Status status, E entity) {
- Status newStatus = new Status();
- newStatus.setId(status.getCode());
- newStatus.setName(status.getName());
- entity.setStatus(newStatus);
- }
-
protected void loadCaracteristicQualitativeValues(Caracteristic caracteristic,
Integer pmfmId) {
Preconditions.checkNotNull(caracteristic, "Caracteristic can not be null");
@@ -507,15 +509,6 @@
return target;
}
- protected Gear loadGear(Object[] source) {
- Gear result = new Gear();
- result.setId(String.valueOf(source[0]));
- result.setName((String) source[1]);
- result.setLabel((String) source[2]);
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], result);
- return result;
- }
-
protected Person loadPerson(Object[] source) {
Person target = new Person();
target.setId(String.valueOf(source[0]));
@@ -526,6 +519,15 @@
return target;
}
+ protected Gear loadGear(Object[] source) {
+ Gear result = new Gear();
+ result.setId(String.valueOf(source[0]));
+ result.setName((String) source[1]);
+ result.setLabel((String) source[2]);
+ setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], result);
+ return result;
+ }
+
protected Iterator<Object[]> queryListWithStatus(String queryName,
Object... params) {
Query query = createQuery(queryName, params);
@@ -546,5 +548,11 @@
return (Object[]) result;
}
+ protected <E extends AbstractTuttiReferentialEntity> void setStatus(fr.ifremer.adagio.core.dao.referential.Status status, E entity) {
+ Status newStatus = new Status();
+ newStatus.setId(status.getCode());
+ newStatus.setName(status.getName());
+ entity.setStatus(newStatus);
+ }
}
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import org.apache.commons.logging.Log;
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 13:55:40 UTC (rev 190)
@@ -129,9 +129,7 @@
<query cacheable="true" name="allCruiseGears">
<![CDATA[
SELECT
- gpf.gear.id AS gearId,
- gpf.gear.label AS gearLabel,
- gpf.gear.name AS gearName
+ gpf.gear.id AS gearId
FROM
ScientificCruiseImpl sc
JOIN sc.fishingTrips ft
@@ -146,7 +144,7 @@
<query cacheable="true" name="allCruiseSecondaryVessels">
<![CDATA[
SELECT
- va.operationVesselAssociationPk.vessel.code AS associatedVesselCode,
+ va.operationVesselAssociationPk.vessel.code AS associatedVesselCode
FROM
ScientificCruiseImpl sc
JOIN sc.fishingTrips ft
@@ -395,6 +393,20 @@
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
+ <query cacheable="true" name="gear">
+ <![CDATA[
+ SELECT
+ g.id,
+ g.label,
+ g.name,
+ g.status AS status
+ FROM GearImpl g
+ WHERE
+ g.id = :gearId
+ ]]>
+ <query-param name="gearId" type="java.lang.Integer"/>
+ </query>
+
<!-- [REF-07] Get all persons -->
<query cacheable="true" name="allPersons">
<![CDATA[
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -36,6 +36,7 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.Calendar;
@@ -88,6 +89,7 @@
Assert.assertNotNull(result);
}
+ @Ignore
@Test
public void createCruise(/*Cruise bean*/) {
String programCode = dbResource.getFixtures().programCode();
@@ -156,6 +158,8 @@
assertEquals(cruise.getName(), createdCruise.getName());
Cruise reloadedCruise = service.getCruise(createdCruise.getId());
+
+ //TODO-TC This is not working, reloadedCruise is not null,...
assertEquals(createdCruise.getBeginDate(), reloadedCruise.getBeginDate());
assertEquals(createdCruise.getEndDate(), reloadedCruise.getEndDate());
assertEquals(createdCruise.getComment(), reloadedCruise.getComment());
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java 2013-01-14 13:22:48 UTC (rev 189)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java 2013-01-14 13:55:40 UTC (rev 190)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.service;
+/*
+ * #%L
+ * Tutti :: Persistence Dev (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.IdAware;
@@ -195,7 +219,12 @@
return getBean(Person.class.getName(), personId.toString());
}
+ @Override
+ public Gear getGear(Integer gearCode) {
+ return getBean(Gear.class.getName(), gearCode.toString());
+ }
+
protected <B extends IdAware> List<B> getData(String entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
Property changes on: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
14 Jan '13
Author: tchemit
Date: 2013-01-14 14:22:48 +0100 (Mon, 14 Jan 2013)
New Revision: 189
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/189
Log:
refs #1809: [Persistence] Adagio Donn?\195?\169es th?\195?\169matiques (create services + tests)
Added:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
Removed:
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/AccidentalBatchTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/BenthosBatchTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/FishingOperationTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/MacroWasteBatchTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/PlanktonBatchTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProgramTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProtocolTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/SpeciesBatchTest.java
Modified:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java
trunk/tutti-persistence-adagio/src/main/resources/applicationContext-service-tutti.xml
trunk/tutti-persistence-adagio/src/main/resources/beanRefFactory.xml
trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -139,6 +139,10 @@
List<Person> getAllPerson();
+ Person getPerson(Integer personId);
+
+ Vessel getVessel(String vesselCode);
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,24 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link AccidentalBatch} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface AccidentalBatchPersistenceService {
+
+ List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId);
+
+ AccidentalBatch getAccidentalBatch(String id);
+
+ AccidentalBatch createAccidentalBatch(AccidentalBatch bean);
+
+ AccidentalBatch saveAccidentalBatch(AccidentalBatch bean);
+
+ void deleteAccidentalBatch(String id);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,24 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link BenthosBatch} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface BenthosBatchPersistenceService {
+
+ List<BenthosBatch> getAllBenthosBatch(String fishingOperationId);
+
+ BenthosBatch getBenthosBatch(String id);
+
+ BenthosBatch createBenthosBatch(BenthosBatch bean);
+
+ BenthosBatch saveBenthosBatch(BenthosBatch bean);
+
+ void deleteBenthosBatch(String id);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,22 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link Cruise} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface CruisePersistenceService {
+
+ List<Cruise> getAllCruise(String programId);
+
+ Cruise getCruise(String id);
+
+ Cruise createCruise(Cruise bean);
+
+ Cruise saveCruise(Cruise bean);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,22 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link FishingOperation} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface FishingOperationPersistenceService {
+
+ List<FishingOperation> getAllFishingOperation(String cruiseId);
+
+ FishingOperation getFishingOperation(String id);
+
+ FishingOperation createFishingOperation(FishingOperation bean);
+
+ FishingOperation saveFishingOperation(FishingOperation bean);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,25 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link MacroWasteBatch} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface MacroWasteBatchPersistenceService {
+
+
+ List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId);
+
+ MacroWasteBatch getMacroWasteBatch(String id);
+
+ MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean);
+
+ MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean);
+
+ void deleteMacroWasteBatch(String id);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,24 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link PlanktonBatch} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface PlanktonBatchPersistenceService {
+
+ List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId);
+
+ PlanktonBatch getPlanktonBatch(String id);
+
+ PlanktonBatch createPlanktonBatch(PlanktonBatch bean);
+
+ PlanktonBatch savePlanktonBatch(PlanktonBatch bean);
+
+ void deletePlanktonBatch(String id);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,22 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.Program;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link Program} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface ProgramPersistenceService {
+
+ List<Program> getAllProgram();
+
+ Program getProgram(String id);
+
+ Program createProgram(Program bean);
+
+ Program saveProgram(Program bean);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,22 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link TuttiProtocol} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface ProtocolPersistenceService {
+
+ List<TuttiProtocol> getAllProtocol();
+
+ TuttiProtocol getProtocol(String id);
+
+ TuttiProtocol createProtocol(TuttiProtocol bean);
+
+ TuttiProtocol saveProtocol(TuttiProtocol bean);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,37 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+
+import java.util.List;
+
+/**
+ * CRUD of {@link SpeciesBatch} entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface SpeciesBatchPersistenceService {
+
+
+ List<SpeciesBatch> getAllRootSpeciesBatch(String fishingOperationId);
+
+ List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId);
+
+ SpeciesBatch getSpeciesBatch(String id);
+
+ SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId);
+
+ SpeciesBatch saveSpeciesBatch(SpeciesBatch bean);
+
+ void deleteSpeciesBatch(String id);
+
+ void deleteSpeciesSubBatch(String id);
+
+ List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(
+ String speciesBatchId);
+
+ List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
+ List<SpeciesBatchFrequency> frequencies);
+
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -28,7 +28,7 @@
import org.springframework.beans.factory.annotation.Value;
/**
- * Contains all constants usablevia the enumeration file.
+ * Contains all constants usable via the enumeration file.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -24,18 +24,6 @@
* #L%
*/
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.adagio.core.dao.administration.programStrategy.ProgramDao;
-import fr.ifremer.adagio.core.dao.administration.user.PersonDao;
-import fr.ifremer.adagio.core.dao.data.survey.fishingTrip.FishingTrip;
-import fr.ifremer.adagio.core.dao.data.survey.scientificCruise.ScientificCruise;
-import fr.ifremer.adagio.core.dao.data.survey.scientificCruise.ScientificCruiseDao;
-import fr.ifremer.adagio.core.dao.referential.QualityFlagDao;
-import fr.ifremer.adagio.core.dao.referential.location.Location;
-import fr.ifremer.adagio.core.dao.referential.location.LocationDao;
-import fr.ifremer.adagio.core.dao.referential.vessel.VesselDao;
-import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
@@ -54,24 +42,23 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.service.AccidentalBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.BenthosBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.CruisePersistenceService;
+import fr.ifremer.tutti.persistence.service.FishingOperationPersistenceService;
+import fr.ifremer.tutti.persistence.service.MacroWasteBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.PlanktonBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.ProgramPersistenceService;
+import fr.ifremer.tutti.persistence.service.ProtocolPersistenceService;
import fr.ifremer.tutti.persistence.service.ReferentialPersistenceService;
+import fr.ifremer.tutti.persistence.service.SpeciesBatchPersistenceService;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hibernate.Query;
-import org.hibernate.SessionFactory;
-import org.hibernate.type.IntegerType;
-import org.hibernate.type.StringType;
-import org.hibernate.type.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import javax.annotation.Resource;
import java.io.IOException;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
import java.util.List;
/**
@@ -85,44 +72,37 @@
private static final Log log =
LogFactory.getLog(TuttiPersistenceAdagioImpl.class);
- /**
- * Session factory.
- *
- * @since 0.3
- */
@Autowired(required = true)
- protected SessionFactory sessionFactory;
+ protected ReferentialPersistenceService referentielService;
- @Resource(name = "programDao")
- protected ProgramDao programDao;
+ @Autowired(required = true)
+ protected ProgramPersistenceService programService;
- @Resource(name = "scientificCruiseDao")
- protected ScientificCruiseDao scientificCruiseDao;
- @Resource(name = "personDao")
- protected PersonDao personDao;
-
- @Resource(name = "vesselDao")
- protected VesselDao vesselDao;
-
- @Resource(name = "locationDao")
- protected LocationDao locationDao;
+ @Autowired(required = true)
+ protected CruisePersistenceService cruiseService;
- @Resource(name = "qualityFlagDao")
- protected QualityFlagDao qualityFlagDao;
-
- protected Calendar calendar = new GregorianCalendar();
-
- protected static String CRUISE_MISC_DATA_VESSELS_TAG="#VESSELS=";
-
- protected static String CRUISE_MISC_DATA_GEARS_TAG="#GEARS=";
+ @Autowired(required = true)
+ protected FishingOperationPersistenceService fishingOperationService;
@Autowired(required = true)
- protected ReferentialPersistenceService referentielService;
+ protected SpeciesBatchPersistenceService speciesBatchService;
@Autowired(required = true)
- protected TuttiEnumerationFile enumeration;
+ protected BenthosBatchPersistenceService benthosBatchService;
+ @Autowired(required = true)
+ protected PlanktonBatchPersistenceService planktonBatchService;
+
+ @Autowired(required = true)
+ protected MacroWasteBatchPersistenceService macroWasteBatchService;
+
+ @Autowired(required = true)
+ protected AccidentalBatchPersistenceService accidentalBatchService;
+
+ @Autowired(required = true)
+ protected ProtocolPersistenceService protocolService;
+
@Override
public String getImplementationName() {
return "Persistence Adagio implementation";
@@ -268,64 +248,38 @@
return referentielService.getAllPerson();
}
+ @Override
+ public Vessel getVessel(String vesselCode) {
+ return referentielService.getVessel(vesselCode);
+ }
+
+ @Override
+ public Person getPerson(Integer personId) {
+ return referentielService.getPerson(personId);
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
@Override
public List<Program> getAllProgram() {
- Iterator<Object[]> list = queryList("allPrograms");
-
- List<Program> result = Lists.newArrayList();
- while (list.hasNext()) {
- Object[] source = list.next();
- Program target = new Program();
- target.setId((String) source[0]);
- target.setName((String) source[1]);
- result.add(target);
- }
- return result;
+ return programService.getAllProgram();
}
@Override
public Program getProgram(String id) {
- Object[] source = queryUnique(
- "program",
- "programCode", StringType.INSTANCE, id);
-
- Program result = new Program();
- result.setId((String) source[0]);
- result.setName((String) source[1]);
-
- // get program locations
- Iterator<Object[]> list = queryList(
- "allProgramLocations",
- "programCode", StringType.INSTANCE, id);
-
- List<Zone> zones = Lists.newArrayList();
- while (list.hasNext()) {
- Object[] zoneSource = list.next();
- Zone target = new Zone();
- target.setId(String.valueOf(zoneSource[0]));
- target.setLabel((String) zoneSource[1]);
- target.setName((String) zoneSource[2]);
- zones.add(target);
- }
- if (!zones.isEmpty()) {
- result.setZone(zones.get(0));
- }
-
- return result;
+ return programService.getProgram(id);
}
@Override
public Program createProgram(Program bean) {
- throw new UnsupportedOperationException();
+ return programService.createProgram(bean);
}
@Override
public Program saveProgram(Program bean) {
- throw new UnsupportedOperationException();
+ return programService.saveProgram(bean);
}
//------------------------------------------------------------------------//
@@ -334,252 +288,22 @@
@Override
public List<Cruise> getAllCruise(String programId) {
- Iterator<Object[]> list = queryList(
- "allCruises",
- "programCode", StringType.INSTANCE, programId);
-
- List<Cruise> result = Lists.newArrayList();
- while (list.hasNext()) {
- Object[] source = list.next();
- Cruise target = new Cruise();
- target.setId((String) source[0]);
- target.setName((String) source[1]);
- target.setBeginDate((Date) source[2]);
- result.add(target);
- }
- return result;
+ return cruiseService.getAllCruise(programId);
}
@Override
public Cruise getCruise(String id) {
- Object[] source = queryUnique(
- "cruise",
- "cruiseId", StringType.INSTANCE, id,
- "locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_LOCALITE);
-
- Cruise result = new Cruise();
- result.setId(id);
-
- String programCode = (String) source[0];
- Program program = getProgram(programCode);
- result.setProgram(program);
-
- result.setYear((Integer) source[1]);
- result.setName((String) source[2]);
-
- String countryId = String.valueOf(source[3]);
- String countryLabel = (String) source[4];
- String countryName = (String) source[5];
- Country c = new Country();
- c.setId(countryId);
- c.setName(countryName);
- c.setLabel(countryLabel);
- result.setCountry(c);
-
- result.setBeginDate((Date) source[6]);
- result.setEndDate((Date) source[7]);
-
- String vesselCode = (String) source[8];
- Vessel vessel = referentielService.getVessel(vesselCode);
- result.setVessel(Lists.newArrayList(vessel));
-
- Integer managerId = (Integer) source[9];
- Person manager = referentielService.getPerson(managerId);
- result.setHeadOfMission(Lists.newArrayList(manager));
-
- result.setComment((String) source[10]);
-
- // get secondary gears
- Iterator<Object[]> list = queryList(
- "allCruiseSecondaryGears",
- "cruiseId", StringType.INSTANCE, id);
-
- List<Gear> gears = Lists.newArrayList();
- while (list.hasNext()) {
- Object[] zoneSource = list.next();
- Gear target = new Gear();
- target.setId((String) zoneSource[0]);
- target.setLabel((String) zoneSource[1]);
- target.setName((String) zoneSource[2]);
- gears.add(target);
- }
- result.setGear(gears);
- return result;
+ return cruiseService.getCruise(id);
}
@Override
public Cruise createCruise(Cruise bean) {
- ScientificCruise scientificCruise = ScientificCruise.Factory.newInstance();
- cruiseToEntity(bean, scientificCruise, true);
- scientificCruiseDao.create(scientificCruise);
-
- bean.setId(String.valueOf(scientificCruise.getId()));
- return bean;
+ return cruiseService.createCruise(bean);
}
-
- protected void cruiseToEntity(Cruise source, ScientificCruise target, boolean copyIfNull) {
- StringBuffer miscDataBuffer = new StringBuffer();
-
- // Name
- if (copyIfNull && source.getName() == null) {
- target.setName(null);
- } else if (source.getName() != null) {
- target.setName(source.getName());
- }
-
- // Program
- if (copyIfNull && (source.getProgram() == null || source.getProgram().getId() == null)) {
- target.setProgram(null);
- } else if (source.getName() != null && source.getProgram().getId() != null) {
- target.setProgram(programDao.load(source.getProgram().getId()));
- }
-
- // Vessel
- if (copyIfNull && (source.getVessel() == null || source.getVessel().size() == 0)) {
- target.setProgram(null);
- } else if (source.getVessel() != null && source.getVessel().size() > 0) {
- List<Vessel> vessels = source.getVessel();
- target.setVessel(vesselDao.load(vessels.get(0).getId()));
-
- if (vessels.size() > 1) {
- //throw new UnsupportedOperationException("Cruise could not yet support more than one vessel.");
- miscDataBuffer.append(CRUISE_MISC_DATA_VESSELS_TAG);
- for(int i=1; i<vessels.size(); i++) {
- if (i>1) miscDataBuffer.append(',');
- miscDataBuffer.append(vessels.get(i).getId());
- }
- }
- }
-
- // Year
- if (copyIfNull && source.getYear() == null && source.getBeginDate() == null) {
- target.setDepartureDateTime(null);
- }
- else if (source.getYear() != null && source.getBeginDate() == null) {
- // Set year into departure date time only if no departure date time has been set
- calendar.setTimeInMillis(0);
- calendar.set(Calendar.YEAR, source.getYear());
- // Add one millisecond to retrieve a 'year saved but no departure date'
- calendar.set(Calendar.MILLISECOND, 1);
- target.setDepartureDateTime(calendar.getTime());
- }
-
- // BeginDate
- if (copyIfNull && source.getYear() == null && source.getBeginDate() == null) {
- target.setDepartureDateTime(null);
- } else if (source.getBeginDate() != null) {
- target.setDepartureDateTime(source.getBeginDate());
- }
-
- // EndDate
- if (copyIfNull && source.getEndDate() == null) {
- target.setReturnDateTime(null);
- } else if (source.getEndDate() != null) {
- target.setReturnDateTime(source.getEndDate());
- }
-
- // Comment
- if (copyIfNull && source.getComment() == null) {
- target.setComments(null);
- } else if (source.getComment() != null) {
- target.setComments(source.getComment());
- }
-
- // Manager
- if (copyIfNull && (source.getHeadOfMission() == null || source.getHeadOfMission().size() == 0)) {
- target.setComments(null);
- } else if (source.getHeadOfMission() != null && source.getHeadOfMission().size() > 0) {
- if (source.getHeadOfMission().size() == 1) {
- Person managerPerson = source.getHeadOfMission().get(0);
- if (managerPerson.getId() != null) {
- target.setManagerPerson(personDao.load(Integer.valueOf(managerPerson.getId())));
- }
- }
- else {
- // TODO : comment gérer dans le modèle Adagio plus d'un manager ?
- throw new UnsupportedOperationException("Cruise could not yet support more than one manager person.");
- }
- }
-
- // Optional values in UI, but mandatory in DB
- if (target.getManagerPerson() == null) {
- target.setManagerPerson(personDao.load(enumeration.PERSON_ID_UNKNOWN_RECORDER_PERSON));
- }
-
- // Default values :
- target.setSynchronizationStatus(SynchronizationStatus.DIRTY.getValue());
- if (target.getCreationDate() == null) {
- target.setCreationDate(new Date());
- }
- if (target.getManagerPerson() != null) {
- target.setRecorderPerson(target.getManagerPerson());
- target.setRecorderDepartment(target.getManagerPerson().getDepartment());
- }
-
- // FishingTrip
- FishingTrip fishingTrip = null;
- if (target.getFishingTrips() == null || target.getFishingTrips().size() == 0) {
- fishingTrip = FishingTrip.Factory.newInstance();
- if (target.getFishingTrips() == null) {
- target.setFishingTrips(Lists.newArrayList(fishingTrip));
- fishingTrip.setScientificCruise(target);
- }
- else {
- target.getFishingTrips().add(fishingTrip);
- fishingTrip.setScientificCruise(target);
- }
- }
-
- // Fill fishing trip with scientificCruise info:
- fishingTrip.setDepartureDateTime(target.getDepartureDateTime());
- fishingTrip.setReturnDateTime(target.getReturnDateTime());
- fishingTrip.setVessel(target.getVessel());
- fishingTrip.setProgram(target.getProgram());
- fishingTrip.setRecorderPerson(target.getRecorderPerson());
- fishingTrip.setRecorderDepartment(target.getRecorderDepartment());
- fishingTrip.setCreationDate(target.getCreationDate());
- fishingTrip.setSynchronizationStatus(target.getSynchronizationStatus());
- if (fishingTrip.getQualityFlag() == null) {
- fishingTrip.setQualityFlag(qualityFlagDao.load(enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED));
- }
-
- if (fishingTrip.getReturnDateTime() == null && fishingTrip.getDepartureDateTime() != null) {
- calendar.setTime(fishingTrip.getDepartureDateTime());
- calendar.add(Calendar.MILLISECOND, 1); // = departureDateTime + 1ms
- fishingTrip.setReturnDateTime(calendar.getTime());
- }
-
- // Country
- if (copyIfNull && source.getCountry() == null || source.getCountry().getId() == null) {
- fishingTrip.setDepartureLocation(null);
- fishingTrip.setReturnLocation(null);
- } else if (source.getCountry() != null && source.getCountry().getId() != null) {
- Location locationCountry = locationDao.load(Integer.valueOf(source.getCountry().getId()));
- fishingTrip.setDepartureLocation(locationCountry);
- fishingTrip.setReturnLocation(locationCountry);
- }
-
- // Gear
- if (copyIfNull && source.isGearEmpty()) {
- miscDataBuffer.append(CRUISE_MISC_DATA_GEARS_TAG);
- } else if (!source.isGearEmpty()) {
- //throw new UnsupportedOperationException("Cruise could not yet support gears storage.");
- miscDataBuffer.append(CRUISE_MISC_DATA_GEARS_TAG);
- for(int i=0; i<source.getGear().size(); i++) {
- if (i>0) miscDataBuffer.append(',');
- miscDataBuffer.append(source.getGear().get(i).getId());
- }
- }
-
- // Save miscDataBuffer into comments
- // TODO BLA : vérifier que les UI Allegro n'utilise pas ce commentaires,
- // mais bien celui de scientificCruise
- fishingTrip.setComments(miscDataBuffer.toString());
- }
@Override
public Cruise saveCruise(Cruise bean) {
- throw new UnsupportedOperationException();
+ return cruiseService.saveCruise(bean);
}
//------------------------------------------------------------------------//
@@ -588,98 +312,96 @@
@Override
public List<TuttiProtocol> getAllProtocol() {
- throw new UnsupportedOperationException();
+ return protocolService.getAllProtocol();
}
@Override
- public TuttiProtocol getProtocol(String id) {
- throw new UnsupportedOperationException();
+ public TuttiProtocol saveProtocol(TuttiProtocol bean) {
+ return protocolService.saveProtocol(bean);
}
@Override
public TuttiProtocol createProtocol(TuttiProtocol bean) {
- throw new UnsupportedOperationException();
+ return protocolService.createProtocol(bean);
}
@Override
- public TuttiProtocol saveProtocol(TuttiProtocol bean) {
- throw new UnsupportedOperationException();
+ public TuttiProtocol getProtocol(String id) {
+ return protocolService.getProtocol(id);
}
+
//------------------------------------------------------------------------//
//-- Fishing operation methods --//
//------------------------------------------------------------------------//
@Override
public List<FishingOperation> getAllFishingOperation(String cruiseId) {
- throw new UnsupportedOperationException();
+ return fishingOperationService.getAllFishingOperation(cruiseId);
}
@Override
public FishingOperation getFishingOperation(String id) {
- throw new UnsupportedOperationException();
+ return fishingOperationService.getFishingOperation(id);
}
@Override
public FishingOperation createFishingOperation(FishingOperation bean) {
- throw new UnsupportedOperationException();
+ return fishingOperationService.createFishingOperation(bean);
}
@Override
public FishingOperation saveFishingOperation(FishingOperation bean) {
- throw new UnsupportedOperationException();
+ return fishingOperationService.saveFishingOperation(bean);
}
//------------------------------------------------------------------------//
//-- Species Batch methods --//
//------------------------------------------------------------------------//
-
@Override
public List<SpeciesBatch> getAllRootSpeciesBatch(String fishingOperationId) {
- throw new UnsupportedOperationException();
+ return speciesBatchService.getAllRootSpeciesBatch(fishingOperationId);
}
@Override
public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) {
- throw new UnsupportedOperationException();
+ return speciesBatchService.getAllSpeciesBatch(fishingOperationId);
}
@Override
public SpeciesBatch getSpeciesBatch(String id) {
- throw new UnsupportedOperationException();
+ return speciesBatchService.getSpeciesBatch(id);
}
@Override
- public SpeciesBatch createSpeciesBatch(SpeciesBatch bean,
- String parentBatchId) {
- throw new UnsupportedOperationException();
+ public SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId) {
+ return speciesBatchService.createSpeciesBatch(bean, parentBatchId);
}
@Override
public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) {
- throw new UnsupportedOperationException();
+ return speciesBatchService.saveSpeciesBatch(bean);
}
@Override
public void deleteSpeciesBatch(String id) {
- throw new UnsupportedOperationException();
+ speciesBatchService.deleteSpeciesBatch(id);
}
@Override
public void deleteSpeciesSubBatch(String id) {
- throw new UnsupportedOperationException();
+ speciesBatchService.deleteSpeciesSubBatch(id);
}
@Override
public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId) {
- throw new UnsupportedOperationException();
+ return speciesBatchService.getAllSpeciesBatchFrequency(speciesBatchId);
}
@Override
- public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
- List<SpeciesBatchFrequency> frequencies) {
- throw new UnsupportedOperationException();
+ public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, List<SpeciesBatchFrequency> frequencies) {
+ return speciesBatchService.saveSpeciesBatchFrequency(speciesBatchId, frequencies);
}
//------------------------------------------------------------------------//
@@ -688,27 +410,27 @@
@Override
public List<BenthosBatch> getAllBenthosBatch(String fishingOperationId) {
- throw new UnsupportedOperationException();
+ return benthosBatchService.getAllBenthosBatch(fishingOperationId);
}
@Override
public BenthosBatch getBenthosBatch(String id) {
- throw new UnsupportedOperationException();
+ return benthosBatchService.getBenthosBatch(id);
}
@Override
public BenthosBatch createBenthosBatch(BenthosBatch bean) {
- throw new UnsupportedOperationException();
+ return benthosBatchService.createBenthosBatch(bean);
}
@Override
public BenthosBatch saveBenthosBatch(BenthosBatch bean) {
- throw new UnsupportedOperationException();
+ return benthosBatchService.saveBenthosBatch(bean);
}
@Override
public void deleteBenthosBatch(String id) {
- throw new UnsupportedOperationException();
+ benthosBatchService.deleteBenthosBatch(id);
}
//------------------------------------------------------------------------//
@@ -717,27 +439,27 @@
@Override
public List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId) {
- throw new UnsupportedOperationException();
+ return planktonBatchService.getAllPlanktonBatch(fishingOperationId);
}
@Override
public PlanktonBatch getPlanktonBatch(String id) {
- throw new UnsupportedOperationException();
+ return planktonBatchService.getPlanktonBatch(id);
}
@Override
public PlanktonBatch createPlanktonBatch(PlanktonBatch bean) {
- throw new UnsupportedOperationException();
+ return planktonBatchService.createPlanktonBatch(bean);
}
@Override
public PlanktonBatch savePlanktonBatch(PlanktonBatch bean) {
- throw new UnsupportedOperationException();
+ return planktonBatchService.savePlanktonBatch(bean);
}
@Override
public void deletePlanktonBatch(String id) {
- throw new UnsupportedOperationException();
+ planktonBatchService.deletePlanktonBatch(id);
}
//------------------------------------------------------------------------//
@@ -746,27 +468,27 @@
@Override
public List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId) {
- throw new UnsupportedOperationException();
+ return macroWasteBatchService.getAllMacroWasteBatch(fishingOperationId);
}
@Override
public MacroWasteBatch getMacroWasteBatch(String id) {
- throw new UnsupportedOperationException();
+ return macroWasteBatchService.getMacroWasteBatch(id);
}
@Override
public MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean) {
- throw new UnsupportedOperationException();
+ return macroWasteBatchService.createMacroWasteBatch(bean);
}
@Override
public MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean) {
- throw new UnsupportedOperationException();
+ return macroWasteBatchService.saveMacroWasteBatch(bean);
}
@Override
public void deleteMacroWasteBatch(String id) {
- throw new UnsupportedOperationException();
+ macroWasteBatchService.deleteMacroWasteBatch(id);
}
//------------------------------------------------------------------------//
@@ -775,85 +497,32 @@
@Override
public List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId) {
- throw new UnsupportedOperationException();
+ return accidentalBatchService.getAllAccidentalBatch(fishingOperationId);
}
@Override
public AccidentalBatch getAccidentalBatch(String id) {
- throw new UnsupportedOperationException();
+ return accidentalBatchService.getAccidentalBatch(id);
}
@Override
public AccidentalBatch createAccidentalBatch(AccidentalBatch bean) {
- throw new UnsupportedOperationException();
+ return accidentalBatchService.createAccidentalBatch(bean);
}
@Override
public AccidentalBatch saveAccidentalBatch(AccidentalBatch bean) {
- throw new UnsupportedOperationException();
+ return accidentalBatchService.saveAccidentalBatch(bean);
}
@Override
public void deleteAccidentalBatch(String id) {
- throw new UnsupportedOperationException();
+ accidentalBatchService.deleteAccidentalBatch(id);
}
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected Iterator<Object[]> queryList(String queryName, Object... params) {
- Query query = sessionFactory.getCurrentSession().getNamedQuery(queryName);
-
- if (params.length > 0) {
-
- Preconditions.checkArgument(
- params.length % 3 == 0,
- "Params must be tuple (paramName, paramType, paramValue)");
-
- int nbParams = params.length / 3;
-
- for (int i = 0; i < nbParams; i++) {
- String paramName = (String) params[3 * i];
- Type paramType = (Type) params[3 * i + 1];
- Object paramValue = params[3 * i + 2];
- query.setParameter(paramName, paramValue, paramType);
- if (log.isDebugEnabled()) {
- log.debug("query [" + queryName + "] (param " + i
- + " [" + paramName + '=' + paramValue + "])");
- }
- }
- }
- Iterator result = query.iterate();
- return result;
- }
-
- protected Object[] queryUnique(String queryName, Object... params) {
-
- Query query = sessionFactory.getCurrentSession().getNamedQuery(queryName);
-
- if (params.length > 0) {
-
- Preconditions.checkArgument(
- params.length % 3 == 0,
- "Params must be tuple (paramName, paramType, paramValue)");
-
- int nbParams = params.length / 3;
-
- for (int i = 0; i < nbParams; i++) {
- String paramName = (String) params[3 * i];
- Type paramType = (Type) params[3 * i + 1];
- Object paramValue = params[3 * i + 2];
- query.setParameter(paramName, paramValue, paramType);
- if (log.isDebugEnabled()) {
- log.debug("query [" + queryName + "] (param " + i
- + " [" + paramName + '=' + paramValue + "])");
- }
- }
- }
- Object result = query.uniqueResult();
- return (Object[]) result;
- }
-
}
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,90 @@
+package fr.ifremer.tutti.persistence.service;
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.adagio.core.dao.administration.programStrategy.ProgramDao;
+import fr.ifremer.tutti.persistence.TuttiEnumerationFile;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.hibernate.classic.Session;
+import org.hibernate.type.Type;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.Resource;
+import java.util.Iterator;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public abstract class AbstractPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractPersistenceService.class);
+
+ /**
+ * Session factory.
+ *
+ * @since 0.3
+ */
+ @Autowired(required = true)
+ protected SessionFactory sessionFactory;
+
+ @Autowired(required = true)
+ protected TuttiEnumerationFile enumeration;
+
+ @Resource(name = "programDao")
+ protected ProgramDao programDao;
+
+ protected final SessionFactory getSessionFactory() {
+ return sessionFactory;
+ }
+
+ protected final Session getCurrentSession() {
+ return getSessionFactory().getCurrentSession();
+ }
+
+ protected Object[] queryUnique(String queryName, Object... params) {
+
+ Query query = createQuery(queryName, params);
+ Object result = query.uniqueResult();
+ return (Object[]) result;
+ }
+
+ protected Iterator<Object[]> queryList(String queryName, Object... params) {
+
+ Query query = createQuery(queryName, params);
+
+ Iterator result = query.iterate();
+ return result;
+ }
+
+ protected Query createQuery(String queryName, Object... params) {
+ Query query = getCurrentSession().getNamedQuery(queryName);
+
+ if (params.length > 0) {
+
+ Preconditions.checkArgument(
+ params.length % 3 == 0,
+ "Params must be tuple (paramName, paramType, paramValue)");
+
+ int nbParams = params.length / 3;
+
+ for (int i = 0; i < nbParams; i++) {
+ String paramName = (String) params[3 * i];
+ Type paramType = (Type) params[3 * i + 1];
+ Object paramValue = params[3 * i + 2];
+ query.setParameter(paramName, paramValue, paramType);
+ if (log.isDebugEnabled()) {
+ log.debug("query [" + queryName + "] (param " + i
+ + " [" + paramName + '=' + paramValue + "])");
+ }
+ }
+ }
+ return query;
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("accidentalBatchPersistenceService")
+@Transactional(readOnly = true)
+public class AccidentalBatchPersistenceServiceImpl extends AbstractPersistenceService implements AccidentalBatchPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AccidentalBatchPersistenceServiceImpl.class);
+
+ @Override
+ public List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId) {
+ return null;
+ }
+
+ @Override
+ public AccidentalBatch getAccidentalBatch(String id) {
+ return null;
+ }
+
+ @Override
+ public AccidentalBatch createAccidentalBatch(AccidentalBatch bean) {
+ return null;
+ }
+
+ @Override
+ public AccidentalBatch saveAccidentalBatch(AccidentalBatch bean) {
+ return null;
+ }
+
+ @Override
+ public void deleteAccidentalBatch(String id) {
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("benthosBatchPersistenceService")
+@Transactional(readOnly = true)
+public class BenthosBatchPersistenceServiceImpl extends AbstractPersistenceService implements BenthosBatchPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(BenthosBatchPersistenceServiceImpl.class);
+
+ @Override
+ public List<BenthosBatch> getAllBenthosBatch(String fishingOperationId) {
+ return null;
+ }
+
+ @Override
+ public BenthosBatch getBenthosBatch(String id) {
+ return null;
+ }
+
+ @Override
+ public BenthosBatch createBenthosBatch(BenthosBatch bean) {
+ return null;
+ }
+
+ @Override
+ public BenthosBatch saveBenthosBatch(BenthosBatch bean) {
+ return null;
+ }
+
+ @Override
+ public void deleteBenthosBatch(String id) {
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,337 @@
+package fr.ifremer.tutti.persistence.service;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.adagio.core.dao.administration.user.PersonDao;
+import fr.ifremer.adagio.core.dao.data.survey.fishingTrip.FishingTrip;
+import fr.ifremer.adagio.core.dao.data.survey.scientificCruise.ScientificCruise;
+import fr.ifremer.adagio.core.dao.data.survey.scientificCruise.ScientificCruiseDao;
+import fr.ifremer.adagio.core.dao.referential.QualityFlagDao;
+import fr.ifremer.adagio.core.dao.referential.location.Location;
+import fr.ifremer.adagio.core.dao.referential.location.LocationDao;
+import fr.ifremer.adagio.core.dao.referential.vessel.VesselDao;
+import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.type.IntegerType;
+import org.hibernate.type.StringType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("cruisePersistenceService")
+@Transactional(readOnly = true)
+public class CruisePersistenceServiceImpl extends AbstractPersistenceService implements CruisePersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(CruisePersistenceServiceImpl.class);
+
+ protected static String CRUISE_MISC_DATA_VESSELS_TAG = "#VESSELS=";
+
+ protected static String CRUISE_MISC_DATA_GEARS_TAG = "#GEARS=";
+
+ @Autowired(required = true)
+ protected ReferentialPersistenceService referentielService;
+
+ @Autowired(required = true)
+ protected ProgramPersistenceService programService;
+
+ @Resource(name = "scientificCruiseDao")
+ protected ScientificCruiseDao scientificCruiseDao;
+
+ @Resource(name = "personDao")
+ protected PersonDao personDao;
+
+ @Resource(name = "vesselDao")
+ protected VesselDao vesselDao;
+
+ @Resource(name = "locationDao")
+ protected LocationDao locationDao;
+
+ @Resource(name = "qualityFlagDao")
+ protected QualityFlagDao qualityFlagDao;
+
+ protected Calendar calendar = new GregorianCalendar();
+
+ @Override
+ public List<Cruise> getAllCruise(String programId) {
+ Iterator<Object[]> list = queryList(
+ "allCruises",
+ "programCode", StringType.INSTANCE, programId);
+
+ List<Cruise> result = Lists.newArrayList();
+ while (list.hasNext()) {
+ Object[] source = list.next();
+ Cruise target = new Cruise();
+ target.setId(String.valueOf(source[0]));
+ target.setName((String) source[1]);
+ target.setBeginDate((Date) source[2]);
+ result.add(target);
+ }
+ return result;
+ }
+
+ @Override
+ public Cruise getCruise(String id) {
+ Object[] source = queryUnique(
+ "cruise",
+ "cruiseId", IntegerType.INSTANCE, Integer.valueOf(id),
+ "countryLocationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_COUNTRY);
+
+ Cruise result = new Cruise();
+ result.setId(id);
+
+ String programCode = (String) source[0];
+ Program program = programService.getProgram(programCode);
+ result.setProgram(program);
+
+ result.setYear((Integer) source[1]);
+ result.setName((String) source[2]);
+
+ String countryId = String.valueOf(source[3]);
+ String countryLabel = (String) source[4];
+ String countryName = (String) source[5];
+ Country c = new Country();
+ c.setId(countryId);
+ c.setName(countryName);
+ c.setLabel(countryLabel);
+ result.setCountry(c);
+
+ result.setBeginDate((Date) source[6]);
+ result.setEndDate((Date) source[7]);
+
+ List<Vessel> vessels = Lists.newArrayList();
+
+ String vesselCode = (String) source[8];
+ Vessel vessel = referentielService.getVessel(vesselCode);
+ vessels.add(vessel);
+
+ Integer managerId = (Integer) source[9];
+ Person manager = referentielService.getPerson(managerId);
+ result.setHeadOfMission(Lists.newArrayList(manager));
+
+ result.setComment((String) source[10]);
+
+ // get gears
+ Iterator<Object[]> list = queryList(
+ "allCruiseGears",
+ "cruiseId", IntegerType.INSTANCE, Integer.valueOf(id));
+
+ List<Gear> gears = Lists.newArrayList();
+ while (list.hasNext()) {
+ Object[] zoneSource = list.next();
+ Gear target = new Gear();
+ target.setId((String) zoneSource[0]);
+ target.setLabel((String) zoneSource[1]);
+ target.setName((String) zoneSource[2]);
+ gears.add(target);
+ }
+
+ // get secondary vessels
+ list = queryList(
+ "allCruiseSecondaryVessels",
+ "cruiseId", IntegerType.INSTANCE, Integer.valueOf(id));
+
+ while (list.hasNext()) {
+ Object[] zoneSource = list.next();
+ vesselCode = (String) zoneSource[0];
+ vessel = referentielService.getVessel(vesselCode);
+ vessels.add(vessel);
+ }
+
+ result.setVessel(vessels);
+ return result;
+ }
+
+ @Transactional(readOnly = false)
+ @Override
+ public Cruise createCruise(Cruise bean) {
+ ScientificCruise scientificCruise = ScientificCruise.Factory.newInstance();
+ cruiseToEntity(bean, scientificCruise, true);
+ scientificCruiseDao.create(scientificCruise);
+
+ bean.setId(String.valueOf(scientificCruise.getId()));
+ return bean;
+ }
+
+ @Transactional(readOnly = false)
+ @Override
+ public Cruise saveCruise(Cruise bean) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void cruiseToEntity(Cruise source, ScientificCruise target, boolean copyIfNull) {
+ StringBuffer miscDataBuffer = new StringBuffer();
+
+ // Name
+ if (copyIfNull && source.getName() == null) {
+ target.setName(null);
+ } else if (source.getName() != null) {
+ target.setName(source.getName());
+ }
+
+ // Program
+ if (copyIfNull && (source.getProgram() == null || source.getProgram().getId() == null)) {
+ target.setProgram(null);
+ } else if (source.getName() != null && source.getProgram().getId() != null) {
+ target.setProgram(programDao.load(source.getProgram().getId()));
+ }
+
+ // Vessel
+ if (copyIfNull && (source.getVessel() == null || source.getVessel().size() == 0)) {
+ target.setProgram(null);
+ } else if (source.getVessel() != null && source.getVessel().size() > 0) {
+ List<Vessel> vessels = source.getVessel();
+ target.setVessel(vesselDao.load(vessels.get(0).getId()));
+
+ if (vessels.size() > 1) {
+ //throw new UnsupportedOperationException("Cruise could not yet support more than one vessel.");
+ miscDataBuffer.append(CRUISE_MISC_DATA_VESSELS_TAG);
+ for (int i = 1; i < vessels.size(); i++) {
+ if (i > 1) miscDataBuffer.append(',');
+ miscDataBuffer.append(vessels.get(i).getId());
+ }
+ }
+ }
+
+ // Year
+ if (copyIfNull && source.getYear() == null && source.getBeginDate() == null) {
+ target.setDepartureDateTime(null);
+ } else if (source.getYear() != null && source.getBeginDate() == null) {
+ // Set year into departure date time only if no departure date time has been set
+ calendar.setTimeInMillis(0);
+ calendar.set(Calendar.YEAR, source.getYear());
+ // Add one millisecond to retrieve a 'year saved but no departure date'
+ calendar.set(Calendar.MILLISECOND, 1);
+ target.setDepartureDateTime(calendar.getTime());
+ }
+
+ // BeginDate
+ if (copyIfNull && source.getYear() == null && source.getBeginDate() == null) {
+ target.setDepartureDateTime(null);
+ } else if (source.getBeginDate() != null) {
+ target.setDepartureDateTime(source.getBeginDate());
+ }
+
+ // EndDate
+ if (copyIfNull && source.getEndDate() == null) {
+ target.setReturnDateTime(null);
+ } else if (source.getEndDate() != null) {
+ target.setReturnDateTime(source.getEndDate());
+ }
+
+ // Comment
+ if (copyIfNull && source.getComment() == null) {
+ target.setComments(null);
+ } else if (source.getComment() != null) {
+ target.setComments(source.getComment());
+ }
+
+ // Manager
+ if (copyIfNull && (source.getHeadOfMission() == null || source.getHeadOfMission().size() == 0)) {
+ target.setComments(null);
+ } else if (source.getHeadOfMission() != null && source.getHeadOfMission().size() > 0) {
+ if (source.getHeadOfMission().size() == 1) {
+ Person managerPerson = source.getHeadOfMission().get(0);
+ if (managerPerson.getId() != null) {
+ target.setManagerPerson(personDao.load(Integer.valueOf(managerPerson.getId())));
+ }
+ } else {
+ // TODO : comment gérer dans le modèle Adagio plus d'un manager ?
+ throw new UnsupportedOperationException("Cruise could not yet support more than one manager person.");
+ }
+ }
+
+ // Optional values in UI, but mandatory in DB
+ if (target.getManagerPerson() == null) {
+ target.setManagerPerson(personDao.load(enumeration.PERSON_ID_UNKNOWN_RECORDER_PERSON));
+ }
+
+ // Default values :
+ target.setSynchronizationStatus(SynchronizationStatus.DIRTY.getValue());
+ if (target.getCreationDate() == null) {
+ target.setCreationDate(new Date());
+ }
+ if (target.getManagerPerson() != null) {
+ target.setRecorderPerson(target.getManagerPerson());
+ target.setRecorderDepartment(target.getManagerPerson().getDepartment());
+ }
+
+ // FishingTrip
+ FishingTrip fishingTrip = null;
+ if (target.getFishingTrips() == null || target.getFishingTrips().size() == 0) {
+ fishingTrip = FishingTrip.Factory.newInstance();
+ if (target.getFishingTrips() == null) {
+ target.setFishingTrips(Lists.newArrayList(fishingTrip));
+ fishingTrip.setScientificCruise(target);
+ } else {
+ target.getFishingTrips().add(fishingTrip);
+ fishingTrip.setScientificCruise(target);
+ }
+ }
+
+ // Fill fishing trip with scientificCruise info:
+ fishingTrip.setDepartureDateTime(target.getDepartureDateTime());
+ fishingTrip.setReturnDateTime(target.getReturnDateTime());
+ fishingTrip.setVessel(target.getVessel());
+ fishingTrip.setProgram(target.getProgram());
+ fishingTrip.setRecorderPerson(target.getRecorderPerson());
+ fishingTrip.setRecorderDepartment(target.getRecorderDepartment());
+ fishingTrip.setCreationDate(target.getCreationDate());
+ fishingTrip.setSynchronizationStatus(target.getSynchronizationStatus());
+ if (fishingTrip.getQualityFlag() == null) {
+ fishingTrip.setQualityFlag(qualityFlagDao.load(enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED));
+ }
+
+ if (fishingTrip.getReturnDateTime() == null && fishingTrip.getDepartureDateTime() != null) {
+ calendar.setTime(fishingTrip.getDepartureDateTime());
+ calendar.add(Calendar.MILLISECOND, 1); // = departureDateTime + 1ms
+ fishingTrip.setReturnDateTime(calendar.getTime());
+ }
+
+ // Country
+ if (copyIfNull && source.getCountry() == null || source.getCountry().getId() == null) {
+ fishingTrip.setDepartureLocation(null);
+ fishingTrip.setReturnLocation(null);
+ } else if (source.getCountry() != null && source.getCountry().getId() != null) {
+ Location locationCountry = locationDao.load(Integer.valueOf(source.getCountry().getId()));
+ fishingTrip.setDepartureLocation(locationCountry);
+ fishingTrip.setReturnLocation(locationCountry);
+ }
+
+ // Gear
+ if (copyIfNull && source.isGearEmpty()) {
+ miscDataBuffer.append(CRUISE_MISC_DATA_GEARS_TAG);
+ } else if (!source.isGearEmpty()) {
+ //throw new UnsupportedOperationException("Cruise could not yet support gears storage.");
+ miscDataBuffer.append(CRUISE_MISC_DATA_GEARS_TAG);
+ for (int i = 0; i < source.getGear().size(); i++) {
+ if (i > 0) miscDataBuffer.append(',');
+ miscDataBuffer.append(source.getGear().get(i).getId());
+ }
+ }
+
+ // Save miscDataBuffer into comments
+ // TODO BLA : vérifier que les UI Allegro n'utilise pas ce commentaires,
+ // mais bien celui de scientificCruise
+ fishingTrip.setComments(miscDataBuffer.toString());
+ }
+
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,42 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("fishingOperationPersistenceService")
+@Transactional(readOnly = true)
+public class FishingOperationPersistenceServiceImpl extends AbstractPersistenceService implements FishingOperationPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FishingOperationPersistenceServiceImpl.class);
+
+ @Override
+ public List<FishingOperation> getAllFishingOperation(String cruiseId) {
+ return null;
+ }
+
+ @Override
+ public FishingOperation getFishingOperation(String id) {
+ return null;
+ }
+
+ @Override
+ public FishingOperation createFishingOperation(FishingOperation bean) {
+ return null;
+ }
+
+ @Override
+ public FishingOperation saveFishingOperation(FishingOperation bean) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("macroWasteBatchPersistenceService")
+@Transactional(readOnly = true)
+public class MacroWasteBatchPersistenceServiceImpl extends AbstractPersistenceService implements MacroWasteBatchPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MacroWasteBatchPersistenceServiceImpl.class);
+
+ @Override
+ public List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId) {
+ return null;
+ }
+
+ @Override
+ public MacroWasteBatch getMacroWasteBatch(String id) {
+ return null;
+ }
+
+ @Override
+ public MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean) {
+ return null;
+ }
+
+ @Override
+ public MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean) {
+ return null;
+ }
+
+ @Override
+ public void deleteMacroWasteBatch(String id) {
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("planktonBatchPersistenceService")
+@Transactional(readOnly = true)
+public class PlanktonBatchPersistenceServiceImpl extends AbstractPersistenceService implements PlanktonBatchPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(PlanktonBatchPersistenceServiceImpl.class);
+
+ @Override
+ public List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId) {
+ return null;
+ }
+
+ @Override
+ public PlanktonBatch getPlanktonBatch(String id) {
+ return null;
+ }
+
+ @Override
+ public PlanktonBatch createPlanktonBatch(PlanktonBatch bean) {
+ return null;
+ }
+
+ @Override
+ public PlanktonBatch savePlanktonBatch(PlanktonBatch bean) {
+ return null;
+ }
+
+ @Override
+ public void deletePlanktonBatch(String id) {
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.persistence.service;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.type.StringType;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("programPersistenceService")
+@Transactional(readOnly = true)
+public class ProgramPersistenceServiceImpl extends AbstractPersistenceService implements ProgramPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ProgramPersistenceServiceImpl.class);
+
+ @Override
+ public List<Program> getAllProgram() {
+ Iterator<Object[]> list = queryList("allPrograms");
+
+ List<Program> result = Lists.newArrayList();
+ while (list.hasNext()) {
+ Object[] source = list.next();
+ Program target = new Program();
+ target.setId((String) source[0]);
+ target.setName((String) source[1]);
+ result.add(target);
+ }
+ return result;
+ }
+
+ @Override
+ public Program getProgram(String id) {
+ Object[] source = queryUnique(
+ "program",
+ "programCode", StringType.INSTANCE, id);
+
+ Program result = new Program();
+ result.setId((String) source[0]);
+ result.setName((String) source[1]);
+
+ // get program locations
+ Iterator<Object[]> list = queryList(
+ "allProgramLocations",
+ "programCode", StringType.INSTANCE, id);
+
+ List<Zone> zones = Lists.newArrayList();
+ while (list.hasNext()) {
+ Object[] zoneSource = list.next();
+ Zone target = new Zone();
+ target.setId(String.valueOf(zoneSource[0]));
+ target.setLabel((String) zoneSource[1]);
+ target.setName((String) zoneSource[2]);
+ zones.add(target);
+ }
+ if (!zones.isEmpty()) {
+ result.setZone(zones.get(0));
+ }
+
+ return result;
+ }
+
+ @Override
+ public Program createProgram(Program bean) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Program saveProgram(Program bean) {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,42 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("protocolPersistenceService")
+@Transactional(readOnly = true)
+public class ProtocolPersistenceServiceImpl extends AbstractPersistenceService implements ProtocolPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ProtocolPersistenceServiceImpl.class);
+
+ @Override
+ public List<TuttiProtocol> getAllProtocol() {
+ return null;
+ }
+
+ @Override
+ public TuttiProtocol getProtocol(String id) {
+ return null;
+ }
+
+ @Override
+ public TuttiProtocol createProtocol(TuttiProtocol bean) {
+ return null;
+ }
+
+ @Override
+ public TuttiProtocol saveProtocol(TuttiProtocol bean) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -26,11 +26,9 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-
import fr.ifremer.adagio.core.dao.referential.StatusDao;
-import fr.ifremer.adagio.core.dao.referential.taxon.TaxonRefTaxVO;
import fr.ifremer.adagio.core.dao.referential.taxon.TaxonNameExtendDao;
-import fr.ifremer.tutti.persistence.TuttiEnumerationFile;
+import fr.ifremer.adagio.core.dao.referential.taxon.TaxonRefTaxVO;
import fr.ifremer.tutti.persistence.entities.referential.AbstractTuttiReferentialEntity;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
@@ -45,12 +43,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
-import org.hibernate.SessionFactory;
import org.hibernate.type.DateType;
import org.hibernate.type.IntegerType;
import org.hibernate.type.StringType;
-import org.hibernate.type.Type;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@@ -65,30 +61,20 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
+@Service("referentialPersistenceService")
@Transactional(readOnly = true)
-public class ReferentialPersistenceServiceImpl implements ReferentialPersistenceService {
+public class ReferentialPersistenceServiceImpl extends AbstractPersistenceService implements ReferentialPersistenceService {
/** Logger. */
private static final Log log =
LogFactory.getLog(ReferentialPersistenceServiceImpl.class);
- /**
- * Session factory.
- *
- * @since 0.3
- */
- @Autowired(required = true)
- protected SessionFactory sessionFactory;
-
@Resource(name = "taxonNameDao")
protected TaxonNameExtendDao taxonNameDao;
-
+
@Resource(name = "statusDao")
- protected StatusDao statusDao;
+ protected StatusDao statusDao;
- @Autowired(required = true)
- protected TuttiEnumerationFile enumeration;
-
//------------------------------------------------------------------------//
//-- ReferentialPersistenceService implentation --//
//------------------------------------------------------------------------//
@@ -124,7 +110,7 @@
Country target = new Country();
target.setId(String.valueOf(source[0]));
target.setLabel((String) source[1]);
- target.setName((String) source[2]);
+ target.setName((String) source[2]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], target);
result.add(target);
}
@@ -164,10 +150,9 @@
return result;
}
-
@Override
public Vessel getVessel(String vesselCode) {
- Object[] source = queryUnique(
+ Object[] source = queryUniqueWithStatus(
"vessel",
"vesselCode", StringType.INSTANCE, vesselCode,
"refDate", DateType.INSTANCE, new Date());
@@ -493,10 +478,10 @@
protected FishingOperationLocation loadFishingOperationLocation(Object[] source) {
FishingOperationLocation target = new FishingOperationLocation();
target.setId(String.valueOf(source[0]));
- target.setName((String)source[1]);
- target.setLabel((String)source[2]);
+ target.setName((String) source[1]);
+ target.setLabel((String) source[2]);
// target.setDescription((String)source[3]);
- target.setLocationLevel((Integer)source[3]);
+ target.setLocationLevel((Integer) source[3]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[4], target);
return target;
@@ -525,8 +510,8 @@
protected Gear loadGear(Object[] source) {
Gear result = new Gear();
result.setId(String.valueOf(source[0]));
- result.setName((String)source[1]);
- result.setLabel((String)source[2]);
+ result.setName((String) source[1]);
+ result.setLabel((String) source[2]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], result);
return result;
}
@@ -551,12 +536,6 @@
return result;
}
- protected Iterator<Object[]> queryList(String queryName, Object... params) {
- Query query = createQuery(queryName, params);
- Iterator result = query.iterate();
- return result;
- }
-
protected Object[] queryUniqueWithStatus(String queryName, Object... params) {
Query query = createQuery(queryName, params);
@@ -567,37 +546,5 @@
return (Object[]) result;
}
- protected Object[] queryUnique(String queryName, Object... params) {
- Query query = createQuery(queryName, params);
- Object result = query.uniqueResult();
- return (Object[]) result;
- }
-
- protected Query createQuery(String queryName, Object... params) {
- Query query = sessionFactory.getCurrentSession().getNamedQuery(queryName);
-
- if (params.length > 0) {
-
- Preconditions.checkArgument(
- params.length % 3 == 0,
- "Params must be tuple (paramName, paramType, paramValue)");
-
- int nbParams = params.length / 3;
-
- for (int i = 0; i < nbParams; i++) {
- String paramName = (String) params[3 * i];
- Type paramType = (Type) params[3 * i + 1];
- Object paramValue = params[3 * i + 2];
- query.setParameter(paramName, paramValue, paramType);
- if (log.isDebugEnabled()) {
- log.debug("query [" + queryName + "] (param " + i
- + " [" + paramName + '=' + paramValue + "])");
- }
- }
- }
- return query;
- }
-
-
}
Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,66 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Service("speciesBatchPersistenceService")
+@Transactional(readOnly = true)
+public class SpeciesBatchPersistenceServiceImpl extends AbstractPersistenceService implements SpeciesBatchPersistenceService {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SpeciesBatchPersistenceServiceImpl.class);
+
+ @Override
+ public List<SpeciesBatch> getAllRootSpeciesBatch(String fishingOperationId) {
+ return null;
+ }
+
+ @Override
+ public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) {
+ return null;
+ }
+
+ @Override
+ public SpeciesBatch getSpeciesBatch(String id) {
+ return null;
+ }
+
+ @Override
+ public SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId) {
+ return null;
+ }
+
+ @Override
+ public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) {
+ return null;
+ }
+
+ @Override
+ public void deleteSpeciesBatch(String id) {
+ }
+
+ @Override
+ public void deleteSpeciesSubBatch(String id) {
+ }
+
+ @Override
+ public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId) {
+ return null;
+ }
+
+ @Override
+ public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, List<SpeciesBatchFrequency> frequencies) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -39,12 +39,11 @@
new TuttiPersistenceServiceLocator();
protected TuttiPersistenceServiceLocator() {
- super("beanRefFactory.xml",
- "TuttiBeanRefFactory");
+ super("beanRefFactory.xml", "TuttiBeanRefFactory");
}
public static TuttiPersistence getPersistenceService() {
- return INSTANCE.getService("adagioPersistenceService",
+ return INSTANCE.getService("tuttiPersistence",
TuttiPersistence.class);
}
@@ -53,6 +52,51 @@
ReferentialPersistenceService.class);
}
+ public static ProgramPersistenceService getProgramPersistenceService() {
+ return INSTANCE.getService("programPersistenceService",
+ ProgramPersistenceService.class);
+ }
+
+ public static CruisePersistenceService getCruisePersistenceService() {
+ return INSTANCE.getService("cruisePersistenceService",
+ CruisePersistenceService.class);
+ }
+
+ public static FishingOperationPersistenceService getFishingOperationPersistenceService() {
+ return INSTANCE.getService("fishingOperationPersistenceService",
+ FishingOperationPersistenceService.class);
+ }
+
+ public static SpeciesBatchPersistenceService getSpeciesBatchPersistenceService() {
+ return INSTANCE.getService("speciesBatchPersistenceService",
+ SpeciesBatchPersistenceService.class);
+ }
+
+ public static BenthosBatchPersistenceService getBenthosBatchPersistenceService() {
+ return INSTANCE.getService("benthosBatchPersistenceService",
+ BenthosBatchPersistenceService.class);
+ }
+
+ public static PlanktonBatchPersistenceService getPlanktonBatchPersistenceService() {
+ return INSTANCE.getService("planktonBatchPersistenceService",
+ PlanktonBatchPersistenceService.class);
+ }
+
+ public static MacroWasteBatchPersistenceService getMacroWasteBatchPersistenceService() {
+ return INSTANCE.getService("macroWasteBatchPersistenceService",
+ MacroWasteBatchPersistenceService.class);
+ }
+
+ public static AccidentalBatchPersistenceService getAccidentalBatchPersistenceService() {
+ return INSTANCE.getService("accidentalBatchPersistenceService",
+ AccidentalBatchPersistenceService.class);
+ }
+
+ public static ProtocolPersistenceService getProtocolPersistenceService() {
+ return INSTANCE.getService("protocolPersistenceService",
+ ProtocolPersistenceService.class);
+ }
+
public static void close() {
INSTANCE.shutdown();
}
Modified: trunk/tutti-persistence-adagio/src/main/resources/applicationContext-service-tutti.xml
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/applicationContext-service-tutti.xml 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/resources/applicationContext-service-tutti.xml 2013-01-14 13:22:48 UTC (rev 189)
@@ -25,443 +25,16 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
- <!-- Activates various annotations to be detected in bean classes: Spring's
- @Required and @Autowired, as well as JSR 250's @PostConstruct, @PreDestroy
- and @Resource (if available) and JPA's @PersistenceContext and @PersistenceUnit
- (if available). -->
- <context:annotation-config />
+ <context:component-scan base-package="fr.ifremer.tutti.persistence.service"/>
- <!--Platform Transaction Manager declared as "transactionManager" will be
- used. -->
- <!--"aspectj" mode enables load-time/compile-time weaving of transactional
- methods, which enables those methods to be intercepted even when called internally.
- (Unlike Spring generated proxies which will only be intercepted when called
- from outside) -->
- <tx:annotation-driven transaction-manager="transactionManager"/>
-
- <bean id="locationService"
- class="fr.ifremer.adagio.core.service.referential.location.impl.LocationServiceImpl"/>
-
- <bean id="referentialPersistenceService"
- class="fr.ifremer.tutti.persistence.service.ReferentialPersistenceServiceImpl"/>
-
- <bean id="adagioPersistenceService" init-method="open" destroy-method="close"
+ <bean id="tuttiPersistence" init-method="open" destroy-method="close"
class="fr.ifremer.tutti.persistence.TuttiPersistenceAdagioImpl"/>
<bean init-method="init"
class="fr.ifremer.tutti.persistence.TuttiEnumerationFile"/>
- <!--Enables the use of @AspectJ style of aspects' declarations. AspectJ
- run-time isn't necessarily involved -->
- <!--<aop:aspectj-autoproxy />-->
-
- <!--bean id="dataSource2"
- class="org.apache.commons.dbcp.BasicDataSource"
- destroy-method="close">
- <property name="driverClassName" value="${dataSource.jdbc.driver}"/>
- <property name="url" value="${dataSource.jdbc.url}"/>
- <property name="username" value="${dataSource.jdbc.username}"/>
- <property name="password" value="${dataSource.jdbc.password}"/>
- </bean>
-
- <bean id="sessionFactory2"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource2" />
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.default_batch_fetch_size">40</prop>
- <prop key="hibernate.max_fetch_depth">4</prop>
- <prop key="hibernate.query.substitutions">true 1, false 0</prop>
- <prop key="hibernate.cache.use_second_level_cache">true</prop>
- <prop key="hibernate.cache.use_query_cache">true</prop>
-
- <prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</prop>
- <prop key="hibernate.cache.query_cache_factory">org.hibernate.cache.StandardQueryCacheFactory</prop>
- <prop key="net.sf.ehcache.configurationResourceName">ehcache.xml</prop>
- <prop key="hibernate.format_sql">true</prop>
- <prop key="hibernate.use_sql_comments">true</prop>
- <prop key="hibernate.bytecode.provider">cglib</prop>
- <prop key="hibernate.jdbc.use_streams_for_binary">true</prop>
-
- <prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
-
- </props>
- </property-->
- <!--property name="mappingResources">
- <list>
- <value>queries-override2.hbm.xml</value>
- <value>file:///home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/Author.hbm.xml</value>
- </list>
- </property-->
- <!--property name="mappingLocations">
- <list>
- <value>classpath:queries.hbm.xml</value>
- <value>classpath:queries-override.hbm.xml</value>
- <value>file:///home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/PersonSessionVessel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/UserProfil.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/PersonSession.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/VesselManagePeriod.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/ManagedDataTransfer.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/ManagedDataType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/DepartmentPrivilegeTransfert.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/Person.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/ManagedData.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/ageReader/AgeReaderQualification.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/user/Department.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/Strategy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/PmfmAppliedStrategy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/ReferenceTaxonStrategy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/AppliedStrategy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/AppliedPeriod.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/Program2Person.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/Program.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/AcquisitionLevel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/BatchModelAppliedStrategy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/Program2Department.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/ProgramPrivilege.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/administration/programStrategy/PmfmStrategy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/technical/optimization/grouping/GroupingVesselHierarchy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/technical/optimization/grouping/GroupingItemHierarchy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/technical/optimization/location/LocationHierarchyException.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/technical/optimization/location/LocationHierarchy.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/DepthGradient.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/NearbySpecificArea.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/RegulationArea2RegulationLocation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/RegulationArea.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/Corpus.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/CorpusType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/RightToProduce.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/MinimumSizeAllowed.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/regulation/Fishery.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/seller/SellerType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/seller/Seller.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/PrecisionType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingItem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingSystem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingItemType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingSide.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/ProcessingStatus.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/DistanceToCoastGradient.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/spatial/SpatialItem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemLine.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemArea.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/spatial/SpatialItem2Location.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemPoint.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/SurveyQualification.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/VesselType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/ObjectType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/Status.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/ProcessingType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/LinkedItemType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/gear/GearClassification.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/gear/GearClassificationAssociation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/gear/GearAssociation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/gear/Gear.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/location/Location.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/location/LocationClassification.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/location/LocationLevel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/location/LocationAssociation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/samplingScheme/denormalized/DenormalizedSamplingStrata.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/buyer/Buyer.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/buyer/BuyerType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/grouping/GroupingClassification.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/grouping/GroupingItem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/grouping/Grouping.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/grouping/GroupingLevel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/PhotoType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/SaleType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroup.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroupHistoricalRecord.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/ReferenceDocument.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroupType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/Citation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonInformation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroupInformation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonNameHistory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/Author.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/ReferenceTaxon.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonInformationHistory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonName.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/TaxonomicLevel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/taxon/VirtualComponent.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselOwner.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/EducationGrade.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselFeatures.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselRegistrationPeriod.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselOwnerPeriod.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselEngineType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselMasterPeriod.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/Vessel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/vessel/VesselMaster.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/metier/Metier.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/order/OrderItem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/order/OrderType.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/conversion/UnitConversion.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/conversion/WeightLengthConversion.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/conversion/RoundWeightConversion.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/qualification/QualificationRule.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/Matrix.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/Unit.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/ParameterGroup.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/Fraction.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/Method.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/Pmfm.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/Parameter.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/AggregationLevel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/pmfm/QualitativeValue.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/NumericalPrecision.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/QualityFlag.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/referential/AnalysisInstrument.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/batch/BatchExhaustiveInventory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/batch/BatchModel.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/batch/Batch.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/batch/denormalized/DenormalizedBatch.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/batch/denormalized/DenormalisedBatchSortingValue.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/qualification/AppliedQualificationRule.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/qualification/QualifiedItem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/takeOver/TakeOver.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/physicalGear/PhysicalGearSurvey.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/declaration/DeclaredDocumentReference.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/economy/EconomicalSurvey.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/activity/ActivityCalendar.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/activity/DailyActivityCalendar.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/sale/SaleOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/sale/Sale.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/fishingTrip/FishingTrip.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/fishingTrip/FishingTripOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/scientificCruise/ScientificCruise.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/fishingEffort/FishingEffortCalendar.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/landing/LandingOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/survey/landing/Landing.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/sale/ExpectedSale.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/fishingArea/FishingArea2RegulationLocation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/fishingArea/FishingArea.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/operation/denormalized/DenormalizedOperation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/operation/Operation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/operation/OperationVesselAssociation.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/sample/Sample.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/transshipment/Transshipment.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/LandingMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/VesselPhysicalMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/QuantificationMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/VesselUseMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/file/MeasurementFile.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/VesselPositionMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/SaleMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/photo/Photo.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/TakeOverMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/GearUseMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/SortingMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/SampleMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/SurveyMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/measure/GearPhysicalMeasurement.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/link/LinkedItem.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/produce/Produce.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/history/UpdatedItemHistory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/history/InsertedItemHistory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/history/ProcessingHistory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/history/DeletedItemHistory.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/position/VesselPosition.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/physical/GearPhysicalFeatures.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/physical/VesselPhysicalFeaturesOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/physical/VesselPhysicalFeatures.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/physical/GearPhysicalFeaturesOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/use/VesselUseFeaturesOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/use/GearUseFeaturesOrigin.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/use/VesselUseFeatures.hbm.xml</value>
- <value>classpath:fr/ifremer/adagio/core/dao/data/vessel/feature/use/GearUseFeatures.hbm.xml</value>
- </list>
- </property-->
- <!--property name="mappingLocations">
- <list>
- <value>queries-override2.hbm.xml</value>
- <value>file:///home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/Author.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/PersonSessionVessel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/UserProfil.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/PersonSession.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/VesselManagePeriod.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/ManagedDataTransfer.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/ManagedDataType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/DepartmentPrivilegeTransfert.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/Person.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/ManagedData.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/ageReader/AgeReaderQualification.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/user/Department.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/Strategy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/PmfmAppliedStrategy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/ReferenceTaxonStrategy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/AppliedStrategy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/AppliedPeriod.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/Program2Person.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/Program.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/AcquisitionLevel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/BatchModelAppliedStrategy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/Program2Department.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/ProgramPrivilege.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/administration/programStrategy/PmfmStrategy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/technical/optimization/grouping/GroupingVesselHierarchy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/technical/optimization/grouping/GroupingItemHierarchy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/technical/optimization/location/LocationHierarchyException.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/technical/optimization/location/LocationHierarchy.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/DepthGradient.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/NearbySpecificArea.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/RegulationArea2RegulationLocation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/RegulationArea.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/Corpus.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/CorpusType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/RightToProduce.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/MinimumSizeAllowed.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/regulation/Fishery.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/seller/SellerType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/seller/Seller.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/PrecisionType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingItem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingSystem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingItemType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/transcribing/TranscribingSide.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/ProcessingStatus.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/DistanceToCoastGradient.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/spatial/SpatialItem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemLine.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemArea.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/spatial/SpatialItem2Location.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/spatial/SpatialItemPoint.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/SurveyQualification.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/VesselType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/ObjectType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/Status.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/ProcessingType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/LinkedItemType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/gear/GearClassification.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/gear/GearClassificationAssociation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/gear/GearAssociation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/gear/Gear.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/location/Location.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/location/LocationClassification.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/location/LocationLevel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/location/LocationAssociation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/samplingScheme/denormalized/DenormalizedSamplingStrata.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/buyer/Buyer.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/buyer/BuyerType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/grouping/GroupingClassification.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/grouping/GroupingItem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/grouping/Grouping.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/grouping/GroupingLevel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/PhotoType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/SaleType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroup.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroupHistoricalRecord.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/ReferenceDocument.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroupType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/Citation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonInformation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonGroupInformation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonNameHistory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/Author.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/ReferenceTaxon.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonInformationHistory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonName.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/TaxonomicLevel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/taxon/VirtualComponent.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselOwner.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/EducationGrade.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselFeatures.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselRegistrationPeriod.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselOwnerPeriod.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselEngineType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselMasterPeriod.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/Vessel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/vessel/VesselMaster.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/metier/Metier.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/order/OrderItem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/order/OrderType.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/conversion/UnitConversion.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/conversion/WeightLengthConversion.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/conversion/RoundWeightConversion.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/qualification/QualificationRule.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/Matrix.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/Unit.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/ParameterGroup.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/Fraction.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/Method.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/Pmfm.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/Parameter.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/AggregationLevel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/pmfm/QualitativeValue.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/NumericalPrecision.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/QualityFlag.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/referential/AnalysisInstrument.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/batch/BatchExhaustiveInventory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/batch/BatchModel.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/batch/Batch.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/batch/denormalized/DenormalizedBatch.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/batch/denormalized/DenormalisedBatchSortingValue.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/qualification/AppliedQualificationRule.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/qualification/QualifiedItem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/takeOver/TakeOver.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/physicalGear/PhysicalGearSurvey.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/declaration/DeclaredDocumentReference.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/economy/EconomicalSurvey.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/activity/ActivityCalendar.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/activity/DailyActivityCalendar.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/sale/SaleOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/sale/Sale.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/fishingTrip/FishingTrip.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/fishingTrip/FishingTripOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/scientificCruise/ScientificCruise.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/fishingEffort/FishingEffortCalendar.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/landing/LandingOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/survey/landing/Landing.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/sale/ExpectedSale.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/fishingArea/FishingArea2RegulationLocation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/fishingArea/FishingArea.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/operation/denormalized/DenormalizedOperation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/operation/Operation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/operation/OperationVesselAssociation.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/sample/Sample.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/transshipment/Transshipment.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/LandingMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/VesselPhysicalMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/QuantificationMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/VesselUseMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/file/MeasurementFile.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/VesselPositionMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/SaleMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/photo/Photo.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/TakeOverMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/GearUseMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/SortingMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/SampleMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/SurveyMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/measure/GearPhysicalMeasurement.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/link/LinkedItem.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/produce/Produce.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/history/UpdatedItemHistory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/history/InsertedItemHistory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/history/ProcessingHistory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/history/DeletedItemHistory.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/position/VesselPosition.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/physical/GearPhysicalFeatures.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/physical/VesselPhysicalFeaturesOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/physical/VesselPhysicalFeatures.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/physical/GearPhysicalFeaturesOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/use/VesselUseFeaturesOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/use/GearUseFeaturesOrigin.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/use/VesselUseFeatures.hbm.xml</value>
- <value>file:/home/tchemit/projets/ifremer/adagio/core/target/generated-sources/java/fr/ifremer/adagio/core/dao/data/vessel/feature/use/GearUseFeatures.hbm.xml</value>
- </list>
- </property-->
- <!--</bean>-->
-
</beans>
\ No newline at end of file
Modified: trunk/tutti-persistence-adagio/src/main/resources/beanRefFactory.xml
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/beanRefFactory.xml 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/resources/beanRefFactory.xml 2013-01-14 13:22:48 UTC (rev 189)
@@ -38,7 +38,7 @@
<value>applicationContext-conf.xml</value>
<value>applicationContext-dataSource-${dataSource.type}.xml</value>
<value>applicationContext-entities.xml</value>
- <!--<value>applicationContext-service.xml</value>-->
+ <value>applicationContext-service.xml</value>
<value>applicationContext-service-tutti.xml</value>
</list>
</constructor-arg>
Modified: trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 13:22:48 UTC (rev 189)
@@ -38,85 +38,128 @@
<!-- [DAT-01] Get all programs (to list with no detail) -->
<query cacheable="true" name="allPrograms">
<![CDATA[
- SELECT
+ SELECT
p.code,
p.name
- FROM ProgramImpl p
- WHERE p.code LIKE 'CAM-%'
- ]]>
+ FROM
+ ProgramImpl p
+ WHERE
+ p.code LIKE 'CAM-%'
+ ]]>
</query>
<!-- [DAT-02] Get all cruises for a given program (to list with no detail) -->
<query cacheable="true" name="allCruises">
<![CDATA[
- SELECT
+ SELECT
c.id,
c.name,
c.departureDateTime
- FROM ScientificCruiseImpl c
- WHERE c.program.code = :programCode
- ORDER BY c.departureDateTime desc
- ]]>
+ FROM
+ ScientificCruiseImpl c
+ WHERE
+ c.program.code = :programCode
+ ORDER BY
+ c.departureDateTime desc
+ ]]>
<query-param name="programCode" type="java.lang.String"/>
</query>
<!-- [DAT-03] Get a detail program -->
<query cacheable="true" name="program">
<![CDATA[
- SELECT
+ SELECT
p.code,
p.name,
p.description
- FROM ProgramImpl p
- WHERE p.code = :programCode
- ]]>
+ FROM
+ ProgramImpl p
+ WHERE
+ p.code = :programCode
+ ]]>
<query-param name="programCode" type="java.lang.String"/>
</query>
<!-- [DAT-03-1] Get a program locations -->
<query cacheable="true" name="allProgramLocations">
<![CDATA[
- SELECT
+ SELECT
l.id,
l.label,
l.name
- FROM ProgramImpl p
+ FROM
+ ProgramImpl p
LEFT OUTER JOIN p.locations l
- WHERE p.code = :programCode
- ]]>
+ WHERE
+ p.code = :programCode
+ ]]>
<query-param name="programCode" type="java.lang.String"/>
</query>
<!-- [DAT-04] Get a detail cruise -->
<query cacheable="true" name="cruise">
<![CDATA[
-SELECT
- sc.program.code AS programCode,
- year(sc.departureDateTime) AS year,
- sc.name AS name,
- lh.locationHierarchyPk.parent.id AS countryId,
- lh.locationHierarchyPk.parent.label AS countryLabel,
- lh.locationHierarchyPk.parent.name AS countryName,
- sc.departureDateTime AS departureDateTime,
- sc.returnDateTime AS returnDateTime,
- sc.vessel.code AS vesselCode,
- mp.id AS managerId,
- sc.comments AS scientificCruiseComments,
- ft.comments AS fishingTripComments
- FROM
- ScientificCruiseImpl sc
- LEFT OUTER JOIN sc.fishingTrips ft
- LEFT OUTER JOIN sc.managerPerson mp,
- LocationHierarchyImpl lh
- WHERE
- sc.id = :cruiseId
- AND lh.locationHierarchyPk.location.id = ft.departureLocation.id
- AND lh.locationHierarchyPk.parent.locationLevel.id = :countryLocationLevelId
- ]]>
- <query-param name="cruiseId" type="java.lang.String"/>
+ SELECT
+ sc.program.code AS programCode,
+ year(sc.departureDateTime) AS year,
+ sc.name AS name,
+ lh.locationHierarchyPk.parent.id AS countryId,
+ lh.locationHierarchyPk.parent.label AS countryLabel,
+ lh.locationHierarchyPk.parent.name AS countryName,
+ sc.departureDateTime AS departureDateTime,
+ sc.returnDateTime AS returnDateTime,
+ sc.vessel.code AS vesselCode,
+ mp.id AS managerId,
+ sc.comments AS scientificCruiseComments,
+ ft.comments AS fishingTripComments
+ FROM
+ ScientificCruiseImpl sc
+ LEFT OUTER JOIN sc.fishingTrips ft
+ LEFT OUTER JOIN sc.managerPerson mp,
+ LocationHierarchyImpl lh
+ WHERE
+ sc.id = :cruiseId
+ AND lh.locationHierarchyPk.parent.locationLevel.id = :countryLocationLevelId
+ AND lh.locationHierarchyPk.location.id = ft.departureLocation.id
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
<query-param name="countryLocationLevelId" type="java.lang.Integer"/>
</query>
+ <query cacheable="true" name="allCruiseGears">
+ <![CDATA[
+ SELECT
+ gpf.gear.id AS gearId,
+ gpf.gear.label AS gearLabel,
+ gpf.gear.name AS gearName
+ FROM
+ ScientificCruiseImpl sc
+ JOIN sc.fishingTrips ft
+ JOIN ft.gearPhysicalFeatures gpf
+ LEFT OUTER JOIN gpf.operations o
+ WHERE
+ sc.id = :cruiseId
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allCruiseSecondaryVessels">
+ <![CDATA[
+ SELECT
+ va.operationVesselAssociationPk.vessel.code AS associatedVesselCode,
+ FROM
+ ScientificCruiseImpl sc
+ JOIN sc.fishingTrips ft
+ JOIN ft.operations o
+ JOIN o.operationVesselAssociations va
+ WHERE
+ sc.id = :cruiseId
+ GROUP BY
+ va.operationVesselAssociationPk.vessel
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ </query>
+
<!-- ===================================================================== -->
<!-- === Requete techniques sur référentiels [REF-TXXX] === -->
<!-- ===================================================================== -->
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/AccidentalBatchTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/AccidentalBatchTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/AccidentalBatchTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,67 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link Program}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class AccidentalBatchTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllAccidentalBatch(/*String fishingOperationId*/) {
-
- }
-
- @Test
- public void getAccidentalBatch(/*String id*/) {
-
- }
-
- @Test
- public void createAccidentalBatch(/*AccidentalBatch bean*/) {
-
- }
-
- @Test
- public void saveAccidentalBatch(/*AccidentalBatch bean*/) {
-
- }
-
- @Test
- public void deleteAccidentalBatch(/*String id*/) {
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/BenthosBatchTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/BenthosBatchTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/BenthosBatchTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,67 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link Program}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class BenthosBatchTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllBenthosBatch(/*String fishingOperationId*/) {
-
- }
-
- @Test
- public void getBenthosBatch(/*String id*/) {
-
- }
-
- @Test
- public void createBenthosBatch(/*BenthosBatch bean*/) {
-
- }
-
- @Test
- public void saveBenthosBatch(/*BenthosBatch bean*/) {
-
- }
-
- @Test
- public void deleteBenthosBatch(/*String id*/) {
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,169 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.google.common.collect.Lists;
-
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
-
-/**
- * To test operations around {@link Program}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class CruiseTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- protected TuttiPersistence service;
-
- @Before
- public void setUp() throws Exception {
- service = TuttiPersistenceServiceLocator.getPersistenceService();
- }
-
- @Test
- public void getAllCruise(/*String programId*/) {
- String programCode = dbResource.getFixtures().programCode();
- List<Cruise> result = service.getAllCruise(programCode);
- Assert.assertNotNull(result);
- Assert.assertEquals(1, result.size());
- }
-
- @Test
- public void getCruise(/*String id*/) {
-
- String cruiseId = dbResource.getFixtures().cruiseId();
- Cruise result = service.getCruise(cruiseId);
- Assert.assertNotNull(result);
- }
-
- @Test
- public void createCruise(/*Cruise bean*/) {
- String programCode = dbResource.getFixtures().programCode();
- Cruise cruise = new Cruise();
-
- cruise.setId(null);
-
- cruise.setName("CGFS_2013");
-
- cruise.setProgram(service.getProgram(programCode));
-
- Calendar calendar = new GregorianCalendar();
- cruise.setBeginDate(calendar.getTime());
-
- cruise.setYear(calendar.get(Calendar.YEAR));
-
- calendar.add(Calendar.MONTH, 1); // add one month
- cruise.setEndDate(calendar.getTime());
-
- Country country = null;
- List<Country> countries = service.getAllCountry();
- for (Iterator iterator = countries.iterator(); iterator.hasNext();) {
- Country aCountry = (Country) iterator.next();
- if (aCountry.getLabel() != null && aCountry.getLabel().equals("FRA")) {
- country = aCountry;
- break;
- }
- }
- assertNotNull("Could not load FRA country", country);
- cruise.setCountry(country);
-
- List<Gear> gears = service.getAllFishingGear();
- cruise.setGear(gears);
-
- cruise.setComment("My comments on cruise");
-
- Person managerPerson = service.getAllPerson().get(0);
- cruise.setHeadOfMission(Lists.newArrayList(managerPerson));
-
- List<Vessel> vessels = Lists.newArrayList();
- vessels.add(service.getAllScientificVessel().get(0));
- Vessel fishingVessel = new Vessel();
- fishingVessel.setId(dbResource.getFixtures().fishingVesselCode());
- vessels.add(fishingVessel);
-
- cruise.setVessel(vessels);
-
- Cruise createdCruise = service.createCruise(cruise);
- assertNotNull(createdCruise);
- assertNotNull(createdCruise.getId());
- assertEquals(cruise.getName(), createdCruise.getName());
-
- // New cruise, with empty optional values
- createdCruise.setId(null);
- createdCruise.setHeadOfMission(null);
- createdCruise.setBeginDate(null);
- createdCruise.setEndDate(null);
- createdCruise.setComment(null);
- createdCruise.setPoche(null);
- createdCruise = service.createCruise(cruise);
- assertNotNull(createdCruise);
- assertNotNull(createdCruise.getId());
- assertEquals(cruise.getName(), createdCruise.getName());
-
- Cruise reloadedCruise = service.getCruise(createdCruise.getId());
- assertEquals(createdCruise.getBeginDate(), reloadedCruise.getBeginDate());
- assertEquals(createdCruise.getEndDate(), reloadedCruise.getEndDate());
- assertEquals(createdCruise.getComment(), reloadedCruise.getComment());
- assertEquals(createdCruise.getPoche(), reloadedCruise.getPoche());
- assertNull(reloadedCruise.getHeadOfMission());
- assertNotNull(reloadedCruise.getVessel());
- assertEquals(createdCruise.getVessel().get(0), reloadedCruise.getVessel().get(0));
- assertEquals(cruise.getCountry().getId(), reloadedCruise.getCountry().getId());
- assertNotNull(reloadedCruise.getVessel());
- assertEquals(vessels.size(), reloadedCruise.getVessel().size());
- assertNotNull(reloadedCruise.getGear());
- assertEquals(gears.size(), reloadedCruise.getGear().size());
- }
-
- @Test
- public void saveCruise(/*Cruise bean*/) {
-
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/FishingOperationTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/FishingOperationTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/FishingOperationTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,63 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link FishingOperation}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class FishingOperationTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllFishingOperation(/*String cruiseId*/) {
-
- }
-
- @Test
- public void getFishingOperation(/*String id*/) {
-
- }
-
- @Test
- public void createFishingOperation(/*FishingOperation bean*/) {
-
- }
-
- @Test
- public void saveFishingOperation(/*FishingOperation bean*/) {
-
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/MacroWasteBatchTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/MacroWasteBatchTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/MacroWasteBatchTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,67 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link Program}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class MacroWasteBatchTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllMacroWasteBatch(/*String fishingOperationId*/) {
-
- }
-
- @Test
- public void getMacroWasteBatch(/*String id*/) {
-
- }
-
- @Test
- public void createMacroWasteBatch(/*MacroWasteBatch bean*/) {
-
- }
-
- @Test
- public void saveMacroWasteBatch(/*MacroWasteBatch bean*/) {
-
- }
-
- @Test
- public void deleteMacroWasteBatch(/*String id*/) {
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/PlanktonBatchTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/PlanktonBatchTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/PlanktonBatchTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,67 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link Program}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class PlanktonBatchTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllPlanktonBatch(/*String fishingOperationId*/) {
-
- }
-
- @Test
- public void getPlanktonBatch(/*String id*/) {
-
- }
-
- @Test
- public void createPlanktonBatch(/*PlanktonBatch bean*/) {
-
- }
-
- @Test
- public void savePlanktonBatch(/*PlanktonBatch bean*/) {
-
- }
-
- @Test
- public void deletePlanktonBatch(/*String id*/) {
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProgramTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProgramTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProgramTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,84 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.List;
-
-/**
- * To test operations around {@link Program}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class ProgramTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- protected TuttiPersistence service;
-
- @Before
- public void setUp() throws Exception {
- service = TuttiPersistenceServiceLocator.getPersistenceService();
- }
-
- @Test
- public void getAllProgram() {
- List<Program> result = service.getAllProgram();
- Assert.assertNotNull(result);
- Assert.assertEquals(1, result.size());
- }
-
- @Test
- public void getProgram(/*String id*/) {
- String programCode = dbResource.getFixtures().programCode();
- Program actual = service.getProgram(programCode);
- Assert.assertNotNull(actual);
- Assert.assertNotNull(actual.getId());
- Assert.assertNotNull(actual.getName());
- Assert.assertNotNull(actual.getZone());
- Assert.assertEquals(programCode, actual.getId());
- }
-
- @Test
- @Ignore
- public void createProgram(/*Program bean*/) {
-
- }
-
- @Test
- @Ignore
- public void saveProgram(/*Program bean*/) {
-
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProtocolTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProtocolTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProtocolTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,63 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link TuttiProtocol}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class ProtocolTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllProtocol() {
-
- }
-
- @Test
- public void getProtocol(/*String id*/) {
-
- }
-
- @Test
- public void createProtocol(/*TuttiProtocol bean*/) {
-
- }
-
- @Test
- public void saveProtocol(/*TuttiProtocol bean*/) {
-
- }
-}
Deleted: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/SpeciesBatchTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/SpeciesBatchTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/SpeciesBatchTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -1,82 +0,0 @@
-package fr.ifremer.tutti.persistence;
-
-/*
- * #%L
- * Tutti :: Persistence Adagio (impl)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * To test operations around {@link SpeciesBatch}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-@Ignore
-public class SpeciesBatchTest {
-
- @ClassRule
- public static final DatabaseResource dbResource = new DatabaseResource();
-
- @Test
- public void getAllRootSpeciesBatch(/*String fishingOperationId*/) {
-
- }
-
- @Test
- public void getAllSpeciesBatch(/*String fishingOperationId*/) {
-
- }
-
- @Test
- public void getSpeciesBatch(/*String id*/) {
-
- }
-
- @Test
- public void createSpeciesBatch(/*SpeciesBatch bean, String parentBatchId*/) {
-
- }
-
- @Test
- public void saveSpeciesBatch(/*SpeciesBatch bean*/) {
-
- }
-
- @Test
- public void deleteSpeciesBatch(/*String id*/) {
- }
-
- @Test
- public void deleteSpeciesSubBatch(/*String id*/) {
- }
-
- @Test
- public void getAllSpeciesBatchFrequency(/*String speciesBatchId*/) {
-
- }
-}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/AccidentalBatchTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class AccidentalBatchPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected AccidentalBatchPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getAccidentalBatchPersistenceService();
+ }
+
+ @Test
+ public void getAllAccidentalBatch(/*String fishingOperationId*/) {
+
+ }
+
+ @Test
+ public void getAccidentalBatch(/*String id*/) {
+
+ }
+
+ @Test
+ public void createAccidentalBatch(/*AccidentalBatch bean*/) {
+
+ }
+
+ @Test
+ public void saveAccidentalBatch(/*AccidentalBatch bean*/) {
+
+ }
+
+ @Test
+ public void deleteAccidentalBatch(/*String id*/) {
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/BenthosBatchTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class BenthosBatchPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected BenthosBatchPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getBenthosBatchPersistenceService();
+ }
+
+ @Test
+ public void getAllBenthosBatch(/*String fishingOperationId*/) {
+
+ }
+
+ @Test
+ public void getBenthosBatch(/*String id*/) {
+
+ }
+
+ @Test
+ public void createBenthosBatch(/*BenthosBatch bean*/) {
+
+ }
+
+ @Test
+ public void saveBenthosBatch(/*BenthosBatch bean*/) {
+
+ }
+
+ @Test
+ public void deleteBenthosBatch(/*String id*/) {
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,177 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class CruisePersistenceServiceTest {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(CruisePersistenceServiceTest.class);
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected ReferentialPersistenceService referentialService;
+
+ protected ProgramPersistenceService programService;
+
+ protected CruisePersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getCruisePersistenceService();
+ referentialService = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
+ programService = TuttiPersistenceServiceLocator.getProgramPersistenceService();
+ }
+
+ @Test
+ public void getAllCruise(/*String programId*/) {
+ String programCode = dbResource.getFixtures().programCode();
+ List<Cruise> result = service.getAllCruise(programCode);
+ Assert.assertNotNull(result);
+ Assert.assertFalse(result.isEmpty());
+ }
+
+ @Test
+ public void getCruise(/*String id*/) {
+
+ String cruiseId = dbResource.getFixtures().cruiseId();
+ Cruise result = service.getCruise(cruiseId);
+ Assert.assertNotNull(result);
+ }
+
+ @Test
+ public void createCruise(/*Cruise bean*/) {
+ String programCode = dbResource.getFixtures().programCode();
+ Cruise cruise = new Cruise();
+
+ cruise.setId(null);
+
+ cruise.setName("CGFS_2013");
+
+ cruise.setProgram(programService.getProgram(programCode));
+
+ Calendar calendar = new GregorianCalendar();
+ cruise.setBeginDate(calendar.getTime());
+
+ cruise.setYear(calendar.get(Calendar.YEAR));
+
+ calendar.add(Calendar.MONTH, 1); // add one month
+ cruise.setEndDate(calendar.getTime());
+
+ Country country = null;
+ List<Country> countries = referentialService.getAllCountry();
+ for (Country aCountry : countries) {
+ if (aCountry.getLabel() != null && aCountry.getLabel().equals("FRA")) {
+ country = aCountry;
+ break;
+ }
+ }
+ assertNotNull("Could not load FRA country", country);
+ cruise.setCountry(country);
+
+ List<Gear> gears = referentialService.getAllFishingGear();
+ cruise.setGear(gears);
+
+ cruise.setComment("My comments on cruise");
+
+ Person managerPerson = referentialService.getAllPerson().get(0);
+ cruise.setHeadOfMission(Lists.newArrayList(managerPerson));
+
+ List<Vessel> vessels = Lists.newArrayList();
+ vessels.add(referentialService.getAllScientificVessel().get(0));
+ Vessel fishingVessel = new Vessel();
+ fishingVessel.setId(dbResource.getFixtures().fishingVesselCode());
+ vessels.add(fishingVessel);
+
+ cruise.setVessel(vessels);
+
+ Cruise createdCruise = service.createCruise(cruise);
+ assertNotNull(createdCruise);
+ assertNotNull(createdCruise.getId());
+ assertEquals(cruise.getName(), createdCruise.getName());
+
+ if (log.isInfoEnabled()) {
+ log.info("Created cruise: " + createdCruise.getId());
+ }
+
+ // New cruise, with empty optional values
+ createdCruise.setId(null);
+ createdCruise.setHeadOfMission(null);
+ createdCruise.setBeginDate(null);
+ createdCruise.setEndDate(null);
+ createdCruise.setComment(null);
+ createdCruise.setPoche(null);
+ createdCruise = service.createCruise(cruise);
+ assertNotNull(createdCruise);
+ assertNotNull(createdCruise.getId());
+ assertEquals(cruise.getName(), createdCruise.getName());
+
+ Cruise reloadedCruise = service.getCruise(createdCruise.getId());
+ assertEquals(createdCruise.getBeginDate(), reloadedCruise.getBeginDate());
+ assertEquals(createdCruise.getEndDate(), reloadedCruise.getEndDate());
+ assertEquals(createdCruise.getComment(), reloadedCruise.getComment());
+ assertEquals(createdCruise.getPoche(), reloadedCruise.getPoche());
+ assertNull(reloadedCruise.getHeadOfMission());
+ assertNotNull(reloadedCruise.getVessel());
+ assertEquals(createdCruise.getVessel().get(0), reloadedCruise.getVessel().get(0));
+ assertEquals(cruise.getCountry().getId(), reloadedCruise.getCountry().getId());
+ assertNotNull(reloadedCruise.getVessel());
+ assertEquals(vessels.size(), reloadedCruise.getVessel().size());
+ assertNotNull(reloadedCruise.getGear());
+ assertEquals(gears.size(), reloadedCruise.getGear().size());
+ }
+
+ @Test
+ public void saveCruise(/*Cruise bean*/) {
+
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/FishingOperationTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,69 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class FishingOperationPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected FishingOperationPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
+ }
+
+ @Test
+ public void getAllFishingOperation(/*String cruiseId*/) {
+
+ }
+
+ @Test
+ public void getFishingOperation(/*String id*/) {
+
+ }
+
+ @Test
+ public void createFishingOperation(/*FishingOperation bean*/) {
+
+ }
+
+ @Test
+ public void saveFishingOperation(/*FishingOperation bean*/) {
+
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/MacroWasteBatchTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/MacroWasteBatchPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class MacroWasteBatchPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected MacroWasteBatchPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getMacroWasteBatchPersistenceService();
+ }
+
+ @Test
+ public void getAllMacroWasteBatch(/*String fishingOperationId*/) {
+
+ }
+
+ @Test
+ public void getMacroWasteBatch(/*String id*/) {
+
+ }
+
+ @Test
+ public void createMacroWasteBatch(/*MacroWasteBatch bean*/) {
+
+ }
+
+ @Test
+ public void saveMacroWasteBatch(/*MacroWasteBatch bean*/) {
+
+ }
+
+ @Test
+ public void deleteMacroWasteBatch(/*String id*/) {
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/PlanktonBatchTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/PlanktonBatchPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,74 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class PlanktonBatchPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected PlanktonBatchPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getPlanktonBatchPersistenceService();
+ }
+
+ @Test
+ public void getAllPlanktonBatch(/*String fishingOperationId*/) {
+
+ }
+
+ @Test
+ public void getPlanktonBatch(/*String id*/) {
+
+ }
+
+ @Test
+ public void createPlanktonBatch(/*PlanktonBatch bean*/) {
+
+ }
+
+ @Test
+ public void savePlanktonBatch(/*PlanktonBatch bean*/) {
+
+ }
+
+ @Test
+ public void deletePlanktonBatch(/*String id*/) {
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProgramTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class ProgramPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected ProgramPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getProgramPersistenceService();
+ }
+
+ @Test
+ public void getAllProgram() {
+ List<Program> result = service.getAllProgram();
+ Assert.assertNotNull(result);
+ Assert.assertEquals(1, result.size());
+ }
+
+ @Test
+ public void getProgram(/*String id*/) {
+ String programCode = dbResource.getFixtures().programCode();
+ Program actual = service.getProgram(programCode);
+ Assert.assertNotNull(actual);
+ Assert.assertNotNull(actual.getId());
+ Assert.assertNotNull(actual.getName());
+ Assert.assertNotNull(actual.getZone());
+ Assert.assertEquals(programCode, actual.getId());
+ }
+
+ @Test
+ @Ignore
+ public void createProgram(/*Program bean*/) {
+
+ }
+
+ @Test
+ @Ignore
+ public void saveProgram(/*Program bean*/) {
+
+ }
+}
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/ProtocolTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,69 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class ProtocolPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected ProtocolPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getProtocolPersistenceService();
+ }
+
+ @Test
+ public void getAllProtocol() {
+
+ }
+
+ @Test
+ public void getProtocol(/*String id*/) {
+
+ }
+
+ @Test
+ public void createProtocol(/*TuttiProtocol bean*/) {
+
+ }
+
+ @Test
+ public void saveProtocol(/*TuttiProtocol bean*/) {
+
+ }
+}
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -53,8 +53,6 @@
import java.util.List;
/**
- * Test the referential service.
- *
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
@@ -81,7 +79,8 @@
TuttiPersistenceDevConfig devDriverConfig =
new TuttiPersistenceDevConfig(applicationConfig);
- applicationConfig.setOption(TuttiPersistenceDevImpl.SKIP_FIXTURES_OPTION, Boolean.TRUE.toString());
+ applicationConfig.setOption(
+ TuttiPersistenceDevImpl.SKIP_FIXTURES_OPTION, Boolean.TRUE.toString());
storage = new TuttiPersistenceDevImpl(devDriverConfig) {
Copied: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java (from rev 188, trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/SpeciesBatchTest.java)
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java (rev 0)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.persistence.service;
+
+/*
+ * #%L
+ * Tutti :: Persistence Adagio (impl)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.DatabaseResource;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+@Ignore
+public class SpeciesBatchPersistenceServiceTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource = new DatabaseResource();
+
+ protected SpeciesBatchPersistenceService service;
+
+ @Before
+ public void setUp() throws Exception {
+ service = TuttiPersistenceServiceLocator.getSpeciesBatchPersistenceService();
+ }
+
+ @Test
+ public void getAllRootSpeciesBatch(/*String fishingOperationId*/) {
+
+ }
+
+ @Test
+ public void getAllSpeciesBatch(/*String fishingOperationId*/) {
+
+ }
+
+ @Test
+ public void getSpeciesBatch(/*String id*/) {
+
+ }
+
+ @Test
+ public void createSpeciesBatch(/*SpeciesBatch bean, String parentBatchId*/) {
+
+ }
+
+ @Test
+ public void saveSpeciesBatch(/*SpeciesBatch bean*/) {
+
+ }
+
+ @Test
+ public void deleteSpeciesBatch(/*String id*/) {
+ }
+
+ @Test
+ public void deleteSpeciesSubBatch(/*String id*/) {
+ }
+
+ @Test
+ public void getAllSpeciesBatchFrequency(/*String speciesBatchId*/) {
+
+ }
+}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -343,6 +343,7 @@
return referentialPersistenceService.getAllPerson();
}
+ @Override
public Person getPerson(Integer personId) {
return referentialPersistenceService.getPerson(personId);
}
@@ -438,7 +439,6 @@
return result;
}
-
//------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-01-14 11:00:11 UTC (rev 188)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-01-14 13:22:48 UTC (rev 189)
@@ -274,6 +274,16 @@
return devDriver.getMacroWasteSizeCategoryCaracteristic();
}
+ @Override
+ public Vessel getVessel(String vesselCode) {
+ return devDriver.getVessel(vesselCode);
+ }
+
+ @Override
+ public Person getPerson(Integer personId) {
+ return devDriver.getPerson(personId);
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
1
0
r188 - in trunk/tutti-persistence-adagio: . src/main/java/fr/ifremer/tutti/persistence src/main/java/fr/ifremer/tutti/persistence/service src/main/resources src/test/java/fr/ifremer/tutti/persistence
by blavenier@users.forge.codelutin.com 14 Jan '13
by blavenier@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: blavenier
Date: 2013-01-14 12:00:11 +0100 (Mon, 14 Jan 2013)
New Revision: 188
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/188
Log:
- Fix 'cruise' query
- Add Unit test for createCruise()
- Add vars into enumeration
- Implement createCruise()
Modified:
trunk/tutti-persistence-adagio/
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java
Property changes on: trunk/tutti-persistence-adagio
___________________________________________________________________
Modified: svn:ignore
- target
*.ipr
*.iml
*.iws
.idea
+ target
*.ipr
*.iml
*.iws
.idea
.classpath
.project
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 11:00:11 UTC (rev 188)
@@ -121,6 +121,12 @@
@Value("${StatusCode.TEMPORARY}")
public final Integer STATUS_TEMPORARY_CODE = null;
+
+ @Value("${PersonId.UNKNOWN_RECORDER_PERSON}")
+ public final Integer PERSON_ID_UNKNOWN_RECORDER_PERSON = null;
+
+ @Value("${QualityFlagCode.NOTQUALIFIED}")
+ public final String QUALITY_FLAG_CODE_NOT_QUALIFIED = null;
public void init() {
Preconditions.checkNotNull(GEAR_CLASSIFICIATION_ID_SCIENTIFIC, "GEAR_CLASSIFICIATION_ID_SCIENTIFIC constant not found");
@@ -137,12 +143,14 @@
Preconditions.checkNotNull(PARAMETER_CODE_WEIGHT, "PARAMETER_CODE_WEIGHT constant not found");
Preconditions.checkNotNull(PARAMETER_GROUP_ENVIRONEMENT_MEASUREMENT, "PARAMETER_GROUP_ENVIRONEMENT_MEASUREMENT constant not found");
Preconditions.checkNotNull(PARAMETER_GROUP_HYDROLOGIC, "PARAMETER_GROUP_HYDROLOGIC constant not found");
+ Preconditions.checkNotNull(PERSON_ID_UNKNOWN_RECORDER_PERSON, "PERSON_ID_UNKNOWN_RECORDER_PERSON constant not found");
Preconditions.checkNotNull(PMFM_ID_SIZE_CATEGORY, "PMFM_ID_SIZE_CATEGORY constant not found");
Preconditions.checkNotNull(PMFM_ID_SEX, "PMFM_ID_SEX constant not found");
Preconditions.checkNotNull(PMFM_ID_SORTED_UNSORTED, "PMFM_ID_SORTED_UNSORTED constant not found");
Preconditions.checkNotNull(PMFM_ID_MATURITY, "PMFM_ID_MATURITY constant not found");
Preconditions.checkNotNull(PMFM_ID_MACRO_WASTE_CATEGORY, "PMFM_ID_MACRO_WASTE_CATEGORY constant not found");
Preconditions.checkNotNull(PMFM_ID_MACRO_WASTE_SIZE_CATEGORY, "PMFM_ID_MACRO_WASTE_SIZE_CATEGORY constant not found");
+ Preconditions.checkNotNull(QUALITY_FLAG_CODE_NOT_QUALIFIED, "QUALITY_FLAG_CODE_NOT_QUALIFIED constant not found");
Preconditions.checkNotNull(UNIT_ID_NONE, "UNIT_ID_NONE constant not found");
Preconditions.checkNotNull(USER_PROFIL_ID_OBSERVER, "USER_PROFIL_ID_OBSERVER constant not found");
Preconditions.checkNotNull(USER_PROFIL_ID_PROJECT_MEMBER, "USER_PROFIL_ID_PROJECT_MEMBER constant not found");
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2013-01-14 11:00:11 UTC (rev 188)
@@ -27,6 +27,15 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import fr.ifremer.adagio.core.dao.administration.programStrategy.ProgramDao;
+import fr.ifremer.adagio.core.dao.administration.user.PersonDao;
+import fr.ifremer.adagio.core.dao.data.survey.fishingTrip.FishingTrip;
+import fr.ifremer.adagio.core.dao.data.survey.scientificCruise.ScientificCruise;
+import fr.ifremer.adagio.core.dao.data.survey.scientificCruise.ScientificCruiseDao;
+import fr.ifremer.adagio.core.dao.referential.QualityFlagDao;
+import fr.ifremer.adagio.core.dao.referential.location.Location;
+import fr.ifremer.adagio.core.dao.referential.location.LocationDao;
+import fr.ifremer.adagio.core.dao.referential.vessel.VesselDao;
+import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
@@ -59,7 +68,9 @@
import javax.annotation.Resource;
import java.io.IOException;
+import java.util.Calendar;
import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
@@ -85,6 +96,27 @@
@Resource(name = "programDao")
protected ProgramDao programDao;
+ @Resource(name = "scientificCruiseDao")
+ protected ScientificCruiseDao scientificCruiseDao;
+
+ @Resource(name = "personDao")
+ protected PersonDao personDao;
+
+ @Resource(name = "vesselDao")
+ protected VesselDao vesselDao;
+
+ @Resource(name = "locationDao")
+ protected LocationDao locationDao;
+
+ @Resource(name = "qualityFlagDao")
+ protected QualityFlagDao qualityFlagDao;
+
+ protected Calendar calendar = new GregorianCalendar();
+
+ protected static String CRUISE_MISC_DATA_VESSELS_TAG="#VESSELS=";
+
+ protected static String CRUISE_MISC_DATA_GEARS_TAG="#GEARS=";
+
@Autowired(required = true)
protected ReferentialPersistenceService referentielService;
@@ -377,8 +409,173 @@
@Override
public Cruise createCruise(Cruise bean) {
- throw new UnsupportedOperationException();
+ ScientificCruise scientificCruise = ScientificCruise.Factory.newInstance();
+ cruiseToEntity(bean, scientificCruise, true);
+ scientificCruiseDao.create(scientificCruise);
+
+ bean.setId(String.valueOf(scientificCruise.getId()));
+ return bean;
}
+
+ protected void cruiseToEntity(Cruise source, ScientificCruise target, boolean copyIfNull) {
+ StringBuffer miscDataBuffer = new StringBuffer();
+
+ // Name
+ if (copyIfNull && source.getName() == null) {
+ target.setName(null);
+ } else if (source.getName() != null) {
+ target.setName(source.getName());
+ }
+
+ // Program
+ if (copyIfNull && (source.getProgram() == null || source.getProgram().getId() == null)) {
+ target.setProgram(null);
+ } else if (source.getName() != null && source.getProgram().getId() != null) {
+ target.setProgram(programDao.load(source.getProgram().getId()));
+ }
+
+ // Vessel
+ if (copyIfNull && (source.getVessel() == null || source.getVessel().size() == 0)) {
+ target.setProgram(null);
+ } else if (source.getVessel() != null && source.getVessel().size() > 0) {
+ List<Vessel> vessels = source.getVessel();
+ target.setVessel(vesselDao.load(vessels.get(0).getId()));
+
+ if (vessels.size() > 1) {
+ //throw new UnsupportedOperationException("Cruise could not yet support more than one vessel.");
+ miscDataBuffer.append(CRUISE_MISC_DATA_VESSELS_TAG);
+ for(int i=1; i<vessels.size(); i++) {
+ if (i>1) miscDataBuffer.append(',');
+ miscDataBuffer.append(vessels.get(i).getId());
+ }
+ }
+ }
+
+ // Year
+ if (copyIfNull && source.getYear() == null && source.getBeginDate() == null) {
+ target.setDepartureDateTime(null);
+ }
+ else if (source.getYear() != null && source.getBeginDate() == null) {
+ // Set year into departure date time only if no departure date time has been set
+ calendar.setTimeInMillis(0);
+ calendar.set(Calendar.YEAR, source.getYear());
+ // Add one millisecond to retrieve a 'year saved but no departure date'
+ calendar.set(Calendar.MILLISECOND, 1);
+ target.setDepartureDateTime(calendar.getTime());
+ }
+
+ // BeginDate
+ if (copyIfNull && source.getYear() == null && source.getBeginDate() == null) {
+ target.setDepartureDateTime(null);
+ } else if (source.getBeginDate() != null) {
+ target.setDepartureDateTime(source.getBeginDate());
+ }
+
+ // EndDate
+ if (copyIfNull && source.getEndDate() == null) {
+ target.setReturnDateTime(null);
+ } else if (source.getEndDate() != null) {
+ target.setReturnDateTime(source.getEndDate());
+ }
+
+ // Comment
+ if (copyIfNull && source.getComment() == null) {
+ target.setComments(null);
+ } else if (source.getComment() != null) {
+ target.setComments(source.getComment());
+ }
+
+ // Manager
+ if (copyIfNull && (source.getHeadOfMission() == null || source.getHeadOfMission().size() == 0)) {
+ target.setComments(null);
+ } else if (source.getHeadOfMission() != null && source.getHeadOfMission().size() > 0) {
+ if (source.getHeadOfMission().size() == 1) {
+ Person managerPerson = source.getHeadOfMission().get(0);
+ if (managerPerson.getId() != null) {
+ target.setManagerPerson(personDao.load(Integer.valueOf(managerPerson.getId())));
+ }
+ }
+ else {
+ // TODO : comment gérer dans le modèle Adagio plus d'un manager ?
+ throw new UnsupportedOperationException("Cruise could not yet support more than one manager person.");
+ }
+ }
+
+ // Optional values in UI, but mandatory in DB
+ if (target.getManagerPerson() == null) {
+ target.setManagerPerson(personDao.load(enumeration.PERSON_ID_UNKNOWN_RECORDER_PERSON));
+ }
+
+ // Default values :
+ target.setSynchronizationStatus(SynchronizationStatus.DIRTY.getValue());
+ if (target.getCreationDate() == null) {
+ target.setCreationDate(new Date());
+ }
+ if (target.getManagerPerson() != null) {
+ target.setRecorderPerson(target.getManagerPerson());
+ target.setRecorderDepartment(target.getManagerPerson().getDepartment());
+ }
+
+ // FishingTrip
+ FishingTrip fishingTrip = null;
+ if (target.getFishingTrips() == null || target.getFishingTrips().size() == 0) {
+ fishingTrip = FishingTrip.Factory.newInstance();
+ if (target.getFishingTrips() == null) {
+ target.setFishingTrips(Lists.newArrayList(fishingTrip));
+ fishingTrip.setScientificCruise(target);
+ }
+ else {
+ target.getFishingTrips().add(fishingTrip);
+ fishingTrip.setScientificCruise(target);
+ }
+ }
+
+ // Fill fishing trip with scientificCruise info:
+ fishingTrip.setDepartureDateTime(target.getDepartureDateTime());
+ fishingTrip.setReturnDateTime(target.getReturnDateTime());
+ fishingTrip.setVessel(target.getVessel());
+ fishingTrip.setProgram(target.getProgram());
+ fishingTrip.setRecorderPerson(target.getRecorderPerson());
+ fishingTrip.setRecorderDepartment(target.getRecorderDepartment());
+ fishingTrip.setCreationDate(target.getCreationDate());
+ fishingTrip.setSynchronizationStatus(target.getSynchronizationStatus());
+ if (fishingTrip.getQualityFlag() == null) {
+ fishingTrip.setQualityFlag(qualityFlagDao.load(enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED));
+ }
+
+ if (fishingTrip.getReturnDateTime() == null && fishingTrip.getDepartureDateTime() != null) {
+ calendar.setTime(fishingTrip.getDepartureDateTime());
+ calendar.add(Calendar.MILLISECOND, 1); // = departureDateTime + 1ms
+ fishingTrip.setReturnDateTime(calendar.getTime());
+ }
+
+ // Country
+ if (copyIfNull && source.getCountry() == null || source.getCountry().getId() == null) {
+ fishingTrip.setDepartureLocation(null);
+ fishingTrip.setReturnLocation(null);
+ } else if (source.getCountry() != null && source.getCountry().getId() != null) {
+ Location locationCountry = locationDao.load(Integer.valueOf(source.getCountry().getId()));
+ fishingTrip.setDepartureLocation(locationCountry);
+ fishingTrip.setReturnLocation(locationCountry);
+ }
+
+ // Gear
+ if (copyIfNull && source.isGearEmpty()) {
+ miscDataBuffer.append(CRUISE_MISC_DATA_GEARS_TAG);
+ } else if (!source.isGearEmpty()) {
+ //throw new UnsupportedOperationException("Cruise could not yet support gears storage.");
+ miscDataBuffer.append(CRUISE_MISC_DATA_GEARS_TAG);
+ for(int i=0; i<source.getGear().size(); i++) {
+ if (i>0) miscDataBuffer.append(',');
+ miscDataBuffer.append(source.getGear().get(i).getId());
+ }
+ }
+
+ // Save miscDataBuffer into comments
+ // TODO BLA : vérifier que les UI Allegro n'utilise pas ce commentaires,
+ // mais bien celui de scientificCruise
+ fishingTrip.setComments(miscDataBuffer.toString());
+ }
@Override
public Cruise saveCruise(Cruise bean) {
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 11:00:11 UTC (rev 188)
@@ -26,8 +26,10 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+
+import fr.ifremer.adagio.core.dao.referential.StatusDao;
import fr.ifremer.adagio.core.dao.referential.taxon.TaxonRefTaxVO;
-import fr.ifremer.adagio.core.dao.referential.taxon.TaxonSpecificDao;
+import fr.ifremer.adagio.core.dao.referential.taxon.TaxonNameExtendDao;
import fr.ifremer.tutti.persistence.TuttiEnumerationFile;
import fr.ifremer.tutti.persistence.entities.referential.AbstractTuttiReferentialEntity;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
@@ -78,8 +80,11 @@
@Autowired(required = true)
protected SessionFactory sessionFactory;
- @Resource(name = "taxonSpecificDao")
- protected TaxonSpecificDao taxonSpecificDao;
+ @Resource(name = "taxonNameDao")
+ protected TaxonNameExtendDao taxonNameDao;
+
+ @Resource(name = "statusDao")
+ protected StatusDao statusDao;
@Autowired(required = true)
protected TuttiEnumerationFile enumeration;
@@ -118,8 +123,8 @@
Object[] source = list.next();
Country target = new Country();
target.setId(String.valueOf(source[0]));
- target.setName((String) source[1]);
- target.setDescription((String) source[2]);
+ target.setLabel((String) source[1]);
+ target.setName((String) source[2]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], target);
result.add(target);
}
@@ -228,7 +233,7 @@
@Override
public List<Species> getAllSpecies() {
- TaxonRefTaxVO[] sources = taxonSpecificDao.getAllTaxonRefTax();
+ TaxonRefTaxVO[] sources = taxonNameDao.getAllTaxonRefTax();
List<Species> result = Lists.newArrayList();
for (TaxonRefTaxVO source : sources) {
@@ -240,7 +245,7 @@
@Override
public Species getSpecies(String speciesId) {
- TaxonRefTaxVO source = taxonSpecificDao.getTaxonRefTax(
+ TaxonRefTaxVO source = taxonNameDao.getTaxonRefTax(
Integer.valueOf(speciesId));
Species target = loadSpecies(source);
@@ -249,7 +254,7 @@
@Override
public List<Species> getAllBenthosSpecies() {
- TaxonRefTaxVO[] sources = taxonSpecificDao.getAllTaxonRefTax();
+ TaxonRefTaxVO[] sources = taxonNameDao.getAllTaxonRefTax();
List<Species> result = Lists.newArrayList();
for (TaxonRefTaxVO source : sources) {
@@ -261,7 +266,7 @@
@Override
public List<Species> getAllPlanktonSpecies() {
- TaxonRefTaxVO[] sources = taxonSpecificDao.getAllTaxonRefTax();
+ TaxonRefTaxVO[] sources = taxonNameDao.getAllTaxonRefTax();
List<Species> result = Lists.newArrayList();
for (TaxonRefTaxVO source : sources) {
@@ -502,7 +507,8 @@
target.setId(String.valueOf(source.getReferenceTaxonId()));
target.setName(source.getName());
target.setCodeMemo(source.getRefTaxCode());
- setStatus(source.getStatus(), target);
+ fr.ifremer.adagio.core.dao.referential.Status status = statusDao.load(source.getStatus().getValue());
+ setStatus(status, target);
return target;
}
Modified: trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 11:00:11 UTC (rev 188)
@@ -90,18 +90,19 @@
<!-- [DAT-04] Get a detail cruise -->
<query cacheable="true" name="cruise">
<![CDATA[
- SELECT
+SELECT
sc.program.code AS programCode,
year(sc.departureDateTime) AS year,
- sc.name,
+ sc.name AS name,
lh.locationHierarchyPk.parent.id AS countryId,
lh.locationHierarchyPk.parent.label AS countryLabel,
lh.locationHierarchyPk.parent.name AS countryName,
- sc.departureDateTime,
- sc.returnDateTime,
- sc.vessel.code as vesselCode,
- mp.id as managerId,
- coalesce(sc.comments, ft.comments) as comments
+ sc.departureDateTime AS departureDateTime,
+ sc.returnDateTime AS returnDateTime,
+ sc.vessel.code AS vesselCode,
+ mp.id AS managerId,
+ sc.comments AS scientificCruiseComments,
+ ft.comments AS fishingTripComments
FROM
ScientificCruiseImpl sc
LEFT OUTER JOIN sc.fishingTrips ft
@@ -110,10 +111,10 @@
WHERE
sc.id = :cruiseId
AND lh.locationHierarchyPk.location.id = ft.departureLocation.id
- AND lh.locationHierarchyPk.parent.locationLevel.id = :countryLocationLevel
+ AND lh.locationHierarchyPk.parent.locationLevel.id = :countryLocationLevelId
]]>
<query-param name="cruiseId" type="java.lang.String"/>
- <query-param name="countryLocationLevel" type="java.lang.Integer"/>
+ <query-param name="countryLocationLevelId" type="java.lang.Integer"/>
</query>
<!-- ===================================================================== -->
Modified: trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties 2013-01-14 11:00:11 UTC (rev 188)
@@ -327,6 +327,8 @@
#TODO A créér
PmfmId.MACRO_WASTE_SIZE_CATEGORY=1181
+#TODO A creer (20=observateur volant, 95=Administrateur SIH)
+# L'avantage du 20 est qu'il est inactif (=20), donc plus facilement detectable
+PersonId.UNKNOWN_RECORDER_PERSON=20
-
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/CruiseTest.java 2013-01-14 11:00:11 UTC (rev 188)
@@ -24,24 +24,37 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.List;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
-import java.util.List;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
+
/**
* To test operations around {@link Program}.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-@Ignore
public class CruiseTest {
@ClassRule
@@ -70,9 +83,83 @@
Assert.assertNotNull(result);
}
- @Test
+ @Test
public void createCruise(/*Cruise bean*/) {
+ String programCode = dbResource.getFixtures().programCode();
+ Cruise cruise = new Cruise();
+ cruise.setId(null);
+
+ cruise.setName("CGFS_2013");
+
+ cruise.setProgram(service.getProgram(programCode));
+
+ Calendar calendar = new GregorianCalendar();
+ cruise.setBeginDate(calendar.getTime());
+
+ cruise.setYear(calendar.get(Calendar.YEAR));
+
+ calendar.add(Calendar.MONTH, 1); // add one month
+ cruise.setEndDate(calendar.getTime());
+
+ Country country = null;
+ List<Country> countries = service.getAllCountry();
+ for (Iterator iterator = countries.iterator(); iterator.hasNext();) {
+ Country aCountry = (Country) iterator.next();
+ if (aCountry.getLabel() != null && aCountry.getLabel().equals("FRA")) {
+ country = aCountry;
+ break;
+ }
+ }
+ assertNotNull("Could not load FRA country", country);
+ cruise.setCountry(country);
+
+ List<Gear> gears = service.getAllFishingGear();
+ cruise.setGear(gears);
+
+ cruise.setComment("My comments on cruise");
+
+ Person managerPerson = service.getAllPerson().get(0);
+ cruise.setHeadOfMission(Lists.newArrayList(managerPerson));
+
+ List<Vessel> vessels = Lists.newArrayList();
+ vessels.add(service.getAllScientificVessel().get(0));
+ Vessel fishingVessel = new Vessel();
+ fishingVessel.setId(dbResource.getFixtures().fishingVesselCode());
+ vessels.add(fishingVessel);
+
+ cruise.setVessel(vessels);
+
+ Cruise createdCruise = service.createCruise(cruise);
+ assertNotNull(createdCruise);
+ assertNotNull(createdCruise.getId());
+ assertEquals(cruise.getName(), createdCruise.getName());
+
+ // New cruise, with empty optional values
+ createdCruise.setId(null);
+ createdCruise.setHeadOfMission(null);
+ createdCruise.setBeginDate(null);
+ createdCruise.setEndDate(null);
+ createdCruise.setComment(null);
+ createdCruise.setPoche(null);
+ createdCruise = service.createCruise(cruise);
+ assertNotNull(createdCruise);
+ assertNotNull(createdCruise.getId());
+ assertEquals(cruise.getName(), createdCruise.getName());
+
+ Cruise reloadedCruise = service.getCruise(createdCruise.getId());
+ assertEquals(createdCruise.getBeginDate(), reloadedCruise.getBeginDate());
+ assertEquals(createdCruise.getEndDate(), reloadedCruise.getEndDate());
+ assertEquals(createdCruise.getComment(), reloadedCruise.getComment());
+ assertEquals(createdCruise.getPoche(), reloadedCruise.getPoche());
+ assertNull(reloadedCruise.getHeadOfMission());
+ assertNotNull(reloadedCruise.getVessel());
+ assertEquals(createdCruise.getVessel().get(0), reloadedCruise.getVessel().get(0));
+ assertEquals(cruise.getCountry().getId(), reloadedCruise.getCountry().getId());
+ assertNotNull(reloadedCruise.getVessel());
+ assertEquals(vessels.size(), reloadedCruise.getVessel().size());
+ assertNotNull(reloadedCruise.getGear());
+ assertEquals(gears.size(), reloadedCruise.getGear().size());
}
@Test
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java 2013-01-14 09:50:27 UTC (rev 187)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java 2013-01-14 11:00:11 UTC (rev 188)
@@ -39,4 +39,8 @@
public String cruiseId() {
return "100000";
}
+
+ public String fishingVesselCode() {
+ return "851751";
+ }
}
1
0
r187 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos java/fr/ifremer/tutti/ui/swing/content/operation/catches/species java/fr/ifremer/tutti/ui/swing/util/editor resources/i18n
by tchemit@users.forge.codelutin.com 14 Jan '13
by tchemit@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: tchemit
Date: 2013-01-14 10:50:27 +0100 (Mon, 14 Jan 2013)
New Revision: 187
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/187
Log:
remove some columns + optimize import
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-01-14 09:39:05 UTC (rev 186)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-01-14 09:50:27 UTC (rev 187)
@@ -34,7 +34,6 @@
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.environment.EnvironmentRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.editor.AttachmentCellComponent;
import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java 2013-01-14 09:39:05 UTC (rev 186)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java 2013-01-14 09:50:27 UTC (rev 187)
@@ -129,10 +129,10 @@
n_("tutti.table.species.batch.header.weight"),
n_("tutti.table.species.batch.header.weight"));
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
- n_("tutti.table.species.batch.header.computedWeight"),
- n_("tutti.table.species.batch.header.computedWeight"));
+// public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+// SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
+// n_("tutti.table.species.batch.header.computedWeight"),
+// n_("tutti.table.species.batch.header.computedWeight"));
public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
@@ -188,7 +188,7 @@
frequencyCols = Sets.newHashSet();
frequencyCols.add(COMPUTED_NUMBER);
- frequencyCols.add(COMPUTED_WEIGHT);
+// frequencyCols.add(COMPUTED_WEIGHT);
sampleCols = Sets.newHashSet();
sampleCols.add(SORTED_UNSORTED_CATEGORY);
@@ -220,16 +220,16 @@
super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
}
- if (propertyName == COMPUTED_NUMBER) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, COMPUTED_WEIGHT);
-
- } else if (propertyName == COMPUTED_WEIGHT) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex, COMPUTED_NUMBER);
- }
+// if (propertyName == COMPUTED_NUMBER) {
+//
+// // update also other columns
+// fireTableCellUpdated(rowIndex, COMPUTED_WEIGHT);
+//
+// } else if (propertyName == COMPUTED_WEIGHT) {
+//
+// // update also other columns
+// fireTableCellUpdated(rowIndex, COMPUTED_NUMBER);
+// }
}
public void updateSamplingRatio(Set<SpeciesBatchRowModel> rows) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-01-14 09:39:05 UTC (rev 186)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-01-14 09:50:27 UTC (rev 187)
@@ -385,19 +385,10 @@
protocolSpecy.getSpeciesId());
allSpecies.add(species);
speciesSampleCategories.put(species, SampleCategoryType.sortedUnsorted);
-
- if (protocolSpecy.isSizeEnabled()) {
- speciesSampleCategories.put(species, SampleCategoryType.size);
- }
- if (protocolSpecy.isSexEnabled()) {
- speciesSampleCategories.put(species, SampleCategoryType.sex);
- }
- if (protocolSpecy.isMaturityEnabled()) {
- speciesSampleCategories.put(species, SampleCategoryType.maturity);
- }
- if (protocolSpecy.isAgeEnabled()) {
- speciesSampleCategories.put(species, SampleCategoryType.age);
- }
+ speciesSampleCategories.put(species, SampleCategoryType.size);
+ speciesSampleCategories.put(species, SampleCategoryType.sex);
+ speciesSampleCategories.put(species, SampleCategoryType.maturity);
+ speciesSampleCategories.put(species, SampleCategoryType.age);
}
} else {
@@ -433,6 +424,7 @@
JXTable table = getTable();
+ table.setColumnControlVisible(true);
// create table column model
TableCellRenderer defaultRenderer =
table.getDefaultRenderer(Object.class);
@@ -498,16 +490,16 @@
TuttiUI.DECIMAL3_PATTERN);
}
- { // Computed weight column (from frequencies)
+// { // Computed weight column (from frequencies)
+//
+// addColumnToModel(columnModel,
+// FrequencyCellComponent.newEditor(ui),
+// FrequencyCellComponent.newRender(),
+// SpeciesBatchTableModel.COMPUTED_WEIGHT);
+// }
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
- }
+ { // Number column (from frequencies)
- { // Computed number column (from frequencies)
-
addColumnToModel(columnModel,
FrequencyCellComponent.newEditor(ui),
FrequencyCellComponent.newRender(),
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java 2013-01-14 09:39:05 UTC (rev 186)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java 2013-01-14 09:50:27 UTC (rev 187)
@@ -46,8 +46,6 @@
import java.awt.Color;
import java.awt.Component;
import java.util.List;
-import javax.swing.event.CellEditorListener;
-import javax.swing.event.ChangeEvent;
/**
* Editor for the values of the caracteristics of the fishing operations.
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-01-14 09:39:05 UTC (rev 186)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-01-14 09:50:27 UTC (rev 187)
@@ -232,7 +232,7 @@
tutti.table.protocol.species.header.speciesId=Espèce
tutti.table.species.batch.header.ageCategory=Age
tutti.table.species.batch.header.comment=Commentaire
-tutti.table.species.batch.header.computedNumber=Nombre calculé
+tutti.table.species.batch.header.computedNumber=Nombre
tutti.table.species.batch.header.computedWeight=Poids calculé
tutti.table.species.batch.header.file=Pièces jointes
tutti.table.species.batch.header.maturityCategory=Maturité
@@ -240,10 +240,9 @@
tutti.table.species.batch.header.sexCategory=Sexe
tutti.table.species.batch.header.sizeCategory=Class. Tri
tutti.table.species.batch.header.sortedUnsortedCategory=V/HV
-tutti.table.species.batch.header.species=
-tutti.table.species.batch.header.speciesCategory=Espèce
+tutti.table.species.batch.header.species=Espèce
tutti.table.species.batch.header.toConfirm=A Confirmer
-tutti.table.species.batch.header.weight=Poids
+tutti.table.species.batch.header.weight=Poids sous-échantillonné
tutti.table.species.frequency.header.computedWeight=Poids calculé
tutti.table.species.frequency.header.lengthStep=Classe de taille
tutti.table.species.frequency.header.number=Nombre
1
0
r186 - trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence
by tchemit@users.forge.codelutin.com 14 Jan '13
by tchemit@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: tchemit
Date: 2013-01-14 10:39:05 +0100 (Mon, 14 Jan 2013)
New Revision: 186
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/186
Log:
remove not used file key
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-14 09:05:07 UTC (rev 185)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-14 09:39:05 UTC (rev 186)
@@ -105,7 +105,6 @@
"fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation#Strata",
"fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation#SubStrata",
"fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation#Localite",
- "fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation",
"fr.ifremer.tutti.persistence.entities.referential.Gear#Scientific",
"fr.ifremer.tutti.persistence.entities.referential.Gear#Fishing",
"fr.ifremer.tutti.persistence.entities.referential.Person",
1
0
r185 - in trunk/tutti-persistence-adagio/src: main/java/fr/ifremer/tutti/persistence/service main/resources test/java/fr/ifremer/tutti/persistence/service
by tchemit@users.forge.codelutin.com 14 Jan '13
by tchemit@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: tchemit
Date: 2013-01-14 10:05:07 +0100 (Mon, 14 Jan 2013)
New Revision: 185
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/185
Log:
refs #1807: [Persistence] Adagio r?\195?\169f?\195?\169rentiel (fix fishingLocation requests)
Modified:
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-13 14:58:21 UTC (rev 184)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 09:05:07 UTC (rev 185)
@@ -337,7 +337,7 @@
public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
Iterator<Object[]> sources = queryListWithStatus(
"allFishingOperationStratas",
- "locationLevel", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_STRATA);
+ "locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_STRATA);
List<FishingOperationLocation> result = Lists.newArrayList();
while (sources.hasNext()) {
Object[] source = sources.next();
@@ -351,7 +351,7 @@
public List<FishingOperationLocation> getAllFishingOperationSubStrata(String locationId) {
Iterator<Object[]> sources = queryListWithStatus(
"allFishingOperationSubStratas",
- "locationLevel", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_SUB_STRATA);
+ "locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_SUB_STRATA);
List<FishingOperationLocation> result = Lists.newArrayList();
while (sources.hasNext()) {
Object[] source = sources.next();
@@ -365,7 +365,7 @@
public List<FishingOperationLocation> getAllFishingOperationLocation(String locationId) {
Iterator<Object[]> sources = queryListWithStatus(
"allFishingOperationLocalites",
- "locationLevel", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_LOCALITE);
+ "locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_LOCALITE);
List<FishingOperationLocation> result = Lists.newArrayList();
while (sources.hasNext()) {
Object[] source = sources.next();
@@ -490,10 +490,10 @@
target.setId(String.valueOf(source[0]));
target.setName((String)source[1]);
target.setLabel((String)source[2]);
- target.setDescription((String)source[3]);
- target.setLocationLevel((Integer)source[4]);
+// target.setDescription((String)source[3]);
+ target.setLocationLevel((Integer)source[3]);
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[5], target);
+ setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[4], target);
return target;
}
Modified: trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-13 14:58:21 UTC (rev 184)
+++ trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 09:05:07 UTC (rev 185)
@@ -442,7 +442,7 @@
l.status.code IN (:statusValidCode, :statusTemporaryCode)
AND l.locationLevel.id = :locationLevelId
]]>
- <query-param name="locationLevel" type="java.lang.Integer"/>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
<query-param name="statusValidCode" type="java.lang.String"/>
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
@@ -461,6 +461,7 @@
l.status.code IN (:statusValidCode, :statusTemporaryCode)
AND l.locationLevel.id = :locationLevelId
]]>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
<query-param name="statusValidCode" type="java.lang.String"/>
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
@@ -479,6 +480,7 @@
l.status.code IN (:statusValidCode, :statusTemporaryCode)
AND l.locationLevel.id = :locationLevelId
]]>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
<query-param name="statusValidCode" type="java.lang.String"/>
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java 2013-01-13 14:58:21 UTC (rev 184)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java 2013-01-14 09:05:07 UTC (rev 185)
@@ -32,6 +32,7 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -215,14 +216,32 @@
@Test
public void getAllFishingOperationStrata(/*String zoneId*/) {
+ List<FishingOperationLocation> result =
+ service.getAllFishingOperationStrata(null);
+ Assert.assertNotNull(result);
+ Assert.assertEquals(596, result.size());
+ persistList(FishingOperationLocation.class, "Strata", result);
+ assertSize(result, storage.getAllFishingOperationStrata(null));
}
@Test
public void getAllFishingOperationSubStrata(/*String locationId*/) {
+ List<FishingOperationLocation> result =
+ service.getAllFishingOperationSubStrata(null);
+ Assert.assertNotNull(result);
+ Assert.assertEquals(0, result.size());
+ persistList(FishingOperationLocation.class, "SubStrata", result);
+ assertSize(result, storage.getAllFishingOperationSubStrata(null));
}
@Test
public void getAllFishingOperationLocation(/*String locationId*/) {
+ List<FishingOperationLocation> result =
+ service.getAllFishingOperationLocation(null);
+ Assert.assertNotNull(result);
+ Assert.assertEquals(322, result.size());
+ persistList(FishingOperationLocation.class, "Localite", result);
+ assertSize(result, storage.getAllFishingOperationLocation(null));
}
@Test
1
0
13 Jan '13
Author: tchemit
Date: 2013-01-13 15:58:21 +0100 (Sun, 13 Jan 2013)
New Revision: 184
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/184
Log:
refs #1807: [Persistence] Adagio r?\195?\169f?\195?\169rentiel (usage in dev storage)
fixes #1911: [CAMPAGNE] - Gestion des campagnes (filtrage des navires)
updates to nuiton-utils 2.6.6
fix some little NPE
fix validation
Added:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java
Modified:
trunk/pom.xml
trunk/tutti-persistence-adagio/pom.xml
trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties
trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java
trunk/tutti-persistence-adagio/src/test/resources/log4j.properties
trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/pom.xml 2013-01-13 14:58:21 UTC (rev 184)
@@ -122,7 +122,7 @@
<!-- libraries version -->
- <nuitonUtilsVersion>2.7-SNAPSHOT</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6.6</nuitonUtilsVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
<eugenePluginVersion>2.6.1</eugenePluginVersion>
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -24,6 +24,7 @@
* #L%
*/
+import org.apache.commons.lang3.ObjectUtils;
import org.nuiton.util.CollectionUtil;
import java.io.Serializable;
@@ -62,7 +63,16 @@
@Override
public boolean equals(Object o) {
- if (this == o) return true;
+ if (this == o) {
+ return true;
+ }
+ if (o == null) {
+ return false;
+ }
+ if (ObjectUtils.notEqual(o.getClass(), getClass())) {
+ // not sale class
+ return false;
+ }
if (!(o instanceof AbstractTuttiEntity)) return false;
AbstractTuttiEntity that = (AbstractTuttiEntity) o;
@@ -75,4 +85,9 @@
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
+
+ @Override
+ public String toString() {
+ return super.toString() + ": " + id;
+ }
}
\ No newline at end of file
Modified: trunk/tutti-persistence-adagio/pom.xml
===================================================================
--- trunk/tutti-persistence-adagio/pom.xml 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-adagio/pom.xml 2013-01-13 14:58:21 UTC (rev 184)
@@ -47,6 +47,12 @@
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tutti-persistence-dev</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>fr.ifremer.adagio</groupId>
<artifactId>adagio-core</artifactId>
<classifier>allegro</classifier>
Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -98,7 +98,7 @@
while (list.hasNext()) {
Object[] source = list.next();
Zone target = new Zone();
- target.setId((String) source[0]);
+ target.setId(String.valueOf(source[0]));
target.setName((String) source[1]);
target.setDescription((String) source[2]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], target);
@@ -488,10 +488,10 @@
protected FishingOperationLocation loadFishingOperationLocation(Object[] source) {
FishingOperationLocation target = new FishingOperationLocation();
target.setId(String.valueOf(source[0]));
- target.setName(String.valueOf(source[1]));
- target.setLabel(String.valueOf(source[2]));
- target.setDescription(String.valueOf(source[3]));
- target.setLocationLevel(Integer.valueOf(source[4].toString()));
+ target.setName((String)source[1]);
+ target.setLabel((String)source[2]);
+ target.setDescription((String)source[3]);
+ target.setLocationLevel((Integer)source[4]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[5], target);
return target;
@@ -519,8 +519,8 @@
protected Gear loadGear(Object[] source) {
Gear result = new Gear();
result.setId(String.valueOf(source[0]));
- result.setName(String.valueOf(source[1]));
- result.setLabel(String.valueOf(source[2]));
+ result.setName((String)source[1]);
+ result.setLabel((String)source[2]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], result);
return result;
}
Modified: trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties
===================================================================
--- trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-adagio/src/main/resources/tutti-db-enumerations.properties 2013-01-13 14:58:21 UTC (rev 184)
@@ -300,13 +300,13 @@
# 10/01/2012 BLA Need to retrieve a Location from a given position (Lat/Long)
LocationLevelId.RECTANGLE_STATISTIQUE_MED=145
-# Ajoute pour Tutti
+# Ajout pour Tutti
LocationLevelId.LOCALITE=22
LocationLevelId.STRATA=23
#TODO Creer la bonne valeur
LocationLevelId.SUBSTRATA=-23
#TODO Mettre la bonne valeur
-LocationLevelId.PROGRAM=111
+LocationLevelId.PROGRAM=21
MethodId.DECLARATION=1
@@ -316,8 +316,6 @@
ParameterGroupId.ENVIRONEMENT_MEASUREMENT=3
#TODO Mettre la bonne valeur
ParameterGroupId.HYDROLOGIC_MEASUREMENT=3
-#TODO A creer
-ParameterGroupId.LENGTH=3
PmfmId.SEX=196
PmfmId.SIZE_CATEGORY=198
Modified: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java
===================================================================
--- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceTest.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -24,7 +24,12 @@
* #L%
*/
+import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.TuttiPersistenceDevImpl;
+import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
+import fr.ifremer.tutti.persistence.entities.IdAware;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -32,12 +37,18 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
+import org.nuiton.util.ApplicationConfig;
+import java.io.IOException;
import java.util.List;
/**
@@ -51,8 +62,55 @@
@ClassRule
public static final DatabaseResource dbResource = new DatabaseResource();
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ReferentialPersistenceServiceTest.class);
+
+ protected static TuttiPersistenceDevImpl storage;
+
protected ReferentialPersistenceService service;
+ @BeforeClass
+ public static void beforeClass() throws IOException {
+
+ // create a storage
+
+ ApplicationConfig applicationConfig = dbResource.getConfig().getConfig();
+
+ TuttiPersistenceDevConfig devDriverConfig =
+ new TuttiPersistenceDevConfig(applicationConfig);
+
+ applicationConfig.setOption(TuttiPersistenceDevImpl.SKIP_FIXTURES_OPTION, Boolean.TRUE.toString());
+
+ storage = new TuttiPersistenceDevImpl(devDriverConfig) {
+
+ @Override
+ public <B extends IdAware> B create(String type,
+ B bean,
+ boolean sychronize) {
+ Preconditions.checkNotNull(bean, "Can't persist a null bean");
+ B result = TuttiEntities.newEntity(bean);
+ result.setId(bean.getId());
+ if (log.isDebugEnabled()) {
+ log.debug("Will persist [" + type + ":" + bean.getId() + "]");
+ }
+ super.persist(type, bean, result, sychronize);
+ return result;
+ }
+ };
+
+ if (log.isInfoEnabled()) {
+ log.info("Will open persistence driver " + storage.getImplementationName());
+ }
+
+ storage.open();
+ }
+
+ @AfterClass
+ public static void afterClass() throws IOException {
+ storage.close();
+ }
+
@Before
public void setUp() throws Exception {
service = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
@@ -62,7 +120,10 @@
public void getAllProgramZone() {
List<Zone> result = service.getAllProgramZone();
Assert.assertNotNull(result);
- Assert.assertEquals(0, result.size());
+ Assert.assertEquals(240, result.size());
+
+ persistList(Zone.class, result);
+ assertSize(result, storage.getAllProgramZone());
}
@Test
@@ -70,6 +131,8 @@
List<Country> result = service.getAllCountry();
Assert.assertNotNull(result);
Assert.assertEquals(240, result.size());
+ persistList(Country.class, result);
+ assertSize(result, storage.getAllCountry());
}
@Test
@@ -77,6 +140,8 @@
List<Vessel> result = service.getAllScientificVessel();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
+ persistList(Vessel.class, "Scientific", result);
+ assertSize(result, storage.getAllScientificVessel());
}
//FIXME : requete trop longue (index manquant, trop de jointures?)
@@ -86,6 +151,8 @@
List<Vessel> result = service.getAllFishingVessel();
Assert.assertNotNull(result);
Assert.assertEquals(187, result.size());
+ persistList(Vessel.class, "Fishing", result);
+ assertSize(result, storage.getAllFishingVessel());
}
@Test
@@ -93,6 +160,8 @@
List<Gear> result = service.getAllScientificGear();
Assert.assertNotNull(result);
Assert.assertEquals(2, result.size());
+ persistList(Gear.class, "Scientific", result);
+ assertSize(result, storage.getAllScientificGear());
}
@Test
@@ -100,6 +169,8 @@
List<Gear> result = service.getAllFishingGear();
Assert.assertNotNull(result);
Assert.assertEquals(75, result.size());
+ persistList(Gear.class, "Fishing", result);
+ assertSize(result, storage.getAllFishingGear());
}
@Test
@@ -107,14 +178,17 @@
List<Person> result = service.getAllPerson();
Assert.assertNotNull(result);
Assert.assertEquals(123, result.size());
+ persistList(Person.class, result);
+ assertSize(result, storage.getAllPerson());
}
-
@Test
public void getAllSpecies() {
List<Species> result = service.getAllSpecies();
Assert.assertNotNull(result);
Assert.assertEquals(8435, result.size());
+ persistList(Species.class, result);
+ assertSize(result, storage.getAllSpecies());
}
@Test
@@ -122,6 +196,8 @@
List<Species> result = service.getAllBenthosSpecies();
Assert.assertNotNull(result);
Assert.assertEquals(8435, result.size());
+ persistList(Species.class, "Benthos", result);
+ assertSize(result, storage.getAllBenthosSpecies());
}
@Test
@@ -129,6 +205,8 @@
List<Species> result = service.getAllPlanktonSpecies();
Assert.assertNotNull(result);
Assert.assertEquals(8435, result.size());
+ persistList(Species.class, "Plankton", result);
+ assertSize(result, storage.getAllPlanktonSpecies());
}
@Test
@@ -152,6 +230,8 @@
List<Caracteristic> result = service.getAllFishingOperationEnvironmentCaracteristic();
Assert.assertNotNull(result);
Assert.assertEquals(40, result.size());
+ persistList(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.Environment.name(), result);
+ assertSize(result, storage.getAllFishingOperationEnvironmentCaracteristic());
}
@Test
@@ -159,13 +239,19 @@
List<Caracteristic> result = service.getAllFishingOperationGearCaracteristic();
Assert.assertNotNull(result);
Assert.assertEquals(155, result.size());
+ persistList(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.Gear.name(), result);
+ assertSize(result, storage.getAllFishingOperationGearCaracteristic());
}
+ //TODO Fix this!
@Test
+ @Ignore
public void getAllFishingOperationHydrologicCaracteristic() {
List<Caracteristic> result = service.getAllFishingOperationHydrologicCaracteristic();
Assert.assertNotNull(result);
Assert.assertEquals(40, result.size());
+ persistList(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.Hydrology.name(), result);
+ assertSize(result, storage.getAllFishingOperationHydrologicCaracteristic());
}
@Test
@@ -173,6 +259,8 @@
List<Caracteristic> result = service.getAllSpeciesLengthStepCaracteristic();
Assert.assertNotNull(result);
Assert.assertEquals(24, result.size());
+ persistList(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.Length.name(), result);
+ assertSize(result, storage.getAllSpeciesLengthStepCaracteristic());
}
@Test
@@ -182,6 +270,8 @@
Assert.assertTrue(result.isQualitativeType());
Assert.assertNotNull(result.getQualitativeValue());
Assert.assertEquals(6, result.sizeQualitativeValue());
+ persist(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.SizeCategory.name(), result);
+ assertCaracteristicSize(result, storage.getSizeCategoryCaracteristic());
}
@Test
@@ -191,6 +281,8 @@
Assert.assertTrue(result.isQualitativeType());
Assert.assertNotNull(result.getQualitativeValue());
Assert.assertEquals(4, result.sizeQualitativeValue());
+ persist(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.SexCategory.name(), result);
+ assertCaracteristicSize(result, storage.getSexCaracteristic());
}
@Test
@@ -200,6 +292,8 @@
Assert.assertTrue(result.isQualitativeType());
Assert.assertNotNull(result.getQualitativeValue());
Assert.assertEquals(2, result.sizeQualitativeValue());
+ persist(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.SortedUnsortedCategory.name(), result);
+ assertCaracteristicSize(result, storage.getSortedUnsortedCaracteristic());
}
@Test
@@ -209,6 +303,8 @@
Assert.assertTrue(result.isQualitativeType());
Assert.assertNotNull(result.getQualitativeValue());
Assert.assertEquals(10, result.sizeQualitativeValue());
+ persist(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.MaturityCategory.name(), result);
+ assertCaracteristicSize(result, storage.getMaturityCaracteristic());
}
@Test
@@ -218,6 +314,8 @@
Assert.assertTrue(result.isQualitativeType());
Assert.assertNotNull(result.getQualitativeValue());
Assert.assertEquals(10, result.sizeQualitativeValue());
+ persist(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.MacroWasteCategory.name(), result);
+ assertCaracteristicSize(result, storage.getMacroWasteCategoryCaracteristic());
}
@Test
@@ -227,6 +325,47 @@
Assert.assertTrue(result.isQualitativeType());
Assert.assertNotNull(result.getQualitativeValue());
Assert.assertEquals(10, result.sizeQualitativeValue());
+ persist(Caracteristic.class, ReferentialPersistenceServiceDevImpl.CaracteristicEnum.MacroWasteSizeCategory.name(), result);
+ assertCaracteristicSize(result, storage.getMacroWasteSizeCategoryCaracteristic());
}
+ protected <S extends IdAware> void persistList(Class<S> type, List<S> result) {
+ persistList(type, null, result);
+ }
+
+ protected <S extends IdAware> void persistList(Class<S> type, String context, List<S> result) {
+
+ String key = TuttiPersistenceDevImpl.getKey(type, context);
+ for (S s : result) {
+ storage.create(key, s, false);
+ }
+ storage.persistToFile(key);
+ }
+
+ protected <S extends IdAware> void persist(Class<S> type, S result) {
+ persist(type, null, result);
+ }
+
+ protected <S extends IdAware> void persist(Class<S> type, String context, S result) {
+ String key = TuttiPersistenceDevImpl.getKey(type, context);
+ storage.create(key, result, true);
+ }
+
+ protected void assertSize(List<?> expectedList, List<?> storageList) {
+ Assert.assertNotNull(expectedList);
+ Assert.assertNotNull(storageList);
+ expectedList.removeAll(storageList);
+ Assert.assertTrue("Some " + expectedList.size() + " entities were not persisted in storage :" +
+ expectedList, expectedList.isEmpty());
+
+ }
+
+ protected void assertCaracteristicSize(Caracteristic incoming,
+ Caracteristic caracteristic) {
+ Assert.assertNotNull(incoming);
+ Assert.assertNotNull(caracteristic);
+ Assert.assertEquals(incoming, caracteristic);
+ Assert.assertEquals(incoming.sizeQualitativeValue(),
+ caracteristic.sizeQualitativeValue());
+ }
}
Modified: trunk/tutti-persistence-adagio/src/test/resources/log4j.properties
===================================================================
--- trunk/tutti-persistence-adagio/src/test/resources/log4j.properties 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-adagio/src/test/resources/log4j.properties 2013-01-13 14:58:21 UTC (rev 184)
@@ -38,5 +38,5 @@
log4j.logger.net.sf.ehcache=WARN
log4j.logger.fr.ifremer.adagio.core=DEBUG
-log4j.logger.fr.ifremer.tutti=DEBUG
+log4j.logger.fr.ifremer.tutti=INFO
log4j.logger.org.nuiton=INFO
Modified: trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties
===================================================================
--- trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties 2013-01-13 14:58:21 UTC (rev 184)
@@ -21,5 +21,5 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
-tutti.persistence.jdbc.url=jdbc:hsqldb:file:src/test/db/allegro
-#tutti.persistence.jdbc.url=jdbc:hsqldb:hsql://localhost/allegro
\ No newline at end of file
+#tutti.persistence.jdbc.url=jdbc:hsqldb:file:src/test/db/allegro
+tutti.persistence.jdbc.url=jdbc:hsqldb:hsql://localhost/allegro
\ No newline at end of file
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -40,7 +40,7 @@
import java.util.List;
import java.util.UUID;
-import static fr.ifremer.tutti.persistence.TuttiPersistenceDevImpl.CaracteristicEnum;
+import static fr.ifremer.tutti.persistence.service.ReferentialPersistenceServiceDevImpl.CaracteristicEnum;
/**
* TODO
@@ -50,8 +50,17 @@
*/
public class TuttiPersistenceDevFixtures {
- protected final ArrayListMultimap<Class<? extends IdAware>, IdAware> cache;
+ protected final ArrayListMultimap<String, IdAware> cache;
+ protected void putInCache(Class<?> type, IdAware b) {
+ putInCache(type, null, b);
+ }
+
+ protected void putInCache(Class<?> type, String context, IdAware b) {
+ String key = TuttiPersistenceDevImpl.getKey(type, context);
+ cache.put(key, b);
+ }
+
public TuttiPersistenceDevFixtures() {
// inject default datas (only referential)
@@ -62,7 +71,7 @@
z = new Zone();
z.setId(UUID.randomUUID().toString());
z.setName("zone1");
- cache.put(Zone.class, z);
+ putInCache(Zone.class, z);
FishingOperationLocation l;
FishingOperationLocation sl;
@@ -72,122 +81,149 @@
l.setId(UUID.randomUUID().toString());
l.setName("zone1 - strata1");
l.setZone(z);
- cache.put(FishingOperationLocation.class, l);
+ putInCache(FishingOperationLocation.class, "Strata", l);
sl = new FishingOperationLocation();
sl.setId(UUID.randomUUID().toString());
sl.setName("strat1 - substrata1");
sl.setParent(l);
- cache.put(FishingOperationLocation.class, sl);
+ putInCache(FishingOperationLocation.class, "SubStrata", sl);
ssl = new FishingOperationLocation();
ssl.setId(UUID.randomUUID().toString());
ssl.setName("substrata1 - localite1");
ssl.setLocalite(true);
ssl.setParent(sl);
- cache.put(FishingOperationLocation.class, ssl);
+ putInCache(FishingOperationLocation.class, "Localite", ssl);
ssl = new FishingOperationLocation();
ssl.setId(UUID.randomUUID().toString());
ssl.setName("substrata1 - localite2");
ssl.setLocalite(true);
ssl.setParent(sl);
- cache.put(FishingOperationLocation.class, ssl);
+ putInCache(FishingOperationLocation.class, "Localite", ssl);
sl = new FishingOperationLocation();
sl.setId(UUID.randomUUID().toString());
sl.setName("strat1 - substrata2");
sl.setParent(l);
- cache.put(FishingOperationLocation.class, sl);
+ putInCache(FishingOperationLocation.class, "SubStrata", sl);
ssl = new FishingOperationLocation();
ssl.setId(UUID.randomUUID().toString());
ssl.setName("substrata2 - localite1");
ssl.setLocalite(true);
ssl.setParent(sl);
- cache.put(FishingOperationLocation.class, ssl);
+ putInCache(FishingOperationLocation.class, "Localite", ssl);
ssl = new FishingOperationLocation();
ssl.setId(UUID.randomUUID().toString());
ssl.setName("substrata2 - localite2");
ssl.setLocalite(true);
ssl.setParent(sl);
- cache.put(FishingOperationLocation.class, ssl);
+ putInCache(FishingOperationLocation.class, "Localite", ssl);
l = new FishingOperationLocation();
l.setId(UUID.randomUUID().toString());
l.setName("zone1 - strata2");
l.setZone(z);
- cache.put(FishingOperationLocation.class, l);
+ putInCache(FishingOperationLocation.class, "Strata", l);
ssl = new FishingOperationLocation();
ssl.setId(UUID.randomUUID().toString());
ssl.setName("strata2 - localite1");
ssl.setParent(l);
ssl.setLocalite(true);
- cache.put(FishingOperationLocation.class, ssl);
+ putInCache(FishingOperationLocation.class, "Localite", ssl);
ssl = new FishingOperationLocation();
ssl.setId(UUID.randomUUID().toString());
ssl.setName("strata2 - localite2");
ssl.setParent(l);
ssl.setLocalite(true);
- cache.put(FishingOperationLocation.class, ssl);
+ putInCache(FishingOperationLocation.class, "Localite", ssl);
z = new Zone();
z.setId(UUID.randomUUID().toString());
z.setName("zone2");
- cache.put(Zone.class, z);
+ putInCache(Zone.class, z);
l = new FishingOperationLocation();
l.setId(UUID.randomUUID().toString());
l.setName("zone2 - strata1");
l.setZone(z);
- cache.put(FishingOperationLocation.class, l);
+ putInCache(FishingOperationLocation.class, "Strata", l);
l = new FishingOperationLocation();
l.setId(UUID.randomUUID().toString());
l.setName("zone2 - strata2");
l.setZone(z);
- cache.put(FishingOperationLocation.class, l);
+ putInCache(FishingOperationLocation.class, "Strata", l);
Country c;
c = new Country();
c.setId(UUID.randomUUID().toString());
c.setName("France");
- cache.put(Country.class, c);
+ putInCache(Country.class, c);
c = new Country();
c.setId(UUID.randomUUID().toString());
c.setName("Espagne");
- cache.put(Country.class, c);
+ putInCache(Country.class, c);
Vessel v;
v = new Vessel();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA");
+ v.setScientificVessel(true);
v.setRegistrationCode("RegistrationCode1");
- cache.put(Vessel.class, v);
+ putInCache(Vessel.class, "Scientific", v);
v = new Vessel();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA-II");
+ v.setScientificVessel(true);
v.setRegistrationCode("RegistrationCode2");
- cache.put(Vessel.class, v);
+ putInCache(Vessel.class, "Scientific", v);
+ v = new Vessel();
+ v.setId(UUID.randomUUID().toString());
+ v.setName("Fishing1");
+ v.setScientificVessel(false);
+ v.setRegistrationCode("RegistrationCode1");
+ putInCache(Vessel.class, "Fishing", v);
+
+ v = new Vessel();
+ v.setId(UUID.randomUUID().toString());
+ v.setName("Fishing2");
+ v.setScientificVessel(false);
+ v.setRegistrationCode("RegistrationCode1");
+ putInCache(Vessel.class, "Fishing", v);
+
+
Gear g;
g = new Gear();
g.setId(UUID.randomUUID().toString());
- g.setName("Gear-1");
- cache.put(Gear.class, g);
+ g.setName("Gear-Scientific-1");
+ putInCache(Gear.class, "Scientific", g);
g = new Gear();
g.setId(UUID.randomUUID().toString());
- g.setName("Gear-2");
- cache.put(Gear.class, g);
+ g.setName("Gear-Scientific-2");
+ putInCache(Gear.class, "Scientific", g);
+ g = new Gear();
+ g.setId(UUID.randomUUID().toString());
+ g.setName("Gear-Fishing-1");
+ putInCache(Gear.class, "Fishing", g);
+
+ g = new Gear();
+ g.setId(UUID.randomUUID().toString());
+ g.setName("Gear-Fishing-2");
+ putInCache(Gear.class, "Fishing", g);
+
Person u;
u = new Person();
@@ -195,47 +231,47 @@
u.setName("Vincent Badts");
u.setFirstName("Vincent");
u.setLastName("Badts");
- cache.put(Person.class, u);
+ putInCache(Person.class, u);
u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Jean claude Mahet");
u.setFirstName("Jean claude");
u.setLastName("Mahet");
- cache.put(Person.class, u);
+ putInCache(Person.class, u);
u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Luisa Metral");
u.setFirstName("Luisa");
u.setLastName("Metral");
- cache.put(Person.class, u);
+ putInCache(Person.class, u);
u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Jean Hervé Bourdeix");
u.setFirstName("Jean Hervé");
u.setLastName("Bourdeix");
- cache.put(Person.class, u);
+ putInCache(Person.class, u);
u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Ysabelle Cheret");
u.setFirstName("Ysabelle");
u.setLastName("Cheret");
- cache.put(Person.class, u);
+ putInCache(Person.class, u);
u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Blandine Brisset");
u.setFirstName("Blandine");
u.setLastName("Brisset");
- cache.put(Person.class, u);
+ putInCache(Person.class, u);
Caracteristic ca;
ca = createQualitativeCaracteristic("Vent Beaufort",
- CaracteristicEnum.FishingOperationEnvironment.name());
+ CaracteristicEnum.Environment.name());
createCaracteristicQualitativeValue(ca, "Calme");
createCaracteristicQualitativeValue(ca, "Très légère brise");
@@ -247,83 +283,83 @@
createCaracteristicQualitativeValue(ca, "Fort coup de vent");
ca = createQualitativeCaracteristic("État de la mer",
- CaracteristicEnum.FishingOperationEnvironment.name());
+ CaracteristicEnum.Environment.name());
createCaracteristicQualitativeValue(ca, "Mer calme");
createCaracteristicQualitativeValue(ca, "Mer agitée");
createNumberCaracteristic("Direction du vent",
- CaracteristicEnum.FishingOperationEnvironment.name());
+ CaracteristicEnum.Environment.name());
createNumberCaracteristic("Profondeur (début de traine)",
- CaracteristicEnum.FishingOperationEnvironment.name());
+ CaracteristicEnum.Environment.name());
createNumberCaracteristic("Profondeur (fin de traine)",
- CaracteristicEnum.FishingOperationEnvironment.name());
+ CaracteristicEnum.Environment.name());
createNumberCaracteristic("Ouverture horizontale",
- CaracteristicEnum.FishingOperationGear.name());
+ CaracteristicEnum.Gear.name());
createNumberCaracteristic("Ouverture verticale",
- CaracteristicEnum.FishingOperationGear.name());
+ CaracteristicEnum.Gear.name());
createNumberCaracteristic("Longueur funes",
- CaracteristicEnum.FishingOperationGear.name());
+ CaracteristicEnum.Gear.name());
createNumberCaracteristic("Longueur bras",
- CaracteristicEnum.FishingOperationGear.name());
+ CaracteristicEnum.Gear.name());
ca = createQualitativeCaracteristic("Systeme cul ferme",
- CaracteristicEnum.FishingOperationGear.name());
+ CaracteristicEnum.Gear.name());
createCaracteristicQualitativeValue(ca, "Oui");
createCaracteristicQualitativeValue(ca, "Non");
ca = createQualitativeCaracteristic("Géométrie mesurée",
- CaracteristicEnum.FishingOperationGear.name());
+ CaracteristicEnum.Gear.name());
createCaracteristicQualitativeValue(ca, "Oui");
createCaracteristicQualitativeValue(ca, "Non");
createNumberCaracteristic("Température Surface_S",
- CaracteristicEnum.FishingOperationHydrologic_surfaceTemperature.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Température Surface_E",
- CaracteristicEnum.FishingOperationHydrologic_surfaceTemperature.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Température Surface_A",
- CaracteristicEnum.FishingOperationHydrologic_surfaceTemperature.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Température fond_S",
- CaracteristicEnum.FishingOperationHydrologic_bottomTemperature.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Température fond_E",
- CaracteristicEnum.FishingOperationHydrologic_bottomTemperature.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Température fond_A",
- CaracteristicEnum.FishingOperationHydrologic_bottomTemperature.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Salinité surface_S",
- CaracteristicEnum.FishingOperationHydrologic_surfaceSalinity.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Salinité surface_E",
- CaracteristicEnum.FishingOperationHydrologic_surfaceSalinity.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Salinité surface_A",
- CaracteristicEnum.FishingOperationHydrologic_surfaceSalinity.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Salinité fond_S",
- CaracteristicEnum.FishingOperationHydrologic_bottomSalinity.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Salinité fond_E",
- CaracteristicEnum.FishingOperationHydrologic_bottomSalinity.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Salinité fond_A",
- CaracteristicEnum.FishingOperationHydrologic_bottomSalinity.name());
+ CaracteristicEnum.Hydrology.name());
createNumberCaracteristic("Mesure au cm par un observateur (carapace)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
createNumberCaracteristic("Mesure au cm par un observateur (totale)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
createNumberCaracteristic("Mesure au cm par un observateur (céphalothorax)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
createNumberCaracteristic("Mesure au 1/2 cm par un observateur (totale)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
createNumberCaracteristic("Mesure au 1/100 mm par un observateur (queue de langoustine)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
createNumberCaracteristic("Mesure au 1/2 cm par un observateur (manteau)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
createNumberCaracteristic("Mesure au cm par un observateur (manteau)",
- CaracteristicEnum.SpeciesFrequency.name());
+ CaracteristicEnum.Length.name());
Species sp;
@@ -331,25 +367,25 @@
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("BAR");
sp.setGenusSpecies("Bar");
- cache.put(Species.class, sp);
+ putInCache(Species.class, sp);
sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("CHIN");
sp.setGenusSpecies("Chinchard");
- cache.put(Species.class, sp);
+ putInCache(Species.class, sp);
sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("FLE");
sp.setGenusSpecies("Flet");
- cache.put(Species.class, sp);
+ putInCache(Species.class, sp);
sp = new Species();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("LIM");
sp.setGenusSpecies("Limande");
- cache.put(Species.class, sp);
+ putInCache(Species.class, sp);
ca = createQualitativeCaracteristic("MacroWaste", CaracteristicEnum.MacroWasteCategory.name());
@@ -386,28 +422,27 @@
createCaracteristicQualitativeValue(ca, "<100*100cm = 1m²");
createCaracteristicQualitativeValue(ca, ">100*100cm = 1m²");
- ca = createQualitativeCaracteristic("Sorted / Unsorted Category", CaracteristicEnum.SpeciesSortedUnsorted.name());
+ ca = createQualitativeCaracteristic("Sorted / Unsorted Category", CaracteristicEnum.SortedUnsortedCategory.name());
createCaracteristicQualitativeValue(ca, "Vrac");
createCaracteristicQualitativeValue(ca, "Hors Vrac");
- ca = createQualitativeCaracteristic("Species Sex Category", CaracteristicEnum.SpeciesSex.name());
+ ca = createQualitativeCaracteristic("Species Sex Category", CaracteristicEnum.SexCategory.name());
createCaracteristicQualitativeValue(ca, "Male");
createCaracteristicQualitativeValue(ca, "Femelle");
createCaracteristicQualitativeValue(ca, "Indéterminé");
- ca = createQualitativeCaracteristic("Species Maturity Category", CaracteristicEnum.SpeciesMaturity.name());
+ ca = createQualitativeCaracteristic("Species Maturity Category", CaracteristicEnum.MaturityCategory.name());
createCaracteristicQualitativeValue(ca, "0");
createCaracteristicQualitativeValue(ca, "1");
createCaracteristicQualitativeValue(ca, "2");
- ca = createQualitativeCaracteristic("Species Size Category", CaracteristicEnum.SpeciesSizeCategory.name());
+ ca = createQualitativeCaracteristic("Species Size Category", CaracteristicEnum.SizeCategory.name());
createCaracteristicQualitativeValue(ca, "Petit");
createCaracteristicQualitativeValue(ca, "Gros");
-
}
protected void createCaracteristicQualitativeValue(Caracteristic ca, String name) {
@@ -415,7 +450,7 @@
cqv.setId(UUID.randomUUID().toString());
cqv.setName(name);
ca.addQualitativeValue(cqv);
- cache.put(CaracteristicQualitativeValue.class, cqv);
+ putInCache(CaracteristicQualitativeValue.class, name, cqv);
}
protected Caracteristic createQualitativeCaracteristic(String name, String category) {
@@ -425,7 +460,7 @@
ca.setCategory(category);
ca.setQualitativeType(true);
ca.setQualitativeValue(Lists.<CaracteristicQualitativeValue>newArrayList());
- cache.put(Caracteristic.class, ca);
+ putInCache(Caracteristic.class, category, ca);
return ca;
}
@@ -435,11 +470,11 @@
ca.setName(name);
ca.setCategory(category);
ca.setNumberType(true);
- cache.put(Caracteristic.class, ca);
+ putInCache(Caracteristic.class, category, ca);
return ca;
}
- public <B extends IdAware> List<B> getData(Class<B> entityType) {
+ public <B extends IdAware> List<B> getData(String entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -56,6 +56,8 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.service.ReferentialPersistenceService;
+import fr.ifremer.tutti.persistence.service.ReferentialPersistenceServiceDevImpl;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -71,7 +73,6 @@
import java.io.ObjectOutputStream;
import java.util.List;
import java.util.Map;
-import java.util.ServiceLoader;
import java.util.Set;
import java.util.UUID;
@@ -87,40 +88,48 @@
private static final Log log =
LogFactory.getLog(TuttiPersistenceDevImpl.class);
- /**
- * All entity types.
- *
- * @since 0.1
- */
- public static final List<Class<? extends IdAware>> TYPES;
+ public static final List<String> FILE_KEYS = Lists.newArrayList(
+ "fr.ifremer.tutti.persistence.entities.data.Attachment",
+ "fr.ifremer.tutti.persistence.entities.data.AccidentalBatch",
+ "fr.ifremer.tutti.persistence.entities.data.BenthosBatch",
+ "fr.ifremer.tutti.persistence.entities.data.FishingOperation",
+ "fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch",
+ "fr.ifremer.tutti.persistence.entities.data.PlanktonBatch",
+ "fr.ifremer.tutti.persistence.entities.data.Program",
+ "fr.ifremer.tutti.persistence.entities.data.Cruise",
+ "fr.ifremer.tutti.persistence.entities.data.SpeciesBatch",
+ "fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency",
+ "fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol",
+ "fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue",
+ "fr.ifremer.tutti.persistence.entities.referential.Country",
+ "fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation#Strata",
+ "fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation#SubStrata",
+ "fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation#Localite",
+ "fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation",
+ "fr.ifremer.tutti.persistence.entities.referential.Gear#Scientific",
+ "fr.ifremer.tutti.persistence.entities.referential.Gear#Fishing",
+ "fr.ifremer.tutti.persistence.entities.referential.Person",
+ "fr.ifremer.tutti.persistence.entities.referential.Species",
+ "fr.ifremer.tutti.persistence.entities.referential.Species#Benthos",
+ "fr.ifremer.tutti.persistence.entities.referential.Species#Plankton",
+ "fr.ifremer.tutti.persistence.entities.referential.Vessel#Scientific",
+ "fr.ifremer.tutti.persistence.entities.referential.Vessel#Fishing",
+ "fr.ifremer.tutti.persistence.entities.referential.Zone"
+ );
static {
- TYPES = Lists.newArrayList();
-
- for (IdAware e : ServiceLoader.load(IdAware.class)) {
- TYPES.add(e.getClass());
+ for (ReferentialPersistenceServiceDevImpl.CaracteristicEnum caracteristicEnum :
+ ReferentialPersistenceServiceDevImpl.CaracteristicEnum.values()) {
+ FILE_KEYS.add(getKey(Caracteristic.class, caracteristicEnum.name()));
}
+
if (log.isInfoEnabled()) {
- log.info("Found " + TYPES.size() + " entity types.");
+ log.info("Found " + FILE_KEYS.size() + " files.");
}
}
- enum CaracteristicEnum {
- FishingOperationEnvironment,
- FishingOperationGear,
- FishingOperationHydrologic_bottomTemperature,
- FishingOperationHydrologic_surfaceTemperature,
- FishingOperationHydrologic_bottomSalinity,
- FishingOperationHydrologic_surfaceSalinity,
- SpeciesFrequency,
- SpeciesSizeCategory,
- SpeciesSex,
- SpeciesSortedUnsorted,
- SpeciesMaturity,
- MacroWasteCategory,
- MacroWasteSizeCategory
- }
+ public static final String SKIP_FIXTURES_OPTION = "LoadFixtures";
/**
* Persistence config.
@@ -134,15 +143,22 @@
*
* @since 0.1
*/
- protected final ArrayListMultimap<Class<? extends IdAware>, IdAware> cache = ArrayListMultimap.create();
+ protected final ArrayListMultimap<String, IdAware> cache = ArrayListMultimap.create();
/**
* Cache of binder.
*
* @since 0.2
*/
- protected final Map<Class<? extends IdAware>, Binder<? extends IdAware, ? extends IdAware>> binderCache = Maps.newHashMap();
+ protected final Map<String, Binder<? extends IdAware, ? extends IdAware>> binderCache = Maps.newHashMap();
+ /**
+ * Referential persistence service.
+ *
+ * @since 0.3
+ */
+ protected ReferentialPersistenceService referentialPersistenceService;
+
public TuttiPersistenceDevImpl(TuttiPersistenceDevConfig config) {
this.config = config;
}
@@ -156,6 +172,7 @@
return "Persistence Dev implementation";
}
+ @Override
public void open() throws IOException {
Preconditions.checkNotNull(config, " No config property setted");
@@ -168,14 +185,25 @@
cache.clear();
- TuttiPersistenceDevFixtures fixtures =
- new TuttiPersistenceDevFixtures();
+ boolean loadFixtures =
+ config.getConfig().getOptionAsBoolean(SKIP_FIXTURES_OPTION);
+ if (!loadFixtures) {
- for (Class<? extends IdAware> entityType : TYPES) {
- loadEntities(entityType, fixtures);
+ if (log.isInfoEnabled()) {
+ log.info("Load default fixtures...");
+ }
+ TuttiPersistenceDevFixtures fixtures =
+ new TuttiPersistenceDevFixtures();
+
+ for (String entityType : FILE_KEYS) {
+ loadEntities(entityType, fixtures);
+ }
}
+
+ referentialPersistenceService = new ReferentialPersistenceServiceDevImpl(cache);
}
+ @Override
public void close() throws IOException {
if (log.isInfoEnabled()) {
@@ -183,7 +211,7 @@
}
binderCache.clear();
- for (Class<? extends IdAware> entityType : cache.keySet()) {
+ for (String entityType : cache.keySet()) {
persistToFile(entityType);
}
}
@@ -193,198 +221,159 @@
//------------------------------------------------------------------------//
@Override
- public List<Species> getAllSpecies() {
- List<Species> result = getDataInNewList(Species.class);
- return result;
+ public List<Vessel> getAllScientificVessel() {
+ return referentialPersistenceService.getAllScientificVessel();
}
@Override
- public List<Species> getAllBenthosSpecies() {
- List<Species> result = getDataInNewList(Species.class);
- return result;
+ public List<Zone> getAllProgramZone() {
+ return referentialPersistenceService.getAllProgramZone();
}
@Override
- public List<Species> getAllPlanktonSpecies() {
- List<Species> result = getDataInNewList(Species.class);
- return result;
+ public List<Country> getAllCountry() {
+ return referentialPersistenceService.getAllCountry();
}
@Override
- public Species getSpecies(String id) {
- Species result = getBean(Species.class, id);
- return result;
+ public List<Vessel> getAllFishingVessel() {
+ return referentialPersistenceService.getAllFishingVessel();
}
- @Override
- public List<Zone> getAllProgramZone() {
- List<Zone> result = getDataInNewList(Zone.class);
- return result;
+ public Vessel getVessel(String vesselCode) {
+ return referentialPersistenceService.getVessel(vesselCode);
}
@Override
- public List<Country> getAllCountry() {
- List<Country> result = getDataInNewList(Country.class);
- return result;
+ public List<Species> getAllSpecies() {
+ return referentialPersistenceService.getAllSpecies();
}
@Override
- public List<Vessel> getAllScientificVessel() {
- List<Vessel> result = Lists.newArrayList(Iterables.filter(getData(Vessel.class), new Predicate<Vessel>() {
- @Override
- public boolean apply(Vessel input) {
- return input.isScientificVessel();
- }
- }));
- return result;
+ public List<Species> getAllBenthosSpecies() {
+ return referentialPersistenceService.getAllBenthosSpecies();
}
@Override
- public List<Vessel> getAllFishingVessel() {
- List<Vessel> result = Lists.newArrayList(Iterables.filter(getData(Vessel.class), new Predicate<Vessel>() {
- @Override
- public boolean apply(Vessel input) {
- return !input.isScientificVessel();
- }
- }));
- return result;
+ public List<Species> getAllPlanktonSpecies() {
+ return referentialPersistenceService.getAllPlanktonSpecies();
}
@Override
- public List<Gear> getAllScientificGear() {
- List<Gear> result = getDataInNewList(Gear.class);
- return result;
+ public Species getSpecies(String speciesId) {
+ return referentialPersistenceService.getSpecies(speciesId);
}
@Override
- public List<Gear> getAllFishingGear() {
- List<Gear> result = getDataInNewList(Gear.class);
- return result;
+ public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
+ return referentialPersistenceService.getAllFishingOperationStrata(zoneId);
}
@Override
- public List<Person> getAllPerson() {
- List<Person> result = getDataInNewList(Person.class);
- return result;
+ public List<FishingOperationLocation> getAllFishingOperationSubStrata(String locationId) {
+ return referentialPersistenceService.getAllFishingOperationSubStrata(locationId);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationStrata(final String zoneId) {
- List<FishingOperationLocation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperationLocation.class), new Predicate<FishingOperationLocation>() {
- @Override
- public boolean apply(FishingOperationLocation input) {
- Zone zone = input.getZone();
- return zone != null && zoneId.equals(zone.getId());
- }
- }));
- return result;
+ public List<FishingOperationLocation> getAllFishingOperationLocation(String locationId) {
+ return referentialPersistenceService.getAllFishingOperationLocation(locationId);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationSubStrata(final String locationId) {
- List<FishingOperationLocation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperationLocation.class), new Predicate<FishingOperationLocation>() {
- @Override
- public boolean apply(FishingOperationLocation input) {
- FishingOperationLocation parent = input.getParent();
- return parent != null && !input.isLocalite() && locationId.equals(parent.getId());
- }
- }));
- return result;
- }
-
- @Override
- public List<FishingOperationLocation> getAllFishingOperationLocation(final String locationId) {
- List<FishingOperationLocation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperationLocation.class), new Predicate<FishingOperationLocation>() {
- @Override
- public boolean apply(FishingOperationLocation input) {
- FishingOperationLocation parent = input.getParent();
- return parent != null && input.isLocalite() && locationId.equals(parent.getId());
- }
- }));
- return result;
- }
-
- @Override
public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() {
- return getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationEnvironment.name());
+ return referentialPersistenceService.getAllFishingOperationEnvironmentCaracteristic();
}
@Override
public List<Caracteristic> getAllFishingOperationGearCaracteristic() {
- return getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationGear.name());
+ return referentialPersistenceService.getAllFishingOperationGearCaracteristic();
}
@Override
public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() {
-
- List<Caracteristic> result = Lists.newArrayList();
- result.addAll(getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationHydrologic_bottomSalinity.name()));
- result.addAll(getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationHydrologic_surfaceSalinity.name()));
- result.addAll(getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationHydrologic_bottomTemperature.name()));
- result.addAll(getAllCaracteristicByCategory(CaracteristicEnum.FishingOperationHydrologic_surfaceTemperature.name()));
- return result;
+ return referentialPersistenceService.getAllFishingOperationHydrologicCaracteristic();
}
@Override
public List<Caracteristic> getAllSpeciesLengthStepCaracteristic() {
- return getAllCaracteristicByCategory(CaracteristicEnum.SpeciesFrequency.name());
+ return referentialPersistenceService.getAllSpeciesLengthStepCaracteristic();
}
@Override
public Caracteristic getSizeCategoryCaracteristic() {
- return getCaracteristicByCategory(CaracteristicEnum.SpeciesSizeCategory.name());
+ return referentialPersistenceService.getSizeCategoryCaracteristic();
}
@Override
public Caracteristic getSexCaracteristic() {
- return getCaracteristicByCategory(CaracteristicEnum.SpeciesSex.name());
+ return referentialPersistenceService.getSexCaracteristic();
}
@Override
public Caracteristic getSortedUnsortedCaracteristic() {
- return getCaracteristicByCategory(CaracteristicEnum.SpeciesSortedUnsorted.name());
+ return referentialPersistenceService.getSortedUnsortedCaracteristic();
}
@Override
public Caracteristic getMaturityCaracteristic() {
- return getCaracteristicByCategory(CaracteristicEnum.SpeciesMaturity.name());
+ return referentialPersistenceService.getMaturityCaracteristic();
}
@Override
public Caracteristic getMacroWasteCategoryCaracteristic() {
- return getCaracteristicByCategory(CaracteristicEnum.MacroWasteCategory.name());
+ return referentialPersistenceService.getMacroWasteCategoryCaracteristic();
}
@Override
public Caracteristic getMacroWasteSizeCategoryCaracteristic() {
- return getCaracteristicByCategory(CaracteristicEnum.MacroWasteSizeCategory.name());
+ return referentialPersistenceService.getMacroWasteSizeCategoryCaracteristic();
}
+ @Override
+ public List<Gear> getAllScientificGear() {
+ return referentialPersistenceService.getAllScientificGear();
+ }
+
+ @Override
+ public List<Gear> getAllFishingGear() {
+ return referentialPersistenceService.getAllFishingGear();
+ }
+
+ @Override
+ public List<Person> getAllPerson() {
+ return referentialPersistenceService.getAllPerson();
+ }
+
+ public Person getPerson(Integer personId) {
+ return referentialPersistenceService.getPerson(personId);
+ }
+
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
@Override
public List<Program> getAllProgram() {
- List<Program> result = getDataInNewList(Program.class);
+ List<Program> result = getDataInNewList(Program.class.getName());
return result;
}
@Override
public Program getProgram(String id) {
- Program result = getBean(Program.class, id);
+ Program result = getBean(Program.class.getName(), id);
return result;
}
@Override
public Program createProgram(Program bean) {
- Program result = create(Program.class, bean);
+ Program result = create(Program.class.getName(), bean);
return result;
}
@Override
public Program saveProgram(Program bean) {
- Program result = save(Program.class, bean);
+ Program result = save(Program.class.getName(), bean);
return result;
}
@@ -394,7 +383,8 @@
@Override
public List<Cruise> getAllCruise(final String programId) {
- List<Cruise> result = Lists.newArrayList(Iterables.filter(getData(Cruise.class), new Predicate<Cruise>() {
+ List<Cruise> data = getData(Cruise.class.getName());
+ List<Cruise> result = Lists.newArrayList(Iterables.filter(data, new Predicate<Cruise>() {
@Override
public boolean apply(Cruise input) {
return programId.equals(input.getProgram().getId());
@@ -405,19 +395,19 @@
@Override
public Cruise getCruise(String id) {
- Cruise result = getBean(Cruise.class, id);
+ Cruise result = getBean(Cruise.class.getName(), id);
return result;
}
@Override
public Cruise createCruise(Cruise bean) {
- Cruise result = create(Cruise.class, bean);
+ Cruise result = create(Cruise.class.getName(), bean);
return result;
}
@Override
public Cruise saveCruise(Cruise bean) {
- Cruise result = save(Cruise.class, bean);
+ Cruise result = save(Cruise.class.getName(), bean);
return result;
}
@@ -427,25 +417,25 @@
@Override
public List<TuttiProtocol> getAllProtocol() {
- List<TuttiProtocol> result = getDataInNewList(TuttiProtocol.class);
+ List<TuttiProtocol> result = getDataInNewList(TuttiProtocol.class.getName());
return result;
}
@Override
public TuttiProtocol getProtocol(String id) {
- TuttiProtocol result = getBean(TuttiProtocol.class, id);
+ TuttiProtocol result = getBean(TuttiProtocol.class.getName(), id);
return result;
}
@Override
public TuttiProtocol createProtocol(TuttiProtocol bean) {
- TuttiProtocol result = create(TuttiProtocol.class, bean);
+ TuttiProtocol result = create(TuttiProtocol.class.getName(), bean);
return result;
}
@Override
public TuttiProtocol saveProtocol(TuttiProtocol bean) {
- TuttiProtocol result = save(TuttiProtocol.class, bean);
+ TuttiProtocol result = save(TuttiProtocol.class.getName(), bean);
return result;
}
@@ -456,7 +446,8 @@
@Override
public List<FishingOperation> getAllFishingOperation(final String cruiseId) {
- List<FishingOperation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperation.class), new Predicate<FishingOperation>() {
+ List<FishingOperation> data = getData(FishingOperation.class.getName());
+ List<FishingOperation> result = Lists.newArrayList(Iterables.filter(data, new Predicate<FishingOperation>() {
@Override
public boolean apply(FishingOperation input) {
return cruiseId.equals(input.getCruise().getId());
@@ -467,19 +458,20 @@
@Override
public FishingOperation getFishingOperation(String id) {
- FishingOperation result = TuttiEntities.findById(getData(FishingOperation.class), id);
+ List<FishingOperation> data = getData(FishingOperation.class.getName());
+ FishingOperation result = TuttiEntities.findById(data, id);
return result;
}
@Override
public FishingOperation createFishingOperation(FishingOperation bean) {
- FishingOperation result = create(FishingOperation.class, bean);
+ FishingOperation result = create(FishingOperation.class.getName(), bean);
return result;
}
@Override
public FishingOperation saveFishingOperation(FishingOperation bean) {
- FishingOperation result = save(FishingOperation.class, bean);
+ FishingOperation result = save(FishingOperation.class.getName(), bean);
return result;
}
@@ -490,7 +482,7 @@
@Override
public List<SpeciesBatch> getAllRootSpeciesBatch(String fishingOperationId) {
List<SpeciesBatch> result = getAllTraitFilterBatches(
- SpeciesBatch.class, fishingOperationId, new Predicate<SpeciesBatch>() {
+ SpeciesBatch.class.getName(), fishingOperationId, new Predicate<SpeciesBatch>() {
@Override
public boolean apply(SpeciesBatch input) {
@@ -503,13 +495,13 @@
@Override
public List<SpeciesBatch> getAllSpeciesBatch(final String fishingOperationId) {
List<SpeciesBatch> result = getAllTraitFilterBatches(
- SpeciesBatch.class, fishingOperationId, null);
+ SpeciesBatch.class.getName(), fishingOperationId, null);
return result;
}
@Override
public SpeciesBatch getSpeciesBatch(String id) {
- SpeciesBatch result = getBean(SpeciesBatch.class, id);
+ SpeciesBatch result = getBean(SpeciesBatch.class.getName(), id);
return result;
}
@@ -519,7 +511,7 @@
boolean withParent = parentBatchId != null;
- SpeciesBatch result = create(SpeciesBatch.class, bean, !withParent);
+ SpeciesBatch result = create(SpeciesBatch.class.getName(), bean, !withParent);
if (withParent) {
@@ -536,26 +528,26 @@
childBatchs.add(result);
// now persist species batches
- persistToFile(SpeciesBatch.class);
+ persistToFile(SpeciesBatch.class.getName());
}
return result;
}
@Override
public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) {
- SpeciesBatch result = save(SpeciesBatch.class, bean);
+ SpeciesBatch result = save(SpeciesBatch.class.getName(), bean);
return result;
}
@Override
public void deleteSpeciesBatch(String id) {
- remove(SpeciesBatch.class, id);
+ remove(SpeciesBatch.class.getName(), id);
}
@Override
public void deleteSpeciesSubBatch(String id) {
Preconditions.checkNotNull(id, "Can't save a bean with null id");
- SpeciesBatch bean = getBean(SpeciesBatch.class, id);
+ SpeciesBatch bean = getBean(SpeciesBatch.class.getName(), id);
Preconditions.checkNotNull(
bean, "SpeciesBatch with id: " + id + " does not exist");
@@ -565,7 +557,7 @@
cache.remove(SpeciesBatch.class, toDelete);
}
bean.setChildBatchs(null);
- persistToFile(SpeciesBatch.class);
+ persistToFile(SpeciesBatch.class.getName());
}
protected void collectChilds(SpeciesBatch bean, Set<SpeciesBatch> collected) {
@@ -579,7 +571,8 @@
@Override
public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(final String speciesBatchId) {
- List<SpeciesBatchFrequency> result = Lists.newArrayList(Iterables.filter(getData(SpeciesBatchFrequency.class), new Predicate<SpeciesBatchFrequency>() {
+ List<SpeciesBatchFrequency> data = getData(SpeciesBatchFrequency.class.getName());
+ List<SpeciesBatchFrequency> result = Lists.newArrayList(Iterables.filter(data, new Predicate<SpeciesBatchFrequency>() {
@Override
public boolean apply(SpeciesBatchFrequency input) {
return speciesBatchId.equals(input.getBatch().getId());
@@ -597,7 +590,7 @@
getAllSpeciesBatchFrequency(speciesBatchId);
List<SpeciesBatchFrequency> result =
- persistList(SpeciesBatchFrequency.class,
+ persistList(SpeciesBatchFrequency.class.getName(),
existingData,
frequencies);
return result;
@@ -610,31 +603,31 @@
@Override
public List<BenthosBatch> getAllBenthosBatch(String fishingOperationId) {
List<BenthosBatch> result = getAllTraitFilterBatches(
- BenthosBatch.class, fishingOperationId, null);
+ BenthosBatch.class.getName(), fishingOperationId, null);
return result;
}
@Override
public BenthosBatch getBenthosBatch(String id) {
- BenthosBatch result = getBean(BenthosBatch.class, id);
+ BenthosBatch result = getBean(BenthosBatch.class.getName(), id);
return result;
}
@Override
public BenthosBatch createBenthosBatch(BenthosBatch bean) {
- BenthosBatch result = create(BenthosBatch.class, bean);
+ BenthosBatch result = create(BenthosBatch.class.getName(), bean);
return result;
}
@Override
public BenthosBatch saveBenthosBatch(BenthosBatch bean) {
- BenthosBatch result = save(BenthosBatch.class, bean);
+ BenthosBatch result = save(BenthosBatch.class.getName(), bean);
return result;
}
@Override
public void deleteBenthosBatch(String id) {
- remove(BenthosBatch.class, id);
+ remove(BenthosBatch.class.getName(), id);
}
//------------------------------------------------------------------------//
@@ -644,31 +637,31 @@
@Override
public List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId) {
List<PlanktonBatch> result = getAllTraitFilterBatches(
- PlanktonBatch.class, fishingOperationId, null);
+ PlanktonBatch.class.getName(), fishingOperationId, null);
return result;
}
@Override
public PlanktonBatch getPlanktonBatch(String id) {
- PlanktonBatch result = getBean(PlanktonBatch.class, id);
+ PlanktonBatch result = getBean(PlanktonBatch.class.getName(), id);
return result;
}
@Override
public PlanktonBatch createPlanktonBatch(PlanktonBatch bean) {
- PlanktonBatch result = create(PlanktonBatch.class, bean);
+ PlanktonBatch result = create(PlanktonBatch.class.getName(), bean);
return result;
}
@Override
public PlanktonBatch savePlanktonBatch(PlanktonBatch bean) {
- PlanktonBatch result = save(PlanktonBatch.class, bean);
+ PlanktonBatch result = save(PlanktonBatch.class.getName(), bean);
return result;
}
@Override
public void deletePlanktonBatch(String id) {
- remove(PlanktonBatch.class, id);
+ remove(PlanktonBatch.class.getName(), id);
}
//------------------------------------------------------------------------//
@@ -678,31 +671,31 @@
@Override
public List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId) {
List<MacroWasteBatch> result = getAllTraitFilterBatches(
- MacroWasteBatch.class, fishingOperationId, null);
+ MacroWasteBatch.class.getName(), fishingOperationId, null);
return result;
}
@Override
public MacroWasteBatch getMacroWasteBatch(String id) {
- MacroWasteBatch result = getBean(MacroWasteBatch.class, id);
+ MacroWasteBatch result = getBean(MacroWasteBatch.class.getName(), id);
return result;
}
@Override
public MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean) {
- MacroWasteBatch result = create(MacroWasteBatch.class, bean);
+ MacroWasteBatch result = create(MacroWasteBatch.class.getName(), bean);
return result;
}
@Override
public MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean) {
- MacroWasteBatch result = save(MacroWasteBatch.class, bean);
+ MacroWasteBatch result = save(MacroWasteBatch.class.getName(), bean);
return result;
}
@Override
public void deleteMacroWasteBatch(String id) {
- remove(MacroWasteBatch.class, id);
+ remove(MacroWasteBatch.class.getName(), id);
}
//------------------------------------------------------------------------//
@@ -712,47 +705,65 @@
@Override
public List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId) {
List<AccidentalBatch> result = getAllTraitFilterBatches(
- AccidentalBatch.class, fishingOperationId, null);
+ AccidentalBatch.class.getName(), fishingOperationId, null);
return result;
}
@Override
public AccidentalBatch getAccidentalBatch(String id) {
- AccidentalBatch result = getBean(AccidentalBatch.class, id);
+ AccidentalBatch result = getBean(AccidentalBatch.class.getName(), id);
return result;
}
@Override
public AccidentalBatch createAccidentalBatch(AccidentalBatch bean) {
- AccidentalBatch result = create(AccidentalBatch.class, bean);
+ AccidentalBatch result = create(AccidentalBatch.class.getName(), bean);
return result;
}
@Override
public AccidentalBatch saveAccidentalBatch(AccidentalBatch bean) {
- AccidentalBatch result = save(AccidentalBatch.class, bean);
+ AccidentalBatch result = save(AccidentalBatch.class.getName(), bean);
return result;
}
@Override
public void deleteAccidentalBatch(String id) {
- remove(AccidentalBatch.class, id);
+ remove(AccidentalBatch.class.getName(), id);
}
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected <B extends IdAware> Binder<B, B> getBinder(Class<B> type) {
+ protected <B> Class<B> getType(String type) {
+ String typeName = type;
+ int i = type.indexOf('#');
+ if (i > -1) {
+ typeName = type.substring(0, i);
+ }
+ try {
+ Class<B> result = (Class<B>) Class.forName(typeName);
+ return result;
+ } catch (Exception e) {
+ throw new RuntimeException("No class named " + typeName, e);
+ }
+ }
+
+ protected <B extends IdAware> Binder<B, B> getBinder(String type) {
+
Binder<B, B> result = (Binder<B, B>) binderCache.get(type);
if (result == null) {
- result = BinderFactory.newBinder(type);
+
+ Class<B> binderType = getType(type);
+
+ result = BinderFactory.newBinder(binderType);
binderCache.put(type, result);
}
return result;
}
- protected <B extends IdAware> void persist(Class<B> beanType,
+ protected <B extends IdAware> void persist(String beanType,
B source,
B target,
boolean synchFile) {
@@ -761,7 +772,7 @@
if (source.getId() == null) {
target.setId(UUID.randomUUID().toString());
}
- if (!cache.containsValue(target)) {
+ if (!cache.containsEntry(beanType, target)) {
cache.put(beanType, target);
}
if (synchFile) {
@@ -769,7 +780,7 @@
}
}
- protected <B extends IdAware> List<B> persistList(Class<B> beanType,
+ protected <B extends IdAware> List<B> persistList(String beanType,
List<B> existingData,
List<B> newData) {
@@ -790,7 +801,8 @@
if (TuttiEntities.isNew(source)) {
// must create it
- target = TuttiEntities.newEntity(beanType);
+ Class<B> type = getType(beanType);
+ target = TuttiEntities.newEntity(type);
} else {
// get existing data
@@ -826,9 +838,8 @@
return result;
}
- protected <B extends IdAware> List<B> loadEntities(Class<B> entityType,
- TuttiPersistenceDevFixtures fix
- ) throws IOException {
+ protected <B extends IdAware> List<B> loadEntities(String entityType,
+ TuttiPersistenceDevFixtures fix) throws IOException {
File storageFile = getStorageFile(entityType);
List<B> result;
@@ -864,7 +875,15 @@
return result;
}
- protected <B extends IdAware> List<B> loadEntities(Class<B> entityType,
+ public static String getKey(Class<?> type, String context) {
+ String key = type.getName();
+ if (context != null) {
+ key += '#' + context;
+ }
+ return key;
+ }
+
+ protected <B extends IdAware> List<B> loadEntities(String entityType,
List<B> defaultList) throws IOException {
File storageFile = getStorageFile(entityType);
@@ -898,14 +917,13 @@
return result;
}
- protected <B> File getStorageFile(Class<B> entityType) {
+ protected <B> File getStorageFile(String entityType) {
File storageDirectory = this.config.getStorageDirectory();
- File result = new File(storageDirectory,
- entityType.getSimpleName() + ".ser");
+ File result = new File(storageDirectory, entityType + ".ser");
return result;
}
- protected <B extends IdAware> void persistToFile(Class<B> entityType) {
+ public <B extends IdAware> void persistToFile(String entityType) {
List<B> entities = getDataInNewList(entityType);
File storageFile = getStorageFile(entityType);
@@ -929,61 +947,43 @@
}
}
- protected <B extends IdAware> List<B> getData(Class<B> entityType) {
+ protected <B extends IdAware> List<B> getData(String entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
}
- protected <B extends IdAware> List<B> getDataInNewList(Class<B> entityType) {
+ protected <B extends IdAware> List<B> getDataInNewList(String entityType) {
List<B> result = getData(entityType);
return Lists.newArrayList(result);
}
protected <B extends FishingOperationAware> List<B> getAllTraitFilterBatches(
- Class<B> beanType,
+ String beanType,
String traitId,
Predicate<B> extraPredicate) {
Predicate<B> predicate = TuttiEntities.newTraitIdPredicate(traitId);
if (extraPredicate != null) {
predicate = Predicates.and(predicate, extraPredicate);
}
- List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), predicate));
+ List<B> data = getData(beanType);
+ List<B> result = Lists.newArrayList(Iterables.filter(data, predicate));
return result;
}
- protected List<Caracteristic> getAllCaracteristicByCategory(String categoryId) {
- Predicate<Caracteristic> predicate = TuttiEntities.newCaracteristicCategoryPredicate(categoryId);
- List<Caracteristic> result = Lists.newArrayList(Iterables.filter(getData(Caracteristic.class), predicate));
- return result;
- }
-
- protected Caracteristic getCaracteristicByCategory(String categoryId) {
- Predicate<Caracteristic> predicate = TuttiEntities.newCaracteristicCategoryPredicate(categoryId);
- List<Caracteristic> data = getData(Caracteristic.class);
- Caracteristic result = null;
- for (Caracteristic caracteristic : data) {
- if (predicate.apply(caracteristic)) {
- result = caracteristic;
- break;
- }
- }
- return result;
- }
-
- protected <B extends IdAware> B create(Class<B> type, B bean) {
+ protected <B extends IdAware> B create(String type, B bean) {
return create(type, bean, true);
}
- protected <B extends IdAware> B create(Class<B> type,
- B bean,
- boolean sychronize) {
+ public <B extends IdAware> B create(String type,
+ B bean,
+ boolean sychronize) {
Preconditions.checkNotNull(bean, "Can't persist a null bean");
B result = TuttiEntities.newEntity(bean);
persist(type, bean, result, sychronize);
return result;
}
- protected <B extends IdAware> B save(Class<B> type, B bean) {
+ protected <B extends IdAware> B save(String type, B bean) {
Preconditions.checkNotNull(bean, "Can't persist a null bean");
String id = bean.getId();
Preconditions.checkNotNull(id, "Can't save a bean with null id");
@@ -994,7 +994,7 @@
return result;
}
- protected <B extends IdAware> void remove(Class<B> type, String id) {
+ protected <B extends IdAware> void remove(String type, String id) {
Preconditions.checkNotNull(id, "Can't delete a null id");
B bean = getBean(type, id);
//FIXME tchemit Should never happen!
@@ -1008,8 +1008,9 @@
persistToFile(type);
}
- protected <B extends IdAware> B getBean(Class<B> type, String id) {
- B result = TuttiEntities.findById(getData(type), id);
+ protected <B extends IdAware> B getBean(String type, String id) {
+ List<B> data = getData(type);
+ B result = TuttiEntities.findById(data, id);
return result;
}
Added: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java (rev 0)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -0,0 +1,225 @@
+package fr.ifremer.tutti.persistence.service;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.IdAware;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
+
+import java.util.List;
+
+import static fr.ifremer.tutti.persistence.TuttiPersistenceDevImpl.getKey;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class ReferentialPersistenceServiceDevImpl implements ReferentialPersistenceService {
+
+ public enum CaracteristicEnum {
+ Environment,
+ Gear,
+ Hydrology,
+ Length,
+ SizeCategory,
+ SexCategory,
+ SortedUnsortedCategory,
+ MaturityCategory,
+ MacroWasteCategory,
+ MacroWasteSizeCategory
+ }
+
+ /**
+ * Cache of data.
+ *
+ * @since 0.1
+ */
+ protected final ArrayListMultimap<String, IdAware> cache;
+
+ public ReferentialPersistenceServiceDevImpl(ArrayListMultimap<String, IdAware> cache) {
+ this.cache = cache;
+ }
+
+ @Override
+ public List<Species> getAllSpecies() {
+ List<Species> result = getDataInNewList(Species.class.getName());
+ return result;
+ }
+
+ @Override
+ public List<Species> getAllBenthosSpecies() {
+ List<Species> result = getDataInNewList(getKey(Species.class, "Benthos"));
+ return result;
+ }
+
+ @Override
+ public List<Species> getAllPlanktonSpecies() {
+ List<Species> result = getDataInNewList(getKey(Species.class, "Plankton"));
+ return result;
+ }
+
+ @Override
+ public Species getSpecies(String id) {
+ Species result = getBean(Species.class.getName(), id);
+ return result;
+ }
+
+ @Override
+ public List<Zone> getAllProgramZone() {
+ List<Zone> result = getDataInNewList(Zone.class.getName());
+ return result;
+ }
+
+ @Override
+ public List<Country> getAllCountry() {
+ List<Country> result = getDataInNewList(Country.class.getName());
+ return result;
+ }
+
+ @Override
+ public List<Vessel> getAllScientificVessel() {
+ List<Vessel> result = getDataInNewList(getKey(Vessel.class, "Scientific"));
+ return result;
+ }
+
+ @Override
+ public List<Vessel> getAllFishingVessel() {
+ List<Vessel> result = getDataInNewList(getKey(Vessel.class, "Fishing"));
+ return result;
+ }
+
+ @Override
+ public List<Gear> getAllScientificGear() {
+ List<Gear> result = getDataInNewList(getKey(Gear.class, "Scientific"));
+ return result;
+ }
+
+ @Override
+ public List<Gear> getAllFishingGear() {
+ List<Gear> result = getDataInNewList(getKey(Gear.class, "Fishing"));
+ return result;
+ }
+
+ @Override
+ public List<Person> getAllPerson() {
+ List<Person> result = getDataInNewList(Person.class.getName());
+ return result;
+ }
+
+ @Override
+ public List<FishingOperationLocation> getAllFishingOperationStrata(final String zoneId) {
+ List<FishingOperationLocation> result = getDataInNewList(getKey(FishingOperationLocation.class, "Strata"));
+ return result;
+ }
+
+ @Override
+ public List<FishingOperationLocation> getAllFishingOperationSubStrata(final String locationId) {
+ List<FishingOperationLocation> result = getDataInNewList(getKey(FishingOperationLocation.class, "SubStrata"));
+ return result;
+ }
+
+ @Override
+ public List<FishingOperationLocation> getAllFishingOperationLocation(final String locationId) {
+ List<FishingOperationLocation> result = getDataInNewList(getKey(FishingOperationLocation.class, "Localite"));
+ return result;
+ }
+
+ @Override
+ public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() {
+ return getAllCaracteristic(CaracteristicEnum.Environment);
+ }
+
+ @Override
+ public List<Caracteristic> getAllFishingOperationGearCaracteristic() {
+ return getAllCaracteristic(CaracteristicEnum.Gear);
+ }
+
+ @Override
+ public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() {
+
+ List<Caracteristic> result = Lists.newArrayList();
+ //TODO Find a way to distinguish them... For the moment do not use it
+// result.addAll(getAllCaracteristic(CaracteristicEnum.Hydrology));
+ return result;
+ }
+
+ @Override
+ public List<Caracteristic> getAllSpeciesLengthStepCaracteristic() {
+ return getAllCaracteristic(CaracteristicEnum.Length);
+ }
+
+ @Override
+ public Caracteristic getSizeCategoryCaracteristic() {
+ return getCaracteristic(CaracteristicEnum.SizeCategory);
+ }
+
+ @Override
+ public Caracteristic getSexCaracteristic() {
+ return getCaracteristic(CaracteristicEnum.SexCategory);
+ }
+
+ @Override
+ public Caracteristic getSortedUnsortedCaracteristic() {
+ return getCaracteristic(CaracteristicEnum.SortedUnsortedCategory);
+ }
+
+ @Override
+ public Caracteristic getMaturityCaracteristic() {
+ return getCaracteristic(CaracteristicEnum.MaturityCategory);
+ }
+
+ @Override
+ public Caracteristic getMacroWasteCategoryCaracteristic() {
+ return getCaracteristic(CaracteristicEnum.MacroWasteCategory);
+ }
+
+ @Override
+ public Caracteristic getMacroWasteSizeCategoryCaracteristic() {
+ return getCaracteristic(CaracteristicEnum.MacroWasteSizeCategory);
+ }
+
+ @Override
+ public Vessel getVessel(String vesselCode) {
+ return getBean(Vessel.class.getName(), vesselCode);
+ }
+
+ @Override
+ public Person getPerson(Integer personId) {
+ return getBean(Person.class.getName(), personId.toString());
+ }
+
+
+ protected <B extends IdAware> List<B> getData(String entityType) {
+ List<B> result = (List<B>) cache.get(entityType);
+ return result;
+ }
+
+ protected <B extends IdAware> List<B> getDataInNewList(String entityType) {
+ List<B> result = getData(entityType);
+ return Lists.newArrayList(result);
+ }
+
+ protected <B extends IdAware> B getBean(String type, String id) {
+ List<B> data = getData(type);
+ B result = TuttiEntities.findById(data, id);
+ return result;
+ }
+
+ protected List<Caracteristic> getAllCaracteristic(CaracteristicEnum categoryId) {
+ List<Caracteristic> result = getData(getKey(Caracteristic.class, categoryId.name()));
+ return result;
+ }
+
+ protected Caracteristic getCaracteristic(CaracteristicEnum categoryId) {
+ List<Caracteristic> data = getData(getKey(Caracteristic.class, categoryId.name()));
+ Caracteristic result = data.get(0);
+ return result;
+ }
+}
Property changes on: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
===================================================================
--- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -98,7 +98,7 @@
Assert.assertTrue(storageDirectory.exists());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.getData(Country.class).size(),
+ Assert.assertEquals(fixtures.getData(Country.class.getName()).size(),
persistence.getAllCountry().size());
}
@@ -112,12 +112,12 @@
persistence.open();
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.getData(Country.class).size(),
+ Assert.assertEquals(fixtures.getData(Country.class.getName()).size(),
persistence.getAllCountry().size());
persistence.close();
Assert.assertTrue(storageDirectory.exists());
- Assert.assertEquals(fixtures.getData(Country.class).size(),
+ Assert.assertEquals(fixtures.getData(Country.class.getName()).size(),
persistence.getAllCountry().size());
}
Modified: trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties 2013-01-13 14:58:21 UTC (rev 184)
@@ -1,7 +1,7 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
-# - Apache License
+# - Affero General Public License (AGPL)
# - BSD License
# - BSD-3 Clause License
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
@@ -26,9 +26,8 @@
# Please fill the missing licenses for dependencies :
#
#
-#Mon Jan 07 22:45:28 CET 2013
+#Sun Jan 13 15:29:41 CET 2013
antlr--antlr--2.7.6=BSD License
-commons-codec--commons-codec--1.2=The Apache Software License, Version 2.0
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
javax.transaction--jta--1.1=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -199,11 +199,17 @@
List<Gear> newGearList = getGearList(vesselType);
// compute new selected vessel list
- List<Vessel> newSelectedVessel = Lists.newArrayList(selectedVessel);
+ List<Vessel> newSelectedVessel = Lists.newArrayList();
+ if (selectedVessel!=null) {
+ newSelectedVessel.addAll(selectedVessel);
+ }
newSelectedVessel.retainAll(newVesselList);
// compute new selected gear list
- List<Gear> newSelectedGear = Lists.newArrayList(selectedGear);
+ List<Gear> newSelectedGear = Lists.newArrayList();
+ if (selectedGear!=null) {
+ newSelectedGear.addAll(selectedGear);
+ }
newSelectedGear.retainAll(newGearList);
// reinit vessel list
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-01-13 14:58:21 UTC (rev 184)
@@ -32,14 +32,15 @@
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.spatial.SexagecimalPosition;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
import java.util.Calendar;
import java.util.Date;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* Model for UI {@link EditFishingOperationUI}.
*
@@ -48,12 +49,11 @@
*/
public class EditFishingOperationUIModel extends AbstractTuttiBeanUIModel<FishingOperation, EditFishingOperationUIModel> {
- private static final Log log = LogFactory.getLog(EditFishingOperationUIModel.class);
-
private static final long serialVersionUID = 1L;
-
- public static final String TITLE = "tutti.label.tab.fishingOperation.general";
+ public static final String TITLE =
+ n_("tutti.label.tab.fishingOperation.general");
+
public static final String PROPERTY_PERSISTED = "persisted";
public static final String PROPERTY_EMPTY = "empty";
@@ -187,11 +187,11 @@
gearShootingEndLatitudeAsSexagecimal = SexagecimalPosition.valueOf(gearShootingEndLatitude);
gearShootingEndLongitudeAsSexagecimal = SexagecimalPosition.valueOf(gearShootingEndLongitude);
}
-
+
public String getTitle() {
return TITLE;
}
-
+
public FishingOperation getFishingOperation() {
return fishingOperation;
}
@@ -556,7 +556,10 @@
public void setSaisisseur(List<Person> saisisseur) {
Object oldValue = Lists.newArrayList(getSaisisseur());
- this.saisisseur = Lists.newArrayList(saisisseur);
+ this.saisisseur = Lists.newArrayList();
+ if (saisisseur != null) {
+ this.saisisseur.addAll(saisisseur);
+ }
firePropertyChange(PROPERTY_SAISISSEUR, oldValue, saisisseur);
}
Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml 2013-01-13 14:58:21 UTC (rev 184)
@@ -29,7 +29,7 @@
<field name="stationNumber">
- <field-validator type="required" short-circuit="true">
+ <field-validator type="requiredstring" short-circuit="true">
<message>
tutti.validator.error.fishingOperation.stationNumber.required
</message>
Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml 2013-01-12 18:02:10 UTC (rev 183)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml 2013-01-13 14:58:21 UTC (rev 184)
@@ -29,7 +29,7 @@
<field name="stationNumber">
- <field-validator type="required" short-circuit="true">
+ <field-validator type="requiredstring" short-circuit="true">
<message>
tutti.validator.error.fishingOperation.stationNumber.required
</message>
1
0
r183 - in trunk: tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence tutti-service/src/main/java/fr/ifremer/tutti/service tutti-ui-swing tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol
by tchemit@users.forge.codelutin.com 12 Jan '13
by tchemit@users.forge.codelutin.com 12 Jan '13
12 Jan '13
Author: tchemit
Date: 2013-01-12 19:02:10 +0100 (Sat, 12 Jan 2013)
New Revision: 183
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/183
Log:
- fix jar classpath (bug with snapshot unique version)
- fix adagio persistence driver usage
- reformat license header
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/pom.xml
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-12 18:00:27 UTC (rev 182)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-12 18:02:10 UTC (rev 183)
@@ -71,7 +71,6 @@
import java.io.ObjectOutputStream;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.UUID;
@@ -157,7 +156,6 @@
return "Persistence Dev implementation";
}
- @Override
public void open() throws IOException {
Preconditions.checkNotNull(config, " No config property setted");
@@ -178,7 +176,6 @@
}
}
- @Override
public void close() throws IOException {
if (log.isInfoEnabled()) {
@@ -191,10 +188,6 @@
}
}
- @Override
- public void setEnumerations(Properties dbEnumerations) {
- }
-
//------------------------------------------------------------------------//
//-- Referential methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-01-12 18:00:27 UTC (rev 182)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-01-12 18:02:10 UTC (rev 183)
@@ -46,15 +46,14 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.io.IOException;
import java.util.List;
-import java.util.Properties;
/**
* Persistence service.
@@ -130,22 +129,11 @@
// can now instanciate Spring context
- ApplicationContext springContext = new ClassPathXmlApplicationContext(
- "applicationContext-conf.xml",
- "applicationContext-dataSource-local.xml",
- "applicationContext-entities.xml",
- "applicationContext-service-tutti.xml"
- );
+ driver = TuttiPersistenceServiceLocator.getPersistenceService();
- driver = (TuttiPersistence) springContext.getBean("adagioPersistenceService");
-
if (log.isInfoEnabled()) {
log.info("Will open persistence driver " + driver.getImplementationName());
}
-
- Properties enumerations = driverConfig.getDbEnumerations();
- driver.setEnumerations(enumerations);
- driver.open();
}
@@ -157,23 +145,15 @@
if (log.isInfoEnabled()) {
log.info("Will close persistence Service " + getImplementationName());
}
- try {
- driver.close();
- } finally {
- devDriver.close();
- }
+ IOUtils.closeQuietly(devDriver);
+ IOUtils.closeQuietly(driver);
}
- @Override
- public void setEnumerations(Properties dbEnumerations) {
- }
-
//------------------------------------------------------------------------//
//-- Referential methods --//
//------------------------------------------------------------------------//
-
@Override
public List<Vessel> getAllScientificVessel() {
return devDriver.getAllScientificVessel();
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2013-01-12 18:00:27 UTC (rev 182)
+++ trunk/tutti-ui-swing/pom.xml 2013-01-12 18:02:10 UTC (rev 183)
@@ -185,7 +185,7 @@
<configuration>
<archive>
<manifest>
- <useUniqueVersions>true</useUniqueVersions>
+ <useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
</manifest>
@@ -232,10 +232,10 @@
<version>3.5.0</version>
</dependency-->
- <dependency>
+ <!--dependency>
<groupId>fr.ird</groupId>
<artifactId>msaccess-importer</artifactId>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.nuiton</groupId>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2013-01-12 18:00:27 UTC (rev 182)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2013-01-12 18:02:10 UTC (rev 183)
@@ -16,10 +16,10 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public
-License along with this program. If not, see
-<http://www.gnu.org/licenses/gpl-3.0.html>.
-#L%
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
-->
<JPanel id='homePanel' layout='{new BorderLayout()}'
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditProtocolUIModel, EditProtocolUIHandler>'>
@@ -157,4 +157,4 @@
<JButton id='saveButton' onActionPerformed='handler.save()'/>
</JPanel>
-</JPanel>
\ No newline at end of file
+</JPanel>
1
0
r182 - trunk/tutti-persistence-adagio/src/test/resources
by tchemit@users.forge.codelutin.com 12 Jan '13
by tchemit@users.forge.codelutin.com 12 Jan '13
12 Jan '13
Author: tchemit
Date: 2013-01-12 19:00:27 +0100 (Sat, 12 Jan 2013)
New Revision: 182
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/182
Log:
fix test configuration
Modified:
trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties
Modified: trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties
===================================================================
--- trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties 2013-01-12 17:59:34 UTC (rev 181)
+++ trunk/tutti-persistence-adagio/src/test/resources/tutti-test.properties 2013-01-12 18:00:27 UTC (rev 182)
@@ -21,5 +21,5 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
-#tutti.persistence.jdbc.url=jdbc:hsqldb:file:src/test/db/allegro
-tutti.persistence.jdbc.url=jdbc:hsqldb:hsql://localhost/allegro
\ No newline at end of file
+tutti.persistence.jdbc.url=jdbc:hsqldb:file:src/test/db/allegro
+#tutti.persistence.jdbc.url=jdbc:hsqldb:hsql://localhost/allegro
\ No newline at end of file
1
0