Fixed the sonar issues.

Signed-off-by: Gaurav <gaurav.sahay@in.bosch.com>
This commit is contained in:
Gaurav
2016-08-19 17:25:35 +02:00
parent 381254fa67
commit f7f73ae12c
9 changed files with 47 additions and 52 deletions

View File

@@ -53,17 +53,17 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
@Override
protected String getHeaderCaption() {
return i18n.get("upload.swModuleTable.header");
return softwareHeaderCaption;
}
@Override
protected String getSearchBoxId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
return softwareSerachBoxId;
}
@Override
protected String getSearchRestIconId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON;
return softwareSearchResetIcon;
}
@Override

View File

@@ -332,6 +332,7 @@ public class UploadStatusInfoWindow extends Window {
restoreState();
}
@SuppressWarnings("unchecked")
private void uploadRecevied(final String filename, final SoftwareModule softwareModule) {
final Item item = uploads.addItem(getItemid(filename, softwareModule));
if (item != null) {

View File

@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
@@ -68,6 +69,13 @@ public abstract class AbstractTableHeader extends VerticalLayout {
private Button bulkUploadIcon;
protected String distributionHeaderCaption;
protected String softwareHeaderCaption;
protected String distributionSearchBoxId;
protected String softwareSerachBoxId;
protected String distributionSearchResetIcon;
protected String softwareSearchResetIcon;
/**
* Initialze components.
*/
@@ -85,6 +93,12 @@ public abstract class AbstractTableHeader extends VerticalLayout {
}
private void createComponents() {
distributionHeaderCaption = i18n.get("header.dist.table");
softwareHeaderCaption = i18n.get("upload.swModuleTable.header");
distributionSearchBoxId = SPUIComponentIdProvider.DIST_SEARCH_TEXTFIELD;
softwareSerachBoxId = SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
distributionSearchResetIcon = SPUIComponentIdProvider.DIST_SEARCH_ICON;
softwareSearchResetIcon = SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON;
headerCaption = createHeaderCaption();
searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
@@ -514,4 +528,4 @@ public abstract class AbstractTableHeader extends VerticalLayout {
protected abstract Boolean isBulkUploadAllowed();
}
}

View File

@@ -52,17 +52,17 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
@Override
protected String getHeaderCaption() {
return i18n.get("header.dist.table");
return distributionHeaderCaption;
}
@Override
protected String getSearchBoxId() {
return SPUIComponentIdProvider.DIST_SEARCH_TEXTFIELD;
return distributionSearchBoxId;
}
@Override
protected String getSearchRestIconId() {
return SPUIComponentIdProvider.DIST_SEARCH_ICON;
return distributionSearchResetIcon;
}
@Override

View File

@@ -52,17 +52,17 @@ public class SwModuleTableHeader extends AbstractTableHeader {
@Override
protected String getHeaderCaption() {
return i18n.get("upload.swModuleTable.header");
return softwareHeaderCaption;
}
@Override
protected String getSearchBoxId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
return softwareSerachBoxId;
}
@Override
protected String getSearchRestIconId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON;
return softwareSearchResetIcon;
}
@Override

View File

@@ -139,9 +139,9 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
final Boolean dsVisible = visibleItemIds.stream().filter(e -> e.getId().equals(ds.getId())).findFirst()
.isPresent();
if ((ds.isComplete() && !dsVisible)) {
if (ds.isComplete() && !dsVisible) {
refreshDistributions();
} else if ((!ds.isComplete() && dsVisible)) {
} else if (!ds.isComplete() && dsVisible) {
refreshDistributions();
if (ds.getId().equals(managementUIState.getLastSelectedDsIdName().getId())) {
managementUIState.setLastSelectedDistribution(null);

View File

@@ -54,17 +54,17 @@ public class DistributionTableHeader extends AbstractTableHeader {
@Override
protected String getHeaderCaption() {
return i18n.get("header.dist.table");
return distributionHeaderCaption;
}
@Override
protected String getSearchBoxId() {
return SPUIComponentIdProvider.DIST_SEARCH_TEXTFIELD;
return distributionSearchBoxId;
}
@Override
protected String getSearchRestIconId() {
return SPUIComponentIdProvider.DIST_SEARCH_ICON;
return distributionSearchResetIcon;
}
@Override

View File

@@ -105,9 +105,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
private static final String TARGET_PINNED = "targetPinned";
private static final long serialVersionUID = -2300392868806614568L;
private static final int PROPERTY_DEPT = 3;
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
@@ -127,7 +125,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
private Button targetPinnedBtn;
private Boolean isTargetPinned = Boolean.FALSE;
@Override
@@ -234,17 +231,14 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
protected Container createContainer() {
// ADD all the filters to the query config
final Map<String, Object> queryConfig = prepareQueryConfigFilters();
// Create TargetBeanQuery factory with the query config.
final BeanQueryFactory<TargetBeanQuery> targetQF = new BeanQueryFactory<>(TargetBeanQuery.class);
targetQF.setQueryConfiguration(queryConfig);
// create lazy query container with lazy defination and query
final LazyQueryContainer targetTableContainer = new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_CONT_ID_NAME),
targetQF);
targetTableContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
return targetTableContainer;
}
@@ -339,7 +333,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
shouldRefreshTargets = true;
}
}
if (shouldRefreshTargets) {
refreshOnDelete();
} else {

View File

@@ -1,6 +1,5 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,7 +48,6 @@ import com.vaadin.ui.UI;
* Common util class.
*/
public final class HawkbitCommonUtil {
/**
* Define spaced string.
*/
@@ -58,21 +56,17 @@ public final class HawkbitCommonUtil {
* Define empty string.
*/
public static final String SP_STRING_EMPTY = "";
/**
* Html span.
*/
public static final String SPAN_CLOSE = "</span>";
public static final String HTML_LI_CLOSE_TAG = "</li>";
public static final String HTML_LI_OPEN_TAG = "<li>";
public static final String HTML_UL_CLOSE_TAG = "</ul>";
public static final String HTML_UL_OPEN_TAG = "<ul>";
private static final String JS_DRAG_COUNT_REM_CHILD = " if(x) { document.head.removeChild(x); } ";
public static final String DIV_DESCRIPTION_START = "<div id=\"desc-length\"><p id=\"desciption-p\">";
public static final String DIV_DESCRIPTION_END = "</p></div>";
private static final String DRAG_COUNT_ELEMENT = "var x = document.getElementById('sp-drag-count'); ";
@@ -119,7 +113,7 @@ public final class HawkbitCommonUtil {
/**
* Trim the text and convert into null in case of empty string.
*
*
* @param text
* as text to be trimed
* @return null if the text is null or if the text is blank, text.trim() if
@@ -136,7 +130,7 @@ public final class HawkbitCommonUtil {
/**
* Concatenate the given text all the string arguments with the given
* delimiter.
*
*
* @param delimiter
* the delimiter text to be used while concatenation.
* @param texts
@@ -162,7 +156,7 @@ public final class HawkbitCommonUtil {
/**
* Returns the input text within html bold tag <b>..</b>.
*
*
* @param text
* is the text to be converted in to Bold
* @return null if the input text param is null returns text with <b>...</b>
@@ -181,7 +175,7 @@ public final class HawkbitCommonUtil {
/**
* Get target label Id.
*
*
* @param controllerId
* as String
* @return String as label name
@@ -192,7 +186,7 @@ public final class HawkbitCommonUtil {
/**
* Get distribution table cell id.
*
*
* @param name
* distribution name
* @param version
@@ -205,7 +199,7 @@ public final class HawkbitCommonUtil {
/**
* Get software module label id.
*
*
* @param name
* software module name
* @param version
@@ -218,7 +212,7 @@ public final class HawkbitCommonUtil {
/**
* Get label with software module name and description.
*
*
* @param name
* software module name
* @param desc
@@ -233,7 +227,7 @@ public final class HawkbitCommonUtil {
/**
* Get Label for Artifact Details.
*
*
* @param name
* @return
*/
@@ -245,7 +239,7 @@ public final class HawkbitCommonUtil {
/**
* Get Label for Artifact Details.
*
*
* @param caption
* as caption of the details
* @param name
@@ -260,7 +254,7 @@ public final class HawkbitCommonUtil {
/**
* Get Label for Action History Details.
*
*
* @param name
* @return
*/
@@ -272,7 +266,7 @@ public final class HawkbitCommonUtil {
/**
* Get tool tip for Poll status.
*
*
* @param pollStatus
* @param i18N
* @return
@@ -290,7 +284,7 @@ public final class HawkbitCommonUtil {
/**
* Null check for text.
*
*
* @param orgText
* text to be formatted
* @return String formatted text
@@ -302,7 +296,7 @@ public final class HawkbitCommonUtil {
/**
* Find extra height required to increase by all the components to utilize
* the full height of browser for the responsive UI.
*
*
* @param newBrowserHeight
* as current browser height.
* @return extra height required to increase.
@@ -314,7 +308,7 @@ public final class HawkbitCommonUtil {
/**
* Find required extra height of software module.
*
*
* @param newBrowserHeight
* new browser height
* @return float heigth of software module table
@@ -354,8 +348,6 @@ public final class HawkbitCommonUtil {
}
/**
*
*
* @param newBrowserHeight
* new browser height
* @param minPopupHeight
@@ -401,7 +393,7 @@ public final class HawkbitCommonUtil {
/**
* Get target table width based on screen width.
*
*
* @param newBrowserWidth
* new browser width.
* @param minTargetTableLength
@@ -553,8 +545,8 @@ public final class HawkbitCommonUtil {
}
/**
Duplicate check - Unique Key.
*
* Duplicate check - Unique Key.
*
* @param name
* as string
* @param version
@@ -635,11 +627,9 @@ Duplicate check - Unique Key.
final int assignedCount = result.getAssigned();
final int alreadyAssignedCount = result.getAlreadyAssigned();
final int unassignedCount = result.getUnassigned();
if (assignedCount == 1) {
formMsg.append(i18n.get("message.target.assigned.one",
new Object[] { result.getAssignedEntity().get(0).getName(), tagName })).append("<br>");
} else if (assignedCount > 1) {
formMsg.append(i18n.get("message.target.assigned.many", new Object[] { assignedCount, tagName }))
.append("<br>");
@@ -650,11 +640,9 @@ Duplicate check - Unique Key.
formMsg.append(alreadyAssigned).append("<br>");
}
}
if (unassignedCount == 1) {
formMsg.append(i18n.get("message.target.unassigned.one",
new Object[] { result.getUnassignedEntity().get(0).getName(), tagName })).append("<br>");
} else if (unassignedCount > 1) {
formMsg.append(i18n.get("message.target.unassigned.many", new Object[] { unassignedCount, tagName }))
.append("<br>");
@@ -679,7 +667,6 @@ Duplicate check - Unique Key.
}
/**
*
* Create lazy query container for DS type.
*
* @param queryFactory