Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
50c96c4a
by Tony CHEMIT at 2018-09-17T15:27:45Z
8 changed files:
- client/src/main/java/fr/ird/observe/client/ui/content/ref/ContentReferenceUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/ref/usage/UsageForDeleteUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/ref/usage/UsageForDesactivateUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/ref/usage/UsageForDisplayUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/ref/usage/UsageUIHandlerSupport.java
- pom.xml
- services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
- services/src/main/java/fr/ird/observe/services/service/referential/ReferentialService.java
Changes:
| ... | ... | @@ -38,6 +38,7 @@ import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper; |
| 38 | 38 |
import fr.ird.observe.dto.decoration.decorators.ReferentialReferenceDecorator;
|
| 39 | 39 |
import fr.ird.observe.dto.form.Form;
|
| 40 | 40 |
import fr.ird.observe.dto.form.FormDefinition;
|
| 41 |
+import fr.ird.observe.dto.reference.DtoReference;
|
|
| 41 | 42 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 42 | 43 |
import fr.ird.observe.dto.referential.I18nReferentialDto;
|
| 43 | 44 |
import fr.ird.observe.dto.referential.ProgramDto;
|
| ... | ... | @@ -51,8 +52,8 @@ import fr.ird.observe.spi.DtoModelHelper; |
| 51 | 52 |
import fr.ird.observe.spi.map.ImmutableSetDtoMap;
|
| 52 | 53 |
import org.apache.commons.lang3.StringUtils;
|
| 53 | 54 |
import org.apache.commons.lang3.tuple.Pair;
|
| 54 |
-import org.apache.logging.log4j.Logger;
|
|
| 55 | 55 |
import org.apache.logging.log4j.LogManager;
|
| 56 |
+import org.apache.logging.log4j.Logger;
|
|
| 56 | 57 |
import org.nuiton.decorator.Decorator;
|
| 57 | 58 |
import org.nuiton.jaxx.runtime.swing.CardLayout2Ext;
|
| 58 | 59 |
import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
|
| ... | ... | @@ -166,7 +167,7 @@ public class ContentReferenceUIHandler<D extends ReferentialDto, R extends Refer |
| 166 | 167 |
}
|
| 167 | 168 |
|
| 168 | 169 |
private static <E extends ReferentialDto, R extends ReferentialDtoReference<E, R>> Pair<Boolean, R> showUsagesForDelete(E entity,
|
| 169 |
- ImmutableSetDtoMap<ReferentialDtoReference> usages,
|
|
| 170 |
+ ImmutableSetDtoMap<DtoReference> usages,
|
|
| 170 | 171 |
List<R> referenceList) {
|
| 171 | 172 |
|
| 172 | 173 |
DecoratorService service = ObserveSwingApplicationContext.get().getDecoratorService();
|
| ... | ... | @@ -205,7 +206,7 @@ public class ContentReferenceUIHandler<D extends ReferentialDto, R extends Refer |
| 205 | 206 |
}
|
| 206 | 207 |
|
| 207 | 208 |
private static <E extends ReferentialDto, R extends ReferentialDtoReference<E, R>> Pair<Boolean, R> showUsagesForDesactivated(E entity,
|
| 208 |
- ImmutableSetDtoMap<ReferentialDtoReference> usages,
|
|
| 209 |
+ ImmutableSetDtoMap<DtoReference> usages,
|
|
| 209 | 210 |
List<R> referenceList) {
|
| 210 | 211 |
|
| 211 | 212 |
DecoratorService service = ObserveSwingApplicationContext.get().getDecoratorService();
|
| ... | ... | @@ -393,7 +394,7 @@ public class ContentReferenceUIHandler<D extends ReferentialDto, R extends Refer |
| 393 | 394 |
}
|
| 394 | 395 |
|
| 395 | 396 |
// recherche des utilisation du bean dans la base
|
| 396 |
- ImmutableSetDtoMap<ReferentialDtoReference> usages = getReferentialService().findAllUsages(bean);
|
|
| 397 |
+ ImmutableSetDtoMap<DtoReference> usages = getReferentialService().findAllUsages(bean);
|
|
| 397 | 398 |
|
| 398 | 399 |
DecoratorService dService = getDecoratorService();
|
| 399 | 400 |
Decorator<D> decorator = dService.getDecoratorByType(getBeanType());
|
| ... | ... | @@ -692,7 +693,7 @@ public class ContentReferenceUIHandler<D extends ReferentialDto, R extends Refer |
| 692 | 693 |
log.debug("entity status was desactivated, looking for usage");
|
| 693 | 694 |
}
|
| 694 | 695 |
|
| 695 |
- ImmutableSetDtoMap<ReferentialDtoReference> usages = getReferentialService().findAllUsages(bean);
|
|
| 696 |
+ ImmutableSetDtoMap<DtoReference> usages = getReferentialService().findAllUsages(bean);
|
|
| 696 | 697 |
|
| 697 | 698 |
if (usages.isEmpty()) {
|
| 698 | 699 |
if (log.isInfoEnabled()) {
|
| ... | ... | @@ -766,7 +767,7 @@ public class ContentReferenceUIHandler<D extends ReferentialDto, R extends Refer |
| 766 | 767 |
}
|
| 767 | 768 |
|
| 768 | 769 |
// recherche des utilisation du bean dans la base
|
| 769 |
- ImmutableSetDtoMap<ReferentialDtoReference> usages = getReferentialService().findAllUsages(bean);
|
|
| 770 |
+ ImmutableSetDtoMap<DtoReference> usages = getReferentialService().findAllUsages(bean);
|
|
| 770 | 771 |
|
| 771 | 772 |
R replaceReference = null;
|
| 772 | 773 |
|
| ... | ... | @@ -26,6 +26,7 @@ Interface graphique pour afficher la liste des usages d'une entitee donnee. |
| 26 | 26 |
<import>
|
| 27 | 27 |
|
| 28 | 28 |
fr.ird.observe.spi.map.ImmutableSetDtoMap
|
| 29 |
+ fr.ird.observe.dto.reference.DtoReference
|
|
| 29 | 30 |
fr.ird.observe.dto.reference.ReferentialDtoReference
|
| 30 | 31 |
org.nuiton.jaxx.runtime.context.JAXXInitialContext
|
| 31 | 32 |
org.nuiton.jaxx.widgets.select.BeanFilterableComboBox
|
| ... | ... | @@ -36,7 +37,7 @@ Interface graphique pour afficher la liste des usages d'une entitee donnee. |
| 36 | 37 |
|
| 37 | 38 |
<script><![CDATA[
|
| 38 | 39 |
|
| 39 |
-public static <R extends ReferentialDtoReference> UsageForDeleteUI<R> build(String message, ImmutableSetDtoMap<ReferentialDtoReference> usages, List references) {
|
|
| 40 |
+public static <R extends ReferentialDtoReference> UsageForDeleteUI<R> build(String message, ImmutableSetDtoMap<? extends DtoReference> usages, List references) {
|
|
| 40 | 41 |
return new UsageForDeleteUI<>(new JAXXInitialContext().add(message).add(usages).add(references));
|
| 41 | 42 |
}
|
| 42 | 43 |
|
| ... | ... | @@ -24,6 +24,7 @@ Interface graphique pour afficher la liste des usages d'une entitee donnee. |
| 24 | 24 |
<JPanel layout='{new BorderLayout()}' genericType="R extends ReferentialDtoReference">
|
| 25 | 25 |
<import>
|
| 26 | 26 |
|
| 27 |
+ fr.ird.observe.dto.reference.DtoReference
|
|
| 27 | 28 |
fr.ird.observe.dto.reference.ReferentialDtoReference
|
| 28 | 29 |
fr.ird.observe.spi.map.ImmutableSetDtoMap
|
| 29 | 30 |
|
| ... | ... | @@ -36,7 +37,7 @@ Interface graphique pour afficher la liste des usages d'une entitee donnee. |
| 36 | 37 |
|
| 37 | 38 |
<script><![CDATA[
|
| 38 | 39 |
|
| 39 |
-public static <R extends ReferentialDtoReference> UsageForDesactivateUI<R> build(String message, ImmutableSetDtoMap<ReferentialDtoReference> usages, List references) {
|
|
| 40 |
+public static <R extends ReferentialDtoReference> UsageForDesactivateUI<R> build(String message, ImmutableSetDtoMap<? extends DtoReference> usages, List references) {
|
|
| 40 | 41 |
return new UsageForDesactivateUI<>(new JAXXInitialContext().add(message).add(usages).add(references));
|
| 41 | 42 |
}
|
| 42 | 43 |
|
| ... | ... | @@ -25,6 +25,7 @@ Interface graphique pour afficher la liste des usages d'une entitee donnee. |
| 25 | 25 |
|
| 26 | 26 |
<import>
|
| 27 | 27 |
|
| 28 |
+ fr.ird.observe.dto.reference.DtoReference
|
|
| 28 | 29 |
fr.ird.observe.dto.reference.ReferentialDtoReference
|
| 29 | 30 |
fr.ird.observe.spi.map.ImmutableSetDtoMap
|
| 30 | 31 |
org.nuiton.jaxx.runtime.context.JAXXInitialContext
|
| ... | ... | @@ -34,7 +35,7 @@ Interface graphique pour afficher la liste des usages d'une entitee donnee. |
| 34 | 35 |
|
| 35 | 36 |
<script><![CDATA[
|
| 36 | 37 |
|
| 37 |
-public static <R extends ReferentialDtoReference> UsageForDisplayUI<R> build(String message, ImmutableSetDtoMap<ReferentialDtoReference> usages) {
|
|
| 38 |
+public static <R extends ReferentialDtoReference> UsageForDisplayUI<R> build(String message, ImmutableSetDtoMap<? extends DtoReference> usages) {
|
|
| 38 | 39 |
return new UsageForDisplayUI<>(new JAXXInitialContext().add(message).add(usages));
|
| 39 | 40 |
}
|
| 40 | 41 |
|
| ... | ... | @@ -24,9 +24,11 @@ package fr.ird.observe.client.ui.content.ref.usage; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 26 | 26 |
import fr.ird.observe.dto.IdDto;
|
| 27 |
+import fr.ird.observe.dto.data.DataDto;
|
|
| 27 | 28 |
import fr.ird.observe.dto.decoration.DecoratorService;
|
| 28 | 29 |
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
| 29 | 30 |
import fr.ird.observe.dto.decoration.decorators.ReferentialReferenceDecorator;
|
| 31 |
+import fr.ird.observe.dto.reference.DataDtoReference;
|
|
| 30 | 32 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 31 | 33 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 32 | 34 |
import fr.ird.observe.dto.referential.ReferentialDto;
|
| ... | ... | @@ -91,9 +93,12 @@ public abstract class UsageUIHandlerSupport<R extends ReferentialDtoReference, U |
| 91 | 93 |
Set references = usages.get(dtoType);
|
| 92 | 94 |
String typeTitle = t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType));
|
| 93 | 95 |
addReferentialReferenceUsages(dtoType, references, typeTitle);
|
| 94 |
- |
|
| 95 | 96 |
}
|
| 96 |
- |
|
| 97 |
+ for (Class<? extends DataDtoReference> dtoType : usages.dataReferenceTypes()) {
|
|
| 98 |
+ Set references = usages.get(dtoType);
|
|
| 99 |
+ String typeTitle = t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType));
|
|
| 100 |
+ addDataReferenceUsages(dtoType, references, typeTitle);
|
|
| 101 |
+ }
|
|
| 97 | 102 |
}
|
| 98 | 103 |
|
| 99 | 104 |
BeanFilterableComboBox<R> comboBox = getReplace();
|
| ... | ... | @@ -119,18 +124,18 @@ public abstract class UsageUIHandlerSupport<R extends ReferentialDtoReference, U |
| 119 | 124 |
});
|
| 120 | 125 |
}
|
| 121 | 126 |
|
| 122 |
-// protected <D extends DataDto, R extends DataDtoReference<D, R>> void addDataReferenceUsages(Class<R> dtoType,
|
|
| 123 |
-// Set<R> references,
|
|
| 124 |
-// String typeTitle) {
|
|
| 125 |
-//
|
|
| 126 |
-// String typetitle = n("observe.common.Dto.label.usage.data.title");
|
|
| 127 |
-// typetitle = t(typetitle, typeTitle, references.size());
|
|
| 128 |
-//
|
|
| 129 |
-// Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDataReferenceDecorator(dtoType);
|
|
| 130 |
-// Objects.requireNonNull(decorator, "could not find decorator for type " + dtoType);
|
|
| 131 |
-//
|
|
| 132 |
-// buildUsagePanel(decorator, references, typetitle);
|
|
| 133 |
-// }
|
|
| 127 |
+ protected <D extends DataDto, R extends DataDtoReference<D, R>> void addDataReferenceUsages(Class<R> dtoType,
|
|
| 128 |
+ Set<R> references,
|
|
| 129 |
+ String typeTitle) {
|
|
| 130 |
+ |
|
| 131 |
+ String typetitle = n("observe.common.Dto.label.usage.data.title");
|
|
| 132 |
+ typetitle = t(typetitle, typeTitle, references.size());
|
|
| 133 |
+ |
|
| 134 |
+ Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDataReferenceDecorator(dtoType);
|
|
| 135 |
+ Objects.requireNonNull(decorator, "could not find decorator for type " + dtoType);
|
|
| 136 |
+ |
|
| 137 |
+ buildUsagePanel(decorator, references, typetitle);
|
|
| 138 |
+ }
|
|
| 134 | 139 |
|
| 135 | 140 |
|
| 136 | 141 |
protected <D extends ReferentialDto, R extends ReferentialDtoReference<D, R>> void addReferentialReferenceUsages(Class<R> referenceType,
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>io.ultreia.maven</groupId>
|
| 28 | 28 |
<artifactId>pom</artifactId>
|
| 29 |
- <version>2018.51</version>
|
|
| 29 |
+ <version>2018.53</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<groupId>fr.ird.observe</groupId>
|
| ... | ... | @@ -152,9 +152,8 @@ |
| 152 | 152 |
<maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 153 | 153 |
<buildDate>${maven.build.timestamp}</buildDate>
|
| 154 | 154 |
|
| 155 |
- <observeToolkitVersion>3.7.4</observeToolkitVersion>
|
|
| 156 |
- <lib.version.java4all.http>1.0.12</lib.version.java4all.http>
|
|
| 157 |
- <lib.version.java4all.jaxx>3.0-alpha-35</lib.version.java4all.jaxx>
|
|
| 155 |
+ <observeToolkitVersion>3.7.5</observeToolkitVersion>
|
|
| 156 |
+ <!--lib.version.java4all.http>1.0.12</lib.version.java4all.http-->
|
|
| 158 | 157 |
<lib.version.nuiton.validation>3.1</lib.version.nuiton.validation>
|
| 159 | 158 |
<!--<lib.version.java4all.config>1.0.3</lib.version.java4all.config>-->
|
| 160 | 159 |
<xworkVersion>2.3.35</xworkVersion>
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.referential; |
| 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>.
|
| ... | ... | @@ -25,11 +25,16 @@ package fr.ird.observe.services.local.service.referential; |
| 25 | 25 |
import com.google.common.base.Joiner;
|
| 26 | 26 |
import com.google.common.collect.ImmutableList;
|
| 27 | 27 |
import com.google.common.collect.ImmutableSet;
|
| 28 |
+import fr.ird.observe.binder.data.DataEntityReferenceBinderSupport;
|
|
| 28 | 29 |
import fr.ird.observe.binder.referential.ReferentialEntityDtoBinderSupport;
|
| 29 | 30 |
import fr.ird.observe.binder.referential.ReferentialEntityReferenceBinderSupport;
|
| 30 | 31 |
import fr.ird.observe.dto.IdDto;
|
| 32 |
+import fr.ird.observe.dto.data.DataDto;
|
|
| 31 | 33 |
import fr.ird.observe.dto.form.Form;
|
| 32 | 34 |
import fr.ird.observe.dto.form.FormDefinition;
|
| 35 |
+import fr.ird.observe.dto.reference.DataDtoReference;
|
|
| 36 |
+import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
|
| 37 |
+import fr.ird.observe.dto.reference.DtoReference;
|
|
| 33 | 38 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 34 | 39 |
import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
|
| 35 | 40 |
import fr.ird.observe.dto.referential.ReferenceStatus;
|
| ... | ... | @@ -39,6 +44,7 @@ import fr.ird.observe.dto.referential.SpeciesGroupDto; |
| 39 | 44 |
import fr.ird.observe.dto.referential.seine.ObservedSystemReference;
|
| 40 | 45 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 41 | 46 |
import fr.ird.observe.entities.EntityMap;
|
| 47 |
+import fr.ird.observe.entities.ObserveDataEntity;
|
|
| 42 | 48 |
import fr.ird.observe.entities.longline.TripLongline;
|
| 43 | 49 |
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
|
| 44 | 50 |
import fr.ird.observe.entities.referentiel.Species;
|
| ... | ... | @@ -59,13 +65,14 @@ import fr.ird.observe.services.service.sql.SqlScriptProducerService; |
| 59 | 65 |
import fr.ird.observe.spi.DbModelHelper;
|
| 60 | 66 |
import fr.ird.observe.spi.DtoModelClasses;
|
| 61 | 67 |
import fr.ird.observe.spi.DtoModelHelper;
|
| 68 |
+import fr.ird.observe.spi.context.DataEntityContext;
|
|
| 62 | 69 |
import fr.ird.observe.spi.context.ReferentialDtoEntityContext;
|
| 63 | 70 |
import fr.ird.observe.spi.context.ReferentialEntityContext;
|
| 64 | 71 |
import fr.ird.observe.spi.context.ReferentialReferenceEntityContext;
|
| 65 | 72 |
import fr.ird.observe.spi.map.ImmutableDtoMap;
|
| 66 | 73 |
import fr.ird.observe.spi.map.ImmutableSetDtoMap;
|
| 67 |
-import org.apache.logging.log4j.Logger;
|
|
| 68 | 74 |
import org.apache.logging.log4j.LogManager;
|
| 75 |
+import org.apache.logging.log4j.Logger;
|
|
| 69 | 76 |
import org.nuiton.topia.persistence.TopiaDao;
|
| 70 | 77 |
import org.nuiton.topia.persistence.TopiaEntity;
|
| 71 | 78 |
import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
|
| ... | ... | @@ -208,7 +215,7 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe |
| 208 | 215 |
}
|
| 209 | 216 |
|
| 210 | 217 |
@Override
|
| 211 |
- public <D extends ReferentialDto> ImmutableSetDtoMap<ReferentialDtoReference> findAllUsages(D bean) {
|
|
| 218 |
+ public <D extends ReferentialDto> ImmutableSetDtoMap<DtoReference> findAllUsages(D bean) {
|
|
| 212 | 219 |
|
| 213 | 220 |
ReferentialDtoEntityContext<D, ?, ?> spi = DbModelHelper.fromReferentialDto(bean);
|
| 214 | 221 |
Class<ObserveReferentialEntity> entityType = spi.toEntityType();
|
| ... | ... | @@ -218,12 +225,14 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe |
| 218 | 225 |
TopiaDao<ObserveReferentialEntity> dao = getTopiaPersistenceContext().getDao(entityType);
|
| 219 | 226 |
EntityMap allUsages = new EntityMap(dao.findAllUsages(entity));
|
| 220 | 227 |
|
| 221 |
- ImmutableSetDtoMap.Builder<ReferentialDtoReference> result = ImmutableSetDtoMap.builder();
|
|
| 228 |
+ ImmutableSetDtoMap.Builder<DtoReference> result = ImmutableSetDtoMap.builder();
|
|
| 222 | 229 |
for (Class<? extends TopiaEntity> type : allUsages.keySet()) {
|
| 223 | 230 |
List<? extends TopiaEntity> entities = allUsages.get(type);
|
| 224 | 231 |
if (ObserveReferentialEntity.class.isAssignableFrom(type)) {
|
| 225 | 232 |
//noinspection unchecked
|
| 226 |
- findAllUsageReferential(DbModelHelper.fromReferentialEntity((Class) type), (List) entities, result);
|
|
| 233 |
+ addAllReferentialUsage(DbModelHelper.fromReferentialEntity((Class) type), (List) entities, result);
|
|
| 234 |
+ } else {
|
|
| 235 |
+ adddAllDataUsage(DbModelHelper.fromDataEntity((Class) type), (List) entities, result);
|
|
| 227 | 236 |
}
|
| 228 | 237 |
}
|
| 229 | 238 |
return result.build();
|
| ... | ... | @@ -242,13 +251,20 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe |
| 242 | 251 |
return result;
|
| 243 | 252 |
}
|
| 244 | 253 |
|
| 245 |
- private <D extends ReferentialDto, R extends ReferentialDtoReference<D, R>, E extends ObserveReferentialEntity> void findAllUsageReferential(ReferentialEntityContext<D, R, E> spi, List<E> entities, ImmutableSetDtoMap.Builder<ReferentialDtoReference> result) {
|
|
| 254 |
+ private <D extends ReferentialDto, R extends ReferentialDtoReference<D, R>, E extends ObserveReferentialEntity> void addAllReferentialUsage(ReferentialEntityContext<D, R, E> spi, List<E> entities, ImmutableSetDtoMap.Builder<DtoReference> result) {
|
|
| 246 | 255 |
Class<R> referenceType = spi.toReferenceType();
|
| 247 | 256 |
ReferentialEntityReferenceBinderSupport<D, R, E> binder = spi.toEntityReferenceBinder();
|
| 248 | 257 |
ReferentialDtoReferenceSet<R> referenceSet = toReferentialReferenceSet(binder, entities, null);
|
| 249 | 258 |
result.put(referenceType, referenceSet.toSet());
|
| 250 | 259 |
}
|
| 251 | 260 |
|
| 261 |
+ private <D extends DataDto, R extends DataDtoReference<D, R>, E extends ObserveDataEntity> void adddAllDataUsage(DataEntityContext<D, R, E> spi, List<E> entities, ImmutableSetDtoMap.Builder<DtoReference> result) {
|
|
| 262 |
+ Class<R> referenceType = spi.toReferenceType();
|
|
| 263 |
+ DataEntityReferenceBinderSupport<D, R, E> binder = spi.toEntityReferenceBinder();
|
|
| 264 |
+ DataDtoReferenceSet<R> referenceSet = toDataReferenceSet(binder, entities);
|
|
| 265 |
+ result.put(referenceType, referenceSet.toSet());
|
|
| 266 |
+ }
|
|
| 267 |
+ |
|
| 252 | 268 |
@Override
|
| 253 | 269 |
public <D extends ReferentialDto> boolean exists(Class<D> type, String id) {
|
| 254 | 270 |
if (log.isTraceEnabled()) {
|
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.services.service.referential; |
| 25 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 26 | 26 |
import fr.ird.observe.dto.IdDto;
|
| 27 | 27 |
import fr.ird.observe.dto.form.Form;
|
| 28 |
+import fr.ird.observe.dto.reference.DtoReference;
|
|
| 28 | 29 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 29 | 30 |
import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
|
| 30 | 31 |
import fr.ird.observe.dto.referential.ReferentialDto;
|
| ... | ... | @@ -32,7 +33,6 @@ import fr.ird.observe.dto.referential.SpeciesDto; |
| 32 | 33 |
import fr.ird.observe.dto.referential.SpeciesGroupDto;
|
| 33 | 34 |
import fr.ird.observe.dto.referential.seine.ObservedSystemReference;
|
| 34 | 35 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 35 |
-import org.nuiton.topia.persistence.script.TopiaSqlScript;
|
|
| 36 | 36 |
import fr.ird.observe.services.service.ObserveService;
|
| 37 | 37 |
import fr.ird.observe.services.spi.ReadDataPermission;
|
| 38 | 38 |
import fr.ird.observe.services.spi.ReadReferentialPermission;
|
| ... | ... | @@ -44,6 +44,7 @@ import io.ultreia.java4all.http.spi.Delete; |
| 44 | 44 |
import io.ultreia.java4all.http.spi.Get;
|
| 45 | 45 |
import io.ultreia.java4all.http.spi.Nullable;
|
| 46 | 46 |
import io.ultreia.java4all.http.spi.Post;
|
| 47 |
+import org.nuiton.topia.persistence.script.TopiaSqlScript;
|
|
| 47 | 48 |
|
| 48 | 49 |
import java.util.Date;
|
| 49 | 50 |
import java.util.List;
|
| ... | ... | @@ -109,7 +110,7 @@ public interface ReferentialService extends ObserveService { |
| 109 | 110 |
@Get
|
| 110 | 111 |
@ReadReferentialPermission
|
| 111 | 112 |
@ReadDataPermission
|
| 112 |
- <R extends ReferentialDto> ImmutableSetDtoMap<ReferentialDtoReference> findAllUsages(R bean);
|
|
| 113 |
+ <R extends ReferentialDto> ImmutableSetDtoMap<DtoReference> findAllUsages(R bean);
|
|
| 113 | 114 |
|
| 114 | 115 |
@Get
|
| 115 | 116 |
@ReadReferentialPermission
|