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
January 2013
- 4 participants
- 143 discussions
14 Jan '13
Author: tchemit
Date: 2013-01-14 22:43:11 +0100 (Mon, 14 Jan 2013)
New Revision: 197
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/197
Log:
refs #1805: [Onglet Poisson] Assistance ?\195?\160 la saisie des lots de poissons
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-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.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/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SampleCategory.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/content/operation/catches/species/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -143,6 +144,8 @@
Vessel getVessel(String vesselCode);
+ boolean isSortedQualitativeValue(CaracteristicQualitativeValue value);
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -27,6 +27,7 @@
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -126,4 +127,6 @@
Person getPerson(Integer personId);
Gear getGear(Integer gearId);
+
+ boolean isSortedQualitativeValue(CaracteristicQualitativeValue value);
}
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiEnumerationFile.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -116,15 +116,18 @@
@Value("${LocationLevelId.RECTANGLE_STATISTIQUE_MED}")
public final Integer RECTANGLE_STATISTIQUE_MED = null;
+ @Value("${QualitativeValueId.VRAC}")
+ public final Integer QUALITATIVE_VRAC_ID = null;
+
@Value("${StatusCode.ENABLE}")
public final String STATUS_VALID_CODE = null;
@Value("${StatusCode.TEMPORARY}")
public final String 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;
@@ -160,5 +163,6 @@
Preconditions.checkNotNull(RECTANGLE_STATISTIQUE_MED, "LocationLevelId.RECTANGLE_STATISTIQUE_MED constant not found");
Preconditions.checkNotNull(STATUS_VALID_CODE, "StatusCode.ENABLE constant not found");
Preconditions.checkNotNull(STATUS_TEMPORARY_CODE, "StatusCode.TEMPORARY constant not found");
+ Preconditions.checkNotNull(QUALITATIVE_VRAC_ID, "QualitativeValueId.VRAC 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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceAdagioImpl.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -73,7 +74,7 @@
LogFactory.getLog(TuttiPersistenceAdagioImpl.class);
@Autowired(required = true)
- protected ReferentialPersistenceService referentielService;
+ protected ReferentialPersistenceService referentialService;
@Autowired(required = true)
protected ProgramPersistenceService programService;
@@ -130,132 +131,137 @@
@Override
public List<Zone> getAllProgramZone() {
- return referentielService.getAllProgramZone();
+ return referentialService.getAllProgramZone();
}
@Override
public List<Country> getAllCountry() {
- return referentielService.getAllCountry();
+ return referentialService.getAllCountry();
}
@Override
public List<Vessel> getAllScientificVessel() {
- return referentielService.getAllScientificVessel();
+ return referentialService.getAllScientificVessel();
}
@Override
public List<Vessel> getAllFishingVessel() {
- return referentielService.getAllFishingVessel();
+ return referentialService.getAllFishingVessel();
}
@Override
public List<Species> getAllSpecies() {
- return referentielService.getAllSpecies();
+ return referentialService.getAllSpecies();
}
@Override
public List<Species> getAllBenthosSpecies() {
- return referentielService.getAllBenthosSpecies();
+ return referentialService.getAllBenthosSpecies();
}
@Override
public List<Species> getAllPlanktonSpecies() {
- return referentielService.getAllPlanktonSpecies();
+ return referentialService.getAllPlanktonSpecies();
}
@Override
public Species getSpecies(String speciesId) {
- return referentielService.getSpecies(speciesId);
+ return referentialService.getSpecies(speciesId);
}
@Override
public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
- return referentielService.getAllFishingOperationStrata(zoneId);
+ return referentialService.getAllFishingOperationStrata(zoneId);
}
@Override
public List<FishingOperationLocation> getAllFishingOperationSubStrata(String locationId) {
- return referentielService.getAllFishingOperationSubStrata(locationId);
+ return referentialService.getAllFishingOperationSubStrata(locationId);
}
@Override
public List<FishingOperationLocation> getAllFishingOperationLocation(String locationId) {
- return referentielService.getAllFishingOperationLocation(locationId);
+ return referentialService.getAllFishingOperationLocation(locationId);
}
@Override
public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() {
- return referentielService.getAllFishingOperationEnvironmentCaracteristic();
+ return referentialService.getAllFishingOperationEnvironmentCaracteristic();
}
@Override
public List<Caracteristic> getAllFishingOperationGearCaracteristic() {
- return referentielService.getAllFishingOperationGearCaracteristic();
+ return referentialService.getAllFishingOperationGearCaracteristic();
}
@Override
public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() {
- return referentielService.getAllFishingOperationHydrologicCaracteristic();
+ return referentialService.getAllFishingOperationHydrologicCaracteristic();
}
@Override
public List<Caracteristic> getAllSpeciesLengthStepCaracteristic() {
- return referentielService.getAllSpeciesLengthStepCaracteristic();
+ return referentialService.getAllSpeciesLengthStepCaracteristic();
}
@Override
public Caracteristic getSizeCategoryCaracteristic() {
- return referentielService.getSizeCategoryCaracteristic();
+ return referentialService.getSizeCategoryCaracteristic();
}
@Override
public Caracteristic getSexCaracteristic() {
- return referentielService.getSexCaracteristic();
+ return referentialService.getSexCaracteristic();
}
@Override
public Caracteristic getSortedUnsortedCaracteristic() {
- return referentielService.getSortedUnsortedCaracteristic();
+ return referentialService.getSortedUnsortedCaracteristic();
}
@Override
public Caracteristic getMaturityCaracteristic() {
- return referentielService.getMaturityCaracteristic();
+ return referentialService.getMaturityCaracteristic();
}
@Override
public Caracteristic getMacroWasteCategoryCaracteristic() {
- return referentielService.getMacroWasteCategoryCaracteristic();
+ return referentialService.getMacroWasteCategoryCaracteristic();
}
@Override
public Caracteristic getMacroWasteSizeCategoryCaracteristic() {
- return referentielService.getMacroWasteSizeCategoryCaracteristic();
+ return referentialService.getMacroWasteSizeCategoryCaracteristic();
}
@Override
public List<Gear> getAllScientificGear() {
- return referentielService.getAllScientificGear();
+ return referentialService.getAllScientificGear();
}
@Override
public List<Gear> getAllFishingGear() {
- return referentielService.getAllFishingGear();
+ return referentialService.getAllFishingGear();
}
@Override
public List<Person> getAllPerson() {
- return referentielService.getAllPerson();
+ return referentialService.getAllPerson();
}
@Override
public Vessel getVessel(String vesselCode) {
- return referentielService.getVessel(vesselCode);
+ return referentialService.getVessel(vesselCode);
}
@Override
+ public boolean isSortedQualitativeValue(CaracteristicQualitativeValue value) {
+ return referentialService.isSortedQualitativeValue(value);
+ }
+
+ @Override
public Person getPerson(Integer personId) {
- return referentielService.getPerson(personId);
+ return referentialService.getPerson(personId);
}
//------------------------------------------------------------------------//
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -157,7 +157,7 @@
"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;
}
@@ -227,6 +227,12 @@
}
@Override
+ public boolean isSortedQualitativeValue(CaracteristicQualitativeValue value) {
+ return value != null &&
+ enumeration.QUALITATIVE_VRAC_ID.toString().equals(value.getId());
+ }
+
+ @Override
public List<Species> getAllSpecies() {
TaxonRefTaxVO[] sources = taxonNameDao.getAllTaxonRefTax();
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -49,6 +49,7 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -244,6 +245,11 @@
}
@Override
+ public boolean isSortedQualitativeValue(CaracteristicQualitativeValue value) {
+ return referentialPersistenceService.isSortedQualitativeValue(value);
+ }
+
+ @Override
public List<Species> getAllSpecies() {
return referentialPersistenceService.getAllSpecies();
}
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceDevImpl.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -29,6 +29,7 @@
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.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -224,7 +225,12 @@
return getBean(Gear.class.getName(), gearCode.toString());
}
+ @Override
+ public boolean isSortedQualitativeValue(CaracteristicQualitativeValue value) {
+ return value !=null && value.getId().equals("311");
+ }
+
protected <B extends IdAware> List<B> getData(String entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -39,6 +39,7 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -280,6 +281,11 @@
}
@Override
+ public boolean isSortedQualitativeValue(CaracteristicQualitativeValue value) {
+ return devDriver.isSortedQualitativeValue(value);
+ }
+
+ @Override
public Person getPerson(Integer personId) {
return devDriver.getPerson(personId);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SampleCategory.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SampleCategory.java 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SampleCategory.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -25,7 +25,6 @@
*/
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
import java.io.Serializable;
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -184,7 +184,7 @@
Multimap<Species, SampleCategoryType> speciesSampleCategories) {
super(columnModel, false, false);
this.speciesSampleCategories = speciesSampleCategories;
- setNoneEditableCols();
+ setNoneEditableCols(SPECIES);
frequencyCols = Sets.newHashSet();
frequencyCols.add(COMPUTED_NUMBER);
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -25,6 +25,7 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
@@ -144,8 +145,8 @@
SpeciesBatchUIModel model = getModel();
- List<Species> availableSpecies =
- Lists.newArrayList(model.getAllSpecies());
+ Multimap<CaracteristicQualitativeValue, Species> availableSpecies =
+ ArrayListMultimap.create();
List<SpeciesBatchRowModel> rows;
@@ -183,7 +184,7 @@
}
}
- model.setAvailableSpecies(availableSpecies);
+ model.setSpeciesUsed(availableSpecies);
model.setRows(rows);
recomputeBatchActionEnable();
}
@@ -589,7 +590,11 @@
Species species = createModel.getSpecies();
newRow.setSpecies(species);
- //TODO Add sortedUnosrtedCategory
+ CaracteristicQualitativeValue sortedUnsortedCategory = createModel.getSortedUnsortedCategory();
+ SampleCategory<CaracteristicQualitativeValue> category = newRow.getSortedUnsortedCategory();
+ category.setCategoryValue(sortedUnsortedCategory);
+ category.setCategoryWeight(createModel.getBatchWeight());
+ newRow.setSampleCategory(category);
recomputeRowValidState(newRow);
@@ -597,8 +602,8 @@
saveRow(newRow);
- // update available species list
- getModel().getAvailableSpecies().remove(species);
+ // update species used map
+ getModel().getSpeciesUsed().put(sortedUnsortedCategory, species);
}
@@ -957,8 +962,9 @@
int rowIndex = getTable().getSelectedRow();
- boolean enableAdd =
- CollectionUtils.isNotEmpty(getModel().getAvailableSpecies());
+ //TODO Improve this test
+ boolean enableAdd = true;
+// CollectionUtils.isNotEmpty(getModel().getAvailableSpecies());
boolean enableSplit = false;
boolean enableRemove = false;
@@ -992,8 +998,8 @@
if (enableRemove) {
- // can remove batch if selected batch is not a leaf
- enableRemove = !row.isBatchLeaf();
+ // can always remove the batch
+ enableRemove = true;
}
if (enableRemoveSub) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -24,6 +24,8 @@
* #L%
*/
+import com.google.common.collect.Multimap;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
@@ -41,7 +43,7 @@
public static final String PROPERTY_TABLE_VIEW_MODE = "tableViewMode";
- public static final String PROPERTY_AVAILABLE_SPECIES = "availableSpecies";
+ public static final String PROPERTY_SPECIES_USED = "speciesUsed";
public static final String PROPERTY_ALL_SPECIES = "allSpecies";
@@ -50,8 +52,15 @@
public static final String PROPERTY_SPLIT_SPECIES_BATCH_ENABLED = "splitSpeciesBatchEnabled";
public static final String PROPERTY_REMOVE_SPECIES_SUB_BATCH_ENABLED = "removeSpeciesSubBatchEnabled";
+
public static final String PROPERTY_REMOVE_SPECIES_BATCH_ENABLED = "removeSpeciesBatchEnabled";
+ public static final String PROPERTY_TABLE_VIEW_MODE_ALL = "tableViewModeAll";
+
+ public static final String PROPERTY_TABLE_VIEW_MODE_LEAF = "tableViewModeLeaf";
+
+ public static final String PROPERTY_TABLE_VIEW_MODE_ROOT = "tableViewModeRoot";
+
/**
* Sampling order (sets by protocol).
*
@@ -67,11 +76,11 @@
protected List<Species> allSpecies;
/**
- * All available species (says available species that are not used in any batch).
+ * Species already used in some batches.
*
* @since 0.3
*/
- protected List<Species> availableSpecies;
+ protected Multimap<CaracteristicQualitativeValue, Species> speciesUsed;
/**
* What to show in the table.
@@ -164,9 +173,9 @@
Object oldValue = getTableViewMode();
this.tableViewMode = tableViewMode;
firePropertyChange(PROPERTY_TABLE_VIEW_MODE, oldValue, tableViewMode);
- firePropertyChange("tableViewModeAll", null, isTableViewModeAll());
- firePropertyChange("tableViewModeLeaf", null, isTableViewModeLeaf());
- firePropertyChange("tableViewModeRoot", null, isTableViewModeRoot());
+ firePropertyChange(PROPERTY_TABLE_VIEW_MODE_ALL, null, isTableViewModeAll());
+ firePropertyChange(PROPERTY_TABLE_VIEW_MODE_LEAF, null, isTableViewModeLeaf());
+ firePropertyChange(PROPERTY_TABLE_VIEW_MODE_ROOT, null, isTableViewModeRoot());
}
public boolean isTableViewModeAll() {
@@ -191,16 +200,16 @@
firePropertyChange(PROPERTY_ALL_SPECIES, oldValue, allSpecies);
}
- public List<Species> getAvailableSpecies() {
- return availableSpecies;
+ public Multimap<CaracteristicQualitativeValue, Species> getSpeciesUsed() {
+ return speciesUsed;
}
- public void setAvailableSpecies(List<Species> availableSpecies) {
- Object oldValue = getAvailableSpecies();
- this.availableSpecies = availableSpecies;
- firePropertyChange(PROPERTY_AVAILABLE_SPECIES, oldValue, availableSpecies);
+ public void setSpeciesUsed(Multimap<CaracteristicQualitativeValue, Species> speciesUsed) {
+ this.speciesUsed = speciesUsed;
+ firePropertyChange(PROPERTY_SPECIES_USED, null, speciesUsed);
}
+
public boolean isCreateSpeciesBatchEnabled() {
return createSpeciesBatchEnabled;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.css 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.css 2013-01-14 21:43:11 UTC (rev 197)
@@ -52,6 +52,16 @@
data: {model.getAvailableSpecies()};
}
+#sortedUnsortedCategoryLabel {
+ text: "tutti.label.createSpeciesBatch.sortedUnsortedCategory";
+ labelFor: {sortedUnsortedCategoryComboBox};
+}
+
+#sortedUnsortedCategoryComboBox {
+ property: sortedUnsortedCategory;
+ selectedItem: {model.getSortedUnsortedCategory()};
+}
+
#batchWeightLabel {
text: "tutti.label.createSpeciesBatch.batchWeight";
labelFor: {batchWeightField};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.jaxx 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.jaxx 2013-01-14 21:43:11 UTC (rev 197)
@@ -26,6 +26,7 @@
<import>
fr.ifremer.tutti.persistence.entities.referential.Species
+ fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue
fr.ifremer.tutti.ui.swing.content.operation.catches.species.SampleCategoryType
fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI
@@ -72,6 +73,8 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='species' component='speciesComboBox'/>
+ <field name='sortedUnsortedCategory'
+ component='sortedUnsortedCategoryComboBox'/>
<field name='batchWeight' component='batchWeightField'/>
</BeanValidator>
@@ -90,6 +93,18 @@
</cell>
</row>
+ <!-- Sorted / Unsorted Category -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='sortedUnsortedCategoryLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='sortedUnsortedCategoryComboBox'
+ constructorParams='this'
+ genericType='CaracteristicQualitativeValue'/>
+ </cell>
+ </row>
+
<!-- Species batch weight -->
<row>
<cell anchor='west'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -24,8 +24,14 @@
* #L%
*/
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
@@ -35,6 +41,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.List;
/**
@@ -56,9 +64,27 @@
*/
private final CreateSpeciesBatchUI ui;
- public CreateSpeciesBatchUIHandler(SpeciesBatchUI parentUi, CreateSpeciesBatchUI ui) {
+ private final TuttiPersistence persistenceService;
+
+ private final CaracteristicQualitativeValue sortedValue;
+
+ public CreateSpeciesBatchUIHandler(SpeciesBatchUI parentUi,
+ CreateSpeciesBatchUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+
+ Caracteristic caracteristic =
+ persistenceService.getSortedUnsortedCaracteristic();
+
+ CaracteristicQualitativeValue v = null;
+ for (CaracteristicQualitativeValue value : caracteristic.getQualitativeValue()) {
+ if (persistenceService.isSortedQualitativeValue(value)) {
+ v = value;
+ break;
+ }
+ }
+ sortedValue = v;
}
//------------------------------------------------------------------------//
@@ -82,6 +108,52 @@
Lists.<Species>newArrayList(),
null);
+ Caracteristic caracteristic =
+ persistenceService.getSortedUnsortedCaracteristic();
+
+ initBeanComboBox(ui.getSortedUnsortedCategoryComboBox(),
+ caracteristic.getQualitativeValue(),
+ null);
+
+ getModel().addPropertyChangeListener(CreateSpeciesBatchUIModel.PROPERTY_SPECIES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ CreateSpeciesBatchUIModel source =
+ (CreateSpeciesBatchUIModel) evt.getSource();
+ Species newValue = (Species) evt.getNewValue();
+
+ if (log.isInfoEnabled()) {
+ log.info("New Selected species "+(newValue==null?null:newValue.getCodeMemo()));
+ }
+
+ if (newValue == null || source.getSpeciesUsed() == null) {
+
+ source.setSortedUnsortedCategory(null);
+
+ } else {
+
+ // look for best value : if sorted is available then use it
+
+ List<CaracteristicQualitativeValue> qualitativeValues =
+ ui.getSortedUnsortedCategoryComboBox().getData();
+
+ CaracteristicQualitativeValue newCategory = null;
+
+ for (CaracteristicQualitativeValue qualitativeValue : qualitativeValues) {
+ if (source.isSpeciesAndCategoryAvailable(newValue, qualitativeValue)) {
+ newCategory = qualitativeValue;
+
+ if (newCategory.equals(sortedValue)) {
+ break;
+ }
+ }
+ }
+ source.setSortedUnsortedCategory(newCategory);
+ }
+ }
+ });
+
SwingValidatorUtil.installUI(ui.getErrorTable(),
new SwingValidatorMessageTableRenderer());
@@ -135,13 +207,28 @@
ui.getValidator().setBean(model);
model.setSpecies(null);
+ model.setSortedUnsortedCategory(null);
model.setBatchWeight(null);
List<Species> speciesToUse = Lists.newArrayList();
- if (batchModel != null) {
+ Multimap<CaracteristicQualitativeValue, Species> speciesUsed;
+ boolean reset = batchModel == null;
+ if (reset) {
+ speciesUsed = ArrayListMultimap.create();
+ } else {
+ speciesUsed = batchModel.getSpeciesUsed();
+ }
- speciesToUse.addAll(batchModel.getAvailableSpecies());
+ model.setSpeciesUsed(speciesUsed);
+
+ if (!reset) {
+
+ // compute which species can still be used
+
+ List<Species> allSpecies = batchModel.getAllSpecies();
+
+ speciesToUse.addAll(allSpecies);
}
ui.getSpeciesComboBox().setData(speciesToUse);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel.java 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel.java 2013-01-14 21:43:11 UTC (rev 197)
@@ -24,10 +24,13 @@
* #L%
*/
+import com.google.common.collect.Multimap;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import java.util.List;
+import java.util.Set;
/**
* Model of {@link CreateSpeciesBatchUI}.
@@ -43,6 +46,8 @@
public static final String PROPERTY_SPECIES = "species";
+ public static final String PROPERTY_SORTED_UNSORTED_CATEGORY = "sortedUnsortedCategory";
+
public static final String PROPERTY_BATCH_WEIGHT = "batchWeight";
/**
@@ -60,12 +65,26 @@
protected Species species;
/**
+ * Sorted Unsorted category.
+ *
+ * @since 0.3
+ */
+ protected CaracteristicQualitativeValue sortedUnsortedCategory;
+
+ /**
* Incoming batch weight to split.
*
* @since 0.3
*/
protected Float batchWeight;
+ /**
+ * Already used species by sortedUnsorted category.
+ *
+ * @since 0.3
+ */
+ protected Multimap<CaracteristicQualitativeValue, Species> speciesUsed;
+
public CreateSpeciesBatchUIModel() {
super(CreateSpeciesBatchUIModel.class, null, null);
}
@@ -90,6 +109,16 @@
firePropertyChange(PROPERTY_SPECIES, oldSpecies, getSpecies());
}
+ public CaracteristicQualitativeValue getSortedUnsortedCategory() {
+ return sortedUnsortedCategory;
+ }
+
+ public void setSortedUnsortedCategory(CaracteristicQualitativeValue sortedUnsortedCategory) {
+ Object oldSpecies = getSortedUnsortedCategory();
+ this.sortedUnsortedCategory = sortedUnsortedCategory;
+ firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY, oldSpecies, sortedUnsortedCategory);
+ }
+
public Float getBatchWeight() {
return batchWeight;
}
@@ -100,4 +129,41 @@
firePropertyChange(PROPERTY_BATCH_WEIGHT, oldValue, batchWeight);
}
+ public void setSpeciesUsed(Multimap<CaracteristicQualitativeValue, Species> speciesUsed) {
+ this.speciesUsed = speciesUsed;
+ }
+
+ public Multimap<CaracteristicQualitativeValue, Species> getSpeciesUsed() {
+ return speciesUsed;
+ }
+
+ public boolean isSpeciesAndCategoryAvailable() {
+ boolean result = species != null && sortedUnsortedCategory != null &&
+ isSpeciesAndCategoryAvailable(species, sortedUnsortedCategory);
+ return result;
+ }
+
+ public boolean isSpeciesAndCategoryAvailable(Species species,
+ CaracteristicQualitativeValue sortedUnsortedCategory) {
+ boolean result = !speciesUsed.containsEntry(sortedUnsortedCategory, species);
+
+ if (result) {
+
+ // species - category still no used
+
+ Set<CaracteristicQualitativeValue> categories = speciesUsed.keySet();
+ result = categories.isEmpty();
+ for (CaracteristicQualitativeValue category : categories) {
+
+ if (!speciesUsed.containsEntry(category, species)) {
+
+ // ok found a category available
+ result = true;
+ break;
+ }
+ }
+
+ }
+ return result;
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel-error-validation.xml 2013-01-14 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIModel-error-validation.xml 2013-01-14 21:43:11 UTC (rev 197)
@@ -31,8 +31,31 @@
<message>tutti.validator.error.createSpeciesBatch.species.required
</message>
</field-validator>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ sortedUnsortedCategory == null || speciesAndCategoryAvailable ]]>
+ </param>
+ <message>
+ tutti.validator.error.createSpeciesBatch.speciesAndCategory.notAvailable
+ </message>
+ </field-validator>
</field>
+ <field name="sortedUnsortedCategory">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.createSpeciesBatch.sortedUnsortedCategory.required
+ </message>
+ </field-validator>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ species == null || speciesAndCategoryAvailable ]]>
+ </param>
+ <message>
+ tutti.validator.error.createSpeciesBatch.speciesAndCategory.notAvailable
+ </message>
+ </field-validator>
+ </field>
+
<field name="batchWeight">
<field-validator type="required" short-circuit="true">
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 18:25:01 UTC (rev 196)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-01-14 21:43:11 UTC (rev 197)
@@ -79,6 +79,7 @@
tutti.label.catches.speciesTotalWeight=Poids TOTAL (kg)
tutti.label.comment=Commentaire
tutti.label.createSpeciesBatch.batchWeight=Poids du lot
+tutti.label.createSpeciesBatch.sortedUnsortedCategory=V / HV
tutti.label.createSpeciesBatch.species=Espèce du lot
tutti.label.cruise=Campagne
tutti.label.cruise.beginDate=Date de début
@@ -277,7 +278,9 @@
tutti.tooltip.comment.none=Pas de commentaire
tutti.validator.error.createSpeciesBatch.batchWeight.invalidValue=Le poids du lot doit être strictement positif
tutti.validator.error.createSpeciesBatch.batchWeight.required=Le poids du lot est obligatoire
+tutti.validator.error.createSpeciesBatch.sortedUnsortedCategory.required=LA catégorie Vrac / Hors Vrac est obligatoire
tutti.validator.error.createSpeciesBatch.species.required=L'espèce est obligatoire
+tutti.validator.error.createSpeciesBatch.speciesAndCategory.notAvailable=Couple (espèce - Vrac/Hors Vrac) déjà utilisée
tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire
tutti.validator.error.cruise.country.required=Le pays est obligatoire
tutti.validator.error.cruise.endDate.required=La date de fin est obligatoire
1
0
Author: tchemit
Date: 2013-01-14 19:25:01 +0100 (Mon, 14 Jan 2013)
New Revision: 196
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/196
Log:
updates to stable adagio version
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-14 17:46:19 UTC (rev 195)
+++ trunk/pom.xml 2013-01-14 18:25:01 UTC (rev 196)
@@ -136,7 +136,7 @@
<slf4jVersion>1.7.2</slf4jVersion>
- <adagioVersion>3.3.1-SNAPSHOT</adagioVersion>
+ <adagioVersion>3.3.1-rev-401</adagioVersion>
<msaccessImporterVersion>1.4.1</msaccessImporterVersion>
1
0
r195 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing: environment gearshooting hydrology
by kmorin@users.forge.codelutin.com 14 Jan '13
by kmorin@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: kmorin
Date: 2013-01-14 18:46:19 +0100 (Mon, 14 Jan 2013)
New Revision: 195
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/195
Log:
debug NPE
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2013-01-14 17:40:34 UTC (rev 194)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2013-01-14 17:46:19 UTC (rev 195)
@@ -230,9 +230,11 @@
TuttiProtocol protocol = ui.getContextValue(TuttiProtocol.class);
List<String> environmentPmfmIds = Lists.newArrayList();
- List<String> protocolEnvironmentPmfmId = protocol.getEnvironmentPmfmId();
- if (protocol != null && protocolEnvironmentPmfmId != null) {
- environmentPmfmIds.addAll(protocolEnvironmentPmfmId);
+ if (protocol != null) {
+ List<String> protocolEnvironmentPmfmId = protocol.getEnvironmentPmfmId();
+ if (protocolEnvironmentPmfmId != null) {
+ environmentPmfmIds.addAll(protocolEnvironmentPmfmId);
+ }
}
List<EnvironmentRowModel> rows = Lists.newArrayList();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2013-01-14 17:40:34 UTC (rev 194)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2013-01-14 17:46:19 UTC (rev 195)
@@ -233,9 +233,11 @@
TuttiProtocol protocol = ui.getContextValue(TuttiProtocol.class);
List<String> gearPmfmIds = Lists.newArrayList();
- List<String> protocolGearPmfmId = protocol.getGearPmfmId();
- if (protocol != null && protocolGearPmfmId != null) {
- gearPmfmIds.addAll(protocolGearPmfmId);
+ if (protocol != null) {
+ List<String> protocolGearPmfmId = protocol.getGearPmfmId();
+ if (protocolGearPmfmId != null) {
+ gearPmfmIds.addAll(protocolGearPmfmId);
+ }
}
List<GearShootingRowModel> rows = Lists.newArrayList();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2013-01-14 17:40:34 UTC (rev 194)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2013-01-14 17:46:19 UTC (rev 195)
@@ -286,7 +286,10 @@
TuttiProtocol protocol = ui.getContextValue(TuttiProtocol.class);
List<String> gearPmfmIds = Lists.newArrayList();
if (protocol != null) {
- gearPmfmIds.addAll(protocol.getHydrologyPmfmId());
+ List<String> protocolHydrologyPmfmId = protocol.getHydrologyPmfmId();
+ if (protocolHydrologyPmfmId != null) {
+ gearPmfmIds.addAll(protocolHydrologyPmfmId);
+ }
}
List<HydrologyRowModel> rows = Lists.newArrayList();
1
0
r194 - in trunk: 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-service/src/main/java/fr/ifremer/tutti/service tutti-service/src/main/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 18:40:34 +0100 (Mon, 14 Jan 2013)
New Revision: 194
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/194
Log:
fix decorator of referentiel
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/CruisePersistenceServiceTest.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
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 16:35:12 UTC (rev 193)
+++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-01-14 17:40:34 UTC (rev 194)
@@ -24,7 +24,6 @@
* #L%
*/
-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.TaxonNameExtendDao;
@@ -90,8 +89,8 @@
Object[] source = list.next();
Zone target = new Zone();
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);
}
@@ -423,29 +422,6 @@
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected void loadCaracteristicQualitativeValues(Caracteristic caracteristic,
- Integer pmfmId) {
- Preconditions.checkNotNull(caracteristic, "Caracteristic can not be null");
- Preconditions.checkNotNull(pmfmId, "pmfmId can not be null");
- Preconditions.checkArgument(caracteristic.isQualitativeType(),
- "Caracteristic must be a qualitativeValue type");
-
- Iterator<Object[]> sources = queryListWithStatus(
- "pmfmQualitativeValues",
- "pmfmId", IntegerType.INSTANCE, pmfmId);
-
- List<CaracteristicQualitativeValue> values = Lists.newArrayList();
- while (sources.hasNext()) {
- Object[] source = sources.next();
- CaracteristicQualitativeValue target = new CaracteristicQualitativeValue();
- target.setId(String.valueOf(source[0]));
- target.setName(String.valueOf(source[1]));
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[2], target);
- values.add(target);
- }
- caracteristic.setQualitativeValue(values);
- }
-
protected Caracteristic loadCaracteristic(Integer pmfmId) {
Object[] source = queryUniqueWithStatus("pmfmById",
@@ -453,38 +429,52 @@
"unitIdNone", IntegerType.INSTANCE, enumeration.UNIT_ID_NONE);
Caracteristic target = loadCaracteristic(source);
-
- if (target.isQualitativeType()) {
-
- // load qualititative values
- loadCaracteristicQualitativeValues(target, pmfmId);
- }
return target;
}
protected Caracteristic loadCaracteristic(Object[] source) {
- Caracteristic target = new Caracteristic();
- target.setId(String.valueOf(source[0]));
- target.setParameterName((String) source[1]);
- target.setMatrixName((String) source[2]);
- target.setFractionName((String) source[3]);
- target.setMethodName((String) source[4]);
- target.setNumberType((Boolean) source[5]);
- target.setQualitativeType((Boolean) source[6]);
- target.setSignifFiguresNumber((Integer) source[7]);
- target.setMaximumNumberDecimals((Integer) source[8]);
- target.setPrecision((Float) source[9]);
- target.setUnit((String) source[10]);
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[11], target);
- return target;
+ Integer pmfmId = (Integer) source[0];
+
+ Caracteristic result = new Caracteristic();
+ result.setId(pmfmId.toString());
+ result.setParameterName((String) source[1]);
+ result.setMatrixName((String) source[2]);
+ result.setFractionName((String) source[3]);
+ result.setMethodName((String) source[4]);
+ result.setNumberType((Boolean) source[5]);
+ result.setQualitativeType((Boolean) source[6]);
+ result.setSignifFiguresNumber((Integer) source[7]);
+ result.setMaximumNumberDecimals((Integer) source[8]);
+ result.setPrecision((Float) source[9]);
+ result.setUnit((String) source[10]);
+ setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[11], result);
+
+ if (result.isQualitativeType()) {
+
+ Iterator<Object[]> sources = queryListWithStatus(
+ "pmfmQualitativeValues",
+ "pmfmId", IntegerType.INSTANCE, pmfmId);
+
+ List<CaracteristicQualitativeValue> values = Lists.newArrayList();
+ while (sources.hasNext()) {
+ Object[] source2 = sources.next();
+ CaracteristicQualitativeValue target2 = new CaracteristicQualitativeValue();
+ target2.setId(String.valueOf(source2[0]));
+ target2.setName(String.valueOf(source2[1]));
+ setStatus((fr.ifremer.adagio.core.dao.referential.Status) source2[2], target2);
+ values.add(target2);
+ }
+ result.setQualitativeValue(values);
+ }
+ return result;
}
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.setLabel((String) source[1]);
+ target.setName((String) source[2]);
// target.setDescription((String)source[3]);
target.setLocationLevel((Integer) source[3]);
@@ -525,8 +515,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.setLabel((String) source[1]);
+ result.setName((String) source[2]);
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], result);
return result;
}
@@ -534,8 +524,8 @@
protected Iterator<Object[]> queryListWithStatus(String queryName,
Object... params) {
Query query = createQuery(queryName, params);
- query.setString("statusValidCode", enumeration.STATUS_VALID_CODE.toString());
- query.setString("statusTemporaryCode", enumeration.STATUS_TEMPORARY_CODE.toString());
+ query.setString("statusValidCode", enumeration.STATUS_VALID_CODE);
+ query.setString("statusTemporaryCode", enumeration.STATUS_TEMPORARY_CODE);
Iterator result = query.iterate();
return result;
@@ -544,8 +534,8 @@
protected Object[] queryUniqueWithStatus(String queryName, Object... params) {
Query query = createQuery(queryName, params);
- query.setString("statusValidCode", enumeration.STATUS_VALID_CODE.toString());
- query.setString("statusTemporaryCode", enumeration.STATUS_TEMPORARY_CODE.toString());
+ query.setString("statusValidCode", enumeration.STATUS_VALID_CODE);
+ query.setString("statusTemporaryCode", enumeration.STATUS_TEMPORARY_CODE);
Object result = query.uniqueResult();
return (Object[]) result;
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 16:35:12 UTC (rev 193)
+++ trunk/tutti-persistence-adagio/src/main/resources/queries-override.hbm.xml 2013-01-14 17:40:34 UTC (rev 194)
@@ -279,6 +279,8 @@
AND l.status.code IN (:statusValidCode, :statusTemporaryCode)
]]>
<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>
<!-- [REF-02] Get all countries -->
@@ -295,6 +297,8 @@
AND l.status.code IN (:statusValidCode, :statusTemporaryCode)
]]>
<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>
<!-- [REF-03] et [REF-04] Get all vessel for a given vesselType -->
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 16:35:12 UTC (rev 193)
+++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceTest.java 2013-01-14 17:40:34 UTC (rev 194)
@@ -89,6 +89,7 @@
Assert.assertNotNull(result);
}
+ @Ignore
@Test
public void createCruise(/*Cruise bean*/) {
String programCode = dbResource.getFixtures().programCode();
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2013-01-14 16:35:12 UTC (rev 193)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2013-01-14 17:40:34 UTC (rev 194)
@@ -103,18 +103,18 @@
registerMultiJXPathDecorator(Cruise.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(TuttiProtocol.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${date}$td/%3$tm/%3$tY", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Zone.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Vessel.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Country.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Gear.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Person.class, "${firstName}$s#${lastName}$s", SEPARATOR, " ");
- registerMultiJXPathDecorator(FishingOperationLocation.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Caracteristic.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Caracteristic.class, CARACTERISTIC_WITH_UNIT, "${name}$s (${unit}$s)", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Zone.class, "${label}$s#${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Vessel.class, "${name}$s#${internalRegistrationCode}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Country.class, "${label}$s#${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Gear.class, "${label}$s#${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Person.class, "${firstName}$s#${lastName}$s#${department}$s", SEPARATOR, " ");
+ registerMultiJXPathDecorator(FishingOperationLocation.class, "${label}$s#${name}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Caracteristic.class, "${parameterName}$s#${matrixName}$s#${fractionName}$s#${methodName}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Caracteristic.class, CARACTERISTIC_WITH_UNIT, "${parameterName}$s#${matrixName}$s#${fractionName}$s#${methodName}$s (${unit}$s)", SEPARATOR, " - ");
registerMultiJXPathDecorator(CaracteristicQualitativeValue.class, "${name}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Species.class, "${codeMemo}$s#${genusSpecies}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Species.class, "${codeMemo}$s#${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(Species.class, SPECIES_BY_CODE, "${codeMemo}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Species.class, SPECIES_BY_GENUS, "${genusSpecies}$s", SEPARATOR, " - ");
+ registerMultiJXPathDecorator(Species.class, SPECIES_BY_GENUS, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(SpeciesProtocol.class, "${speciesId}", SEPARATOR, " - ");
registerMultiJXPathDecorator(Attachment.class, "${name}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(LabelAware.class, "${label}$s", SEPARATOR, " - ");
@@ -132,12 +132,19 @@
static {
n_("tutti.property.protocol");
+ n_("tutti.property.label");
n_("tutti.property.name");
n_("tutti.property.firstName");
n_("tutti.property.lastName");
+ n_("tutti.property.department");
n_("tutti.property.stationNumber");
+ n_("tutti.property.internalRegistrationCode");
n_("tutti.property.date");
n_("tutti.property.program");
+ n_("tutti.property.parameterName");
+ n_("tutti.property.matrixName");
+ n_("tutti.property.fractionName");
+ n_("tutti.property.methodName");
n_("tutti.property.cruise");
n_("tutti.property.fishingOperation");
n_("tutti.property.zone");
Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-01-14 16:35:12 UTC (rev 193)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-01-14 17:40:34 UTC (rev 194)
@@ -8,13 +8,20 @@
tutti.property.country=Pays
tutti.property.cruise=Campagne
tutti.property.date=Date
+tutti.property.department=Département
tutti.property.firstName=Prénom
tutti.property.fishingOperation=Trait
+tutti.property.fractionName=Fraction
tutti.property.gear=Engin
tutti.property.genusSpecies=Nom scientifique
+tutti.property.internalRegistrationCode=Immatriculation internationale
+tutti.property.label=Code
tutti.property.lastName=Nom de Famille
tutti.property.macroWasteCategory=Type de macro déchet
+tutti.property.matrixName=Support
+tutti.property.methodName=Méthode
tutti.property.name=Nom
+tutti.property.parameterName=Paramètre
tutti.property.program=Série de campagne
tutti.property.protocol=Protocol de saisie
tutti.property.sortedUnsortedCategory=Vrac / Hors Vrac
1
0
r193 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting java/fr/ifremer/tutti/ui/swing/content/protocol java/fr/ifremer/tutti/ui/swing/util resources/i18n
by kmorin@users.forge.codelutin.com 14 Jan '13
by kmorin@users.forge.codelutin.com 14 Jan '13
14 Jan '13
Author: kmorin
Date: 2013-01-14 17:35:12 +0100 (Mon, 14 Jan 2013)
New Revision: 193
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/193
Log:
* [PROTOCOL] add columns to species
* [FISHING OPERATION] check model validity before saving on operation change
* [FISHING OPERATION] save on tab change (not only edit fishing operation tab change)
* [FISHING OPERATION] update combo when data change
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.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/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -41,7 +41,9 @@
import fr.ifremer.tutti.ui.swing.content.operation.fishing.gearshooting.GearShootingTabUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUI;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.hydrology.HydrologyTabUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
import fr.ifremer.tutti.ui.swing.util.CustomTab;
+import fr.ifremer.tutti.ui.swing.util.TabHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
@@ -63,7 +65,8 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class EditFishingOperationUIHandler extends AbstractTuttiUIHandler<EditFishingOperationUIModel> {
+public class EditFishingOperationUIHandler extends AbstractTuttiTabContainerUIHandler<EditFishingOperationUIModel>
+ implements TabHandler {
/** Logger. */
private static final Log log =
@@ -251,36 +254,6 @@
hydrologyModel.setAvailableCaracteristics(persistenceService.getAllFishingOperationHydrologicCaracteristic());
tabPanel.setTabComponentAt(3, new CustomTab(hydrologyModel));
- tabPanel.setModel(new DefaultSingleSelectionModel() {
-
- @Override
- public void setSelectedIndex(int index) {
- int currentIndex = tabPanel.getSelectedIndex();
- boolean mustSelectIndex = true;
-
- if (currentIndex >= 0) {
- CustomTab currentTab = (CustomTab) tabPanel.getTabComponentAt(currentIndex);
- AbstractTuttiBeanUIModel model = currentTab.getModel();
-
- if (TuttiUIContext.VALIDATION_CONTEXT_EDIT.equals(getModel().getValidationContext())
- || model.isValid()) {
- if (!model.isCreate() && model.isModify()) {
- save();
- }
- super.setSelectedIndex(index);
-
- } else {
- mustSelectIndex = false;
- }
- }
-
- if (mustSelectIndex) {
- super.setSelectedIndex(index);
- }
- }
-
- });
-
MainUI main = ui.getContextValue(MainUI.class, MainUI.class.getName());
main.clearValidators();
main.registerValidator(ui.getValidator());
@@ -303,6 +276,43 @@
}
@Override
+ protected JTabbedPane getTabPanel() {
+ return ui.getFishingOperationTabPane();
+ }
+
+ @Override
+ protected boolean onTabChanged(int currentIndex, int newIndex) {
+ boolean result = super.onTabChanged(currentIndex, newIndex);
+ if (result && currentIndex != newIndex && currentIndex >= 0) {
+ CustomTab currentTab = (CustomTab) getTabPanel().getTabComponentAt(currentIndex);
+ AbstractTuttiBeanUIModel model = currentTab.getModel();
+ result = TuttiUIContext.VALIDATION_CONTEXT_EDIT.equals(getModel().getValidationContext())
+ || model.isValid();
+
+ if (result && !model.isCreate() && model.isModify()) {
+ save();
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean onHideTab() {
+ AbstractTuttiBeanUIModel model = getModel();
+ boolean result = TuttiUIContext.VALIDATION_CONTEXT_EDIT.equals(getModel().getValidationContext())
+ || model.isValid();
+ if (result && !model.isCreate() && model.isModify()) {
+ save();
+ }
+ return result;
+ }
+
+ @Override
+ public void onShowTab() {
+ log.info("show tab");
+ }
+
+ @Override
protected EditFishingOperationUIModel getModel() {
return ui.getModel();
}
@@ -399,7 +409,7 @@
if (log.isWarnEnabled()) {
log.warn("Won't save new fishing operation, use explicit save button instead...");
}
- } else {
+ } else if (beanToSave.isValid()) {
if (beanToSave.isUseSexagecimalFormat()) {
beanToSave.convertGearShootingCoordinatesDMSToDD();
}
@@ -525,4 +535,5 @@
ui.getLocationComboBox().setData(location);
}
}
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -33,6 +33,8 @@
import fr.ifremer.tutti.ui.swing.MainUI;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TabHandler;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -42,6 +44,8 @@
import java.beans.PropertyChangeListener;
import java.util.Date;
import java.util.List;
+import javax.swing.DefaultSingleSelectionModel;
+import javax.swing.JTabbedPane;
import static org.nuiton.i18n.I18n._;
@@ -51,7 +55,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
+public class FishingOperationsUIHandler extends AbstractTuttiTabContainerUIHandler<FishingOperationsUIModel> {
/** Logger. */
private static final Log log =
@@ -166,6 +170,11 @@
protected FishingOperationsUIModel getModel() {
return ui.getModel();
}
+
+ @Override
+ protected JTabbedPane getTabPanel() {
+ return ui.getTabPane();
+ }
public void createNewFishingOperation() {
@@ -238,6 +247,7 @@
if (create) {
savedFishingOperation = persistenceService.createFishingOperation(toSave);
model.addFishingOperation(savedFishingOperation);
+ model.setSelectedFishingOperation(savedFishingOperation);
} else {
savedFishingOperation = persistenceService.saveFishingOperation(toSave);
@@ -247,16 +257,7 @@
FishingOperation existingFishingOperation =
TuttiEntities.findById(data, savedFishingOperation.getId());
- if (existingFishingOperation != null) {
- data.remove(existingFishingOperation);
- }
- data.add(savedFishingOperation);
-
- // update model fishingOperation list
- model.setFishingOperation(data);
+ model.updateFishingOperation(existingFishingOperation, savedFishingOperation);
}
-
- // update model selected fishingOperation
- model.setSelectedFishingOperation(savedFishingOperation);
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -72,6 +72,24 @@
firePropertyChange(PROPERTY_FISHING_OPERATION, oldValue, this.fishingOperation);
}
+ public void removeFishingOperation(FishingOperation fishingOperation) {
+ Object oldValue = Lists.newArrayList(getFishingOperation());
+ this.fishingOperation.remove(fishingOperation);
+ firePropertyChange(PROPERTY_FISHING_OPERATION, oldValue, this.fishingOperation);
+ }
+
+ public void updateFishingOperation(FishingOperation oldFishingOperation,
+ FishingOperation newFishingOperation) {
+ int oldFishingOperationIndex = fishingOperation.indexOf(oldFishingOperation);
+ fishingOperation.remove(oldFishingOperation);
+ if (oldFishingOperationIndex >= 0) {
+ fishingOperation.add(oldFishingOperationIndex, newFishingOperation);
+ } else {
+ fishingOperation.add(newFishingOperation);
+ }
+ firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation);
+ }
+
public FishingOperation getSelectedFishingOperation() {
return selectedFishingOperation;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -230,8 +230,9 @@
TuttiProtocol protocol = ui.getContextValue(TuttiProtocol.class);
List<String> environmentPmfmIds = Lists.newArrayList();
- if (protocol != null) {
- environmentPmfmIds.addAll(protocol.getEnvironmentPmfmId());
+ List<String> protocolEnvironmentPmfmId = protocol.getEnvironmentPmfmId();
+ if (protocol != null && protocolEnvironmentPmfmId != null) {
+ environmentPmfmIds.addAll(protocolEnvironmentPmfmId);
}
List<EnvironmentRowModel> rows = Lists.newArrayList();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -233,8 +233,9 @@
TuttiProtocol protocol = ui.getContextValue(TuttiProtocol.class);
List<String> gearPmfmIds = Lists.newArrayList();
- if (protocol != null) {
- gearPmfmIds.addAll(protocol.getGearPmfmId());
+ List<String> protocolGearPmfmId = protocol.getGearPmfmId();
+ if (protocol != null && protocolGearPmfmId != null) {
+ gearPmfmIds.addAll(protocolGearPmfmId);
}
List<GearShootingRowModel> rows = Lists.newArrayList();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -38,7 +38,7 @@
public class EditProtocolSpeciesRowModel extends AbstractTuttiBeanUIModel<SpeciesProtocol, EditProtocolSpeciesRowModel> {
private static final long serialVersionUID = 1L;
-
+
public static final String PROPERTY_SPECIES = "species";
public static final String PROPERTY_SIZE_ENABLED = "sizeEnabled";
@@ -51,8 +51,12 @@
public static final String PROPERTY_LENGTH_STEP_PMFM = "lengthStepPmfm";
- public static final String PROPERTY_SORTED_UNSORTED = "sortedUnsorted";
+ public static final String PROPERTY_WEIGHT_ENABLED = "weightEnabled";
+ public static final String PROPERTY_COUNT_IF_NO_FREQUENCY_ENABLED = "countIfNoFrequencyEnabled";
+
+ public static final String PROPERTY_CALCIFY_SAMPLE_ENABLED = "calcifySampleEnabled";
+
protected Species species;
protected boolean sizeEnabled;
@@ -63,10 +67,14 @@
protected boolean ageEnabled;
- protected boolean sortedUnsorted;
-
protected Caracteristic lengthStepPmfm;
+ protected boolean weightEnabled;
+
+ protected boolean countIfNoFrequencyEnabled;
+
+ protected boolean calcifySampleEnabled;
+
protected static final Binder<SpeciesProtocol, EditProtocolSpeciesRowModel> fromBeanBinder =
BinderFactory.newBinder(SpeciesProtocol.class,
EditProtocolSpeciesRowModel.class);
@@ -133,16 +141,6 @@
firePropertyChange(PROPERTY_AGE_ENABLED, oldValue, ageEnabled);
}
- public boolean isSortedUnsorted() {
- return sortedUnsorted;
- }
-
- public void setSortedUnsorted(boolean sortedUnsorted) {
- Object oldValue = isSortedUnsorted();
- this.sortedUnsorted = sortedUnsorted;
- firePropertyChange(PROPERTY_SORTED_UNSORTED, oldValue, sortedUnsorted);
- }
-
public String getLengthStepPmfmId() {
return lengthStepPmfm != null ? lengthStepPmfm.getId() : null;
}
@@ -156,4 +154,35 @@
this.lengthStepPmfm = lengthStepPmfm;
firePropertyChange(PROPERTY_LENGTH_STEP_PMFM, oldValue, lengthStepPmfm);
}
+
+ public boolean isWeightEnabled() {
+ return weightEnabled;
+ }
+
+ public void setWeightEnabled(boolean weightEnabled) {
+ Object oldValue = isWeightEnabled();
+ this.weightEnabled = weightEnabled;
+ firePropertyChange(PROPERTY_WEIGHT_ENABLED, oldValue, weightEnabled);
+ }
+
+ public boolean isCountIfNoFrequencyEnabled() {
+ return countIfNoFrequencyEnabled;
+ }
+
+ public void setCountIfNoFrequencyEnabled(boolean countIfNoFrequencyEnabled) {
+ Object oldValue = isCountIfNoFrequencyEnabled();
+ this.countIfNoFrequencyEnabled = countIfNoFrequencyEnabled;
+ firePropertyChange(PROPERTY_COUNT_IF_NO_FREQUENCY_ENABLED, oldValue, countIfNoFrequencyEnabled);
+ }
+
+ public boolean isCalcifySampleEnabled() {
+ return calcifySampleEnabled;
+ }
+
+ public void setCalcifySampleEnabled(boolean calcifySampleEnabled) {
+ Object oldValue = isCalcifySampleEnabled();
+ this.calcifySampleEnabled = calcifySampleEnabled;
+ firePropertyChange(PROPERTY_CALCIFY_SAMPLE_ENABLED, oldValue, calcifySampleEnabled);
+ }
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -67,10 +67,21 @@
n_("tutti.table.protocol.species.header.lengthStep"),
n_("tutti.table.protocol.species.header.lengthStep"));
- public static final ColumnIdentifier<EditProtocolSpeciesRowModel> SORTED_UNSORTED = ColumnIdentifier.newId(
- EditProtocolSpeciesRowModel.PROPERTY_SORTED_UNSORTED,
- n_("tutti.table.protocol.species.header.sortedUnsorted"),
- n_("tutti.table.protocol.species.header.sortedUnsorted"));
+ public static final ColumnIdentifier<EditProtocolSpeciesRowModel> WEIGHT_ENABLED = ColumnIdentifier.newId(
+ EditProtocolSpeciesRowModel.PROPERTY_WEIGHT_ENABLED,
+ n_("tutti.table.protocol.species.header.weight"),
+ n_("tutti.table.protocol.species.header.weight"));
+
+ public static final ColumnIdentifier<EditProtocolSpeciesRowModel> COUNT_IF_NO_FREQUENCY_ENABLED = ColumnIdentifier.newId(
+ EditProtocolSpeciesRowModel.PROPERTY_COUNT_IF_NO_FREQUENCY_ENABLED,
+ n_("tutti.table.protocol.species.header.countIfNoFrequency"),
+ n_("tutti.table.protocol.species.header.countIfNoFrequency"));
+
+ public static final ColumnIdentifier<EditProtocolSpeciesRowModel> CALCIFY_SAMPLE_ENABLED = ColumnIdentifier.newId(
+ EditProtocolSpeciesRowModel.PROPERTY_CALCIFY_SAMPLE_ENABLED,
+ n_("tutti.table.protocol.species.header.calcifySample"),
+ n_("tutti.table.protocol.species.header.calcifySample"));
+
private static final long serialVersionUID = 1L;
@@ -87,6 +98,9 @@
result.setSizeEnabled(true);
result.setSexEnabled(true);
result.setAgeEnabled(true);
+ result.setWeightEnabled(true);
+ result.setCountIfNoFrequencyEnabled(true);
+ result.setCalcifySampleEnabled(true);
result.setValid(false);
return result;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -54,8 +54,6 @@
import javax.swing.table.TableColumnModel;
import jaxx.runtime.swing.editor.bean.BeanDoubleList;
import jaxx.runtime.validator.swing.SwingValidator;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -104,7 +102,9 @@
columToSampleCategory.put(EditProtocolSpeciesTableModel.SEX_ENABLED, SampleCategoryEnum.sex);
columToSampleCategory.put(EditProtocolSpeciesTableModel.MATURITY_ENABLED, SampleCategoryEnum.maturity);
columToSampleCategory.put(EditProtocolSpeciesTableModel.AGE_ENABLED, SampleCategoryEnum.age);
- columToSampleCategory.put(EditProtocolSpeciesTableModel.SORTED_UNSORTED, SampleCategoryEnum.sortedUnsorted);
+ columToSampleCategory.put(EditProtocolSpeciesTableModel.WEIGHT_ENABLED, SampleCategoryEnum.weight);
+ columToSampleCategory.put(EditProtocolSpeciesTableModel.COUNT_IF_NO_FREQUENCY_ENABLED, SampleCategoryEnum.countIfNoFrequency);
+ columToSampleCategory.put(EditProtocolSpeciesTableModel.CALCIFY_SAMPLE_ENABLED, SampleCategoryEnum.calcifySample);
}
//------------------------------------------------------------------------//
@@ -248,7 +248,9 @@
for (SampleCategoryEnum sampleOrder : model.getSampleCategoryOrder()) {
ColumnIdentifier<EditProtocolSpeciesRowModel> columnIdentifier = sampleCategoryToColumn.get(sampleOrder);
- addBooleanColumnToModel(columnModel, columnIdentifier, table);
+ if (columnIdentifier != null) {
+ addBooleanColumnToModel(columnModel, columnIdentifier, table);
+ }
}
columnModel.addColumnModelListener(new TableColumnModelListener() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-01-14 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -72,7 +72,10 @@
SampleCategoryEnum.size,
SampleCategoryEnum.sex,
SampleCategoryEnum.maturity,
- SampleCategoryEnum.age);
+ SampleCategoryEnum.age,
+ SampleCategoryEnum.weight,
+ SampleCategoryEnum.countIfNoFrequency,
+ SampleCategoryEnum.calcifySample);
/**
* Can user remove a selected species?
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -0,0 +1,74 @@
+
+package fr.ifremer.tutti.ui.swing.util;
+
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import java.awt.Component;
+import javax.swing.DefaultSingleSelectionModel;
+import javax.swing.JTabbedPane;
+
+/**
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 0.3
+ */
+public abstract class AbstractTuttiTabContainerUIHandler<M> extends AbstractTuttiUIHandler<M> {
+
+ protected AbstractTuttiTabContainerUIHandler(TuttiUIContext context) {
+ super(context);
+ }
+
+ protected abstract JTabbedPane getTabPanel();
+
+ protected boolean onTabChanged(int currentIndex, int newIndex) {
+ boolean result = true;
+ if (currentIndex != newIndex) {
+ TabHandler handler = getTabHandler(currentIndex);
+ if (handler != null) {
+ result = handler.onHideTab();
+ }
+
+ handler = getTabHandler(newIndex);
+ if (handler != null) {
+ handler.onShowTab();
+ }
+ }
+ return result;
+ }
+
+ protected TabHandler getTabHandler(int index) {
+ TabHandler tabHandler = null;
+ JTabbedPane tabPanel = getTabPanel();
+ if (index >= 0 && index < tabPanel.getTabCount()) {
+ Component tab = tabPanel.getComponentAt(index);
+ if (TuttiUI.class.isInstance(tab)) {
+ TuttiUI tuttiTab = (TuttiUI) tabPanel.getComponentAt(index);
+ AbstractTuttiUIHandler handler = tuttiTab.getHandler();
+ if (TabHandler.class.isInstance(handler)) {
+ tabHandler = (TabHandler) handler;
+ }
+ }
+ }
+ return tabHandler;
+ }
+
+ protected void initUI(TuttiUI ui) {
+ super.initUI(ui);
+
+ final JTabbedPane tabPanel = getTabPanel();
+ tabPanel.setModel(new DefaultSingleSelectionModel() {
+
+ @Override
+ public void setSelectedIndex(int index) {
+ int currentIndex = tabPanel.getSelectedIndex();
+ boolean mustChangeTab = onTabChanged(currentIndex, index);
+
+ if (mustChangeTab) {
+ super.setSelectedIndex(index);
+ }
+ }
+
+ });
+ }
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java 2013-01-14 16:35:12 UTC (rev 193)
@@ -0,0 +1,14 @@
+
+package fr.ifremer.tutti.ui.swing.util;
+
+/**
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 0.3
+ */
+public interface TabHandler {
+
+ boolean onHideTab();
+
+ void onShowTab();
+}
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 16:21:51 UTC (rev 192)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-01-14 16:35:12 UTC (rev 193)
@@ -224,12 +224,14 @@
tutti.table.plankton.batch.header.toConfirm=A Confirmer
tutti.table.plankton.batch.header.weight=Poids
tutti.table.protocol.species.header.age=Age
-tutti.table.protocol.species.header.lengthStep=Classe de Taille
+tutti.table.protocol.species.header.calcifySample=Prélèvement de pièces calcifiées
+tutti.table.protocol.species.header.countIfNoFrequency=Dénombrement
+tutti.table.protocol.species.header.lengthStep=Classe de Taille
tutti.table.protocol.species.header.maturity=Maturité
tutti.table.protocol.species.header.sex=Sexe
tutti.table.protocol.species.header.size=Catégorie Tri
-tutti.table.protocol.species.header.sortedUnsorted=Vrac / Hors Vrac
tutti.table.protocol.species.header.speciesId=Espèce
+tutti.table.protocol.species.header.weight=Pesée
tutti.table.species.batch.header.ageCategory=Age
tutti.table.species.batch.header.comment=Commentaire
tutti.table.species.batch.header.computedNumber=Nombre
1
0
14 Jan '13
Author: kmorin
Date: 2013-01-14 17:21:51 +0100 (Mon, 14 Jan 2013)
New Revision: 192
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/192
Log:
add SampleCategories
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
1
0
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