This is an automated email from the git hooks/post-receive script. New commit to branch feature/7617-LL-VerifEnregistreursDeProfondeur in repository tutti. See http://git.codelutin.com/tutti.git commit 41d62ac9770d3cef01595106b90e8b0d6559b176 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Mar 14 09:21:36 2016 +0100 Ajouter du filtre sur les espèces (see #7617). --- .../content/table/impl/longline/TdrUIHandler.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java index e6f031c..2e36c24 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java @@ -32,9 +32,13 @@ import fr.ird.observe.services.dto.Form; import fr.ird.observe.services.dto.longline.SetLonglineTdrDto; import fr.ird.observe.services.dto.longline.SetLonglineTdrDtos; import fr.ird.observe.services.dto.longline.TdrDto; +import fr.ird.observe.services.dto.referential.ReferentialDto; +import fr.ird.observe.services.dto.referential.ReferentialReference; +import fr.ird.observe.services.dto.referential.ReferentialReferences; import fr.ird.observe.services.dto.referential.longline.SensorBrandDto; import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.service.longline.TdrService; +import fr.ird.observe.services.service.longline.TripLonglineService; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; @@ -66,8 +70,11 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.sql.SQLException; +import java.util.Collection; import java.util.Date; import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; import java.util.Set; import static org.nuiton.i18n.I18n.n; @@ -466,6 +473,36 @@ public class TdrUIHandler extends ContentTableUIHandler<SetLonglineTdrDto, TdrDt } @Override + protected <D extends ReferentialDto> Collection<ReferentialReference<D>> filterReferentialReferences(Class<D> dtoType, String propertyName, LinkedList<ReferentialReference<D>> incomingReferences) { + + Collection<ReferentialReference<D>> result = super.filterReferentialReferences(dtoType, propertyName, incomingReferences); + + switch (propertyName) { + + case TdrDto.PROPERTY_SPECIES: { + String speciesListId = ObserveSwingApplicationContext.get().getConfig().getSpeciesListLonglineCatchId(); + + String tripLonglineId = getDataContext().getSelectedTripLonglineId(); + + TripLonglineService tripLonglineService = ObserveSwingApplicationContext.get().newService(TripLonglineService.class); + result = (List) tripLonglineService.getSpeciesByListAndTrip(tripLonglineId, speciesListId); + + result = ReferentialReferences.filterEnabled(result); + + if (log.isDebugEnabled()) { + log.debug(String.format("Filter referential references (type %s - property %s), final size: %d", dtoType.getSimpleName(), propertyName, incomingReferences.size())); + } + + break; + } + + } + + return result; + + } + + @Override protected void loadEditBean(String beanId) { Form<SetLonglineTdrDto> form = getTdrService().loadForm(beanId); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.