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