add files to status dialog when receive upload

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-08-12 08:29:43 +02:00
parent 7f156f05a4
commit 630cf09162
4 changed files with 110 additions and 74 deletions

View File

@@ -7,6 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
*/ */
package org.eclipse.hawkbit.ui.artifacts.event; package org.eclipse.hawkbit.ui.artifacts.event;
/** /**
* *
* Holds the upload file status. * Holds the upload file status.
@@ -14,24 +15,36 @@ package org.eclipse.hawkbit.ui.artifacts.event;
*/ */
public class UploadStatusEvent { public class UploadStatusEvent {
/**
* Event type definition of events during the artifact upload life-cycle
* from receiving the upload until the process end.
*/
public enum UploadStatusEventType { public enum UploadStatusEventType {
UPLOAD_FAILED, UPLOAD_IN_PROGRESS, UPLOAD_STARTED, UPLOAD_FINISHED, UPLOAD_SUCCESSFUL, UPLOAD_STREAMING_FAILED, UPLOAD_STREAMING_FINISHED, ABORT_UPLOAD RECEIVE_UPLOAD, UPLOAD_FAILED, UPLOAD_IN_PROGRESS, UPLOAD_STARTED, UPLOAD_FINISHED, UPLOAD_SUCCESSFUL, UPLOAD_STREAMING_FAILED, UPLOAD_STREAMING_FINISHED, ABORT_UPLOAD
} }
private UploadStatusEventType uploadProgressEventType; private final UploadStatusEventType uploadProgressEventType;
private UploadFileStatus uploadStatus; private UploadFileStatus uploadStatus;
public UploadStatusEvent(UploadStatusEventType eventType, UploadFileStatus entity) { /**
* Constructor.
*
* @param eventType
* the type of the event
* @param uploadStatus
* the upload status of this event
*/
public UploadStatusEvent(final UploadStatusEventType eventType, final UploadFileStatus uploadStatus) {
this.uploadProgressEventType = eventType; this.uploadProgressEventType = eventType;
this.uploadStatus = entity; this.uploadStatus = uploadStatus;
} }
public UploadFileStatus getUploadStatus() { public UploadFileStatus getUploadStatus() {
return uploadStatus; return uploadStatus;
} }
public void setUploadStatus(UploadFileStatus uploadStatus) { public void setUploadStatus(final UploadFileStatus uploadStatus) {
this.uploadStatus = uploadStatus; this.uploadStatus = uploadStatus;
} }

View File

@@ -71,10 +71,10 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
private transient EventBus.SessionEventBus eventBus; private transient EventBus.SessionEventBus eventBus;
private final SoftwareModule selectedSw; private final SoftwareModule selectedSw;
private SoftwareModule selectedSwForUpload; private SoftwareModule selectedSwForUpload;
private ArtifactUploadState artifactUploadState; private final ArtifactUploadState artifactUploadState;
UploadHandler(final String fileName, final long fileSize, final UploadLayout view, final long maxSize, UploadHandler(final String fileName, final long fileSize, final UploadLayout view, final long maxSize,
final Upload upload, final String mimeType, SoftwareModule selectedSw) { final Upload upload, final String mimeType, final SoftwareModule selectedSw) {
super(); super();
this.aborted = false; this.aborted = false;
this.fileName = fileName; this.fileName = fileName;
@@ -142,7 +142,11 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
try { try {
if (view.checkIfSoftwareModuleIsSelected() && !view.checkForDuplicate(fileName, selectedSwForUpload)) { if (view.checkIfSoftwareModuleIsSelected() && !view.checkForDuplicate(fileName, selectedSwForUpload)) {
view.increaseNumberOfFileUploadsExpected(); view.increaseNumberOfFileUploadsExpected();
return view.saveUploadedFileDetails(fileName, 0, mimeType, selectedSwForUpload); final OutputStream saveUploadedFileDetails = view.saveUploadedFileDetails(fileName, 0, mimeType,
selectedSwForUpload);
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.RECEIVE_UPLOAD,
new UploadFileStatus(fileName, 0, -1, selectedSwForUpload)));
return saveUploadedFileDetails;
} }
} catch (final ArtifactUploadFailedException e) { } catch (final ArtifactUploadFailedException e) {
LOG.error("Atifact upload failed {} ", e); LOG.error("Atifact upload failed {} ", e);
@@ -163,8 +167,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
@Override @Override
public void uploadSucceeded(final SucceededEvent event) { public void uploadSucceeded(final SucceededEvent event) {
LOG.debug("Streaming finished for file :{}", event.getFilename()); LOG.debug("Streaming finished for file :{}", event.getFilename());
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_SUCCESSFUL, new UploadFileStatus( eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_SUCCESSFUL,
event.getFilename(), 0, event.getLength(), selectedSwForUpload))); new UploadFileStatus(event.getFilename(), 0, event.getLength(), selectedSwForUpload)));
} }
/** /**
@@ -190,8 +194,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
@Override @Override
public void uploadFinished(final FinishedEvent event) { public void uploadFinished(final FinishedEvent event) {
LOG.debug("Upload finished for file :{}", event.getFilename()); LOG.debug("Upload finished for file :{}", event.getFilename());
eventBus.publish(this, eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_FINISHED,
new UploadStatusEvent(UploadStatusEventType.UPLOAD_FINISHED, new UploadFileStatus(event.getFilename()))); new UploadFileStatus(event.getFilename())));
} }
/** /**
@@ -202,8 +206,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
@Override @Override
public void streamingStarted(final StreamingStartEvent event) { public void streamingStarted(final StreamingStartEvent event) {
LOG.debug("Streaming started for file :{}", fileName); LOG.debug("Streaming started for file :{}", fileName);
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_STARTED, new UploadFileStatus( eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_STARTED,
fileName, 0, 0, selectedSw))); new UploadFileStatus(fileName, 0, 0, selectedSw)));
} }
/** /**
@@ -214,8 +218,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
@Override @Override
public void uploadStarted(final StartedEvent event) { public void uploadStarted(final StartedEvent event) {
uploadInterrupted = false; uploadInterrupted = false;
selectedSwForUpload = artifactUploadState.getSelectedBaseSoftwareModule().isPresent() ? artifactUploadState selectedSwForUpload = artifactUploadState.getSelectedBaseSoftwareModule().isPresent()
.getSelectedBaseSoftwareModule().get() : null; ? artifactUploadState.getSelectedBaseSoftwareModule().get() : null;
if (view.isSoftwareModuleSelected()) { if (view.isSoftwareModuleSelected()) {
// single file session // single file session
@@ -223,9 +227,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
LOG.debug("Upload started for file :{}", event.getFilename()); LOG.debug("Upload started for file :{}", event.getFilename());
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_STARTED, eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_STARTED,
new UploadFileStatus(event.getFilename(), 0, 0, selectedSwForUpload))); new UploadFileStatus(event.getFilename(), 0, 0, selectedSwForUpload)));
} }
} } else {
else {
failureReason = i18n.get("message.upload.failed"); failureReason = i18n.get("message.upload.failed");
upload.interruptUpload(); upload.interruptUpload();
// actual interrupt will happen a bit late so setting the below // actual interrupt will happen a bit late so setting the below
@@ -291,8 +294,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
interruptFileStreaming(); interruptFileStreaming();
return; return;
} }
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_IN_PROGRESS, new UploadFileStatus( eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_IN_PROGRESS,
fileName, event.getBytesReceived(), event.getContentLength(), selectedSw))); new UploadFileStatus(fileName, event.getBytesReceived(), event.getContentLength(), selectedSw)));
// Logging to solve sonar issue // Logging to solve sonar issue
LOG.trace("Streaming in progress for file :{}", event.getFileName()); LOG.trace("Streaming in progress for file :{}", event.getFileName());
} }
@@ -332,8 +335,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
if (failureReason == null) { if (failureReason == null) {
failureReason = event.getReason().getMessage(); failureReason = event.getReason().getMessage();
} }
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_FAILED, new UploadFileStatus( eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_FAILED,
fileName, failureReason, selectedSwForUpload))); new UploadFileStatus(fileName, failureReason, selectedSwForUpload)));
if (!aborted) { if (!aborted) {
LOG.info("Upload failed for file :{}", event.getFilename()); LOG.info("Upload failed for file :{}", event.getFilename());
LOG.info("Upload failed for file :{}", event.getReason()); LOG.info("Upload failed for file :{}", event.getReason());

View File

@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent; import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent; import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent.UploadStatusEventType; import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent.UploadStatusEventType;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState; import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -273,6 +274,10 @@ public class UploadLayout extends VerticalLayout {
private void processFile(final Html5File file, final SoftwareModule selectedSw) { private void processFile(final Html5File file, final SoftwareModule selectedSw) {
if (!isDirectory(file)) { if (!isDirectory(file)) {
if (!checkForDuplicate(file.getFileName(), selectedSw)) { if (!checkForDuplicate(file.getFileName(), selectedSw)) {
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.RECEIVE_UPLOAD,
new UploadFileStatus(file.getFileName(), 0, -1, selectedSw)));
artifactUploadState.getNumberOfFileUploadsExpected().incrementAndGet(); artifactUploadState.getNumberOfFileUploadsExpected().incrementAndGet();
file.setStreamVariable(createStreamVariable(file, selectedSw)); file.setStreamVariable(createStreamVariable(file, selectedSw));
} }

View File

@@ -16,6 +16,7 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent; import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent; import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent.UploadStatusEventType; import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent.UploadStatusEventType;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState; import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -135,26 +136,36 @@ public class UploadStatusInfoWindow extends Window {
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final UploadStatusEvent event) { void onEvent(final UploadStatusEvent event) {
if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_IN_PROGRESS) {
UI.getCurrent().access( final UploadFileStatus uploadStatus = event.getUploadStatus();
() -> updateProgress(event.getUploadStatus().getFileName(), event.getUploadStatus().getBytesRead(), switch (event.getUploadProgressEventType()) {
event.getUploadStatus().getContentLength(), event.getUploadStatus().getSoftwareModule())); case UPLOAD_IN_PROGRESS:
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STARTED) { ui.access(() -> updateProgress(uploadStatus.getFileName(), uploadStatus.getBytesRead(),
UI.getCurrent().access(() -> onStartOfUpload(event)); uploadStatus.getContentLength(), uploadStatus.getSoftwareModule()));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FAILED) { break;
ui.access(() -> uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus() case UPLOAD_STARTED:
.getFailureReason(), event.getUploadStatus().getSoftwareModule())); ui.access(() -> onStartOfUpload(event));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_SUCCESSFUL) { break;
UI.getCurrent().access( case UPLOAD_STREAMING_FAILED:
() -> uploadSucceeded(event.getUploadStatus().getFileName(), event.getUploadStatus() ui.access(() -> uploadFailed(uploadStatus.getFileName(), uploadStatus.getFailureReason(),
.getSoftwareModule())); uploadStatus.getSoftwareModule()));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FINISHED) { break;
ui.access(() -> uploadSucceeded(event.getUploadStatus().getFileName(), event.getUploadStatus() case UPLOAD_SUCCESSFUL:
.getSoftwareModule())); // fall through here
case UPLOAD_STREAMING_FINISHED:
ui.access(() -> uploadSucceeded(uploadStatus.getFileName(), uploadStatus.getSoftwareModule()));
break;
case RECEIVE_UPLOAD:
uploadRecevied(uploadStatus.getFileName(), uploadStatus.getSoftwareModule());
break;
case UPLOAD_FINISHED:
case ABORT_UPLOAD:
case UPLOAD_FAILED:
default:
} }
} }
private void onStartOfUpload(UploadStatusEvent event) { private void onStartOfUpload(final UploadStatusEvent event) {
uploadSessionStarted(); uploadSessionStarted();
uploadStarted(event.getUploadStatus().getFileName(), event.getUploadStatus().getSoftwareModule()); uploadStarted(event.getUploadStatus().getFileName(), event.getUploadStatus().getSoftwareModule());
} }
@@ -169,19 +180,23 @@ public class UploadStatusInfoWindow extends Window {
} }
private void restoreState() { private void restoreState() {
Indexed container = grid.getContainerDataSource(); final Indexed container = grid.getContainerDataSource();
if (container.getItemIds().isEmpty()) { if (container.getItemIds().isEmpty()) {
container.removeAllItems(); container.removeAllItems();
for (UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) { for (final UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) {
Item item = container.addItem(getItemid(statusObject.getFilename(), final Item item = container
statusObject.getSelectedSoftwareModule())); .addItem(getItemid(statusObject.getFilename(), statusObject.getSelectedSoftwareModule()));
item.getItemProperty(REASON).setValue(statusObject.getReason() != null ? statusObject.getReason() : ""); item.getItemProperty(REASON).setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
item.getItemProperty(STATUS).setValue(statusObject.getStatus()); if (statusObject.getStatus() != null) {
item.getItemProperty(PROGRESS).setValue(statusObject.getProgress()); item.getItemProperty(STATUS).setValue(statusObject.getStatus());
}
if (statusObject.getProgress() != null) {
item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
}
item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename()); item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
SoftwareModule sw = statusObject.getSelectedSoftwareModule(); final SoftwareModule sw = statusObject.getSelectedSoftwareModule();
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue( item.getItemProperty(SPUILabelDefinitions.NAME_VERSION)
HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion())); .setValue(HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()));
} }
if (artifactUploadState.isUploadCompleted()) { if (artifactUploadState.isUploadCompleted()) {
minimizeButton.setEnabled(false); minimizeButton.setEnabled(false);
@@ -209,7 +224,7 @@ public class UploadStatusInfoWindow extends Window {
} }
private Grid createGrid() { private Grid createGrid() {
Grid statusGrid = new Grid(uploads); final Grid statusGrid = new Grid(uploads);
statusGrid.addStyleName(SPUIStyleDefinitions.UPLOAD_STATUS_GRID); statusGrid.addStyleName(SPUIStyleDefinitions.UPLOAD_STATUS_GRID);
statusGrid.setSelectionMode(SelectionMode.NONE); statusGrid.setSelectionMode(SelectionMode.NONE);
statusGrid.setHeaderVisible(true); statusGrid.setHeaderVisible(true);
@@ -219,7 +234,7 @@ public class UploadStatusInfoWindow extends Window {
} }
private IndexedContainer getGridContainer() { private IndexedContainer getGridContainer() {
IndexedContainer uploadContainer = new IndexedContainer(); final IndexedContainer uploadContainer = new IndexedContainer();
uploadContainer.addContainerProperty(STATUS, String.class, "Active"); uploadContainer.addContainerProperty(STATUS, String.class, "Active");
uploadContainer.addContainerProperty(FILE_NAME, String.class, null); uploadContainer.addContainerProperty(FILE_NAME, String.class, null);
uploadContainer.addContainerProperty(PROGRESS, Double.class, 0D); uploadContainer.addContainerProperty(PROGRESS, Double.class, 0D);
@@ -321,31 +336,33 @@ public class UploadStatusInfoWindow extends Window {
restoreState(); restoreState();
} }
void uploadStarted(final String filename, final SoftwareModule softwareModule) { private void uploadRecevied(final String filename, final SoftwareModule softwareModule) {
final Item item = uploads.addItem(getItemid(filename, softwareModule)); final Item item = uploads.addItem(getItemid(filename, softwareModule));
if (item != null) { if (item != null) {
item.getItemProperty(FILE_NAME).setValue(filename); item.getItemProperty(FILE_NAME).setValue(filename);
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue( item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(
HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(), softwareModule.getVersion())); HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(), softwareModule.getVersion()));
final UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
uploadStatus.setStatus("Active");
artifactUploadState.getUploadedFileStatusList().add(uploadStatus);
} }
grid.scrollToEnd(); }
UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
uploadStatus.setStatus("Active"); void uploadStarted(final String filename, final SoftwareModule softwareModule) {
artifactUploadState.getUploadedFileStatusList().add(uploadStatus); grid.scrollTo(getItemid(filename, softwareModule));
} }
void updateProgress(final String filename, final long readBytes, final long contentLength, void updateProgress(final String filename, final long readBytes, final long contentLength,
final SoftwareModule softwareModule) { final SoftwareModule softwareModule) {
final Item item = uploads.getItem(getItemid(filename, softwareModule)); final Item item = uploads.getItem(getItemid(filename, softwareModule));
double progress = (double) readBytes / (double) contentLength; final double progress = (double) readBytes / (double) contentLength;
if (item != null) { if (item != null) {
item.getItemProperty(PROGRESS).setValue(progress); item.getItemProperty(PROGRESS).setValue(progress);
} }
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState final List<UploadStatusObject> uploadStatusObjectList = artifactUploadState.getUploadedFileStatusList().stream()
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename)) .filter(e -> e.getFilename().equals(filename)).collect(Collectors.toList());
.collect(Collectors.toList());
if (!uploadStatusObjectList.isEmpty()) { if (!uploadStatusObjectList.isEmpty()) {
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0); final UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
uploadStatusObject.setProgress(progress); uploadStatusObject.setProgress(progress);
} }
} }
@@ -358,35 +375,33 @@ public class UploadStatusInfoWindow extends Window {
* @param softwareModule * @param softwareModule
* selected software module * selected software module
*/ */
public void uploadSucceeded(final String filename, SoftwareModule softwareModule) { public void uploadSucceeded(final String filename, final SoftwareModule softwareModule) {
final Item item = uploads.getItem(getItemid(filename, softwareModule)); final Item item = uploads.getItem(getItemid(filename, softwareModule));
String status = "Finished"; final String status = "Finished";
if (item != null) { if (item != null) {
item.getItemProperty(STATUS).setValue(status); item.getItemProperty(STATUS).setValue(status);
} }
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState final List<UploadStatusObject> uploadStatusObjectList = artifactUploadState.getUploadedFileStatusList().stream()
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename)) .filter(e -> e.getFilename().equals(filename)).collect(Collectors.toList());
.collect(Collectors.toList());
if (!uploadStatusObjectList.isEmpty()) { if (!uploadStatusObjectList.isEmpty()) {
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0); final UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
uploadStatusObject.setStatus(status); uploadStatusObject.setStatus(status);
uploadStatusObject.setProgress(1d); uploadStatusObject.setProgress(1d);
} }
} }
void uploadFailed(final String filename, final String errorReason, SoftwareModule softwareModule) { void uploadFailed(final String filename, final String errorReason, final SoftwareModule softwareModule) {
errorOccured = true; errorOccured = true;
String status = "Failed"; final String status = "Failed";
final Item item = uploads.getItem(getItemid(filename, softwareModule)); final Item item = uploads.getItem(getItemid(filename, softwareModule));
if (item != null) { if (item != null) {
item.getItemProperty(REASON).setValue(errorReason); item.getItemProperty(REASON).setValue(errorReason);
item.getItemProperty(STATUS).setValue(status); item.getItemProperty(STATUS).setValue(status);
} }
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState final List<UploadStatusObject> uploadStatusObjectList = artifactUploadState.getUploadedFileStatusList().stream()
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename)) .filter(e -> e.getFilename().equals(filename)).collect(Collectors.toList());
.collect(Collectors.toList());
if (!uploadStatusObjectList.isEmpty()) { if (!uploadStatusObjectList.isEmpty()) {
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0); final UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
uploadStatusObject.setStatus(status); uploadStatusObject.setStatus(status);
uploadStatusObject.setReason(errorReason); uploadStatusObject.setReason(errorReason);
} }
@@ -428,7 +443,7 @@ public class UploadStatusInfoWindow extends Window {
return resizeBtn; return resizeBtn;
} }
private void resizeWindow(ClickEvent event) { private void resizeWindow(final ClickEvent event) {
if (event.getButton().getIcon() == FontAwesome.EXPAND) { if (event.getButton().getIcon() == FontAwesome.EXPAND) {
event.getButton().setIcon(FontAwesome.COMPRESS); event.getButton().setIcon(FontAwesome.COMPRESS);
setWindowMode(WindowMode.MAXIMIZED); setWindowMode(WindowMode.MAXIMIZED);