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

View File

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

View File

@@ -8,7 +8,14 @@
*/
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.Collection;
@@ -416,7 +423,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
/**
* Add listener to pin.
*
* @param pinBtn
* @param event
* as event
*/
private void addPinClickListener(final ClickEvent event) {