Refactor style b/c of service models 10.1 update 34/99834/15
authorguillaume.lambert <guillaume.lambert@orange.com>
Mon, 21 Feb 2022 13:15:16 +0000 (14:15 +0100)
committerGilles Thouenon <gilles.thouenon@orange.com>
Wed, 30 Mar 2022 14:08:04 +0000 (16:08 +0200)
commit1b8941461b6f81f6f7b018f6fc6907d1c7d1292d
tree3bbc8d159336b7e3d1b7c6fd32ad126b1ada495c
parent5e3f7dd89cb088ef4957f5559a82b8c6436afa17
Refactor style b/c of service models 10.1 update

Some pieces of the current code do not follow any coherent coding style
pattern.
Some others still use old Java coding style patterns,
mainly old patterns used before builders and setters could be cascaded.

A coherent and clean coding style matters because
- it eases the code maintenance and evolution
- it also helps detect errors or possible optimizations

For this reason, coding style issues should preferably be adressed
before any in-depth modifications such as API migrations.
And if not possible, at least afterwards.
This is particularly true with the YANG models API used here.
They generate long namespaces and long builders/setters structures
that can quickly burden the code and complicate its reading or analysis.

As a consequence, the style of some pieces of code was reviewed here to
- correct indentations
- rework LF positions
- fix split NS and revision dates
- add ternary operator where it makes senses
- rearrange and cascade builders and setters

Once that done, some optimizations have been proposed on the fly to:
- remove some intermediate variables that are not needed
- remove related imports no more used
- add imports to avoid to use long NS in code blocks
- etc

Finally add TODO comments on few places that might need to be reworked.

https://en.wikipedia.org/wiki/Programming_style

JIRA: TRNSPRTPCE-586 TRNSPRTPCE-205
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I14f5f40dfdf97fa0f32139d384db878e2932fc04
pce/src/main/java/org/opendaylight/transportpce/pce/service/PathComputationServiceImpl.java
pce/src/test/java/org/opendaylight/transportpce/pce/utils/PceTestData.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ModelMappingUtils.java