mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-10-19 16:03:19 +00:00
Added ProjectCreationNotification (#2176)
* Added ProjectCreationNotification Signed-off-by: Mark Zeman <zeman@puzzle.ch> * Added test Signed-off-by: Mark Zeman <zeman@puzzle.ch> * Fixed mess after dealing with GitHub Signed-off-by: Mark Zeman <zeman@puzzle.ch> * And redo work lost due to that mess Signed-off-by: Mark Zeman <zeman@puzzle.ch> * Fixed broken tests Signed-off-by: Mark Zeman <zeman@puzzle.ch> * Fixed misunderstanding of createProjectTest Signed-off-by: Mark Zeman <zeman@puzzle.ch> Signed-off-by: Mark Zeman <zeman@puzzle.ch> Closes #2173
This commit is contained in:
parent
82d4aec349
commit
a2cbecca89
7 changed files with 55 additions and 15 deletions
|
@ -24,6 +24,8 @@ import alpine.model.ApiKey;
|
|||
import alpine.model.Permission;
|
||||
import alpine.model.Team;
|
||||
import alpine.model.UserPrincipal;
|
||||
import alpine.notification.Notification;
|
||||
import alpine.notification.NotificationLevel;
|
||||
import alpine.persistence.PaginatedResult;
|
||||
import alpine.resources.AlpineRequest;
|
||||
import com.github.packageurl.PackageURL;
|
||||
|
@ -43,6 +45,10 @@ import org.dependencytrack.model.ProjectProperty;
|
|||
import org.dependencytrack.model.ServiceComponent;
|
||||
import org.dependencytrack.model.Tag;
|
||||
import org.dependencytrack.model.Vulnerability;
|
||||
import org.dependencytrack.notification.NotificationConstants;
|
||||
import org.dependencytrack.notification.NotificationGroup;
|
||||
import org.dependencytrack.notification.NotificationScope;
|
||||
import org.dependencytrack.util.NotificationUtil;
|
||||
|
||||
import javax.jdo.FetchPlan;
|
||||
import javax.jdo.PersistenceManager;
|
||||
|
@ -430,6 +436,14 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
bind(project, resolvedTags);
|
||||
|
||||
Event.dispatch(new IndexEvent(IndexEvent.Action.CREATE, pm.detachCopy(result)));
|
||||
Notification.dispatch(new Notification()
|
||||
.scope(NotificationScope.PORTFOLIO)
|
||||
.group(NotificationGroup.PROJECT_CREATED)
|
||||
.title(NotificationConstants.Title.PROJECT_CREATED)
|
||||
.level(NotificationLevel.INFORMATIONAL)
|
||||
.content(result.getName() + " was created")
|
||||
.subject(NotificationUtil.toJson(pm.detachCopy(result)))
|
||||
);
|
||||
commitSearchIndex(commitIndex, Project.class);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue