Spring Boot 2.0 (#721)

* Migration to Boot 2.0.

Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
This commit is contained in:
Kai Zimmermann
2019-01-31 07:29:27 +01:00
committed by GitHub
parent b42b009f9e
commit d52a720480
263 changed files with 2874 additions and 2692 deletions

View File

@@ -10,8 +10,8 @@ package org.eclipse.hawkbit.ui;
import org.atmosphere.container.JSR356AsyncSupport;
import org.atmosphere.cpr.ApplicationConfig;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

View File

@@ -57,17 +57,16 @@ public class ErrorView extends VerticalLayout implements View {
public void enter(final ViewChangeListener.ViewChangeEvent event) {
final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName());
if (view == null) {
message.setValue(i18n.getMessage("message.error.view", new Object[] { event.getViewName() }));
message.setValue(i18n.getMessage("message.error.view", event.getViewName()));
return;
}
if (dashboardMenu.isAccessDenied(event.getViewName())) {
final Notification nt = new Notification("Access denied",
i18n.getMessage("message.accessdenied.view", new Object[] { event.getViewName() }),
Type.ERROR_MESSAGE, false);
i18n.getMessage("message.accessdenied.view", event.getViewName()), Type.ERROR_MESSAGE, false);
nt.setStyleName(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE);
nt.setPosition(Position.BOTTOM_RIGHT);
nt.show(UI.getCurrent().getPage());
message.setValue(i18n.getMessage("message.accessdenied.view", new Object[] { event.getViewName() }));
message.setValue(i18n.getMessage("message.accessdenied.view", event.getViewName()));
}
}

View File

@@ -95,7 +95,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<Artifact> {
long size = 0;
if (baseSwModuleId != null) {
firstPagetArtifacts = getArtifactManagement()
.findBySoftwareModule(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), baseSwModuleId);
.findBySoftwareModule(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), baseSwModuleId);
size = firstPagetArtifacts.getTotalElements();
}
if (size > Integer.MAX_VALUE) {

View File

@@ -155,6 +155,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private Optional<SoftwareModule> findSelectedSoftwareModule() {
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
if (selectedBaseSwModuleId.isPresent()) {
return softwareModuleManagement.get(selectedBaseSwModuleId.get());
}
@@ -281,9 +282,8 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private void confirmAndDeleteArtifact(final Long id, final String fileName) {
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.getMessage("caption.delete.artifact.confirmbox"),
i18n.getMessage("message.delete.artifact", new Object[] { fileName }),
i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL),
ok -> {
i18n.getMessage("message.delete.artifact", fileName), i18n.getMessage(UIMessageIdProvider.BUTTON_OK),
i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), ok -> {
if (ok) {
artifactManagement.delete(id);
uINotification.displaySuccess(i18n.getMessage("message.artifact.deleted", fileName));

View File

@@ -150,7 +150,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
final SoftwareModule newSoftwareModule = softwareModuleManagement.create(softwareModule);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion()));
softwareModuleTable.setValue(Sets.newHashSet(newSoftwareModule.getId()));
}
@@ -163,8 +163,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
.map(SoftwareModuleType::getId);
if (moduleType.isPresent() && softwareModuleManagement
.getByNameAndVersionAndType(name, version, moduleType.get()).isPresent()) {
uiNotifcation.displayValidationError(
i18n.getMessage("message.duplicate.softwaremodule", new Object[] { name, version }));
uiNotifcation
.displayValidationError(i18n.getMessage("message.duplicate.softwaremodule", name, version));
return true;
}
return false;
@@ -178,11 +178,12 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
.update(baseSwModuleId).description(descTextArea.getValue()).vendor(vendorTextField.getValue()));
if (newSWModule != null) {
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
new Object[] { newSWModule.getName() + ":" + newSWModule.getVersion() }));
newSWModule.getName() + ":" + newSWModule.getVersion()));
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.UPDATED_ENTITY, newSWModule));
}
}
}
/**
@@ -281,9 +282,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
setCompositionRoot(formLayout);
final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
.caption(i18n.getMessage("caption.create.new", i18n.getMessage("caption.software.module"))).id(UIComponentIdProvider.SW_MODULE_CREATE_DIALOG)
.content(this).layout(formLayout).i18n(i18n).saveDialogCloseListener(new SaveOnDialogCloseListener())
.buildCommonDialogWindow();
.caption(i18n.getMessage("caption.create.new", i18n.getMessage("caption.software.module")))
.id(UIComponentIdProvider.SW_MODULE_CREATE_DIALOG).content(this).layout(formLayout).i18n(i18n)
.saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
nameTextField.setEnabled(!editSwModule);
versionTextField.setEnabled(!editSwModule);

View File

@@ -46,11 +46,10 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick {
@Override
protected void filterClicked(final Button clickedButton) {
softwareModuleTypeManagement.getByName(clickedButton.getData().toString())
.ifPresent(softwareModuleType -> {
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
});
softwareModuleTypeManagement.getByName(clickedButton.getData().toString()).ifPresent(softwareModuleType -> {
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
});
}
}

View File

@@ -237,7 +237,7 @@ public class ArtifactUploadState implements ManagementEntityState, Serializable
if (!StringUtils.isBlank(fileUploadProgress.getFilePath())) {
final boolean deleted = FileUtils.deleteQuietly(new File(fileUploadProgress.getFilePath()));
if (!deleted) {
LOG.warn("TempFile was not deleted: " + fileUploadProgress.getFilePath());
LOG.warn("TempFile was not deleted: {}", fileUploadProgress.getFilePath());
}
}
}

View File

@@ -93,9 +93,8 @@ public abstract class AbstractFileTransferHandler implements Serializable {
protected void startTransferToRepositoryThread(final InputStream inputStream, final FileUploadId fileUploadId,
final String mimeType) {
SpringContextHelper.getBean("asyncExecutor", ExecutorService.class)
.execute(
new TransferArtifactToRepositoryRunnable(inputStream, fileUploadId, mimeType, UI.getCurrent()));
SpringContextHelper.getBean("asyncExecutor", ExecutorService.class).execute(
new TransferArtifactToRepositoryRunnable(inputStream, fileUploadId, mimeType, UI.getCurrent()));
}
private void interruptUploadAndSetReason(final String failureReason) {
@@ -133,7 +132,8 @@ public abstract class AbstractFileTransferHandler implements Serializable {
protected void publishUploadStarted(final FileUploadId fileUploadId) {
LOG.info("Upload started for file {}", fileUploadId);
final FileUploadProgress fileUploadProgress = new FileUploadProgress(fileUploadId, FileUploadStatus.UPLOAD_STARTED);
final FileUploadProgress fileUploadProgress = new FileUploadProgress(fileUploadId,
FileUploadStatus.UPLOAD_STARTED);
artifactUploadState.updateFileUploadProgress(fileUploadId, fileUploadProgress);
eventBus.publish(this, fileUploadProgress);
}

View File

@@ -91,7 +91,6 @@ public class FileUploadId implements Serializable {
return new EqualsBuilder().append(id, other.id).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(id).toHashCode();

View File

@@ -19,27 +19,27 @@ public class FileUploadProgress implements Serializable {
* Status of a file upload.
*/
public enum FileUploadStatus {
/**
* An upload for a file has been started.
*/
UPLOAD_STARTED,
/**
* Progress changed for one file upload.
*/
UPLOAD_IN_PROGRESS,
/**
* Upload of one file failed.
*/
UPLOAD_FAILED,
/**
* One file upload succeeded.
*/
UPLOAD_SUCCESSFUL,
/**
* One file upload finished ()
*/
@@ -57,9 +57,8 @@ public class FileUploadProgress implements Serializable {
private String failureReason;
private String filePath;
private final FileUploadStatus fileUploadStatus;
private final FileUploadStatus fileUploadStatus;
/**
* Creates a new {@link FileUploadProgress} instance.
@@ -88,8 +87,8 @@ public class FileUploadProgress implements Serializable {
* @param contentLength
* size of the file in bytes
*/
FileUploadProgress(final FileUploadId fileUploadId, final FileUploadStatus fileUploadStatus,
final long bytesRead, final long contentLength) {
FileUploadProgress(final FileUploadId fileUploadId, final FileUploadStatus fileUploadStatus, final long bytesRead,
final long contentLength) {
this.fileUploadId = fileUploadId;
this.fileUploadStatus = fileUploadStatus;
this.contentLength = contentLength;
@@ -111,9 +110,8 @@ public class FileUploadProgress implements Serializable {
* @param filePath
* the path of the file
*/
FileUploadProgress(final FileUploadId fileUploadId, final FileUploadStatus fileUploadStatus,
final long bytesRead, final long contentLength,
final String filePath) {
FileUploadProgress(final FileUploadId fileUploadId, final FileUploadStatus fileUploadStatus, final long bytesRead,
final long contentLength, final String filePath) {
this.fileUploadId = fileUploadId;
this.fileUploadStatus = fileUploadStatus;
this.contentLength = contentLength;
@@ -158,7 +156,7 @@ public class FileUploadProgress implements Serializable {
public String getFilePath() {
return filePath;
}
public FileUploadStatus getFileUploadStatus() {
return fileUploadStatus;
}

View File

@@ -27,7 +27,6 @@ public class UploadFixed extends Upload {
private boolean uploadInterrupted;
@Override
public void interruptUpload() {
super.interruptUpload();

View File

@@ -65,8 +65,7 @@ public class DistributionSetMetadataDetailsLayout extends AbstractMetadataDetail
}
selectedDistSetId = distributionSet.getId();
final List<DistributionSetMetadata> dsMetadataList = distributionSetManagement
.findMetaDataByDistributionSetId(new PageRequest(0, MAX_METADATA_QUERY), selectedDistSetId)
.getContent();
.findMetaDataByDistributionSetId(PageRequest.of(0, MAX_METADATA_QUERY), selectedDistSetId).getContent();
if (null != dsMetadataList && !dsMetadataList.isEmpty()) {
dsMetadataList.forEach(this::setMetadataProperties);
}

View File

@@ -64,8 +64,7 @@ public class SoftwareModuleMetadataDetailsLayout extends AbstractMetadataDetails
}
selectedSWModuleId = swModule.getId();
final List<SoftwareModuleMetadata> swMetadataList = softwareModuleManagement
.findMetaDataBySoftwareModuleId(new PageRequest(0, MAX_METADATA_QUERY), selectedSWModuleId)
.getContent();
.findMetaDataBySoftwareModuleId(PageRequest.of(0, MAX_METADATA_QUERY), selectedSWModuleId).getContent();
if (!CollectionUtils.isEmpty(swMetadataList)) {
swMetadataList.forEach(this::setMetadataProperties);
}

View File

@@ -214,9 +214,11 @@ public abstract class AbstractFilterButtons extends Table {
final Long id = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_ID).getValue();
final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
final String desc = (String) item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue() != null
? item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue().toString() : null;
? item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue().toString()
: null;
final String color = (String) item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue() != null
? item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue().toString() : DEFAULT_GREEN;
? item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue().toString()
: DEFAULT_GREEN;
final Button typeButton = createFilterButton(id, name, desc, color, itemId);
typeButton.addClickListener(filterButtonClickBehaviour::processFilterButtonClick);

View File

@@ -546,7 +546,7 @@ public abstract class AbstractTable<E extends NamedEntity> extends Table impleme
private boolean validateDropList(final Set<?> droplist) {
if (droplist.isEmpty()) {
final String actionDidNotWork = i18n.getMessage("message.action.did.not.work", new Object[] {});
final String actionDidNotWork = i18n.getMessage("message.action.did.not.work");
notification.displayValidationError(actionDidNotWork);
return false;
}

View File

@@ -48,8 +48,7 @@ public abstract class AbstractTargetTagToken<T extends BaseEntity> extends Abstr
@EventBusListenerMethod(scope = EventScope.UI)
void onEventTargetTagCreated(final TargetTagCreatedEventContainer container) {
container.getEvents().stream().filter(Objects::nonNull)
.map(TargetTagCreatedEvent::getEntity)
container.getEvents().stream().filter(Objects::nonNull).map(TargetTagCreatedEvent::getEntity)
.forEach(tag -> setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour()));
}

View File

@@ -108,8 +108,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
public void displayAlreadyAssignedTags() {
removePreviouslyAddedTokens();
if (selectedEntity != null) {
distributionSetTagManagement
.findByDistributionSet(new PageRequest(0, MAX_TAG_QUERY), selectedEntity.getId())
distributionSetTagManagement.findByDistributionSet(PageRequest.of(0, MAX_TAG_QUERY), selectedEntity.getId())
.getContent().stream().forEach(tag -> addNewToken(tag.getId()));
}
}
@@ -118,7 +117,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
protected void populateContainer() {
container.removeAllItems();
tagDetails.clear();
distributionSetTagManagement.findAll(new PageRequest(0, MAX_TAG_QUERY)).getContent().stream()
distributionSetTagManagement.findAll(PageRequest.of(0, MAX_TAG_QUERY)).getContent().stream()
.forEach(tag -> setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour()));
}

View File

@@ -98,7 +98,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
protected void displayAlreadyAssignedTags() {
removePreviouslyAddedTokens();
if (selectedEntity != null) {
for (final TargetTag tag : tagManagement.findByTarget(new PageRequest(0, MAX_TAGS),
for (final TargetTag tag : tagManagement.findByTarget(PageRequest.of(0, MAX_TAGS),
selectedEntity.getControllerId())) {
addNewToken(tag.getId());
}
@@ -109,7 +109,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
protected void populateContainer() {
container.removeAllItems();
tagDetails.clear();
for (final TargetTag tag : tagManagement.findAll(new PageRequest(0, MAX_TAGS))) {
for (final TargetTag tag : tagManagement.findAll(PageRequest.of(0, MAX_TAGS))) {
setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour());
}
}

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.components;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -20,7 +21,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import com.google.common.base.Optional;
import com.vaadin.server.ClientConnector.ConnectorErrorEvent;
import com.vaadin.server.DefaultErrorHandler;
import com.vaadin.server.ErrorEvent;
@@ -82,10 +82,10 @@ public class HawkbitUIErrorHandler extends DefaultErrorHandler {
final Component errorOrigin = findAbstractComponent(event);
if (errorOrigin != null && errorOrigin.getUI() != null) {
return Optional.fromNullable(errorOrigin.getUI().getPage());
return Optional.ofNullable(errorOrigin.getUI().getPage());
}
return Optional.absent();
return Optional.empty();
}
/**

View File

@@ -170,7 +170,7 @@ public class NotificationUnreadButton extends Button {
setEnabled(true);
setCaption("<div class='" + STYLE_UNREAD_COUNTER + "'>" + unreadNotificationCounter + "</div>");
}
setDescription(i18n.getMessage(DESCRIPTION, new Object[] { unreadNotificationCounter }));
setDescription(i18n.getMessage(DESCRIPTION, unreadNotificationCounter));
}
private static class NotificationUnreadValue {

View File

@@ -14,52 +14,51 @@ import com.vaadin.client.ui.VButton;
import com.vaadin.client.widget.grid.RendererCellReference;
/**
* Renders button with provided CustomObject.
* Used to display button with link.
* Renders button with provided CustomObject. Used to display button with link.
*
*/
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData, VButton> {
@Override
public VButton createWidget() {
VButton b = GWT.create(VButton.class);
b.addClickHandler(this);
b.setStylePrimaryName("v-nativebutton");
return b;
}
@Override
public VButton createWidget() {
VButton b = GWT.create(VButton.class);
b.addClickHandler(this);
b.setStylePrimaryName("v-nativebutton");
return b;
}
@Override
public void render(RendererCellReference cell, RolloutRendererData text, VButton button) {
final String creating = "CREATING";
button.setText(text.getName());
applystyle(button);
// this is to allow the button to disappear, if the text is null
button.setVisible(text.getName() != null);
button.getElement().setId(new StringBuilder("link").append(".").append(text.getName()).toString());
/*
* checking Rollout Status for applying button style. If Rollout status
* is not "CREATING", then the Rollout button is applying hyperlink
* style
*/
final boolean isStatusCreate = text.getStatus() != null && creating.equalsIgnoreCase(text.getStatus());
if (isStatusCreate) {
button.addStyleName(getStyle("boldhide"));
button.setEnabled(false);
} else {
button.setEnabled(true);
}
}
@Override
public void render(RendererCellReference cell, RolloutRendererData text, VButton button) {
final String creating = "CREATING";
button.setText(text.getName());
applystyle(button);
// this is to allow the button to disappear, if the text is null
button.setVisible(text.getName() != null);
button.getElement().setId(new StringBuilder("link").append(".").append(text.getName()).toString());
/*
* checking Rollout Status for applying button style. If Rollout status
* is not "CREATING", then the Rollout button is applying hyperlink
* style
*/
final boolean isStatusCreate = text.getStatus() != null && creating.equalsIgnoreCase(text.getStatus());
if (isStatusCreate) {
button.addStyleName(getStyle("boldhide"));
button.setEnabled(false);
} else {
button.setEnabled(true);
}
}
private void applystyle(VButton button) {
button.setStyleName(VButton.CLASSNAME);
button.addStyleName(getStyle("borderless"));
button.addStyleName(getStyle("small"));
button.addStyleName(getStyle("on-focus-no-border"));
button.addStyleName(getStyle("link"));
}
private void applystyle(VButton button) {
button.setStyleName(VButton.CLASSNAME);
button.addStyleName(getStyle("borderless"));
button.addStyleName(getStyle("small"));
button.addStyleName(getStyle("on-focus-no-border"));
button.addStyleName(getStyle("link"));
}
private String getStyle(final String style) {
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
}
private String getStyle(final String style) {
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
}
}

View File

@@ -41,8 +41,6 @@ public class GridButtonRenderer extends ClickableRenderer<FontIconData> {
addClickListener(listener);
}
/**
* Initialize custom object renderer with the given type.
*
@@ -54,7 +52,6 @@ public class GridButtonRenderer extends ClickableRenderer<FontIconData> {
super(presentationType);
}
@Override
public JsonValue encode(final FontIconData resource) {
return super.encode(resource, FontIconData.class);

View File

@@ -189,7 +189,7 @@ public class DistributionSetTypeSoftwareModuleSelectLayout extends VerticalLayou
protected void createSourceTableData() {
sourceTableContainer.removeAllItems();
final Iterable<SoftwareModuleType> moduleTypeBeans = softwareModuleTypeManagement
.findAll(new PageRequest(0, 1000));
.findAll(PageRequest.of(0, 1000));
Item saveTblitem;
for (final SoftwareModuleType swTypeTag : moduleTypeBeans) {
saveTblitem = sourceTableContainer.addItem(swTypeTag.getId());

View File

@@ -55,8 +55,8 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
distributionSetManagement, entityFactory, permissionChecker);
super.init(i18n,
new DistributionSetTableHeader(i18n, permissionChecker, eventBus, manageDistUIState,
distributionAddUpdateWindowLayout),
new DistributionSetTableHeader(
i18n, permissionChecker, eventBus, manageDistUIState, distributionAddUpdateWindowLayout),
distributionSetTable,
new DistributionSetDetails(i18n, eventBus, permissionChecker, manageDistUIState, null,
distributionAddUpdateWindowLayout, distributionSetManagement, uiNotification,

View File

@@ -69,7 +69,7 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayoutVersioned<
@Override
protected List<MetaData> getMetadataList() {
return Collections.unmodifiableList(distributionSetManagement
.findMetaDataByDistributionSetId(new PageRequest(0, 500), getSelectedEntity().getId()).getContent());
.findMetaDataByDistributionSetId(PageRequest.of(0, 500), getSelectedEntity().getId()).getContent());
}
@Override

View File

@@ -104,7 +104,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
.setIsComplete(dsComplete).setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE)
.setType(distributionSetType).build();
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(startIndex / count, count, sort), distributionSetFilter);
PageRequest.of(startIndex / count, count, sort), distributionSetFilter);
}
for (final DistributionSet distributionSet : distBeans) {
@@ -124,13 +124,13 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
if (StringUtils.isEmpty(searchText) && distributionSetType == null) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement()
.findByCompleted(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), dsComplete);
.findByCompleted(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), dsComplete);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(dsComplete).setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE)
.setType(distributionSetType).build();
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
}
final long size = firstPageDistributionSets.getTotalElements();

View File

@@ -77,7 +77,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayoutVersioned<
@Override
protected List<SoftwareModuleMetadata> getMetadataList() {
return Collections.unmodifiableList(softwareModuleManagement
.findMetaDataBySoftwareModuleId(new PageRequest(0, MAX_METADATA_QUERY), getSelectedEntity().getId())
.findMetaDataBySoftwareModuleId(PageRequest.of(0, MAX_METADATA_QUERY), getSelectedEntity().getId())
.getContent());
}

View File

@@ -45,11 +45,10 @@ public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick
@Override
protected void filterClicked(final Button clickedButton) {
softwareModuleTypeManagement.getByName(clickedButton.getData().toString())
.ifPresent(smType -> {
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
});
softwareModuleTypeManagement.getByName(clickedButton.getData().toString()).ifPresent(smType -> {
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
});
}
}

View File

@@ -373,8 +373,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private void createTargetFilterQuery() {
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement.create(entityFactory.targetFilterQuery()
.create().name(nameTextField.getValue()).query(queryTextField.getValue()));
notification.displaySuccess(
i18n.getMessage("message.create.filter.success", new Object[] { targetFilterQuery.getName() }));
notification.displaySuccess(i18n.getMessage("message.create.filter.success", targetFilterQuery.getName()));
eventBus.publish(this, CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY);
}

View File

@@ -89,11 +89,12 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
Slice<Target> targetBeans;
final List<ProxyTarget> proxyTargetBeans = new ArrayList<>();
if (!StringUtils.isEmpty(filterQuery)) {
targetBeans = targetManagement.findByRsql(new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
targetBeans = targetManagement.findByRsql(
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
filterQuery);
} else {
targetBeans = targetManagement.findAll(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
targetBeans = targetManagement
.findAll(PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
}
for (final Target targ : targetBeans) {

View File

@@ -60,8 +60,8 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
searchText = String.format("%%%s%%", searchText);
}
}
if (sortStates!= null && 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
@@ -84,11 +84,11 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
targetFilterQuery = firstPageTargetFilter;
} else if (StringUtils.isEmpty(searchText)) {
// if no search filters available
targetFilterQuery = getTargetFilterQueryManagement().findAll(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
targetFilterQuery = getTargetFilterQueryManagement()
.findAll(PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
} else {
targetFilterQuery = getTargetFilterQueryManagement().findByName(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
searchText);
}
for (final TargetFilterQuery tarFilterQuery : targetFilterQuery) {
@@ -121,10 +121,10 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
public int size() {
if (StringUtils.isEmpty(searchText)) {
firstPageTargetFilter = getTargetFilterQueryManagement()
.findAll(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
.findAll(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort));
} else {
firstPageTargetFilter = getTargetFilterQueryManagement()
.findByName(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), searchText);
.findByName(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), searchText);
}
final long size = firstPageTargetFilter.getTotalElements();

View File

@@ -200,8 +200,8 @@ public class TargetFilterTable extends Table {
* of the deleted custom filter.
*/
notification.displaySuccess(
i18n.getMessage("message.delete.filter.success", new Object[] { deletedFilterName }));
notification
.displaySuccess(i18n.getMessage("message.delete.filter.success", deletedFilterName));
refreshContainer();
}
});

View File

@@ -87,7 +87,8 @@ public class TextFieldSuggestionBox extends AbstractExtension implements TextFie
private void updateValidationIcon(final ValidationOracleContext suggest, final String text) {
final String errorMessage = (suggest.getSyntaxErrorContext() != null)
? suggest.getSyntaxErrorContext().getErrorMessage() : null;
? suggest.getSyntaxErrorContext().getErrorMessage()
: null;
autoCompleteTextFieldComponent.onQueryFilterChange(text, !suggest.isSyntaxError(), errorMessage);
}
}

View File

@@ -289,8 +289,7 @@ public abstract class AbstractHawkbitLoginUI extends UI {
}
private void buildSignInButton() {
final String caption = isDemo
? i18n.getMessage("button.login.agreeandsignin")
final String caption = isDemo ? i18n.getMessage("button.login.agreeandsignin")
: i18n.getMessage("button.login.signin");
signIn = new Button(caption);
@@ -306,7 +305,7 @@ public abstract class AbstractHawkbitLoginUI extends UI {
password.addStyleName(
ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
password.setId("login-password");
if(isDemo && !uiProperties.getDemo().getPassword().isEmpty()) {
if (isDemo && !uiProperties.getDemo().getPassword().isEmpty()) {
password.setValue(uiProperties.getDemo().getPassword());
}
}
@@ -317,7 +316,7 @@ public abstract class AbstractHawkbitLoginUI extends UI {
username.addStyleName(
ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
username.setId("login-username");
if(isDemo && !uiProperties.getDemo().getUser().isEmpty()) {
if (isDemo && !uiProperties.getDemo().getUser().isEmpty()) {
username.setValue(uiProperties.getDemo().getUser());
}
}

View File

@@ -83,12 +83,12 @@ public class ActionBeanQuery extends AbstractBeanQuery<ProxyAction> {
if (startIndex == 0) {
if (firstPageActions == null) {
firstPageActions = getDeploymentManagement().findActionsByTarget(currentSelectedConrollerId,
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort));
}
actionBeans = firstPageActions;
} else {
actionBeans = getDeploymentManagement().findActionsByTarget(currentSelectedConrollerId,
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
}
return createProxyActions(actionBeans);
}

View File

@@ -58,7 +58,7 @@ public class ActionStatusBeanQuery extends AbstractBeanQuery<ProxyActionStatus>
currentSelectedActionId = (Long) queryConfig.get(SPUIDefinitions.ACTIONSTATES_BY_ACTION);
}
if (sortStates!= null && 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
@@ -80,10 +80,9 @@ public class ActionStatusBeanQuery extends AbstractBeanQuery<ProxyActionStatus>
if (startIndex == 0 && firstPageActionStates != null) {
actionBeans = firstPageActionStates;
} else {
actionBeans = getDeploymentManagement()
.findActionStatusByAction(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
currentSelectedActionId);
actionBeans = getDeploymentManagement().findActionStatusByAction(
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
currentSelectedActionId);
}
return createProxyActionStates(actionBeans);
}
@@ -128,7 +127,7 @@ public class ActionStatusBeanQuery extends AbstractBeanQuery<ProxyActionStatus>
if (currentSelectedActionId != null) {
firstPageActionStates = getDeploymentManagement().findActionStatusByAction(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), currentSelectedActionId);
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), currentSelectedActionId);
size = firstPageActionStates.getTotalElements();
}
if (size > Integer.MAX_VALUE) {

View File

@@ -43,7 +43,8 @@ public class ActionStatusLayout extends AbstractGridComponentLayout {
@Override
public DefaultGridHeader createGridHeader() {
return new DefaultGridHeader(managementUIState, getI18n().getMessage("caption.action.states"), getI18n()).init();
return new DefaultGridHeader(managementUIState, getI18n().getMessage("caption.action.states"), getI18n())
.init();
}
@Override

View File

@@ -84,7 +84,7 @@ public class ActionStatusMsgBeanQuery extends AbstractBeanQuery<ProxyMessage> {
actionBeans = firstPageMessages;
} else {
actionBeans = getDeploymentManagement().findMessagesByActionStatusId(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
currentSelectedActionStatusId);
}
return createProxyMessages(actionBeans);
@@ -129,7 +129,7 @@ public class ActionStatusMsgBeanQuery extends AbstractBeanQuery<ProxyMessage> {
if (currentSelectedActionStatusId != null) {
firstPageMessages = getDeploymentManagement().findMessagesByActionStatusId(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), currentSelectedActionStatusId);
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), currentSelectedActionStatusId);
size = firstPageMessages.getTotalElements();
}
if (size > Integer.MAX_VALUE) {

View File

@@ -168,8 +168,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
.type(distributionSetType).requiredMigrationStep(isMigStepReq));
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success",
new Object[] { newDist.getName(), newDist.getVersion() }));
notificationMessage.displaySuccess(
i18n.getMessage("message.new.dist.save.success", newDist.getName(), newDist.getVersion()));
distributionSetTable.setValue(Sets.newHashSet(newDist.getId()));
}
@@ -194,7 +194,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
distNameTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT);
distVersionTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT);
notificationMessage.displayValidationError(i18n.getMessage("message.duplicate.dist",
new Object[] { existingDs.get().getName(), existingDs.get().getVersion() }));
existingDs.get().getName(), existingDs.get().getVersion()));
return true;
}

View File

@@ -148,19 +148,19 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
firstPageDistributionSets = getDistributionSetManagement()
.findByFilterAndAssignedInstalledDsOrderedByLinkTarget(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilterBuilder,
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement()
.findByCompleted(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), true);
.findByCompleted(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), true);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
.setTagNames(distributionTags).build();
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
}
final long size = firstPageDistributionSets.getTotalElements();

View File

@@ -389,7 +389,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
// assign dist to those targets
targetTagManagement.getByName(targetTagName).ifPresent(tag -> {
Pageable query = new PageRequest(0, 500);
Pageable query = PageRequest.of(0, 500);
Page<Target> assignedTargets;
boolean assigned = false;
do {
@@ -400,8 +400,8 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
}
} while (assignedTargets.hasNext() && (query = assignedTargets.nextPageable()) != null);
if (assigned) {
getNotification().displaySuccess(
getI18n().getMessage("message.no.targets.assiged.fortag", new Object[] { targetTagName }));
getNotification()
.displaySuccess(getI18n().getMessage("message.no.targets.assiged.fortag", targetTagName));
}
});
}
@@ -654,7 +654,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
private boolean isNoTagButton(final String tagData, final String targetNoTagData) {
if (tagData.equals(targetNoTagData)) {
getNotification().displayValidationError(getI18n().getMessage("message.tag.cannot.be.assigned",
new Object[] { getI18n().getMessage("label.no.tag.assigned") }));
getI18n().getMessage("label.no.tag.assigned")));
return true;
}
return false;
@@ -664,8 +664,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
final String distNameVersion) {
String pendActionMsg = getI18n().getMessage("message.target.assigned.pending");
if (null == message) {
pendActionMsg = getI18n().getMessage("message.dist.pending.action",
new Object[] { controllerId, distNameVersion });
pendActionMsg = getI18n().getMessage("message.dist.pending.action", controllerId, distNameVersion);
}
return pendActionMsg;
}

View File

@@ -59,8 +59,9 @@ public class DistributionTagLayout extends AbstractFilterLayout implements Refre
final DistributionSetTagManagement distributionSetTagManagement, final EntityFactory entityFactory,
final UINotification uiNotification, final DistributionTagButtons distributionTagButtons) {
super(new DistributionTagFilterHeader(i18n, managementUIState, permChecker, eventBus, distributionSetTagManagement,
entityFactory, uiNotification, distributionTagButtons), distributionTagButtons, eventBus);
super(new DistributionTagFilterHeader(i18n, managementUIState, permChecker, eventBus,
distributionSetTagManagement, entityFactory, uiNotification, distributionTagButtons),
distributionTagButtons, eventBus);
this.managementUIState = managementUIState;
restoreState();

View File

@@ -85,8 +85,8 @@ public class DistributionTagDropEvent implements DropHandler {
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
if (tagName.equals(i18n.getMessage(UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG))) {
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
notification.displayValidationError(
i18n.getMessage("message.tag.cannot.be.assigned", i18n.getMessage("label.no.tag.assigned")));
return false;
}
return true;

View File

@@ -130,7 +130,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
final Target target = targetManagement.update(entityFactory.target().update(controllerId)
.name(nameTextField.getValue()).description(descTextArea.getValue()));
/* display success msg */
uINotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { target.getName() }));
uINotification.displaySuccess(i18n.getMessage("message.update.success", target.getName()));
// publishing through event bus
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.UPDATED_ENTITY, target));
}
@@ -144,7 +144,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc));
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget));
uINotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newTarget.getName() }));
uINotification.displaySuccess(i18n.getMessage("message.save.success", newTarget.getName()));
targetTable.setValue(Sets.newHashSet(newTarget.getId()));
}

View File

@@ -114,14 +114,14 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
} else if (null != targetFilterQueryId) {
targetBeans = getTargetManagement().findByTargetFilterQuery(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
targetFilterQueryId);
} else if (!isAnyFilterSelected()) {
targetBeans = getTargetManagement()
.findAll(new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
.findAll(PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
} else {
targetBeans = getTargetManagement().findByFilters(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
}
for (final Target targ : targetBeans) {

View File

@@ -29,8 +29,9 @@ public class TargetBulkTokenTags extends AbstractTargetTagToken {
private static final int MAX_TAGS = 500;
TargetBulkTokenTags(final SpPermissionChecker checker, final VaadinMessageSource i18n, final UINotification uinotification,
final UIEventBus eventBus, final ManagementUIState managementUIState, final TargetTagManagement tagManagement) {
TargetBulkTokenTags(final SpPermissionChecker checker, final VaadinMessageSource i18n,
final UINotification uinotification, final UIEventBus eventBus, final ManagementUIState managementUIState,
final TargetTagManagement tagManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState, tagManagement);
}
@@ -76,7 +77,7 @@ public class TargetBulkTokenTags extends AbstractTargetTagToken {
protected void populateContainer() {
container.removeAllItems();
tagDetails.clear();
for (final TargetTag tag : tagManagement.findAll(new PageRequest(0, MAX_TAGS))) {
for (final TargetTag tag : tagManagement.findAll(PageRequest.of(0, MAX_TAGS))) {
setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour());
}

View File

@@ -56,8 +56,7 @@ public class TargetTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
@Override
public int size() {
firstPageTargetTag = getTagManagement()
.findAll(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
firstPageTargetTag = getTagManagement().findAll(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
long size = firstPageTargetTag.getTotalElements();
if (size > Integer.MAX_VALUE) {
size = Integer.MAX_VALUE;

View File

@@ -114,7 +114,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
@Override
public void clean() {
LOG.info("Cleanup delayed event push strategy for UI", vaadinUI.getUIId());
LOG.info("Cleanup delayed event push strategy for UI {}", vaadinUI.getUIId());
jobHandle.cancel(true);
queue.clear();
}
@@ -206,6 +206,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
}).get();
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Wait for Vaadin session for UI {} interrupted!", vaadinUI.getUIId(), e);
Thread.currentThread().interrupt();
} finally {
SecurityContextHolder.setContext(oldContext);
}

View File

@@ -70,12 +70,11 @@ public class RolloutView extends VerticalLayout implements View {
@Autowired
RolloutView(final SpPermissionChecker permissionChecker, final RolloutUIState rolloutUIState,
final UIEventBus eventBus, final RolloutManagement rolloutManagement,
final RolloutGroupManagement rolloutGroupManagement, final TargetManagement targetManagement,
final UINotification uiNotification, final UiProperties uiProperties, final EntityFactory entityFactory,
final VaadinMessageSource i18n, final TargetFilterQueryManagement targetFilterQueryManagement,
final QuotaManagement quotaManagement,
final TenantConfigurationManagement tenantConfigManagement) {
final UIEventBus eventBus, final RolloutManagement rolloutManagement,
final RolloutGroupManagement rolloutGroupManagement, final TargetManagement targetManagement,
final UINotification uiNotification, final UiProperties uiProperties, final EntityFactory entityFactory,
final VaadinMessageSource i18n, final TargetFilterQueryManagement targetFilterQueryManagement,
final QuotaManagement quotaManagement, final TenantConfigurationManagement tenantConfigManagement) {
this.permChecker = permissionChecker;
this.rolloutManagement = rolloutManagement;
this.rolloutListView = new RolloutListView(permissionChecker, rolloutUIState, eventBus, rolloutManagement,

View File

@@ -147,7 +147,7 @@ public class GroupsPieChartWidget extends DockLayoutPanel {
background.attr("width", textWidth * 1.1);
background.attr("height", textHeight);
moveSelection(background, -textWidth * 1.1 / 2.0, -textHeight*0.8);
moveSelection(background, -textWidth * 1.1 / 2.0, -textHeight * 0.8);
moveSelection(infoText, x, y);
infoText.attr(ATTR_VISIBILITY, "visible");
}
@@ -156,14 +156,13 @@ public class GroupsPieChartWidget extends DockLayoutPanel {
sel.attr(ATTR_TRANSFORM, "translate(" + x + ", " + y + ")");
}
private static final native double getTextWidth(Element e)/*-{
return e.getBBox().width;
}-*/;
return e.getBBox().width;
}-*/;
private static final native double getTextHeight(Element e)/*-{
return e.getBBox().height;
}-*/;
return e.getBBox().height;
}-*/;
private void initChart() {
arc = D3.svg().arc().innerRadius(0).outerRadius(90);

View File

@@ -356,7 +356,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private Long getScheduledStartTime() {
return AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())
? autoStartOptionGroupLayout.getStartAtDateField().getValue().getTime() : null;
? autoStartOptionGroupLayout.getStartAtDateField().getValue().getTime()
: null;
}
private int getErrorThresholdPercentage(final int amountGroup) {
@@ -802,7 +803,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void populateTargetFilterQuery(final Rollout rollout) {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement.findByQuery(new PageRequest(0, 1),
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement.findByQuery(PageRequest.of(0, 1),
rollout.getTargetFilterQuery());
if (filterQueries.getTotalElements() > 0) {
final TargetFilterQuery filterQuery = filterQueries.getContent().get(0);
@@ -1043,7 +1044,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
window.setOrginaleValues();
updateGroupsChart(rolloutGroupManagement
.findByRollout(new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout()), rollout.getId())
.findByRollout(PageRequest.of(0, quotaManagement.getMaxRolloutGroupsPerRollout()), rollout.getId())
.getContent(), rollout.getTotalTargets());
totalTargetsCount = rollout.getTotalTargets();

View File

@@ -240,7 +240,7 @@ public class DefineGroupsLayout extends GridLayout {
removeAllRows();
final List<RolloutGroup> groups = rolloutGroupManagement
.findByRollout(new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout()), rollout.getId())
.findByRollout(PageRequest.of(0, quotaManagement.getMaxRolloutGroupsPerRollout()), rollout.getId())
.getContent();
for (final RolloutGroup group : groups) {
final GroupRow groupRow = addGroupRow();
@@ -504,7 +504,7 @@ public class DefineGroupsLayout extends GridLayout {
targetFilterQueryCombo.setValue(null);
} else {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement
.findByQuery(new PageRequest(0, 1), group.getTargetFilterQuery());
.findByQuery(PageRequest.of(0, 1), group.getTargetFilterQuery());
if (filterQueries.getTotalElements() > 0) {
final TargetFilterQuery filterQuery = filterQueries.getContent().get(0);
targetFilterQueryCombo.setValue(filterQuery.getName());

View File

@@ -83,7 +83,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
distBeans = firstPageDistributionSets;
} else {
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(startIndex / count, count, sort), distributionSetFilter);
PageRequest.of(startIndex / count, count, sort), distributionSetFilter);
}
return createProxyDistributions(distBeans);
}
@@ -119,8 +119,8 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).build();
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
firstPageDistributionSets = getDistributionSetManagement()
.findByDistributionSetFilter(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
final long size = firstPageDistributionSets.getTotalElements();
if (size > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;

View File

@@ -89,13 +89,12 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
@Override
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
final Slice<Rollout> rolloutBeans;
final PageRequest pageRequest = new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE,
final PageRequest pageRequest = PageRequest.of(startIndex / SPUIDefinitions.PAGE_SIZE,
SPUIDefinitions.PAGE_SIZE, sort);
if (StringUtils.isEmpty(searchText)) {
rolloutBeans = getRolloutManagement().findAllWithDetailedStatus(pageRequest, false);
} else {
rolloutBeans = getRolloutManagement().findByFiltersWithDetailedStatus(pageRequest, searchText,
false);
rolloutBeans = getRolloutManagement().findByFiltersWithDetailedStatus(pageRequest, searchText, false);
}
return getProxyRolloutList(rolloutBeans);
}

View File

@@ -669,8 +669,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
private StatusFontIcon createDeleteButtonMetadata(final RolloutStatus rolloutStatus) {
final boolean isDisabled = hasToBeDisabled(rolloutStatus, DELETE_COPY_BUTTON_ENABLED);
return new StatusFontIcon(FontAwesome.TRASH_O, null,
i18n.getMessage(UIMessageIdProvider.TOOLTIP_DELETE),
return new StatusFontIcon(FontAwesome.TRASH_O, null, i18n.getMessage(UIMessageIdProvider.TOOLTIP_DELETE),
UIComponentIdProvider.ROLLOUT_DELETE_BUTTON_ID, isDisabled);
}

View File

@@ -105,7 +105,7 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
} else {
proxyRolloutGroupsList = getRolloutGroupManagement()
.findByRolloutWithDetailedStatus(new PageRequest(startIndex / count, count), rolloutId)
.findByRolloutWithDetailedStatus(PageRequest.of(startIndex / count, count), rolloutId)
.getContent();
}
}
@@ -156,8 +156,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
long size = 0;
if (rolloutId != null) {
try {
firstPageRolloutGroupSets = getRolloutGroupManagement().findByRolloutWithDetailedStatus(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), rolloutId);
firstPageRolloutGroupSets = getRolloutGroupManagement()
.findByRolloutWithDetailedStatus(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), rolloutId);
size = firstPageRolloutGroupSets.getTotalElements();
} catch (final EntityNotFoundException e) {
LOG.error("Rollout does not exists. Redirect to Rollouts overview", e);

View File

@@ -48,7 +48,8 @@ public class RolloutGroupsListHeader extends AbstractGridHeader {
* @param i18n
* I18N
*/
public RolloutGroupsListHeader(final UIEventBus eventBus, final RolloutUIState rolloutUiState, final VaadinMessageSource i18n) {
public RolloutGroupsListHeader(final UIEventBus eventBus, final RolloutUIState rolloutUiState,
final VaadinMessageSource i18n) {
super(null, rolloutUiState, i18n);
this.eventBus = eventBus;
eventBus.subscribe(this);

View File

@@ -87,9 +87,11 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
return getProxyRolloutGroupTargetsList(firstPageTargetSets.getContent());
}
return rolloutGroup.map(group -> getProxyRolloutGroupTargetsList(getRolloutGroupManagement()
.findAllTargetsOfRolloutGroupWithActionStatus(new PageRequest(startIndex / count, count), group.getId())
.getContent())).orElse(Collections.emptyList());
return rolloutGroup
.map(group -> getProxyRolloutGroupTargetsList(
getRolloutGroupManagement().findAllTargetsOfRolloutGroupWithActionStatus(
PageRequest.of(startIndex / count, count), group.getId()).getContent()))
.orElse(Collections.emptyList());
}
private static List<ProxyTarget> getProxyRolloutGroupTargetsList(
@@ -133,8 +135,9 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
long size = 0;
try {
firstPageTargetSets = rolloutGroup.map(group -> getRolloutGroupManagement()
.findAllTargetsOfRolloutGroupWithActionStatus(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), group.getId()))
firstPageTargetSets = rolloutGroup
.map(group -> getRolloutGroupManagement().findAllTargetsOfRolloutGroupWithActionStatus(
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), group.getId()))
.orElse(null);
size = firstPageTargetSets == null ? 0 : firstPageTargetSets.getTotalElements();

View File

@@ -276,7 +276,7 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid<LazyQueryContainer
return RolloutGroupStatus.READY.toString().toLowerCase();
} else if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) {
final String ds = rolloutUIState.getRolloutDistributionSet().orElse("");
return i18n.getMessage("message.dist.already.assigned", new Object[] { ds });
return i18n.getMessage("message.dist.already.assigned", ds);
}
return "unknown";
}

View File

@@ -79,7 +79,7 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView {
hlayout.addComponent(configurationLabel);
final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
.findAll(new PageRequest(0, 100));
.findAll(PageRequest.of(0, 100));
combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
combobox.setNullSelectionAllowed(false);

View File

@@ -25,10 +25,12 @@ public class ApprovalConfigurationItem extends AbstractBooleanTenantConfiguratio
private boolean configurationEnabledChange;
/**
* Constructor for tenant specific approval mode setting.
* Constructor for tenant specific approval mode setting.
*
* @param tenantConfigurationManagement used to enable/disable the approval mode per tenant
* @param i18n used to translate labels
* @param tenantConfigurationManagement
* used to enable/disable the approval mode per tenant
* @param i18n
* used to translate labels
*/
public ApprovalConfigurationItem(final TenantConfigurationManagement tenantConfigurationManagement,
final VaadinMessageSource i18n) {

View File

@@ -183,7 +183,8 @@ public final class HawkbitCommonUtil {
private static float findRequiredSwModuleExtraWidth(final float newBrowserWidth) {
return newBrowserWidth > SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH
? (newBrowserWidth - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH) : 0;
? (newBrowserWidth - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH)
: 0;
}
/**
@@ -296,24 +297,21 @@ public final class HawkbitCommonUtil {
final int alreadyAssignedCount = result.getAlreadyAssigned();
final int unassignedCount = result.getUnassigned();
if (assignedCount == 1) {
formMsg.append(i18n.getMessage("message.target.assigned.one",
new Object[] { result.getAssignedEntity().get(0).getName(), tagName })).append("<br>");
formMsg.append(i18n.getMessage("message.target.assigned.one", result.getAssignedEntity().get(0).getName(),
tagName)).append("<br>");
} else if (assignedCount > 1) {
formMsg.append(i18n.getMessage("message.target.assigned.many", new Object[] { assignedCount, tagName }))
.append("<br>");
formMsg.append(i18n.getMessage("message.target.assigned.many", assignedCount, tagName)).append("<br>");
if (alreadyAssignedCount > 0) {
final String alreadyAssigned = i18n.getMessage("message.target.alreadyAssigned",
new Object[] { alreadyAssignedCount });
final String alreadyAssigned = i18n.getMessage("message.target.alreadyAssigned", alreadyAssignedCount);
formMsg.append(alreadyAssigned).append("<br>");
}
}
if (unassignedCount == 1) {
formMsg.append(i18n.getMessage("message.target.unassigned.one",
new Object[] { result.getUnassignedEntity().get(0).getName(), tagName })).append("<br>");
result.getUnassignedEntity().get(0).getName(), tagName)).append("<br>");
} else if (unassignedCount > 1) {
formMsg.append(i18n.getMessage("message.target.unassigned.many", new Object[] { unassignedCount, tagName }))
.append("<br>");
formMsg.append(i18n.getMessage("message.target.unassigned.many", unassignedCount, tagName)).append("<br>");
}
return formMsg.toString();
}

View File

@@ -11,4 +11,19 @@
vaadin.servlet.productionMode=true
vaadin.servlet.urlMapping=/UI/*
vaadin.servlet.heartbeatInterval=60
vaadin.servlet.closeIdleSessions=false
vaadin.servlet.closeIdleSessions=false
hawkbit.server.ui.links.documentation.root=https://www.eclipse.org/hawkbit/
hawkbit.server.ui.links.documentation.security=https://www.eclipse.org/hawkbit/concepts/authorization/
hawkbit.server.ui.links.documentation.rollout=https://www.eclipse.org/hawkbit/concepts/rollout-management/
hawkbit.server.ui.links.documentation.deployment-view=https://www.eclipse.org/hawkbit/ui/#deployment-management
hawkbit.server.ui.links.documentation.distribution-view=https://www.eclipse.org/hawkbit/ui/#distribution-management
hawkbit.server.ui.links.documentation.rollout-view=https://www.eclipse.org/hawkbit/ui/#rollout-management
hawkbit.server.ui.links.documentation.system-configuration-view=https://www.eclipse.org/hawkbit/ui/
hawkbit.server.ui.links.documentation.targetfilter-view=https://www.eclipse.org/hawkbit/ui/#target-filter-management
hawkbit.server.ui.links.documentation.upload-view=https://www.eclipse.org/hawkbit/ui/#artifact-management
hawkbit.server.ui.links.documentation.maintenance-window-view=http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html
# UI Favicon disabled to use our Eclipse icon
spring.mvc.favicon.enabled=false

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.dd.client.criteria;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;