Removed further unnedded repo methods.
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
@@ -37,8 +38,8 @@ import com.google.common.base.Strings;
|
||||
public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> {
|
||||
private static final long serialVersionUID = 4362142538539335466L;
|
||||
private transient SoftwareManagement softwareManagementService;
|
||||
private SoftwareModuleType type;
|
||||
private String searchText = null;
|
||||
private Long type;
|
||||
private String searchText;
|
||||
private final Sort sort = new Sort(Direction.ASC, "name", "version");
|
||||
|
||||
/**
|
||||
@@ -57,7 +58,8 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
|
||||
final Object[] sortIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortIds, sortStates);
|
||||
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
|
||||
type = (SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE);
|
||||
type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
|
||||
.map(type -> type.getId()).orElse(null);
|
||||
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
searchText = String.format("%%%s%%", searchText);
|
||||
@@ -73,22 +75,17 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
|
||||
@Override
|
||||
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<SoftwareModule> swModuleBeans;
|
||||
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<>();
|
||||
|
||||
if (type == null && Strings.isNullOrEmpty(searchText)) {
|
||||
swModuleBeans = getSoftwareManagementService()
|
||||
.findSoftwareModulesAll(new OffsetBasedPageRequest(startIndex, count, sort));
|
||||
|
||||
} else {
|
||||
swModuleBeans = getSoftwareManagementService().findSoftwareModuleByFilters(
|
||||
new OffsetBasedPageRequest(startIndex, count, sort), searchText, type.getId());
|
||||
swModuleBeans = getSoftwareManagementService()
|
||||
.findSoftwareModuleByFilters(new OffsetBasedPageRequest(startIndex, count, sort), searchText, type);
|
||||
}
|
||||
|
||||
for (final SoftwareModule swModule : swModuleBeans) {
|
||||
proxyBeans.add(getProxyBean(swModule));
|
||||
}
|
||||
|
||||
return proxyBeans;
|
||||
return swModuleBeans.getContent().stream().map(this::getProxyBean).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private ProxyBaseSoftwareModuleItem getProxyBean(final SoftwareModule bean) {
|
||||
@@ -113,7 +110,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
|
||||
if (type == null && Strings.isNullOrEmpty(searchText)) {
|
||||
size = getSoftwareManagementService().countSoftwareModulesAll();
|
||||
} else {
|
||||
size = getSoftwareManagementService().countSoftwareModuleByFilters(searchText, type.getId());
|
||||
size = getSoftwareManagementService().countSoftwareModuleByFilters(searchText, type);
|
||||
}
|
||||
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
|
||||
@@ -209,7 +209,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId());
|
||||
/* display the window */
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
||||
}
|
||||
|
||||
private void showMetadataDetails(final Long itemId) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(itemId);
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(itemId);
|
||||
/* display the window */
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
|
||||
|
||||
@Override
|
||||
protected List<SoftwareModuleMetadata> getMetadataList() {
|
||||
return getSelectedEntity().getMetadata();
|
||||
return softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(getSelectedEntity().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.distributions.smtable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
@@ -22,7 +23,6 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
@@ -36,9 +36,9 @@ import com.google.common.base.Strings;
|
||||
public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> {
|
||||
private static final long serialVersionUID = 4362142538539335466L;
|
||||
private transient SoftwareManagement softwareManagementService;
|
||||
private SoftwareModuleType type;
|
||||
private String searchText = null;
|
||||
private Long orderByDistId = 0L;
|
||||
private Long type;
|
||||
private String searchText;
|
||||
private Long orderByDistId;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
@@ -56,7 +56,8 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
||||
final Object[] sortIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortIds, sortStates);
|
||||
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
|
||||
type = (SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE);
|
||||
type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
|
||||
.map(type -> type.getId()).orElse(null);
|
||||
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
searchText = String.format("%%%s%%", searchText);
|
||||
@@ -75,17 +76,10 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
||||
|
||||
@Override
|
||||
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<AssignedSoftwareModule> swModuleBeans;
|
||||
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>();
|
||||
|
||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type.getId());
|
||||
|
||||
for (final AssignedSoftwareModule swModule : swModuleBeans) {
|
||||
proxyBeans.add(getProxyBean(swModule));
|
||||
}
|
||||
|
||||
return proxyBeans;
|
||||
return getSoftwareManagement()
|
||||
.findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type)
|
||||
.getContent().stream().map(this::getProxyBean).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private ProxyBaseSwModuleItem getProxyBean(final AssignedSoftwareModule customSoftwareModule) {
|
||||
@@ -114,7 +108,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
||||
if (type == null && Strings.isNullOrEmpty(searchText)) {
|
||||
size = getSoftwareManagement().countSoftwareModulesAll();
|
||||
} else {
|
||||
size = getSoftwareManagement().countSoftwareModuleByFilters(searchText, type.getId());
|
||||
size = getSoftwareManagement().countSoftwareModuleByFilters(searchText, type);
|
||||
}
|
||||
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
|
||||
@@ -153,7 +153,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
|
||||
if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) {
|
||||
maxAssign = getI18n().get("label.singleAssign.type");
|
||||
} else {
|
||||
maxAssign = getI18n().get("label.multiAssign.type");
|
||||
maxAssign = getI18n().get("label.multiAssign.type");
|
||||
}
|
||||
updateSwModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||
getSelectedBaseEntity().getVendor(), maxAssign);
|
||||
@@ -217,7 +217,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId());
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteri
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
@@ -118,7 +118,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final SaveActionWindowEvent event) {
|
||||
if (event == SaveActionWindowEvent.DELETE_ALL_SOFWARE) {
|
||||
UI.getCurrent().access(() -> refreshFilter());
|
||||
UI.getCurrent().access(this::refreshFilter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
||||
}
|
||||
|
||||
private void showMetadataDetails(final Long itemId) {
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(itemId);
|
||||
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(itemId);
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user