Skip to content

Commit

Permalink
fix classcast ex on TargetBeanQuery (eclipse-hawkbit#440)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hirsch <[email protected]>
  • Loading branch information
michahirsch authored Feb 21, 2017
1 parent 5628d62 commit cbf5bed
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.components.ProxyTarget;
Expand Down Expand Up @@ -61,7 +60,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
private transient TargetManagement targetManagement;
private transient I18N i18N;
private Long pinnedDistId;
private TargetFilterQuery targetFilterQuery;
private Long targetFilterQueryId;
private ManagementUIState managementUIState;

/**
Expand All @@ -88,7 +87,7 @@ public TargetBeanQuery(final QueryDefinition definition, final Map<String, Objec
noTagClicked = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_NO_TAG);
distributionId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION);
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
targetFilterQuery = (TargetFilterQuery) queryConfig.get(SPUIDefinitions.FILTER_BY_TARGET_FILTER_QUERY);
targetFilterQueryId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_TARGET_FILTER_QUERY);
if (!Strings.isNullOrEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText);
}
Expand Down Expand Up @@ -118,8 +117,8 @@ protected List<ProxyTarget> loadBeans(final int startIndex, final int count) {
targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet(
new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId,
new FilterParams(distributionId, status, overdueState, searchText, noTagClicked, targetTags));
} else if (null != targetFilterQuery) {
targetBeans = getTargetManagement().findTargetsByTargetFilterQuery(targetFilterQuery.getId(),
} else if (null != targetFilterQueryId) {
targetBeans = getTargetManagement().findTargetsByTargetFilterQuery(targetFilterQueryId,
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
} else if (!isAnyFilterSelected()) {
targetBeans = getTargetManagement().findTargetsAll(
Expand Down Expand Up @@ -186,8 +185,8 @@ protected void saveBeans(final List<ProxyTarget> addedTargets, final List<ProxyT
public int size() {
final long totSize = getTargetManagement().countTargetsAll();
long size;
if (null != targetFilterQuery) {
size = getTargetManagement().countTargetByTargetFilterQuery(targetFilterQuery.getId());
if (null != targetFilterQueryId) {
size = getTargetManagement().countTargetByTargetFilterQuery(targetFilterQueryId);
} else if (!isAnyFilterSelected()) {
size = totSize;
} else {
Expand Down

0 comments on commit cbf5bed

Please sign in to comment.