| ... |
... |
@@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.data.seine; |
|
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,7 +28,7 @@ import com.google.common.collect.ImmutableSet; |
|
28
|
28
|
import com.google.common.collect.Maps;
|
|
29
|
29
|
import com.google.common.collect.Multimap;
|
|
30
|
30
|
import fr.ird.observe.binder.referential.ReferentialEntityDtoBinderSupport;
|
|
31
|
|
-import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
|
31
|
+import fr.ird.observe.dto.DataNotFoundException;
|
|
32
|
32
|
import fr.ird.observe.dto.data.seine.FloatingObjectDto;
|
|
33
|
33
|
import fr.ird.observe.dto.data.seine.FloatingObjectPartDto;
|
|
34
|
34
|
import fr.ird.observe.dto.data.seine.FloatingObjectPartReference;
|
| ... |
... |
@@ -36,18 +36,22 @@ import fr.ird.observe.dto.data.seine.FloatingObjectReference; |
|
36
|
36
|
import fr.ird.observe.dto.data.seine.ObjectMaterialHierarchyDto;
|
|
37
|
37
|
import fr.ird.observe.dto.form.Form;
|
|
38
|
38
|
import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
|
|
39
|
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
39
|
40
|
import fr.ird.observe.dto.referential.seine.ObjectMaterialDto;
|
|
40
|
41
|
import fr.ird.observe.dto.result.SaveResultDto;
|
|
41
|
|
-import fr.ird.observe.dto.DataNotFoundException;
|
|
42
|
42
|
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
|
|
43
|
43
|
import fr.ird.observe.entities.referentiel.seine.ObjectMaterial;
|
|
44
|
44
|
import fr.ird.observe.entities.referentiel.seine.ObjectMaterialTopiaDao;
|
|
|
45
|
+import fr.ird.observe.entities.referentiel.seine.ObservedSystem;
|
|
45
|
46
|
import fr.ird.observe.entities.seine.ActivitySeine;
|
|
46
|
47
|
import fr.ird.observe.entities.seine.FloatingObject;
|
|
47
|
48
|
import fr.ird.observe.entities.seine.FloatingObjectPart;
|
|
48
|
49
|
import fr.ird.observe.entities.seine.FloatingObjectPartTopiaDao;
|
|
49
|
50
|
import fr.ird.observe.services.local.service.ObserveServiceLocal;
|
|
50
|
51
|
import fr.ird.observe.services.service.data.seine.FloatingObjectService;
|
|
|
52
|
+import org.apache.commons.logging.Log;
|
|
|
53
|
+import org.apache.commons.logging.LogFactory;
|
|
|
54
|
+
|
|
51
|
55
|
import java.util.Collection;
|
|
52
|
56
|
import java.util.Comparator;
|
|
53
|
57
|
import java.util.LinkedHashSet;
|
| ... |
... |
@@ -57,8 +61,6 @@ import java.util.Optional; |
|
57
|
61
|
import java.util.Set;
|
|
58
|
62
|
import java.util.TreeSet;
|
|
59
|
63
|
import java.util.stream.Collectors;
|
|
60
|
|
-import org.apache.commons.logging.Log;
|
|
61
|
|
-import org.apache.commons.logging.LogFactory;
|
|
62
|
64
|
|
|
63
|
65
|
/**
|
|
64
|
66
|
* @author Tony Chemit - dev@tchemit.fr
|
| ... |
... |
@@ -66,6 +68,10 @@ import org.apache.commons.logging.LogFactory; |
|
66
|
68
|
public class FloatingObjectServiceLocal extends ObserveServiceLocal implements FloatingObjectService {
|
|
67
|
69
|
|
|
68
|
70
|
private static final Log log = LogFactory.getLog(FloatingObjectServiceLocal.class);
|
|
|
71
|
+ //FIXME Make this configurable
|
|
|
72
|
+ private static final String FOB_OBSERVED_SYSTEM = "fr.ird.observe.entities.referentiel.seine.ObservedSystem#0#1.2";
|
|
|
73
|
+ //FIXME Make this configurable
|
|
|
74
|
+ private static final Set<String> FOB_OBSERVED_SYSTEM_EXCLUDE_OPERATIONS = ImmutableSet.of("fr.ird.observe.entities.referentiel.seine.ObjectOperation#0#10", "fr.ird.observe.entities.referentiel.seine.ObjectOperation#0#1");
|
|
69
|
75
|
|
|
70
|
76
|
@Override
|
|
71
|
77
|
public List<ObjectMaterialHierarchyDto> getObjectMaterialHierarchy() {
|
| ... |
... |
@@ -184,6 +190,15 @@ public class FloatingObjectServiceLocal extends ObserveServiceLocal implements F |
|
184
|
190
|
activitySeine.addFloatingObject(entity);
|
|
185
|
191
|
}
|
|
186
|
192
|
|
|
|
193
|
+ boolean addFobObservedSystem = !FOB_OBSERVED_SYSTEM_EXCLUDE_OPERATIONS.contains(dto.getObjectOperation().getId())
|
|
|
194
|
+ && !activitySeine.getObservedSystemTopiaIds().contains(FOB_OBSERVED_SYSTEM);
|
|
|
195
|
+
|
|
|
196
|
+ if (addFobObservedSystem) {
|
|
|
197
|
+ log.info("Add FOB Observed System to activity: " + activitySeineId);
|
|
|
198
|
+ ObservedSystem observedSystem = getTopiaPersistenceContext().getObservedSystemDao().forTopiaIdEquals(FOB_OBSERVED_SYSTEM).findUnique();
|
|
|
199
|
+ activitySeine.addObservedSystem(observedSystem);
|
|
|
200
|
+ }
|
|
|
201
|
+
|
|
187
|
202
|
return result;
|
|
188
|
203
|
|
|
189
|
204
|
}
|