Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: d9cd7d7e by Tony CHEMIT at 2018-05-08T21:28:00Z Improve FOB Form (when creating) - See #948) - - - - - 12 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUI.jcss - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIModel.java - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeNode.java - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeTableModel.java - persistence/src/main/resources/db/migration/7.2/01_update_objectMaterial-common.sql - services-local/src/main/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocal.java - services-local/src/test/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocalTest.java - services/src/main/java/fr/ird/observe/services/service/data/seine/FloatingObjectService.java - test/src/main/resources/db/7.2/dataForTestLongline.sql.gz - test/src/main/resources/db/7.2/dataForTestSeine.sql.gz - test/src/main/resources/db/7.2/referentiel.sql.gz Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUI.jcss ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUI.jcss +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUI.jcss @@ -144,4 +144,5 @@ BeanComboBox { treeTableModel:{new FloatingObjectPartsTreeTableModel(getModel())}; treeCellRenderer:{new FloatingObjectPartLegendTreeCellRenderer()}; selectionMode:{ListSelectionModel.SINGLE_SELECTION}; + rootVisible:false; } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java @@ -22,6 +22,7 @@ package fr.ird.observe.client.ui.content.data.seine; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; import fr.ird.observe.client.ObserveSwingApplicationContext; import fr.ird.observe.client.db.ClientDataContext; import fr.ird.observe.client.db.ObserveSwingDataSource; @@ -45,6 +46,7 @@ import fr.ird.observe.dto.data.seine.FloatingObjectReference; import fr.ird.observe.dto.data.seine.ObjectMaterialHierarchyDto; import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.referential.seine.ObjectMaterialDto; +import fr.ird.observe.dto.referential.seine.ObjectMaterialTypeReference; import fr.ird.observe.dto.referential.seine.ObjectOperationReference; import fr.ird.observe.dto.result.SaveResultDto; import fr.ird.observe.services.service.actions.consolidate.dcp.ConsolidateFloatingObjectRequest; @@ -187,7 +189,7 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, getModel().reset(); - openTable(partsSet, getUi().getTable()); + openTable(partsSet, getUi().getTable(),bean.isPersisted()); setContentMode(mode); @@ -209,7 +211,7 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, SwingUtilities.invokeLater(this::forceGrabFocusOnForm); } - private void openTable(Set<FloatingObjectPartReference> partsSet, JXTreeTable table) { + private void openTable(Set<FloatingObjectPartReference> partsSet, JXTreeTable table, boolean persisted) { FloatingObjectUIModel model = getModel(); for (FloatingObjectPartReference p : partsSet) { @@ -227,7 +229,9 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, FloatingObjectPartsTreeTableModel treeTableModel = (FloatingObjectPartsTreeTableModel) table.getTreeTableModel(); treeTableModel.reset(); - table.expandAll(); + if (persisted) { + table.expandAll(); + } } @Override @@ -322,10 +326,15 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, // listen messages to see if required to add ui.getErrorTableModel().addTableModelListener(computeTabValidStateListener); - List<ObjectMaterialHierarchyDto> detailedForm = getFloatingObjectService().getObjectMaterialHierarchy(); + ObjectMaterialHierarchyDto detailedForm = getFloatingObjectService().getObjectMaterialHierarchy(); + + ObjectMaterialTypeReference booleanType = getReferentialReferences(ObjectMaterialTypeReference.class).stream().filter(e->e.getTopiaId().equals("fr.ird.observe.entities.referentiel.seine.ObjectMaterialType#0#0")).findFirst().orElseThrow(IllegalStateException::new); + for (ObjectMaterialHierarchyDto objectMaterialHierarchyDto : detailedForm.getChildren()) { + objectMaterialHierarchyDto.setObjectMaterialType(booleanType); + } Map<String, ObjectMaterialDto> allMap = new TreeMap<>(); - detailedForm.stream().flatMap(o -> o.getAllDtos().stream()).forEach(s -> allMap.putIfAbsent(s.getId(), s)); + detailedForm.getAllDtos().forEach(s -> allMap.putIfAbsent(s.getId(), s)); FloatingObjectUIModel model = getModel(); model.setReferentialMap(allMap); @@ -386,7 +395,7 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, treeModel.reset(); } - private void initTable(List<ObjectMaterialHierarchyDto> materials, JXTreeTable table) { + private void initTable(ObjectMaterialHierarchyDto materials, JXTreeTable table) { FloatingObjectPartsTreeTableModel treeModel = (FloatingObjectPartsTreeTableModel) table.getTreeTableModel(); treeModel.rebuildRootNode(materials); ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIModel.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIModel.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIModel.java @@ -120,6 +120,10 @@ public class FloatingObjectUIModel extends ContentUIModel<FloatingObjectDto> { ImmutableSet<FloatingObjectPartDto> toParts() { ImmutableSet.Builder<FloatingObjectPartDto> result = ImmutableSet.builder(); for (ObjectMaterialDto o : getAll()) { + if (o.getParent()!=null && o.getParent().getParentId()==null) { + // first level node, can't be send + continue; + } FloatingObjectPartDto partDto = new FloatingObjectPartDto(); partDto.setObjectMaterial(binder.toReference(referentialLocale, o)); if (arriving) { ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeNode.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeNode.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeNode.java @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.seine.dcp; * 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>. @@ -34,7 +34,6 @@ import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.Iterator; -import java.util.List; import java.util.Objects; import java.util.Optional; @@ -48,137 +47,6 @@ public class FloatingObjectPartsTreeNode extends AbstractMutableTreeTableNode im /** Logger. */ private static final Log log = LogFactory.getLog(FloatingObjectPartsTreeNode.class); - static FloatingObjectPartsTreeNode createRoot(FloatingObjectUIModel model, List<ObjectMaterialHierarchyDto> referential) { - FloatingObjectPartsTreeNodeContext rootModel = new FloatingObjectPartsTreeNodeContext(model); - FloatingObjectPartsTreeNode root = new FloatingObjectPartsTreeNode(rootModel); - if (referential != null) { - for (ObjectMaterialHierarchyDto dto : referential) { - FloatingObjectPartsTreeNodeContext childModel = new FloatingObjectPartsTreeNodeContext(dto, rootModel); - FloatingObjectPartsTreeNode node = new FloatingObjectPartsTreeNode(childModel); - root.add(node); - ImmutableSet.Builder<FloatingObjectPartsTreeNode> companionsBuilder = dto.isChildrenMultiSelectable() ? ImmutableSet.builder() : null; - node.computeCompanions(companionsBuilder); - node.setCompanions(companionsBuilder); - } - } - return root; - } - - boolean isNotValid() { - return !(getUserObject().validWhenArriving && getUserObject().validWhenLeaving); - } - - private static class FloatingObjectPartsTreeNodeContext { - - // main model to get and store values - private final FloatingObjectUIModel uiModel; - // dto (null for root) - private final ObjectMaterialHierarchyDto dto; - // Is the node is enabled (hierarchic value) ? - private final boolean enabled; - // Is this node editable ? - private final boolean editable; - // Is this node need at least one child selected ? - private final boolean needOneSelection; - // Is this node in the path of at least one mandatory child ancestor ? - private final boolean mandatory; - // Is the node is exclusive (means only one value possible for him and his brothers) ? - private final boolean exclusive; - // Is the node valid for whenArriving column ? - private boolean validWhenArriving = true; - // Is the node valid for whenLeaving column ? - private boolean validWhenLeaving = true; - // Set of brothers of this node that is in a exclusive group of node (only one value among all of them) - private ImmutableSet<FloatingObjectPartsTreeNode> companions; - // Internal to store debug node text - private String text; - - FloatingObjectPartsTreeNodeContext(FloatingObjectUIModel uiModel) { - Objects.requireNonNull(uiModel); - this.uiModel = uiModel; - this.dto = null; - this.enabled = true; - this.editable = false; - this.mandatory = false; - this.exclusive = false; - this.needOneSelection = false; - } - - FloatingObjectPartsTreeNodeContext(ObjectMaterialHierarchyDto dto, FloatingObjectPartsTreeNodeContext parent) { - Objects.requireNonNull(dto); - Objects.requireNonNull(parent); - this.uiModel = parent.uiModel; - this.dto = dto; - // enabled if parent is enabled and dto is enabled - this.enabled = parent.enabled && dto.isEnabled(); - // need one selection if is enabled and dto requires it - this.needOneSelection = enabled && dto.isChildSelectionMandatory(); - // editable if dto is selectable (we also make sure that the object material type is here too) - this.editable = dto.isSelectable() && dto.getObjectMaterialType() != null; - // mandatory if enabled parent is so or parent makes this child to be - this.mandatory = parent.mandatory || parent.needOneSelection; - // exclusive if his parent requires it - this.exclusive = parent.dto != null && parent.dto.isChildrenMultiSelectable(); - log.info(String.format("New node: %s - mandatory %s - needOneSelection %s - exclusive %s", dto.getLabel2(), mandatory, needOneSelection, exclusive)); - } - - Object getValueAt(int column) { - switch (column) { - case 0: // dto - return dto; - case 1: // when arriving - return uiModel.getWhenArriving().get(dto); - case 2: // when leaving - return uiModel.getWhenLeaving().get(dto); - } - throw new IllegalStateException(); - } - - void setValueAt(Object aValue, int column) { - switch (column) { - case 1: // when arriving - uiModel.setWhenArriving(dto.getId(), aValue == null ? null : String.valueOf(aValue)); - return; - case 2: // when leaving - uiModel.setWhenLeaving(dto.getId(), aValue == null ? null : String.valueOf(aValue)); - return; - } - throw new IllegalStateException(); - } - - boolean isColumnEditable(int column) { - switch (column) { - case 1: // when arriving - return uiModel.isArriving(); - case 2: // when leaving - return uiModel.isLeaving(); - } - throw new IllegalStateException(); - } - - boolean isValid(int column) { - switch (column) { - case 1: // when arriving - return validWhenArriving; - case 2: // when leaving - return validWhenLeaving; - } - throw new IllegalStateException(); - } - - Optional<FloatingObjectPartsTreeNode> getSelectedCompanion(int column) { - return companions.stream().filter(n -> n.getValueAt(column) != null).findFirst(); - } - - public String getText() { - if (text == null && dto != null) { - text = String.format("%s [value: %s-%s] [valid: %s-%s]", dto.getLabel2(), getValueAt(1), getValueAt(2), isValid(1), isValid(2)); - } - return text; - } - - } - private FloatingObjectPartsTreeNode(FloatingObjectPartsTreeNodeContext context) { super(context); if (context.dto != null) { @@ -189,6 +57,25 @@ public class FloatingObjectPartsTreeNode extends AbstractMutableTreeTableNode im } } + static FloatingObjectPartsTreeNode createRoot(FloatingObjectUIModel model, ObjectMaterialHierarchyDto dto) { + FloatingObjectPartsTreeNode root; + FloatingObjectPartsTreeNodeContext rootModel = new FloatingObjectPartsTreeNodeContext(model); + if (dto != null) { + FloatingObjectPartsTreeNodeContext childModel = new FloatingObjectPartsTreeNodeContext(dto, rootModel); + root = new FloatingObjectPartsTreeNode(childModel); + ImmutableSet.Builder<FloatingObjectPartsTreeNode> companionsBuilder = dto.isChildrenMultiSelectable() ? ImmutableSet.builder() : null; + root.computeCompanions(companionsBuilder); + root.setCompanions(companionsBuilder); + } else { + root = new FloatingObjectPartsTreeNode(rootModel); + } + return root; + } + + boolean isNotValid() { + return !(getUserObject().validWhenArriving && getUserObject().validWhenLeaving); + } + @Override public String toString() { return getUserObject().getText(); @@ -395,4 +282,116 @@ public class FloatingObjectPartsTreeNode extends AbstractMutableTreeTableNode im } setCompanions(childCompanionsBuilder); } + + private static class FloatingObjectPartsTreeNodeContext { + + // main model to get and store values + private final FloatingObjectUIModel uiModel; + // dto (null for root) + private final ObjectMaterialHierarchyDto dto; + // Is the node is enabled (hierarchic value) ? + private final boolean enabled; + // Is this node editable ? + private final boolean editable; + // Is this node need at least one child selected ? + private final boolean needOneSelection; + // Is this node in the path of at least one mandatory child ancestor ? + private final boolean mandatory; + // Is the node is exclusive (means only one value possible for him and his brothers) ? + private final boolean exclusive; + // Is the node valid for whenArriving column ? + private boolean validWhenArriving = true; + // Is the node valid for whenLeaving column ? + private boolean validWhenLeaving = true; + // Set of brothers of this node that is in a exclusive group of node (only one value among all of them) + private ImmutableSet<FloatingObjectPartsTreeNode> companions; + // Internal to store debug node text + private String text; + + FloatingObjectPartsTreeNodeContext(FloatingObjectUIModel uiModel) { + Objects.requireNonNull(uiModel); + this.uiModel = uiModel; + this.dto = null; + this.enabled = true; + this.editable = false; + this.mandatory = false; + this.exclusive = false; + this.needOneSelection = false; + } + + FloatingObjectPartsTreeNodeContext(ObjectMaterialHierarchyDto dto, FloatingObjectPartsTreeNodeContext parent) { + Objects.requireNonNull(dto); + Objects.requireNonNull(parent); + this.uiModel = parent.uiModel; + this.dto = dto; + // enabled if parent is enabled and dto is enabled + this.enabled = parent.enabled && dto.isEnabled(); + // need one selection if is enabled and dto requires it + this.needOneSelection = enabled && dto.isChildSelectionMandatory(); + // editable if dto is selectable (we also make sure that the object material type is here too) + this.editable = dto.isSelectable() && dto.getObjectMaterialType() != null; + + // mandatory if enabled parent is so or parent makes this child to be + this.mandatory = parent.mandatory || parent.needOneSelection; + // exclusive if his parent requires it + this.exclusive = parent.dto != null && parent.dto.isChildrenMultiSelectable(); + log.info(String.format("New node: %s - mandatory %s - needOneSelection %s - exclusive %s", dto.getLabel2(), mandatory, needOneSelection, exclusive)); + } + + Object getValueAt(int column) { + switch (column) { + case 0: // dto + return dto; + case 1: // when arriving + return uiModel.getWhenArriving().get(dto); + case 2: // when leaving + return uiModel.getWhenLeaving().get(dto); + } + throw new IllegalStateException(); + } + + void setValueAt(Object aValue, int column) { + switch (column) { + case 1: // when arriving + uiModel.setWhenArriving(dto.getId(), aValue == null ? null : String.valueOf(aValue)); + return; + case 2: // when leaving + uiModel.setWhenLeaving(dto.getId(), aValue == null ? null : String.valueOf(aValue)); + return; + } + throw new IllegalStateException(); + } + + boolean isColumnEditable(int column) { + switch (column) { + case 1: // when arriving + return uiModel.isArriving(); + case 2: // when leaving + return uiModel.isLeaving(); + } + throw new IllegalStateException(); + } + + boolean isValid(int column) { + switch (column) { + case 1: // when arriving + return validWhenArriving; + case 2: // when leaving + return validWhenLeaving; + } + throw new IllegalStateException(); + } + + Optional<FloatingObjectPartsTreeNode> getSelectedCompanion(int column) { + return companions.stream().filter(n -> n.getValueAt(column) != null).findFirst(); + } + + public String getText() { + if (text == null && dto != null) { + text = String.format("%s [value: %s-%s] [valid: %s-%s]", dto.getLabel2(), getValueAt(1), getValueAt(2), isValid(1), isValid(2)); + } + return text; + } + + } } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeTableModel.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeTableModel.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/dcp/FloatingObjectPartsTreeTableModel.java @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.seine.dcp; * 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>. @@ -32,8 +32,6 @@ import org.jdesktop.swingx.treetable.TreeTableNode; import org.nuiton.i18n.I18n; import java.util.Arrays; -import java.util.Collections; -import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -56,7 +54,7 @@ public class FloatingObjectPartsTreeTableModel extends DefaultTreeTableModel { private ImmutableSet<FloatingObjectPartsTreeNode> withValidationNodes; public FloatingObjectPartsTreeTableModel(FloatingObjectUIModel uiModel) { - super(FloatingObjectPartsTreeNode.createRoot(uiModel, Collections.emptyList()), Arrays.asList( + super(FloatingObjectPartsTreeNode.createRoot(uiModel, null), Arrays.asList( I18n.t("observe.common.FloatingObjectDto.table.type"), I18n.t("observe.common.whenArriving"), I18n.t("observe.common.whenLeaving"))); @@ -68,11 +66,6 @@ public class FloatingObjectPartsTreeTableModel extends DefaultTreeTableModel { return (FloatingObjectPartsTreeNode) super.getRoot(); } - public void rebuildRootNode(List<ObjectMaterialHierarchyDto> materials) { - FloatingObjectPartsTreeNode root = FloatingObjectPartsTreeNode.createRoot(uiModel, materials); - setRoot(root); - } - @Override public void setRoot(TreeTableNode root) { super.setRoot(root); @@ -91,6 +84,10 @@ public class FloatingObjectPartsTreeTableModel extends DefaultTreeTableModel { withValidationNodes = ImmutableSet.copyOf(allNodes.stream().filter(FloatingObjectPartsTreeNode::withValidation).collect(Collectors.toSet())); } + public void rebuildRootNode(ObjectMaterialHierarchyDto materials) { + FloatingObjectPartsTreeNode root = FloatingObjectPartsTreeNode.createRoot(uiModel, materials); + setRoot(root); + } @Override public int getColumnCount() { ===================================== persistence/src/main/resources/db/migration/7.2/01_update_objectMaterial-common.sql ===================================== --- a/persistence/src/main/resources/db/migration/7.2/01_update_objectMaterial-common.sql +++ b/persistence/src/main/resources/db/migration/7.2/01_update_objectMaterial-common.sql @@ -109,3 +109,4 @@ update observe_seine.objectmaterial set validation='x.length() >= 3 && x.length( INSERT INTO observe_seine.objectMaterial (topiaid, topiaversion, topiacreatedate, lastupdatedate, needComment, status, legacyCode, standardCode, code, parent, label1, label2, label3, selectable, childrenMultiSelectable, childSelectionMandatory, objectMaterialType, validation, biodegradable, nonEntangling) values ('fr.ird.observe.entities.referentiel.seine.ObjectMaterial#0#1.3', 0, CURRENT_DATE, CURRENT_TIMESTAMP, false, 1, NULL, 'FOB', '' , null , 'FOB', 'FOB', 'FOB', false, true , true, NULL, NULL, false, false); UPDATE observe_seine.objectmaterial SET parent='fr.ird.observe.entities.referentiel.seine.ObjectMaterial#0#1.3' WHERE parent IS NULL; UPDATE observe_seine.objectmaterial SET parent= NULL WHERE topiaid='fr.ird.observe.entities.referentiel.seine.ObjectMaterial#0#1.3'; +UPDATE observe_seine.objectmaterial SET SELECTABLE = TRUE WHERE parent='fr.ird.observe.entities.referentiel.seine.ObjectMaterial#0#1.3' and status = '1'; \ No newline at end of file ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocal.java ===================================== --- a/services-local/src/main/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocal.java +++ b/services-local/src/main/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocal.java @@ -74,12 +74,11 @@ public class FloatingObjectServiceLocal extends ObserveServiceLocal implements F private static final Set<String> FOB_OBSERVED_SYSTEM_EXCLUDE_OPERATIONS = ImmutableSet.of("fr.ird.observe.entities.referentiel.seine.ObjectOperation#0#10", "fr.ird.observe.entities.referentiel.seine.ObjectOperation#0#1"); @Override - public List<ObjectMaterialHierarchyDto> getObjectMaterialHierarchy() { + public ObjectMaterialHierarchyDto getObjectMaterialHierarchy() { ObjectMaterialTopiaDao dao = getTopiaPersistenceContext().getObjectMaterialDao(); List<ObjectMaterial> objectMaterials = dao.findAll(); objectMaterials.sort(Comparator.comparing(ObjectMaterial::getCode)); - List<ObjectMaterialHierarchyDto> rootNode = getObjectMaterialHierarchyDtos(objectMaterials); - return rootNode.get(0).getChildren(); + return getObjectMaterialHierarchyDtos(objectMaterials).get(0); } @Override ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocalTest.java ===================================== --- a/services-local/src/test/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocalTest.java +++ b/services-local/src/test/java/fr/ird/observe/services/local/service/data/seine/FloatingObjectServiceLocalTest.java @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.data.seine; * 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>. @@ -27,7 +27,6 @@ import fr.ird.observe.services.local.service.ServiceLocalTestSupport; import fr.ird.observe.services.service.data.seine.FloatingObjectService; import fr.ird.observe.test.DatabaseName; import fr.ird.observe.test.spi.DatabaseNameConfiguration; -import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -50,9 +49,8 @@ public class FloatingObjectServiceLocalTest extends ServiceLocalTestSupport { @Test public void getObjectMaterialHierarchy() { - List<ObjectMaterialHierarchyDto> form = service.getObjectMaterialHierarchy(); + ObjectMaterialHierarchyDto form = service.getObjectMaterialHierarchy(); Assert.assertNotNull(form); - Assert.assertEquals(4, form.size()); } ===================================== services/src/main/java/fr/ird/observe/services/service/data/seine/FloatingObjectService.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/data/seine/FloatingObjectService.java +++ b/services/src/main/java/fr/ird/observe/services/service/data/seine/FloatingObjectService.java @@ -40,8 +40,6 @@ import io.ultreia.java4all.http.spi.Delete; import io.ultreia.java4all.http.spi.Get; import io.ultreia.java4all.http.spi.Post; -import java.util.List; - /** * @author Tony Chemit - dev@tchemit.fr */ @@ -49,7 +47,7 @@ public interface FloatingObjectService extends ObserveService { @Get @ReadReferentialPermission - List<ObjectMaterialHierarchyDto> getObjectMaterialHierarchy(); + ObjectMaterialHierarchyDto getObjectMaterialHierarchy(); @Get @ReadDataPermission ===================================== test/src/main/resources/db/7.2/dataForTestLongline.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.2/dataForTestLongline.sql.gz and b/test/src/main/resources/db/7.2/dataForTestLongline.sql.gz differ ===================================== test/src/main/resources/db/7.2/dataForTestSeine.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.2/dataForTestSeine.sql.gz and b/test/src/main/resources/db/7.2/dataForTestSeine.sql.gz differ ===================================== test/src/main/resources/db/7.2/referentiel.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.2/referentiel.sql.gz and b/test/src/main/resources/db/7.2/referentiel.sql.gz differ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/d9cd7d7e6d4e059073a0b42ad367... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/d9cd7d7e6d4e059073a0b42ad367... You're receiving this email because of your account on gitlab.com.