r260 - in trunk: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service tutti-service/src/main/java/fr/ifremer/tutti/service
Author: tchemit Date: 2013-01-30 10:10:09 +0100 (Wed, 30 Jan 2013) New Revision: 260 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/260 Log: add CatchBatchPersistenceService Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImplTest.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceService.java Modified: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.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-30 08:41:21 UTC (rev 259) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-01-30 09:10:09 UTC (rev 260) @@ -26,6 +26,7 @@ import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch; import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.CatchBatch; import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch; @@ -86,11 +87,38 @@ */ List<Country> getAllCountry(); + /** + * Get the list of location of type strata that match the given zone id. + * + * @param zoneId id of the parent zone (can not be null) + * @return the stratas with given zone id as location parent + * @since 1.0 + */ List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId); - List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId, String startaId); + /** + * Get the list of location of type substra that match the given zone id or + * if not null the given strata id. + * + * @param zoneId id of the parent zone (can not be null) + * @param strataId id of the optional parent strata + * @return the list of localite with given zone id as location parent / or strata + * @since 1.0 + */ + List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId, String strataId); - List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId, String startaId, String subStrataId); + /** + * Get the list of location of type substra that match the given zone id or + * if not null the given strata id or if not null the given substrata id if + * not null. + * + * @param zoneId id of the parent zone (can not be null) + * @param strataId id of the optional parent strata + * @param subStrataId id of the optional parent subStrata + * @return the list of localite with given zone id as location parent / or strata or substrata + * @since 1.0 + */ + List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId); /** * @return all scientific vessels (used by a {@link Cruise}). @@ -112,14 +140,12 @@ Species getSpecies(String speciesId); - List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic(); + /** + * @return all caracteristics of the system. + * @since 1.0 + */ + List<Caracteristic> getAllCaracteristic(); - List<Caracteristic> getAllFishingOperationGearCaracteristic(); - - List<Caracteristic> getAllFishingOperationHydrologicCaracteristic(); - - List<Caracteristic> getAllSpeciesLengthStepCaracteristic(); - Caracteristic getSizeCategoryCaracteristic(); Caracteristic getSexCaracteristic(); @@ -203,6 +229,36 @@ FishingOperation saveFishingOperation(FishingOperation bean); //------------------------------------------------------------------------// + //-- CatchBatch methods --// + //------------------------------------------------------------------------// + + /** + * Get the catchBatch from the fishing Operation id. + * + * @param id id of the fihsing operation + * @return found catchbatch + */ + CatchBatch getCatchBatchFromFishingOperation(String id); + + /** + * Create the given CatchBatch and return it. + * + * @param bean catchBatch to create + * @return created catchBatch + */ + @Transactional(readOnly = false) + CatchBatch createCatchBatch(CatchBatch bean); + + /** + * Save the given catchBatch and return it. + * + * @param bean batch to save + * @return the saved catchBatch + */ + @Transactional(readOnly = false) + CatchBatch saveCatchBatch(CatchBatch bean); + + //------------------------------------------------------------------------// //-- Species Batch methods --// //------------------------------------------------------------------------// Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceService.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceService.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceService.java 2013-01-30 09:10:09 UTC (rev 260) @@ -0,0 +1,64 @@ +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.CatchBatch; +import org.springframework.transaction.annotation.Transactional; + +/** + * CRUD of {@link CatchBatch} entity. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +@Transactional(readOnly = true) +public interface CatchBatchPersistenceService { + + /** + * Get the catchBatch from the fishing Operation id. + * + * @param id id of the fihsing operation + * @return found catchbatch + */ + CatchBatch getCatchBatchFromFishingOperation(String id); + + /** + * Create the given CatchBatch and return it. + * + * @param bean catchBatch to create + * @return created catchBatch + */ + @Transactional(readOnly = false) + CatchBatch createCatchBatch(CatchBatch bean); + + /** + * Save the given catchBatch and return it. + * + * @param bean batch to save + * @return the saved catchBatch + */ + @Transactional(readOnly = false) + CatchBatch saveCatchBatch(CatchBatch bean); +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java =================================================================== --- trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java (rev 0) +++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-01-30 09:10:09 UTC (rev 260) @@ -0,0 +1,57 @@ +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.CatchBatch; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.stereotype.Service; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +@Service("catchBatchPersistenceService") +public class CatchBatchPersistenceServiceImpl extends AbstractPersistenceService implements CatchBatchPersistenceService { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(CatchBatchPersistenceServiceImpl.class); + + @Override + public CatchBatch getCatchBatchFromFishingOperation(String id) { + return null; + } + + @Override + public CatchBatch createCatchBatch(CatchBatch bean) { + return null; + } + + @Override + public CatchBatch saveCatchBatch(CatchBatch bean) { + return null; + } +} Property changes on: trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL 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-30 08:41:21 UTC (rev 259) +++ trunk/tutti-persistence-adagio/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2013-01-30 09:10:09 UTC (rev 260) @@ -79,6 +79,11 @@ FishingOperationPersistenceService.class); } + public static CatchBatchPersistenceService getCatchBatchPersistenceService() { + return instance().getService("catchBatchPersistenceService", + CatchBatchPersistenceService.class); + } + public static SpeciesBatchPersistenceService getSpeciesBatchPersistenceService() { return instance().getService("speciesBatchPersistenceService", SpeciesBatchPersistenceService.class); Added: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImplTest.java =================================================================== --- trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImplTest.java (rev 0) +++ trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImplTest.java 2013-01-30 09:10:09 UTC (rev 260) @@ -0,0 +1,70 @@ +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.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class CatchBatchPersistenceServiceImplTest { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(CatchBatchPersistenceServiceImplTest.class); + + @ClassRule + public static final DatabaseResource dbResource = new DatabaseResource(); + + protected CatchBatchPersistenceService service; + + @Before + public void setUp() throws Exception { + service = TuttiPersistenceServiceLocator.getCatchBatchPersistenceService(); + } + + @Test + public void getCatchBatchFromFishingOperation() throws Exception { + + //TODO + } + + @Test + public void createCatchBatch() throws Exception { + //TODO + } + + @Test + public void saveCatchBatch() throws Exception { + + //TODO + } +} Property changes on: trunk/tutti-persistence-adagio/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImplTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native 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-30 08:41:21 UTC (rev 259) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-01-30 09:10:09 UTC (rev 260) @@ -30,6 +30,7 @@ import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig; import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch; import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.CatchBatch; import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch; @@ -179,6 +180,11 @@ } @Override + public List<Caracteristic> getAllCaracteristic() { + return devDriver.getAllCaracteristic(); + } + + @Override public List<Zone> getAllProgramZone() { return devDriver.getAllProgramZone(); } @@ -219,26 +225,6 @@ } @Override - public List<Caracteristic> getAllFishingOperationEnvironmentCaracteristic() { - return devDriver.getAllFishingOperationEnvironmentCaracteristic(); - } - - @Override - public List<Caracteristic> getAllFishingOperationGearCaracteristic() { - return devDriver.getAllFishingOperationGearCaracteristic(); - } - - @Override - public List<Caracteristic> getAllFishingOperationHydrologicCaracteristic() { - return devDriver.getAllFishingOperationHydrologicCaracteristic(); - } - - @Override - public List<Caracteristic> getAllSpeciesLengthStepCaracteristic() { - return devDriver.getAllSpeciesLengthStepCaracteristic(); - } - - @Override public Caracteristic getSizeCategoryCaracteristic() { return devDriver.getSizeCategoryCaracteristic(); } @@ -385,6 +371,25 @@ } //------------------------------------------------------------------------// + //-- CatchBatch methods --// + //------------------------------------------------------------------------// + + @Override + public CatchBatch getCatchBatchFromFishingOperation(String id) { + return devDriver.getCatchBatchFromFishingOperation(id); + } + + @Override + public CatchBatch createCatchBatch(CatchBatch bean) { + return devDriver.createCatchBatch(bean); + } + + @Override + public CatchBatch saveCatchBatch(CatchBatch bean) { + return devDriver.saveCatchBatch(bean); + } + + //------------------------------------------------------------------------// //-- Species Batch methods --// //------------------------------------------------------------------------//
participants (1)
-
tchemit@users.forge.codelutin.com