branch develop updated (7b5fa43 -> 97e54db)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See http://git.codelutin.com/observe.git from 7b5fa43 Optimisation des dépendances new 5132a7d Migration de l'écran des captures ciblées (refs #7604) new af4b2e4 sipression d'un log pour le debug (refs #7604) new 250352f mise en place de la validation (refs #7604) new 97e54db Merge branch 'feature/7604' into develop The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 97e54dbe585ee1d1047eb832ff381c7063df1fe3 Merge: 7b5fa43 250352f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 15:12:33 2015 +0200 Merge branch 'feature/7604' into develop commit 250352fa4007b1d2b86ee3e4bf05f5baf9e17ddc Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 15:11:24 2015 +0200 mise en place de la validation (refs #7604) commit af4b2e4ca820122176c523efe50e8e8aa18601db Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 14:58:24 2015 +0200 sipression d'un log pour le debug (refs #7604) commit 5132a7dcccf1bee9736b824d949fffca0b71117e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 14:57:21 2015 +0200 Migration de l'écran des captures ciblées (refs #7604) Summary of changes: .../ui/content/table/impl/seine/TargetCatchUI.jaxx | 17 +- .../table/impl/seine/TargetCatchUIHandler.java | 309 +++++---------------- .../table/impl/seine/TargetCatchUIModel.java | 48 ++-- ...neTargetCatchDto-n1-update-error-validation.xml | 2 +- ...hDto-n1-update-targetCatch-error-validation.xml | 0 ...to-n1-update-targetCatch-warning-validation.xml | 0 .../v1/seine/TargetCatchServiceController.java | 5 +- .../ird/observe/entities/seine/TargetCatchs.java | 20 ++ .../ird/observe/entities/seine/TargetLenghts.java | 20 ++ .../services/service/seine/TargetCatchService.java | 3 +- .../src/main/xmi/observe-services-dto-seine.zargo | Bin 61137 -> 61190 bytes .../services/dto/ObserveDtosInitializer.java | 2 +- .../service/seine/SchoolEstimateServiceTopia.java | 5 + .../service/seine/TargetCatchServiceTopia.java | 119 ++++++++ 14 files changed, 281 insertions(+), 269 deletions(-) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/SetSeine-n1-update-targetCatch-error-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml (95%) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/TargetCatch-n1-update-targetCatch-error-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-error-validation.xml (100%) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/TargetCatch-n1-update-targetCatch-warning-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-warning-validation.xml (100%) create mode 100644 observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetCatchs.java create mode 100644 observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetLenghts.java create mode 100644 observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetCatchServiceTopia.java -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit 5132a7dcccf1bee9736b824d949fffca0b71117e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 14:57:21 2015 +0200 Migration de l'écran des captures ciblées (refs #7604) --- .../ui/content/table/impl/seine/TargetCatchUI.jaxx | 15 +- .../table/impl/seine/TargetCatchUIHandler.java | 316 +++++---------------- .../table/impl/seine/TargetCatchUIModel.java | 48 ++-- .../v1/seine/TargetCatchServiceController.java | 5 +- .../ird/observe/entities/seine/TargetCatchs.java | 20 ++ .../ird/observe/entities/seine/TargetLenghts.java | 20 ++ .../services/service/seine/TargetCatchService.java | 3 +- .../src/main/xmi/observe-services-dto-seine.zargo | Bin 61137 -> 61190 bytes .../services/dto/ObserveDtosInitializer.java | 2 +- .../service/seine/SchoolEstimateServiceTopia.java | 5 + .../service/seine/TargetCatchServiceTopia.java | 119 ++++++++ 11 files changed, 286 insertions(+), 267 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx index e901344..193fb48 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx @@ -21,19 +21,17 @@ --> <fr.ird.observe.ui.content.table.ContentTableUI - superGenericType='SetSeineDto, TargetCatchDto' + superGenericType='SetSeineTargetCatchDto, TargetCatchDto' contentTitle='{n("observe.common.targetCatch")}' saveNewEntryText='{n("observe.action.create.targetCatch")}' - saveNewEntryTip='{n("observe.action.create.targetCatch.tip")}' - - > + saveNewEntryTip='{n("observe.action.create.targetCatch.tip")}'> <style source="../../CommonTable.css"/> <import> fr.ird.observe.services.dto.ReferenceDto fr.ird.observe.services.dto.CommentableDto - fr.ird.observe.services.dto.seine.SetSeineDto + fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto fr.ird.observe.services.dto.seine.TargetCatchDto fr.ird.observe.services.dto.referential.seine.WeightCategoryDto fr.ird.observe.services.dto.referential.SpeciesDto @@ -55,7 +53,7 @@ <TargetCatchUIModel id='model' constructorParams='this'/> <!-- edit bean --> - <SetSeineDto id='bean'/> + <SetSeineTargetCatchDto id='bean'/> <!-- table edit bean --> <TargetCatchDto id='tableEditBean'/> @@ -65,12 +63,11 @@ <!-- le validateur de l'écran --> <BeanValidator id='validator' - beanClass='fr.ird.observe.services.dto.seine.SetSeineDto' + beanClass='fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto' errorTableModel='{getErrorTableModel()}' context='n1-update-targetCatch'> <!-- clef unique --> - <!--FIXME--> - <!--<field name="targetCatch" component="editorPanel"/>--> + <field name="targetCatch" component="editorPanel"/> </BeanValidator> <!-- le validateur d'une entrée de tableau --> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java index f8b90e8..a97c151 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java @@ -21,22 +21,26 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.ReferenceSetDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; -import fr.ird.observe.services.dto.seine.SetSeineDto; -import fr.ird.observe.services.dto.seine.SetSeineDtos; +import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto; +import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDtos; import fr.ird.observe.services.dto.seine.TargetCatchDto; -import fr.ird.observe.services.dto.seine.TargetLengthDto; -import fr.ird.observe.services.service.seine.SetSeineService; +import fr.ird.observe.services.dto.seine.TargetCatchDtos; +import fr.ird.observe.services.service.seine.TargetCatchService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIHandler; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.swing.editor.bean.BeanComboBox; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -48,12 +52,10 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.Collection; +import java.util.Arrays; import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; import java.util.List; +import java.util.Set; import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -62,29 +64,11 @@ import static org.nuiton.i18n.I18n.t; * @author Tony Chemit - chemit@codelutin.com * @since 1.0 */ -public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, TargetCatchDto> { +public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCatchDto, TargetCatchDto> { /** Logger */ private static final Log log = LogFactory.getLog(TargetCatchUIHandler.class); - JAXXContextEntryDef<List<TargetLengthDto>> ALL_TAILLES_TO_DELETE_ENTRY = - UIHelper.newListContextEntryDef("TargetCatchUI-all-taille-to-delete"); - - /** - * l'entrée dans le contexte pour récupérer la liste complètes des - * catégories - */ - JAXXContextEntryDef<List<ReferenceDto<WeightCategoryDto>>> ALL_CATEGORIES_ENTRY = - UIHelper.newListContextEntryDef("TargetCatchUI-all-categories"); - - //FIXME -// TopiaExecutor<WeightCategory> weightCategoryTopiaExecutor = new TopiaExecutor<WeightCategory>() { -// @Override -// public void execute(TopiaContext tx, WeightCategory bean) { -// getDecoratorService().decorate(bean.getSpecies()); -// } -// }; - public TargetCatchUIHandler(TargetCatchUI ui) { super(ui, DataContextType.SetSeine); } @@ -109,7 +93,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar @Override public void propertyChange(PropertyChangeEvent evt) { - ContentTableModel<SetSeineDto, TargetCatchDto> model; + ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model; model = getTableModel(); if (model.getRowBean().getId() == null) { @@ -117,7 +101,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar // en mode creation , on doit recalculer la liste // des categories - SpeciesDto species = (SpeciesDto) evt.getNewValue(); + ReferentialReferenceDto<SpeciesDto> species = (ReferentialReferenceDto<SpeciesDto>) evt.getNewValue(); onEspeceChanged(species); @@ -132,145 +116,43 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar return getDataContext().getSelectedSetId(); } -// @Override -// protected SetSeine loadEditBean(ContentMode mode, -// DataContext dataContext, -// DataService dataService, -// DataSource dataSource) { -// -// List<Species> speciesList; -// List<WeightCategory> categorieList; -// -// if (mode == ContentMode.UPDATE) { -// -// // on charge le formulaire uniquement si en mode édition -// -// categorieList = new ArrayList<WeightCategory>( -// dataService.loadDecoratedEntities(dataSource, -// WeightCategory.class, -// weightCategoryTopiaExecutor)); -// -// // Keep only weight categories for the species -// ObserveSwingApplicationConfig config = getUi().getContextValue(ObserveSwingApplicationConfig.class); -// String speciesListId = config.getSpeciesListSeineTargetCatchId(); -// -// java.util.Set<String> speciesIds = loadSpeciesList(speciesListId, n("observe.error.speciesList.seine.targetCatch.notFound")); -// -// categorieList = Species2.filterWeightCategoryBySpeciesIds( -// categorieList, speciesIds); -// -// // filtre par status actif -// ReferenceEntities.filterReferentielListByStatus(categorieList); -// -// // get current ocean -// Ocean ocean = dataService.getTripOcean( -// dataSource, dataContext.getSelectedTripId()); -// -// // filtre par ocean -// categorieList = Species2.filterWeightCategoryByOcean(categorieList, ocean); -// -// // filtre par ocean -// speciesList = Species2.toSpecies(categorieList); -// -// // filtre par status actif -// ReferenceEntities.filterReferentielListByStatus(speciesList); -// -// } else { -// -// speciesList = new ArrayList<Species>(); -// categorieList = new ArrayList<WeightCategory>(); -// } -// -// TargetCatchUI ui = getUi(); -// -// ALL_CATEGORIES_ENTRY.setContextValue(ui, categorieList); -// -// ui.getSpecies().setData(speciesList); -// -// return super.loadEditBean(mode, dataContext, dataService, dataSource); -// } - -// @Override -// protected Collection<TargetCatch> loadChilds(TopiaContext tx, SetSeine bean) throws TopiaException { -// Collection<TargetCatch> childs = getModel().getChildsUpdator().getChilds(bean); -// Collection<TargetCatch> data = new ArrayList<TargetCatch>(); -// if (CollectionUtils.isNotEmpty(childs)) { -// TopiaDAO<TargetCatch> dao = -// getDataSource().getDAO(tx, getTableEditBean()); -// TopiaEntityBinder<TargetCatch> childLoador = getModel().getChildLoador(); -// -// DecoratorService decoratorService = getDecoratorService(); -// -// for (TargetCatch c : childs) { -// if (c.isDiscarded()) { -// // c'est un rejet, on ne le retient pas dans cette liste -// if (log.isDebugEnabled()) { -// log.debug("targetDiscarded " + c.getSpecies().getLabel2() + -// " non retenu."); -// } -// continue; -// } -// try { -// -// TargetCatch c2 = getModel().newTableEditBean(); -// TargetCatch safeC = dao.findByTopiaId(c.getTopiaId()); -// WeightCategory weightCategory = safeC.getWeightCategory(); -// if (weightCategory != null) { -// Species species = weightCategory.getSpecies(); -// decoratorService.decorate(species); -// } -// childLoador.load(safeC, c2, true); -// data.add(c2); -// } catch (Exception e) { -// throw new RuntimeException(e); -// } -// } -// } -// return data; -// } - @Override - protected boolean prepareSave(SetSeineDto bean, List<TargetCatchDto> objets) { + protected boolean prepareSave(SetSeineTargetCatchDto bean, List<TargetCatchDto> objets) { + + //on cherche si parmis les captures supprimer certaines ont des échantillon + SetSeineTargetCatchDto originalSetSeineTargetCatchDto = getModel().getFormDto().getForm(); + SetSeineTargetCatchDto currentSetSeineTargetCatch = getModel().getBean(); + + Set<ReferentialReferenceDto<SpeciesDto>> speciesToDelete = Sets.newHashSet(); + + for (TargetCatchDto targetCatchDto : originalSetSeineTargetCatchDto.getTargetCatch()) { - // on recupere les speciess acceptables pour des echantillonnages - // i.e une species d'un targetCatch + if (targetCatchDto.isHasSample()) { - Collection<SpeciesDto> speciessUsed = new HashSet<SpeciesDto>(); - //FIXME -// for (TargetCatchDto c : objets) { -// speciessUsed.add(c.getSpecies()); -// } + ReferentialReferenceDto<SpeciesDto> species = targetCatchDto.getSpecies(); - // il faut supprimer les echantillon thons sur des speciess qui ne - // sont plus sur un rejet + Iterable<TargetCatchDto> currentTargetCatchSpecies = TargetCatchDtos.filterBySpecies(currentSetSeineTargetCatch.getTargetCatch(), species); - List<TargetLengthDto> tailleToDelete = new ArrayList<TargetLengthDto>(); - Collection<SpeciesDto> speciessToDelete = new HashSet<SpeciesDto>(); + if (Iterables.isEmpty(currentTargetCatchSpecies)) { - //FIXME -// getDataService().getObsoleteEspeceForTargetSample(getDataSource(), -// bean.getTopiaId(), -// speciessUsed, -// speciessToDelete, -// tailleToDelete, -// false); + speciesToDelete.add(species); - if (!tailleToDelete.isEmpty()) { + } + } + + } + + if (!speciesToDelete.isEmpty()) { // il existe des echantillon thon a supprimer on demande une // confirmation StringBuilder sb = new StringBuilder(512); StringBuilder sb2 = new StringBuilder(512); - Decorator<SpeciesDto> decorator = - getDecoratorService().getDecoratorByType(SpeciesDto.class); - Decorator<TargetLengthDto> decorator2 = - getDecoratorService().getDecoratorByType(TargetLengthDto.class); + Decorator<ReferenceDto> decorator = + getDecoratorService().getDecoratorByType(ReferenceDto.class, SpeciesDto.class.getSimpleName()); - for (SpeciesDto e : speciessToDelete) { - sb.append(" - ").append(decorator.toString(e)).append('\n'); - } - for (TargetLengthDto t : tailleToDelete) { - sb2.append(" - ").append(decorator2.toString(t)).append('\n'); + for (ReferentialReferenceDto<SpeciesDto> species : speciesToDelete) { + sb.append(" - ").append(decorator.toString(species)).append('\n'); } int reponse = UIHelper.askUser( t("observe.title.need.confirm"), @@ -296,62 +178,21 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar // l'utilisateur a choisi de ne pas continuer return false; } - - // on conserve les tailles a supprimer - ALL_TAILLES_TO_DELETE_ENTRY.setContextValue(getUi(), tailleToDelete); - } - - for (TargetCatchDto targetCatch : objets) { - - // on attache la set - //FIXME -// targetCatch.setSetSeine(bean); } return true; } - //FIXME -// @Override -// protected void onUpdateFinalize(TopiaContext tx, SetSeine bean, Collection<TargetCatch> oldChilds) { -// -// if (oldChilds != null && !oldChilds.isEmpty()) { -// -// // on reinjecte les rejet thon precedemment saisie dans la set -// for (TargetCatch targetCatch : oldChilds) { -// if (targetCatch.isDiscarded()) { -// bean.addTargetCatch(targetCatch); -// } -// } -// } -// -// -// List<TargetLength> tailleToDelete = ALL_TAILLES_TO_DELETE_ENTRY.getContextValue(getUi()); -// -// if (tailleToDelete != null && !tailleToDelete.isEmpty()) { -// -// // on a demande la suppression de taille obsoletes -// -// if (log.isInfoEnabled()) { -// log.info("Will remove " + tailleToDelete.size() + -// " obsolete targetLength(s)."); -// } -// -// TargetSample echantillon = bean.getTargetSample(false); -// -// // on supprime les echantillons obsoletes -// echantillon.getTargetLength().removeAll(tailleToDelete); -// } -// } - @Override protected void onSelectedRowChanged(int editingRow, TargetCatchDto bean, boolean create) { TargetCatchUI ui = getUi(); - //FIXME -// WeightCategoryDto beanWeightCategory = bean.getWeightCategory(); -// SpeciesDto beanEspece = beanWeightCategory == null ? -// null : beanWeightCategory.getSpecies(); + ReferenceDto<WeightCategoryDto> beanWeightCategory = bean.getWeightCategory(); + + ReferenceDto<SpeciesDto> beanSpecies = null; + if (beanWeightCategory != null) { + beanSpecies = (ReferenceDto<SpeciesDto>) beanWeightCategory.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES); + } JComponent requestFocus; if (create) { @@ -363,11 +204,9 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar if (!getTableModel().isCreate()) { // on repositionne l'species (cela reconstruira la liste // des categories) - //FIXME -// ui.getSpecies().setSelectedItem(beanEspece); + ui.getSpecies().setSelectedItem(beanSpecies); // on repositionne la categorie - //FIXME -// ui.getWeightCategory().setSelectedItem(beanWeightCategory); + ui.getWeightCategory().setSelectedItem(beanWeightCategory); } requestFocus = ui.getSpecies(); @@ -378,20 +217,17 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar // au singleton de sa valeur correspondante dans le bean // puisque dans ce mode, pas possibilite de modifier de cette // valeur (clef metier) - //FIXME -// ui.getSpecies().setSelectedItem(beanEspece); - //FIXME -// ui.getWeightCategory().setData( -// Arrays.asList(beanWeightCategory)); -// ui.getWeightCategory().setSelectedItem(beanWeightCategory); + ui.getSpecies().setSelectedItem(beanSpecies); + ui.getWeightCategory().setData( + Arrays.asList(beanWeightCategory)); + ui.getWeightCategory().setSelectedItem(beanWeightCategory); requestFocus = ui.getCatchWeight(); } if (log.isDebugEnabled()) { - //FIXME -// log.debug("selected categoriePoid " + beanWeightCategory); -// log.debug("selected species " + beanEspece); + log.debug("selected categoriePoid " + beanWeightCategory); + log.debug("selected species " + beanSpecies); } requestFocus.requestFocus(); } @@ -418,15 +254,15 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar n("observe.targetCatch.table.comment"), n("observe.targetCatch.table.comment.tip")); - UIHelper.setTableColumnRenderer(table, 0, UIHelper.newDecorateTableCellRenderer(renderer, SpeciesDto.class)); - UIHelper.setTableColumnRenderer(table, 1, UIHelper.newDecorateTableCellRenderer(renderer, WeightCategoryDto.class)); + UIHelper.setTableColumnRenderer(table, 0, UIHelper.newDecorateTableCellRenderer(renderer, ReferenceDto.class, SpeciesDto.class.getSimpleName())); + UIHelper.setTableColumnRenderer(table, 1, UIHelper.newDecorateTableCellRenderer(renderer, ReferenceDto.class, WeightCategoryDto.class.getSimpleName())); UIHelper.setTableColumnRenderer(table, 2, renderer); UIHelper.setTableColumnRenderer(table, 3, UIHelper.newEmptyNumberTableCellRenderer(renderer)); UIHelper.setTableColumnRenderer(table, 4, UIHelper.newStringTableCellRenderer(renderer, 10, true)); } @SuppressWarnings("unchecked") - protected void onEspeceChanged(SpeciesDto species) { + protected void onEspeceChanged(final ReferentialReferenceDto<SpeciesDto> species) { List<ReferenceDto<WeightCategoryDto>> availableCategories; @@ -442,19 +278,27 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar // un species est selectionnee, // on calcule les categories pour cette species - availableCategories = getAllCategories(getUi()); + ReferenceSetDto<WeightCategoryDto> weightCategoryDtoReferenceSetDto = getModel().getFormDto().getReferenceSetDto(WeightCategoryDto.class); + + Set<ReferenceDto<WeightCategoryDto>> allCategories = (Set) weightCategoryDtoReferenceSetDto.getReference(); // on ne conserve que les categories de l'species - for (Iterator<ReferenceDto<WeightCategoryDto>> it = availableCategories.iterator(); - it.hasNext(); ) { - ReferenceDto<WeightCategoryDto> weighte = it.next(); - if (!species.equals(weighte.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES))) { - it.remove(); + availableCategories = Lists.newArrayList(Iterables.filter(allCategories, new Predicate<ReferenceDto<WeightCategoryDto>>() { + @Override + public boolean apply(ReferenceDto<WeightCategoryDto> input) { + return species.equals(input.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES)); } - } + })); } // on met a jour la liste des categories disponibles + if (log.isWarnEnabled()) { + log.warn("availableCategories : "); + for (ReferenceDto<WeightCategoryDto> category : availableCategories) { + log.warn(" - " + category.getPropertyValue(WeightCategoryDto.PROPERTY_CODE) + " : " + category.getPropertyValue("label")); + } + } + BeanComboBox<ReferenceDto<WeightCategoryDto>> combo = getUi().getWeightCategory(); combo.setData(availableCategories); @@ -462,24 +306,20 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar combo.setSelectedItem(null); } - protected List<ReferenceDto<WeightCategoryDto>> getAllCategories(JAXXContext context) { - List<ReferenceDto<WeightCategoryDto>> list = new ArrayList<>(ALL_CATEGORIES_ENTRY.getContextValue(context)); - return list; - } - @Override - protected void doPersist(SetSeineDto bean) { - getSetSeineService().save(getSelectedParentId(), bean); + protected void doPersist(SetSeineTargetCatchDto bean) { + getTargetCatchService().save(bean); } @Override protected void loadEditBean(String beanId) { - FormDto<SetSeineDto> formDto = getSetSeineService().loadToEdit(beanId); + FormDto<SetSeineTargetCatchDto> formDto = getTargetCatchService().loadToEdit(beanId); + getModel().setFormDto(formDto); - SetSeineDtos.copySetSeineDto(formDto.getForm(), getBean()); + SetSeineTargetCatchDtos.copySetSeineTargetCatchDto(formDto.getForm(), getBean()); } - protected SetSeineService getSetSeineService() { - return ObserveSwingApplicationContext.get().newService(SetSeineService.class); + protected TargetCatchService getTargetCatchService() { + return ObserveSwingApplicationContext.get().newService(TargetCatchService.class); } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIModel.java index a67d877..b4930cc 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIModel.java @@ -24,13 +24,15 @@ package fr.ird.observe.ui.content.table.impl.seine; import com.google.common.collect.Lists; import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; -import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto; import fr.ird.observe.services.dto.seine.TargetCatchDto; +import fr.ird.observe.services.dto.seine.TargetCatchDtos; import fr.ird.observe.ui.content.table.ContentTableMeta; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIModel; import fr.ird.observe.ui.content.table.ObserveContentTableUI; +import java.util.Collection; import java.util.List; /** @@ -39,27 +41,25 @@ import java.util.List; * @author Tony Chemit - chemit@codelutin.com * @since XXX */ -public class TargetCatchUIModel extends ContentTableUIModel<SetSeineDto, TargetCatchDto> { +public class TargetCatchUIModel extends ContentTableUIModel<SetSeineTargetCatchDto, TargetCatchDto> { private static final long serialVersionUID = 1L; public TargetCatchUIModel(TargetCatchUI ui) { - super(SetSeineDto.class, + super(SetSeineTargetCatchDto.class, TargetCatchDto.class, new String[]{ - //FIXME -// SetSeineDto.PROPERTY_TARGET_CATCH + SetSeineTargetCatchDto.PROPERTY_TARGET_CATCH }, new String[]{ - //FIXME -// TargetCatchDto.PROPERTY_SET_SEINE, - TargetCatchDto.PROPERTY_WEIGHT_CATEGORY, - TargetCatchDto.PROPERTY_CATCH_WEIGHT, - TargetCatchDto.PROPERTY_WELL, - TargetCatchDto.PROPERTY_BROUGHT_ON_DECK, - TargetCatchDto.PROPERTY_DISCARDED, - TargetCatchDto.PROPERTY_COMMENT}); + TargetCatchDto.PROPERTY_WEIGHT_CATEGORY, + TargetCatchDto.PROPERTY_CATCH_WEIGHT, + TargetCatchDto.PROPERTY_WELL, + TargetCatchDto.PROPERTY_BROUGHT_ON_DECK, + TargetCatchDto.PROPERTY_DISCARDED, + TargetCatchDto.PROPERTY_COMMENT} + ); List<ContentTableMeta<TargetCatchDto>> metas = Lists.newArrayList( ContentTableModel.newTableMeta(TargetCatchDto.class, WeightCategoryDto.PROPERTY_SPECIES, true), @@ -73,8 +73,24 @@ public class TargetCatchUIModel extends ContentTableUIModel<SetSeineDto, TargetC } @Override - protected ContentTableModel<SetSeineDto, TargetCatchDto> createTableModel(ObserveContentTableUI<SetSeineDto, TargetCatchDto> ui, List<ContentTableMeta<TargetCatchDto>> contentTableMetas) { - // FIXME - return null; + protected ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> createTableModel( + ObserveContentTableUI<SetSeineTargetCatchDto, TargetCatchDto> ui, + List<ContentTableMeta<TargetCatchDto>> contentTableMetas) { + return new ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto>(ui, contentTableMetas) { + @Override + protected Collection<TargetCatchDto> getChilds(SetSeineTargetCatchDto bean) { + return bean.getTargetCatch(); + } + + @Override + protected void load(TargetCatchDto source, TargetCatchDto target) { + TargetCatchDtos.copyTargetCatchDto(source, target); + } + + @Override + protected void setChilds(SetSeineTargetCatchDto parent, List<TargetCatchDto> childs) { + parent.setTargetCatch(childs); + } + }; } } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetCatchServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetCatchServiceController.java index 56050a4..21fc85c 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetCatchServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetCatchServiceController.java @@ -24,6 +24,7 @@ package fr.ird.observe.application.web.controller.v1.seine; import fr.ird.observe.application.web.controller.v1.ObserveAuthenticatedServiceControllerSupport; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto; import fr.ird.observe.services.service.seine.TargetCatchService; @@ -47,7 +48,7 @@ public class TargetCatchServiceController extends ObserveAuthenticatedServiceCon } @Override - public String save(FormDto<SetSeineTargetCatchDto> form) { - return service.save(form); + public SaveResultDto save(SetSeineTargetCatchDto dto) { + return service.save(dto); } } diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetCatchs.java b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetCatchs.java new file mode 100644 index 0000000..df3882f --- /dev/null +++ b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetCatchs.java @@ -0,0 +1,20 @@ +package fr.ird.observe.entities.seine; + +import com.google.common.base.Function; +import fr.ird.observe.entities.referentiel.Species; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TargetCatchs { + + public static Function<TargetCatch, Species> getSpeciesFunction() { + return new Function<TargetCatch, Species>() { + @Override + public Species apply(TargetCatch input) { + return input.getSpecies(); + } + }; + } + +} diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetLenghts.java b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetLenghts.java new file mode 100644 index 0000000..b442857 --- /dev/null +++ b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TargetLenghts.java @@ -0,0 +1,20 @@ +package fr.ird.observe.entities.seine; + +import com.google.common.base.Function; +import fr.ird.observe.entities.referentiel.Species; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TargetLenghts { + + public static Function<TargetLength, Species> getSpeciesFunction() { + return new Function<TargetLength, Species>() { + @Override + public Species apply(TargetLength input) { + return input.getSpecies(); + } + }; + } + +} diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetCatchService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetCatchService.java index 4af52d0..78f05dd 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetCatchService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetCatchService.java @@ -24,6 +24,7 @@ package fr.ird.observe.services.service.seine; import fr.ird.observe.services.ObserveService; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto; import fr.ird.observe.services.spi.PostRequest; import fr.ird.observe.services.spi.ReadDataPermission; @@ -44,5 +45,5 @@ public interface TargetCatchService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(FormDto<SetSeineTargetCatchDto> form); + SaveResultDto save(SetSeineTargetCatchDto dto); } diff --git a/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo b/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo index 9370756..7e29c36 100644 Binary files a/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo and b/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo differ diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java b/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java index 1279362..40098fe 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java @@ -1306,7 +1306,7 @@ public class ObserveDtosInitializer implements ObserveModelInitializer { registerDtoType(WeightCategoryDto.class, WeightCategory.class); registerReferentialDtoBinder(WeightCategoryDto.class, WeightCategory.class, WeightCategoryDto.PROPERTY_CODE, WeightCategoryDto.PROPERTY_SPECIES); - registerReferentialReferenceDtoBinder(WeightCategoryDto.class, WeightCategory.class); + registerReferentialReferenceDtoBinder(WeightCategoryDto.class, WeightCategory.class, WeightCategoryDto.PROPERTY_CODE, WeightCategoryDto.PROPERTY_SPECIES); } @Override diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SchoolEstimateServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SchoolEstimateServiceTopia.java index f75d1b9..abf9075 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SchoolEstimateServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SchoolEstimateServiceTopia.java @@ -25,6 +25,7 @@ package fr.ird.observe.services.service.seine; import com.google.common.collect.ImmutableMap; import fr.ird.observe.entities.referentiel.Ocean; import fr.ird.observe.entities.referentiel.Species; +import fr.ird.observe.entities.seine.SchoolEstimate; import fr.ird.observe.entities.seine.SetSeine; import fr.ird.observe.entities.seine.TripSeine; import fr.ird.observe.services.ObserveServiceTopia; @@ -73,6 +74,10 @@ public class SchoolEstimateServiceTopia extends ObserveServiceTopia implements S SetSeine setSeine = dtoToEntity(SetSeineSchoolEstimateDto.class, SetSeine.class, dto); + for (SchoolEstimate schoolEstimate : setSeine.getSchoolEstimate()) { + schoolEstimate.setSetSeine(setSeine); + } + setSeine = saveEntity(SetSeine.class, setSeine); return setSeine.getTopiaId(); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetCatchServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetCatchServiceTopia.java new file mode 100644 index 0000000..0c47c53 --- /dev/null +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetCatchServiceTopia.java @@ -0,0 +1,119 @@ +package fr.ird.observe.services.service.seine; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Sets; +import fr.ird.observe.entities.referentiel.Species; +import fr.ird.observe.entities.seine.SetSeine; +import fr.ird.observe.entities.seine.TargetCatch; +import fr.ird.observe.entities.seine.TargetCatchs; +import fr.ird.observe.entities.seine.TargetLenghts; +import fr.ird.observe.entities.seine.TargetLength; +import fr.ird.observe.entities.seine.TargetSample; +import fr.ird.observe.services.ObserveServiceTopia; +import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.ReferenceTypeName; +import fr.ird.observe.services.dto.referential.SpeciesDto; +import fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto; +import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; +import fr.ird.observe.services.dto.result.SaveResultDto; +import fr.ird.observe.services.dto.result.SaveResultDtos; +import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto; +import fr.ird.observe.services.dto.seine.TargetCatchDto; +import org.nuiton.topia.persistence.TopiaEntities; + +import java.util.Set; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TargetCatchServiceTopia extends ObserveServiceTopia implements TargetCatchService { + @Override + public FormDto<SetSeineTargetCatchDto> loadToRead(String setSeineId) { + + SetSeine setSeine = loadEntity(SetSeineTargetCatchDto.class, SetSeine.class, setSeineId); + + FormDto<SetSeineTargetCatchDto> form = entityToReadFormDto(SetSeineTargetCatchDto.class, SetSeine.class, setSeine); + + return form; + } + + @Override + public FormDto<SetSeineTargetCatchDto> loadToEdit(String setSeineId) { + + SetSeine setSeine = loadEntity(SetSeineTargetCatchDto.class, SetSeine.class, setSeineId); + + FormDto<SetSeineTargetCatchDto> form = entityToEditFormDto( + SetSeineTargetCatchDto.class, + SetSeine.class, + setSeine, + new ReferenceTypeName(TargetCatchDto.class, SpeciesDto.class, TargetCatchDto.PROPERTY_SPECIES), + new ReferenceTypeName(TargetCatchDto.class, ReasonForDiscardDto.class, TargetCatchDto.PROPERTY_REASON_FOR_DISCARD), + new ReferenceTypeName(TargetCatchDto.class, WeightCategoryDto.class, TargetCatchDto.PROPERTY_WEIGHT_CATEGORY)); + + SetSeineTargetCatchDto setSeineTargetCatchDto = form.getForm(); + + // on cherche si il y a des échantillons sur les captures + TargetSample targetSample = setSeine.getTargetSample(false); + + if (targetSample != null) { + + Iterable<Species> speciesSamples = Iterables.transform( + targetSample.getTargetLength(), + TargetLenghts.getSpeciesFunction()); + + Set<String> speciesSampleIds = Sets.newHashSet(Iterables.transform(speciesSamples, TopiaEntities.getTopiaIdFunction())); + + for (TargetCatchDto targetCatchDto : setSeineTargetCatchDto.getTargetCatch()) { + + boolean hasSample = speciesSampleIds.contains(targetCatchDto.getSpecies().getId()); + + targetCatchDto.setHasSample(hasSample); + } + + } + + return form; + } + + @Override + public SaveResultDto save(SetSeineTargetCatchDto dto) { + + SetSeine setSeine = dtoToEntity(SetSeineTargetCatchDto.class, SetSeine.class, dto); + + // on supprime les échantillons qui ne correspondent plus a des capture + TargetSample targetSample = setSeine.getTargetSample(false); + + Set<Species> speciesCatchs = Sets.newHashSet(Iterables.transform( + setSeine.getTargetCatch(), + TargetCatchs.getSpeciesFunction())); + + Set<TargetLength> targetLengthToDelete = Sets.newHashSet(); + + if (targetSample != null) { + + for (TargetLength targetLength : targetSample.getTargetLength()) { + + if (! speciesCatchs.contains(targetLength.getSpecies())) { + + targetLengthToDelete.add(targetLength); + + } + } + + for (TargetLength targetLength : targetLengthToDelete) { + + targetSample.removeTargetLength(targetLength); + + } + + } + + for (TargetCatch targetCatch : setSeine.getTargetCatch()) { + targetCatch.setSetSeine(setSeine); + } + + setSeine = saveEntity(SetSeine.class, setSeine); + + return SaveResultDtos.newSaveResult(setSeine.getTopiaId(), setSeine.getLastUpdate()); + } +} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit af4b2e4ca820122176c523efe50e8e8aa18601db Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 14:58:24 2015 +0200 sipression d'un log pour le debug (refs #7604) --- .../observe/ui/content/table/impl/seine/TargetCatchUIHandler.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java index a97c151..0986eaf 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java @@ -292,13 +292,6 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa } // on met a jour la liste des categories disponibles - if (log.isWarnEnabled()) { - log.warn("availableCategories : "); - for (ReferenceDto<WeightCategoryDto> category : availableCategories) { - log.warn(" - " + category.getPropertyValue(WeightCategoryDto.PROPERTY_CODE) + " : " + category.getPropertyValue("label")); - } - } - BeanComboBox<ReferenceDto<WeightCategoryDto>> combo = getUi().getWeightCategory(); combo.setData(availableCategories); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit 250352fa4007b1d2b86ee3e4bf05f5baf9e17ddc Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 15:11:24 2015 +0200 mise en place de la validation (refs #7604) --- .../ui/content/table/impl/seine/TargetCatchUI.jaxx | 2 +- ...neTargetCatchDto-n1-update-error-validation.xml | 41 ++++++++++ ...hDto-n1-update-targetCatch-error-validation.xml | 91 ++++++++++++++++++++++ ...to-n1-update-targetCatch-warning-validation.xml | 40 ++++++++++ 4 files changed, 173 insertions(+), 1 deletion(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx index 193fb48..881e02d 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx @@ -65,7 +65,7 @@ <BeanValidator id='validator' beanClass='fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto' errorTableModel='{getErrorTableModel()}' - context='n1-update-targetCatch'> + context='n1-update'> <!-- clef unique --> <field name="targetCatch" component="editorPanel"/> </BeanValidator> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml new file mode 100644 index 0000000..f6d972a --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="targetCatch"> + + <!-- clef unique sur la categorie weight et well --> + + <field-validator type="collectionFieldExpression"> + <param name="mode">UNIQUE_KEY</param> + <param name="keys">weightCategory.id,well</param> + <message>validator.targetCatch.uniqueKey</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-error-validation.xml new file mode 100644 index 0000000..f9666e2 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-error-validation.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="species"> + + <!-- pas de species selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetCatch.required.species</message> + </field-validator> + + <!-- species desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ species.enabled ]]> + </param> + <message>validator.targetCatch.desactivated.species</message> + </field-validator> + + </field> + + <field name="weightCategory"> + + <!-- pas de categorie weight selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetCatch.required.weightCategory</message> + </field-validator> + + <!-- weightCategory desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ weightCategory.enabled ]]> + </param> + <message>validator.targetCatch.desactivated.weightCategory</message> + </field-validator> + + </field> + + <field name="well"> + + <!-- well non renseignée --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetCatch.required.well</message> + </field-validator> + + </field> + + <field name="catchWeight"> + + <!-- catchWeight non renseigné --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetCatch.required.weight</message> + </field-validator> + + </field> + + <field name="comment"> + + <!-- comentaire de moins de 1024 caractères --> + <field-validator type="stringlength"> + <param name="maxLength">1024</param> + <message>validator.targetCatch.comment.tobig</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-warning-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-warning-validation.xml new file mode 100644 index 0000000..1363e20 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetCatch-warning-validation.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="catchWeight"> + + <!-- catchWeight entre 0 et 400 --> + <field-validator type="double" short-circuit="true"> + <param name="minExclusive">0</param> + <param name="maxInclusive">400</param> + <message>validator.targetCatch.bound.weight##${minExclusive}##${maxInclusive}</message> + </field-validator> + + </field> + +</validators> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit 97e54dbe585ee1d1047eb832ff381c7063df1fe3 Merge: 7b5fa43 250352f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 19 15:12:33 2015 +0200 Merge branch 'feature/7604' into develop .../ui/content/table/impl/seine/TargetCatchUI.jaxx | 17 +- .../table/impl/seine/TargetCatchUIHandler.java | 309 +++++---------------- .../table/impl/seine/TargetCatchUIModel.java | 48 ++-- ...neTargetCatchDto-n1-update-error-validation.xml | 41 +++ ...hDto-n1-update-targetCatch-error-validation.xml | 91 ++++++ ...to-n1-update-targetCatch-warning-validation.xml | 40 +++ .../v1/seine/TargetCatchServiceController.java | 5 +- .../ird/observe/entities/seine/TargetCatchs.java | 20 ++ .../ird/observe/entities/seine/TargetLenghts.java | 20 ++ .../services/service/seine/TargetCatchService.java | 3 +- .../src/main/xmi/observe-services-dto-seine.zargo | Bin 61137 -> 61190 bytes .../services/dto/ObserveDtosInitializer.java | 2 +- .../service/seine/SchoolEstimateServiceTopia.java | 5 + .../service/seine/TargetCatchServiceTopia.java | 119 ++++++++ 14 files changed, 452 insertions(+), 268 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm