Merge pull request #27 from bsinno/Sonar_Fix_Rollout

Sonar fixes
This commit is contained in:
Michael Hirsch
2016-02-09 12:00:27 +01:00
39 changed files with 642 additions and 715 deletions

View File

@@ -75,7 +75,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private SpringViewProvider viewProvider;
@Autowired
private ApplicationContext context;
private transient ApplicationContext context;
@Autowired
private I18N i18n;
@@ -89,13 +89,13 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private ErrorView errorview;
@Autowired
protected EventBus.SessionEventBus eventBus;
protected transient EventBus.SessionEventBus eventBus;
/**
* An {@link com.google.common.eventbus.EventBus} subscriber which
* subscribes {@link EntityEvent} from the repository to dispatch these
* events to the UI {@link SessionEventBus}.
*
*
* @param event
* the entity event which has been published from the repository
*/
@@ -103,21 +103,28 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
@AllowConcurrentEvents
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
final VaadinSession session = getSession();
if (session != null && session.getState() == State.OPEN) {
final WrappedSession wrappedSession = session.getSession();
if (wrappedSession != null) {
final SecurityContext userContext = (SecurityContext) wrappedSession
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
if (eventSecurityCheck(userContext, event)) {
final SecurityContext oldContext = SecurityContextHolder.getContext();
try {
access(new DispatcherRunnable(eventBus, session, userContext, event));
} finally {
SecurityContextHolder.setContext(oldContext);
}
}
}
if (session == null || session.getState() != State.OPEN) {
return;
}
final WrappedSession wrappedSession = session.getSession();
if (wrappedSession == null) {
return;
}
final SecurityContext userContext = (SecurityContext) wrappedSession
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
if (!eventSecurityCheck(userContext, event)) {
return;
}
final SecurityContext oldContext = SecurityContextHolder.getContext();
try {
access(new DispatcherRunnable(eventBus, session, userContext, event));
} finally {
SecurityContextHolder.setContext(oldContext);
}
}
protected boolean eventSecurityCheck(final SecurityContext userContext,
@@ -134,7 +141,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
/*
* (non-Javadoc)
*
*
* @see
* com.vaadin.server.ClientConnector.DetachListener#detach(com.vaadin.server
* .ClientConnector. DetachEvent)
@@ -225,7 +232,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
/**
* Get Specific Locale.
*
*
* @param availableLocalesInApp
* as set
* @return String as preferred locale

View File

@@ -44,9 +44,9 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract layout of confirm actions window.
*
*
*
*
*
*/
@SpringComponent
@ViewScope
@@ -84,13 +84,13 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
* AbstractConfirmationWindowLayout# getConfimrationTabs()
*/
@Override
protected Map<String, ConfirmationTab> getConfimrationTabs() {
final Map<String, ConfirmationTab> tabs = new HashMap<String, ConfirmationTab>();
final Map<String, ConfirmationTab> tabs = new HashMap<>();
if (!artifactUploadState.getDeleteSofwareModules().isEmpty()) {
tabs.put(i18n.get("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
}
@@ -145,7 +145,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
/**
* Get SWModule table container.
*
*
* @return IndexedContainer
*/
@SuppressWarnings("unchecked")
@@ -153,9 +153,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
final IndexedContainer swcontactContainer = new IndexedContainer();
swcontactContainer.addContainerProperty("SWModuleId", String.class, "");
swcontactContainer.addContainerProperty(SW_MODULE_NAME_MSG, String.class, "");
Item item = null;
for (final Long swModuleID : artifactUploadState.getDeleteSofwareModules().keySet()) {
item = swcontactContainer.addItem(swModuleID);
final Item item = swcontactContainer.addItem(swModuleID);
item.getItemProperty("SWModuleId").setValue(swModuleID.toString());
item.getItemProperty(SW_MODULE_NAME_MSG)
.setValue(artifactUploadState.getDeleteSofwareModules().get(swModuleID));
@@ -197,7 +196,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
final String swNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
customFile.getBaseSoftwareModuleName(), customFile.getBaseSoftwareModuleVersion());
if (HawkbitCommonUtil.bothSame(deleteSoftwareNameVersion, swNameVersion)) {
if (deleteSoftwareNameVersion != null && deleteSoftwareNameVersion.equals(swNameVersion)) {
tobeRemoved.add(customFile);
}
}

View File

@@ -38,13 +38,13 @@ public class ArtifactUploadState implements Serializable {
private final Map<Long, String> deleteSofwareModules = new HashMap<>();
private final Set<CustomFile> fileSelected = new HashSet<CustomFile>();
private final Set<CustomFile> fileSelected = new HashSet<>();
private Long selectedBaseSwModuleId;
private SoftwareModule selectedBaseSoftwareModule;
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<String, SoftwareModule>();
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<>();
private Set<Long> selectedSoftwareModules = Collections.emptySet();
@@ -60,7 +60,7 @@ public class ArtifactUploadState implements Serializable {
/**
* Set software.
*
*
* @return
*/
public SoftwareModuleFilters getSoftwareModuleFilters() {
@@ -85,7 +85,7 @@ public class ArtifactUploadState implements Serializable {
* @return the selectedBaseSwModuleId
*/
public Optional<Long> getSelectedBaseSwModuleId() {
return this.selectedBaseSwModuleId != null ? Optional.of(this.selectedBaseSwModuleId) : Optional.empty();
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
}
/**
@@ -100,8 +100,7 @@ public class ArtifactUploadState implements Serializable {
* @return the selectedBaseSoftwareModule
*/
public Optional<SoftwareModule> getSelectedBaseSoftwareModule() {
return this.selectedBaseSoftwareModule == null ? Optional.empty()
: Optional.of(this.selectedBaseSoftwareModule);
return selectedBaseSoftwareModule == null ? Optional.empty() : Optional.of(selectedBaseSoftwareModule);
}
/**

View File

@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.state;
import java.io.Serializable;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
/**
* Custom file to hold details of uploaded file.
*
@@ -168,36 +166,50 @@ public class CustomFile implements Serializable {
return failureReason;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (fileName == null ? 0 : fileName.hashCode());
result = prime * result + ((baseSoftwareModuleName == null) ? 0 : baseSoftwareModuleName.hashCode());
result = prime * result + ((baseSoftwareModuleVersion == null) ? 0 : baseSoftwareModuleVersion.hashCode());
result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CustomFile)) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CustomFile other = (CustomFile) obj;
return HawkbitCommonUtil.bothSame(fileName, other.fileName)
&& HawkbitCommonUtil.bothSame(baseSoftwareModuleName, other.baseSoftwareModuleName)
&& HawkbitCommonUtil.bothSame(baseSoftwareModuleVersion, other.baseSoftwareModuleVersion);
if (baseSoftwareModuleName == null) {
if (other.baseSoftwareModuleName != null) {
return false;
}
} else if (!baseSoftwareModuleName.equals(other.baseSoftwareModuleName)) {
return false;
}
if (baseSoftwareModuleVersion == null) {
if (other.baseSoftwareModuleVersion != null) {
return false;
}
} else if (!baseSoftwareModuleVersion.equals(other.baseSoftwareModuleVersion)) {
return false;
}
if (fileName == null) {
if (other.fileName != null) {
return false;
}
} else if (!fileName.equals(other.fileName)) {
return false;
}
return true;
}
}

View File

@@ -8,8 +8,6 @@
*/
package org.eclipse.hawkbit.ui.common.filterlayout;
import java.util.Optional;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import com.vaadin.ui.Button;
@@ -17,20 +15,20 @@ import com.vaadin.ui.Button.ClickEvent;
/**
* Abstract Single button click behaviour of filter buttons layout.
*
*
*
*
*
*
*/
public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButtonClickBehaviour {
private static final long serialVersionUID = 478874092615793581L;
private Optional<Button> alreadyClickedButton = Optional.empty();
private Button alreadyClickedButton;
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClick#
* processFilterButtonClick(com.vaadin.ui. Button.ClickEvent)
*/
@@ -40,18 +38,18 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
if (isButtonUnClicked(clickedButton)) {
/* If same button clicked */
clickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton = Optional.empty();
alreadyClickedButton = null;
filterUnClicked(clickedButton);
} else if (alreadyClickedButton.isPresent()) {
} else if (alreadyClickedButton != null) {
/* If button clicked and some other button is already clicked */
alreadyClickedButton.get().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton = Optional.of(clickedButton);
alreadyClickedButton = clickedButton;
filterClicked(clickedButton);
} else {
/* If button clicked and not other button is clicked currently */
clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton = Optional.of(clickedButton);
alreadyClickedButton = clickedButton;
filterClicked(clickedButton);
}
}
@@ -61,21 +59,19 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
* @return
*/
private boolean isButtonUnClicked(final Button clickedButton) {
return alreadyClickedButton.isPresent() && alreadyClickedButton.get().equals(clickedButton);
return alreadyClickedButton != null && alreadyClickedButton.equals(clickedButton);
}
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#
* setDefaultClickedButton(com.vaadin .ui.Button)
*/
@Override
protected void setDefaultClickedButton(final Button button) {
if (button == null) {
alreadyClickedButton = Optional.empty();
} else {
alreadyClickedButton = Optional.of(button);
alreadyClickedButton = button;
if (button != null) {
button.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
}
}
@@ -83,7 +79,7 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
/**
* @return the alreadyClickedButton
*/
public Optional<Button> getAlreadyClickedButton() {
public Button getAlreadyClickedButton() {
return alreadyClickedButton;
}
@@ -91,7 +87,7 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
* @param alreadyClickedButton
* the alreadyClickedButton to set
*/
public void setAlreadyClickedButton(final Optional<Button> alreadyClickedButton) {
public void setAlreadyClickedButton(final Button alreadyClickedButton) {
this.alreadyClickedButton = alreadyClickedButton;
}

View File

@@ -32,7 +32,7 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract class for target/ds tag token layout.
*
*
*
*
*
@@ -47,9 +47,9 @@ public abstract class AbstractTagToken implements Serializable {
protected IndexedContainer container;
protected final Map<Long, TagData> tagDetails = new HashMap<Long, TagData>();
protected final Map<Long, TagData> tagDetails = new HashMap<>();
protected final Map<Long, TagData> tokensAdded = new HashMap<Long, TagData>();
protected final Map<Long, TagData> tokensAdded = new HashMap<>();
protected CssLayout tokenLayout = new CssLayout();
@@ -123,7 +123,7 @@ public abstract class AbstractTagToken implements Serializable {
class CustomTokenField extends TokenField {
private static final long serialVersionUID = 694216966472937436L;
final Container tokenContainer;
Container tokenContainer;
CustomTokenField(final CssLayout cssLayout, final Container tokenContainer) {
super(cssLayout);
@@ -235,9 +235,11 @@ public abstract class AbstractTagToken implements Serializable {
/**
* Tag details.
*
*
*/
public static class TagData {
public static class TagData implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
@@ -247,7 +249,7 @@ public abstract class AbstractTagToken implements Serializable {
/**
* Tag data constructor.
*
*
* @param id
* @param name
* @param color

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.ui.distributions.dstable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -57,7 +58,7 @@ import com.vaadin.ui.Window;
/**
* Distribution set details layout.
*
*
*
*
*/
@@ -153,12 +154,13 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
@SuppressWarnings("unchecked")
private void showUnsavedAssignment() {
Item item;
final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = manageDistUIState.getAssignedList();
final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = manageDistUIState
.getAssignedList();
final Long selectedDistId = manageDistUIState.getLastSelectedDistribution().isPresent()
? manageDistUIState.getLastSelectedDistribution().get().getId() : null;
Set<SoftwareModuleIdName> softwareModuleIdNameList = null;
for (final Map.Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : assignedList.entrySet()) {
for (final Map.Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : assignedList.entrySet()) {
if (entry.getKey().getId().equals(selectedDistId)) {
softwareModuleIdNameList = entry.getValue();
break;
@@ -321,7 +323,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* onEdit(com.vaadin.ui .Button.ClickEvent)
*/
@@ -336,7 +338,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* getEditButtonId()
*/
@@ -347,7 +349,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* onLoadIsSwModuleSelected ()
*/
@@ -359,7 +361,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* onLoadIsTableMaximized ()
*/
@@ -370,7 +372,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* populateDetailsWidget()
*/
@@ -381,7 +383,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* getDefaultCaption()
*/
@@ -392,7 +394,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* addTabs(com.vaadin. ui.TabSheet)
*/
@@ -407,7 +409,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* clearDetails()
*/
@@ -418,7 +420,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* hasEditSoftwareModulePermission()
*/
@@ -507,7 +509,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* getTabSheetId()
*/

View File

@@ -73,7 +73,7 @@ import com.vaadin.ui.UI;
/**
* Distribution set table.
*
*
*
*
*/
@@ -138,7 +138,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
*/
@@ -149,7 +149,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
* )
@@ -157,7 +157,7 @@ public class DistributionSetTable extends AbstractTable {
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
final Map<String, Object> queryConfiguration = new HashMap<>();
manageDistUIState.getManageDistFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
@@ -166,19 +166,16 @@ public class DistributionSetTable extends AbstractTable {
manageDistUIState.getManageDistFilters().getClickedDistSetType());
}
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<ManageDistBeanQuery>(
ManageDistBeanQuery.class);
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfiguration);
final LazyQueryContainer distContainer = new LazyQueryContainer(
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
distributionQF);
return distContainer;
}
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties
* (com.vaadin.data.Container )
*/
@@ -191,7 +188,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
* addCustomGeneratedColumns ()
*/
@@ -204,7 +201,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
* isFirstRowSelectedOnLoad ()
*/
@@ -216,7 +213,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
*/
@Override
@@ -229,7 +226,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
*/
@@ -269,7 +266,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
*/
@@ -280,7 +277,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
* ()
*/
@@ -291,7 +288,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
*/
@Override
@@ -317,7 +314,7 @@ public class DistributionSetTable extends AbstractTable {
final TableTransferable transferable = (TableTransferable) event.getTransferable();
final Table source = transferable.getSourceComponent();
final Set<Long> softwareModuleSelected = (Set<Long>) source.getValue();
final Set<Long> softwareModulesIdList = new HashSet<Long>();
final Set<Long> softwareModulesIdList = new HashSet<>();
if (!softwareModuleSelected.contains(transferable.getData("itemId"))) {
softwareModulesIdList.add((Long) transferable.getData("itemId"));
@@ -345,11 +342,11 @@ public class DistributionSetTable extends AbstractTable {
final String distVersion = (String) item.getItemProperty("version").getValue();
final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distId, distName, distVersion);
final Map<Long, Set<SoftwareModuleIdName>> map;
final HashMap<Long, HashSet<SoftwareModuleIdName>> map;
if (manageDistUIState.getConsolidatedDistSoftwarewList().containsKey(distributionSetIdName)) {
map = manageDistUIState.getConsolidatedDistSoftwarewList().get(distributionSetIdName);
} else {
map = new HashMap<Long, Set<SoftwareModuleIdName>>();
map = new HashMap<>();
manageDistUIState.getConsolidatedDistSoftwarewList().put(distributionSetIdName, map);
}
@@ -382,7 +379,8 @@ public class DistributionSetTable extends AbstractTable {
}
}
final Set<SoftwareModuleIdName> softwareModules = new HashSet<SoftwareModuleIdName>();
// hashset is seriablizable
final HashSet<SoftwareModuleIdName> softwareModules = new HashSet<>();
map.keySet().forEach(typeId -> softwareModules.addAll(map.get(typeId)));
updateDropedDetails(distributionSetIdName, softwareModules);
@@ -405,8 +403,8 @@ public class DistributionSetTable extends AbstractTable {
* @param softwareModule
* @param softwareModuleIdName
*/
private void handleFirmwareCase(final Map<Long, Set<SoftwareModuleIdName>> map, final SoftwareModule softwareModule,
final SoftwareModuleIdName softwareModuleIdName) {
private void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
if (softwareModule.getType().getMaxAssignments() == 1) {
if (!map.containsKey(softwareModule.getType().getId())) {
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
@@ -423,8 +421,8 @@ public class DistributionSetTable extends AbstractTable {
* @param softwareModule
* @param softwareModuleIdName
*/
private void handleSoftwareCase(final Map<Long, Set<SoftwareModuleIdName>> map, final SoftwareModule softwareModule,
final SoftwareModuleIdName softwareModuleIdName) {
private void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
if (softwareModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
if (!map.containsKey(softwareModule.getType().getId())) {
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
@@ -434,7 +432,7 @@ public class DistributionSetTable extends AbstractTable {
}
private void updateDropedDetails(final DistributionSetIdName distributionSetIdName,
final Set<SoftwareModuleIdName> softwareModules) {
final HashSet<SoftwareModuleIdName> softwareModules) {
LOG.debug("Adding a log to check if distributionSetIdName is null : {} ", distributionSetIdName);
manageDistUIState.getAssignedList().put(distributionSetIdName, softwareModules);
@@ -487,20 +485,20 @@ public class DistributionSetTable extends AbstractTable {
}
private boolean isSoftwareModuleDragged(final Long distId, final SoftwareModule sm) {
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : manageDistUIState.getAssignedList()
.entrySet()) {
if (distId.equals(entry.getKey().getId())) {
final Set<SoftwareModuleIdName> swModuleIdNames = entry.getValue();
for (final SoftwareModuleIdName swModuleIdName : swModuleIdNames) {
if ((sm.getName().concat(":" + sm.getVersion())).equals(swModuleIdName.getName())) {
notification.displayValidationError(i18n.get("message.software.already.dragged",
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
return false;
}
}
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : manageDistUIState
.getAssignedList().entrySet()) {
if (!distId.equals(entry.getKey().getId())) {
continue;
}
final Set<SoftwareModuleIdName> swModuleIdNames = entry.getValue();
for (final SoftwareModuleIdName swModuleIdName : swModuleIdNames) {
if ((sm.getName().concat(":" + sm.getVersion())).equals(swModuleIdName.getName())) {
notification.displayValidationError(i18n.get("message.software.already.dragged",
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
return false;
}
}
}
return true;
}
@@ -564,21 +562,18 @@ public class DistributionSetTable extends AbstractTable {
}
private void addTableStyleGenerator() {
setCellStyleGenerator(new Table.CellStyleGenerator() {
@Override
public String getStyle(final Table source, final Object itemId, final Object propertyId) {
if (propertyId == null) {
// Styling for row
final Item item = getItem(itemId);
final Boolean isComplete = (Boolean) item
.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
if (!isComplete) {
return SPUIDefinitions.DISABLE_DISTRIBUTION;
}
return null;
} else {
return null;
setCellStyleGenerator((source, itemId, propertyId) -> {
if (propertyId == null) {
// Styling for row
final Item item = getItem(itemId);
final Boolean isComplete = (Boolean) item
.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
if (!isComplete) {
return SPUIDefinitions.DISABLE_DISTRIBUTION;
}
return null;
} else {
return null;
}
});
}
@@ -603,7 +598,7 @@ public class DistributionSetTable extends AbstractTable {
/**
* DistributionTableFilterEvent.
*
*
* @param event
* as instance of {@link DistributionTableFilterEvent}
*/

View File

@@ -51,9 +51,9 @@ import com.vaadin.ui.UI;
/**
* Distributions footer layout implementation.
*
*
*
*
*
*/
@org.springframework.stereotype.Component
@ViewScope
@@ -94,10 +94,11 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
*/
@Override
@PostConstruct
protected void init() {
super.init();
@@ -140,7 +141,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* hasDeletePermission()
@@ -153,7 +154,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* hasUpdatePermission()
@@ -166,7 +167,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getDeleteAreaLabel()
@@ -178,7 +179,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getDeleteAreaId()
@@ -191,7 +192,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getDeleteLayoutAcceptCriteria ()
@@ -204,7 +205,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* processDroppedComponent(com .vaadin.event.dd.DragAndDropEvent)
@@ -248,7 +249,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/**
* Check if distribution set type is selected.
*
*
* @param distTypeName
* @return true if ds type is selected
*/
@@ -276,7 +277,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
@SuppressWarnings("unchecked")
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) sourceTable.getValue();
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<DistributionSetIdName>();
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<>();
if (!distSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
distributionIdNameSet.add((DistributionSetIdName) transferable.getData(SPUIDefinitions.ITEMID));
} else {
@@ -314,7 +315,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
@SuppressWarnings("unchecked")
final Set<Long> swModuleSelected = (Set<Long>) sourceTable.getValue();
final Set<Long> swModuleIdNameSet = new HashSet<Long>();
final Set<Long> swModuleIdNameSet = new HashSet<>();
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
} else {
@@ -336,7 +337,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
+ manageDistUIState.getDeleteSofwareModulesList().size()
+ manageDistUIState.getDeletedDistributionList().size();
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> mapEntry : manageDistUIState
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> mapEntry : manageDistUIState
.getAssignedList().entrySet()) {
count += manageDistUIState.getAssignedList().get(mapEntry.getKey()).size();
}
@@ -345,7 +346,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/**
* DistributionsUIEvent.
*
*
* @param event
* as instance of {@link DistributionsUIEvent}
*/
@@ -357,27 +358,17 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
}
/**
*
* @param source
* @return true if it is distribution table
*/
private boolean isDistributionTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.DIST_TABLE_ID);
return SPUIComponetIdProvider.DIST_TABLE_ID.equals(source.getId());
}
/**
*
* @param source
* @return true if it is SoftwareModule table
*/
private boolean isSoftwareModuleTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE);
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE.equals(source.getId());
}
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getNoActionsButtonLabel()
@@ -389,7 +380,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getActionsButtonLabel()
@@ -403,7 +394,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* reloadActionCount()
@@ -416,7 +407,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getUnsavedActionsWindowCaption ()
@@ -428,7 +419,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* unsavedActionsWindowClosed()
@@ -444,7 +435,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getUnsavedActionsWindowContent ()
@@ -457,7 +448,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* hasUnsavedActions()
@@ -490,7 +481,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
* hasBulkUploadPermission()
*/
@@ -501,7 +492,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
* showBulkUploadWindow()
*/
@@ -514,7 +505,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
* restoreBulkUploadStatusCount()
*/
@@ -531,7 +522,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/**
* Check if the distribution set type is default.
*
*
* @param dsTypeName
* distribution set name
* @return true if distribution set type is set default in configuration

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.distributions.footer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -52,9 +53,9 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract layout of confirm actions window.
*
*
*
*
*
*/
@org.springframework.stereotype.Component
@ViewScope
@@ -107,13 +108,13 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
* AbstractConfirmationWindowLayout# getConfimrationTabs()
*/
@Override
protected Map<String, ConfirmationTab> getConfimrationTabs() {
final Map<String, ConfirmationTab> tabs = new HashMap<String, ConfirmationTab>();
final Map<String, ConfirmationTab> tabs = new HashMap<>();
/* Create tab for SW Modules delete */
if (!manageDistUIState.getDeleteSofwareModulesList().isEmpty()) {
tabs.put(i18n.get("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
@@ -190,26 +191,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
private void deleteSMAll(final ConfirmationTab tab) {
final Set<Long> swmoduleIds = manageDistUIState.getDeleteSofwareModulesList().keySet();
if (null != manageDistUIState.getAssignedList() && !manageDistUIState.getAssignedList().isEmpty()) {
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entryAssignSM : manageDistUIState
.getAssignedList().entrySet()) {
for (final Entry<Long, String> entryDeleteSM : manageDistUIState.getDeleteSofwareModulesList()
.entrySet()) {
final SoftwareModuleIdName smIdName = new SoftwareModuleIdName(entryDeleteSM.getKey(),
entryDeleteSM.getValue());
if (entryAssignSM.getValue().contains(smIdName)) {
entryAssignSM.getValue().remove(smIdName);
assignmnetTab.getTable().removeItem(HawkbitCommonUtil.concatStrings("|||",
entryAssignSM.getKey().getId().toString(), smIdName.getId().toString()));
}
if (entryAssignSM.getValue().isEmpty()) {
manageDistUIState.getAssignedList().remove(entryAssignSM.getKey());
}
}
}
if (manageDistUIState.getAssignedList() == null || manageDistUIState.getAssignedList().isEmpty()) {
removeAssignedSoftwareModules();
}
softwareManagement.deleteSoftwareModules(swmoduleIds);
@@ -221,6 +204,25 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
eventBus.publish(this, SaveActionWindowEvent.DELETE_ALL_SOFWARE);
}
private void removeAssignedSoftwareModules() {
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entryAssignSM : manageDistUIState
.getAssignedList().entrySet()) {
for (final Entry<Long, String> entryDeleteSM : manageDistUIState.getDeleteSofwareModulesList().entrySet()) {
final SoftwareModuleIdName smIdName = new SoftwareModuleIdName(entryDeleteSM.getKey(),
entryDeleteSM.getValue());
if (entryAssignSM.getValue().contains(smIdName)) {
entryAssignSM.getValue().remove(smIdName);
assignmnetTab.getTable().removeItem(HawkbitCommonUtil.concatStrings("|||",
entryAssignSM.getKey().getId().toString(), smIdName.getId().toString()));
}
if (entryAssignSM.getValue().isEmpty()) {
manageDistUIState.getAssignedList().remove(entryAssignSM.getKey());
}
}
}
}
private void discardSMAll(final ConfirmationTab tab) {
removeCurrentTab(tab);
manageDistUIState.getDeleteSofwareModulesList().clear();
@@ -230,7 +232,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
/**
* Get SWModule table container.
*
*
* @return IndexedContainer
*/
@SuppressWarnings("unchecked")
@@ -238,9 +240,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
final IndexedContainer swcontactContainer = new IndexedContainer();
swcontactContainer.addContainerProperty("SWModuleId", String.class, "");
swcontactContainer.addContainerProperty(SW_MODULE_NAME_MSG, String.class, "");
Item item = null;
for (final Long swModuleID : manageDistUIState.getDeleteSofwareModulesList().keySet()) {
item = swcontactContainer.addItem(swModuleID);
final Item item = swcontactContainer.addItem(swModuleID);
item.getItemProperty("SWModuleId").setValue(swModuleID.toString());
item.getItemProperty(SW_MODULE_NAME_MSG)
.setValue(manageDistUIState.getDeleteSofwareModulesList().get(swModuleID));
@@ -640,7 +641,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
contactContainer.addContainerProperty(DIST_ID_NAME, DistributionSetIdName.class, "");
contactContainer.addContainerProperty(SOFTWARE_MODULE_ID_NAME, SoftwareModuleIdName.class, "");
final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = manageDistUIState.getAssignedList();
final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = manageDistUIState
.getAssignedList();
assignedList.forEach((distIdname, softIdNameSet) -> softIdNameSet.forEach(softIdName -> {
final String itemId = HawkbitCommonUtil.concatStrings("|||", distIdname.getId().toString(),
@@ -672,8 +674,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
});
int count = 0;
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : manageDistUIState.getAssignedList()
.entrySet()) {
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : manageDistUIState
.getAssignedList().entrySet()) {
count += entry.getValue().size();
}
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -707,7 +709,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
if (softIdNameSet.isEmpty()) {
manageDistUIState.getAssignedList().remove(discardDistIdName);
}
final Map<Long, Set<SoftwareModuleIdName>> map = manageDistUIState.getConsolidatedDistSoftwarewList()
final Map<Long, HashSet<SoftwareModuleIdName>> map = manageDistUIState.getConsolidatedDistSoftwarewList()
.get(discardDistIdName);
map.keySet().forEach(typeId -> map.get(typeId).remove(discardSoftIdName));

View File

@@ -40,11 +40,11 @@ public class ManageDistUIState implements Serializable {
@Autowired
private ManageSoftwareModuleFilters softwareModuleFilters;
private final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = new HashMap<DistributionSetIdName, Set<SoftwareModuleIdName>>();
private final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = new HashMap<>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<DistributionSetIdName>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<>();
private Set<DistributionSetIdName> selectedDistributions = new HashSet<DistributionSetIdName>();
private Set<DistributionSetIdName> selectedDistributions = new HashSet<>();
private DistributionSetIdName lastSelectedDistribution;
@@ -66,9 +66,9 @@ public class ManageDistUIState implements Serializable {
private boolean isDsTableMaximized = Boolean.FALSE;
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<String, SoftwareModuleIdName>();
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>();
private final Map<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>>();
private final Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<>();
private boolean noDataAvilableSwModule = Boolean.FALSE;
@@ -89,10 +89,11 @@ public class ManageDistUIState implements Serializable {
}
/**
*
* Need HashSet because the Set have to be serializable
*
* @return the assignedList
*/
public Map<DistributionSetIdName, Set<SoftwareModuleIdName>> getAssignedList() {
public Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> getAssignedList() {
return assignedList;
}
@@ -119,7 +120,7 @@ public class ManageDistUIState implements Serializable {
}
public void setSelectedDistributions(final Set<DistributionSetIdName> slectedDistributions) {
this.selectedDistributions = slectedDistributions;
selectedDistributions = slectedDistributions;
}
/**
@@ -140,7 +141,7 @@ public class ManageDistUIState implements Serializable {
* @return the selectedBaseSwModuleId
*/
public Optional<Long> getSelectedBaseSwModuleId() {
return this.selectedBaseSwModuleId != null ? Optional.of(this.selectedBaseSwModuleId) : Optional.empty();
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
}
/**
@@ -214,7 +215,7 @@ public class ManageDistUIState implements Serializable {
/**
* Get isSwModuleTableMaximized.
*
*
* @return boolean
*/
public boolean isDsTableMaximized() {
@@ -223,11 +224,11 @@ public class ManageDistUIState implements Serializable {
/***
* Set isDsModuleTableMaximized.
*
*
* @param isDsModuleTableMaximized
*/
public void setDsTableMaximized(final boolean isDsModuleTableMaximized) {
this.isDsTableMaximized = isDsModuleTableMaximized;
isDsTableMaximized = isDsModuleTableMaximized;
}
public Map<String, SoftwareModuleIdName> getAssignedSoftwareModuleDetails() {
@@ -279,7 +280,12 @@ public class ManageDistUIState implements Serializable {
this.noDataAvailableDist = noDataAvailableDist;
}
public Map<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
/**
* Need HashSet because the Set have to be serializable
*
* @return map
*/
public Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
return consolidatedDistSoftwarewList;
}

View File

@@ -49,7 +49,7 @@ public class HawkbitLoginUI extends DefaultHawkbitUI {
private SpringViewProvider viewProvider;
@Autowired
private ApplicationContext context;
private transient ApplicationContext context;
@Override
protected void init(final VaadinRequest request) {

View File

@@ -79,10 +79,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
private I18N i18n;
@Autowired
private DeploymentManagement deploymentManagement;
private transient DeploymentManagement deploymentManagement;
@Autowired
private EventBus.SessionEventBus eventBus;
private transient EventBus.SessionEventBus eventBus;
@Autowired
private UINotification notification;
@@ -204,10 +204,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Get Action based on status.
*
*
* @param type
* as Action.Type
*
*
* @return List of Actions
*/
private List<Object> getVisbleColumns() {
@@ -227,12 +227,12 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* fetch the target details using controller id, and set it globally.
*
*
* @param selectedTarget
* reference of target
*/
public void populateTableData(final Target selectedTarget) {
this.target = selectedTarget;
target = selectedTarget;
refreshContainer();
}
@@ -255,7 +255,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Populate Container for Action.
*
*
* @param isActiveActions
* as flag
* @param reversedActions
@@ -275,14 +275,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
final Item item = hierarchicalContainer.addItem(actionWithStatusCount.getActionId());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
actionWithStatusCount.getActionStatus());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
.setValue(actionWithStatusCount.getActionStatus());
/*
* add action id.
*/
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID).setValue(
actionWithStatusCount.getActionId().toString());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID)
.setValue(actionWithStatusCount.getActionId().toString());
/*
* add active/inactive status to the item which will be used in
* Column generator to generate respective icon
@@ -294,28 +294,27 @@ public class ActionHistoryTable extends TreeTable implements Handler {
* add action Id to the item which will be used for fetching child
* items ( previous action status ) during expand
*/
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN).setValue(
actionWithStatusCount.getActionId());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
.setValue(actionWithStatusCount.getActionId());
/*
* add distribution name to the item which will be displayed in the
* table. The name should not exceed certain limit.
*/
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
HawkbitCommonUtil.getFormattedText(actionWithStatusCount.getDsName() + ":"
+ actionWithStatusCount.getDsVersion()));
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(HawkbitCommonUtil
.getFormattedText(actionWithStatusCount.getDsName() + ":" + actionWithStatusCount.getDsVersion()));
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
/* Default no child */
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), false);
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
.setValue(
SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null) ? actionWithStatusCount
.getActionLastModifiedAt() : actionWithStatusCount.getActionCreatedAt()));
.setValue(SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null)
? actionWithStatusCount.getActionLastModifiedAt()
: actionWithStatusCount.getActionCreatedAt()));
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME).setValue(
actionWithStatusCount.getRolloutName());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME)
.setValue(actionWithStatusCount.getRolloutName());
if (actionWithStatusCount.getActionStatusCount() > 0) {
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), true);
@@ -390,10 +389,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
}
final String distName = (String) hierarchicalContainer.getItem(itemId)
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).getValue();
final Label activeStatusIcon = createActiveStatusLabel(
activeValue,
final Label activeStatusIcon = createActiveStatusLabel(activeValue,
(Action.Status) hierarchicalContainer.getItem(itemId)
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).getValue() == Action.Status.ERROR);
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
.getValue() == Action.Status.ERROR);
activeStatusIcon.setId(new StringJoiner(".").add(distName).add(itemId.toString())
.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE).add(activeValue).toString());
return activeStatusIcon;
@@ -412,7 +411,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Load the rows of previous status history of the selected action row and
* add it next to the selected action row.
*
*
* @param parentRowIdx
* index of the selected action row.
*/
@@ -447,14 +446,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
*/
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue("");
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST)
.setValue(HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
+ action.getDistributionSet().getVersion()));
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME).setValue(
SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
actionStatus.getStatus());
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
.setValue(SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
.setValue(actionStatus.getStatus());
showOrHideMessage(childItem, actionStatus);
/* No further child items allowed for the child items */
((Hierarchical) hierarchicalContainer).setChildrenAllowed(childId, false);
@@ -469,7 +468,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Hide the rows of previous status history of the selected action row.
*
*
* @param parentRowIdx
* index of the selected action row.
*/
@@ -487,7 +486,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Get status icon.
*
*
* @param status
* as Status
* @return Label as UI
@@ -561,13 +560,11 @@ public class ActionHistoryTable extends TreeTable implements Handler {
if (actionWithActiveStatus.isHitAutoForceTime(currentTimeMillis)) {
autoForceLabel.setDescription("autoforced");
autoForceLabel.setStyleName(STATUS_ICON_GREEN);
autoForceLabel.setDescription("auto forced since "
+ SPDateTimeUtil.getDurationFormattedString(actionWithActiveStatus.getForcedTime(),
currentTimeMillis, i18n));
autoForceLabel.setDescription("auto forced since " + SPDateTimeUtil
.getDurationFormattedString(actionWithActiveStatus.getForcedTime(), currentTimeMillis, i18n));
} else {
autoForceLabel.setDescription("auto forcing in "
+ SPDateTimeUtil.getDurationFormattedString(currentTimeMillis,
actionWithActiveStatus.getForcedTime(), i18n));
autoForceLabel.setDescription("auto forcing in " + SPDateTimeUtil
.getDurationFormattedString(currentTimeMillis, actionWithActiveStatus.getForcedTime(), i18n));
autoForceLabel.setStyleName("statusIconPending");
autoForceLabel.setValue(FontAwesome.HISTORY.getHtml());
}
@@ -576,7 +573,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Create Status Label.
*
*
* @param activeValue
* as String
* @return Labeal as UI
@@ -649,7 +646,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* create Message block for Actions.
*
*
* @param messages
* as List of msg
* @return Component as UI
@@ -748,7 +745,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Show confirmation window and if ok then only, force the action.
*
*
* @param actionId
* as Id if the action needs to be forced.
*/
@@ -776,9 +773,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
private void confirmAndForceQuitAction(final Long actionId) {
/* Display the confirmation */
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.get("caption.forcequit.action.confirmbox"), i18n.get("message.forcequit.action.confirm"),
i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.forcequit.action.confirmbox"),
i18n.get("message.forcequit.action.confirm"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
if (ok) {
final boolean cancelResult = forceQuitActiveAction(actionId);
if (cancelResult) {
@@ -793,14 +789,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
notification.displayValidationError(i18n.get("message.forcequit.action.failed"));
}
}
}, FontAwesome.WARNING);
} , FontAwesome.WARNING);
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
}
/**
* Show confirmation window and if ok then only, cancel the action.
*
*
* @param actionId
* as Id if the action needs to be cancelled.
*/
@@ -880,8 +876,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
if (managementUIState.getDistributionTableFilters().getPinnedTargetId().isPresent()
&& null != managementUIState.getDistributionTableFilters().getPinnedTargetId().get()) {
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters()
.getPinnedTargetId().get();
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters().getPinnedTargetId()
.get();
// if the current target is pinned publish a pin event again
if (null != alreadyPinnedControllerId && alreadyPinnedControllerId.equals(target.getControllerId())) {
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
@@ -898,7 +894,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Set messages false.
*
*
* @param alreadyHasMessages
* the alreadyHasMessages to set
*/

View File

@@ -54,6 +54,7 @@ import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextArea;
@@ -109,7 +110,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
private String originalDistDescription;
private Boolean originalReqMigStep;
private String originalDistSetType;
private final List<Object> changedComponents = new ArrayList<Object>();
private final List<Component> changedComponents = new ArrayList<>();
private ValueChangeListener reqMigStepCheckboxListerner;
private TextChangeListener descTextAreaListener;
private TextChangeListener distNameTextFieldListener;
@@ -197,12 +198,12 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
/**
* Get the LazyQueryContainer instance for DistributionSetTypes.
*
*
* @return
*/
private LazyQueryContainer getDistSetTypeLazyQueryContainer() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final BeanQueryFactory<DistributionSetTypeBeanQuery> dtQF = new BeanQueryFactory<DistributionSetTypeBeanQuery>(
final Map<String, Object> queryConfig = new HashMap<>();
final BeanQueryFactory<DistributionSetTypeBeanQuery> dtQF = new BeanQueryFactory<>(
DistributionSetTypeBeanQuery.class);
dtQF.setQueryConfiguration(queryConfig);
@@ -499,7 +500,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
/**
* populate data.
*
*
* @param editDistId
*/
public void populateValuesOfDistribution(final Long editDistId) {

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.management.footer;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
@@ -27,7 +26,7 @@ public final class DeleteActionsLayoutHelper {
/**
* Checks if component is a target tag.
*
*
* @param source
* Component dropped
* @return true if it component is target tag
@@ -45,7 +44,7 @@ public final class DeleteActionsLayoutHelper {
/**
* Checks if component is distribution tag.
*
*
* @param source
* component dropped
* @return true if it component is distribution tag
@@ -63,29 +62,29 @@ public final class DeleteActionsLayoutHelper {
/**
* Checks if component is target table.
*
*
* @param source
* component dropped
* @return true if it component is target table
*/
public static boolean isTargetTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.TARGET_TABLE_ID);
return SPUIComponetIdProvider.TARGET_TABLE_ID.equalsIgnoreCase(source.getId());
}
/**
* Checks id component is distribution table.
*
*
* @param source
* component dropped
* @return true if it component is distribution table
*/
public static boolean isDistributionTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.DIST_TABLE_ID);
return SPUIComponetIdProvider.DIST_TABLE_ID.equalsIgnoreCase(source.getId());
}
/**
* Check if dropped component can be deleted.
*
*
* @param source
* component dropped
* @return true if component can be deleted

View File

@@ -35,17 +35,19 @@ public class ManagementUIState implements Serializable {
private static final long serialVersionUID = 7301409196969723794L;
private final transient Set<Object> expandParentActionRowId = new HashSet<>();
@Autowired
private DistributionTableFilters distributionTableFilters;
@Autowired
private TargetTableFilters targetTableFilters;
private final Map<TargetIdName, DistributionSetIdName> assignedList = new HashMap<TargetIdName, DistributionSetIdName>();
private final Map<TargetIdName, DistributionSetIdName> assignedList = new HashMap<>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<DistributionSetIdName>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<>();
private final Set<TargetIdName> deletedTargetList = new HashSet<TargetIdName>();
private final Set<TargetIdName> deletedTargetList = new HashSet<>();
private Boolean targetTagLayoutVisible = Boolean.TRUE;
@@ -79,9 +81,7 @@ public class ManagementUIState implements Serializable {
private boolean noDataAvailableDistribution = Boolean.FALSE;
private final Set<String> canceledTargetName = new HashSet<String>();
private final Set<Object> expandParentActionRowId = new HashSet<Object>();
private final Set<String> canceledTargetName = new HashSet<>();
private boolean customFilterSelected;
@@ -114,7 +114,7 @@ public class ManagementUIState implements Serializable {
* the isCustomFilterSelected to set
*/
public void setCustomFilterSelected(final boolean isCustomFilterSelected) {
this.customFilterSelected = isCustomFilterSelected;
customFilterSelected = isCustomFilterSelected;
}
public Set<Object> getExpandParentActionRowId() {
@@ -134,7 +134,7 @@ public class ManagementUIState implements Serializable {
}
public void setTargetTagLayoutVisible(final Boolean targetTagVisible) {
this.targetTagLayoutVisible = targetTagVisible;
targetTagLayoutVisible = targetTagVisible;
}
public Boolean getTargetTagLayoutVisible() {
@@ -241,16 +241,16 @@ public class ManagementUIState implements Serializable {
* increments the targets all counter.
*/
public void incrementTargetsCountAll() {
this.targetsCountAll.incrementAndGet();
targetsCountAll.incrementAndGet();
}
/**
* decrement the targets all counter.
*/
public void decrementTargetsCountAll() {
final long decrementAndGet = this.targetsCountAll.decrementAndGet();
final long decrementAndGet = targetsCountAll.decrementAndGet();
if (decrementAndGet < 0) {
this.targetsCountAll.set(0);
targetsCountAll.set(0);
}
}

View File

@@ -56,12 +56,7 @@ import com.vaadin.ui.components.colorpicker.ColorSelector;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* Abstract class for create/update target tag layout.
*
*
*
*
*/
public abstract class CreateUpdateTagLayout extends CustomComponent implements ColorChangeListener, ColorSelector {
private static final long serialVersionUID = 4229177824620576456L;
@@ -78,7 +73,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
protected I18N i18n;
@Autowired
protected TagManagement tagManagement;
protected transient TagManagement tagManagement;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
@@ -124,14 +119,14 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Save new tag / update new tag.
*
*
* @param event
*/
protected abstract void save(final Button.ClickEvent event);
/**
* Discard the changes and close the popup.
*
*
* @param event
*/
protected abstract void discard(final Button.ClickEvent event);
@@ -202,7 +197,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
getPreviewButtonColor(DEFAULT_COLOR);
tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
selectors = new HashSet<ColorSelector>();
selectors = new HashSet<>();
selectedColor = new Color(44, 151, 32);
selPreview = new SpColorPickerPreview(selectedColor);
@@ -284,28 +279,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
*/
private void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
final String selectedOption = (String) optiongroup.getValue();
if (null != selectedOption && selectedOption.equalsIgnoreCase(updateTagNw)) {
if (null != tagNameComboBox.getValue()) {
final TargetTag targetTagSelected = tagManagement
.findTargetTag(tagNameComboBox.getValue().toString());
if (null != targetTagSelected) {
selectedColor = targetTagSelected.getColour() != null
? rgbToColorConverter(targetTagSelected.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
} else {
final DistributionSetTag distTag = tagManagement
.findDistributionSetTag(tagNameComboBox.getValue().toString());
selectedColor = distTag.getColour() != null ? rgbToColorConverter(distTag.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
}
} else {
selectedColor = rgbToColorConverter(DEFAULT_COLOR);
}
}
setColor();
selPreview.setColor(selectedColor);
fieldLayout.addComponent(sliders);
mainLayout.addComponent(colorPickerLayout);
@@ -314,28 +288,53 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
tagPreviewBtnClicked = !tagPreviewBtnClicked;
}
private void setColor() {
final String selectedOption = (String) optiongroup.getValue();
if (selectedOption == null || !selectedOption.equalsIgnoreCase(updateTagNw)) {
return;
}
if (tagNameComboBox.getValue() == null) {
selectedColor = rgbToColorConverter(DEFAULT_COLOR);
return;
}
final TargetTag targetTagSelected = tagManagement.findTargetTag(tagNameComboBox.getValue().toString());
if (targetTagSelected == null) {
final DistributionSetTag distTag = tagManagement
.findDistributionSetTag(tagNameComboBox.getValue().toString());
selectedColor = distTag.getColour() != null ? rgbToColorConverter(distTag.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
} else {
selectedColor = targetTagSelected.getColour() != null ? rgbToColorConverter(targetTagSelected.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
}
}
/**
* Covert RGB code to {@Color}.
*
*
* @param value
* RGB vale
* @return Color
*/
protected Color rgbToColorConverter(final String value) {
if (value.startsWith("rgb")) {
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
return new Color(red, green, blue, alpha);
} else {
return new Color(red, green, blue);
}
if (!value.startsWith("rgb")) {
return null;
}
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
return new Color(red, green, blue, alpha);
} else {
return new Color(red, green, blue);
}
return null;
}
private Label getMandatoryLabel() {
@@ -369,7 +368,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Listener for option group - Create tag/Update.
*
*
* @param event
* ValueChangeEvent
*/
@@ -478,7 +477,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Set tag name and desc field border color based on chosen color.
*
*
* @param tagName
* @param tagDesc
* @param taregtTagColor
@@ -506,7 +505,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Get target style - Dynamically as per the color picked, cannot be done
* from the static css.
*
*
* @param colorPickedPreview
*/
private void getTargetDynamicStyles(final String colorPickedPreview) {

View File

@@ -9,7 +9,6 @@
package org.eclipse.hawkbit.ui.management.targettag;
import java.io.Serializable;
import java.util.Optional;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
@@ -27,9 +26,9 @@ import com.vaadin.ui.Button.ClickEvent;
/**
* Single button click behaviour of custom target filter buttons layout.
*
*
*
*
*
*/
@SpringComponent
@ViewScope
@@ -48,28 +47,28 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
* AbstractFilterButtonClickBehaviour#filterUnClicked (com.vaadin.ui.Button)
*/
@Override
protected void filterUnClicked(final Button clickedButton) {
managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
this.eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
}
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#filterClicked
* (com.vaadin.ui.Button )
*/
@Override
protected void filterClicked(final Button clickedButton) {
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
final TargetFilterQuery targetFilterQuery = this.targetFilterQueryManagement
.findTargetFilterQueryById((Long) clickedButton.getData());
managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery);
eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery);
this.eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
}
protected void processButtonClick(final ClickEvent event) {
@@ -77,12 +76,12 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
}
protected void clearAppliedTargetFilterQuery() {
if (getAlreadyClickedButton().isPresent()) {
getAlreadyClickedButton().get().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
setAlreadyClickedButton(Optional.empty());
if (getAlreadyClickedButton() != null) {
getAlreadyClickedButton().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
setAlreadyClickedButton(null);
}
managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
this.eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
}
protected void setDefaultButtonClicked(final Button button) {

View File

@@ -8,12 +8,14 @@
*/
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
import java.io.Serializable;
import com.vaadin.ui.Component;
/**
* Interface to be implemented by any tenant specific configuration to show on
* the UI.
*
*
*
*
*
@@ -48,7 +50,7 @@ public interface TenantConfigurationItem extends Component {
/**
* Adds a configuration change listener to notify about configuration
* changes.
*
*
* @param listener
* the listener to be notified in case the item changes some
* configuration
@@ -58,11 +60,12 @@ public interface TenantConfigurationItem extends Component {
/**
* Configuration Change Listener to be notified about configuration changes
* in configuration item.
*
*
*
*
*/
interface TenantConfigurationChangeListener {
@FunctionalInterface
interface TenantConfigurationChangeListener extends Serializable {
/**
* called to notify about configuration has been changed.
*/

View File

@@ -263,14 +263,13 @@ public final class HawkbitCommonUtil {
public static String concatStrings(final String delimiter, final String... texts) {
final String delim = delimiter == null ? SP_STRING_EMPTY : delimiter;
final StringBuilder conCatStrBldr = new StringBuilder();
String conCatedStr = null;
if (null != texts) {
for (final String text : texts) {
conCatStrBldr.append(delim);
conCatStrBldr.append(text);
}
}
conCatedStr = conCatStrBldr.toString();
final String conCatedStr = conCatStrBldr.toString();
return delim.length() > 0 && conCatedStr.startsWith(delim) ? conCatedStr.substring(1) : conCatedStr;
}
@@ -343,31 +342,6 @@ public final class HawkbitCommonUtil {
return labelId.toString();
}
/**
* Check if two objects are same or not.
*
* @param obj1
* as reference
* @param obj2
* as reference
* @return true if both obj1 & obj2 are null (or) if the .equals() method
* return true. false if only either one of obj1 & obj2 is null (or)
* if .equals() method return false.
*/
public static boolean bothSame(final Object obj1, final Object obj2) {
boolean result = false;
if (obj1 == null && obj2 == null) {
result = true;
} else if (obj1 == null && obj2 != null) {
result = false;
} else if (obj1 != null && obj2 == null) {
result = false;
} else {
result = obj2.equals(obj1);
}
return result;
}
/**
* Get label with software module name and description.
*
@@ -725,7 +699,7 @@ public final class HawkbitCommonUtil {
final UserDetailsService idManagement = SpringContextHelper.getBean(UserDetailsService.class);
try {
imReslovedUser = HawkbitCommonUtil.getFormattedName(idManagement.loadUserByUsername(uuid));
} catch (final UsernameNotFoundException e) {
} catch (final UsernameNotFoundException e) { // NOSONAR
// nope not need to handle
}
// If Null display the UID
@@ -982,12 +956,10 @@ public final class HawkbitCommonUtil {
* @return instance of {@link LazyQueryContainer}.
*/
public static LazyQueryContainer createLazyQueryContainer(
final BeanQueryFactory<? extends AbstractBeanQuery> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<>();
queryFactory.setQueryConfiguration(queryConfig);
final LazyQueryContainer typeContainer = new LazyQueryContainer(
new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), queryFactory);
return typeContainer;
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), queryFactory);
}
/**
@@ -998,12 +970,10 @@ public final class HawkbitCommonUtil {
* @return LazyQueryContainer
*/
public static LazyQueryContainer createDSLazyQueryContainer(
final BeanQueryFactory<? extends AbstractBeanQuery> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<>();
queryFactory.setQueryConfiguration(queryConfig);
final LazyQueryContainer typeContainer = new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"),
queryFactory);
return typeContainer;
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"), queryFactory);
}
/**
@@ -1037,7 +1007,7 @@ public final class HawkbitCommonUtil {
*/
public static List<TableColumn> getTableVisibleColumns(final Boolean isMaximized, final Boolean isShowPinColumn,
final I18N i18n) {
final List<TableColumn> columnList = new ArrayList<TableColumn>();
final List<TableColumn> columnList = new ArrayList<>();
if (isMaximized) {
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get(HEADER_NAME), 0.2f));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get(HEADER_VERSION), 0.1f));