Fixed visibility and sonar issues

Signed-off-by: Dominik Herbst <dominik.herbst@bosch-si.com>
This commit is contained in:
Dominik Herbst
2016-09-27 11:10:52 +02:00
parent ab7c2d6a61
commit 405a0aa125
3 changed files with 30 additions and 18 deletions

View File

@@ -21,12 +21,12 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
*/ */
public class FilterParams { public class FilterParams {
Collection<TargetUpdateStatus> filterByStatus; private Collection<TargetUpdateStatus> filterByStatus;
Boolean overdueState; private Boolean overdueState;
String filterBySearchText; private String filterBySearchText;
Boolean selectTargetWithNoTag; private Boolean selectTargetWithNoTag;
String[] filterByTagNames; private String[] filterByTagNames;
Long filterByDistributionId; private Long filterByDistributionId;
/** /**
* Constructor. * Constructor.
@@ -72,6 +72,7 @@ public class FilterParams {
* Sets {@link DistributionSet#getId()} to filter the result. * Sets {@link DistributionSet#getId()} to filter the result.
* *
* @param filterByDistributionId * @param filterByDistributionId
* the distribution set id
*/ */
public void setFilterByDistributionId(Long filterByDistributionId) { public void setFilterByDistributionId(Long filterByDistributionId) {
this.filterByDistributionId = filterByDistributionId; this.filterByDistributionId = filterByDistributionId;
@@ -91,6 +92,7 @@ public class FilterParams {
* Sets the collection of target states to filter for. * Sets the collection of target states to filter for.
* *
* @param filterByStatus * @param filterByStatus
* collection of target update status
*/ */
public void setFilterByStatus(Collection<TargetUpdateStatus> filterByStatus) { public void setFilterByStatus(Collection<TargetUpdateStatus> filterByStatus) {
this.filterByStatus = filterByStatus; this.filterByStatus = filterByStatus;
@@ -113,6 +115,7 @@ public class FilterParams {
* overdue filter is activated. * overdue filter is activated.
* *
* @param overdueState * @param overdueState
* if the overdue filter should be activates
*/ */
public void setOverdueState(Boolean overdueState) { public void setOverdueState(Boolean overdueState) {
this.overdueState = overdueState; this.overdueState = overdueState;
@@ -133,6 +136,7 @@ public class FilterParams {
* Sets the search text to filter for. * Sets the search text to filter for.
* *
* @param filterBySearchText * @param filterBySearchText
* search text
*/ */
public void setFilterBySearchText(String filterBySearchText) { public void setFilterBySearchText(String filterBySearchText) {
this.filterBySearchText = filterBySearchText; this.filterBySearchText = filterBySearchText;
@@ -152,6 +156,7 @@ public class FilterParams {
* Sets the flag indicating if tagging filter is used. * Sets the flag indicating if tagging filter is used.
* *
* @param selectTargetWithNoTag * @param selectTargetWithNoTag
* should the tagging filter be used?
*/ */
public void setSelectTargetWithNoTag(Boolean selectTargetWithNoTag) { public void setSelectTargetWithNoTag(Boolean selectTargetWithNoTag) {
this.selectTargetWithNoTag = selectTargetWithNoTag; this.selectTargetWithNoTag = selectTargetWithNoTag;
@@ -171,6 +176,7 @@ public class FilterParams {
* Sets the tags that are used to filter for. * Sets the tags that are used to filter for.
* *
* @param filterByTagNames * @param filterByTagNames
* array of tag names
*/ */
public void setFilterByTagNames(String[] filterByTagNames) { public void setFilterByTagNames(String[] filterByTagNames) {
this.filterByTagNames = filterByTagNames; this.filterByTagNames = filterByTagNames;

View File

@@ -187,7 +187,6 @@ public final class RSQLUtility {
private final Root<T> root; private final Root<T> root;
private final CriteriaBuilder cb; private final CriteriaBuilder cb;
private final Class<A> enumType; private final Class<A> enumType;
private final VirtualPropertyLookup virtualPropertyLookup;
private final StrSubstitutor substitutor; private final StrSubstitutor substitutor;
private final SimpleTypeConverter simpleTypeConverter; private final SimpleTypeConverter simpleTypeConverter;
@@ -197,10 +196,10 @@ public final class RSQLUtility {
this.root = root; this.root = root;
this.cb = cb; this.cb = cb;
this.enumType = enumType; this.enumType = enumType;
this.virtualPropertyLookup = virtualPropertyLookup; this.substitutor = (virtualPropertyLookup != null)
this.substitutor = new StrSubstitutor(new StrLookupAdapter(virtualPropertyLookup), ? new StrSubstitutor(new StrLookupAdapter(virtualPropertyLookup), StrSubstitutor.DEFAULT_PREFIX,
StrSubstitutor.DEFAULT_PREFIX, StrSubstitutor.DEFAULT_SUFFIX, StrSubstitutor.DEFAULT_ESCAPE)
StrSubstitutor.DEFAULT_SUFFIX, StrSubstitutor.DEFAULT_ESCAPE); : null;
simpleTypeConverter = new SimpleTypeConverter(); simpleTypeConverter = new SimpleTypeConverter();
} }
@@ -222,7 +221,7 @@ public final class RSQLUtility {
return toSingleList(cb.conjunction()); return toSingleList(cb.conjunction());
} }
private List<Predicate> toSingleList(final Predicate predicate) { private static List<Predicate> toSingleList(final Predicate predicate) {
return Collections.singletonList(predicate); return Collections.singletonList(predicate);
} }
@@ -419,7 +418,7 @@ public final class RSQLUtility {
// Exception squid:S2095 - see // Exception squid:S2095 - see
// https://jira.sonarsource.com/browse/SONARJAVA-1478 // https://jira.sonarsource.com/browse/SONARJAVA-1478
@SuppressWarnings({ "rawtypes", "unchecked", "squid:S2095" }) @SuppressWarnings({ "rawtypes", "unchecked", "squid:S2095" })
private Object transformEnumValue(final ComparisonNode node, final String value, private static Object transformEnumValue(final ComparisonNode node, final String value,
final Class<? extends Object> javaType) { final Class<? extends Object> javaType) {
final Class<? extends Enum> tmpEnumType = (Class<? extends Enum>) javaType; final Class<? extends Enum> tmpEnumType = (Class<? extends Enum>) javaType;
try { try {
@@ -447,7 +446,7 @@ public final class RSQLUtility {
final String value; final String value;
// if lookup is available, replace macros ... // if lookup is available, replace macros ...
if (virtualPropertyLookup != null) { if (substitutor != null) {
value = substitutor.replace(values.get(0)); value = substitutor.replace(values.get(0));
} else { } else {
value = values.get(0); value = values.get(0);
@@ -568,12 +567,12 @@ public final class RSQLUtility {
return cb.notEqual(fieldPath, transformedValue); return cb.notEqual(fieldPath, transformedValue);
} }
private String escapeValueToSQL(final String transformedValue) { private static String escapeValueToSQL(final String transformedValue) {
return transformedValue.replace("%", "\\%").replace(LIKE_WILDCARD, '%'); return transformedValue.replace("%", "\\%").replace(LIKE_WILDCARD, '%');
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private <Y> Path<Y> pathOfString(final Path<?> path) { private static <Y> Path<Y> pathOfString(final Path<?> path) {
return (Path<Y>) path; return (Path<Y>) path;
} }

View File

@@ -8,7 +8,14 @@
*/ */
package org.eclipse.hawkbit.ui.management.targettable; package org.eclipse.hawkbit.ui.management.targettable;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.*; import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.FILTER_BY_DISTRIBUTION;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.FILTER_BY_TAG;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.FILTER_BY_TEXT;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.REMOVE_FILTER_BY_TAG;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY;
import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.REMOVE_FILTER_BY_TEXT;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@@ -416,7 +423,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
/** /**
* Add listener to pin. * Add listener to pin.
* *
* @param pinBtn * @param event
* as event * as event
*/ */
private void addPinClickListener(final ClickEvent event) { private void addPinClickListener(final ClickEvent event) {