fix bug: change sql-query in localArtifactRepository (#820)

Also-by: Nazife Basbaz <nazife.basbaz@bosch-si.com>
Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
This commit is contained in:
Nazife Basbaz
2019-06-05 16:07:07 +02:00
committed by Jeroen Laverman
parent b8ca7d24c8
commit fde0cbdf16
31 changed files with 237 additions and 136 deletions

View File

@@ -249,10 +249,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
@Override
protected String getDeletedEntityName(final Long entityId) {
final Optional<SoftwareModule> softwareModule = softwareModuleManagement.get(entityId);
if (softwareModule.isPresent()) {
return softwareModule.get().getName() + ":" + softwareModule.get().getVersion();
}
return "";
return softwareModule.map(module -> module.getName() + ":" + module.getVersion()).orElse("");
}
}

View File

@@ -8,11 +8,8 @@
*/
package org.eclipse.hawkbit.ui.common.detailslayout;
import java.util.List;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -64,11 +61,9 @@ public class DistributionSetMetadataDetailsLayout extends AbstractMetadataDetail
return;
}
selectedDistSetId = distributionSet.getId();
final List<DistributionSetMetadata> dsMetadataList = distributionSetManagement
.findMetaDataByDistributionSetId(PageRequest.of(0, MAX_METADATA_QUERY), selectedDistSetId).getContent();
if (!dsMetadataList.isEmpty()) {
dsMetadataList.forEach(this::setMetadataProperties);
}
final PageRequest pageRequest = PageRequest.of(0, MAX_METADATA_QUERY);
distributionSetManagement.findMetaDataByDistributionSetId(pageRequest, selectedDistSetId).getContent()
.forEach(this::setMetadataProperties);
}
@Override

View File

@@ -8,11 +8,8 @@
*/
package org.eclipse.hawkbit.ui.common.detailslayout;
import java.util.List;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetMetadata;
import org.eclipse.hawkbit.ui.management.targettable.TargetMetadataPopupLayout;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -63,12 +60,8 @@ public class TargetMetadataDetailsLayout extends AbstractMetadataDetailsLayout {
return;
}
selectedTargetId = target.getId();
final List<TargetMetadata> targetMetadataList = targetManagement
.findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId())
.getContent();
if (!targetMetadataList.isEmpty()) {
targetMetadataList.forEach(this::setMetadataProperties);
}
targetManagement.findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId())
.getContent().forEach(this::setMetadataProperties);
}
@Override

View File

@@ -13,5 +13,5 @@ package org.eclipse.hawkbit.ui.common.table;
*
*/
public enum BaseEntityEventType {
ADD_ENTITY, REMOVE_ENTITY, UPDATED_ENTITY, SELECTED_ENTITY, MAXIMIZED, MINIMIZED;
ADD_ENTITY, REMOVE_ENTITY, UPDATED_ENTITY, SELECTED_ENTITY, MAXIMIZED, MINIMIZED
}

View File

@@ -338,10 +338,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
@Override
protected String getDeletedEntityName(final Long entityId) {
final Optional<SoftwareModule> softwareModule = softwareModuleManagement.get(entityId);
if (softwareModule.isPresent()) {
return softwareModule.get().getName() + ":" + softwareModule.get().getVersion();
}
return "";
return softwareModule.map(module -> module.getName() + ":" + module.getVersion()).orElse("");
}
}

View File

@@ -200,11 +200,9 @@ public class MaintenanceWindowLayout extends VerticalLayout {
* Get list of all time zone offsets supported.
*/
private static List<String> getAllTimeZones() {
final List<String> lst = ZoneId.getAvailableZoneIds().stream()
.map(id -> ZonedDateTime.now(ZoneId.of(id)).getOffset().getId().replace("Z", "+00:00")).distinct()
.collect(Collectors.toList());
lst.sort(null);
return lst;
return ZoneId.getAvailableZoneIds().stream()
.map(id -> ZonedDateTime.now(ZoneId.of(id)).getOffset().getId().replace("Z", "+00:00"))
.distinct().sorted().collect(Collectors.toList());
}
/**

View File

@@ -337,14 +337,9 @@ public final class DashboardMenu extends CustomComponent {
* with given viewname does not exists
*/
public DashboardMenuItem getByViewName(final String viewName) {
final Optional<DashboardMenuItem> findFirst = dashboardVaadinViews.stream()
.filter(view -> view.getViewName().equals(viewName)).findAny();
if (!findFirst.isPresent()) {
return null;
}
return findFirst.get();
return dashboardVaadinViews.stream()
.filter(view -> view.getViewName().equals(viewName)).findAny().orElse(null);
}
/**
@@ -355,14 +350,8 @@ public final class DashboardMenu extends CustomComponent {
* @return <code>true</code> = denied, <code>false</code> = accessible
*/
public boolean isAccessDenied(final String viewName) {
final List<DashboardMenuItem> accessibleViews = getAccessibleViews();
boolean accessDeined = Boolean.TRUE.booleanValue();
for (final DashboardMenuItem dashboardViewType : accessibleViews) {
if (dashboardViewType.getViewName().equals(viewName)) {
accessDeined = Boolean.FALSE.booleanValue();
}
}
return accessDeined;
return getAccessibleViews().stream()
.noneMatch(dashboardMenuItem -> dashboardMenuItem.getViewName().equals(viewName));
}
private class MenuToggleClickListenerMyClickListener implements ClickListener {

View File

@@ -149,7 +149,7 @@ public class AutoStartOptionGroupLayout extends HorizontalLayout {
* Rollout start options
*/
enum AutoStartOption {
MANUAL, AUTO_START, SCHEDULED;
MANUAL, AUTO_START, SCHEDULED
}