Refactoring of bulk upload
Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
@@ -214,22 +214,22 @@ public class BulkUploadHandler extends CustomComponent
|
|||||||
* below event.
|
* below event.
|
||||||
*/
|
*/
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_PROCESS_STARTED));
|
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_PROCESS_STARTED));
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
innerCounter++;
|
innerCounter++;
|
||||||
readEachLine(line, innerCounter, totalFileSize);
|
readEachLine(line, innerCounter, totalFileSize);
|
||||||
}
|
}
|
||||||
doAssignments();
|
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_COMPLETED));
|
|
||||||
|
|
||||||
// Clearing after assignments are done
|
|
||||||
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().clear();
|
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
LOG.error("Error reading file {}", tempFile.getName(), e);
|
LOG.error("Error reading file {}", tempFile.getName(), e);
|
||||||
} catch (final RuntimeException e) {
|
} catch (final RuntimeException e) {
|
||||||
Optional.ofNullable(UI.getCurrent()).ifPresent(
|
Optional.ofNullable(UI.getCurrent()).ifPresent(
|
||||||
error -> UI.getCurrent().getErrorHandler().error(new ConnectorErrorEvent(upload, e)));
|
error -> UI.getCurrent().getErrorHandler().error(new ConnectorErrorEvent(upload, e)));
|
||||||
targetBulkUpdateWindowLayout.closePopupAfterFailureAndRefresh();
|
|
||||||
} finally {
|
} finally {
|
||||||
|
doAssignments();
|
||||||
|
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_COMPLETED));
|
||||||
|
// Clearing after assignments are done
|
||||||
|
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().clear();
|
||||||
resetCounts();
|
resetCounts();
|
||||||
deleteFile();
|
deleteFile();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,15 +239,6 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
|||||||
eventBus.publish(this, BulkUploadPopupEvent.CLOSED);
|
eventBus.publish(this, BulkUploadPopupEvent.CLOSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Close and refresh this component.
|
|
||||||
*/
|
|
||||||
public void closePopupAfterFailureAndRefresh() {
|
|
||||||
closePopup();
|
|
||||||
destroy();
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user