Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
f1d57b9c
by Tony CHEMIT at 2018-10-14T23:31:38Z
18 changed files:
- client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
- client/src/main/java/fr/ird/observe/client/ui/actions/content/api/data/edit/SaveEditDataUIActionSupport.java
- + client/src/main/java/fr/ird/observe/client/ui/actions/content/data/longline/save/CopyValuesAndSaveSetLonglineLogbookUIAction.java
- client/src/main/java/fr/ird/observe/client/ui/actions/content/data/longline/save/SaveSetLonglineLogbookUIAction.java
- client/src/main/java/fr/ird/observe/client/ui/content/api/data/edit/ContentEditUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/api/data/edit/ContentEditUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/SetLonglineLogbookUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/SetLonglineLogbookUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/SetLonglineLogbookUIModel.java
- client/src/main/resources/i18n/client_en_GB.properties
- client/src/main/resources/i18n/client_es_ES.properties
- client/src/main/resources/i18n/client_fr_FR.properties
- dto/src/main/java/fr/ird/observe/dto/data/longline/SetLonglineLogbookGlobalCompositionDto.java
- dto/src/main/models/Observe-06-data-longline-logbook.model
- persistence/src/main/java/fr/ird/observe/binder/data/longline/SetLonglineLogbookStubEntityDtoBinder.java
- server/src/main/filtered-resources/mapping
- services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/SetLonglineLogbookServiceLocal.java
- services/src/main/java/fr/ird/observe/services/service/data/longline/SetLonglineLogbookService.java
Changes:
| ... | ... | @@ -74,6 +74,7 @@ public abstract class ObserveKeyStrokes { |
| 74 | 74 |
public static final KeyStroke KEY_STROKE_CONFIGURE_SYNCHRO_FROM_RIGHT = KeyStroke.getKeyStroke("ctrl pressed B");
|
| 75 | 75 |
public static final KeyStroke KEY_STROKE_CONFIGURE_SYNCHRO_FROM_BOTH = KeyStroke.getKeyStroke("ctrl pressed C");
|
| 76 | 76 |
|
| 77 |
+ public static final KeyStroke KEY_STROKE_COPY_VALUES_AND_SAVE = KeyStroke.getKeyStroke("ctrl pressed T");
|
|
| 77 | 78 |
public static final KeyStroke KEY_STROKE_SELECT_TRANSSHIPMENT = KeyStroke.getKeyStroke("ctrl pressed T");
|
| 78 | 79 |
public static final KeyStroke KEY_STROKE_SAVE_TABLE_ENTRY = KeyStroke.getKeyStroke("ctrl pressed S");
|
| 79 | 80 |
public static final KeyStroke KEY_STROKE_PRESSED_ENTER = KeyStroke.getKeyStroke("pressed ENTER");
|
| ... | ... | @@ -57,8 +57,12 @@ public abstract class SaveEditDataUIActionSupport<D extends DataDto, R extends D |
| 57 | 57 |
|
| 58 | 58 |
private static final long serialVersionUID = 1L;
|
| 59 | 59 |
|
| 60 |
- protected SaveEditDataUIActionSupport(ObserveMainUI mainUI, String name, KeyStroke keyStroke) {
|
|
| 61 |
- super(mainUI, name, n("observe.action.save"), n("observe.action.save.tip"), "save", keyStroke);
|
|
| 60 |
+ protected SaveEditDataUIActionSupport(ObserveMainUI mainUI, String actionKey, String text, String tip, KeyStroke keyStroke) {
|
|
| 61 |
+ super(mainUI, actionKey, text, tip, "save", keyStroke);
|
|
| 62 |
+ }
|
|
| 63 |
+ |
|
| 64 |
+ protected SaveEditDataUIActionSupport(ObserveMainUI mainUI, String actionKey, KeyStroke keyStroke) {
|
|
| 65 |
+ super(mainUI, actionKey, n("observe.action.save"), n("observe.action.save.tip"), "save", keyStroke);
|
|
| 62 | 66 |
}
|
| 63 | 67 |
|
| 64 | 68 |
protected abstract boolean doSave(U ui, D bean, ObserveEditNode<?> parentEditNode, boolean notPersisted);
|
| 1 |
+package fr.ird.observe.client.ui.actions.content.data.longline.save;
|
|
| 2 |
+ |
|
| 3 |
+import fr.ird.observe.client.ui.ObserveKeyStrokes;
|
|
| 4 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 5 |
+import fr.ird.observe.client.ui.content.data.longline.logbook.SetLonglineLogbookUI;
|
|
| 6 |
+import fr.ird.observe.client.ui.content.data.longline.logbook.SetLonglineLogbookUIModel;
|
|
| 7 |
+import fr.ird.observe.dto.data.longline.SetLonglineLogbookDto;
|
|
| 8 |
+import fr.ird.observe.dto.result.SaveResultDto;
|
|
| 9 |
+import fr.ird.observe.navigation.model.edit.ObserveEditNode;
|
|
| 10 |
+ |
|
| 11 |
+import java.util.Objects;
|
|
| 12 |
+ |
|
| 13 |
+import static org.nuiton.i18n.I18n.n;
|
|
| 14 |
+ |
|
| 15 |
+/**
|
|
| 16 |
+ * Created by tchemit on 14/10/2018.
|
|
| 17 |
+ *
|
|
| 18 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 19 |
+ */
|
|
| 20 |
+public class CopyValuesAndSaveSetLonglineLogbookUIAction extends SaveSetLonglineLogbookUIAction {
|
|
| 21 |
+ |
|
| 22 |
+ public static final String ACTION_NAME = CopyValuesAndSaveSetLonglineLogbookUIAction.class.getName();
|
|
| 23 |
+ |
|
| 24 |
+ public CopyValuesAndSaveSetLonglineLogbookUIAction(ObserveMainUI mainUI) {
|
|
| 25 |
+ super(mainUI, ACTION_NAME, n("observe.common.SetLonglineLogbookDto.action.copyValuesAndSave"), n("observe.common.SetLonglineLogbookDto.action.copyValuesAndSave"), ObserveKeyStrokes.KEY_STROKE_COPY_VALUES_AND_SAVE);
|
|
| 26 |
+ }
|
|
| 27 |
+ |
|
| 28 |
+ @Override
|
|
| 29 |
+ protected boolean doSave(SetLonglineLogbookUI ui, SetLonglineLogbookDto bean, ObserveEditNode<?> parentEditNode, boolean notPersisted) {
|
|
| 30 |
+ String parentId = parentEditNode.getId();
|
|
| 31 |
+ SetLonglineLogbookUIModel model = ui.getModel();
|
|
| 32 |
+ String setIdToCopy = Objects.requireNonNull(model.getSetIdToCopy());
|
|
| 33 |
+ SaveResultDto saveResult = getServicesProvider().getSetLonglineLogbookService().saveAndCopyProperties(parentId, setIdToCopy, bean);
|
|
| 34 |
+ saveResult.toDto(bean);
|
|
| 35 |
+ return true;
|
|
| 36 |
+ }
|
|
| 37 |
+ |
|
| 38 |
+}
|
| ... | ... | @@ -31,6 +31,8 @@ import fr.ird.observe.dto.data.longline.SetLonglineLogbookReference; |
| 31 | 31 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 32 | 32 |
import fr.ird.observe.navigation.model.edit.ObserveEditNode;
|
| 33 | 33 |
|
| 34 |
+import javax.swing.KeyStroke;
|
|
| 35 |
+ |
|
| 34 | 36 |
/**
|
| 35 | 37 |
* Created by tchemit on 28/09/2018.
|
| 36 | 38 |
*
|
| ... | ... | @@ -40,6 +42,10 @@ public class SaveSetLonglineLogbookUIAction extends SaveEditDataUIActionSupport< |
| 40 | 42 |
|
| 41 | 43 |
public static final String ACTION_NAME = SaveSetLonglineLogbookUIAction.class.getName();
|
| 42 | 44 |
|
| 45 |
+ public SaveSetLonglineLogbookUIAction(ObserveMainUI mainUI, String actionKey, String text, String tip, KeyStroke keyStroke) {
|
|
| 46 |
+ super(mainUI, actionKey, text, tip, keyStroke);
|
|
| 47 |
+ }
|
|
| 48 |
+ |
|
| 43 | 49 |
public SaveSetLonglineLogbookUIAction(ObserveMainUI mainUI) {
|
| 44 | 50 |
super(mainUI, ACTION_NAME, ObserveKeyStrokes.KEY_STROKE_SAVE_DATA);
|
| 45 | 51 |
}
|
| ... | ... | @@ -62,5 +62,11 @@ |
| 62 | 62 |
<JButton id='delete'/>
|
| 63 | 63 |
</cell>
|
| 64 | 64 |
</row>
|
| 65 |
+ <row insets='0'>
|
|
| 66 |
+ <cell fill='both' columns="3">
|
|
| 67 |
+ <Table id='extraActions' fill="both" weightx="1" insets='2'/>
|
|
| 68 |
+ </cell>
|
|
| 69 |
+ </row>
|
|
| 70 |
+ |
|
| 65 | 71 |
</Table>
|
| 66 | 72 |
</fr.ird.observe.client.ui.content.api.ContentUI>
|
| ... | ... | @@ -30,7 +30,9 @@ |
| 30 | 30 |
#actions {
|
| 31 | 31 |
visible:{model.isCanWrite()};
|
| 32 | 32 |
}
|
| 33 |
- |
|
| 33 |
+#extraActions {
|
|
| 34 |
+ visible:false;
|
|
| 35 |
+}
|
|
| 34 | 36 |
#reset {
|
| 35 | 37 |
_observeAction:{ResetEditUIAction.ACTION_NAME};
|
| 36 | 38 |
_globalAction:{ResetDataGlobalUIAction.ACTION_NAME};
|
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 |
fr.ird.observe.dto.referential.longline.LightsticksColorReference
|
| 35 | 35 |
|
| 36 | 36 |
fr.ird.observe.client.ui.actions.content.data.longline.delete.DeleteSetLonglineLogbookUIAction
|
| 37 |
+ fr.ird.observe.client.ui.actions.content.data.longline.save.CopyValuesAndSaveSetLonglineLogbookUIAction
|
|
| 37 | 38 |
fr.ird.observe.client.ui.actions.content.data.longline.save.SaveSetLonglineLogbookUIAction
|
| 38 | 39 |
|
| 39 | 40 |
fr.ird.observe.client.ui.content.api.ContentUIModel
|
| ... | ... | @@ -427,5 +428,11 @@ |
| 427 | 428 |
<JButton id='reset'/>
|
| 428 | 429 |
<JButton id='save'/>
|
| 429 | 430 |
<JButton id='delete'/>
|
| 430 |
- |
|
| 431 |
+ <Table id='extraActions' fill="both" weightx="1" insets='2'>
|
|
| 432 |
+ <row>
|
|
| 433 |
+ <cell fill="both">
|
|
| 434 |
+ <JButton id='copyValuesAndSave'/>
|
|
| 435 |
+ </cell>
|
|
| 436 |
+ </row>
|
|
| 437 |
+ </Table>
|
|
| 431 | 438 |
</fr.ird.observe.client.ui.content.api.data.edit.ContentEditUI>
|
| ... | ... | @@ -28,6 +28,15 @@ |
| 28 | 28 |
_observeAction:{DeleteSetLonglineLogbookUIAction.ACTION_NAME};
|
| 29 | 29 |
}
|
| 30 | 30 |
|
| 31 |
+#extraActions {
|
|
| 32 |
+ visible:{!model.isReadingMode()};
|
|
| 33 |
+}
|
|
| 34 |
+ |
|
| 35 |
+#copyValuesAndSave {
|
|
| 36 |
+ enabled:{model.getCopySetCandidate() != null && model.isValid()};
|
|
| 37 |
+ _observeAction:{CopyValuesAndSaveSetLonglineLogbookUIAction.ACTION_NAME};
|
|
| 38 |
+}
|
|
| 39 |
+ |
|
| 31 | 40 |
/* ***************************************************************************** */
|
| 32 | 41 |
/* SETTING TAB **************************************************************** */
|
| 33 | 42 |
/* ***************************************************************************** */
|
| ... | ... | @@ -25,6 +25,13 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; |
| 25 | 25 |
import fr.ird.observe.client.ui.content.api.data.edit.ContentEditUIModel;
|
| 26 | 26 |
import fr.ird.observe.dto.data.longline.SetLonglineLogbookDto;
|
| 27 | 27 |
import fr.ird.observe.dto.data.longline.SetLonglineLogbookReference;
|
| 28 |
+import fr.ird.observe.dto.data.longline.SetLonglineLogbookStubDto;
|
|
| 29 |
+import fr.ird.observe.dto.form.Form;
|
|
| 30 |
+ |
|
| 31 |
+import java.util.Comparator;
|
|
| 32 |
+import java.util.Date;
|
|
| 33 |
+import java.util.List;
|
|
| 34 |
+import java.util.stream.Collectors;
|
|
| 28 | 35 |
|
| 29 | 36 |
/**
|
| 30 | 37 |
* Created on 9/28/14.
|
| ... | ... | @@ -36,7 +43,48 @@ public class SetLonglineLogbookUIModel extends ContentEditUIModel<SetLonglineLog |
| 36 | 43 |
|
| 37 | 44 |
private static final long serialVersionUID = 1L;
|
| 38 | 45 |
|
| 46 |
+ private List<SetLonglineLogbookStubDto> copySetCandidates;
|
|
| 47 |
+ private SetLonglineLogbookStubDto copySetCandidate;
|
|
| 48 |
+ |
|
| 39 | 49 |
public SetLonglineLogbookUIModel() {
|
| 40 | 50 |
super(SetLonglineLogbookDto.class);
|
| 41 | 51 |
}
|
| 52 |
+ |
|
| 53 |
+ @Override
|
|
| 54 |
+ public void openForm(Form<SetLonglineLogbookDto> form) {
|
|
| 55 |
+ super.openForm(form);
|
|
| 56 |
+ |
|
| 57 |
+ copySetCandidates = form.getObject().getOtherSets().stream()
|
|
| 58 |
+ .sorted(Comparator.comparing(SetLonglineLogbookStubDto::getSettingStartTimeStamp))
|
|
| 59 |
+ .collect(Collectors.toList());
|
|
| 60 |
+ addPropertyChangeListener(SetLonglineLogbookDto.PROPERTY_SETTING_START_TIME_STAMP, e -> updateCopySetCandidate((Date) e.getNewValue()));
|
|
| 61 |
+ updateCopySetCandidate(getBean().getSettingStartTimeStamp());
|
|
| 62 |
+ }
|
|
| 63 |
+ |
|
| 64 |
+ private void updateCopySetCandidate(Date newValue) {
|
|
| 65 |
+ if (newValue == null) {
|
|
| 66 |
+ setCopySetCandidate(null);
|
|
| 67 |
+ } else {
|
|
| 68 |
+ List<SetLonglineLogbookStubDto> collect = copySetCandidates.stream().filter(e -> e.getSettingStartTimeStamp().before(newValue)).collect(Collectors.toList());
|
|
| 69 |
+ if (collect.isEmpty()) {
|
|
| 70 |
+ setCopySetCandidate(null);
|
|
| 71 |
+ } else {
|
|
| 72 |
+ setCopySetCandidate(collect.get(collect.size() - 1));
|
|
| 73 |
+ }
|
|
| 74 |
+ }
|
|
| 75 |
+ }
|
|
| 76 |
+ |
|
| 77 |
+ public SetLonglineLogbookStubDto getCopySetCandidate() {
|
|
| 78 |
+ return copySetCandidate;
|
|
| 79 |
+ }
|
|
| 80 |
+ |
|
| 81 |
+ public void setCopySetCandidate(SetLonglineLogbookStubDto copySetCandidate) {
|
|
| 82 |
+ SetLonglineLogbookStubDto oldValue = getCopySetCandidate();
|
|
| 83 |
+ this.copySetCandidate = copySetCandidate;
|
|
| 84 |
+ firePropertyChange("copySetCandidate", oldValue, copySetCandidate);
|
|
| 85 |
+ }
|
|
| 86 |
+ |
|
| 87 |
+ public String getSetIdToCopy() {
|
|
| 88 |
+ return copySetCandidate == null ? null : copySetCandidate.getId();
|
|
| 89 |
+ }
|
|
| 42 | 90 |
}
|
| ... | ... | @@ -1091,6 +1091,7 @@ observe.common.SetDto.action.goToOpen.short=Open set |
| 1091 | 1091 |
observe.common.SetDto.action.goToOpen.tip=Open set
|
| 1092 | 1092 |
observe.common.SetLogbookDto.action.goToOpen.short=Logbook - Open set
|
| 1093 | 1093 |
observe.common.SetLogbookDto.action.goToOpen.tip=Go to open set (Logbook)
|
| 1094 |
+observe.common.SetLonglineLogbookDto.action.copyValuesAndSave=Copy values and save
|
|
| 1094 | 1095 |
observe.common.SetLonglineLogbookDto.action.reset.homeId.tip=Reset home id
|
| 1095 | 1096 |
observe.common.SetLonglineLogbookDto.basketLineLength=Bakset line length (m)
|
| 1096 | 1097 |
observe.common.SetLonglineLogbookDto.haulingTab=Hauling
|
| ... | ... | @@ -1091,6 +1091,7 @@ observe.common.SetDto.action.goToOpen.short=Lance abierto |
| 1091 | 1091 |
observe.common.SetDto.action.goToOpen.tip=Acceder al lance abierto
|
| 1092 | 1092 |
observe.common.SetLogbookDto.action.goToOpen.short=Logbook - Open set \#TODO
|
| 1093 | 1093 |
observe.common.SetLogbookDto.action.goToOpen.tip=Go to open set (Logbook) \#TODO
|
| 1094 |
+observe.common.SetLonglineLogbookDto.action.copyValuesAndSave=Copy values and save \#TODO
|
|
| 1094 | 1095 |
observe.common.SetLonglineLogbookDto.action.reset.homeId.tip=Reiniciar el id de negocio
|
| 1095 | 1096 |
observe.common.SetLonglineLogbookDto.basketLineLength=Bakset line length (m) \#TODO
|
| 1096 | 1097 |
observe.common.SetLonglineLogbookDto.haulingTab=Arrastre
|
| ... | ... | @@ -1091,6 +1091,7 @@ observe.common.SetDto.action.goToOpen.short=Calée ouverte |
| 1091 | 1091 |
observe.common.SetDto.action.goToOpen.tip=Accéder à la calée ouverte
|
| 1092 | 1092 |
observe.common.SetLogbookDto.action.goToOpen.short=Livre de bord - Calée ouverte
|
| 1093 | 1093 |
observe.common.SetLogbookDto.action.goToOpen.tip=Accéder à la calée ouverte (Livre de bord)
|
| 1094 |
+observe.common.SetLonglineLogbookDto.action.copyValuesAndSave=Recopier les propriétés et enregister
|
|
| 1094 | 1095 |
observe.common.SetLonglineLogbookDto.action.reset.homeId.tip=Réinitialiser l'id métier
|
| 1095 | 1096 |
observe.common.SetLonglineLogbookDto.basketLineLength=Longueur de la ligne par panier (m)
|
| 1096 | 1097 |
observe.common.SetLonglineLogbookDto.haulingTab=Virage
|
| ... | ... | @@ -102,4 +102,11 @@ public class SetLonglineLogbookGlobalCompositionDto extends GeneratedSetLongline |
| 102 | 102 |
firePropertyChange(PROPERTY_BAITS_COMPOSITION_PROPORTION_SUM, 0, sum);
|
| 103 | 103 |
}
|
| 104 | 104 |
|
| 105 |
+ public void removeIds() {
|
|
| 106 |
+ setId(null);
|
|
| 107 |
+ getBaitsComposition().forEach(e -> e.setId(null));
|
|
| 108 |
+ getBranchlinesComposition().forEach(e -> e.setId(null));
|
|
| 109 |
+ getFloatlinesComposition().forEach(e -> e.setId(null));
|
|
| 110 |
+ getHooksComposition().forEach(e -> e.setId(null));
|
|
| 111 |
+ }
|
|
| 105 | 112 |
}
|
| ... | ... | @@ -96,6 +96,7 @@ catchLongline {*} data.longline.CatchLonglineLogbook | ordered |
| 96 | 96 |
data.longline.SetLonglineLogbookStub > data.Data | mainDto=skip
|
| 97 | 97 |
homeId + {*:1} String
|
| 98 | 98 |
number + {*:1} Integer
|
| 99 |
+settingStartTimeStamp + {*:1} Date
|
|
| 99 | 100 |
activityLongline {*:1} fr.ird.observe.dto.data.longline.ActivityLonglineLogbookReference | unique
|
| 100 | 101 |
|
| 101 | 102 |
|
| ... | ... | @@ -50,6 +50,7 @@ public class SetLonglineLogbookStubEntityDtoBinder extends DataEntityDtoBinderSu |
| 50 | 50 |
|
| 51 | 51 |
dto.setHomeId(entity.getHomeId());
|
| 52 | 52 |
dto.setNumber(entity.getNumber());
|
| 53 |
+ dto.setSettingStartTimeStamp(entity.getSettingStartTimeStamp());
|
|
| 53 | 54 |
dto.setActivityLongline(toDataReference(referentialLocale, null));
|
| 54 | 55 |
|
| 55 | 56 |
}
|
| ... | ... | @@ -131,6 +131,7 @@ GET /api/v1/data/longline/SetLonglineLogbookService/loadForm |
| 131 | 131 |
GET /api/v1/data/longline/SetLonglineLogbookService/loadReferenceToRead v1.data.longline.SetLonglineLogbookServiceRestApi.loadReferenceToRead
|
| 132 | 132 |
GET /api/v1/data/longline/SetLonglineLogbookService/preCreate v1.data.longline.SetLonglineLogbookServiceRestApi.preCreate
|
| 133 | 133 |
POST /api/v1/data/longline/SetLonglineLogbookService/save v1.data.longline.SetLonglineLogbookServiceRestApi.save
|
| 134 |
+POST /api/v1/data/longline/SetLonglineLogbookService/saveAndCopyProperties v1.data.longline.SetLonglineLogbookServiceRestApi.saveAndCopyProperties
|
|
| 134 | 135 |
GET /api/v1/data/longline/SetLonglineObsCatchService/loadForm v1.data.longline.SetLonglineObsCatchServiceRestApi.loadForm
|
| 135 | 136 |
POST /api/v1/data/longline/SetLonglineObsCatchService/save v1.data.longline.SetLonglineObsCatchServiceRestApi.save
|
| 136 | 137 |
GET /api/v1/data/longline/SetLonglineObsDetailCompositionService/canDeleteBasket v1.data.longline.SetLonglineObsDetailCompositionServiceRestApi.canDeleteBasket
|
| ... | ... | @@ -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>.
|
| ... | ... | @@ -28,6 +28,7 @@ import fr.ird.observe.dto.DataNotFoundException; |
| 28 | 28 |
import fr.ird.observe.dto.data.longline.ActivityLonglineLogbookDto;
|
| 29 | 29 |
import fr.ird.observe.dto.data.longline.ActivityLonglineLogbookReference;
|
| 30 | 30 |
import fr.ird.observe.dto.data.longline.SetLonglineLogbookDto;
|
| 31 |
+import fr.ird.observe.dto.data.longline.SetLonglineLogbookGlobalCompositionDto;
|
|
| 31 | 32 |
import fr.ird.observe.dto.data.longline.SetLonglineLogbookReference;
|
| 32 | 33 |
import fr.ird.observe.dto.data.longline.SetLonglineLogbookStubDto;
|
| 33 | 34 |
import fr.ird.observe.dto.form.Form;
|
| ... | ... | @@ -36,6 +37,7 @@ import fr.ird.observe.entities.longline.ActivityLonglineLogbook; |
| 36 | 37 |
import fr.ird.observe.entities.longline.SetLonglineLogbook;
|
| 37 | 38 |
import fr.ird.observe.entities.longline.TripLongline;
|
| 38 | 39 |
import fr.ird.observe.services.local.service.ObserveServiceLocal;
|
| 40 |
+import fr.ird.observe.services.service.data.longline.SetLonglineLogbookGlobalCompositionService;
|
|
| 39 | 41 |
import fr.ird.observe.services.service.data.longline.SetLonglineLogbookService;
|
| 40 | 42 |
import org.apache.commons.lang3.time.DateUtils;
|
| 41 | 43 |
|
| ... | ... | @@ -107,6 +109,32 @@ public class SetLonglineLogbookServiceLocal extends ObserveServiceLocal implemen |
| 107 | 109 |
return result;
|
| 108 | 110 |
}
|
| 109 | 111 |
|
| 112 |
+ @Override
|
|
| 113 |
+ public SaveResultDto saveAndCopyProperties(String activityLonglineId, String setToCopyId, SetLonglineLogbookDto dto) {
|
|
| 114 |
+ ActivityLonglineLogbook activityLongline = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId);
|
|
| 115 |
+ SetLonglineLogbook entityToCopy = SET_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), setToCopyId);
|
|
| 116 |
+ SetLonglineLogbook entity = SET_LONGLINE_LOGBOOK_SPI.loadOrCreateEntityFromDataDto(getTopiaPersistenceContext(), dto);
|
|
| 117 |
+ checkLastUpdateDate(entity, dto);
|
|
| 118 |
+ |
|
| 119 |
+ SetLonglineLogbookGlobalCompositionService globalCompositionService = serviceContext.newService(SetLonglineLogbookGlobalCompositionService.class);
|
|
| 120 |
+ SetLonglineLogbookGlobalCompositionDto globalCompositionToCopy = globalCompositionService.loadForm(setToCopyId).getObject();
|
|
| 121 |
+ |
|
| 122 |
+ globalCompositionToCopy.removeIds();
|
|
| 123 |
+ SET_LONGLINE_LOGBOOK_GLOBAL_COMPOSITION_SPI.copyDataDtoToEntity(globalCompositionToCopy, entity, getReferentialLocale());
|
|
| 124 |
+ SET_LONGLINE_LOGBOOK_SPI.copyDataDtoToEntity(dto, entity, getReferentialLocale());
|
|
| 125 |
+ |
|
| 126 |
+ entity.setTotalLineLength(entityToCopy.getTotalLineLength());
|
|
| 127 |
+ entity.setBasketLineLength(entityToCopy.getBasketLineLength());
|
|
| 128 |
+ entity.setLengthBetweenBranchlines(entityToCopy.getLengthBetweenBranchlines());
|
|
| 129 |
+ entity.setLineType(entityToCopy.getLineType());
|
|
| 130 |
+ |
|
| 131 |
+ SaveResultDto result = saveEntity(entity);
|
|
| 132 |
+ if (dto.isNotPersisted()) {
|
|
| 133 |
+ activityLongline.setSetLongline(entity);
|
|
| 134 |
+ }
|
|
| 135 |
+ return result;
|
|
| 136 |
+ }
|
|
| 137 |
+ |
|
| 110 | 138 |
@Override
|
| 111 | 139 |
public void delete(String activityLonglineId, String setLonglineId) {
|
| 112 | 140 |
ActivityLonglineLogbook activityLongline = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId);
|
| ... | ... | @@ -128,6 +156,7 @@ public class SetLonglineLogbookServiceLocal extends ObserveServiceLocal implemen |
| 128 | 156 |
otherSetDto.setId(otherSetLongline.getTopiaId());
|
| 129 | 157 |
otherSetDto.setHomeId(otherSetLongline.getHomeId());
|
| 130 | 158 |
otherSetDto.setNumber(otherSetLongline.getNumber());
|
| 159 |
+ otherSetDto.setSettingStartTimeStamp(otherSetLongline.getSettingStartTimeStamp());
|
|
| 131 | 160 |
ActivityLonglineLogbookReference reference = binder.toReference(getReferentialLocale(), activityLongline);
|
| 132 | 161 |
otherSetDto.setActivityLongline(reference);
|
| 133 | 162 |
result.add(otherSetDto);
|
| ... | ... | @@ -64,6 +64,11 @@ public interface SetLonglineLogbookService extends ObserveService { |
| 64 | 64 |
@Post
|
| 65 | 65 |
SaveResultDto save(String activityLonglineId, SetLonglineLogbookDto dto);
|
| 66 | 66 |
|
| 67 |
+ @WriteDataPermission
|
|
| 68 |
+ @Write
|
|
| 69 |
+ @Post
|
|
| 70 |
+ SaveResultDto saveAndCopyProperties(String activityLonglineId, String setToCopyId, SetLonglineLogbookDto dto);
|
|
| 71 |
+ |
|
| 67 | 72 |
@Write
|
| 68 | 73 |
@WriteDataPermission
|
| 69 | 74 |
@Delete
|