Introduced direct return of default
This commit is contained in:
@@ -50,125 +50,92 @@ public final class PagingUtility {
|
||||
}
|
||||
|
||||
static Sort sanitizeTargetSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(TargetFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, TargetFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, TargetFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(TargetFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeSoftwareModuleSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(SoftwareModuleFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, SoftwareModuleFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, SoftwareModuleFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(SoftwareModuleFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeSoftwareModuleTypeSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(SoftwareModuleTypeFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, SoftwareModuleTypeFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, SoftwareModuleTypeFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(SoftwareModuleTypeFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeDistributionSetSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(DistributionSetFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, DistributionSetFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, DistributionSetFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(DistributionSetFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeDistributionSetTypeSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(DistributionSetTypeFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, DistributionSetTypeFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, DistributionSetTypeFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(DistributionSetTypeFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeActionSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(ActionFields.class, sortParam));
|
||||
} else {
|
||||
if (sortParam == null) {
|
||||
// default sort is DESC in case of action to match behavior
|
||||
// of management UI (last entry on top)
|
||||
sorting = new Sort(Direction.DESC, ActionFields.ID.getFieldName());
|
||||
return new Sort(Direction.DESC, ActionFields.ID.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(ActionFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeActionStatusSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(ActionStatusFields.class, sortParam));
|
||||
} else {
|
||||
if (sortParam == null) {
|
||||
// default sort is DESC in case of action status to match behavior
|
||||
// of management UI (last entry on top)
|
||||
sorting = new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName());
|
||||
return new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(ActionStatusFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeDistributionSetMetadataSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(DistributionSetMetadataFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, DistributionSetMetadataFields.KEY.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, DistributionSetMetadataFields.KEY.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(DistributionSetMetadataFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeSoftwareModuleMetadataSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(SoftwareModuleMetadataFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, SoftwareModuleMetadataFields.KEY.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, SoftwareModuleMetadataFields.KEY.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(SoftwareModuleMetadataFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeRolloutSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(RolloutFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, RolloutFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, RolloutFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(RolloutFields.class, sortParam));
|
||||
}
|
||||
|
||||
static Sort sanitizeRolloutGroupSortParam(final String sortParam) {
|
||||
final Sort sorting;
|
||||
if (sortParam != null) {
|
||||
sorting = new Sort(SortUtility.parse(RolloutGroupFields.class, sortParam));
|
||||
} else {
|
||||
// default sort
|
||||
sorting = new Sort(Direction.ASC, RolloutGroupFields.NAME.getFieldName());
|
||||
if (sortParam == null) {
|
||||
// default
|
||||
return new Sort(Direction.ASC, RolloutGroupFields.NAME.getFieldName());
|
||||
}
|
||||
return sorting;
|
||||
return new Sort(SortUtility.parse(RolloutGroupFields.class, sortParam));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user