Fix issues from static code analysis

Signed-off-by: Marcel Mager (INST-IOT/ESB) <Marcel.Mager@bosch-si.com>
This commit is contained in:
Marcel Mager (INST-IOT/ESB)
2016-09-22 10:28:08 +02:00
parent b790072d1f
commit 07a158534f
8 changed files with 215 additions and 83 deletions

View File

@@ -0,0 +1,151 @@
package org.eclipse.hawkbit.repository;
import java.util.Collection;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
/**
* Encapsulates a set of filters that may be specified (optionally). Properties
* that are not specified (e.g. <code>null</code> for simple properties) When
* applied, these filters are AND-gated.
*
*/
public class FilterParams {
Collection<TargetUpdateStatus> filterByStatus;
Boolean overdueState;
String filterBySearchText;
Boolean selectTargetWithNoTag;
String[] filterByTagNames;
Long filterByDistributionId;
public FilterParams(Long filterByDistributionId, Collection<TargetUpdateStatus> filterByStatus,
Boolean overdueState, String filterBySearchText, Boolean selectTargetWithNoTag,
String... filterByTagNames) {
this.filterByStatus = filterByStatus;
this.overdueState = overdueState;
this.filterBySearchText = filterBySearchText;
this.filterByDistributionId = filterByDistributionId;
this.selectTargetWithNoTag = selectTargetWithNoTag;
this.filterByTagNames = filterByTagNames;
}
/**
* Gets {@link DistributionSet#getId()} to filter the result. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return {@link DistributionSet#getId()} to filter the result
*/
public Long getFilterByDistributionId() {
return filterByDistributionId;
}
/**
* Sets {@link DistributionSet#getId()} to filter the result.
*
* @param filterByDistributionId
*/
public void setFilterByDistributionId(Long filterByDistributionId) {
this.filterByDistributionId = filterByDistributionId;
}
/**
* Gets a collection of target states to filter for. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return collection of target states to filter for
*/
public Collection<TargetUpdateStatus> getFilterByStatus() {
return filterByStatus;
}
/**
* Sets the collection of target states to filter for.
*
* @param filterByStatus
*/
public void setFilterByStatus(Collection<TargetUpdateStatus> filterByStatus) {
this.filterByStatus = filterByStatus;
}
/**
* Gets the flag for overdue filter; if set to <code>true</code>, the
* overdue filter is activated. Overdued targets a targets that did not
* respond during the configured intervals: poll_itvl + overdue_itvl. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return flag for overdue filter activation
*/
public Boolean getOverdueState() {
return overdueState;
}
/**
* Sets the flag for overdue filter; if set to <code>true</code>, the
* overdue filter is activated.
*
* @param overdueState
*/
public void setOverdueState(Boolean overdueState) {
this.overdueState = overdueState;
}
/**
* Gets the search text to filter for. This is used to find targets having
* the text anywhere in name or description <br>
* If set to <code>null</code> this filter is disabled.
*
* @return the search text to filter for
*/
public String getFilterBySearchText() {
return filterBySearchText;
}
/**
* Sets the search text to filter for.
*
* @param filterBySearchText
*/
public void setFilterBySearchText(String filterBySearchText) {
this.filterBySearchText = filterBySearchText;
}
/**
* Gets the flag indicating if tagging filter is used. <br>
* If set to <code>null</code> this filter is disabled.
*
* @return the flag indicating if tagging filter is used
*/
public Boolean getSelectTargetWithNoTag() {
return selectTargetWithNoTag;
}
/**
* Sets the flag indicating if tagging filter is used.
*
* @param selectTargetWithNoTag
*/
public void setSelectTargetWithNoTag(Boolean selectTargetWithNoTag) {
this.selectTargetWithNoTag = selectTargetWithNoTag;
}
/**
* Gets the tags that are used to filter for. The activation of this filter
* is done by {@link #setSelectTargetWithNoTag(Boolean)}.
*
* @return the tags that are used to filter for
*/
public String[] getFilterByTagNames() {
return filterByTagNames;
}
/**
* Sets the tags that are used to filter for.
*
* @param filterByTagNames
*/
public void setFilterByTagNames(String[] filterByTagNames) {
this.filterByTagNames = filterByTagNames;
}
}

View File

@@ -480,36 +480,15 @@ public interface TargetManagement {
* the page request to page the result set
* @param orderByDistributionId
* {@link DistributionSet#getId()} to be ordered by
* @param filterByDistributionId
* {@link DistributionSet#getId()} to be filter the result. Set
* to <code>null</code> in case this is not required.
* @param filterByStatus
* find targets having this {@link TargetUpdateStatus}s. Set to
* <code>null</code> in case this is not required.
* @param overdueState
* find targets that are overdue (targets that did not respond
* during the configured intervals: poll_itvl + overdue_itvl).
* @param filterBySearchText
* to find targets having the text anywhere in name or
* description. Set <code>null</code> in case this is not
* required.
* @param installedOrAssignedDistributionSetId
* to find targets having the {@link DistributionSet} as
* installed or assigned. Set to <code>null</code> in case this
* is not required.
* @param filterByTagNames
* to find targets which are having any one in this tag names.
* Set <code>null</code> in case this is not required.
* @param selectTargetWithNoTag
* flag to select targets with no tag assigned
* @param filterParams
* the filters to apply; only filters are enabled that have
* non-null value; filters are AND-gated
* @return a paged result {@link Page} of the {@link Target}s in a defined
* order.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findTargetsAllOrderByLinkedDistributionSet(@NotNull Pageable pageable,
@NotNull Long orderByDistributionId, Long filterByDistributionId,
Collection<TargetUpdateStatus> filterByStatus, Boolean overdueState, String filterBySearchText,
Boolean selectTargetWithNoTag, String... filterByTagNames);
@NotNull Long orderByDistributionId, FilterParams filterParams);
/**
* retrieves a list of {@link Target}s by their controller ID with details,