-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating modifications should now impact ES index #365
Conversation
…h - still buggy with voltageLevels/subsations updating across linked equipments Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
@@ -21,6 +21,8 @@ public interface EquipmentInfosRepository extends ElasticsearchRepository<Equipm | |||
|
|||
List<EquipmentInfos> findByIdInAndNetworkUuidAndVariantId(@NonNull List<String> equipmentIds, @NonNull UUID networkUuid, @NonNull String variantId); | |||
|
|||
EquipmentInfos findByIdAndNetworkUuid/*AndVariantId*/(@NonNull String equipmentId, @NonNull UUID networkUuid/*, @NonNull String variantId*/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to clean it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
// update substation linked to voltageLevel | ||
Optional<Substation> linkedSubstation = updatedVoltageLevel.getSubstation(); | ||
if (linkedSubstation.isPresent()) { | ||
createdEquipments.add(EquipmentInfos.toInfosWithUpdatedVoltageLevelName(linkedSubstation.get(), updatedVoltageLevel, networkUuid, network.getVariantManager().getWorkingVariantId())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood well, maybe rename createdEquipments
into createdOrUpdatedEquipments
? Or use a new list updatedEquipments
?
It's consufing to me, it took some time to understand why do you do add
on a list named createdEquipments
(I don't know this class and no Javadoc so not easy to get in)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes use modifedEquipments
list ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
linkedVoltageLevels.forEach(vl -> createdEquipments.add(EquipmentInfos.toInfosWithUpdatedSubstationName(vl, updatedSubstation, networkUuid, network.getVariantManager().getWorkingVariantId()))); | ||
// update all equipments linked to each of the voltageLevels | ||
linkedVoltageLevels.forEach(vl -> | ||
Iterables.concat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can extract this part into a method like you did for updateEquipmentsLinkedToVoltageLevel
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -88,4 +89,18 @@ public void deleteAll() { | |||
equipmentInfosRepository.deleteAll(); | |||
tombstonedEquipmentInfosRepository.deleteAll(); | |||
} | |||
|
|||
public void updateEquipment(Identifiable<?> identifiable, UUID networkUuid, String variantId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -130,9 +119,68 @@ public void onElementReplaced(Identifiable identifiable, String attribute, Objec | |||
addSimpleModificationImpact(identifiable); | |||
} | |||
|
|||
@Override | |||
public void onUpdate(Identifiable identifiable, String attribute, Object oldValue, Object newValue) { | |||
networkImpacts.add( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addSimpleModificationImpact ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not my code, but fixed anyway
// update substation linked to voltageLevel | ||
Optional<Substation> linkedSubstation = updatedVoltageLevel.getSubstation(); | ||
if (linkedSubstation.isPresent()) { | ||
createdEquipments.add(EquipmentInfos.toInfosWithUpdatedVoltageLevelName(linkedSubstation.get(), updatedVoltageLevel, networkUuid, network.getVariantManager().getWorkingVariantId())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes use modifedEquipments
list ?
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code OK
@AutoConfigureMockMvc | ||
@SpringBootTest | ||
@Tag("IntegrationTest") | ||
public class ModificationElasticsearchTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integration test ?
@@ -102,4 +103,15 @@ public static Set<SubstationInfos> getSubstationsInfos(@NonNull Identifiable<?> | |||
.collect(Collectors.toSet()); | |||
} | |||
|
|||
public static EquipmentInfos toInfos(Identifiable<?> identifiable, UUID networkUuid, String variantId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it to the listener class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Kudos, SonarCloud Quality Gate passed! |
No description provided.