Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
26 changed files:
- client-core/src/main/i18n/getters/java.getter
- client-core/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/content/api/data/edit/SaveEditDataUIActionSupport.java
- + client-core/src/main/java/fr/ird/observe/client/ui/actions/content/data/longline/add/AddActivityLonglineLogbookSampleUIAction.java
- + client-core/src/main/java/fr/ird/observe/client/ui/actions/content/data/longline/delete/DeleteSampleLonglineLogbookUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/content/data/longline/save/SaveActivityLonglineLogbookSampleUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUI.jaxx
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUI.jcss
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIHandler.java
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIModel.java
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookUI.jaxx
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookUI.jcss
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/SamplePartLogbookUIHandler.java
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/SamplePartLogbookUIModel.java
- client-core/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java
- client-core/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/logbook/ActivityLonglineLogbookNavigationTreeNode.java
- dto/src/main/java/fr/ird/observe/dto/data/longline/ActivityLonglineLogbookDto.java
- observe-i18n/src/main/i18n/translations/observe_en_GB.properties
- observe-i18n/src/main/i18n/translations/observe_es_ES.properties
- observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
- server-core/src/main/filtered-resources/mapping
- services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/ActivityLonglineLogbookSampleServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/ActivityLonglineLogbookServiceLocal.java
- services/src/main/java/fr/ird/observe/services/service/data/longline/ActivityLonglineLogbookSampleService.java
- validation/src/main/resources/fr/ird/observe/dto/data/longline/SetLonglineLogbookDto-create-error-validation.xml
- validation/src/main/resources/fr/ird/observe/dto/data/longline/SetLonglineLogbookDto-update-error-validation.xml
Changes:
| ... | ... | @@ -289,6 +289,8 @@ observe.common.ActivityDto.action.goToOpen.short |
| 289 | 289 |
observe.common.ActivityDto.action.goToOpen.tip
|
| 290 | 290 |
observe.common.ActivityLogbookDto.action.goToOpen.short
|
| 291 | 291 |
observe.common.ActivityLogbookDto.action.goToOpen.tip
|
| 292 |
+observe.common.ActivityLonglineLogbookDto.action.addSample
|
|
| 293 |
+observe.common.ActivityLonglineLogbookDto.action.addSample.tip
|
|
| 292 | 294 |
observe.common.ActivityLonglineLogbookDto.action.addSet
|
| 293 | 295 |
observe.common.ActivityLonglineLogbookDto.action.addSet.tip
|
| 294 | 296 |
observe.common.ActivityLonglineLogbookDto.action.chooseRelatedObservedActivity
|
| ... | ... | @@ -94,6 +94,7 @@ public abstract class ObserveKeyStrokes { |
| 94 | 94 |
public static final KeyStroke KEY_STROKE_GO_DOWN = KeyStroke.getKeyStroke("alt pressed D");
|
| 95 | 95 |
public static final KeyStroke KEY_STROKE_ADD_DCP = KeyStroke.getKeyStroke("ctrl pressed P");
|
| 96 | 96 |
public static final KeyStroke KEY_STROKE_ADD_SET_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed L");
|
| 97 |
+ public static final KeyStroke KEY_STROKE_ADD_SAMPLE_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed M");
|
|
| 97 | 98 |
public static final KeyStroke KEY_STROKE_GO_UP = KeyStroke.getKeyStroke("alt pressed U");
|
| 98 | 99 |
public static final KeyStroke KEY_STROKE_EDIT_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed M");
|
| 99 | 100 |
public static final KeyStroke KEY_STROKE_DETAIL_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed D");
|
| ... | ... | @@ -40,6 +40,7 @@ import fr.ird.observe.navigation.tree.MultipleReferenceContainerNode; |
| 40 | 40 |
import fr.ird.observe.navigation.tree.ReferenceNode;
|
| 41 | 41 |
import fr.ird.observe.navigation.tree.SingleReferenceContainerNode;
|
| 42 | 42 |
import fr.ird.observe.spi.DtoModelHelper;
|
| 43 |
+import org.jetbrains.annotations.NotNull;
|
|
| 43 | 44 |
import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
|
| 44 | 45 |
|
| 45 | 46 |
import javax.swing.KeyStroke;
|
| ... | ... | @@ -93,14 +94,7 @@ public abstract class SaveEditDataUIActionSupport<D extends DataDto, R extends D |
| 93 | 94 |
ReferenceNode<D, R> node = model.getReferenceNode(tree);
|
| 94 | 95 |
|
| 95 | 96 |
NavigationTreeNodeSupport parent = (NavigationTreeNodeSupport) node.getParent();
|
| 96 |
- Function<R, ReferenceNode<D, R>> nodeFactory;
|
|
| 97 |
- if (parent instanceof SingleReferenceContainerNode) {
|
|
| 98 |
- //noinspection unchecked
|
|
| 99 |
- nodeFactory = ((SingleReferenceContainerNode) parent)::newSingleChildNode;
|
|
| 100 |
- } else {
|
|
| 101 |
- //noinspection unchecked
|
|
| 102 |
- nodeFactory = ((MultipleReferenceContainerNode) parent)::newChildNode;
|
|
| 103 |
- }
|
|
| 97 |
+ Function<R, ReferenceNode<D, R>> nodeFactory = getNodeFactory(parent);
|
|
| 104 | 98 |
|
| 105 | 99 |
ReferentialLocale referentialLocale = ObserveSwingApplicationContext.get().getDecoratorService().getReferentialLocale();
|
| 106 | 100 |
|
| ... | ... | @@ -132,5 +126,18 @@ public abstract class SaveEditDataUIActionSupport<D extends DataDto, R extends D |
| 132 | 126 |
// afterSave(ui, bean, node, notPersisted);
|
| 133 | 127 |
}
|
| 134 | 128 |
|
| 129 |
+ @NotNull
|
|
| 130 |
+ protected Function<R, ReferenceNode<D, R>> getNodeFactory(NavigationTreeNodeSupport parent) {
|
|
| 131 |
+ Function<R, ReferenceNode<D, R>> nodeFactory;
|
|
| 132 |
+ if (parent instanceof SingleReferenceContainerNode) {
|
|
| 133 |
+ //noinspection unchecked
|
|
| 134 |
+ nodeFactory = ((SingleReferenceContainerNode) parent)::newSingleChildNode;
|
|
| 135 |
+ } else {
|
|
| 136 |
+ //noinspection unchecked
|
|
| 137 |
+ nodeFactory = ((MultipleReferenceContainerNode) parent)::newChildNode;
|
|
| 138 |
+ }
|
|
| 139 |
+ return nodeFactory;
|
|
| 140 |
+ }
|
|
| 141 |
+ |
|
| 135 | 142 |
}
|
| 136 | 143 |
|
| 1 |
+package fr.ird.observe.client.ui.actions.content.data.longline.add;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client core
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import fr.ird.observe.client.ui.ObserveKeyStrokes;
|
|
| 26 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 27 |
+import fr.ird.observe.client.ui.actions.content.api.AbstractContentUIAction;
|
|
| 28 |
+import fr.ird.observe.client.ui.content.api.ContentUI;
|
|
| 29 |
+import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookUI;
|
|
| 30 |
+import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
| 31 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.longline.logbook.ActivityLonglineLogbookNavigationTreeNode;
|
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.longline.logbook.ActivityLonglineSampleLogbookNavigationTreeNode;
|
|
| 33 |
+import fr.ird.observe.dto.data.longline.ActivityLonglineLogbookDto;
|
|
| 34 |
+import fr.ird.observe.dto.data.longline.SampleLogbookDto;
|
|
| 35 |
+import fr.ird.observe.dto.data.longline.SampleLogbookReference;
|
|
| 36 |
+ |
|
| 37 |
+import static fr.ird.observe.client.ui.content.api.ContentUIHandler.getNavigationTree;
|
|
| 38 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 39 |
+ |
|
| 40 |
+/**
|
|
| 41 |
+ * Created by tchemit on 19/11/2018.
|
|
| 42 |
+ *
|
|
| 43 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 44 |
+ */
|
|
| 45 |
+public class AddActivityLonglineLogbookSampleUIAction extends AbstractContentUIAction {
|
|
| 46 |
+ |
|
| 47 |
+ public static final String ACTION_NAME = AddActivityLonglineLogbookSampleUIAction.class.getName();
|
|
| 48 |
+ |
|
| 49 |
+ public AddActivityLonglineLogbookSampleUIAction(ObserveMainUI mainUI) {
|
|
| 50 |
+ super(mainUI, ACTION_NAME, t("observe.common.ActivityLonglineLogbookDto.action.addSample"), t("observe.common.ActivityLonglineLogbookDto.action.addSample.tip"), "add", ObserveKeyStrokes.KEY_STROKE_ADD_SAMPLE_LONGLINE);
|
|
| 51 |
+ }
|
|
| 52 |
+ |
|
| 53 |
+ @Override
|
|
| 54 |
+ protected void actionPerformed(ContentUI contentUI) {
|
|
| 55 |
+ NavigationTree tree = getNavigationTree();
|
|
| 56 |
+ ActivityLonglineLogbookNavigationTreeNode parentNode = (ActivityLonglineLogbookNavigationTreeNode) tree.getSelectedNode();
|
|
| 57 |
+ ActivityLonglineLogbookUI ui = (ActivityLonglineLogbookUI) contentUI;
|
|
| 58 |
+ ActivityLonglineLogbookDto bean = ui.getBean();
|
|
| 59 |
+ ActivityLonglineSampleLogbookNavigationTreeNode childNode = parentNode.newSampleChildNode(new SampleLogbookReference(new SampleLogbookDto(),
|
|
| 60 |
+ bean.getTimeStamp(),
|
|
| 61 |
+ bean.getLatitude(),
|
|
| 62 |
+ bean.getLongitude()));
|
|
| 63 |
+ tree.addUnsavedNode(parentNode, childNode);
|
|
| 64 |
+ }
|
|
| 65 |
+}
|
| 1 |
+package fr.ird.observe.client.ui.actions.content.data.longline.delete;
|
|
| 2 |
+ |
|
| 3 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 4 |
+import fr.ird.observe.client.ui.actions.content.api.data.edit.DeleteEditDataUIActionSupport;
|
|
| 5 |
+import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookSampleUI;
|
|
| 6 |
+import fr.ird.observe.dto.data.longline.SampleLogbookDto;
|
|
| 7 |
+import fr.ird.observe.dto.data.longline.SampleLogbookReference;
|
|
| 8 |
+import fr.ird.observe.navigation.model.edit.ObserveEditNode;
|
|
| 9 |
+ |
|
| 10 |
+import static fr.ird.observe.client.ui.ObserveKeyStrokes.KEY_STROKE_DELETE_DATA_GLOBAL;
|
|
| 11 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 12 |
+ |
|
| 13 |
+/**
|
|
| 14 |
+ * Created by tchemit on 19/11/2018.
|
|
| 15 |
+ *
|
|
| 16 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 17 |
+ */
|
|
| 18 |
+public class DeleteSampleLonglineLogbookUIAction extends DeleteEditDataUIActionSupport<SampleLogbookDto, SampleLogbookReference, ActivityLonglineLogbookSampleUI> {
|
|
| 19 |
+ |
|
| 20 |
+ public static final String ACTION_NAME = DeleteSampleLonglineLogbookUIAction.class.getName();
|
|
| 21 |
+ |
|
| 22 |
+ public DeleteSampleLonglineLogbookUIAction(ObserveMainUI mainUI) {
|
|
| 23 |
+ super(mainUI, ACTION_NAME, n("observe.action.delete.tip"), KEY_STROKE_DELETE_DATA_GLOBAL);
|
|
| 24 |
+ }
|
|
| 25 |
+ |
|
| 26 |
+ @Override
|
|
| 27 |
+ protected void doDelete(ActivityLonglineLogbookSampleUI ui, SampleLogbookDto bean, ObserveEditNode<?> parentEditNode) {
|
|
| 28 |
+ String parentId = parentEditNode.getId();
|
|
| 29 |
+ getServicesProvider().getActivityLonglineLogbookSampleService().delete(parentId, bean.getId());
|
|
| 30 |
+ }
|
|
| 31 |
+ |
|
| 32 |
+}
|
| ... | ... | @@ -24,18 +24,25 @@ package fr.ird.observe.client.ui.actions.content.data.longline.save; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ui.ObserveKeyStrokes;
|
| 26 | 26 |
import fr.ird.observe.client.ui.ObserveMainUI;
|
| 27 |
-import fr.ird.observe.client.ui.actions.content.api.data.simple.SaveSimpleDataUIActionSupport;
|
|
| 27 |
+import fr.ird.observe.client.ui.actions.content.api.data.edit.SaveEditDataUIActionSupport;
|
|
| 28 | 28 |
import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookSampleUI;
|
| 29 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 30 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.longline.logbook.ActivityLonglineLogbookNavigationTreeNode;
|
|
| 29 | 31 |
import fr.ird.observe.dto.data.longline.SampleLogbookDto;
|
| 32 |
+import fr.ird.observe.dto.data.longline.SampleLogbookReference;
|
|
| 30 | 33 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 31 | 34 |
import fr.ird.observe.navigation.model.edit.ObserveEditNode;
|
| 35 |
+import fr.ird.observe.navigation.tree.ReferenceNode;
|
|
| 36 |
+import org.jetbrains.annotations.NotNull;
|
|
| 37 |
+ |
|
| 38 |
+import java.util.function.Function;
|
|
| 32 | 39 |
|
| 33 | 40 |
/**
|
| 34 | 41 |
* Created by tchemit on 28/09/2018.
|
| 35 | 42 |
*
|
| 36 | 43 |
* @author Tony Chemit - dev@tchemit.fr
|
| 37 | 44 |
*/
|
| 38 |
-public class SaveActivityLonglineLogbookSampleUIAction extends SaveSimpleDataUIActionSupport<SampleLogbookDto, ActivityLonglineLogbookSampleUI> {
|
|
| 45 |
+public class SaveActivityLonglineLogbookSampleUIAction extends SaveEditDataUIActionSupport<SampleLogbookDto, SampleLogbookReference, ActivityLonglineLogbookSampleUI> {
|
|
| 39 | 46 |
|
| 40 | 47 |
public static final String ACTION_NAME = SaveActivityLonglineLogbookSampleUIAction.class.getName();
|
| 41 | 48 |
|
| ... | ... | @@ -44,16 +51,16 @@ public class SaveActivityLonglineLogbookSampleUIAction extends SaveSimpleDataUIA |
| 44 | 51 |
}
|
| 45 | 52 |
|
| 46 | 53 |
@Override
|
| 47 |
- protected boolean doSave(ActivityLonglineLogbookSampleUI ui, SampleLogbookDto bean, ObserveEditNode<?> parentEditNode) {
|
|
| 54 |
+ protected boolean doSave(ActivityLonglineLogbookSampleUI ui, SampleLogbookDto bean, ObserveEditNode<?> parentEditNode, boolean notPersisted) {
|
|
| 48 | 55 |
bean.setSamplePartLogbook(ui.getSamplePartLogbookModel().getBean().getSamplePartLogbook());
|
| 49 |
- SaveResultDto saveResult = getServicesProvider().getActivityLonglineLogbookSampleService().save(bean);
|
|
| 56 |
+ String parentId = parentEditNode.getId();
|
|
| 57 |
+ SaveResultDto saveResult = getServicesProvider().getActivityLonglineLogbookSampleService().save(parentId, bean);
|
|
| 50 | 58 |
saveResult.toDto(bean);
|
| 51 | 59 |
return true;
|
| 52 | 60 |
}
|
| 53 | 61 |
|
| 54 | 62 |
@Override
|
| 55 |
- protected void afterSave(ActivityLonglineLogbookSampleUI ui, SampleLogbookDto bean) {
|
|
| 56 |
- super.afterSave(ui, bean);
|
|
| 57 |
- ui.getSamplePartLogbookUI().resetEdit();
|
|
| 63 |
+ protected @NotNull Function<SampleLogbookReference, ReferenceNode<SampleLogbookDto, SampleLogbookReference>> getNodeFactory(NavigationTreeNodeSupport parent) {
|
|
| 64 |
+ return ((ActivityLonglineLogbookNavigationTreeNode)parent)::newSampleChildNode;
|
|
| 58 | 65 |
}
|
| 59 | 66 |
}
|
| ... | ... | @@ -18,16 +18,18 @@ |
| 18 | 18 |
#L%
|
| 19 | 19 |
-->
|
| 20 | 20 |
|
| 21 |
-<fr.ird.observe.client.ui.content.api.data.simple.ContentSimpleUI
|
|
| 21 |
+<fr.ird.observe.client.ui.content.api.data.edit.ContentEditUI
|
|
| 22 | 22 |
i18n="fr.ird.observe.dto.data.longline.SampleLogbookDto"
|
| 23 |
- superGenericType='SampleLogbookDto, ActivityLonglineLogbookSampleUI'
|
|
| 23 |
+ superGenericType='SampleLogbookDto, SampleLogbookReference, ActivityLonglineLogbookSampleUI'
|
|
| 24 | 24 |
contentTitle='{n("observe.common.SampleLogbookDto.title")}'>
|
| 25 | 25 |
|
| 26 | 26 |
<style source="../../../Common.jcss"/>
|
| 27 | 27 |
|
| 28 | 28 |
<import>
|
| 29 | 29 |
fr.ird.observe.dto.data.longline.SampleLogbookDto
|
| 30 |
+ fr.ird.observe.dto.data.longline.SampleLogbookReference
|
|
| 30 | 31 |
|
| 32 |
+ fr.ird.observe.client.ui.actions.content.data.longline.delete.DeleteSampleLonglineLogbookUIAction
|
|
| 31 | 33 |
fr.ird.observe.client.ui.actions.content.data.longline.move.MoveSingleActivityLonglineSampleLogbookUIAction
|
| 32 | 34 |
fr.ird.observe.client.ui.actions.content.data.longline.save.SaveActivityLonglineLogbookSampleUIAction
|
| 33 | 35 |
fr.ird.observe.client.ui.util.JComment
|
| ... | ... | @@ -67,7 +69,8 @@ |
| 67 | 69 |
|
| 68 | 70 |
<JButton id='reset'/>
|
| 69 | 71 |
<JButton id='save'/>
|
| 70 |
- <Table id="actions" fill='both' weightx='1' insets='0'>
|
|
| 72 |
+ <JButton id='delete'/>
|
|
| 73 |
+ <Table id="extraActions" fill='both' weightx='1' insets='0'>
|
|
| 71 | 74 |
<row>
|
| 72 | 75 |
<cell weightx="0.5" fill="both">
|
| 73 | 76 |
<JButton id='move'/>
|
| ... | ... | @@ -77,4 +80,4 @@ |
| 77 | 80 |
<Object id="delegateContentUI" initializer="samplePartLogbookPanel"/>
|
| 78 | 81 |
<SamplePartLogbookUIModel id="samplePartLogbookModel" initializer="samplePartLogbookUI.getModel()" styleClass="contentTableStandalone"/>
|
| 79 | 82 |
|
| 80 |
-</fr.ird.observe.client.ui.content.api.data.simple.ContentSimpleUI>
|
|
| 83 |
+</fr.ird.observe.client.ui.content.api.data.edit.ContentEditUI>
|
| ... | ... | @@ -29,6 +29,15 @@ |
| 29 | 29 |
_observeAction:{SaveActivityLonglineLogbookSampleUIAction.ACTION_NAME};
|
| 30 | 30 |
}
|
| 31 | 31 |
|
| 32 |
+ |
|
| 33 |
+#delete {
|
|
| 34 |
+ _observeAction:{DeleteSampleLonglineLogbookUIAction.ACTION_NAME};
|
|
| 35 |
+}
|
|
| 36 |
+ |
|
| 37 |
+#extraActions {
|
|
| 38 |
+ visible:{!model.isReadingMode()};
|
|
| 39 |
+}
|
|
| 40 |
+ |
|
| 32 | 41 |
#comment {
|
| 33 | 42 |
title:"observe.common.TripLonglineSampleLogbookDto.comment";
|
| 34 | 43 |
}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -24,9 +24,10 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 26 | 26 |
import fr.ird.observe.client.ui.content.api.ContentMode;
|
| 27 |
-import fr.ird.observe.client.ui.content.api.data.simple.ContentSimpleUIHandler;
|
|
| 27 |
+import fr.ird.observe.client.ui.content.api.data.edit.ContentEditUIHandler;
|
|
| 28 | 28 |
import fr.ird.observe.client.ui.content.api.ui.ObserveLayoutFocusTraversalPolicy;
|
| 29 | 29 |
import fr.ird.observe.dto.data.longline.SampleLogbookDto;
|
| 30 |
+import fr.ird.observe.dto.data.longline.SampleLogbookReference;
|
|
| 30 | 31 |
import fr.ird.observe.dto.form.Form;
|
| 31 | 32 |
import org.apache.logging.log4j.LogManager;
|
| 32 | 33 |
import org.apache.logging.log4j.Logger;
|
| ... | ... | @@ -34,8 +35,6 @@ import org.nuiton.jaxx.runtime.spi.UIHandler; |
| 34 | 35 |
|
| 35 | 36 |
import java.awt.Component;
|
| 36 | 37 |
import java.awt.Container;
|
| 37 |
-import java.awt.GridBagConstraints;
|
|
| 38 |
-import java.awt.Insets;
|
|
| 39 | 38 |
|
| 40 | 39 |
/**
|
| 41 | 40 |
* Created on 12/5/14.
|
| ... | ... | @@ -43,7 +42,7 @@ import java.awt.Insets; |
| 43 | 42 |
* @author Tony Chemit - dev@tchemit.fr
|
| 44 | 43 |
* @since 3.8
|
| 45 | 44 |
*/
|
| 46 |
-public class ActivityLonglineLogbookSampleUIHandler extends ContentSimpleUIHandler<SampleLogbookDto, ActivityLonglineLogbookSampleUI> implements UIHandler<ActivityLonglineLogbookSampleUI> {
|
|
| 45 |
+public class ActivityLonglineLogbookSampleUIHandler extends ContentEditUIHandler<SampleLogbookDto, SampleLogbookReference, ActivityLonglineLogbookSampleUI> implements UIHandler<ActivityLonglineLogbookSampleUI> {
|
|
| 47 | 46 |
|
| 48 | 47 |
private static final Logger log = LogManager.getLogger(ActivityLonglineLogbookSampleUIHandler.class);
|
| 49 | 48 |
|
| ... | ... | @@ -64,9 +63,6 @@ public class ActivityLonglineLogbookSampleUIHandler extends ContentSimpleUIHandl |
| 64 | 63 |
ObserveSwingApplicationContext.get().getMainUI().removeContextValue(Boolean.class, "fromActivity");
|
| 65 | 64 |
initTabUI(ui.getSamplePartLogbookUI(), ui.getSamplePartLogbookPanel());
|
| 66 | 65 |
ui.getSamplePartLogbookUI().getSelectToolbar().setVisible(true);
|
| 67 |
- ui.getActions().add(ui.getReset(), new GridBagConstraints(0, 0, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));
|
|
| 68 |
- ui.getActions().add(ui.getSave(), new GridBagConstraints(1, 0, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));
|
|
| 69 |
- ui.getActions().add(ui.getMove(), new GridBagConstraints(2, 0, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));
|
|
| 70 | 66 |
}
|
| 71 | 67 |
|
| 72 | 68 |
@Override
|
| ... | ... | @@ -90,9 +86,18 @@ public class ActivityLonglineLogbookSampleUIHandler extends ContentSimpleUIHandl |
| 90 | 86 |
public void onOpenModel() {
|
| 91 | 87 |
super.onOpenModel();
|
| 92 | 88 |
ActivityLonglineLogbookSampleUIModel model = getModel();
|
| 93 |
- String activityId = model.getSelectedId();
|
|
| 89 |
+ String sampleId = model.getSelectedId();
|
|
| 90 |
+ String activityId = model.getSelectedParentId();
|
|
| 94 | 91 |
log.info(prefix + "activityId = " + activityId);
|
| 95 |
- Form<SampleLogbookDto> form = getActivityLonglineLogbookSampleService().loadForm(activityId);
|
|
| 92 |
+ log.info(prefix + "sampleId = " + sampleId);
|
|
| 93 |
+ boolean create = sampleId == null;
|
|
| 94 |
+ |
|
| 95 |
+ Form<SampleLogbookDto> form;
|
|
| 96 |
+ if (create) {
|
|
| 97 |
+ form = getActivityLonglineLogbookSampleService().preCreate(activityId);
|
|
| 98 |
+ } else {
|
|
| 99 |
+ form = getActivityLonglineLogbookSampleService().loadForm(activityId);
|
|
| 100 |
+ }
|
|
| 96 | 101 |
model.openForm(form);
|
| 97 | 102 |
onOpenTabUIModel(ui.getSamplePartLogbookUI(), form);
|
| 98 | 103 |
}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -24,8 +24,10 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 26 | 26 |
import fr.ird.observe.client.ui.content.api.ContentMode;
|
| 27 |
-import fr.ird.observe.client.ui.content.api.data.simple.ContentSimpleUIModel;
|
|
| 27 |
+import fr.ird.observe.client.ui.content.api.data.edit.ContentEditUIModel;
|
|
| 28 | 28 |
import fr.ird.observe.dto.data.longline.SampleLogbookDto;
|
| 29 |
+import fr.ird.observe.dto.data.longline.SampleLogbookReference;
|
|
| 30 |
+import fr.ird.observe.navigation.model.edit.ObserveEditNode;
|
|
| 29 | 31 |
import fr.ird.observe.navigation.model.select.ObserveSelectNode;
|
| 30 | 32 |
|
| 31 | 33 |
/**
|
| ... | ... | @@ -33,7 +35,7 @@ import fr.ird.observe.navigation.model.select.ObserveSelectNode; |
| 33 | 35 |
*
|
| 34 | 36 |
* @author Tony Chemit - dev@tchemit.fr
|
| 35 | 37 |
*/
|
| 36 |
-public class ActivityLonglineLogbookSampleUIModel extends ContentSimpleUIModel<SampleLogbookDto> {
|
|
| 38 |
+public class ActivityLonglineLogbookSampleUIModel extends ContentEditUIModel<SampleLogbookDto, SampleLogbookReference> {
|
|
| 37 | 39 |
|
| 38 | 40 |
private static final long serialVersionUID = 1L;
|
| 39 | 41 |
|
| ... | ... | @@ -43,12 +45,16 @@ public class ActivityLonglineLogbookSampleUIModel extends ContentSimpleUIModel<S |
| 43 | 45 |
|
| 44 | 46 |
@Override
|
| 45 | 47 |
protected ContentMode computeMode(boolean canWrite) {
|
| 46 |
- return canWrite ? getContentModeFromSelf() : ContentMode.READ;
|
|
| 48 |
+ return canWrite ? getContentModeFromParent() : ContentMode.READ;
|
|
| 47 | 49 |
}
|
| 48 | 50 |
|
| 49 | 51 |
@Override
|
| 50 | 52 |
protected ObserveSelectNode<?> computeSelectNode() {
|
| 51 |
- return ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbook();
|
|
| 53 |
+ return ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbookSample();
|
|
| 54 |
+ }
|
|
| 55 |
+ |
|
| 56 |
+ protected ObserveEditNode<?> computeEditNode() {
|
|
| 57 |
+ return ObserveSwingApplicationContext.get().getNavigationEdit().getLongline().getActivityLogbook();
|
|
| 52 | 58 |
}
|
| 53 | 59 |
|
| 54 | 60 |
}
|
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 |
fr.ird.observe.dto.referential.DataQualityReference
|
| 39 | 39 |
|
| 40 | 40 |
fr.ird.observe.client.ui.actions.content.data.longline.add.AddActivityLonglineLogbookSetUIAction
|
| 41 |
+ fr.ird.observe.client.ui.actions.content.data.longline.add.AddActivityLonglineLogbookSampleUIAction
|
|
| 41 | 42 |
fr.ird.observe.client.ui.actions.content.data.longline.delete.DeleteActivityLonglineLogbookUIAction
|
| 42 | 43 |
fr.ird.observe.client.ui.actions.content.data.longline.move.MoveSingleActivityLonglineLogbookUIAction
|
| 43 | 44 |
fr.ird.observe.client.ui.actions.content.data.longline.save.SaveActivityLonglineLogbookUIAction
|
| ... | ... | @@ -221,6 +222,9 @@ |
| 221 | 222 |
<cell weightx="0.5" fill="both">
|
| 222 | 223 |
<JButton id='addSet'/>
|
| 223 | 224 |
</cell>
|
| 225 |
+ <cell weightx="0.5" fill="both">
|
|
| 226 |
+ <JButton id='addSample'/>
|
|
| 227 |
+ </cell>
|
|
| 224 | 228 |
</row>
|
| 225 | 229 |
</Table>
|
| 226 | 230 |
|
| ... | ... | @@ -118,6 +118,11 @@ |
| 118 | 118 |
_observeAction:{AddActivityLonglineLogbookSetUIAction.ACTION_NAME};
|
| 119 | 119 |
}
|
| 120 | 120 |
|
| 121 |
+#addSample {
|
|
| 122 |
+ enabled:{!model.isModified() && model.isValid() && !bean.isHasSample()};
|
|
| 123 |
+ _observeAction:{AddActivityLonglineLogbookSampleUIAction.ACTION_NAME};
|
|
| 124 |
+}
|
|
| 125 |
+ |
|
| 121 | 126 |
#chooseRelatedObservedActivity {
|
| 122 | 127 |
visible:{!model.isReadingMode()};
|
| 123 | 128 |
enabled:{model.isValid()};
|
| ... | ... | @@ -76,9 +76,9 @@ public class SamplePartLogbookUIHandler extends NotStandaloneContentTableUIHandl |
| 76 | 76 |
boolean fromActivity = ui.getContextValue(Boolean.class, "fromActivity") != null;
|
| 77 | 77 |
if (fromActivity) {
|
| 78 | 78 |
ui.removeContextValue(Boolean.class, "fromActivity");
|
| 79 |
- ui.setContextValue(new SamplePartLogbookUIModel(ui, ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbook()));
|
|
| 79 |
+ ui.setContextValue(new SamplePartLogbookUIModel(ui, getDataSource(),ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbook()));
|
|
| 80 | 80 |
} else {
|
| 81 |
- ui.setContextValue(new SamplePartLogbookUIModel(ui, ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getTripSampleLogbook()));
|
|
| 81 |
+ ui.setContextValue(new SamplePartLogbookUIModel(ui, getDataSource(),ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getTripSampleLogbook()));
|
|
| 82 | 82 |
}
|
| 83 | 83 |
}
|
| 84 | 84 |
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.client.db.ObserveSwingDataSource;
|
|
| 25 | 26 |
import fr.ird.observe.client.ui.content.api.data.table.ContentTableMeta;
|
| 26 | 27 |
import fr.ird.observe.client.ui.content.api.data.table.ContentTableModel;
|
| 27 | 28 |
import fr.ird.observe.client.ui.content.api.data.table.ContentTableUI;
|
| ... | ... | @@ -29,7 +30,6 @@ import fr.ird.observe.client.ui.content.api.data.table.ContentTableUIModel; |
| 29 | 30 |
import fr.ird.observe.client.validation.ClientValidationContext;
|
| 30 | 31 |
import fr.ird.observe.dto.data.longline.SampleLogbookDto;
|
| 31 | 32 |
import fr.ird.observe.dto.data.longline.SamplePartLogbookDto;
|
| 32 |
-import fr.ird.observe.dto.data.longline.SamplePartLogbookHelper;
|
|
| 33 | 33 |
import fr.ird.observe.dto.referential.LengthMeasureMethodReference;
|
| 34 | 34 |
import fr.ird.observe.dto.referential.SexReference;
|
| 35 | 35 |
import fr.ird.observe.dto.referential.SizeMeasureTypeReference;
|
| ... | ... | @@ -63,7 +63,7 @@ public class SamplePartLogbookUIModel extends ContentTableUIModel<SampleLogbookD |
| 63 | 63 |
private LengthMeasureMethodReference defaultLengthMeasureMethod;
|
| 64 | 64 |
private WeightMeasureMethodReference defaultWeightMeasureMethod;
|
| 65 | 65 |
|
| 66 |
- public SamplePartLogbookUIModel(SamplePartLogbookUI ui, ObserveSelectNode<?> selectNode) {
|
|
| 66 |
+ public SamplePartLogbookUIModel(SamplePartLogbookUI ui, ObserveSwingDataSource dataSource, ObserveSelectNode<?> selectNode) {
|
|
| 67 | 67 |
super(SampleLogbookDto.class,
|
| 68 | 68 |
SamplePartLogbookDto.class,
|
| 69 | 69 |
selectNode,
|
| ... | ... | @@ -93,15 +93,11 @@ public class SamplePartLogbookUIModel extends ContentTableUIModel<SampleLogbookD |
| 93 | 93 |
ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_SEX, false));
|
| 94 | 94 |
|
| 95 | 95 |
initModel(ui, metas);
|
| 96 |
- setAddMessageOnOpen(false);
|
|
| 97 |
- }
|
|
| 98 | 96 |
|
| 99 |
- @Override
|
|
| 100 |
- public void initModel(ContentTableUI<SampleLogbookDto, SamplePartLogbookDto, ?> ui, List<ContentTableMeta<SamplePartLogbookDto>> contentTableMetas) {
|
|
| 101 |
- super.initModel(ui, contentTableMetas);
|
|
| 102 |
- defaultSex = ui.getDataSource().getReferentialReferenceSet(SexReference.class).tryGetReferenceById(SAMPLE_PART_LOGBOOK_DEFAULT_SEX_ID).orElseThrow(IllegalStateException::new);
|
|
| 103 |
- defaultLengthMeasureMethod = ui.getDataSource().getReferentialReferenceSet(LengthMeasureMethodReference.class).tryGetReferenceById(SAMPLE_PART_LOGBOOK_DEFAULT_LENGTH_MEASURE_METHOD_ID).orElseThrow(IllegalStateException::new);
|
|
| 104 |
- defaultWeightMeasureMethod = ui.getDataSource().getReferentialReferenceSet(WeightMeasureMethodReference.class).tryGetReferenceById(SAMPLE_PART_LOGBOOK_DEFAULT_WEIGHT_MEASURE_METHOD_ID).orElseThrow(IllegalStateException::new);
|
|
| 97 |
+ defaultSex = dataSource.getReferentialReferenceSet(SexReference.class).tryGetReferenceById(SAMPLE_PART_LOGBOOK_DEFAULT_SEX_ID).orElseThrow(IllegalStateException::new);
|
|
| 98 |
+ defaultLengthMeasureMethod = dataSource.getReferentialReferenceSet(LengthMeasureMethodReference.class).tryGetReferenceById(SAMPLE_PART_LOGBOOK_DEFAULT_LENGTH_MEASURE_METHOD_ID).orElseThrow(IllegalStateException::new);
|
|
| 99 |
+ defaultWeightMeasureMethod = dataSource.getReferentialReferenceSet(WeightMeasureMethodReference.class).tryGetReferenceById(SAMPLE_PART_LOGBOOK_DEFAULT_WEIGHT_MEASURE_METHOD_ID).orElseThrow(IllegalStateException::new);
|
|
| 100 |
+ setAddMessageOnOpen(false);
|
|
| 105 | 101 |
}
|
| 106 | 102 |
|
| 107 | 103 |
@Override
|
| ... | ... | @@ -143,7 +139,7 @@ public class SamplePartLogbookUIModel extends ContentTableUIModel<SampleLogbookD |
| 143 | 139 |
|
| 144 | 140 |
@Override
|
| 145 | 141 |
protected void load(SamplePartLogbookDto source, SamplePartLogbookDto target) {
|
| 146 |
- SamplePartLogbookHelper.copySamplePartLogbookDto(source, target);
|
|
| 142 |
+ source.copy(target);
|
|
| 147 | 143 |
}
|
| 148 | 144 |
|
| 149 | 145 |
@Override
|
| ... | ... | @@ -333,6 +333,11 @@ public class NavigationTree extends JXTree { |
| 333 | 333 |
afterAddUnsavedNode(parentNode, result);
|
| 334 | 334 |
}
|
| 335 | 335 |
|
| 336 |
+ public void addUnsavedNode(MutableTreeNode parentNode, ReferenceNode<?,?> result) {
|
|
| 337 |
+ insertNode(parentNode, result, parentNode.getChildCount());
|
|
| 338 |
+ afterAddUnsavedNode(parentNode, result);
|
|
| 339 |
+ }
|
|
| 340 |
+ |
|
| 336 | 341 |
private void afterAddUnsavedNode(MutableTreeNode parentNode, ReferenceNode result) {
|
| 337 | 342 |
|
| 338 | 343 |
// refresh parent node (render of parent can have changed)
|
| ... | ... | @@ -94,6 +94,10 @@ public class ActivityLonglineLogbookNavigationTreeNode extends ReferenceNavigati |
| 94 | 94 |
return SetLonglineLogbookReference.class;
|
| 95 | 95 |
}
|
| 96 | 96 |
|
| 97 |
+ public ActivityLonglineSampleLogbookNavigationTreeNode newSampleChildNode(SampleLogbookReference childrenReference) {
|
|
| 98 |
+ return new ActivityLonglineSampleLogbookNavigationTreeNode(childrenReference);
|
|
| 99 |
+ }
|
|
| 100 |
+ |
|
| 97 | 101 |
@Override
|
| 98 | 102 |
public SetLonglineLogbookNavigationTreeNode newSingleChildNode(SetLonglineLogbookReference childrenReference) {
|
| 99 | 103 |
return new SetLonglineLogbookNavigationTreeNode(childrenReference);
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.dto.data.longline; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -74,4 +74,9 @@ public class ActivityLonglineLogbookDto extends GeneratedActivityLonglineLogbook |
| 74 | 74 |
public String getVesselActivityLonglineId() {
|
| 75 | 75 |
return vesselActivityLongline == null ? null : vesselActivityLongline.getId();
|
| 76 | 76 |
}
|
| 77 |
+ |
|
| 78 |
+ public boolean isHasSample() {
|
|
| 79 |
+ return sample != null;
|
|
| 80 |
+ }
|
|
| 81 |
+ |
|
| 77 | 82 |
}
|
| ... | ... | @@ -389,6 +389,8 @@ observe.common.ActivityLonglineDto.message.not.open=Activity is not opened, no e |
| 389 | 389 |
observe.common.ActivityLonglineDto.message.updating=Updating an activity
|
| 390 | 390 |
observe.common.ActivityLonglineDto.timeStamp=timestamp
|
| 391 | 391 |
observe.common.ActivityLonglineDto.titles=Activities
|
| 392 |
+observe.common.ActivityLonglineLogbookDto.action.addSample=Add sample
|
|
| 393 |
+observe.common.ActivityLonglineLogbookDto.action.addSample.tip=Add sample associated with this activity
|
|
| 392 | 394 |
observe.common.ActivityLonglineLogbookDto.action.addSet=Add the fishing operation
|
| 393 | 395 |
observe.common.ActivityLonglineLogbookDto.action.addSet.tip=Add the fishing operation associated with this activity
|
| 394 | 396 |
observe.common.ActivityLonglineLogbookDto.action.chooseRelatedObservedActivity=Choose activity
|
| ... | ... | @@ -389,6 +389,8 @@ observe.common.ActivityLonglineDto.message.not.open=La actividad no está abiert |
| 389 | 389 |
observe.common.ActivityLonglineDto.message.updating=Se está modificando la actividad actual.
|
| 390 | 390 |
observe.common.ActivityLonglineDto.timeStamp=FechaHora
|
| 391 | 391 |
observe.common.ActivityLonglineDto.titles=Actividades
|
| 392 |
+observe.common.ActivityLonglineLogbookDto.action.addSample=Add sample \#TODO
|
|
| 393 |
+observe.common.ActivityLonglineLogbookDto.action.addSample.tip=Add sample associated with this activity \#TODO
|
|
| 392 | 394 |
observe.common.ActivityLonglineLogbookDto.action.addSet=Añadir la operación de pesca
|
| 393 | 395 |
observe.common.ActivityLonglineLogbookDto.action.addSet.tip=Añadir la operación de pesca asociada a esta actividad
|
| 394 | 396 |
observe.common.ActivityLonglineLogbookDto.action.chooseRelatedObservedActivity=Choose activity \#TODO
|
| ... | ... | @@ -389,6 +389,8 @@ observe.common.ActivityLonglineDto.message.not.open=L'opération de pêche n'est |
| 389 | 389 |
observe.common.ActivityLonglineDto.message.updating=L'activité est en cours de modification.
|
| 390 | 390 |
observe.common.ActivityLonglineDto.timeStamp=Horodatage
|
| 391 | 391 |
observe.common.ActivityLonglineDto.titles=Activités
|
| 392 |
+observe.common.ActivityLonglineLogbookDto.action.addSample=Ajouter l'échantillon
|
|
| 393 |
+observe.common.ActivityLonglineLogbookDto.action.addSample.tip=Ajouter l'échantillon associé à cette activité
|
|
| 392 | 394 |
observe.common.ActivityLonglineLogbookDto.action.addSet=Ajouter l'opération de pêche
|
| 393 | 395 |
observe.common.ActivityLonglineLogbookDto.action.addSet.tip=Ajouter l'opération de pêche associée à cette activité
|
| 394 | 396 |
observe.common.ActivityLonglineLogbookDto.action.chooseRelatedObservedActivity=Choisir l'activité
|
| ... | ... | @@ -95,9 +95,11 @@ POST /api/v1/data/longline/ActivityLongLineObsEncounterService/save |
| 95 | 95 |
GET /api/v1/data/longline/ActivityLongLineObsSensorUsedService/getDataFile v1.data.longline.ActivityLongLineObsSensorUsedServiceRestApi.getDataFile
|
| 96 | 96 |
GET /api/v1/data/longline/ActivityLongLineObsSensorUsedService/loadForm v1.data.longline.ActivityLongLineObsSensorUsedServiceRestApi.loadForm
|
| 97 | 97 |
POST /api/v1/data/longline/ActivityLongLineObsSensorUsedService/save v1.data.longline.ActivityLongLineObsSensorUsedServiceRestApi.save
|
| 98 |
+DELETE /api/v1/data/longline/ActivityLonglineLogbookSampleService/delete v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.delete
|
|
| 98 | 99 |
GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/loadForm v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.loadForm
|
| 99 | 100 |
POST /api/v1/data/longline/ActivityLonglineLogbookSampleService/moveToActivityLongline v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.moveToActivityLongline
|
| 100 | 101 |
POST /api/v1/data/longline/ActivityLonglineLogbookSampleService/moveToTripLongline v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.moveToTripLongline
|
| 102 |
+GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/preCreate v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.preCreate
|
|
| 101 | 103 |
POST /api/v1/data/longline/ActivityLonglineLogbookSampleService/save v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.save
|
| 102 | 104 |
DELETE /api/v1/data/longline/ActivityLonglineLogbookService/delete v1.data.longline.ActivityLonglineLogbookServiceRestApi.delete
|
| 103 | 105 |
GET /api/v1/data/longline/ActivityLonglineLogbookService/exists v1.data.longline.ActivityLonglineLogbookServiceRestApi.exists
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.data.longline; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -45,13 +45,35 @@ public class ActivityLonglineLogbookSampleServiceLocal extends ObserveServiceLoc |
| 45 | 45 |
}
|
| 46 | 46 |
|
| 47 | 47 |
@Override
|
| 48 |
- public SaveResultDto save(SampleLogbookDto dto) {
|
|
| 48 |
+ public Form<SampleLogbookDto> preCreate(String activityLonglineId) {
|
|
| 49 |
+ ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId);
|
|
| 50 |
+ SampleLogbook preCreated = SAMPLE_LOGBOOK_SPI.newEntity();
|
|
| 51 |
+ preCreated.setTimeStamp(activity.getTimeStamp());
|
|
| 52 |
+ preCreated.setLatitude(activity.getLatitude());
|
|
| 53 |
+ preCreated.setLongitude(activity.getLongitude());
|
|
| 54 |
+ return SAMPLE_LOGBOOK_SPI.dataEntityToForm(preCreated, getReferentialLocale());
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+ @Override
|
|
| 58 |
+ public SaveResultDto save(String activityId, SampleLogbookDto dto) {
|
|
| 59 |
+ ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityId);
|
|
| 49 | 60 |
SampleLogbook entity = SAMPLE_LOGBOOK_SPI.loadOrCreateEntityFromDataDto(getTopiaPersistenceContext(), dto);
|
| 50 | 61 |
checkLastUpdateDate(entity, dto);
|
| 51 | 62 |
SAMPLE_LOGBOOK_SPI.copyDataDtoToEntity(dto, entity, getReferentialLocale());
|
| 63 |
+ if (activity.getSample() == null) {
|
|
| 64 |
+ activity.setSample(entity);
|
|
| 65 |
+ }
|
|
| 52 | 66 |
return saveEntity(entity);
|
| 53 | 67 |
}
|
| 54 | 68 |
|
| 69 |
+ @Override
|
|
| 70 |
+ public void delete(String activityLonglineId, String sampleLogbookId) {
|
|
| 71 |
+ ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId);
|
|
| 72 |
+ SAMPLE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), sampleLogbookId);
|
|
| 73 |
+ activity.setSample(null);
|
|
| 74 |
+ saveEntity(activity);
|
|
| 75 |
+ }
|
|
| 76 |
+ |
|
| 55 | 77 |
@Override
|
| 56 | 78 |
public void moveToTripLongline(String activityId, String newTripId, String sampleLogbookId) {
|
| 57 | 79 |
//FIXME Manage fields to remove like associated observed activity
|
| ... | ... | @@ -34,7 +34,6 @@ import fr.ird.observe.dto.result.TripChildSaveResultDto; |
| 34 | 34 |
import fr.ird.observe.dto.result.TripChildSaveResultHelper;
|
| 35 | 35 |
import fr.ird.observe.entities.longline.ActivityLonglineLogbook;
|
| 36 | 36 |
import fr.ird.observe.entities.longline.ActivityLonglineLogbookTopiaDao;
|
| 37 |
-import fr.ird.observe.entities.longline.SampleLogbook;
|
|
| 38 | 37 |
import fr.ird.observe.entities.longline.TripLongline;
|
| 39 | 38 |
import fr.ird.observe.entities.referentiel.DataQuality;
|
| 40 | 39 |
import fr.ird.observe.services.local.service.ObserveServiceLocal;
|
| ... | ... | @@ -108,21 +107,11 @@ public class ActivityLonglineLogbookServiceLocal extends ObserveServiceLocal imp |
| 108 | 107 |
checkLastUpdateDate(entity, dto);
|
| 109 | 108 |
ACTIVITY_LONGLINE_LOGBOOK_SPI.copyDataDtoToEntity(dto, entity, getReferentialLocale());
|
| 110 | 109 |
boolean notPersisted = dto.isNotPersisted();
|
| 111 |
- if (notPersisted) {
|
|
| 112 |
- // create a unique sample
|
|
| 113 |
- SampleLogbook preCreated = SAMPLE_LOGBOOK_SPI.newEntity();
|
|
| 114 |
- preCreated.setLatitude(entity.getLatitude());
|
|
| 115 |
- preCreated.setLongitude(entity.getLongitude());
|
|
| 116 |
- preCreated.setTimeStamp(entity.getTimeStamp());
|
|
| 117 |
- saveEntity(preCreated);
|
|
| 118 |
- entity.setSample(preCreated);
|
|
| 119 |
- }
|
|
| 120 | 110 |
SaveResultDto saveResultDto = saveEntity(entity);
|
| 121 | 111 |
|
| 122 | 112 |
TripChildSaveResultDto result = TripChildSaveResultHelper.of(saveResultDto);
|
| 123 | 113 |
if (notPersisted) {
|
| 124 | 114 |
tripLongline.addActivityLonglineLogbook(entity);
|
| 125 |
- |
|
| 126 | 115 |
}
|
| 127 | 116 |
boolean wasEndDateUpdated = TRIP_LONGLINE_SPI.getDao(getTopiaPersistenceContext()).updateEndDate(tripLongline);
|
| 128 | 117 |
result.setTripEndDateUpdated(wasEndDateUpdated);
|
| ... | ... | @@ -29,6 +29,7 @@ import fr.ird.observe.services.service.ObserveService; |
| 29 | 29 |
import fr.ird.observe.services.spi.ReadDataPermission;
|
| 30 | 30 |
import fr.ird.observe.services.spi.Write;
|
| 31 | 31 |
import fr.ird.observe.services.spi.WriteDataPermission;
|
| 32 |
+import io.ultreia.java4all.http.spi.Delete;
|
|
| 32 | 33 |
import io.ultreia.java4all.http.spi.Get;
|
| 33 | 34 |
import io.ultreia.java4all.http.spi.Post;
|
| 34 | 35 |
|
| ... | ... | @@ -37,6 +38,10 @@ import io.ultreia.java4all.http.spi.Post; |
| 37 | 38 |
*/
|
| 38 | 39 |
public interface ActivityLonglineLogbookSampleService extends ObserveService {
|
| 39 | 40 |
|
| 41 |
+ @Get
|
|
| 42 |
+ @WriteDataPermission
|
|
| 43 |
+ Form<SampleLogbookDto> preCreate(String activityLonglineId);
|
|
| 44 |
+ |
|
| 40 | 45 |
@Get
|
| 41 | 46 |
@ReadDataPermission
|
| 42 | 47 |
Form<SampleLogbookDto> loadForm(String activityLonglineId);
|
| ... | ... | @@ -44,7 +49,12 @@ public interface ActivityLonglineLogbookSampleService extends ObserveService { |
| 44 | 49 |
@WriteDataPermission
|
| 45 | 50 |
@Write
|
| 46 | 51 |
@Post
|
| 47 |
- SaveResultDto save(SampleLogbookDto dto);
|
|
| 52 |
+ SaveResultDto save(String activityId, SampleLogbookDto dto);
|
|
| 53 |
+ |
|
| 54 |
+ @Write
|
|
| 55 |
+ @WriteDataPermission
|
|
| 56 |
+ @Delete
|
|
| 57 |
+ void delete(String activityLonglineId, String sampleLogbookId);
|
|
| 48 | 58 |
|
| 49 | 59 |
@WriteDataPermission
|
| 50 | 60 |
@Write
|
| ... | ... | @@ -26,13 +26,13 @@ |
| 26 | 26 |
|
| 27 | 27 |
<field name="homeId">
|
| 28 | 28 |
<!-- homeId duplique -->
|
| 29 |
- <field-validator type="setLonglineObsUniqueHomeIdDto" short-circuit="true">
|
|
| 29 |
+ <field-validator type="setLonglineLogbookUniqueHomeIdDto" short-circuit="true">
|
|
| 30 | 30 |
<message>observe.validation.setLongline.duplicated.homeId##${duplicatedActivity}</message>
|
| 31 | 31 |
</field-validator>
|
| 32 | 32 |
</field>
|
| 33 | 33 |
<field name="number">
|
| 34 | 34 |
<!-- number duplique -->
|
| 35 |
- <field-validator type="setLonglineObsUniqueNumberIdDto" short-circuit="true">
|
|
| 35 |
+ <field-validator type="setLonglineLogbookUniqueNumberIdDto" short-circuit="true">
|
|
| 36 | 36 |
<message>observe.validation.setLongline.duplicated.number##${duplicatedActivity}</message>
|
| 37 | 37 |
</field-validator>
|
| 38 | 38 |
</field>
|
| ... | ... | @@ -26,13 +26,13 @@ |
| 26 | 26 |
|
| 27 | 27 |
<field name="homeId">
|
| 28 | 28 |
<!-- homeId duplique -->
|
| 29 |
- <field-validator type="setLonglineObsUniqueHomeIdDto" short-circuit="true">
|
|
| 29 |
+ <field-validator type="setLonglineLogbookUniqueHomeIdDto" short-circuit="true">
|
|
| 30 | 30 |
<message>observe.validation.setLongline.duplicated.homeId##${duplicatedActivity}</message>
|
| 31 | 31 |
</field-validator>
|
| 32 | 32 |
</field>
|
| 33 | 33 |
<field name="number">
|
| 34 | 34 |
<!-- number duplique -->
|
| 35 |
- <field-validator type="setLonglineObsUniqueNumberIdDto" short-circuit="true">
|
|
| 35 |
+ <field-validator type="setLonglineLogbookUniqueNumberIdDto" short-circuit="true">
|
|
| 36 | 36 |
<message>observe.validation.setLongline.duplicated.number##${duplicatedActivity}</message>
|
| 37 | 37 |
</field-validator>
|
| 38 | 38 |
</field>
|