Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
c2a5a240
by Tony Chemit at 2020-12-02T10:30:47+01:00
-
d6a73b1b
by Tony Chemit at 2020-12-02T10:39:13+01:00
-
1923b958
by Tony Chemit at 2020-12-02T10:40:27+01:00
-
de883bd1
by Tony Chemit at 2020-12-02T10:40:38+01:00
-
1420acb5
by Tony Chemit at 2020-12-02T10:40:51+01:00
30 changed files:
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/actions/TripUIGenerateHomeId.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/BranchlineUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/LonglinePositionHelper.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/actions/SetDetailCompositionUIDeleteAll.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/DiscardedTargetSampleUINavigationContext.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/KeptTargetSampleUINavigationContext.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/NonTargetSampleUINavigationContext.java
- models/dto/src/main/java/fr/ird/observe/dto/data/ll/observation/LonglineCompositionDto.java
- models/dto/src/main/models/Observe-30-data-ll-observation.model
- models/persistence/src/main/java/fr/ird/observe/entities/data/ll/observation/SetImpl.java
- server/core/src/main/filtered-resources/mapping
- − services/api/src/main/java/fr/ird/observe/services/service/data/ll/common/TripService.java
- − services/api/src/main/java/fr/ird/observe/services/service/data/ll/observation/SetDetailCompositionService.java
- − services/api/src/main/java/fr/ird/observe/services/service/data/ps/common/TripService.java
- − services/api/src/main/java/fr/ird/observe/services/service/data/ps/observation/DiscardedTargetSampleService.java
- services/api/src/main/java/fr/ird/observe/services/service/data/ps/observation/NonTargetSampleService.java
- − services/api/src/main/java/fr/ird/observe/services/service/data/ps/observation/SetService.java
- services/api/src/main/java/fr/ird/observe/services/service/data/ps/observation/TargetSampleAwareService.java
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/ll/common/TripServiceLocal.java
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/ll/observation/SetDetailCompositionServiceLocal.java
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/ps/observation/NonTargetSampleServiceLocal.java
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/ps/observation/TargetSampleServiceLocalSupport.java
- services/local-impl/src/test/java/fr/ird/observe/services/local/service/data/ps/observation/DiscardedTargetSampleServiceLocalTest.java
- services/local-impl/src/test/java/fr/ird/observe/services/local/service/data/ps/observation/KeptTargetSampleServiceLocalTest.java
- services/api/src/main/java/fr/ird/observe/services/service/data/ps/observation/KeptTargetSampleService.java → services/local-impl/src/test/java/fr/ird/observe/services/local/service/data/ps/observation/NonTargetSampleServiceLocalTest.java
- toolkit/service/src/main/java/fr/ird/observe/services/service/DataSourceService.java
- toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/service/OpenableServiceTransformer.java
- toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/service/SimpleServiceTransformer.java
Changes:
| ... | ... | @@ -43,7 +43,7 @@ public class TripUIGenerateHomeId extends ContentUIActionSupport<TripUI> { |
| 43 | 43 |
|
| 44 | 44 |
@Override
|
| 45 | 45 |
protected void doActionPerformed(ActionEvent e, TripUI ui) {
|
| 46 |
- String homeId = getDataSource().getLlCommonTripService().generateHomeId();
|
|
| 46 |
+ String homeId = getDataSource().getDataSourceService().generateHomeId();
|
|
| 47 | 47 |
ui.getModel().getStates().getBean().setHomeId(homeId);
|
| 48 | 48 |
}
|
| 49 | 49 |
}
|
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.client.datasource.editor.ll.data.observation; |
| 25 | 25 |
import fr.ird.observe.client.ClientUIContext;
|
| 26 | 26 |
import fr.ird.observe.client.datasource.editor.api.content.actions.ResetForm;
|
| 27 | 27 |
import fr.ird.observe.client.datasource.editor.api.content.actions.reset.DefaultResetAdapter;
|
| 28 |
+import fr.ird.observe.client.datasource.editor.api.content.data.simple.ContentSimpleUIModelStates;
|
|
| 28 | 29 |
import fr.ird.observe.client.datasource.editor.api.content.ui.ObserveLayoutFocusTraversalPolicy;
|
| 29 | 30 |
import fr.ird.observe.client.util.UIHelper;
|
| 30 | 31 |
import fr.ird.observe.dto.data.ll.observation.BranchlineDto;
|
| ... | ... | @@ -67,8 +68,7 @@ public class BranchlineUIHandler extends GeneratedBranchlineUIHandler { |
| 67 | 68 |
} else {
|
| 68 | 69 |
beanToSave.setTimeSinceContact(null);
|
| 69 | 70 |
}
|
| 70 |
- |
|
| 71 |
- log.info("Time since contact: " + beanToSave.getTimeSinceContact());
|
|
| 71 |
+ log.info(String.format("Time since contact: %d", beanToSave.getTimeSinceContact()));
|
|
| 72 | 72 |
|
| 73 | 73 |
// for external models
|
| 74 | 74 |
ui.getModel().fireSaved();
|
| ... | ... | @@ -83,7 +83,7 @@ public class BranchlineUIHandler extends GeneratedBranchlineUIHandler { |
| 83 | 83 |
ui.getModel().setResetEdit(true);
|
| 84 | 84 |
try {
|
| 85 | 85 |
BranchlineDto branchline = ui.getModel().getBranchline();
|
| 86 |
- // on arrete l'edition
|
|
| 86 |
+ // on arrête l'édition
|
|
| 87 | 87 |
stopEditUI();
|
| 88 | 88 |
// on re-ouvre l'écran d'édition
|
| 89 | 89 |
try {
|
| ... | ... | @@ -186,14 +186,15 @@ public class BranchlineUIHandler extends GeneratedBranchlineUIHandler { |
| 186 | 186 |
// oldBranchline.removePropertyChangeListener(BranchlineDto.PROPERTY_TIMER, timerChanged);
|
| 187 | 187 |
// }
|
| 188 | 188 |
model.setBranchline(branchline);
|
| 189 |
+ ContentSimpleUIModelStates<BranchlineDto> states = model.getStates();
|
|
| 189 | 190 |
if (branchline == null) {
|
| 190 |
- model.getStates().getBean().clear();
|
|
| 191 |
+ states.getBean().clear();
|
|
| 191 | 192 |
Date timeSinceContactDate = DateUtil.createDate(0, 0, 0, 0, 0, 0);
|
| 192 | 193 |
model.setTimeSinceContact(timeSinceContactDate);
|
| 193 | 194 |
// stop edit
|
| 194 | 195 |
stopEditUI();
|
| 195 | 196 |
} else {
|
| 196 |
- branchline.copy(model.getStates().getBean());
|
|
| 197 |
+ branchline.copy(states.getBean());
|
|
| 197 | 198 |
if (Objects.equals(true, branchline.getTimer())) {
|
| 198 | 199 |
Long timeSinceContact = branchline.getTimeSinceContact();
|
| 199 | 200 |
if (timeSinceContact != null) {
|
| ... | ... | @@ -204,7 +205,7 @@ public class BranchlineUIHandler extends GeneratedBranchlineUIHandler { |
| 204 | 205 |
Date timeSinceContactDate = DateUtil.createDate(0, 0, 0, 0, 0, 0);
|
| 205 | 206 |
model.setTimeSinceContact(timeSinceContactDate);
|
| 206 | 207 |
}
|
| 207 |
- if (model.getStates().isEnabled() && !model.getStates().isEditing()) {
|
|
| 208 |
+ if (states.isEnabled() && !states.isEditing()) {
|
|
| 208 | 209 |
startEditUI();
|
| 209 | 210 |
}
|
| 210 | 211 |
}
|
| ... | ... | @@ -214,9 +215,10 @@ public class BranchlineUIHandler extends GeneratedBranchlineUIHandler { |
| 214 | 215 |
public boolean tryToQuit() {
|
| 215 | 216 |
boolean canContinue;
|
| 216 | 217 |
BranchlineUIModel model = getModel();
|
| 217 |
- if (model.getStates().isEditing() && model.getStates().isModified()) {
|
|
| 218 |
+ ContentSimpleUIModelStates<BranchlineDto> states = model.getStates();
|
|
| 219 |
+ if (states.isEditing() && states.isModified()) {
|
|
| 218 | 220 |
canContinue = false;
|
| 219 |
- if (model.getStates().isValid()) {
|
|
| 221 |
+ if (states.isValid()) {
|
|
| 220 | 222 |
// le formulaire est valide, on demande a l'utilisateur s'il
|
| 221 | 223 |
// veut la sauvegarder
|
| 222 | 224 |
int response = ClientUIContext.askUser(
|
| ... | ... | @@ -236,7 +238,7 @@ public class BranchlineUIHandler extends GeneratedBranchlineUIHandler { |
| 236 | 238 |
case 0:
|
| 237 | 239 |
// will save ui
|
| 238 | 240 |
// sauvegarde des modifications
|
| 239 |
- doSave(ui, model.getStates().getBean());
|
|
| 241 |
+ doSave(ui, states.getBean());
|
|
| 240 | 242 |
canContinue = true;
|
| 241 | 243 |
break;
|
| 242 | 244 |
case 1:
|
| ... | ... | @@ -46,35 +46,26 @@ import java.util.stream.Collectors; |
| 46 | 46 |
public class LonglinePositionHelper<D extends LonglinePositionAwareDto> {
|
| 47 | 47 |
|
| 48 | 48 |
protected final JaxxComboBox<SectionReference> uiSection;
|
| 49 |
- |
|
| 50 | 49 |
protected final JaxxComboBox<BasketReference> uiBasket;
|
| 51 |
- |
|
| 52 | 50 |
protected final JaxxComboBox<BranchlineReference> uiBranchline;
|
| 53 | 51 |
|
| 54 | 52 |
// To avoid any propagation when doing some works on locations
|
| 55 | 53 |
protected boolean locationIsAdjusting;
|
| 56 |
- |
|
| 57 | 54 |
protected Collection<SectionReference> sectionUniverse;
|
| 58 |
- |
|
| 59 | 55 |
protected Collection<BasketReference> basketUniverse;
|
| 60 |
- |
|
| 61 | 56 |
protected Collection<BranchlineReference> branchlineUniverse;
|
| 62 | 57 |
|
| 63 | 58 |
public LonglinePositionHelper(JaxxComboBox<SectionReference> uiSection,
|
| 64 | 59 |
JaxxComboBox<BasketReference> uiBasket,
|
| 65 | 60 |
JaxxComboBox<BranchlineReference> uiBranchline,
|
| 66 | 61 |
D tableEditBean) {
|
| 67 |
- |
|
| 68 | 62 |
this.uiSection = uiSection;
|
| 69 | 63 |
this.uiBasket = uiBasket;
|
| 70 | 64 |
this.uiBranchline = uiBranchline;
|
| 71 |
- |
|
| 72 | 65 |
@SuppressWarnings("unchecked") PropertyChangeListener sectionChanged = evt -> onSectionChanged((SectionReference) evt.getNewValue(), (D) evt.getSource());
|
| 73 | 66 |
tableEditBean.addPropertyChangeListener(CatchDto.PROPERTY_SECTION, sectionChanged);
|
| 74 |
- |
|
| 75 | 67 |
@SuppressWarnings("unchecked") PropertyChangeListener basketChanged = evt -> onBasketChanged((BasketReference) evt.getNewValue(), (D) evt.getSource());
|
| 76 | 68 |
tableEditBean.addPropertyChangeListener(CatchDto.PROPERTY_BASKET, basketChanged);
|
| 77 |
- |
|
| 78 | 69 |
// tri par virage
|
| 79 | 70 |
uiSection.getIndexes().setSelectedButton(1);
|
| 80 | 71 |
// tri par virage
|
| ... | ... | @@ -88,65 +79,44 @@ public class LonglinePositionHelper<D extends LonglinePositionAwareDto> { |
| 88 | 79 |
this.sectionUniverse = positionSetDto.getSections();
|
| 89 | 80 |
this.basketUniverse = positionSetDto.getBaskets();
|
| 90 | 81 |
this.branchlineUniverse = positionSetDto.getBranchlines();
|
| 91 |
- |
|
| 92 | 82 |
for (D dto : dtos) {
|
| 93 |
- |
|
| 94 | 83 |
BranchlineReference branchline = dto.getBranchline();
|
| 95 |
- |
|
| 96 | 84 |
if (branchline != null) {
|
| 97 |
- |
|
| 98 | 85 |
BasketReference basket = getBasket(branchline);
|
| 99 | 86 |
dto.setBasket(basket);
|
| 100 |
- |
|
| 101 | 87 |
}
|
| 102 |
- |
|
| 103 | 88 |
BasketReference basket = dto.getBasket();
|
| 104 |
- |
|
| 105 | 89 |
if (basket != null) {
|
| 106 |
- |
|
| 107 | 90 |
SectionReference section = getSection(basket);
|
| 108 | 91 |
dto.setSection(section);
|
| 109 |
- |
|
| 110 | 92 |
}
|
| 111 | 93 |
}
|
| 112 | 94 |
uiSection.setData(getSections());
|
| 113 | 95 |
}
|
| 114 | 96 |
|
| 115 | 97 |
public void resetPosition(D dto) {
|
| 116 |
- |
|
| 117 | 98 |
SectionReference section = dto.getSection();
|
| 118 | 99 |
BasketReference basket = dto.getBasket();
|
| 119 | 100 |
BranchlineReference branchline = dto.getBranchline();
|
| 120 |
- |
|
| 121 | 101 |
uiBranchline.setSelectedItem(null);
|
| 122 | 102 |
uiSection.setSelectedItem(null);
|
| 123 | 103 |
uiBasket.setSelectedItem(null);
|
| 124 |
- |
|
| 125 | 104 |
if (section != null) {
|
| 126 |
- |
|
| 127 | 105 |
// reload section (basket and branchlines universe will then changed)
|
| 128 | 106 |
uiSection.setSelectedItem(section);
|
| 129 |
- |
|
| 130 | 107 |
}
|
| 131 |
- |
|
| 132 | 108 |
if (basket != null) {
|
| 133 |
- |
|
| 134 | 109 |
// reload basket (branchlines universe will then changed)
|
| 135 | 110 |
uiBasket.setSelectedItem(basket);
|
| 136 |
- |
|
| 137 | 111 |
}
|
| 138 |
- |
|
| 139 | 112 |
if (branchline != null) {
|
| 140 |
- |
|
| 141 | 113 |
// reload branchline
|
| 142 | 114 |
uiBranchline.setSelectedItem(branchline);
|
| 143 |
- |
|
| 144 | 115 |
}
|
| 145 |
- |
|
| 146 | 116 |
}
|
| 147 | 117 |
|
| 148 |
- public void savePosition(List<D> dtos) {
|
|
| 149 |
- for (D dto : dtos) {
|
|
| 118 |
+ public void savePosition(List<D> dtoList) {
|
|
| 119 |
+ for (D dto : dtoList) {
|
|
| 150 | 120 |
if (dto.getBasket() != null) {
|
| 151 | 121 |
// remove section
|
| 152 | 122 |
dto.setSection(null);
|
| ... | ... | @@ -159,107 +129,66 @@ public class LonglinePositionHelper<D extends LonglinePositionAwareDto> { |
| 159 | 129 |
}
|
| 160 | 130 |
|
| 161 | 131 |
public List<SectionReference> getSections() {
|
| 162 |
- |
|
| 163 | 132 |
List<SectionReference> sections = new ArrayList<>();
|
| 164 |
- |
|
| 165 | 133 |
if (sectionUniverse != null) {
|
| 166 |
- |
|
| 167 | 134 |
sections.addAll(sectionUniverse);
|
| 168 |
- |
|
| 169 | 135 |
}
|
| 170 |
- |
|
| 171 | 136 |
return sections;
|
| 172 | 137 |
}
|
| 173 | 138 |
|
| 174 | 139 |
protected void onSectionChanged(SectionReference newValue, D dto) {
|
| 175 |
- |
|
| 176 | 140 |
locationIsAdjusting = true;
|
| 177 |
- |
|
| 178 | 141 |
try {
|
| 179 |
- |
|
| 180 | 142 |
BasketReference basket = dto.getBasket();
|
| 181 | 143 |
BranchlineReference branchline = dto.getBranchline();
|
| 182 |
- |
|
| 183 |
- // on deselectionne le panier
|
|
| 144 |
+ // on désélectionne le panier
|
|
| 184 | 145 |
dto.setBasket(null);
|
| 185 |
- |
|
| 186 |
- // on deselectionne l'avançon
|
|
| 146 |
+ // on désélectionne l'avançon
|
|
| 187 | 147 |
dto.setBranchline(null);
|
| 188 |
- |
|
| 189 | 148 |
// on vide l'ensemble des paniers
|
| 190 | 149 |
uiBasket.setData(Collections.emptyList());
|
| 191 |
- |
|
| 192 | 150 |
// on vide l'ensemble des avançons
|
| 193 | 151 |
uiBranchline.setData(Collections.emptyList());
|
| 194 |
- |
|
| 195 | 152 |
if (newValue != null) {
|
| 196 |
- |
|
| 197 | 153 |
// une section est sélectionnée
|
| 198 |
- |
|
| 199 | 154 |
// on remplit uniquement les paniers de cette section
|
| 200 | 155 |
List<BasketReference> baskets = getBaskets(newValue);
|
| 201 | 156 |
uiBasket.setData(new ArrayList<>(baskets));
|
| 202 |
- |
|
| 203 | 157 |
if (basket != null && baskets.contains(basket)) {
|
| 204 |
- |
|
| 205 | 158 |
// un panier est sélectionné
|
| 206 |
- |
|
| 207 |
- // on repmlit uniquement les avançons du panier
|
|
| 159 |
+ // on remplit uniquement les avançons du panier
|
|
| 208 | 160 |
List<BranchlineReference> branchlines = getBranchlines(basket);
|
| 209 | 161 |
uiBranchline.setData(new ArrayList<>(branchlines));
|
| 210 | 162 |
dto.setBasket(basket);
|
| 211 |
- |
|
| 212 | 163 |
if (branchline != null && branchlines.contains(branchline)) {
|
| 213 |
- |
|
| 214 | 164 |
// un avançon est sélectionné
|
| 215 | 165 |
dto.setBranchline(branchline);
|
| 216 |
- |
|
| 217 | 166 |
}
|
| 218 |
- |
|
| 219 | 167 |
}
|
| 220 |
- |
|
| 221 | 168 |
}
|
| 222 |
- |
|
| 223 | 169 |
} finally {
|
| 224 |
- |
|
| 225 | 170 |
locationIsAdjusting = false;
|
| 226 |
- |
|
| 227 | 171 |
}
|
| 228 |
- |
|
| 229 | 172 |
}
|
| 230 | 173 |
|
| 231 | 174 |
protected void onBasketChanged(BasketReference newValue, D dto) {
|
| 232 |
- |
|
| 233 | 175 |
if (!locationIsAdjusting) {
|
| 234 |
- |
|
| 235 | 176 |
BranchlineReference branchline = dto.getBranchline();
|
| 236 |
- |
|
| 237 |
- // on deselectionne l'avançon
|
|
| 177 |
+ // on désélectionne l'avançon
|
|
| 238 | 178 |
dto.setBranchline(null);
|
| 239 |
- |
|
| 240 | 179 |
// on vide l'ensemble des avançons
|
| 241 | 180 |
uiBranchline.setData(Collections.emptyList());
|
| 242 |
- |
|
| 243 | 181 |
if (newValue != null) {
|
| 244 |
- |
|
| 245 |
- // un panier est selectionne
|
|
| 246 |
- |
|
| 182 |
+ // un panier est sélectionné
|
|
| 247 | 183 |
// on remplit uniquement les avançons des paniers
|
| 248 | 184 |
List<BranchlineReference> branchlines = getBranchlines(newValue);
|
| 249 | 185 |
uiBranchline.setData(branchlines);
|
| 250 |
- |
|
| 251 |
- |
|
| 252 | 186 |
if (branchline != null && branchlines.contains(branchline)) {
|
| 253 |
- |
|
| 254 | 187 |
// un avançon est sélectionné
|
| 255 | 188 |
dto.setBranchline(branchline);
|
| 256 |
- |
|
| 257 | 189 |
}
|
| 258 |
- |
|
| 259 | 190 |
}
|
| 260 |
- |
|
| 261 | 191 |
}
|
| 262 |
- |
|
| 263 | 192 |
}
|
| 264 | 193 |
|
| 265 | 194 |
private SectionReference getSection(BasketReference basket) {
|
| ... | ... | @@ -946,19 +946,19 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 946 | 946 |
|
| 947 | 947 |
public boolean canDeleteSection(SectionDto section) {
|
| 948 | 948 |
|
| 949 |
- return section.isNotPersisted() || getLlObservationSetDetailCompositionService().canDeleteSection(section.getId());
|
|
| 949 |
+ return section.isNotPersisted() || section.isNotUsed();
|
|
| 950 | 950 |
|
| 951 | 951 |
}
|
| 952 | 952 |
|
| 953 | 953 |
private boolean canDeleteBasket(BasketDto basket) {
|
| 954 | 954 |
|
| 955 |
- return basket.isNotPersisted() || getLlObservationSetDetailCompositionService().canDeleteBasket(basket.getId());
|
|
| 955 |
+ return basket.isNotPersisted() || basket.isNotUsed();
|
|
| 956 | 956 |
|
| 957 | 957 |
}
|
| 958 | 958 |
|
| 959 | 959 |
private boolean canDeleteBranchline(BranchlineDto branchline) {
|
| 960 | 960 |
|
| 961 |
- return branchline.isNotPersisted() || getLlObservationSetDetailCompositionService().canDeleteBranchline(branchline.getId());
|
|
| 961 |
+ return branchline.isNotPersisted() || branchline.isNotUsed();
|
|
| 962 | 962 |
|
| 963 | 963 |
}
|
| 964 | 964 |
|
| ... | ... | @@ -50,7 +50,8 @@ public class SetDetailCompositionUIDeleteAll extends ContentUIActionSupport<SetD |
| 50 | 50 |
private static final Logger log = LogManager.getLogger(SetDetailCompositionUIDeleteAll.class);
|
| 51 | 51 |
|
| 52 | 52 |
public SetDetailCompositionUIDeleteAll() {
|
| 53 |
- super(t("observe.data.ll.observation.SetDetailComposition.action.deleteAllSections"), t("observe.data.ll.observation.SetDetailComposition.action.deleteAllSections.tip"), "delete", ObserveLLKeyStrokes.KEY_STROKE_DELETE_DATA_GLOBAL);
|
|
| 53 |
+ super(t("observe.data.ll.observation.SetDetailComposition.action.deleteAllSections"), t("observe.data.ll.observation.SetDetailComposition.action.deleteAllSections.tip"), null, ObserveLLKeyStrokes.KEY_STROKE_DELETE_DATA_GLOBAL);
|
|
| 54 |
+ setIcon(getContentScaledImage("delete"));
|
|
| 54 | 55 |
}
|
| 55 | 56 |
|
| 56 | 57 |
@Override
|
| ... | ... | @@ -34,6 +34,6 @@ public class DiscardedTargetSampleUINavigationContext extends GeneratedDiscarded |
| 34 | 34 |
|
| 35 | 35 |
@Override
|
| 36 | 36 |
protected boolean computeShowSata(ContentTableUINavigationInitializer initializer) {
|
| 37 |
- return getService().canUseTargetSample(initializer.getSelectedId());
|
|
| 37 |
+ return getService().canUseSample(initializer.getSelectedId());
|
|
| 38 | 38 |
}
|
| 39 | 39 |
}
|
| ... | ... | @@ -34,6 +34,6 @@ public class KeptTargetSampleUINavigationContext extends GeneratedKeptTargetSamp |
| 34 | 34 |
|
| 35 | 35 |
@Override
|
| 36 | 36 |
protected boolean computeShowSata(ContentTableUINavigationInitializer initializer) {
|
| 37 |
- return getService().canUseTargetSample(initializer.getSelectedId());
|
|
| 37 |
+ return getService().canUseSample(initializer.getSelectedId());
|
|
| 38 | 38 |
}
|
| 39 | 39 |
}
|
| ... | ... | @@ -34,6 +34,6 @@ public class NonTargetSampleUINavigationContext extends GeneratedNonTargetSample |
| 34 | 34 |
|
| 35 | 35 |
@Override
|
| 36 | 36 |
protected boolean computeShowSata(ContentTableUINavigationInitializer initializer) {
|
| 37 |
- return getService().canUseNonTargetSample(initializer.getSelectedId());
|
|
| 37 |
+ return getService().canUseSample(initializer.getSelectedId());
|
|
| 38 | 38 |
}
|
| 39 | 39 |
}
|
| ... | ... | @@ -40,4 +40,5 @@ public interface LonglineCompositionDto extends DtoParentAware { |
| 40 | 40 |
|
| 41 | 41 |
Integer getHaulingIdentifier();
|
| 42 | 42 |
|
| 43 |
+ boolean isNotUsed();
|
|
| 43 | 44 |
}
|
| ... | ... | @@ -43,6 +43,7 @@ floatline1Length + {*:1} Float | positiveNumber |
| 43 | 43 |
floatline2Length + {*:1} Float | positiveNumber
|
| 44 | 44 |
branchline + {*} data.ll.observation.Branchline | ordered unique
|
| 45 | 45 |
parentId + {*:1} String
|
| 46 |
+notUsed + {*:1} boolean
|
|
| 46 | 47 |
|
| 47 | 48 |
data.ll.observation.Branchline > data.Simple >> data.ll.observation.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier,parentId
|
| 48 | 49 |
settingIdentifier + {*:1} Integer
|
| ... | ... | @@ -68,6 +69,7 @@ tracelineType {*:0..1} fr.ird.observe.dto.referential.ll.common.LineTypeReferenc |
| 68 | 69 |
topType {*:0..1} fr.ird.observe.dto.referential.ll.common.LineTypeReference | mayNotNull
|
| 69 | 70 |
baitType {*:0..1} fr.ird.observe.dto.referential.ll.common.BaitTypeReference
|
| 70 | 71 |
parentId + {*:1} String
|
| 72 |
+notUsed + {*:1} boolean
|
|
| 71 | 73 |
|
| 72 | 74 |
data.ll.observation.BranchlinesComposition > data.Data | references=topTypeLabel,tracelineTypeLabel,length,proportion
|
| 73 | 75 |
length + {*:1} Float | notNull positiveNumber
|
| ... | ... | @@ -125,6 +127,7 @@ settingIdentifier + {*:1} Integer | notNull positiveNumber |
| 125 | 127 |
haulingIdentifier + {*:1} Integer | positiveNumber
|
| 126 | 128 |
basket + {*} data.ll.observation.Basket | ordered unique
|
| 127 | 129 |
parentId + {*:1} String
|
| 130 |
+notUsed + {*:1} boolean
|
|
| 128 | 131 |
|
| 129 | 132 |
data.ll.observation.SensorUsed > data.Data >> data.WithDataFile | references=sensorTypeLabel
|
| 130 | 133 |
hasData + {*:1} boolean
|
| ... | ... | @@ -22,6 +22,8 @@ package fr.ird.observe.entities.data.ll.observation; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableMap;
|
|
| 26 |
+import com.google.common.collect.Maps;
|
|
| 25 | 27 |
import fr.ird.observe.dto.CoordinateHelper;
|
| 26 | 28 |
import fr.ird.observe.dto.data.DataDto;
|
| 27 | 29 |
import fr.ird.observe.dto.data.ll.observation.BasketReference;
|
| ... | ... | @@ -301,13 +303,26 @@ public class SetImpl extends SetAbstract { |
| 301 | 303 |
}
|
| 302 | 304 |
|
| 303 | 305 |
private void loadDtoParents(SetDetailCompositionDto dto) {
|
| 306 |
+ //FIXME If not performant, let's used an optimized dao query
|
|
| 307 |
+ ImmutableMap<String, Section> sectionsById = Maps.uniqueIndex(getSection(), Section::getTopiaId);
|
|
| 304 | 308 |
dto.getSection().forEach(section -> {
|
| 305 | 309 |
section.setParentId(dto.getId());
|
| 306 | 310 |
String sectionId = section.getTopiaId();
|
| 311 |
+ Section entitySection = sectionsById.get(sectionId);
|
|
| 312 |
+ ImmutableMap<String, Basket> basketsById = Maps.uniqueIndex(entitySection.getBasket(), Basket::getTopiaId);
|
|
| 313 |
+ section.setNotUsed(entitySection.isNotUsed());
|
|
| 307 | 314 |
section.getBasket().forEach(basket -> {
|
| 308 | 315 |
basket.setParentId(sectionId);
|
| 309 | 316 |
String basketId = basket.getTopiaId();
|
| 310 |
- basket.getBranchline().forEach(branchline -> branchline.setParentId(basketId));
|
|
| 317 |
+ Basket entityBasket = basketsById.get(basketId);
|
|
| 318 |
+ basket.setNotUsed(entityBasket.isNotUsed());
|
|
| 319 |
+ ImmutableMap<String, Branchline> branchlinesById = Maps.uniqueIndex(entityBasket.getBranchline(), Branchline::getTopiaId);
|
|
| 320 |
+ basket.getBranchline().forEach(branchline -> {
|
|
| 321 |
+ String branchlineId = branchline.getId();
|
|
| 322 |
+ Branchline entityBranchline = branchlinesById.get(branchlineId);
|
|
| 323 |
+ branchline.setParentId(basketId);
|
|
| 324 |
+ branchline.setNotUsed(entityBranchline.isNotUsed());
|
|
| 325 |
+ });
|
|
| 311 | 326 |
});
|
| 312 | 327 |
});
|
| 313 | 328 |
}
|
| ... | ... | @@ -60,6 +60,7 @@ GET /api/v1/DataSourceService/checkCanConnectOrBeEmpty |
| 60 | 60 |
GET /api/v1/DataSourceService/close v1.DataSourceServiceRestApi.close
|
| 61 | 61 |
GET /api/v1/DataSourceService/create v1.DataSourceServiceRestApi.create
|
| 62 | 62 |
GET /api/v1/DataSourceService/destroy v1.DataSourceServiceRestApi.destroy
|
| 63 |
+GET /api/v1/DataSourceService/generateHomeId v1.DataSourceServiceRestApi.generateHomeId
|
|
| 63 | 64 |
GET /api/v1/DataSourceService/getUsers v1.DataSourceServiceRestApi.getUsers
|
| 64 | 65 |
GET /api/v1/DataSourceService/isIdValid v1.DataSourceServiceRestApi.isIdValid
|
| 65 | 66 |
GET /api/v1/DataSourceService/migrateData v1.DataSourceServiceRestApi.migrateData
|
| ... | ... | @@ -97,7 +98,6 @@ GET /api/v1/data/ll/common/TripGearUseFeaturesService/loadForm |
| 97 | 98 |
POST /api/v1/data/ll/common/TripGearUseFeaturesService/save v1.data.ll.common.TripGearUseFeaturesServiceRestApi.save
|
| 98 | 99 |
DELETE /api/v1/data/ll/common/TripService/delete v1.data.ll.common.TripServiceRestApi.delete
|
| 99 | 100 |
GET /api/v1/data/ll/common/TripService/exists v1.data.ll.common.TripServiceRestApi.exists
|
| 100 |
-GET /api/v1/data/ll/common/TripService/generateHomeId v1.data.ll.common.TripServiceRestApi.generateHomeId
|
|
| 101 | 101 |
GET /api/v1/data/ll/common/TripService/getAllTrip v1.data.ll.common.TripServiceRestApi.getAllTrip
|
| 102 | 102 |
GET /api/v1/data/ll/common/TripService/getBrothers v1.data.ll.common.TripServiceRestApi.getBrothers
|
| 103 | 103 |
GET /api/v1/data/ll/common/TripService/getChildren v1.data.ll.common.TripServiceRestApi.getChildren
|
| ... | ... | @@ -183,9 +183,6 @@ GET /api/v1/data/ll/observation/BranchlineService/loadForm |
| 183 | 183 |
POST /api/v1/data/ll/observation/BranchlineService/save v1.data.ll.observation.BranchlineServiceRestApi.save
|
| 184 | 184 |
GET /api/v1/data/ll/observation/SetCatchService/loadForm v1.data.ll.observation.SetCatchServiceRestApi.loadForm
|
| 185 | 185 |
POST /api/v1/data/ll/observation/SetCatchService/save v1.data.ll.observation.SetCatchServiceRestApi.save
|
| 186 |
-GET /api/v1/data/ll/observation/SetDetailCompositionService/canDeleteBasket v1.data.ll.observation.SetDetailCompositionServiceRestApi.canDeleteBasket
|
|
| 187 |
-GET /api/v1/data/ll/observation/SetDetailCompositionService/canDeleteBranchline v1.data.ll.observation.SetDetailCompositionServiceRestApi.canDeleteBranchline
|
|
| 188 |
-GET /api/v1/data/ll/observation/SetDetailCompositionService/canDeleteSection v1.data.ll.observation.SetDetailCompositionServiceRestApi.canDeleteSection
|
|
| 189 | 186 |
GET /api/v1/data/ll/observation/SetDetailCompositionService/loadForm v1.data.ll.observation.SetDetailCompositionServiceRestApi.loadForm
|
| 190 | 187 |
POST /api/v1/data/ll/observation/SetDetailCompositionService/save v1.data.ll.observation.SetDetailCompositionServiceRestApi.save
|
| 191 | 188 |
GET /api/v1/data/ll/observation/SetGlobalCompositionService/loadForm v1.data.ll.observation.SetGlobalCompositionServiceRestApi.loadForm
|
| ... | ... | @@ -229,7 +226,7 @@ GET /api/v1/data/ps/observation/ActivityService/loadReferenceToRead |
| 229 | 226 |
POST /api/v1/data/ps/observation/ActivityService/move v1.data.ps.observation.ActivityServiceRestApi.move
|
| 230 | 227 |
GET /api/v1/data/ps/observation/ActivityService/preCreate v1.data.ps.observation.ActivityServiceRestApi.preCreate
|
| 231 | 228 |
POST /api/v1/data/ps/observation/ActivityService/save v1.data.ps.observation.ActivityServiceRestApi.save
|
| 232 |
-GET /api/v1/data/ps/observation/DiscardedTargetSampleService/canUseTargetSample v1.data.ps.observation.DiscardedTargetSampleServiceRestApi.canUseTargetSample
|
|
| 229 |
+GET /api/v1/data/ps/observation/DiscardedTargetSampleService/canUseSample v1.data.ps.observation.DiscardedTargetSampleServiceRestApi.canUseSample
|
|
| 233 | 230 |
GET /api/v1/data/ps/observation/DiscardedTargetSampleService/getSampleSpecies v1.data.ps.observation.DiscardedTargetSampleServiceRestApi.getSampleSpecies
|
| 234 | 231 |
GET /api/v1/data/ps/observation/DiscardedTargetSampleService/loadForm v1.data.ps.observation.DiscardedTargetSampleServiceRestApi.loadForm
|
| 235 | 232 |
POST /api/v1/data/ps/observation/DiscardedTargetSampleService/save v1.data.ps.observation.DiscardedTargetSampleServiceRestApi.save
|
| ... | ... | @@ -247,11 +244,11 @@ GET /api/v1/data/ps/observation/FloatingObjectService/loadReferenceToRead |
| 247 | 244 |
GET /api/v1/data/ps/observation/FloatingObjectService/preCreate v1.data.ps.observation.FloatingObjectServiceRestApi.preCreate
|
| 248 | 245 |
GET /api/v1/data/ps/observation/FloatingObjectService/preCreate v1.data.ps.observation.FloatingObjectServiceRestApi.preCreate
|
| 249 | 246 |
POST /api/v1/data/ps/observation/FloatingObjectService/save v1.data.ps.observation.FloatingObjectServiceRestApi.save
|
| 250 |
-GET /api/v1/data/ps/observation/KeptTargetSampleService/canUseTargetSample v1.data.ps.observation.KeptTargetSampleServiceRestApi.canUseTargetSample
|
|
| 247 |
+GET /api/v1/data/ps/observation/KeptTargetSampleService/canUseSample v1.data.ps.observation.KeptTargetSampleServiceRestApi.canUseSample
|
|
| 251 | 248 |
GET /api/v1/data/ps/observation/KeptTargetSampleService/getSampleSpecies v1.data.ps.observation.KeptTargetSampleServiceRestApi.getSampleSpecies
|
| 252 | 249 |
GET /api/v1/data/ps/observation/KeptTargetSampleService/loadForm v1.data.ps.observation.KeptTargetSampleServiceRestApi.loadForm
|
| 253 | 250 |
POST /api/v1/data/ps/observation/KeptTargetSampleService/save v1.data.ps.observation.KeptTargetSampleServiceRestApi.save
|
| 254 |
-GET /api/v1/data/ps/observation/NonTargetSampleService/canUseNonTargetSample v1.data.ps.observation.NonTargetSampleServiceRestApi.canUseNonTargetSample
|
|
| 251 |
+GET /api/v1/data/ps/observation/NonTargetSampleService/canUseSample v1.data.ps.observation.NonTargetSampleServiceRestApi.canUseSample
|
|
| 255 | 252 |
GET /api/v1/data/ps/observation/NonTargetSampleService/getSampleSpecies v1.data.ps.observation.NonTargetSampleServiceRestApi.getSampleSpecies
|
| 256 | 253 |
GET /api/v1/data/ps/observation/NonTargetSampleService/getSampleSpeciesFate v1.data.ps.observation.NonTargetSampleServiceRestApi.getSampleSpeciesFate
|
| 257 | 254 |
GET /api/v1/data/ps/observation/NonTargetSampleService/loadForm v1.data.ps.observation.NonTargetSampleServiceRestApi.loadForm
|
| 1 |
-package fr.ird.observe.services.service.data.ll.common;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Services :: API
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2020 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.dto.data.ll.common.TripReference;
|
|
| 26 |
-import fr.ird.observe.services.service.data.TripAwareService;
|
|
| 27 |
-import io.ultreia.java4all.http.spi.Get;
|
|
| 28 |
- |
|
| 29 |
-/**
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- */
|
|
| 32 |
-public interface TripService extends GeneratedTripService, TripAwareService<TripReference> {
|
|
| 33 |
- |
|
| 34 |
- @Get
|
|
| 35 |
- String generateHomeId();
|
|
| 36 |
- |
|
| 37 |
-}
|
| 1 |
-package fr.ird.observe.services.service.data.ll.observation;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Services :: API
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2020 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.security.Permission;
|
|
| 26 |
-import fr.ird.observe.services.spi.MethodCredential;
|
|
| 27 |
-import io.ultreia.java4all.http.spi.Get;
|
|
| 28 |
- |
|
| 29 |
-/**
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- */
|
|
| 32 |
-public interface SetDetailCompositionService extends GeneratedSetDetailCompositionService {
|
|
| 33 |
- |
|
| 34 |
- //FIXME Remove this, add a field in dto containing all elements used, ca after no need to call service
|
|
| 35 |
- @Get
|
|
| 36 |
- @MethodCredential(Permission.WRITE_DATA)
|
|
| 37 |
- boolean canDeleteSection(String sectionId);
|
|
| 38 |
- |
|
| 39 |
- //FIXME Remove this, add a field in dto containing all elements used, ca after no need to call service
|
|
| 40 |
- @Get
|
|
| 41 |
- @MethodCredential(Permission.WRITE_DATA)
|
|
| 42 |
- boolean canDeleteBasket(String basketId);
|
|
| 43 |
- |
|
| 44 |
- //FIXME Remove this, add a field in dto containing all elements used, ca after no need to call service
|
|
| 45 |
- @Get
|
|
| 46 |
- @MethodCredential(Permission.WRITE_DATA)
|
|
| 47 |
- boolean canDeleteBranchline(String branchlineId);
|
|
| 48 |
- |
|
| 49 |
-}
|
| 1 |
-package fr.ird.observe.services.service.data.ps.common;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Services :: API
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2020 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.dto.data.ps.common.TripReference;
|
|
| 26 |
-import fr.ird.observe.services.service.data.TripAwareService;
|
|
| 27 |
- |
|
| 28 |
-/**
|
|
| 29 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 30 |
- */
|
|
| 31 |
-public interface TripService extends GeneratedTripService, TripAwareService<TripReference> {
|
|
| 32 |
- |
|
| 33 |
-}
|
| 1 |
-package fr.ird.observe.services.service.data.ps.observation;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Services :: API
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2020 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 |
-/**
|
|
| 26 |
- * Created on 16/10/2020.
|
|
| 27 |
- *
|
|
| 28 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 29 |
- * @since 8.0.1
|
|
| 30 |
- */
|
|
| 31 |
-public interface DiscardedTargetSampleService extends GeneratedDiscardedTargetSampleService, TargetSampleAwareService {
|
|
| 32 |
- |
|
| 33 |
-}
|
| ... | ... | @@ -23,7 +23,6 @@ package fr.ird.observe.services.service.data.ps.observation; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
|
| 26 |
-import fr.ird.observe.dto.referential.common.SpeciesReference;
|
|
| 27 | 26 |
import fr.ird.observe.dto.referential.ps.common.SpeciesFateReference;
|
| 28 | 27 |
import fr.ird.observe.security.Permission;
|
| 29 | 28 |
import fr.ird.observe.services.spi.MethodCredential;
|
| ... | ... | @@ -34,14 +33,6 @@ import io.ultreia.java4all.http.spi.Get; |
| 34 | 33 |
*/
|
| 35 | 34 |
public interface NonTargetSampleService extends GeneratedNonTargetSampleService {
|
| 36 | 35 |
|
| 37 |
- @Get
|
|
| 38 |
- @MethodCredential(Permission.READ_DATA)
|
|
| 39 |
- boolean canUseNonTargetSample(String setId);
|
|
| 40 |
- |
|
| 41 |
- @Get
|
|
| 42 |
- @MethodCredential(Permission.READ_DATA)
|
|
| 43 |
- ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setId);
|
|
| 44 |
- |
|
| 45 | 36 |
@Get
|
| 46 | 37 |
@MethodCredential(Permission.READ_DATA)
|
| 47 | 38 |
ReferentialDtoReferenceSet<SpeciesFateReference> getSampleSpeciesFate(String setId);
|
| 1 |
-package fr.ird.observe.services.service.data.ps.observation;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Services :: API
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2020 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 |
-/**
|
|
| 26 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 27 |
- */
|
|
| 28 |
-public interface SetService extends GeneratedSetService {
|
|
| 29 |
- |
|
| 30 |
-}
|
| ... | ... | @@ -41,7 +41,7 @@ public interface TargetSampleAwareService extends ObserveService { |
| 41 | 41 |
|
| 42 | 42 |
@Get
|
| 43 | 43 |
@MethodCredential(Permission.READ_DATA)
|
| 44 |
- boolean canUseTargetSample(String setId);
|
|
| 44 |
+ boolean canUseSample(String setId);
|
|
| 45 | 45 |
|
| 46 | 46 |
@Get
|
| 47 | 47 |
@MethodCredential(Permission.READ_DATA)
|
| ... | ... | @@ -54,6 +54,7 @@ import fr.ird.observe.spi.ObservePersistenceBusinessProject; |
| 54 | 54 |
import fr.ird.observe.spi.context.DtoEntityContext;
|
| 55 | 55 |
import org.apache.logging.log4j.LogManager;
|
| 56 | 56 |
import org.apache.logging.log4j.Logger;
|
| 57 |
+import org.hashids.Hashids;
|
|
| 57 | 58 |
import org.nuiton.topia.persistence.jdbc.JdbcHelper;
|
| 58 | 59 |
import org.nuiton.topia.persistence.jdbc.JdbcPostgresHelper;
|
| 59 | 60 |
import org.nuiton.topia.persistence.script.TopiaSqlScript;
|
| ... | ... | @@ -84,6 +85,7 @@ import static io.ultreia.java4all.i18n.I18n.l; |
| 84 | 85 |
public class DataSourceServiceLocal extends ObserveServiceLocal implements DataSourceService {
|
| 85 | 86 |
|
| 86 | 87 |
private static final Logger log = LogManager.getLogger(DataSourceServiceLocal.class);
|
| 88 |
+ private static final Hashids ID_GENERATOR = new Hashids("ObServeHasSomeSalt", 8, "0123456789#abcdefghijklmnopqrestuvwxyz");
|
|
| 87 | 89 |
|
| 88 | 90 |
private static boolean canWrite(Set<?> privileges) {
|
| 89 | 91 |
return privileges != null &&
|
| ... | ... | @@ -173,7 +175,6 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS |
| 173 | 175 |
return dataSourceInformation;
|
| 174 | 176 |
}
|
| 175 | 177 |
|
| 176 |
- |
|
| 177 | 178 |
@Override
|
| 178 | 179 |
public ObserveDataSourceInformation checkCanConnect(ObserveDataSourceConfiguration dataSourceConfiguration) throws DatabaseNotFoundException, DatabaseConnexionNotAuthorizedException {
|
| 179 | 180 |
|
| ... | ... | @@ -540,6 +541,11 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS |
| 540 | 541 |
return id != null && serviceContext.getTopiaPersistenceContext().isTopiaId(spi.toEntityType(), id);
|
| 541 | 542 |
}
|
| 542 | 543 |
|
| 544 |
+ @Override
|
|
| 545 |
+ public String generateHomeId() {
|
|
| 546 |
+ return ID_GENERATOR.encode(now().getTime());
|
|
| 547 |
+ }
|
|
| 548 |
+ |
|
| 543 | 549 |
private ObserveDataSourceConnectionTopia createDataSourceConnection(ObserveDataSourceInformation dataSourceInformation, String authenticationToken) {
|
| 544 | 550 |
return new ObserveDataSourceConnectionTopia(
|
| 545 | 551 |
authenticationToken,
|
| ... | ... | @@ -31,7 +31,6 @@ import fr.ird.observe.services.local.service.data.TripServiceLocalSupport; |
| 31 | 31 |
import fr.ird.observe.services.service.data.ll.common.TripService;
|
| 32 | 32 |
import org.apache.logging.log4j.LogManager;
|
| 33 | 33 |
import org.apache.logging.log4j.Logger;
|
| 34 |
-import org.hashids.Hashids;
|
|
| 35 | 34 |
|
| 36 | 35 |
/**
|
| 37 | 36 |
* @author Tony Chemit - dev@tchemit.fr
|
| ... | ... | @@ -39,11 +38,6 @@ import org.hashids.Hashids; |
| 39 | 38 |
public class TripServiceLocal extends TripServiceLocalSupport<TripDto, TripReference, Trip, TripTopiaDao> implements TripService {
|
| 40 | 39 |
|
| 41 | 40 |
private static final Logger log = LogManager.getLogger(TripServiceLocal.class);
|
| 42 |
- private static final Hashids ID_GENERATOR = new Hashids("ObServeHasSomeSalt", 8, "0123456789#abcdefghijklmnopqrestuvwxyz");
|
|
| 43 |
- |
|
| 44 |
- public TripServiceLocal() {
|
|
| 45 |
- super(Program.SPI, Trip.SPI, Trip.PROPERTY_PROGRAM);
|
|
| 46 |
- }
|
|
| 47 | 41 |
|
| 48 | 42 |
public static boolean copyTripLogbookMetaData(Trip oldTrip, Trip newTrip) {
|
| 49 | 43 |
if (!newTrip.isLogbookAvailability()) {
|
| ... | ... | @@ -73,9 +67,8 @@ public class TripServiceLocal extends TripServiceLocalSupport<TripDto, TripRefer |
| 73 | 67 |
return false;
|
| 74 | 68 |
}
|
| 75 | 69 |
|
| 76 |
- @Override
|
|
| 77 |
- public String generateHomeId() {
|
|
| 78 |
- return ID_GENERATOR.encode(now().getTime());
|
|
| 70 |
+ public TripServiceLocal() {
|
|
| 71 |
+ super(Program.SPI, Trip.SPI, Trip.PROPERTY_PROGRAM);
|
|
| 79 | 72 |
}
|
| 80 | 73 |
|
| 81 | 74 |
}
|
| ... | ... | @@ -23,9 +23,6 @@ package fr.ird.observe.services.local.service.data.ll.observation; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.dto.data.ll.observation.SetDetailCompositionDto;
|
| 26 |
-import fr.ird.observe.entities.data.ll.observation.Basket;
|
|
| 27 |
-import fr.ird.observe.entities.data.ll.observation.Branchline;
|
|
| 28 |
-import fr.ird.observe.entities.data.ll.observation.Section;
|
|
| 29 | 26 |
import fr.ird.observe.entities.data.ll.observation.Set;
|
| 30 | 27 |
import fr.ird.observe.services.local.service.data.Simple2DataServiceLocalSupport;
|
| 31 | 28 |
import fr.ird.observe.services.service.data.ll.observation.SetDetailCompositionService;
|
| ... | ... | @@ -40,22 +37,4 @@ public class SetDetailCompositionServiceLocal extends Simple2DataServiceLocalSup |
| 40 | 37 |
super(Set.SPI, Set.SET_DETAIL_COMPOSITION_SPI, null);
|
| 41 | 38 |
}
|
| 42 | 39 |
|
| 43 |
- @Override
|
|
| 44 |
- public boolean canDeleteSection(String sectionId) {
|
|
| 45 |
- Section entity = Section.loadEntity(getApplicationLocale(), getTopiaPersistenceContext(), sectionId);
|
|
| 46 |
- return entity.isNotUsed();
|
|
| 47 |
- }
|
|
| 48 |
- |
|
| 49 |
- @Override
|
|
| 50 |
- public boolean canDeleteBasket(String basketId) {
|
|
| 51 |
- Basket entity = Basket.loadEntity(getApplicationLocale(), getTopiaPersistenceContext(), basketId);
|
|
| 52 |
- return entity.isNotUsed();
|
|
| 53 |
- }
|
|
| 54 |
- |
|
| 55 |
- @Override
|
|
| 56 |
- public boolean canDeleteBranchline(String branchlineId) {
|
|
| 57 |
- Branchline entity = Branchline.loadEntity(getApplicationLocale(), getTopiaPersistenceContext(), branchlineId);
|
|
| 58 |
- return entity.isNotUsed();
|
|
| 59 |
- }
|
|
| 60 |
- |
|
| 61 | 40 |
}
|
| ... | ... | @@ -45,7 +45,7 @@ public class NonTargetSampleServiceLocal extends Simple3DataServiceLocalSupport< |
| 45 | 45 |
}
|
| 46 | 46 |
|
| 47 | 47 |
@Override
|
| 48 |
- public boolean canUseNonTargetSample(String setId) {
|
|
| 48 |
+ public boolean canUseSample(String setId) {
|
|
| 49 | 49 |
Set parent = loadParentEntity(setId);
|
| 50 | 50 |
return parent.canUseNonTargetSample();
|
| 51 | 51 |
}
|
| ... | ... | @@ -50,7 +50,7 @@ public abstract class TargetSampleServiceLocalSupport<D extends DataDto & Target |
| 50 | 50 |
this.discarded = discarded;
|
| 51 | 51 |
}
|
| 52 | 52 |
|
| 53 |
- public boolean canUseTargetSample(String setId) {
|
|
| 53 |
+ public boolean canUseSample(String setId) {
|
|
| 54 | 54 |
Set parent = loadParentEntity(setId);
|
| 55 | 55 |
return parent.canUseTargetSample(discarded);
|
| 56 | 56 |
}
|
| ... | ... | @@ -31,7 +31,6 @@ import fr.ird.observe.test.ObserveFixtures; |
| 31 | 31 |
import fr.ird.observe.test.spi.DatabaseNameConfiguration;
|
| 32 | 32 |
import org.junit.Assert;
|
| 33 | 33 |
import org.junit.Before;
|
| 34 |
-import org.junit.Ignore;
|
|
| 35 | 34 |
import org.junit.Test;
|
| 36 | 35 |
|
| 37 | 36 |
/**
|
| ... | ... | @@ -49,13 +48,11 @@ public class DiscardedTargetSampleServiceLocalTest extends ServiceLocalTestSuppo |
| 49 | 48 |
|
| 50 | 49 |
@Test
|
| 51 | 50 |
public void canUseTargetSampleTest() {
|
| 52 |
- Assert.assertFalse(service.canUseTargetSample(ObserveFixtures.SET_SEINE_ID));
|
|
| 51 |
+ Assert.assertFalse(service.canUseSample(ObserveFixtures.SET_SEINE_ID));
|
|
| 53 | 52 |
}
|
| 54 | 53 |
|
| 55 |
- @Ignore
|
|
| 56 | 54 |
@Test
|
| 57 | 55 |
public void loadForEditTest() {
|
| 58 |
- |
|
| 59 | 56 |
//FIXME Get a discarded target sample in test database
|
| 60 | 57 |
Form<DiscardedTargetSampleDto> form = service.loadForm(ObserveFixtures.SET_SEINE_ID);
|
| 61 | 58 |
Assert.assertNotNull(form);
|
| ... | ... | @@ -48,7 +48,7 @@ public class KeptTargetSampleServiceLocalTest extends ServiceLocalTestSupport { |
| 48 | 48 |
|
| 49 | 49 |
@Test
|
| 50 | 50 |
public void canUseTargetSampleTest() {
|
| 51 |
- Assert.assertTrue(service.canUseTargetSample(ObserveFixtures.SET_SEINE_ID));
|
|
| 51 |
+ Assert.assertTrue(service.canUseSample(ObserveFixtures.SET_SEINE_ID));
|
|
| 52 | 52 |
}
|
| 53 | 53 |
|
| 54 | 54 |
@Test
|
| 1 |
-package fr.ird.observe.services.service.data.ps.observation;
|
|
| 1 |
+package fr.ird.observe.services.local.service.data.ps.observation;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*-
|
| 4 | 4 |
* #%L
|
| 5 |
- * ObServe Services :: API
|
|
| 5 |
+ * ObServe Services :: Local implementation
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
|
| 8 | 8 |
* %%
|
| ... | ... | @@ -22,12 +22,46 @@ package fr.ird.observe.services.service.data.ps.observation; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.dto.data.ps.observation.NonTargetSampleDto;
|
|
| 26 |
+import fr.ird.observe.dto.form.Form;
|
|
| 27 |
+import fr.ird.observe.services.local.service.ServiceLocalTestSupport;
|
|
| 28 |
+import fr.ird.observe.services.service.data.ps.observation.NonTargetSampleService;
|
|
| 29 |
+import fr.ird.observe.test.DatabaseName;
|
|
| 30 |
+import fr.ird.observe.test.ObserveFixtures;
|
|
| 31 |
+import fr.ird.observe.test.spi.DatabaseNameConfiguration;
|
|
| 32 |
+import org.junit.Assert;
|
|
| 33 |
+import org.junit.Before;
|
|
| 34 |
+import org.junit.Test;
|
|
| 35 |
+ |
|
| 25 | 36 |
/**
|
| 26 |
- * Created on 16/10/2020.
|
|
| 37 |
+ * Created on 02/12/2020.
|
|
| 27 | 38 |
*
|
| 28 | 39 |
* @author Tony Chemit - dev@tchemit.fr
|
| 29 | 40 |
* @since 8.0.1
|
| 30 | 41 |
*/
|
| 31 |
-public interface KeptTargetSampleService extends GeneratedKeptTargetSampleService, TargetSampleAwareService {
|
|
| 32 |
-}
|
|
| 42 |
+@DatabaseNameConfiguration(DatabaseName.dataForTestSeine)
|
|
| 43 |
+public class NonTargetSampleServiceLocalTest extends ServiceLocalTestSupport {
|
|
| 44 |
+ |
|
| 45 |
+ protected NonTargetSampleService service;
|
|
| 46 |
+ |
|
| 47 |
+ @Before
|
|
| 48 |
+ public void setUp() throws Exception {
|
|
| 49 |
+ service = localTestMethodResource.newService(NonTargetSampleService.class);
|
|
| 50 |
+ }
|
|
| 33 | 51 |
|
| 52 |
+ @Test
|
|
| 53 |
+ public void canUseTargetSampleTest() {
|
|
| 54 |
+ Assert.assertFalse(service.canUseSample(ObserveFixtures.SET_SEINE_ID));
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+ @Test
|
|
| 58 |
+ public void loadForEditTest() {
|
|
| 59 |
+ //FIXME Get a Non target sample in test database
|
|
| 60 |
+ Form<NonTargetSampleDto> form = service.loadForm(ObserveFixtures.SET_SEINE_ID);
|
|
| 61 |
+ Assert.assertNotNull(form);
|
|
| 62 |
+ NonTargetSampleDto dto = form.getObject();
|
|
| 63 |
+ Assert.assertNotNull(dto);
|
|
| 64 |
+ Assert.assertTrue(dto.isNonTargetLengthEmpty());
|
|
| 65 |
+ }
|
|
| 66 |
+ |
|
| 67 |
+}
|
| ... | ... | @@ -80,4 +80,7 @@ public interface DataSourceService extends ObserveService, Closeable { |
| 80 | 80 |
@Get
|
| 81 | 81 |
<D extends IdDto> boolean isIdValid(Class<D> type, String id);
|
| 82 | 82 |
|
| 83 |
+ @Get
|
|
| 84 |
+ String generateHomeId();
|
|
| 85 |
+ |
|
| 83 | 86 |
}
|
| ... | ... | @@ -197,7 +197,10 @@ public class OpenableServiceTransformer extends ObjectModelTransformerToJava imp |
| 197 | 197 |
|
| 198 | 198 |
addInterface(output, String.format("%s<%s, %s>", OpenableDataService.class.getName(), dtoName, referenceName));
|
| 199 | 199 |
addAnnotation(output, output, Internal.class);
|
| 200 |
- |
|
| 200 |
+ if (referenceName.endsWith("TripReference")) {
|
|
| 201 |
+ // Add TripAwareService contract
|
|
| 202 |
+ addInterface(output, String.format("fr.ird.observe.services.service.data.TripAwareService<%s>", referenceName));
|
|
| 203 |
+ }
|
|
| 201 | 204 |
String spiClass = OpenableDtoServiceContext.class.getSimpleName();
|
| 202 | 205 |
addImport(output, OpenableDtoServiceContext.class);
|
| 203 | 206 |
addImport(output, packageName + "." + dtoName);
|
| ... | ... | @@ -202,7 +202,10 @@ public class SimpleServiceTransformer extends ObjectModelTransformerToJava imple |
| 202 | 202 |
|
| 203 | 203 |
addInterface(output, String.format("%s<%s>", SimpleDataService.class.getName(), dtoName));
|
| 204 | 204 |
addAnnotation(output, output, Internal.class);
|
| 205 |
- |
|
| 205 |
+ if (dtoName.contains(".ps.observation.") || dtoName.endsWith("SampleDto")) {
|
|
| 206 |
+ // Add TripAwareService contract
|
|
| 207 |
+ addInterface(output, "fr.ird.observe.services.service.data.ps.observation.TargetSampleAwareService");
|
|
| 208 |
+ }
|
|
| 206 | 209 |
String spiClass = SimpleDtoServiceContext.class.getSimpleName();
|
| 207 | 210 |
addImport(output, SimpleDtoServiceContext.class);
|
| 208 | 211 |
addImport(output, packageName + "." + dtoName);
|