diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/details/ArtifactBeanQuery.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/details/ArtifactBeanQuery.java index faf43b4ca..d08474a5a 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/details/ArtifactBeanQuery.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/details/ArtifactBeanQuery.java @@ -9,6 +9,9 @@ package org.eclipse.hawkbit.ui.artifacts.details; import static org.apache.commons.lang3.ArrayUtils.isEmpty; +import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.isNotNullOrEmpty; +import static org.springframework.data.domain.Sort.Direction.ASC; +import static org.springframework.data.domain.Sort.Direction.DESC; import java.util.List; import java.util.Map; @@ -17,7 +20,6 @@ import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.EntityFactory; import org.eclipse.hawkbit.repository.OffsetBasedPageRequest; import org.eclipse.hawkbit.repository.model.LocalArtifact; -import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SpringContextHelper; import org.springframework.data.domain.Page; @@ -53,18 +55,18 @@ public class ArtifactBeanQuery extends AbstractBeanQuery { */ public ArtifactBeanQuery(final QueryDefinition definition, final Map queryConfig, final Object[] sortIds, final boolean[] sortStates) { + super(definition, queryConfig, sortIds, sortStates); - if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) { + if (isNotNullOrEmpty(queryConfig)) { baseSwModuleId = (Long) queryConfig.get(SPUIDefinitions.BY_BASE_SOFTWARE_MODULE); } - if (isEmpty(sortStates)) { - // Initalize Sor - sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]); - // Add sort. + if (!isEmpty(sortStates)) { + sort = new Sort(sortStates[0] ? ASC : DESC, (String) sortIds[0]); + for (int targetId = 1; targetId < sortIds.length; targetId++) { - sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId])); + sort.and(new Sort(sortStates[targetId] ? ASC : DESC, (String) sortIds[targetId])); } } }