Full representation with filtration (#1415)
* fixed RSQL filtration while loading full representation of a Rollout Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Added tests Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * review findings Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> --------- Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>
This commit is contained in:
@@ -103,26 +103,17 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
final boolean isFullMode = parseRepresentationMode(representationModeParam) == MgmtRepresentationMode.FULL;
|
||||
|
||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
||||
final Slice<Rollout> rollouts;
|
||||
final long totalElements;
|
||||
final Page<Rollout> rollouts;
|
||||
if (rsqlParam != null) {
|
||||
if (isFullMode) {
|
||||
rollouts = this.rolloutManagement.findByFiltersWithDetailedStatus(pageable, rsqlParam, false);
|
||||
totalElements = this.rolloutManagement.countByFilters(rsqlParam);
|
||||
} else {
|
||||
final Page<Rollout> findRolloutsAll = this.rolloutManagement.findByRsql(pageable, rsqlParam, false);
|
||||
totalElements = findRolloutsAll.getTotalElements();
|
||||
rollouts = findRolloutsAll;
|
||||
}
|
||||
rollouts = this.rolloutManagement.findByRsql(pageable, rsqlParam, false);
|
||||
} else {
|
||||
if (isFullMode) {
|
||||
rollouts = this.rolloutManagement.findAllWithDetailedStatus(pageable, false);
|
||||
totalElements = this.rolloutManagement.count();
|
||||
} else {
|
||||
final Page<Rollout> findRolloutsAll = this.rolloutManagement.findAll(pageable, false);
|
||||
totalElements = findRolloutsAll.getTotalElements();
|
||||
rollouts = findRolloutsAll;
|
||||
}
|
||||
rollouts = this.rolloutManagement.findAll(pageable, false);
|
||||
}
|
||||
|
||||
final long totalElements = rollouts.getTotalElements();
|
||||
|
||||
if (isFullMode) {
|
||||
this.rolloutManagement.setRolloutStatusDetails(rollouts);
|
||||
}
|
||||
|
||||
final List<MgmtRolloutResponseBody> rest = MgmtRolloutMapper.toResponseRollout(rollouts.getContent(),
|
||||
|
||||
Reference in New Issue
Block a user