Author: tchemit Date: 2013-02-06 18:14:16 +0100 (Wed, 06 Feb 2013) New Revision: 350 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/350 Log: remove getAllSpeciesBatch method Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.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-02-06 10:54:11 UTC (rev 349) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-02-06 17:14:16 UTC (rev 350) @@ -353,10 +353,10 @@ List<SpeciesBatch> getAllRootSpeciesBatch(String fishingOperationId); - List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId); +// List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId); +// +// SpeciesBatch getSpeciesBatch(String id); - SpeciesBatch getSpeciesBatch(String id); - @Transactional(readOnly = false) SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId); Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-02-06 10:54:11 UTC (rev 349) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2013-02-06 17:14:16 UTC (rev 350) @@ -599,15 +599,7 @@ return result; } - @Override - public List<SpeciesBatch> getAllSpeciesBatch(final String fishingOperationId) { - List<SpeciesBatch> result = getAllTraitFilterBatches( - SpeciesBatch.class.getName(), fishingOperationId, null); - return result; - } - - @Override - public SpeciesBatch getSpeciesBatch(String id) { + private SpeciesBatch getSpeciesBatch(String id) { SpeciesBatch result = getBean(SpeciesBatch.class.getName(), id); return result; } Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2013-02-06 10:54:11 UTC (rev 349) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2013-02-06 17:14:16 UTC (rev 350) @@ -472,15 +472,15 @@ return speciesBatchService.getAllRootSpeciesBatch(fishingOperationId); } - @Override - public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) { - return speciesBatchService.getAllSpeciesBatch(fishingOperationId); - } +// @Override +// public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) { +// return speciesBatchService.getAllSpeciesBatch(fishingOperationId); +// } - @Override - public SpeciesBatch getSpeciesBatch(String id) { - return speciesBatchService.getSpeciesBatch(id); - } +// @Override +// public SpeciesBatch getSpeciesBatch(String id) { +// return speciesBatchService.getSpeciesBatch(id); +// } @Override public SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId) { 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-02-06 10:54:11 UTC (rev 349) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java 2013-02-06 17:14:16 UTC (rev 350) @@ -43,8 +43,8 @@ List<SpeciesBatch> getAllRootSpeciesBatch(String fishingOperationId); - List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId); - +// List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId); +// SpeciesBatch getSpeciesBatch(String id); List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency( Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-02-06 10:54:11 UTC (rev 349) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-02-06 17:14:16 UTC (rev 350) @@ -57,11 +57,9 @@ import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; /** @@ -107,59 +105,59 @@ return result; } +// @Override +// public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) { +// Iterator<Object[]> list = queryList("allSpeciesBatch", +// "fishingOperationId", IntegerType.INSTANCE, Integer.valueOf(fishingOperationId)); +// +// List<SpeciesBatch> result = new ArrayList<SpeciesBatch>(); +// List<SpeciesBatch> rootBatchs = new ArrayList<SpeciesBatch>(); +// +// Map<String, SpeciesBatch> batchMapById = new HashMap<String, SpeciesBatch>(); +// Map<String, String> parentBatchMapById = new HashMap<String, String>(); +// while (list.hasNext()) { +// Object[] source = list.next(); +// SpeciesBatch speciesBatch = loadSpeciesBatch(source, false); +// batchMapById.put(speciesBatch.getId(), speciesBatch); +// +// Integer parentbatchId = (Integer) source[11]; +// if (parentbatchId != null) { +// parentBatchMapById.put(speciesBatch.getId(), parentbatchId.toString()); +// } +// } +// +// for (Iterator iterator = batchMapById.values().iterator(); iterator.hasNext(); ) { +// SpeciesBatch speciesBatch = (SpeciesBatch) iterator.next(); +// +// // Retrieve the parent SpeciesBatch +// String parentbatchId = parentBatchMapById.get(speciesBatch.getId()); +// if (parentbatchId != null) { +// SpeciesBatch parentSpeciesBatch = batchMapById.get(parentbatchId); +// +// // If found, link the batch with its parent : +// if (parentSpeciesBatch != null) { +// speciesBatch.setParentBatch(parentSpeciesBatch); +// if (parentSpeciesBatch.getChildBatchs() == null) { +// parentSpeciesBatch.setChildBatchs(Lists.newArrayList(speciesBatch)); +// } else { +// parentSpeciesBatch.addChildBatchs(speciesBatch); +// } +// } +// +// // If no parent found = batch is a child of the catch batch +// else { +// rootBatchs.add(speciesBatch); +// } +// } +// } +// +// // Apply inheritance, starting with the catch batch children +// applyInheritedProperties(rootBatchs, null, null, result); +// +// return result; +// } +// @Override - public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) { - Iterator<Object[]> list = queryList("allSpeciesBatch", - "fishingOperationId", IntegerType.INSTANCE, Integer.valueOf(fishingOperationId)); - - List<SpeciesBatch> result = new ArrayList<SpeciesBatch>(); - List<SpeciesBatch> rootBatchs = new ArrayList<SpeciesBatch>(); - - Map<String, SpeciesBatch> batchMapById = new HashMap<String, SpeciesBatch>(); - Map<String, String> parentBatchMapById = new HashMap<String, String>(); - while (list.hasNext()) { - Object[] source = list.next(); - SpeciesBatch speciesBatch = loadSpeciesBatch(source, false); - batchMapById.put(speciesBatch.getId(), speciesBatch); - - Integer parentbatchId = (Integer) source[11]; - if (parentbatchId != null) { - parentBatchMapById.put(speciesBatch.getId(), parentbatchId.toString()); - } - } - - for (Iterator iterator = batchMapById.values().iterator(); iterator.hasNext(); ) { - SpeciesBatch speciesBatch = (SpeciesBatch) iterator.next(); - - // Retrieve the parent SpeciesBatch - String parentbatchId = parentBatchMapById.get(speciesBatch.getId()); - if (parentbatchId != null) { - SpeciesBatch parentSpeciesBatch = batchMapById.get(parentbatchId); - - // If found, link the batch with its parent : - if (parentSpeciesBatch != null) { - speciesBatch.setParentBatch(parentSpeciesBatch); - if (parentSpeciesBatch.getChildBatchs() == null) { - parentSpeciesBatch.setChildBatchs(Lists.newArrayList(speciesBatch)); - } else { - parentSpeciesBatch.addChildBatchs(speciesBatch); - } - } - - // If no parent found = batch is a child of the catch batch - else { - rootBatchs.add(speciesBatch); - } - } - } - - // Apply inheritance, starting with the catch batch children - applyInheritedProperties(rootBatchs, null, null, result); - - return result; - } - - @Override public SpeciesBatch getSpeciesBatch(String id) { Object[] source = queryUnique("speciesBatch", "batchId", IntegerType.INSTANCE, Integer.valueOf(id)); Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java =================================================================== --- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java 2013-02-06 10:54:11 UTC (rev 349) +++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceTest.java 2013-02-06 17:14:16 UTC (rev 350) @@ -268,12 +268,12 @@ assertNotNull(rootSpeciesBatch); assertEquals(2, rootSpeciesBatch.size()); - // ----------------------------------------------------------------------------- - // 4. Test get all species - // ----------------------------------------------------------------------------- - List<SpeciesBatch> allSpeciesBatch = service.getAllSpeciesBatch(fishingOperation.getId()); - assertNotNull(allSpeciesBatch); - assertEquals(5, allSpeciesBatch.size()); +// // ----------------------------------------------------------------------------- +// // 4. Test get all species +// // ----------------------------------------------------------------------------- +// List<SpeciesBatch> allSpeciesBatch = service.getAllSpeciesBatch(fishingOperation.getId()); +// assertNotNull(allSpeciesBatch); +// assertEquals(5, allSpeciesBatch.size()); } @Test
participants (1)
-
tchemit@users.forge.codelutin.com