Split repository API for module and DS management. Refactor utility usage (#524)

* Split DS management and reduce util usage.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Split sw module and type management.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Sonar issues.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Make sonar listen to the exception!

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Register both beans.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Split JPA implementations.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Revert user details change.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix compilation errors.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix bean queries. Fix image path.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Document preferred utility usage.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix exmaples and revert unintended checkin.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Code cleanup.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Typos, readibility.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove unused reference.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Rollouts cache delete aware.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix rolloutgroup delete event.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Add new RolloutGroupDeletedEvent event

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-06-01 06:28:59 +02:00
committed by GitHub
parent 0ab995d1a4
commit 67a4677ef6
203 changed files with 2738 additions and 2320 deletions

View File

@@ -14,7 +14,8 @@ import javax.servlet.MultipartConfigElement;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -93,7 +94,9 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
UploadArtifactView(final UIEventBus eventBus, final SpPermissionChecker permChecker, final VaadinMessageSource i18n,
final UINotification uiNotification, final ArtifactUploadState artifactUploadState,
final TagManagement tagManagement, final EntityFactory entityFactory,
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion,
final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final UploadViewClientCriterion uploadViewClientCriterion,
final MultipartConfigElement multipartConfigElement, final ArtifactManagement artifactManagement) {
this.eventBus = eventBus;
this.permChecker = permChecker;
@@ -101,15 +104,15 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
this.uiNotification = uiNotification;
this.artifactUploadState = artifactUploadState;
this.filterByTypeLayout = new SMTypeFilterLayout(artifactUploadState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, softwareManagement, uploadViewClientCriterion);
tagManagement, entityFactory, uiNotification, softwareModuleTypeManagement, uploadViewClientCriterion);
this.smTableLayout = new SoftwareModuleTableLayout(i18n, permChecker, artifactUploadState, uiNotification,
eventBus, softwareManagement, entityFactory, uploadViewClientCriterion);
eventBus, softwareModuleManagement, softwareModuleTypeManagement, entityFactory, uploadViewClientCriterion);
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
artifactManagement, softwareManagement);
artifactManagement, softwareModuleManagement);
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState,
multipartConfigElement, artifactManagement, softwareManagement);
multipartConfigElement, artifactManagement, softwareModuleManagement);
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
artifactUploadState, softwareManagement, uploadViewClientCriterion);
artifactUploadState, softwareModuleManagement, softwareModuleTypeManagement, uploadViewClientCriterion);
}
@PostConstruct

View File

@@ -16,7 +16,7 @@ import java.util.Map;
import java.util.Optional;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
@@ -35,6 +35,7 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
@@ -43,7 +44,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.vaadin.data.Container;
import com.vaadin.server.FontAwesome;
@@ -104,7 +104,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private final transient ArtifactManagement artifactManagement;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
/**
* Constructor for ArtifactDetailsLayout
@@ -124,13 +124,13 @@ public class ArtifactDetailsLayout extends VerticalLayout {
*/
public ArtifactDetailsLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final UINotification uINotification,
final ArtifactManagement artifactManagement, final SoftwareManagement softwareManagement) {
final ArtifactManagement artifactManagement, final SoftwareModuleManagement softwareManagement) {
this.i18n = i18n;
this.eventBus = eventBus;
this.artifactUploadState = artifactUploadState;
this.uINotification = uINotification;
this.artifactManagement = artifactManagement;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
final Optional<SoftwareModule> selectedSoftwareModule = findSelectedSoftwareModule();
@@ -155,7 +155,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private Optional<SoftwareModule> findSelectedSoftwareModule() {
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
if (selectedBaseSwModuleId.isPresent()) {
return softwareManagement.findSoftwareModuleById(selectedBaseSwModuleId.get());
return softwareModuleManagement.findSoftwareModuleById(selectedBaseSwModuleId.get());
}
return Optional.empty();
}
@@ -424,7 +424,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
*/
public void populateArtifactDetails(final Long baseSwModuleId, final String swModuleName) {
if (!readOnly) {
if (Strings.isNullOrEmpty(swModuleName)) {
if (StringUtils.isEmpty(swModuleName)) {
setTitleOfLayoutHeader();
} else {
titleOfArtifactDetails.setValue(HawkbitCommonUtil.getArtifactoryDetailsLabelId(swModuleName));

View File

@@ -10,7 +10,8 @@ package org.eclipse.hawkbit.ui.artifacts.footer;
import java.util.Set;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -47,11 +48,13 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
public SMDeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final UIEventBus eventBus, final UINotification notification, final ArtifactUploadState artifactUploadState,
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion) {
final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final UploadViewClientCriterion uploadViewClientCriterion) {
super(i18n, permChecker, eventBus, notification);
this.artifactUploadState = artifactUploadState;
this.uploadViewConfirmationWindowLayout = new UploadViewConfirmationWindowLayout(i18n, eventBus,
softwareManagement, artifactUploadState);
softwareModuleManagement, softwareModuleTypeManagement, artifactUploadState);
this.uploadViewClientCriterion = uploadViewClientCriterion;
init();

View File

@@ -13,7 +13,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
@@ -53,14 +54,19 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
private static final String DISCARD = "Discard";
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final ArtifactUploadState artifactUploadState;
UploadViewConfirmationWindowLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SoftwareManagement softwareManagement, final ArtifactUploadState artifactUploadState) {
final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final ArtifactUploadState artifactUploadState) {
super(i18n, eventBus);
this.softwareManagement = softwareManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
this.softwareModuleManagement = softwareModuleManagement;
this.artifactUploadState = artifactUploadState;
}
@@ -146,7 +152,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
private void deleteSMAll(final ConfirmationTab tab) {
final Set<Long> swmoduleIds = artifactUploadState.getDeleteSofwareModules().keySet();
softwareManagement.deleteSoftwareModules(swmoduleIds);
softwareModuleManagement.deleteSoftwareModules(swmoduleIds);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -244,8 +250,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
private void deleteSMtypeAll(final ConfirmationTab tab) {
final int deleteSWModuleTypeCount = artifactUploadState.getSelectedDeleteSWModuleTypes().size();
for (final String swModuleTypeName : artifactUploadState.getSelectedDeleteSWModuleTypes()) {
softwareManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareManagement::deleteSoftwareModuleType);
softwareModuleTypeManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareModuleTypeManagement::deleteSoftwareModuleType);
}
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.sw.module.type.delete", new Object[] { deleteSWModuleTypeCount }));

View File

@@ -14,7 +14,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
@@ -25,11 +25,10 @@ import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Simple implementation of generics bean query which dynamically loads a batch
* of beans.
@@ -37,7 +36,7 @@ import com.google.common.base.Strings;
*/
public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> {
private static final long serialVersionUID = 4362142538539335466L;
private transient SoftwareManagement softwareManagementService;
private transient SoftwareModuleManagement softwareManagementService;
private Long type;
private String searchText;
private final Sort sort = new Sort(Direction.ASC, "name", "version");
@@ -61,7 +60,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
.map(SoftwareModuleType::getId).orElse(null);
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(searchText)) {
if (!StringUtils.isEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText);
}
}
@@ -76,7 +75,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
final Slice<SoftwareModule> swModuleBeans;
if (type == null && Strings.isNullOrEmpty(searchText)) {
if (type == null && StringUtils.isEmpty(searchText)) {
swModuleBeans = getSoftwareManagementService()
.findSoftwareModulesAll(new OffsetBasedPageRequest(startIndex, count, sort));
@@ -107,7 +106,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
@Override
public int size() {
long size;
if (type == null && Strings.isNullOrEmpty(searchText)) {
if (type == null && StringUtils.isEmpty(searchText)) {
size = getSoftwareManagementService().countSoftwareModulesAll();
} else {
size = getSoftwareManagementService().countSoftwareModuleByFilters(searchText, type);
@@ -127,9 +126,9 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
// save of the entity not required from this method
}
private SoftwareManagement getSoftwareManagementService() {
private SoftwareModuleManagement getSoftwareManagementService() {
if (softwareManagementService == null) {
softwareManagementService = SpringContextHelper.getBean(SoftwareManagement.class);
softwareManagementService = SpringContextHelper.getBean(SoftwareModuleManagement.class);
}
return softwareManagementService;
}

View File

@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -59,7 +59,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
private final transient EventBus.UIEventBus eventBus;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
private final transient EntityFactory entityFactory;
@@ -90,18 +92,22 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
* UINotification
* @param eventBus
* UIEventBus
* @param softwareManagement
* SoftwareManagement
* @param softwareModuleManagement
* management for {@link SoftwareModule}s
* @param softwareModuleTypeManagement
* management for {@link SoftwareModuleType}s
* @param entityFactory
* EntityFactory
*/
public SoftwareModuleAddUpdateWindow(final VaadinMessageSource i18n, final UINotification uiNotifcation,
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final UIEventBus eventBus, final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement, final EntityFactory entityFactory,
final AbstractTable<SoftwareModule> softwareModuleTable) {
this.i18n = i18n;
this.uiNotifcation = uiNotifcation;
this.eventBus = eventBus;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareModuleManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
this.entityFactory = entityFactory;
this.softwareModuleTable = softwareModuleTable;
@@ -133,12 +139,13 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
final SoftwareModuleType softwareModuleTypeByName = softwareManagement.findSoftwareModuleTypeByName(type)
final SoftwareModuleType softwareModuleTypeByName = softwareModuleTypeManagement
.findSoftwareModuleTypeByName(type)
.orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, type));
final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create()
.type(softwareModuleTypeByName).name(name).version(version).description(description).vendor(vendor);
final SoftwareModule newSoftwareModule = softwareManagement.createSoftwareModule(softwareModule);
final SoftwareModule newSoftwareModule = softwareModuleManagement.createSoftwareModule(softwareModule);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
@@ -150,9 +157,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
final String version = versionTextField.getValue();
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
final Optional<Long> moduleType = softwareManagement.findSoftwareModuleTypeByName(type)
final Optional<Long> moduleType = softwareModuleTypeManagement.findSoftwareModuleTypeByName(type)
.map(SoftwareModuleType::getId);
if (moduleType.isPresent() && softwareManagement
if (moduleType.isPresent() && softwareModuleManagement
.findSoftwareModuleByNameAndVersion(name, version, moduleType.get()).isPresent()) {
uiNotifcation.displayValidationError(
i18n.getMessage("message.duplicate.softwaremodule", new Object[] { name, version }));
@@ -165,8 +172,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
* updates a softwareModule
*/
private void updateSwModule() {
final SoftwareModule newSWModule = softwareManagement.updateSoftwareModule(entityFactory.softwareModule()
.update(baseSwModuleId).description(descTextArea.getValue()).vendor(vendorTextField.getValue()));
final SoftwareModule newSWModule = softwareModuleManagement
.updateSoftwareModule(entityFactory.softwareModule().update(baseSwModuleId)
.description(descTextArea.getValue()).vendor(vendorTextField.getValue()));
if (newSWModule != null) {
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
new Object[] { newSWModule.getName() + ":" + newSWModule.getVersion() }));
@@ -220,8 +228,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
typeComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("upload.swmodule.type"), "", null, null, true,
null, i18n.getMessage("upload.swmodule.type"));
typeComboBox.setId(UIComponentIdProvider.SW_MODULE_TYPE);
typeComboBox
.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + StringUtils.SPACE + ValoTheme.COMBOBOX_TINY);
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
typeComboBox.setImmediate(Boolean.TRUE);
}
@@ -282,7 +289,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
return;
}
editSwModule = Boolean.TRUE;
softwareManagement.findSoftwareModuleById(baseSwModuleId).ifPresent(swModule -> {
softwareModuleManagement.findSoftwareModuleById(baseSwModuleId).ifPresent(swModule -> {
nameTextField.setValue(swModule.getName());
versionTextField.setValue(swModule.getVersion());
vendorTextField.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getVendor()));

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.artifacts.smtable;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -30,7 +30,7 @@ public class SoftwareModuleDetails extends AbstractSoftwareModuleDetails {
SoftwareModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker,
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
final ArtifactUploadState artifactUploadState, final SoftwareManagement softwareManagement,
final ArtifactUploadState artifactUploadState, final SoftwareModuleManagement softwareManagement,
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
super(i18n, eventBus, permissionChecker, null, softwareManagement, swMetadataPopupLayout, entityFactory,
softwareModuleAddUpdateWindow);

View File

@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
@@ -60,19 +60,19 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
private final ArtifactUploadState artifactUploadState;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final UploadViewClientCriterion uploadViewClientCriterion;
private final SwMetadataPopupLayout swMetadataPopupLayout;
SoftwareModuleTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification uiNotification,
final ArtifactUploadState artifactUploadState, final SoftwareManagement softwareManagement,
final ArtifactUploadState artifactUploadState, final SoftwareModuleManagement softwareManagement,
final UploadViewClientCriterion uploadViewClientCriterion,
final SwMetadataPopupLayout swMetadataPopupLayout) {
super(eventBus, i18n, uiNotification);
this.artifactUploadState = artifactUploadState;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.uploadViewClientCriterion = uploadViewClientCriterion;
this.swMetadataPopupLayout = swMetadataPopupLayout;
@@ -145,7 +145,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
@Override
protected Optional<SoftwareModule> findEntityByTableValue(final Long entityTableId) {
return softwareManagement.findSoftwareModuleById(entityTableId);
return softwareModuleManagement.findSoftwareModuleById(entityTableId);
}
@Override
@@ -253,7 +253,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
}
private void showMetadataDetails(final Long itemId) {
softwareManagement.findSoftwareModuleById(itemId)
softwareModuleManagement.findSoftwareModuleById(itemId)
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
}

View File

@@ -9,7 +9,8 @@
package org.eclipse.hawkbit.ui.artifacts.smtable;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
@@ -30,23 +31,25 @@ public class SoftwareModuleTableLayout extends AbstractTableLayout<SoftwareModul
public SoftwareModuleTableLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final ArtifactUploadState artifactUploadState, final UINotification uiNotification,
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final UIEventBus eventBus, final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement, final EntityFactory entityFactory,
final UploadViewClientCriterion uploadViewClientCriterion) {
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
softwareManagement, entityFactory, permChecker);
softwareModuleManagement, entityFactory, permChecker);
this.softwareModuleTable = new SoftwareModuleTable(eventBus, i18n, uiNotification, artifactUploadState,
softwareManagement, uploadViewClientCriterion, swMetadataPopupLayout);
softwareModuleManagement, uploadViewClientCriterion, swMetadataPopupLayout);
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
uiNotification, eventBus, softwareManagement, entityFactory, softwareModuleTable);
uiNotification, eventBus, softwareModuleManagement, softwareModuleTypeManagement, entityFactory,
softwareModuleTable);
super.init(
new SoftwareModuleTableHeader(i18n, permChecker, eventBus, artifactUploadState,
softwareModuleAddUpdateWindow),
softwareModuleTable,
new SoftwareModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
artifactUploadState, softwareManagement, swMetadataPopupLayout, entityFactory));
artifactUploadState, softwareModuleManagement, swMetadataPopupLayout, entityFactory));
}
public SoftwareModuleTable getSoftwareModuleTable() {

View File

@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Optional;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -53,7 +53,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateSoftwareTypeLayout.class);
private final transient SoftwareManagement swTypeManagementService;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
private String singleAssignStr;
private String multiAssignStr;
@@ -76,14 +76,14 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
* SpPermissionChecker
* @param uiNotification
* UINotification
* @param swTypeManagementService
* SoftwareManagement
* @param softwareModuleTypeManagement
* management for {@link SoftwareModuleType}s
*/
public CreateUpdateSoftwareTypeLayout(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification, final SoftwareManagement swTypeManagementService) {
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
this.swTypeManagementService = swTypeManagementService;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
}
@Override
@@ -119,7 +119,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
@Override
protected Color getColorForColorPicker() {
final Optional<SoftwareModuleType> typeSelected = swTypeManagementService
final Optional<SoftwareModuleType> typeSelected = softwareModuleTypeManagement
.findSoftwareModuleTypeByName(tagNameComboBox.getValue().toString());
if (typeSelected.isPresent()) {
return typeSelected.get().getColour() != null
@@ -197,7 +197,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
@Override
protected void setTagDetails(final String targetTagSelected) {
tagName.setValue(targetTagSelected);
swTypeManagementService.findSoftwareModuleTypeByName(targetTagSelected).ifPresent(selectedTypeTag -> {
softwareModuleTypeManagement.findSoftwareModuleTypeByName(targetTagSelected).ifPresent(selectedTypeTag -> {
tagDesc.setValue(selectedTypeTag.getDescription());
typeKey.setValue(selectedTypeTag.getKey());
if (selectedTypeTag.getMaxAssignments() == 1) {
@@ -237,12 +237,12 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
@Override
protected Optional<SoftwareModuleType> findEntityByKey() {
return swTypeManagementService.findSoftwareModuleTypeByKey(typeKey.getValue());
return softwareModuleTypeManagement.findSoftwareModuleTypeByKey(typeKey.getValue());
}
@Override
protected Optional<SoftwareModuleType> findEntityByName() {
return swTypeManagementService.findSoftwareModuleTypeByName(tagName.getValue());
return softwareModuleTypeManagement.findSoftwareModuleTypeByName(tagName.getValue());
}
@Override
@@ -264,7 +264,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
}
if (typeNameValue != null && typeKeyValue != null) {
final SoftwareModuleType newSWType = swTypeManagementService.createSoftwareModuleType(
final SoftwareModuleType newSWType = softwareModuleTypeManagement.createSoftwareModuleType(
entityFactory.softwareModuleType().create().key(typeKeyValue).name(typeNameValue)
.description(typeDescValue).colour(colorPicked).maxAssignments(assignNumber));
uiNotification
@@ -277,7 +277,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
}
private void updateSWModuleType(final SoftwareModuleType existingType) {
swTypeManagementService.updateSoftwareModuleType(
softwareModuleTypeManagement.updateSoftwareModuleType(
entityFactory.softwareModuleType().update(existingType.getId()).description(tagDesc.getValue())
.colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())));
uiNotification

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtype;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
@@ -29,13 +29,13 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick {
private final ArtifactUploadState artifactUploadState;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
SMTypeFilterButtonClick(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState,
final SoftwareManagement softwareManagement) {
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
this.eventBus = eventBus;
this.artifactUploadState = artifactUploadState;
this.softwareManagement = softwareManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
}
@Override
@@ -46,7 +46,7 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick {
@Override
protected void filterClicked(final Button clickedButton) {
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
softwareModuleTypeManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
.ifPresent(softwareModuleType -> {
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.EnumSet;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
@@ -43,8 +43,9 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
private final UploadViewClientCriterion uploadViewClientCriterion;
SMTypeFilterButtons(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState,
final UploadViewClientCriterion uploadViewClientCriterion, final SoftwareManagement softwareManagement) {
super(eventBus, new SMTypeFilterButtonClick(eventBus, artifactUploadState, softwareManagement));
final UploadViewClientCriterion uploadViewClientCriterion,
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(eventBus, new SMTypeFilterButtonClick(eventBus, artifactUploadState, softwareModuleTypeManagement));
this.artifactUploadState = artifactUploadState;
this.uploadViewClientCriterion = uploadViewClientCriterion;
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.artifacts.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
@@ -39,11 +39,11 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
SMTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement) {
final SoftwareModuleTypeManagement softwareModuletypeManagement) {
super(permChecker, eventBus, i18n);
this.artifactUploadState = artifactUploadState;
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, tagManagement, entityFactory, eventBus,
permChecker, uiNotification, softwareManagement);
permChecker, uiNotification, softwareModuletypeManagement);
if (permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission()) {
createUpdateSWTypeLayout.init();

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.artifacts.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
@@ -34,10 +34,12 @@ public class SMTypeFilterLayout extends AbstractFilterLayout {
public SMTypeFilterLayout(final ArtifactUploadState artifactUploadState, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion) {
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final UploadViewClientCriterion uploadViewClientCriterion) {
super(new SMTypeFilterHeader(i18n, permChecker, eventBus, artifactUploadState, tagManagement, entityFactory,
uiNotification, softwareManagement),
new SMTypeFilterButtons(eventBus, artifactUploadState, uploadViewClientCriterion, softwareManagement));
uiNotification, softwareModuleTypeManagement),
new SMTypeFilterButtons(eventBus, artifactUploadState, uploadViewClientCriterion,
softwareModuleTypeManagement));
this.artifactUploadState = artifactUploadState;
restoreState();

View File

@@ -12,7 +12,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
@@ -73,11 +73,11 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
private SoftwareModule selectedSwForUpload;
private final ArtifactUploadState artifactUploadState;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
UploadHandler(final String fileName, final long fileSize, final UploadLayout view, final long maxSize,
final Upload upload, final String mimeType, final SoftwareModule selectedSw,
final SoftwareManagement softwareManagement) {
final SoftwareModuleManagement softwareManagement) {
super();
this.aborted = false;
this.fileName = fileName;
@@ -90,7 +90,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
this.i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
this.eventBus = SpringContextHelper.getBean(EventBus.UIEventBus.class);
this.artifactUploadState = SpringContextHelper.getBean(ArtifactUploadState.class);
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
eventBus.subscribe(this);
}
@@ -217,7 +217,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
if (selectedBaseSwModuleId.isPresent()) {
selectedSwForUpload = softwareManagement.findSoftwareModuleById(selectedBaseSwModuleId.get()).orElse(null);
selectedSwForUpload = softwareModuleManagement.findSoftwareModuleById(selectedBaseSwModuleId.get()).orElse(null);
}
if (selectedSwForUpload != null && view.checkIfSoftwareModuleIsSelected()

View File

@@ -21,7 +21,7 @@ import javax.servlet.MultipartConfigElement;
import org.apache.commons.io.FileUtils;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
@@ -51,7 +51,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.base.Strings;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
@@ -112,7 +111,7 @@ public class UploadLayout extends VerticalLayout {
private Button uploadStatusButton;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private static AcceptCriterion acceptAllExceptBlacklisted = new Not(new ServerItemIdClientCriterion(Mode.PREFIX,
UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UIComponentIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
@@ -121,7 +120,7 @@ public class UploadLayout extends VerticalLayout {
public UploadLayout(final VaadinMessageSource i18n, final UINotification uiNotification, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final MultipartConfigElement multipartConfigElement,
final ArtifactManagement artifactManagement, final SoftwareManagement softwareManagement) {
final ArtifactManagement artifactManagement, final SoftwareModuleManagement softwareManagement) {
this.uploadInfoWindow = new UploadStatusInfoWindow(eventBus, artifactUploadState, i18n);
this.i18n = i18n;
this.uiNotification = uiNotification;
@@ -129,7 +128,7 @@ public class UploadLayout extends VerticalLayout {
this.artifactUploadState = artifactUploadState;
this.multipartConfigElement = multipartConfigElement;
this.artifactManagement = artifactManagement;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
createComponents();
buildLayout();
@@ -178,7 +177,7 @@ public class UploadLayout extends VerticalLayout {
final Upload upload = new Upload();
final UploadHandler uploadHandler = new UploadHandler(null, 0, this, multipartConfigElement.getMaxFileSize(),
upload, null, null, softwareManagement);
upload, null, null, softwareModuleManagement);
upload.setButtonCaption(i18n.getMessage("upload.file"));
upload.setImmediate(true);
upload.setReceiver(uploadHandler);
@@ -252,7 +251,7 @@ public class UploadLayout extends VerticalLayout {
artifactUploadState.getSelectedBaseSwModuleId().ifPresent(selectedSwId -> {
// reset the flag
hasDirectory = false;
final SoftwareModule softwareModule = softwareManagement.findSoftwareModuleById(selectedSwId)
final SoftwareModule softwareModule = softwareModuleManagement.findSoftwareModuleById(selectedSwId)
.orElse(null);
for (final Html5File file : files) {
processFile(file, softwareModule);
@@ -304,18 +303,18 @@ public class UploadLayout extends VerticalLayout {
private StreamVariable createStreamVariable(final Html5File file, final SoftwareModule selectedSw) {
return new UploadHandler(file.getFileName(), file.getFileSize(), UploadLayout.this,
multipartConfigElement.getMaxFileSize(), null, file.getType(), selectedSw, softwareManagement);
multipartConfigElement.getMaxFileSize(), null, file.getType(), selectedSw, softwareModuleManagement);
}
private boolean isDirectory(final Html5File file) {
return Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0;
return StringUtils.isEmpty(file.getType()) && file.getFileSize() % 4096 == 0;
}
}
private void displayCompositeMessage() {
final String duplicateMessage = getDuplicateFileValidationMessage();
final StringBuilder compositeMessage = new StringBuilder();
if (!Strings.isNullOrEmpty(duplicateMessage)) {
if (!StringUtils.isEmpty(duplicateMessage)) {
compositeMessage.append(duplicateMessage);
}
if (hasDirectory) {
@@ -731,7 +730,7 @@ public class UploadLayout extends VerticalLayout {
}
void refreshArtifactDetailsLayout(final Long selectedBaseSoftwareModuleId) {
final SoftwareModule softwareModule = softwareManagement.findSoftwareModuleById(selectedBaseSoftwareModuleId)
final SoftwareModule softwareModule = softwareModuleManagement.findSoftwareModuleById(selectedBaseSoftwareModuleId)
.orElse(null);
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, softwareModule));
}

View File

@@ -8,10 +8,10 @@
*/
package org.eclipse.hawkbit.ui.colorpicker;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.ui.management.tag.SpColorPickerPreview;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.ui.Slider.ValueOutOfBoundsException;
@@ -50,7 +50,7 @@ public final class ColorPickerHelper {
*/
public static Color rgbToColorConverter(final String value) {
if (StringUtils.isEmpty(value) || (StringUtils.isNotEmpty(value) && !value.startsWith("rgb"))) {
if (StringUtils.isEmpty(value) || (!StringUtils.isEmpty(value) && !value.startsWith("rgb"))) {
throw new IllegalArgumentException(
"String to convert is empty or of invalid format - value: '" + value + "'");
}

View File

@@ -19,7 +19,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorderWithIcon;

View File

@@ -12,8 +12,8 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleTiny;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.util.StringUtils;
import com.google.common.base.Strings;
import com.vaadin.server.Resource;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
@@ -120,7 +120,7 @@ public class ConfirmationDialog implements Button.ClickListener {
public ConfirmationDialog(final String caption, final String question, final String okLabel,
final String cancelLabel, final ConfirmationDialogCallback callback, final Resource icon, final String id) {
window = new Window(caption);
if (!Strings.isNullOrEmpty(id)) {
if (!StringUtils.isEmpty(id)) {
window.setId(id);
}
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.common;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
@@ -39,7 +39,7 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
private final Sort sort = new Sort(Direction.ASC, "name");
private transient Page<DistributionSetType> firstPageDistSetType;
private transient DistributionSetManagement distributionSetManagement;
private transient DistributionSetTypeManagement distributionSetTypeManagement;
/**
* Parametric constructor.
@@ -71,11 +71,11 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
return (int) size;
}
private DistributionSetManagement getDistributionSetManagement() {
if (distributionSetManagement == null) {
distributionSetManagement = SpringContextHelper.getBean(DistributionSetManagement.class);
private DistributionSetTypeManagement getDistributionSetManagement() {
if (distributionSetTypeManagement == null) {
distributionSetTypeManagement = SpringContextHelper.getBean(DistributionSetTypeManagement.class);
}
return distributionSetManagement;
return distributionSetTypeManagement;
}
@Override

View File

@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
@@ -30,15 +30,10 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
private static final long serialVersionUID = 7824925429198339644L;
private final Sort sort = new Sort(Direction.ASC, "name");
private transient Page<SoftwareModuleType> firstPageSwModuleType;
private transient SoftwareManagement softwareManagement;
private transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
/**
* Parametric constructor.
*
* @param definition
* @param queryConfig
* @param sortIds
* @param sortStates
*/
public SoftwareModuleTypeBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
final Object[] sortIds, final boolean[] sortStates) {
@@ -52,7 +47,7 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
@Override
public int size() {
firstPageSwModuleType = getSoftwareManagement()
firstPageSwModuleType = getSoftwareModuleTypeManagement()
.findSoftwareModuleTypesAll(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
long size = firstPageSwModuleType.getTotalElements();
if (size > Integer.MAX_VALUE) {
@@ -61,11 +56,11 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
return (int) size;
}
private SoftwareManagement getSoftwareManagement() {
if (softwareManagement == null) {
softwareManagement = SpringContextHelper.getBean(SoftwareManagement.class);
private SoftwareModuleTypeManagement getSoftwareModuleTypeManagement() {
if (softwareModuleTypeManagement == null) {
softwareModuleTypeManagement = SpringContextHelper.getBean(SoftwareModuleTypeManagement.class);
}
return softwareManagement;
return softwareModuleTypeManagement;
}
@Override
@@ -74,7 +69,7 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
if (startIndex == 0 && firstPageSwModuleType != null) {
swModuleTypeBeans = firstPageSwModuleType;
} else {
swModuleTypeBeans = getSoftwareManagement()
swModuleTypeBeans = getSoftwareModuleTypeManagement()
.findSoftwareModuleTypesAll(new OffsetBasedPageRequest(startIndex, count, sort));
}
return swModuleTypeBeans.getContent();

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.common.builder;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import com.vaadin.ui.AbstractTextField;
@@ -144,18 +144,18 @@ public abstract class AbstractTextFieldBuilder<E extends AbstractTextField> {
textComponent.setReadOnly(readOnly);
textComponent.setEnabled(enabled);
if (StringUtils.isNotEmpty(caption)) {
if (!StringUtils.isEmpty(caption)) {
textComponent.setCaption(caption);
}
if (StringUtils.isNotEmpty(style)) {
if (!StringUtils.isEmpty(style)) {
textComponent.setStyleName(style);
}
if (StringUtils.isNotEmpty(styleName)) {
if (!StringUtils.isEmpty(styleName)) {
textComponent.addStyleName(styleName);
}
if (StringUtils.isNotEmpty(prompt)) {
if (!StringUtils.isEmpty(prompt)) {
textComponent.setInputPrompt(prompt);
}
@@ -163,7 +163,7 @@ public abstract class AbstractTextFieldBuilder<E extends AbstractTextField> {
textComponent.setMaxLength(maxLengthAllowed);
}
if (StringUtils.isNotEmpty(id)) {
if (!StringUtils.isEmpty(id)) {
textComponent.setId(id);
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.common.detailslayout;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -45,17 +45,17 @@ public abstract class AbstractSoftwareModuleDetails
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final SwMetadataPopupLayout swMetadataPopupLayout;
protected AbstractSoftwareModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final SoftwareModuleManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory, final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
super(i18n, eventBus, permissionChecker, managementUIState);
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
@@ -139,7 +139,7 @@ public abstract class AbstractSoftwareModuleDetails
@Override
protected void showMetadata(final ClickEvent event) {
softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId())
softwareModuleManagement.findSoftwareModuleById(getSelectedBaseEntityId())
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
}

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.common.detailslayout;
import java.util.List;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -48,7 +48,7 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
private SpPermissionChecker permissionChecker;
private transient SoftwareManagement softwareManagement;
private transient SoftwareModuleManagement softwareModuleManagement;
private SwMetadataPopupLayout swMetadataPopupLayout;
@@ -73,11 +73,11 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
* the entity factory service
*/
public void init(final VaadinMessageSource i18n, final SpPermissionChecker permissionChecker,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final SoftwareModuleManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
this.entityFactory = entityFactory;
createSWMMetadataTable();
@@ -95,7 +95,7 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
return;
}
selectedSWModuleId = swModule.getId();
final List<SoftwareModuleMetadata> swMetadataList = softwareManagement
final List<SoftwareModuleMetadata> swMetadataList = softwareModuleManagement
.findSoftwareModuleMetadataBySoftwareModuleId(selectedSWModuleId,
new PageRequest(0, MAX_METADATA_QUERY))
.getContent();
@@ -177,7 +177,7 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
}
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
softwareManagement.findSoftwareModuleById(selectedSWModuleId).ifPresent(swmodule -> UI.getCurrent()
softwareModuleManagement.findSoftwareModuleById(selectedSWModuleId).ifPresent(swmodule -> UI.getCurrent()
.addWindow(swMetadataPopupLayout.getWindow(swmodule, entityFactory.generateMetadata(metadataKey, ""))));
}

View File

@@ -8,9 +8,10 @@
*/
package org.eclipse.hawkbit.ui.common.grid;
import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;
import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
@@ -604,11 +605,12 @@ public abstract class AbstractGrid<T extends Indexed> extends Grid implements Re
@Override
public String getStyle(final CellReference cellReference) {
if (ArrayUtils.contains(center, cellReference.getPropertyId())) {
if (Arrays.stream(center).anyMatch(o -> Objects.equals(o, cellReference.getPropertyId()))) {
return "centeralign";
} else if (ArrayUtils.contains(right, cellReference.getPropertyId())) {
} else if (Arrays.stream(right).anyMatch(o -> Objects.equals(o, cellReference.getPropertyId()))) {
return "rightalign";
} else if (ArrayUtils.contains(left, cellReference.getPropertyId())) {
} else if (Arrays.stream(left).anyMatch(o -> Objects.equals(o, cellReference.getPropertyId()))) {
return "leftalign";
}
return null;

View File

@@ -17,8 +17,8 @@ import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import com.google.common.base.Strings;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
@@ -63,7 +63,7 @@ public abstract class AbstractGridHeader extends VerticalLayout {
private void restoreState() {
final String onLoadSearchBoxValue = onLoadSearchBoxValue();
if (!Strings.isNullOrEmpty(onLoadSearchBoxValue)) {
if (!StringUtils.isEmpty(onLoadSearchBoxValue)) {
openSearchTextField();
searchField.setValue(onLoadSearchBoxValue);
}

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.common.table;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.lang3.ClassUtils;
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
import org.eclipse.hawkbit.repository.event.remote.RemoteIdEvent;
import org.eclipse.hawkbit.repository.model.BaseEntity;
@@ -96,7 +95,7 @@ public class BaseUIEntityEvent<T extends BaseEntity> {
}
final RemoteIdEvent remoteIdEvent = (RemoteIdEvent) tenantAwareEvent;
try {
final Class<?> remoteEntityClass = ClassUtils.getClass(remoteIdEvent.getEntityClass());
final Class<?> remoteEntityClass = Class.forName(remoteIdEvent.getEntityClass());
return entityClass.isAssignableFrom(remoteEntityClass) && entityIds.contains(remoteIdEvent.getEntityId());
} catch (final ClassNotFoundException e) {
LOG.error("Entity Class of remoteIdEvent cannot be found", e);

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.Arrays;
import java.util.Optional;
import org.eclipse.hawkbit.repository.TagManagement;
@@ -27,8 +28,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.collect.Lists;
/**
* Implementation of Target tag token.
*
@@ -76,7 +75,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
private TargetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
final TargetTagAssignmentResult result = targetManagement
.toggleTagAssignment(Lists.newArrayList(selectedEntity.getControllerId()), tagNameSelected);
.toggleTagAssignment(Arrays.asList(selectedEntity.getControllerId()), tagNameSelected);
processTargetTagAssigmentResult(result);
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
return result;

View File

@@ -8,10 +8,8 @@
*/
package org.eclipse.hawkbit.ui.components;
import java.util.Arrays;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
@@ -21,6 +19,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.FontAwesome;
@@ -199,7 +198,7 @@ public final class SPUIComponentProvider {
* @return Label
*/
public static Label createNameValueLabel(final String label, final String... values) {
final String valueStr = StringUtils.join(Arrays.asList(values), " ");
final String valueStr = StringUtils.arrayToDelimitedString(values, " ");
final Label nameValueLabel = new Label(getBoldHTMLText(label) + valueStr, ContentMode.HTML);
nameValueLabel.setSizeFull();
nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);

View File

@@ -12,8 +12,8 @@ import java.io.Serializable;
import java.util.Locale;
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
import org.springframework.util.StringUtils;
import com.google.common.base.Strings;
import com.vaadin.data.util.converter.Converter;
/**
@@ -52,7 +52,7 @@ public abstract class AbstractHtmlLabelConverter<T> implements Converter<String,
* label-adapter that converts from model to label-presentation.
* @return self for method-chaining
*/
public AbstractHtmlLabelConverter<T> addAdapter(LabelAdapter<T> adapter) {
public AbstractHtmlLabelConverter<T> addAdapter(final LabelAdapter<T> adapter) {
this.adapter = adapter;
return this;
}
@@ -97,15 +97,15 @@ public abstract class AbstractHtmlLabelConverter<T> implements Converter<String,
* @return string representation of key:value map
*/
private static String getStatusLabelDetailsInString(final String value, final String style, final String title,
final String id, boolean disabled) {
final String id, final boolean disabled) {
final StringBuilder val = new StringBuilder();
if (!Strings.isNullOrEmpty(value)) {
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(",");
}
if (!Strings.isNullOrEmpty(style)) {
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(",");
}
if (!Strings.isNullOrEmpty(title)) {
if (!StringUtils.isEmpty(title)) {
val.append("title:").append(title).append(",");
}
if (disabled) {

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.decorators;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import com.vaadin.server.Resource;
import com.vaadin.ui.Button;

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.decorators;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.themes.ValoTheme;
@@ -56,27 +56,27 @@ public final class SPUIComboBoxDecorator {
spUICombo.setRequired(required);
spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);
if (StringUtils.isNotEmpty(caption)) {
if (!StringUtils.isEmpty(caption)) {
spUICombo.setCaption(caption);
}
// Add style
if (StringUtils.isNotEmpty(style)) {
if (!StringUtils.isEmpty(style)) {
spUICombo.setStyleName(style);
}
// Add style Name
if (StringUtils.isNotEmpty(styleName)) {
if (!StringUtils.isEmpty(styleName)) {
spUICombo.addStyleName(styleName);
}
// AddWidth
if (StringUtils.isNotEmpty(width)) {
if (!StringUtils.isEmpty(width)) {
spUICombo.setWidth(width);
}
// Set prompt
if (StringUtils.isNotEmpty(prompt)) {
if (!StringUtils.isEmpty(prompt)) {
spUICombo.setInputPrompt(prompt);
}
// Set Data
if (StringUtils.isNotEmpty(data)) {
if (!StringUtils.isEmpty(data)) {
spUICombo.setData(data);
}

View File

@@ -14,8 +14,10 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
@@ -94,9 +96,12 @@ public class DistributionsView extends AbstractNotificationView implements Brows
@Autowired
DistributionsView(final SpPermissionChecker permChecker, final UIEventBus eventBus, final VaadinMessageSource i18n,
final UINotification uiNotification, final ManageDistUIState manageDistUIState,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final TagManagement tagManagement, final DistributionsViewClientCriterion distributionsViewClientCriterion,
final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final TagManagement tagManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final ArtifactUploadState artifactUploadState, final SystemManagement systemManagement,
final ArtifactManagement artifactManagement, final NotificationUnreadButton notificationUnreadButton,
final DistributionsViewMenuItem distributionsViewMenuItem) {
@@ -105,19 +110,20 @@ public class DistributionsView extends AbstractNotificationView implements Brows
this.i18n = i18n;
this.uiNotification = uiNotification;
this.filterByDSTypeLayout = new DSTypeFilterLayout(manageDistUIState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, softwareManagement, distributionSetManagement,
distributionsViewClientCriterion);
tagManagement, entityFactory, uiNotification, softwareModuleTypeManagement,
distributionSetTypeManagement, distributionsViewClientCriterion);
this.distributionTableLayout = new DistributionSetTableLayout(i18n, eventBus, permChecker, manageDistUIState,
softwareManagement, distributionSetManagement, targetManagement, entityFactory, uiNotification,
tagManagement, distributionsViewClientCriterion, systemManagement);
this.softwareModuleTableLayout = new SwModuleTableLayout(i18n, uiNotification, eventBus, softwareManagement,
entityFactory, manageDistUIState, permChecker, distributionsViewClientCriterion, artifactUploadState,
artifactManagement);
softwareModuleManagement, distributionSetManagement, distributionSetTypeManagement, targetManagement,
entityFactory, uiNotification, tagManagement, distributionsViewClientCriterion, systemManagement);
this.softwareModuleTableLayout = new SwModuleTableLayout(i18n, uiNotification, eventBus,
softwareModuleManagement, softwareModuleTypeManagement, entityFactory, manageDistUIState, permChecker,
distributionsViewClientCriterion, artifactUploadState, artifactManagement);
this.filterBySMTypeLayout = new DistSMTypeFilterLayout(eventBus, i18n, permChecker, manageDistUIState,
tagManagement, entityFactory, uiNotification, softwareManagement, distributionsViewClientCriterion);
tagManagement, entityFactory, uiNotification, softwareModuleTypeManagement,
distributionsViewClientCriterion);
this.deleteActionsLayout = new DSDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
systemManagement, manageDistUIState, distributionsViewClientCriterion, distributionSetManagement,
softwareManagement);
distributionSetTypeManagement, softwareModuleManagement, softwareModuleTypeManagement);
this.manageDistUIState = manageDistUIState;
this.distributionsViewMenuItem = distributionsViewMenuItem;
}

View File

@@ -13,9 +13,9 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
@@ -69,9 +69,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
private static final String DIST_TYPE_MANDATORY = "mandatory";
private static final String STAR = " * ";
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
private final transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetTypeManagement distributionSetTypeManagement;
private HorizontalLayout distTypeSelectLayout;
private Table sourceTable;
@@ -97,18 +97,18 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
* SpPermissionChecker
* @param uiNotification
* UINotification
* @param softwareManagement
* SoftwareManagement
* @param distributionSetManagement
* @param softwareModuleTypeManagement
* management for {@link SoftwareModuleType}s
* @param distributionSetTypeManagement
* DistributionSetManagement
*/
public CreateUpdateDistSetTypeLayout(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification, final SoftwareManagement softwareManagement,
final DistributionSetManagement distributionSetManagement) {
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
this.softwareManagement = softwareManagement;
this.distributionSetManagement = distributionSetManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
this.distributionSetTypeManagement = distributionSetTypeManagement;
}
@Override
@@ -153,7 +153,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
@Override
protected Color getColorForColorPicker() {
final Optional<DistributionSetType> existedDistType = distributionSetManagement
final Optional<DistributionSetType> existedDistType = distributionSetTypeManagement
.findDistributionSetTypeByName(tagNameComboBox.getValue().toString());
if (existedDistType.isPresent()) {
return existedDistType.get().getColour() != null
@@ -315,7 +315,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
private void getSourceTableData() {
sourceTableContainer.removeAllItems();
final Iterable<SoftwareModuleType> moduleTypeBeans = softwareManagement
final Iterable<SoftwareModuleType> moduleTypeBeans = softwareModuleTypeManagement
.findSoftwareModuleTypesAll(new PageRequest(0, 1_000));
Item saveTblitem;
for (final SoftwareModuleType swTypeTag : moduleTypeBeans) {
@@ -397,7 +397,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
final List<Long> optional = itemIds.stream()
.filter(itemId -> isOptionalModuleType(selectedTable.getItem(itemId))).collect(Collectors.toList());
final DistributionSetType newDistType = distributionSetManagement.createDistributionSetType(
final DistributionSetType newDistType = distributionSetTypeManagement.createDistributionSetType(
entityFactory.distributionSetType().create().key(typeKeyValue).name(typeNameValue)
.description(typeDescValue).colour(colorPicked).mandatory(mandatory).optional(optional));
uiNotification
@@ -429,7 +429,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
final DistributionSetTypeUpdate update = entityFactory.distributionSetType().update(existingType.getId())
.description(tagDesc.getValue())
.colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()));
if (distributionSetManagement.countDistributionSetsByType(existingType.getId()) <= 0 && null != itemIds
if (distributionSetTypeManagement.countDistributionSetsByType(existingType.getId()) <= 0 && null != itemIds
&& !itemIds.isEmpty()) {
update.mandatory(itemIds.stream().filter(itemId -> isMandatoryModuleType(selectedTable.getItem(itemId)))
@@ -438,7 +438,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
.collect(Collectors.toList()));
}
final DistributionSetType updateDistSetType = distributionSetManagement.updateDistributionSetType(update);
final DistributionSetType updateDistSetType = distributionSetTypeManagement.updateDistributionSetType(update);
uiNotification.displaySuccess(
i18n.getMessage("message.update.success", new Object[] { updateDistSetType.getName() }));
@@ -528,10 +528,10 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
tagName.setValue(distSetTypeSelected);
getSourceTableData();
selectedTable.getContainerDataSource().removeAllItems();
distributionSetManagement.findDistributionSetTypeByName(distSetTypeSelected).ifPresent(selectedTypeTag -> {
distributionSetTypeManagement.findDistributionSetTypeByName(distSetTypeSelected).ifPresent(selectedTypeTag -> {
tagDesc.setValue(selectedTypeTag.getDescription());
typeKey.setValue(selectedTypeTag.getKey());
if (distributionSetManagement.countDistributionSetsByType(selectedTypeTag.getId()) <= 0) {
if (distributionSetTypeManagement.countDistributionSetsByType(selectedTypeTag.getId()) <= 0) {
distTypeSelectLayout.setEnabled(true);
selectedTable.setEnabled(true);
} else {
@@ -584,12 +584,12 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
@Override
protected Optional<DistributionSetType> findEntityByKey() {
return distributionSetManagement.findDistributionSetTypeByKey(typeKey.getValue());
return distributionSetTypeManagement.findDistributionSetTypeByKey(typeKey.getValue());
}
@Override
protected Optional<DistributionSetType> findEntityByName() {
return distributionSetManagement.findDistributionSetTypeByName(tagName.getValue());
return distributionSetTypeManagement.findDistributionSetTypeByName(tagName.getValue());
}
@Override

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.distributions.disttype;
import java.io.Serializable;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
@@ -30,13 +30,13 @@ public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
private final ManageDistUIState manageDistUIState;
private final transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetTypeManagement distributionSetTypeManagement;
DSTypeFilterButtonClick(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final DistributionSetManagement distributionSetManagement) {
final DistributionSetTypeManagement distributionSetManagement) {
this.eventBus = eventBus;
this.manageDistUIState = manageDistUIState;
this.distributionSetManagement = distributionSetManagement;
this.distributionSetTypeManagement = distributionSetManagement;
}
@Override
@@ -47,7 +47,7 @@ public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
@Override
protected void filterClicked(final Button clickedButton) {
distributionSetManagement.findDistributionSetTypeByName(clickedButton.getData().toString())
distributionSetTypeManagement.findDistributionSetTypeByName(clickedButton.getData().toString())
.ifPresent(manageDistUIState.getManageDistFilters()::setClickedDistSetType);
eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
}

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
@@ -41,8 +41,8 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
DSTypeFilterButtons(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final DistributionSetManagement distributionSetManagement) {
super(eventBus, new DSTypeFilterButtonClick(eventBus, manageDistUIState, distributionSetManagement));
final DistributionSetTypeManagement distributionSetTypeManagement) {
super(eventBus, new DSTypeFilterButtonClick(eventBus, manageDistUIState, distributionSetTypeManagement));
this.manageDistUIState = manageDistUIState;
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
}

View File

@@ -8,9 +8,9 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
@@ -40,11 +40,12 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
DSTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement) {
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement) {
super(permChecker, eventBus, i18n);
this.manageDistUIState = manageDistUIState;
this.createUpdateDistSetTypeLayout = new CreateUpdateDistSetTypeLayout(i18n, tagManagement, entityFactory,
eventBus, permChecker, uiNotification, softwareManagement, distributionSetManagement);
eventBus, permChecker, uiNotification, softwareModuleTypeManagement, distributionSetTypeManagement);
if (hasCreateUpdatePermission()) {
createUpdateDistSetTypeLayout.init();
}

View File

@@ -8,9 +8,9 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
@@ -35,12 +35,13 @@ public class DSTypeFilterLayout extends AbstractFilterLayout {
public DSTypeFilterLayout(final ManageDistUIState manageDistUIState, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion) {
super(new DSTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, tagManagement, entityFactory,
uiNotification, softwareManagement, distributionSetManagement),
uiNotification, softwareModuleTypeManagement, distributionSetTypeManagement),
new DSTypeFilterButtons(eventBus, manageDistUIState, distributionsViewClientCriterion,
distributionSetManagement));
distributionSetTypeManagement));
this.manageDistUIState = manageDistUIState;
restoreState();

View File

@@ -14,7 +14,7 @@ import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -57,7 +57,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
private final ManageDistUIState manageDistUIState;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final transient TargetManagement targetManagement;
@@ -69,7 +69,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final ManagementUIState managementUIState,
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final SoftwareModuleManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final UINotification uiNotification, final TagManagement tagManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout) {
@@ -78,7 +78,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
createSoftwareModuleDetailsTable(i18n, permissionChecker, distributionSetManagement, eventBus,
manageDistUIState, uiNotification));
this.manageDistUIState = manageDistUIState;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.targetManagement = targetManagement;
tfqDetailsTable = new TargetFilterQueryDetailsTable(i18n);
@@ -127,7 +127,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
}
softwareModuleIdNameList.stream().map(SoftwareModuleIdName::getId)
.map(softwareManagement::findSoftwareModuleById)
.map(softwareModuleManagement::findSoftwareModuleById)
.forEach(found -> found.ifPresent(softwareModule -> {
if (assignedSWModule.containsKey(softwareModule.getType().getName())) {

View File

@@ -17,7 +17,7 @@ import java.util.Optional;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdatedEvent;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -83,7 +83,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
private final transient DistributionSetManagement distributionSetManagement;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final DistributionsViewClientCriterion distributionsViewClientCriterion;
@@ -93,14 +93,14 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
DistributionSetTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification,
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final DistributionSetManagement distributionSetManagement, final SoftwareManagement softwareManagement,
final DistributionSetManagement distributionSetManagement, final SoftwareModuleManagement softwareManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final TargetManagement targetManagement, final DsMetadataPopupLayout dsMetadataPopupLayout) {
super(eventBus, i18n, notification);
this.permissionChecker = permissionChecker;
this.manageDistUIState = manageDistUIState;
this.distributionSetManagement = distributionSetManagement;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
this.targetManagement = targetManagement;
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
@@ -259,7 +259,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
final String name = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
final String swVersion = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
final Optional<SoftwareModule> softwareModule = softwareManagement.findSoftwareModuleById(softwareModuleId);
final Optional<SoftwareModule> softwareModule = softwareModuleManagement.findSoftwareModuleById(softwareModuleId);
if (softwareModule.isPresent() && validSoftwareModule((Long) distId, softwareModule.get())) {
final SoftwareModuleIdName softwareModuleIdName = new SoftwareModuleIdName(softwareModuleId,

View File

@@ -9,8 +9,9 @@
package org.eclipse.hawkbit.ui.distributions.dstable;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
@@ -34,9 +35,9 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
public DistributionSetTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final UINotification uiNotification, final TagManagement tagManagement,
final SoftwareModuleManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final UINotification uiNotification, final TagManagement tagManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final SystemManagement systemManagement) {
@@ -48,8 +49,8 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
targetManagement, popupLayout);
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
i18n, uiNotification, eventBus, distributionSetManagement, systemManagement, entityFactory,
distributionSetTable);
i18n, uiNotification, eventBus, distributionSetManagement, distributionSetTypeManagement,
systemManagement, entityFactory, distributionSetTable);
super.init(
new DistributionSetTableHeader(i18n, permissionChecker, eventBus, manageDistUIState,

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.dstable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -23,8 +24,6 @@ import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.data.domain.PageRequest;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.collect.Lists;
/**
* Pop up layout to display distribution metadata.
*/
@@ -36,9 +35,9 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
private final transient EntityFactory entityFactory;
public DsMetadataPopupLayout(final VaadinMessageSource i18n, final UINotification uiNotification, final UIEventBus eventBus,
final DistributionSetManagement distributionSetManagement, final EntityFactory entityFactory,
final SpPermissionChecker permChecker) {
public DsMetadataPopupLayout(final VaadinMessageSource i18n, final UINotification uiNotification,
final UIEventBus eventBus, final DistributionSetManagement distributionSetManagement,
final EntityFactory entityFactory, final SpPermissionChecker permChecker) {
super(i18n, uiNotification, eventBus, permChecker);
this.distributionSetManagement = distributionSetManagement;
this.entityFactory = entityFactory;
@@ -53,7 +52,7 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
protected DistributionSetMetadata createMetadata(final DistributionSet entity, final String key,
final String value) {
final DistributionSetMetadata dsMetaData = distributionSetManagement.createDistributionSetMetadata(
entity.getId(), Lists.newArrayList(entityFactory.generateMetadata(key, value))).get(0);
entity.getId(), Arrays.asList(entityFactory.generateMetadata(key, value))).get(0);
setSelectedEntity(dsMetaData.getDistributionSet());
return dsMetaData;
}

View File

@@ -28,11 +28,10 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Manage Distributions table bean query.
*
@@ -61,7 +60,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(searchText)) {
if (!StringUtils.isEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText);
}
if (queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE) != null) {
@@ -73,7 +72,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
}
}
if (sortStates.length > 0) {
if (sortStates!= null && sortStates.length > 0) {
// Initialize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
@@ -95,7 +94,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
if (startIndex == 0 && firstPageDistributionSets != null) {
distBeans = firstPageDistributionSets;
} else if (Strings.isNullOrEmpty(searchText)) {
} else if (StringUtils.isEmpty(searchText)) {
// if no search filters available
distBeans = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new OffsetBasedPageRequest(startIndex, count, sort), false, dsComplete);
@@ -121,7 +120,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
@Override
public int size() {
if (Strings.isNullOrEmpty(searchText) && null == distributionSetType) {
if (StringUtils.isEmpty(searchText) && null == distributionSetType) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, dsComplete);

View File

@@ -15,7 +15,9 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
@@ -65,14 +67,18 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
final UIEventBus eventBus, final UINotification notification, final SystemManagement systemManagement,
final ManageDistUIState manageDistUIState,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final DistributionSetManagement dsManagement, final SoftwareManagement softwareManagement) {
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(i18n, permChecker, eventBus, notification);
this.systemManagement = systemManagement;
this.manageDistUIState = manageDistUIState;
this.distConfirmationWindowLayout = new DistributionsConfirmationWindowLayout(i18n, eventBus, dsManagement,
softwareManagement, manageDistUIState);
this.distConfirmationWindowLayout = new DistributionsConfirmationWindowLayout(i18n, eventBus,
distributionSetManagement, distributionSetTypeManagement, softwareModuleManagement,
softwareModuleTypeManagement, manageDistUIState);
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
this.distributionSetManagement = dsManagement;
this.distributionSetManagement = distributionSetManagement;
init();
}

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.footer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -16,7 +17,9 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
@@ -39,7 +42,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
@@ -78,18 +80,27 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
private ConfirmationTab assignmnetTab;
private final transient DistributionSetManagement dsManagement;
private final transient DistributionSetManagement distributionSetManagement;
private final transient SoftwareManagement softwareManagement;
private final transient DistributionSetTypeManagement distributionSetTypeManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
private final ManageDistUIState manageDistUIState;
DistributionsConfirmationWindowLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
final DistributionSetManagement dsManagement, final SoftwareManagement softwareManagement,
final DistributionSetManagement dsManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final ManageDistUIState manageDistUIState) {
super(i18n, eventBus);
this.dsManagement = dsManagement;
this.softwareManagement = softwareManagement;
this.distributionSetManagement = dsManagement;
this.distributionSetTypeManagement = distributionSetTypeManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
this.softwareModuleManagement = softwareModuleManagement;
this.manageDistUIState = manageDistUIState;
}
@@ -164,7 +175,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
removeAssignedSoftwareModules();
}
softwareManagement.deleteSoftwareModules(swmoduleIds);
softwareModuleManagement.deleteSoftwareModules(swmoduleIds);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -280,8 +291,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
final int deleteSWModuleTypeCount = manageDistUIState.getSelectedDeleteSWModuleTypes().size();
for (final String swModuleTypeName : manageDistUIState.getSelectedDeleteSWModuleTypes()) {
softwareManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareManagement::deleteSoftwareModuleType);
softwareModuleTypeManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareModuleTypeManagement::deleteSoftwareModuleType);
}
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.sw.module.type.delete", new Object[] { deleteSWModuleTypeCount }));
@@ -372,9 +383,9 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
});
}
dsManagement.deleteDistributionSet(Lists.newArrayList(deletedIds));
distributionSetManagement.deleteDistributionSet(Arrays.asList(deletedIds));
eventBus.publish(this,
new DistributionTableEvent(BaseEntityEventType.REMOVE_ENTITY, Lists.newArrayList(deletedIds)));
new DistributionTableEvent(BaseEntityEventType.REMOVE_ENTITY, Arrays.asList(deletedIds)));
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.dist.deleted", deletedIds.length));
@@ -463,8 +474,9 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
final int deleteDistTypeCount = manageDistUIState.getSelectedDeleteDistSetTypes().size();
manageDistUIState.getSelectedDeleteDistSetTypes().stream()
.map(deleteDistTypeName -> dsManagement.findDistributionSetTypeByName(deleteDistTypeName).get().getId())
.forEach(dsManagement::deleteDistributionSetType);
.map(deleteDistTypeName -> distributionSetTypeManagement
.findDistributionSetTypeByName(deleteDistTypeName).get().getId())
.forEach(distributionSetTypeManagement::deleteDistributionSetType);
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.dist.type.delete", new Object[] { deleteDistTypeCount }));
@@ -586,7 +598,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
manageDistUIState.getAssignedList().forEach((distIdName, softIdNameSet) -> {
final List<Long> softIds = softIdNameSet.stream().map(softIdName -> softIdName.getId())
.collect(Collectors.toList());
dsManagement.assignSoftwareModules(distIdName.getId(), softIds);
distributionSetManagement.assignSoftwareModules(distIdName.getId(), softIds);
});

View File

@@ -12,7 +12,7 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
@@ -32,21 +32,21 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
private static final long serialVersionUID = -1252090014161012563L;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final transient EntityFactory entityFactory;
public SwMetadataPopupLayout(final VaadinMessageSource i18n, final UINotification uiNotification,
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final UIEventBus eventBus, final SoftwareModuleManagement softwareManagement, final EntityFactory entityFactory,
final SpPermissionChecker permChecker) {
super(i18n, uiNotification, eventBus, permChecker);
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.entityFactory = entityFactory;
}
@Override
protected boolean checkForDuplicate(final SoftwareModule entity, final String value) {
return softwareManagement.findSoftwareModuleMetadata(entity.getId(), value).isPresent();
return softwareModuleManagement.findSoftwareModuleMetadata(entity.getId(), value).isPresent();
}
/**
@@ -54,7 +54,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
*/
@Override
protected SoftwareModuleMetadata createMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = softwareManagement.createSoftwareModuleMetadata(entity.getId(),
final SoftwareModuleMetadata swMetadata = softwareModuleManagement.createSoftwareModuleMetadata(entity.getId(),
entityFactory.generateMetadata(key, value));
setSelectedEntity(swMetadata.getSoftwareModule());
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA, swMetadata, entity));
@@ -66,7 +66,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
*/
@Override
protected SoftwareModuleMetadata updateMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = softwareManagement.updateSoftwareModuleMetadata(entity.getId(),
final SoftwareModuleMetadata swMetadata = softwareModuleManagement.updateSoftwareModuleMetadata(entity.getId(),
entityFactory.generateMetadata(key, value));
setSelectedEntity(swMetadata.getSoftwareModule());
return swMetadata;
@@ -74,7 +74,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
@Override
protected List<MetaData> getMetadataList() {
return Collections.unmodifiableList(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(
return Collections.unmodifiableList(softwareModuleManagement.findSoftwareModuleMetadataBySoftwareModuleId(
new PageRequest(0, MAX_METADATA_QUERY), getSelectedEntity().getId()).getContent());
}
@@ -83,7 +83,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
*/
@Override
protected void deleteMetadata(final SoftwareModule entity, final String key, final String value) {
softwareManagement.deleteSoftwareModuleMetadata(entity.getId(), key);
softwareModuleManagement.deleteSoftwareModuleMetadata(entity.getId(), key);
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA,
entityFactory.generateMetadata(key, value), entity));
}

View File

@@ -14,7 +14,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.AssignedSoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
@@ -23,11 +23,10 @@ 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.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Simple implementation of generics bean query which dynamically loads a batch
* of beans.
@@ -35,7 +34,7 @@ import com.google.common.base.Strings;
*/
public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> {
private static final long serialVersionUID = 4362142538539335466L;
private transient SoftwareManagement softwareManagementService;
private transient SoftwareModuleManagement softwareManagementService;
private final Long type;
private final String searchText;
private final Long orderByDistId;
@@ -59,7 +58,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
.map(SoftwareModuleType::getId).orElse(null);
final String text = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(text)) {
if (!StringUtils.isEmpty(text)) {
searchText = String.format("%%%s%%", text);
} else {
searchText = null;
@@ -81,7 +80,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
@Override
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
return getSoftwareManagement()
return getSoftwareModuleManagement()
.findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type)
.getContent().stream().map(SwModuleBeanQuery::getProxyBean).collect(Collectors.toList());
@@ -110,10 +109,10 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
@Override
public int size() {
long size;
if (type == null && Strings.isNullOrEmpty(searchText)) {
size = getSoftwareManagement().countSoftwareModulesAll();
if (type == null && StringUtils.isEmpty(searchText)) {
size = getSoftwareModuleManagement().countSoftwareModulesAll();
} else {
size = getSoftwareManagement().countSoftwareModuleByFilters(searchText, type);
size = getSoftwareModuleManagement().countSoftwareModuleByFilters(searchText, type);
}
if (size > Integer.MAX_VALUE) {
@@ -129,9 +128,9 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
// save of the entity not required from this method
}
private SoftwareManagement getSoftwareManagement() {
private SoftwareModuleManagement getSoftwareModuleManagement() {
if (softwareManagementService == null) {
softwareManagementService = SpringContextHelper.getBean(SoftwareManagement.class);
softwareManagementService = SpringContextHelper.getBean(SoftwareModuleManagement.class);
}
return softwareManagementService;
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.distributions.smtable;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
@@ -32,7 +32,7 @@ public class SwModuleDetails extends AbstractSoftwareModuleDetails {
SwModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker,
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
final ManageDistUIState manageDistUIState, final SoftwareModuleManagement softwareManagement,
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
super(i18n, eventBus, permissionChecker, null, softwareManagement, swMetadataPopupLayout, entityFactory,
softwareModuleAddUpdateWindow);

View File

@@ -14,7 +14,7 @@ import java.util.Optional;
import java.util.Set;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
@@ -71,7 +71,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
private final ManageDistUIState manageDistUIState;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleManagement softwareModuleManagement;
private final DistributionsViewClientCriterion distributionsViewClientCriterion;
@@ -80,13 +80,13 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
private final SwMetadataPopupLayout swMetadataPopupLayout;
SwModuleTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification uiNotification,
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
final ManageDistUIState manageDistUIState, final SoftwareModuleManagement softwareManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final ArtifactManagement artifactManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final ArtifactUploadState artifactUploadState) {
super(eventBus, i18n, uiNotification);
this.manageDistUIState = manageDistUIState;
this.softwareManagement = softwareManagement;
this.softwareModuleManagement = softwareManagement;
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
artifactManagement, softwareManagement);
@@ -252,7 +252,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
@Override
protected Optional<SoftwareModule> findEntityByTableValue(final Long lastSelectedId) {
return softwareManagement.findSoftwareModuleById(lastSelectedId);
return softwareModuleManagement.findSoftwareModuleById(lastSelectedId);
}
@Override
@@ -414,7 +414,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
}
private void showMetadataDetails(final Long itemId) {
softwareManagement.findSoftwareModuleById(itemId)
softwareModuleManagement.findSoftwareModuleById(itemId)
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
}

View File

@@ -10,7 +10,8 @@ package org.eclipse.hawkbit.ui.distributions.smtable;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -31,23 +32,25 @@ public class SwModuleTableLayout extends AbstractTableLayout<SwModuleTable> {
private final SwModuleTable swModuleTable;
public SwModuleTableLayout(final VaadinMessageSource i18n, final UINotification uiNotification,
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final UIEventBus eventBus, final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement, final EntityFactory entityFactory,
final ManageDistUIState manageDistUIState, final SpPermissionChecker permChecker,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final ArtifactUploadState artifactUploadState, final ArtifactManagement artifactManagement) {
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
softwareManagement, entityFactory, permChecker);
softwareModuleManagement, entityFactory, permChecker);
this.swModuleTable = new SwModuleTable(eventBus, i18n, uiNotification, manageDistUIState, softwareManagement,
this.swModuleTable = new SwModuleTable(eventBus, i18n, uiNotification, manageDistUIState, softwareModuleManagement,
distributionsViewClientCriterion, artifactManagement, swMetadataPopupLayout, artifactUploadState);
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
uiNotification, eventBus, softwareManagement, entityFactory, swModuleTable);
uiNotification, eventBus, softwareModuleManagement, softwareModuleTypeManagement, entityFactory,
swModuleTable);
super.init(
new SwModuleTableHeader(i18n, permChecker, eventBus, manageDistUIState, softwareModuleAddUpdateWindow),
swModuleTable, new SwModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
manageDistUIState, softwareManagement, swMetadataPopupLayout, entityFactory));
manageDistUIState, softwareModuleManagement, swMetadataPopupLayout, entityFactory));
}
public SwModuleTable getSwModuleTable() {

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.smtype;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
@@ -28,13 +28,13 @@ public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick
private final ManageDistUIState manageDistUIState;
private final transient SoftwareManagement softwareManagement;
private final transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
DistSMTypeFilterButtonClick(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final SoftwareManagement softwareManagement) {
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
this.eventBus = eventBus;
this.manageDistUIState = manageDistUIState;
this.softwareManagement = softwareManagement;
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
}
@Override
@@ -45,10 +45,11 @@ public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick
@Override
protected void filterClicked(final Button clickedButton) {
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString()).ifPresent(smType -> {
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
});
softwareModuleTypeManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
.ifPresent(smType -> {
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
});
}
}

View File

@@ -15,7 +15,7 @@ import static org.eclipse.hawkbit.ui.utils.UIComponentIdProvider.SW_MODULE_TYPE_
import java.util.Collections;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
@@ -48,8 +48,8 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
DistSMTypeFilterButtons(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final SoftwareManagement softwareManagement) {
super(eventBus, new DistSMTypeFilterButtonClick(eventBus, manageDistUIState, softwareManagement));
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(eventBus, new DistSMTypeFilterButtonClick(eventBus, manageDistUIState, softwareModuleTypeManagement));
this.manageDistUIState = manageDistUIState;
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.distributions.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.smtype.CreateUpdateSoftwareTypeLayout;
@@ -36,14 +36,14 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
private final ManageDistUIState manageDistUIState;
private final CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
DistSMTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
DistSMTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final UIEventBus eventBus, final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement swTypeManagementService) {
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(permChecker, eventBus, i18n);
this.manageDistUIState = manageDistUIState;
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, tagManagement, entityFactory, eventBus,
permChecker, uiNotification, swTypeManagementService);
permChecker, uiNotification, softwareModuleTypeManagement);
if (hasCreateUpdatePermission()) {
createUpdateSWTypeLayout.init();

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.distributions.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
@@ -31,15 +31,15 @@ public class DistSMTypeFilterLayout extends AbstractFilterLayout {
private final ManageDistUIState manageDistUIState;
public DistSMTypeFilterLayout(final UIEventBus eventBus, final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement,
public DistSMTypeFilterLayout(final UIEventBus eventBus, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final ManageDistUIState manageDistUIState,
final TagManagement tagManagement, final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion) {
super(new DistSMTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, tagManagement, entityFactory,
uiNotification, softwareManagement),
uiNotification, softwareModuleTypeManagement),
new DistSMTypeFilterButtons(eventBus, manageDistUIState, distributionsViewClientCriterion,
softwareManagement));
softwareModuleTypeManagement));
this.manageDistUIState = manageDistUIState;
restoreState();

View File

@@ -27,12 +27,12 @@ import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.base.Strings;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
@@ -211,7 +211,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private void createListeners() {
nameTextFieldBlusListner = event -> {
if (!Strings.isNullOrEmpty(nameTextField.getValue())) {
if (!StringUtils.isEmpty(nameTextField.getValue())) {
captionLayout.removeComponent(nameTextField);
captionLayout.addComponent(nameLabel);
}
@@ -307,7 +307,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
private static boolean isNameAndQueryEmpty(final String name, final String query) {
return Strings.isNullOrEmpty(name) && Strings.isNullOrEmpty(query);
return StringUtils.isEmpty(name) && StringUtils.isEmpty(query);
}
private SPUIButton createSearchResetIcon() {
@@ -401,15 +401,16 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private boolean doesAlreadyExists() {
if (targetFilterQueryManagement.findTargetFilterQueryByName(nameTextField.getValue()).isPresent()) {
notification.displayValidationError(i18n.getMessage("message.target.filter.duplicate", nameTextField.getValue()));
notification.displayValidationError(
i18n.getMessage("message.target.filter.duplicate", nameTextField.getValue()));
return true;
}
return false;
}
private boolean manadatoryFieldsPresent() {
if (Strings.isNullOrEmpty(nameTextField.getValue())
|| Strings.isNullOrEmpty(filterManagementUIState.getFilterQueryValue())) {
if (StringUtils.isEmpty(nameTextField.getValue())
|| StringUtils.isEmpty(filterManagementUIState.getFilterQueryValue())) {
notification.displayValidationError(i18n.getMessage("message.target.filter.validation"));
return false;
}

View File

@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
@@ -33,7 +34,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.vaadin.data.Item;
@@ -130,7 +130,7 @@ public class CreateOrUpdateFilterTable extends Table {
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = Maps.newHashMapWithExpectedSize(2);
if (!Strings.isNullOrEmpty(filterManagementUIState.getFilterQueryValue())) {
if (!StringUtils.isEmpty(filterManagementUIState.getFilterQueryValue())) {
queryConfig.put(SPUIDefinitions.FILTER_BY_QUERY, filterManagementUIState.getFilterQueryValue());
}
queryConfig.put(SPUIDefinitions.FILTER_BY_INVALID_QUERY,
@@ -182,10 +182,12 @@ public class CreateOrUpdateFilterTable extends Table {
final List<TableColumn> columnList = Lists.newArrayListWithExpectedSize(7);
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.getMessage("header.name"), 0.15F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.getMessage("header.createdBy"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.getMessage("header.createdDate"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.getMessage("header.modifiedBy"), 0.1F));
columnList.add(
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.getMessage("header.modifiedDate"), 0.1F));
new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.getMessage("header.createdDate"), 0.1F));
columnList.add(
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.getMessage("header.modifiedBy"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE,
i18n.getMessage("header.modifiedDate"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.getMessage("header.description"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.getMessage("header.status"), 0.1F));

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.filtermanagement;
import static org.apache.commons.lang3.ArrayUtils.isEmpty;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.isNotNullOrEmpty;
import static org.eclipse.hawkbit.ui.utils.SPUIDefinitions.FILTER_BY_QUERY;
import static org.springframework.data.domain.Sort.Direction.ASC;
@@ -32,11 +31,10 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Simple implementation of generics bean query which dynamically loads
* {@link ProxyTarget} batch of beans.
@@ -71,7 +69,7 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
filterQuery = (String) queryConfig.get(FILTER_BY_QUERY);
}
if (!isEmpty(sortStates)) {
if (sortStates != null && sortStates.length > 0) {
sort = new Sort(sortStates[0] ? ASC : DESC, (String) sortIds[0]);
@@ -90,7 +88,7 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
protected List<ProxyTarget> loadBeans(final int startIndex, final int count) {
Slice<Target> targetBeans;
final List<ProxyTarget> proxyTargetBeans = new ArrayList<>();
if (!Strings.isNullOrEmpty(filterQuery)) {
if (!StringUtils.isEmpty(filterQuery)) {
targetBeans = targetManagement.findTargetsAll(filterQuery,
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
} else {
@@ -130,7 +128,7 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
@Override
public int size() {
long size = 0;
if (!Strings.isNullOrEmpty(filterQuery)) {
if (!StringUtils.isEmpty(filterQuery)) {
size = getTargetManagement().countTargetByTargetFilterQuery(filterQuery);
}
getFilterManagementUIState().setTargetsCountAll(size);

View File

@@ -27,11 +27,10 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
*
*
@@ -57,11 +56,12 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
super(definition, queryConfig, sortPropertyIds, sortStates);
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(searchText)) {
if (!StringUtils.isEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText);
}
}
if (sortStates.length > 0) {
if (sortStates!= null && sortStates.length > 0) {
// Initalize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
@@ -82,7 +82,7 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
final List<ProxyTargetFilter> proxyTargetFilter = new ArrayList<>();
if (startIndex == 0 && firstPageTargetFilter != null) {
targetFilterQuery = firstPageTargetFilter;
} else if (Strings.isNullOrEmpty(searchText)) {
} else if (StringUtils.isEmpty(searchText)) {
// if no search filters available
targetFilterQuery = getTargetFilterQueryManagement().findAllTargetFilterQuery(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
@@ -119,7 +119,7 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
@Override
public int size() {
if (Strings.isNullOrEmpty(searchText)) {
if (StringUtils.isEmpty(searchText)) {
firstPageTargetFilter = getTargetFilterQueryManagement()
.findAllTargetFilterQuery(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
} else {

View File

@@ -15,6 +15,7 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
@@ -120,7 +121,8 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
final UINotification uiNotification, final ManagementUIState managementUIState,
final DeploymentManagement deploymentManagement, final UIEventBus eventBus,
final DistributionTableFilters distFilterParameters,
final DistributionSetManagement distributionSetManagement, final TargetManagement targetManagement,
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final UiProperties uiproperties,
final ManagementViewClientCriterion managementViewClientCriterion, final TagManagement tagManagement,
final TargetFilterQueryManagement targetFilterQueryManagement, final SystemManagement systemManagement,
@@ -152,8 +154,8 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
tagManagement, entityFactory, uiNotification, distFilterParameters, distributionSetManagement,
managementViewClientCriterion);
this.distributionTableLayout = new DistributionTableLayout(i18n, eventBus, permChecker, managementUIState,
distributionSetManagement, managementViewClientCriterion, entityFactory, uiNotification, tagManagement,
systemManagement, targetManagement, deploymentManagement);
distributionSetManagement, distributionSetTypeManagement, managementViewClientCriterion, entityFactory,
uiNotification, tagManagement, systemManagement, targetManagement, deploymentManagement);
this.deleteAndActionsLayout = new DeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
tagManagement, managementViewClientCriterion, managementUIState, targetManagement, targetTable,
deploymentManagement, distributionSetManagement);

View File

@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.ui.management.actionhistory.ProxyAction.IsActiveDecoration;
@@ -61,7 +60,7 @@ public class ActionBeanQuery extends AbstractBeanQuery<ProxyAction> {
currentSelectedConrollerId = (String) queryConfig.get(SPUIDefinitions.ACTIONS_BY_TARGET);
}
if (ArrayUtils.isEmpty(sortStates)) {
if (sortStates == null || sortStates.length <= 0) {
return;
}

View File

@@ -58,7 +58,7 @@ public class ActionStatusBeanQuery extends AbstractBeanQuery<ProxyActionStatus>
currentSelectedActionId = (Long) queryConfig.get(SPUIDefinitions.ACTIONSTATES_BY_ACTION);
}
if (sortStates.length > 0) {
if (sortStates!= null && sortStates.length > 0) {
// Initialize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort

View File

@@ -22,11 +22,10 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Simple implementation of generic bean query which dynamically loads
* {@link ProxyMessage} batch of beans.
@@ -62,7 +61,7 @@ public class ActionStatusMsgBeanQuery extends AbstractBeanQuery<ProxyMessage> {
noMessageText = (String) queryConfig.get(SPUIDefinitions.NO_MSG_PROXY);
}
if (sortStates.length > 0) {
if (sortStates != null && sortStates.length > 0) {
// Initialize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
@@ -111,23 +110,16 @@ public class ActionStatusMsgBeanQuery extends AbstractBeanQuery<ProxyMessage> {
proxyMsgs.add(proxyMsg);
}
if (messages.getTotalElements() == 1L && Strings.isNullOrEmpty(proxyMsgs.get(0).getMessage())) {
if (messages.getTotalElements() == 1L && StringUtils.isEmpty(proxyMsgs.get(0).getMessage())) {
proxyMsgs.get(0).setMessage(noMessageText);
}
return proxyMsgs;
}
/*
* (non-Javadoc)
*
* @see
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
* .util.List, java.util.List, java.util.List)
*/
@Override
protected void saveBeans(List<ProxyMessage> addedBeans, List<ProxyMessage> modifiedBeans,
List<ProxyMessage> removedBeans) {
protected void saveBeans(final List<ProxyMessage> addedBeans, final List<ProxyMessage> modifiedBeans,
final List<ProxyMessage> removedBeans) {
// CRUD operations on Target will be done through repository methods
}

View File

@@ -12,6 +12,7 @@ import java.util.Collections;
import java.util.Optional;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
@@ -61,6 +62,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
private final UINotification notificationMessage;
private final transient EventBus.UIEventBus eventBus;
private final transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetTypeManagement distributionSetTypeManagement;
private final transient SystemManagement systemManagement;
private final transient EntityFactory entityFactory;
@@ -87,6 +89,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
* UIEventBus
* @param distributionSetManagement
* DistributionSetManagement
* @param distributionSetTypeManagement
* distributionSetTypeManagement
* @param systemManagement
* SystemManagement
* @param entityFactory
@@ -96,12 +100,13 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
*/
public DistributionAddUpdateWindowLayout(final VaadinMessageSource i18n, final UINotification notificationMessage,
final UIEventBus eventBus, final DistributionSetManagement distributionSetManagement,
final SystemManagement systemManagement, final EntityFactory entityFactory,
final DistributionSetTable distributionSetTable) {
final DistributionSetTypeManagement distributionSetTypeManagement, final SystemManagement systemManagement,
final EntityFactory entityFactory, final DistributionSetTable distributionSetTable) {
this.i18n = i18n;
this.notificationMessage = notificationMessage;
this.eventBus = eventBus;
this.distributionSetManagement = distributionSetManagement;
this.distributionSetTypeManagement = distributionSetTypeManagement;
this.systemManagement = systemManagement;
this.entityFactory = entityFactory;
this.distributionSetTable = distributionSetTable;
@@ -136,7 +141,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
distributionSetManagement.findDistributionSetTypeById(distSetTypeId).ifPresent(type -> {
distributionSetTypeManagement.findDistributionSetTypeById(distSetTypeId).ifPresent(type -> {
final DistributionSet currentDS = distributionSetManagement.updateDistributionSet(
entityFactory.distributionSet().update(editDistId).name(distNameTextField.getValue())
.description(descTextArea.getValue()).version(distVersionTextField.getValue())
@@ -160,7 +165,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
final DistributionSetType distributionSetType = distributionSetManagement
final DistributionSetType distributionSetType = distributionSetTypeManagement
.findDistributionSetTypeById(distSetTypeId)
.orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, distSetTypeId));
final DistributionSet newDist = distributionSetManagement

View File

@@ -29,11 +29,10 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Simple implementation of generics bean query which dynamically loads a batch
* of beans.
@@ -71,12 +70,12 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
noTagClicked = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_NO_TAG);
pinnedTarget = (TargetIdName) queryConfig.get(SPUIDefinitions.ORDER_BY_PINNED_TARGET);
if (!Strings.isNullOrEmpty(searchText)) {
if (!StringUtils.isEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText);
}
}
if (sortStates.length > 0) {
if (sortStates!= null && sortStates.length > 0) {
// Initalize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
@@ -109,7 +108,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
distBeans = getDistributionSetManagement().findDistributionSetsAllOrderedByLinkTarget(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && Strings.isNullOrEmpty(searchText) && !noTagClicked) {
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
distBeans = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new OffsetBasedPageRequest(startIndex, count, sort), false, true);
@@ -150,7 +149,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsAllOrderedByLinkTarget(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && Strings.isNullOrEmpty(searchText) && !noTagClicked) {
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, true);

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.management.dstable;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
@@ -35,13 +36,15 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
public DistributionTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final ManagementViewClientCriterion managementViewClientCriterion, final EntityFactory entityFactory,
final UINotification notification, final TagManagement tagManagement,
final SystemManagement systemManagement, final TargetManagement targetManagement,
final DeploymentManagement deploymentManagement) {
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
i18n, notification, eventBus, distributionSetManagement, systemManagement, entityFactory, null);
i18n, notification, eventBus, distributionSetManagement, distributionSetTypeManagement,
systemManagement, entityFactory, null);
final DsMetadataPopupLayout dsMetadataPopupLayout = new DsMetadataPopupLayout(i18n, notification, eventBus,
distributionSetManagement, entityFactory, permissionChecker);

View File

@@ -8,8 +8,6 @@
*/
package org.eclipse.hawkbit.ui.management.dstag;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.List;
import java.util.Optional;
@@ -30,6 +28,7 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.ui.UI;
@@ -90,10 +89,10 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
super.createNewTag();
final String tagNameValueTrimmed = HawkbitCommonUtil.trimAndNullIfEmpty(tagNameValue);
final String tagDescriptionTrimmed = HawkbitCommonUtil.trimAndNullIfEmpty(tagDescValue);
if (isNotEmpty(tagNameValueTrimmed)) {
if (!StringUtils.isEmpty(tagNameValueTrimmed)) {
String colour = ColorPickerConstants.START_COLOR.getCSS();
if (isNotEmpty(getColorPicked())) {
if (!StringUtils.isEmpty(getColorPicked())) {
colour = getColorPicked();
}

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.management.footer;
import java.util.List;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
@@ -26,6 +25,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -63,8 +63,8 @@ public class CountMessageLabel extends Label {
* @param targetTable
* TargetTable
*/
public CountMessageLabel(final UIEventBus eventBus, final TargetManagement targetManagement, final VaadinMessageSource i18n,
final ManagementUIState managementUIState, final TargetTable targetTable) {
public CountMessageLabel(final UIEventBus eventBus, final TargetManagement targetManagement,
final VaadinMessageSource i18n, final ManagementUIState managementUIState, final TargetTable targetTable) {
this.targetManagement = targetManagement;
this.i18n = i18n;
this.managementUIState = managementUIState;
@@ -143,14 +143,14 @@ public class CountMessageLabel extends Label {
final String dists = i18n.getMessage("label.filter.dist");
final String custom = i18n.getMessage("label.filter.custom");
final StringBuilder filterMesgBuf = new StringBuilder(i18n.getMessage("label.filter"));
filterMesgBuf.append(StringUtils.SPACE);
filterMesgBuf.append(" ");
filterMesgBuf.append(getStatusMsg(targFilParams.getClickedStatusTargetTags(), status));
filterMesgBuf.append(getOverdueStateMsg(targFilParams.isOverdueFilterEnabled(), overdue));
filterMesgBuf
.append(getTagsMsg(targFilParams.isNoTagSelected(), targFilParams.getClickedTargetTags(), tags));
filterMesgBuf.append(targFilParams.getSearchText().map(search -> text).orElse(StringUtils.SPACE));
filterMesgBuf.append(targFilParams.getDistributionSet().map(set -> dists).orElse(StringUtils.SPACE));
filterMesgBuf.append(targFilParams.getTargetFilterQuery().map(query -> custom).orElse(StringUtils.SPACE));
filterMesgBuf.append(targFilParams.getSearchText().map(search -> text).orElse(" "));
filterMesgBuf.append(targFilParams.getDistributionSet().map(set -> dists).orElse(" "));
filterMesgBuf.append(targFilParams.getTargetFilterQuery().map(query -> custom).orElse(" "));
final String filterMesageChk = filterMesgBuf.toString().trim();
String filterMesage = filterMesageChk;
if (filterMesage.endsWith(",")) {
@@ -212,7 +212,7 @@ public class CountMessageLabel extends Label {
* @return String as msg.
*/
private static String getStatusMsg(final List<TargetUpdateStatus> status, final String param) {
return status.isEmpty() ? StringUtils.SPACE : param;
return status.isEmpty() ? " " : param;
}
/**
@@ -223,7 +223,7 @@ public class CountMessageLabel extends Label {
* @return String as msg.
*/
private static String getOverdueStateMsg(final boolean overdueState, final String param) {
return !overdueState ? StringUtils.SPACE : param;
return !overdueState ? " " : param;
}
/**
@@ -236,6 +236,6 @@ public class CountMessageLabel extends Label {
*/
private static String getTagsMsg(final Boolean noTargetTagSelected, final List<String> tags, final String param) {
return tags.isEmpty() && (noTargetTagSelected == null || !noTargetTagSelected.booleanValue())
? StringUtils.SPACE : param;
? " " : param;
}
}

View File

@@ -13,7 +13,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.FilterParams;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
@@ -33,11 +32,10 @@ import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
* Simple implementation of generics bean query which dynamically loads a batch
* of beans.
@@ -85,13 +83,13 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
distributionId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION);
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
targetFilterQueryId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_TARGET_FILTER_QUERY);
if (!Strings.isNullOrEmpty(searchText)) {
if (!StringUtils.isEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText);
}
pinnedDistId = (Long) queryConfig.get(SPUIDefinitions.ORDER_BY_DISTRIBUTION);
}
if (!ArrayUtils.isEmpty(sortStates)) {
if (sortStates != null && sortStates.length > 0) {
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
@@ -204,7 +202,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
private boolean isAnyFilterSelected() {
final boolean isFilterSelected = isTagSelected() || isOverdueFilterEnabled();
return isFilterSelected || !CollectionUtils.isEmpty(status) || distributionId != null
|| !Strings.isNullOrEmpty(searchText);
|| !StringUtils.isEmpty(searchText);
}
private TargetManagement getTargetManagement() {

View File

@@ -62,6 +62,7 @@ import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
@@ -69,7 +70,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.vaadin.data.Container;
@@ -826,7 +826,7 @@ public class TargetTable extends AbstractTable<Target> {
.map(DistributionSetIdName::getId).orElse(null);
final Long pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().orElse(null);
final String searchText = managementUIState.getTargetTableFilters().getSearchText().map(text -> {
if (Strings.isNullOrEmpty(text)) {
if (StringUtils.isEmpty(text)) {
return null;
}
return String.format("%%%s%%", text);
@@ -877,7 +877,7 @@ public class TargetTable extends AbstractTable<Target> {
private static boolean noFilterSelected(final Collection<TargetUpdateStatus> status, final Long distributionId,
final Boolean noTagClicked, final String[] targetTags, final String searchText) {
return CollectionUtils.isEmpty(status) && distributionId == null && Strings.isNullOrEmpty(searchText)
return CollectionUtils.isEmpty(status) && distributionId == null && StringUtils.isEmpty(searchText)
&& !isTagSelected(targetTags, noTagClicked);
}

View File

@@ -8,8 +8,6 @@
*/
package org.eclipse.hawkbit.ui.management.targettag;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.Optional;
import org.eclipse.hawkbit.repository.EntityFactory;
@@ -26,6 +24,7 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus.UIEventBus;
/**
@@ -119,9 +118,9 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
super.createNewTag();
final String tagNameTrimmed = HawkbitCommonUtil.trimAndNullIfEmpty(tagNameValue);
final String tagDescriptionTrimmed = HawkbitCommonUtil.trimAndNullIfEmpty(tagDescValue);
if (isNotEmpty(tagNameTrimmed)) {
if (!StringUtils.isEmpty(tagNameTrimmed)) {
String colour = ColorPickerConstants.START_COLOR.getCSS();
if (isNotEmpty(getColorPicked())) {
if (!StringUtils.isEmpty(getColorPicked())) {
colour = getColorPicked();
}

View File

@@ -18,7 +18,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import org.eclipse.hawkbit.HawkbitServerProperties;
import org.eclipse.hawkbit.im.authentication.PermissionService;
import org.eclipse.hawkbit.ui.UiProperties;

View File

@@ -64,13 +64,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.base.Strings;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
@@ -712,7 +712,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private void onTargetFilterChange(final ValueChangeEvent event) {
final String filterQueryString = getTargetFilterQuery();
if (Strings.isNullOrEmpty(filterQueryString)) {
if (StringUtils.isEmpty(filterQueryString)) {
totalTargetsCount = 0L;
groupsLegendLayout.populateTotalTargets(null);
defineGroupsLayout.setTargetFilter(null);

View File

@@ -13,7 +13,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.QuotaManagement;
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
@@ -39,6 +38,7 @@ import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
import org.springframework.util.concurrent.ListenableFuture;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -580,7 +580,7 @@ public class DefineGroupsLayout extends GridLayout {
final RolloutGroupConditionBuilder conditionBuilder = new RolloutGroupConditionBuilder()
.successAction(RolloutGroup.RolloutGroupSuccessAction.NEXTGROUP, null)
.successCondition(RolloutGroup.RolloutGroupSuccessCondition.THRESHOLD, triggerThreshold.getValue());
if (StringUtils.isNotEmpty(errorThreshold.getValue())) {
if (!StringUtils.isEmpty(errorThreshold.getValue())) {
conditionBuilder
.errorCondition(RolloutGroup.RolloutGroupErrorCondition.THRESHOLD, errorThreshold.getValue())
.errorAction(RolloutGroup.RolloutGroupErrorAction.PAUSE, null);
@@ -618,7 +618,7 @@ public class DefineGroupsLayout extends GridLayout {
* @return whether the data entered in this row is valid
*/
public boolean isValid() {
return StringUtils.isNotEmpty(groupName.getValue()) && targetPercentage.isValid()
return !StringUtils.isEmpty(groupName.getValue()) && targetPercentage.isValid()
&& triggerThreshold.isValid() && errorThreshold.isValid();
}

View File

@@ -8,8 +8,6 @@
*/
package org.eclipse.hawkbit.ui.rollout.rollout;
import static org.apache.commons.lang3.ArrayUtils.isEmpty;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -29,11 +27,10 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
*
* Simple implementation of generics bean query which dynamically loads a batch
@@ -70,7 +67,7 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
searchText = getSearchText();
if (!isEmpty(sortStates)) {
if (sortStates != null && sortStates.length > 0) {
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
@@ -94,7 +91,7 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
final Slice<Rollout> rolloutBeans;
final PageRequest pageRequest = new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE,
SPUIDefinitions.PAGE_SIZE, sort);
if (Strings.isNullOrEmpty(searchText)) {
if (StringUtils.isEmpty(searchText)) {
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(pageRequest, false);
} else {
rolloutBeans = getRolloutManagement().findRolloutWithDetailedStatusByFilters(pageRequest, searchText,
@@ -141,7 +138,7 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
@Override
public int size() {
int size = getRolloutManagement().countRolloutsAll().intValue();
if (!Strings.isNullOrEmpty(searchText)) {
if (!StringUtils.isEmpty(searchText)) {
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
}
return size;

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
import static org.apache.commons.lang3.ArrayUtils.isEmpty;
import static org.springframework.data.domain.Sort.Direction.ASC;
import static org.springframework.data.domain.Sort.Direction.DESC;
@@ -79,7 +78,7 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
rolloutId = getRolloutId();
if (!isEmpty(sortStates)) {
if (sortStates != null && sortStates.length > 0) {
sort = new Sort(sortStates[0] ? ASC : DESC, (String) sortPropertyIds[0]);

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.tenantconfiguration;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.TenantMetaData;
@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Alignment;
@@ -47,7 +46,7 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView {
private final Label changeIcon;
DefaultDistributionSetTypeLayout(final SystemManagement systemManagement,
final DistributionSetManagement distributionSetManagement, final VaadinMessageSource i18n,
final DistributionSetTypeManagement distributionSetTypeManagement, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker) {
this.systemManagement = systemManagement;
combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
@@ -75,13 +74,13 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView {
hlayout.setSpacing(true);
hlayout.setStyleName("config-h-panel");
final Label configurationLabel = new Label(i18n.getMessage("configuration.defaultdistributionset.select.label"));
final Label configurationLabel = new Label(
i18n.getMessage("configuration.defaultdistributionset.select.label"));
hlayout.addComponent(configurationLabel);
hlayout.setComponentAlignment(configurationLabel, Alignment.MIDDLE_LEFT);
final Pageable pageReq = new PageRequest(0, 100);
final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetManagement
.findDistributionSetTypesAll(pageReq);
final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
.findDistributionSetTypesAll(new PageRequest(0, 100));
combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
combobox.setNullSelectionAllowed(false);

View File

@@ -15,7 +15,7 @@ import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ControllerPollProperties;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
@@ -77,12 +77,12 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
@Autowired
TenantConfigurationDashboardView(final VaadinMessageSource i18n, final UiProperties uiProperties,
final UINotification uINotification, final SystemManagement systemManagement,
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final TenantConfigurationManagement tenantConfigurationManagement,
final SecurityTokenGenerator securityTokenGenerator,
final ControllerPollProperties controllerPollProperties, final SpPermissionChecker permChecker) {
this.defaultDistributionSetTypeLayout = new DefaultDistributionSetTypeLayout(systemManagement,
distributionSetManagement, i18n, permChecker);
distributionSetTypeManagement, i18n, permChecker);
this.authenticationConfigurationView = new AuthenticationConfigurationView(i18n, tenantConfigurationManagement,
securityTokenGenerator);
this.pollingConfigurationView = new PollingConfigurationView(i18n, controllerPollProperties,

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;

View File

@@ -19,12 +19,12 @@ import org.eclipse.hawkbit.repository.model.PollStatus;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import com.google.common.base.Strings;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.shared.ui.label.ContentMode;
@@ -511,10 +511,10 @@ public final class HawkbitCommonUtil {
*/
public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
final StringBuilder val = new StringBuilder();
if (!Strings.isNullOrEmpty(value)) {
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(",");
}
if (!Strings.isNullOrEmpty(style)) {
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(",");
}
return val.append("id:").append(id).toString();

View File

@@ -145,9 +145,9 @@
.valo-menu-item-selected {
border: 0 solid white;
border-bottom: 5px solid transparent;
border-image: url("images/lightCorner_top.png") 30 30 stretch;
o-border-image: url("images/lightCorner_top.png") 30 30 stretch;
webkit-border-image: url("images/lightCorner_top.png") 30 30 stretch;
border-image: url("../images/lightCorner_top.png") 30 30 stretch;
o-border-image: url("../images/lightCorner_top.png") 30 30 stretch;
webkit-border-image: url("../images/lightCorner_top.png") 30 30 stretch;
}
.v-csslayout-valo-menu-item {
border: 0 solid white;