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 @Override
protected String getHeaderCaption() { protected String getHeaderCaption() {
return i18n.get("upload.swModuleTable.header"); return softwareHeaderCaption;
} }
@Override @Override
protected String getSearchBoxId() { protected String getSearchBoxId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD; return softwareSerachBoxId;
} }
@Override @Override
protected String getSearchRestIconId() { protected String getSearchRestIconId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON; return softwareSearchResetIcon;
} }
@Override @Override

View File

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

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.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N; 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.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -68,6 +69,13 @@ public abstract class AbstractTableHeader extends VerticalLayout {
private Button bulkUploadIcon; private Button bulkUploadIcon;
protected String distributionHeaderCaption;
protected String softwareHeaderCaption;
protected String distributionSearchBoxId;
protected String softwareSerachBoxId;
protected String distributionSearchResetIcon;
protected String softwareSearchResetIcon;
/** /**
* Initialze components. * Initialze components.
*/ */
@@ -85,6 +93,12 @@ public abstract class AbstractTableHeader extends VerticalLayout {
} }
private void createComponents() { 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(); headerCaption = createHeaderCaption();
searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText())); searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
@@ -514,4 +528,4 @@ public abstract class AbstractTableHeader extends VerticalLayout {
protected abstract Boolean isBulkUploadAllowed(); protected abstract Boolean isBulkUploadAllowed();
} }

View File

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

View File

@@ -52,17 +52,17 @@ public class SwModuleTableHeader extends AbstractTableHeader {
@Override @Override
protected String getHeaderCaption() { protected String getHeaderCaption() {
return i18n.get("upload.swModuleTable.header"); return softwareHeaderCaption;
} }
@Override @Override
protected String getSearchBoxId() { protected String getSearchBoxId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD; return softwareSerachBoxId;
} }
@Override @Override
protected String getSearchRestIconId() { protected String getSearchRestIconId() {
return SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON; return softwareSearchResetIcon;
} }
@Override @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() final Boolean dsVisible = visibleItemIds.stream().filter(e -> e.getId().equals(ds.getId())).findFirst()
.isPresent(); .isPresent();
if ((ds.isComplete() && !dsVisible)) { if (ds.isComplete() && !dsVisible) {
refreshDistributions(); refreshDistributions();
} else if ((!ds.isComplete() && dsVisible)) { } else if (!ds.isComplete() && dsVisible) {
refreshDistributions(); refreshDistributions();
if (ds.getId().equals(managementUIState.getLastSelectedDsIdName().getId())) { if (ds.getId().equals(managementUIState.getLastSelectedDsIdName().getId())) {
managementUIState.setLastSelectedDistribution(null); managementUIState.setLastSelectedDistribution(null);

View File

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

View File

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