mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-10-31 21:50:55 +00:00
#1501 - Adding ability to exclude inactive projects when querying by tag
Signed-off-by: Steve Springett <steve@springett.us>
This commit is contained in:
parent
a53bcd7592
commit
87675e4f62
3 changed files with 14 additions and 8 deletions
|
|
@ -227,10 +227,15 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
* @param tag the tag associated with the Project
|
||||
* @return a List of Projects that contain the tag
|
||||
*/
|
||||
public PaginatedResult getProjects(final Tag tag, final boolean includeMetrics) {
|
||||
public PaginatedResult getProjects(final Tag tag, final boolean includeMetrics, final boolean excludeInactive) {
|
||||
final PaginatedResult result;
|
||||
final Query<Project> query = pm.newQuery(Project.class);
|
||||
final String queryFilter = "(tags.contains(:tag))";
|
||||
final String queryFilter;
|
||||
if (excludeInactive) {
|
||||
queryFilter = "(tags.contains(:tag)) && (active == true || active == null))";
|
||||
} else {
|
||||
queryFilter = "(tags.contains(:tag))";
|
||||
}
|
||||
if (orderBy == null) {
|
||||
query.setOrdering("name asc");
|
||||
}
|
||||
|
|
@ -254,7 +259,7 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
* @return a List of Projects that contain the tag
|
||||
*/
|
||||
public PaginatedResult getProjects(final Tag tag) {
|
||||
return getProjects(tag, false);
|
||||
return getProjects(tag, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue