mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-10-19 16:03:19 +00:00
Fix project.active
being nullable
Ensure the field defaults to `true`, both in Java and the database. During upgrade, migrate all values that are currently `null` to `true`. Solidify this change by switching `project.active` from `Boolean` to `boolean`. Adjust logic that previously had to check for `null`. Fixes #4410 Signed-off-by: nscuro <nscuro@protonmail.com>
This commit is contained in:
parent
66c36ba0bb
commit
42b91e887a
16 changed files with 157 additions and 65 deletions
|
@ -182,7 +182,7 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
public List<Project> getAllProjects(boolean excludeInactive) {
|
||||
final Query<Project> query = pm.newQuery(Project.class);
|
||||
if (excludeInactive) {
|
||||
query.setFilter("active == true || active == null");
|
||||
query.setFilter("active");
|
||||
}
|
||||
query.setOrdering("id asc");
|
||||
return query.executeList();
|
||||
|
@ -473,9 +473,6 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
if (project.getParent() != null && !Boolean.TRUE.equals(project.getParent().isActive())){
|
||||
throw new IllegalArgumentException("An inactive Parent cannot be selected as parent");
|
||||
}
|
||||
if (project.isActive() == null) {
|
||||
project.setActive(Boolean.TRUE);
|
||||
}
|
||||
final Project oldLatestProject = project.isLatest() ? getLatestProjectVersion(project.getName()) : null;
|
||||
final Project result = callInTransaction(() -> {
|
||||
// Remove isLatest flag from current latest project version, if the new project will be the latest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue