@Service
class ProjectService(repository: ProjectRepository, val projectPermissionService: ProjectPermissionService, val componentVersionRepository: ComponentVersionRepository, val layoutService: LayoutService, val viewRepository: ViewRepository) : TrackableService<Project, ProjectRepository>

Service for Projects. Provides functions to create, update and delete

Parameters

repository

the associated repository used for CRUD functionality

projectPermissionService

used to create the initial permission for a created Project

componentVersionRepository

used to get ComponentVersions by id

layoutService

used to update the layout of a Project

viewRepository

used to save the Project

Constructors

Link copied to clipboard
constructor(repository: ProjectRepository, projectPermissionService: ProjectPermissionService, componentVersionRepository: ComponentVersionRepository, layoutService: LayoutService, viewRepository: ViewRepository)

Properties

Link copied to clipboard
Link copied to clipboard
@Autowired
lateinit var authorizationChecker: AuthorizationChecker

Injected, used for the checkPermission function

Link copied to clipboard

Injected, used to get a user based on a GropiusAuthorizationContext

Link copied to clipboard
@Autowired
lateinit var imsProjectService: IMSProjectService
Link copied to clipboard
@Autowired
lateinit var issueService: IssueService

Injected IssueService

Link copied to clipboard
@Autowired
lateinit var labelRepository: LabelRepository
Link copied to clipboard
Link copied to clipboard
@Autowired
lateinit var nodeRepository: NodeRepository
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Adds a ComponentVersion to a Project Checks the authorization status

Link copied to clipboard
suspend fun beforeDeleteTrackable(node: Trackable)

Must be called before node is deleted via the repository Deletes all Artefacts Deletes Labels and Issues, if only present on this Trackable

Link copied to clipboard
suspend fun checkIsAdmin(authorizationContext: GropiusAuthorizationContext, errorMessage: String)

Checks if the user defined by authorizationContext is a global admin

Link copied to clipboard
suspend fun checkPermission(node: Node, permission: Permission, errorMessage: String)

Checks if the permission is granted on node If checkPermission on the permission.context is false, no permission is evaluated Does not handle the case that the user is an admin

Link copied to clipboard
suspend fun createProject(authorizationContext: GropiusAuthorizationContext, input: CreateProjectInput): Project

Creates a new Project based on the provided input Checks the authorization status

Link copied to clipboard
suspend fun deleteProject(authorizationContext: GropiusAuthorizationContext, input: DeleteNodeInput)

Deletes a Project by id Checks the authorization status

Link copied to clipboard
suspend fun evaluatePermission(node: Node, permission: Permission): Boolean

Evaluates if the permission is granted on node If checkPermission on the permission.context is false, no permission is evaluated Does not handle the case that the user is an admin

Link copied to clipboard
suspend fun getUser(authorizationContext: GropiusAuthorizationContext): GropiusUser

Gets a GropiusUser based on the userId from the authorizationContext

Link copied to clipboard

Removes a ComponentVersion from a Project Checks the authorization status

Link copied to clipboard

Updates node based on input Updates name and description

Link copied to clipboard
suspend fun updateProject(authorizationContext: GropiusAuthorizationContext, input: UpdateProjectInput): Project

Updates a Project based on the provided input Checks the authorization status

Link copied to clipboard

Updates node based on input Calls updateNamedAffectedByIssue Updates repositoryURL