2828import java .util .stream .Stream ;
2929
3030import static org .gridsuite .modification .NetworkModificationException .Type .MODIFICATION_ERROR ;
31- import static org .gridsuite .modification .server .elasticsearch .EquipmentInfosService .TYPES_FOR_INDEXING ;
31+ import static org .gridsuite .modification .server .elasticsearch .EquipmentInfosService .getIndexedEquipmentTypes ;
3232
3333/**
3434 * @author Franck Lecuyer <franck.lecuyer at rte-france.com>
@@ -123,22 +123,31 @@ private void addSimpleModificationImpact(Identifiable<?> identifiable) {
123123 @ Override
124124 public void onPropertyRemoved (Identifiable identifiable , String attribute , Object oldValue ) {
125125 addSimpleModificationImpact (identifiable );
126+ if (getIndexedEquipmentTypes ().contains (identifiable .getType ())) {
127+ updateEquipmentIndexation (identifiable , attribute , networkUuid , network .getVariantManager ().getWorkingVariantId ());
128+ }
126129 }
127130
128131 @ Override
129132 public void onPropertyAdded (Identifiable identifiable , String attribute , Object newValue ) {
130133 addSimpleModificationImpact (identifiable );
134+ if (getIndexedEquipmentTypes ().contains (identifiable .getType ())) {
135+ updateEquipmentIndexation (identifiable , attribute , networkUuid , network .getVariantManager ().getWorkingVariantId ());
136+ }
131137 }
132138
133139 @ Override
134140 public void onPropertyReplaced (Identifiable identifiable , String attribute , Object oldValue , Object newValue ) {
135141 addSimpleModificationImpact (identifiable );
142+ if (getIndexedEquipmentTypes ().contains (identifiable .getType ())) {
143+ updateEquipmentIndexation (identifiable , attribute , networkUuid , network .getVariantManager ().getWorkingVariantId ());
144+ }
136145 }
137146
138147 @ Override
139148 public void onUpdate (Identifiable identifiable , String attribute , String variantId , Object oldValue , Object newValue ) {
140149 addSimpleModificationImpact (identifiable );
141- if (TYPES_FOR_INDEXING .contains (identifiable .getType ())) {
150+ if (getIndexedEquipmentTypes () .contains (identifiable .getType ())) {
142151 updateEquipmentIndexation (identifiable , attribute , networkUuid , network .getVariantManager ().getWorkingVariantId ());
143152 }
144153 }
@@ -181,13 +190,13 @@ private void updateEquipmentsLinkedToSubstation(Substation substation) {
181190
182191 private void updateEquipmentsLinkedToVoltageLevel (VoltageLevel voltageLevel ) {
183192 voltageLevel .getConnectableStream ()
184- .filter (connectable -> TYPES_FOR_INDEXING .contains (connectable .getType ()))
193+ .filter (connectable -> getIndexedEquipmentTypes () .contains (connectable .getType ()))
185194 .forEach (c -> updateImpactedEquipment (toEquipmentInfos (c , networkUuid , network .getVariantManager ().getWorkingVariantId ()), SimpleImpactType .MODIFICATION , true , false ));
186195 }
187196
188197 @ Override
189198 public void onCreation (Identifiable identifiable ) {
190- if (TYPES_FOR_INDEXING .contains (identifiable .getType ())) {
199+ if (getIndexedEquipmentTypes () .contains (identifiable .getType ())) {
191200 updateImpactedEquipment (EquipmentInfos .builder ()
192201 .networkUuid (networkUuid )
193202 .variantId (network .getVariantManager ().getWorkingVariantId ())
@@ -210,7 +219,7 @@ public void onCreation(Identifiable identifiable) {
210219
211220 @ Override
212221 public void beforeRemoval (Identifiable identifiable ) {
213- if (TYPES_FOR_INDEXING .contains (identifiable .getType ())) {
222+ if (getIndexedEquipmentTypes () .contains (identifiable .getType ())) {
214223 updateImpactedEquipment (TombstonedEquipmentInfos .builder ()
215224 .networkUuid (networkUuid )
216225 .variantId (network .getVariantManager ().getWorkingVariantId ())
@@ -381,7 +390,7 @@ private List<EquipmentInfos> getAllModifiedEquipmentsToBeIndexed() {
381390 @ Override
382391 public void onExtensionCreation (Extension <?> extension ) {
383392 Identifiable <?> identifiable = (Identifiable <?>) extension .getExtendable ();
384- if (TYPES_FOR_INDEXING .contains (identifiable .getType ())) {
393+ if (getIndexedEquipmentTypes () .contains (identifiable .getType ())) {
385394 updateImpactedEquipment (toEquipmentInfos (identifiable , networkUuid , network .getVariantManager ().getWorkingVariantId ()), SimpleImpactType .MODIFICATION );
386395 }
387396 addSimpleModificationImpact (identifiable );
0 commit comments