Remoce further usage of the helper
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.artifacts;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
@@ -94,7 +95,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
||||
final UINotification uiNotification, final ArtifactUploadState artifactUploadState,
|
||||
final TagManagement tagManagement, final EntityFactory entityFactory,
|
||||
final SoftwareManagement softwareManagement, final UploadViewAcceptCriteria uploadViewAcceptCriteria,
|
||||
final SPInfo spInfo) {
|
||||
final SPInfo spInfo, final ArtifactManagement artifactManagement) {
|
||||
this.eventBus = eventBus;
|
||||
this.permChecker = permChecker;
|
||||
this.i18n = i18n;
|
||||
@@ -104,8 +105,10 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
||||
tagManagement, entityFactory, uiNotification, softwareManagement, uploadViewAcceptCriteria);
|
||||
this.smTableLayout = new SoftwareModuleTableLayout(i18n, permChecker, artifactUploadState, uiNotification,
|
||||
eventBus, softwareManagement, entityFactory, uploadViewAcceptCriteria);
|
||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification);
|
||||
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState, spInfo);
|
||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
||||
artifactManagement);
|
||||
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState, spInfo,
|
||||
artifactManagement);
|
||||
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
||||
artifactUploadState, softwareManagement, uploadViewAcceptCriteria);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
@@ -101,12 +100,16 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
||||
|
||||
private boolean readOnly;
|
||||
|
||||
private final ArtifactManagement artifactManagement;
|
||||
|
||||
public ArtifactDetailsLayout(final I18N i18n, final UIEventBus eventBus,
|
||||
final ArtifactUploadState artifactUploadState, final UINotification uINotification) {
|
||||
final ArtifactUploadState artifactUploadState, final UINotification uINotification,
|
||||
final ArtifactManagement artifactManagement) {
|
||||
this.i18n = i18n;
|
||||
this.eventBus = eventBus;
|
||||
this.artifactUploadState = artifactUploadState;
|
||||
this.uINotification = uINotification;
|
||||
this.artifactManagement = artifactManagement;
|
||||
|
||||
createComponents();
|
||||
buildLayout();
|
||||
@@ -252,8 +255,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
||||
i18n.get("message.delete.artifact", new Object[] { fileName }), i18n.get("button.ok"),
|
||||
i18n.get("button.cancel"), ok -> {
|
||||
if (ok) {
|
||||
final ArtifactManagement artifactManagement = SpringContextHelper
|
||||
.getBean(ArtifactManagement.class);
|
||||
artifactManagement.deleteArtifact(id);
|
||||
uINotification.displaySuccess(i18n.get("message.artifact.deleted", fileName));
|
||||
if (artifactUploadState.getSelectedBaseSwModuleId().isPresent()) {
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -117,7 +116,9 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
|
||||
private final ArtifactUploadState artifactUploadState;
|
||||
|
||||
private final UIEventBus eventBus;
|
||||
private final transient UIEventBus eventBus;
|
||||
|
||||
private final transient ArtifactManagement artifactManagement;
|
||||
|
||||
/**
|
||||
* Initialize the upload confirmation window.
|
||||
@@ -128,10 +129,11 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
* reference of session variable {@link ArtifactUploadState}.
|
||||
*/
|
||||
UploadConfirmationWindow(final UploadLayout artifactUploadView, final ArtifactUploadState artifactUploadState,
|
||||
final UIEventBus eventBus) {
|
||||
final UIEventBus eventBus, final ArtifactManagement artifactManagement) {
|
||||
this.uploadLayout = artifactUploadView;
|
||||
this.artifactUploadState = artifactUploadState;
|
||||
this.eventBus = eventBus;
|
||||
this.artifactManagement = artifactManagement;
|
||||
i18n = artifactUploadView.getI18n();
|
||||
createRequiredComponents();
|
||||
buildLayout();
|
||||
@@ -192,7 +194,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
*/
|
||||
private void setWarningIcon(final Label warningIconLabel, final String fileName, final Object itemId) {
|
||||
final Item item = uploadDetailsTable.getItem(itemId);
|
||||
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
|
||||
if (HawkbitCommonUtil.trimAndNullIfEmpty(fileName) != null) {
|
||||
final Long baseSwId = (Long) item.getItemProperty(BASE_SOFTWARE_ID).getValue();
|
||||
final List<Artifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(fileName, baseSwId);
|
||||
@@ -436,7 +437,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
private void hideErrorIcon(final Label warningLabel, final int errorLabelCount, final int duplicateCount,
|
||||
final Label errorLabel, final String oldFileName, final Long currentSwId) {
|
||||
if (warningLabel == null && (errorLabelCount > 1 || (duplicateCount == 1 && errorLabelCount == 1))) {
|
||||
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
|
||||
|
||||
final List<Artifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(oldFileName,
|
||||
currentSwId);
|
||||
errorLabel.removeStyleName(SPUIStyleDefinitions.ERROR_LABEL);
|
||||
@@ -581,7 +582,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
private void processArtifactUpload() {
|
||||
final List<String> itemIds = (List<String>) uploadDetailsTable.getItemIds();
|
||||
if (preUploadValidation(itemIds)) {
|
||||
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
|
||||
Boolean refreshArtifactDetailsLayout = false;
|
||||
for (final String itemId : itemIds) {
|
||||
final String[] itemDet = itemId.split("/");
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
@@ -108,14 +109,18 @@ public class UploadLayout extends VerticalLayout {
|
||||
|
||||
private Button uploadStatusButton;
|
||||
|
||||
private final transient ArtifactManagement artifactManagement;
|
||||
|
||||
public UploadLayout(final I18N i18n, final UINotification uiNotification, final UIEventBus eventBus,
|
||||
final ArtifactUploadState artifactUploadState, final SPInfo spInfo) {
|
||||
final ArtifactUploadState artifactUploadState, final SPInfo spInfo,
|
||||
final ArtifactManagement artifactManagement) {
|
||||
this.uploadInfoWindow = new UploadStatusInfoWindow(eventBus, artifactUploadState, i18n);
|
||||
this.i18n = i18n;
|
||||
this.uiNotification = uiNotification;
|
||||
this.eventBus = eventBus;
|
||||
this.artifactUploadState = artifactUploadState;
|
||||
this.spInfo = spInfo;
|
||||
this.artifactManagement = artifactManagement;
|
||||
|
||||
createComponents();
|
||||
buildLayout();
|
||||
@@ -621,7 +626,8 @@ public class UploadLayout extends VerticalLayout {
|
||||
if (artifactUploadState.getFileSelected().isEmpty()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.error.noFileSelected"));
|
||||
} else {
|
||||
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState, eventBus);
|
||||
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState, eventBus,
|
||||
artifactManagement);
|
||||
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
|
||||
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
|
||||
Page.getCurrent().getBrowserWindowHeight());
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.distributions;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
@@ -91,7 +92,8 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
|
||||
final TargetManagement targetManagement, final EntityFactory entityFactory,
|
||||
final TagManagement tagManagement, final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
|
||||
final ArtifactUploadState artifactUploadState, final SystemManagement systemManagement) {
|
||||
final ArtifactUploadState artifactUploadState, final SystemManagement systemManagement,
|
||||
final ArtifactManagement artifactManagement) {
|
||||
this.permChecker = permChecker;
|
||||
this.eventBus = eventBus;
|
||||
this.i18n = i18n;
|
||||
@@ -103,7 +105,8 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
softwareManagement, distributionSetManagement, targetManagement, entityFactory, uiNotification,
|
||||
tagManagement, distributionsViewAcceptCriteria, systemManagement);
|
||||
this.softwareModuleTableLayout = new SwModuleTableLayout(i18n, uiNotification, eventBus, softwareManagement,
|
||||
entityFactory, manageDistUIState, permChecker, distributionsViewAcceptCriteria, artifactUploadState);
|
||||
entityFactory, manageDistUIState, permChecker, distributionsViewAcceptCriteria, artifactUploadState,
|
||||
artifactManagement);
|
||||
this.filterBySMTypeLayout = new DistSMTypeFilterLayout(eventBus, i18n, permChecker, manageDistUIState,
|
||||
tagManagement, entityFactory, uiNotification, softwareManagement, distributionsViewAcceptCriteria);
|
||||
this.deleteActionsLayout = new DSDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
||||
@@ -78,12 +79,14 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
||||
SwModuleTable(final UIEventBus eventBus, final I18N i18n, final UINotification uiNotification,
|
||||
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
|
||||
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
|
||||
final SwMetadataPopupLayout swMetadataPopupLayout, final ArtifactUploadState artifactUploadState) {
|
||||
final ArtifactManagement artifactManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
|
||||
final ArtifactUploadState artifactUploadState) {
|
||||
super(eventBus, i18n, uiNotification);
|
||||
this.manageDistUIState = manageDistUIState;
|
||||
this.softwareManagement = softwareManagement;
|
||||
this.distributionsViewAcceptCriteria = distributionsViewAcceptCriteria;
|
||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification);
|
||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
||||
artifactManagement);
|
||||
this.swMetadataPopupLayout = swMetadataPopupLayout;
|
||||
|
||||
addNewContainerDS();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
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.SpPermissionChecker;
|
||||
@@ -31,7 +32,7 @@ public class SwModuleTableLayout extends AbstractTableLayout {
|
||||
final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
|
||||
final ManageDistUIState manageDistUIState, final SpPermissionChecker permChecker,
|
||||
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
|
||||
final ArtifactUploadState artifactUploadState) {
|
||||
final ArtifactUploadState artifactUploadState, final ArtifactManagement artifactManagement) {
|
||||
|
||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
|
||||
uiNotification, eventBus, softwareManagement, entityFactory);
|
||||
@@ -42,7 +43,8 @@ public class SwModuleTableLayout extends AbstractTableLayout {
|
||||
super.init(
|
||||
new SwModuleTableHeader(i18n, permChecker, eventBus, manageDistUIState, softwareModuleAddUpdateWindow),
|
||||
new SwModuleTable(eventBus, i18n, uiNotification, manageDistUIState, softwareManagement,
|
||||
distributionsViewAcceptCriteria, swMetadataPopupLayout, artifactUploadState),
|
||||
distributionsViewAcceptCriteria, artifactManagement, swMetadataPopupLayout,
|
||||
artifactUploadState),
|
||||
new SwModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow, manageDistUIState,
|
||||
softwareManagement, swMetadataPopupLayout, entityFactory));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user