Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
3a843b55
by Tony CHEMIT at 2017-07-27T00:49:40+02:00
8 changed files:
- application-swing/src/main/java/fr/ird/observe/application/swing/FloatingObjectReferencesManager.java
- application-web/src/main/filtered-resources/mapping
- application-web/src/main/java/fr/ird/observe/application/web/injector/ImmutableSetInjector.java
- pom.xml
- services-topia/src/main/java/fr/ird/observe/services/topia/service/data/seine/FloatingObjectServiceTopia.java
- services-topia/src/main/java/fr/ird/observe/services/topia/service/referential/ReferentialServiceTopia.java
- services/src/main/java/fr/ird/observe/services/service/data/seine/FloatingObjectService.java
- services/src/main/java/fr/ird/observe/services/service/referential/ReferentialService.java
Changes:
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.application.swing; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.application.swing.configuration.ObserveSwingApplicationConfig;
|
| 26 | 27 |
import fr.ird.observe.application.swing.db.ObserveSwingDataSource;
|
| 27 | 28 |
import fr.ird.observe.services.dto.FloatingObjectReference;
|
| ... | ... | @@ -71,10 +72,14 @@ public class FloatingObjectReferencesManager { |
| 71 | 72 |
return references.stream().filter(r -> floatingObjectId.equals(r.getFloatingObjectId())).findFirst();
|
| 72 | 73 |
}
|
| 73 | 74 |
|
| 75 |
+ ImmutableSet<String> getIds() {
|
|
| 76 |
+ return ImmutableSet.copyOf(references.stream().map(FloatingObjectReference::getFloatingObjectId).collect(Collectors.toSet()));
|
|
| 77 |
+ }
|
|
| 78 |
+ |
|
| 74 | 79 |
void sanitize(ObserveSwingDataSource dataSource) {
|
| 75 | 80 |
|
| 76 |
- Set<String> existingIds = references.stream().map(FloatingObjectReference::getFloatingObjectId).collect(Collectors.toSet());
|
|
| 77 |
- Set<String> ids = dataSource.newFloatingObjectService().retainExistingIds(existingIds);
|
|
| 81 |
+ ImmutableSet<String> existingIds = getIds();
|
|
| 82 |
+ ImmutableSet<String> ids = dataSource.newFloatingObjectService().retainExistingIds(existingIds);
|
|
| 78 | 83 |
int beforeSize = references.size();
|
| 79 | 84 |
|
| 80 | 85 |
references.removeIf(reference -> !ids.contains(reference.getFloatingObjectId()));
|
| ... | ... | @@ -221,7 +221,6 @@ GET /api/v1/data/seine/TripSeineService/preCreate |
| 221 | 221 |
POST /api/v1/data/seine/TripSeineService/save v1.data.seine.TripSeineServiceRestApi.save
|
| 222 | 222 |
POST /api/v1/referential/ReferentialService/computeMissingReferentials v1.referential.ReferentialServiceRestApi.computeMissingReferentials
|
| 223 | 223 |
DELETE /api/v1/referential/ReferentialService/delete v1.referential.ReferentialServiceRestApi.delete
|
| 224 |
-DELETE /api/v1/referential/ReferentialService/delete v1.referential.ReferentialServiceRestApi.delete
|
|
| 225 | 224 |
GET /api/v1/referential/ReferentialService/exists v1.referential.ReferentialServiceRestApi.exists
|
| 226 | 225 |
GET /api/v1/referential/ReferentialService/findAllUsages v1.referential.ReferentialServiceRestApi.findAllUsages
|
| 227 | 226 |
GET /api/v1/referential/ReferentialService/getReferenceSet v1.referential.ReferentialServiceRestApi.getReferenceSet
|
| ... | ... | @@ -60,15 +60,16 @@ public class ImmutableSetInjector implements ExecutorParametersInjectorHandler.I |
| 60 | 60 |
|
| 61 | 61 |
ImmutableSet.Builder builder = ImmutableSet.builder();
|
| 62 | 62 |
|
| 63 |
- Call.ParameterTree parameterTree = call.getParameterTree().getObject().get(name);
|
|
| 63 |
+ if (call.getParameterTree().getObject() != null) {
|
|
| 64 |
+ Call.ParameterTree parameterTree = call.getParameterTree().getObject().get(name);
|
|
| 64 | 65 |
|
| 65 |
- Objects.requireNonNull(parameterTree, "Le paramètre " + name + " n'as pas été trouvé, recompiler (parameter)!");
|
|
| 66 |
+ Objects.requireNonNull(parameterTree, "Le paramètre " + name + " n'as pas été trouvé, recompiler (parameter)!");
|
|
| 66 | 67 |
|
| 67 |
- String[] values = (String[]) parameterTree.getValue();
|
|
| 68 |
- for (String value : values) {
|
|
| 69 |
- builder.add(value);
|
|
| 68 |
+ String[] values = (String[]) parameterTree.getValue();
|
|
| 69 |
+ for (String value : values) {
|
|
| 70 |
+ builder.add(value);
|
|
| 71 |
+ }
|
|
| 70 | 72 |
}
|
| 71 |
- |
|
| 72 | 73 |
result = builder.build();
|
| 73 | 74 |
|
| 74 | 75 |
if (log.isInfoEnabled()) {
|
| ... | ... | @@ -180,7 +180,7 @@ |
| 180 | 180 |
<nuitonUtilsVersion>3.0-rc-18</nuitonUtilsVersion>
|
| 181 | 181 |
<nuitonConverterVersion>1.0</nuitonConverterVersion>
|
| 182 | 182 |
<nuitonVersionVersion>1.0-rc-2</nuitonVersionVersion>
|
| 183 |
- <httpVersion>1.0.1</httpVersion>
|
|
| 183 |
+ <httpVersion>1.0.2-SNAPSHOT</httpVersion>
|
|
| 184 | 184 |
<xworkVersion>2.3.33</xworkVersion>
|
| 185 | 185 |
<flexmarkVersion>0.22.14</flexmarkVersion>
|
| 186 | 186 |
<hibernateVersion>5.1.8.Final</hibernateVersion>
|
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.services.topia.service.data.seine; |
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ArrayListMultimap;
|
| 26 | 26 |
import com.google.common.collect.ImmutableMap;
|
| 27 |
+import com.google.common.collect.ImmutableSet;
|
|
| 27 | 28 |
import com.google.common.collect.Maps;
|
| 28 | 29 |
import com.google.common.collect.Multimap;
|
| 29 | 30 |
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
|
| ... | ... | @@ -102,10 +103,10 @@ public class FloatingObjectServiceTopia extends ObserveServiceTopia implements F |
| 102 | 103 |
}
|
| 103 | 104 |
|
| 104 | 105 |
@Override
|
| 105 |
- public Set<String> retainExistingIds(Set<String> existingIds) {
|
|
| 106 |
- LinkedHashSet<String> result = new LinkedHashSet<>(existingIds);
|
|
| 107 |
- result.retainAll(getTopiaPersistenceContext().getFloatingObjectDao().findAllIds());
|
|
| 108 |
- return result;
|
|
| 106 |
+ public ImmutableSet<String> retainExistingIds(ImmutableSet<String> existingIds) {
|
|
| 107 |
+ LinkedHashSet<String> result = new LinkedHashSet<>(getTopiaPersistenceContext().getFloatingObjectDao().findAllIds());
|
|
| 108 |
+ result.retainAll(existingIds);
|
|
| 109 |
+ return ImmutableSet.copyOf(result);
|
|
| 109 | 110 |
}
|
| 110 | 111 |
|
| 111 | 112 |
@Override
|
| ... | ... | @@ -62,7 +62,6 @@ import fr.ird.observe.services.service.sql.SqlScriptProducerService; |
| 62 | 62 |
import fr.ird.observe.services.topia.service.ObserveServiceTopia;
|
| 63 | 63 |
import fr.ird.observe.services.topia.service.actions.synchro.referential.sql.ReplaceSqlStatementGenerator;
|
| 64 | 64 |
import java.util.Arrays;
|
| 65 |
-import java.util.Collection;
|
|
| 66 | 65 |
import java.util.Collections;
|
| 67 | 66 |
import java.util.Date;
|
| 68 | 67 |
import java.util.List;
|
| ... | ... | @@ -246,16 +245,6 @@ public class ReferentialServiceTopia extends ObserveServiceTopia implements Refe |
| 246 | 245 |
}
|
| 247 | 246 |
|
| 248 | 247 |
@Override
|
| 249 |
- public <D extends ReferentialDto> void delete(Class<D> type, Collection<String> ids) {
|
|
| 250 |
- if (log.isTraceEnabled()) {
|
|
| 251 |
- log.trace("delete(" + type.getName() + ", [" + Joiner.on(", ").join(ids) + "])");
|
|
| 252 |
- }
|
|
| 253 |
- |
|
| 254 |
- Class<? extends ObserveReferentialEntity> entityType = getReferentialEntityType(type);
|
|
| 255 |
- deleteEntity(type, entityType, ids);
|
|
| 256 |
- }
|
|
| 257 |
- |
|
| 258 |
- @Override
|
|
| 259 | 248 |
public <E extends ReferentialDto> void replaceReference(Class<E> beanType, String idToReplace, String replaceId) {
|
| 260 | 249 |
if (log.isTraceEnabled()) {
|
| 261 | 250 |
log.trace("replaceReference(" + beanType.getName() + ", " + idToReplace + "," + replaceId + ")");
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.services.service.data.seine; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.services.dto.form.Form;
|
| 26 | 27 |
import fr.ird.observe.services.dto.reference.DataReference;
|
| 27 | 28 |
import fr.ird.observe.services.dto.reference.DataReferenceSet;
|
| ... | ... | @@ -38,7 +39,6 @@ import io.ultreia.java4all.http.spi.Delete; |
| 38 | 39 |
import io.ultreia.java4all.http.spi.Get;
|
| 39 | 40 |
import io.ultreia.java4all.http.spi.Post;
|
| 40 | 41 |
import java.util.List;
|
| 41 |
-import java.util.Set;
|
|
| 42 | 42 |
|
| 43 | 43 |
/**
|
| 44 | 44 |
* @author Sylvain Bavencoff - bavencoff@codelutin.com
|
| ... | ... | @@ -63,7 +63,7 @@ public interface FloatingObjectService extends ObserveService { |
| 63 | 63 |
|
| 64 | 64 |
@Get
|
| 65 | 65 |
@ReadDataPermission
|
| 66 |
- Set<String> retainExistingIds(Set<String> existingIds);
|
|
| 66 |
+ ImmutableSet<String> retainExistingIds(ImmutableSet<String> existingIds);
|
|
| 67 | 67 |
|
| 68 | 68 |
@Get
|
| 69 | 69 |
@ReadDataPermission
|
| ... | ... | @@ -97,11 +97,6 @@ public interface ReferentialService extends ObserveService { |
| 97 | 97 |
@Delete
|
| 98 | 98 |
<R extends ReferentialDto> void delete(Class<R> type, String id) throws DataNotFoundException;
|
| 99 | 99 |
|
| 100 |
- @WriteReferentialPermission
|
|
| 101 |
- @Write
|
|
| 102 |
- @Delete
|
|
| 103 |
- <R extends ReferentialDto> void delete(Class<R> type, Collection<String> ids) throws DataNotFoundException;
|
|
| 104 |
- |
|
| 105 | 100 |
@Post
|
| 106 | 101 |
@WriteReferentialPermission
|
| 107 | 102 |
@WriteDataPermission
|