@Service
class ComponentService(repository: ComponentRepository, val templatedNodeService: TemplatedNodeService, val componentTemplateRepository: ComponentTemplateRepository, val componentPermissionService: ComponentPermissionService, val interfaceSpecificationService: InterfaceSpecificationService, val componentVersionService: ComponentVersionService, val intraComponentDependencySpecificationTypeRepository: IntraComponentDependencySpecificationTypeRepository, val templateService: TemplateService) : TrackableService<Component, ComponentRepository>

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

Parameters

repository

the associated repository used for CRUD functionality

templatedNodeService

service used to update templatedFields

componentTemplateRepository

used to get ComponentTemplate

componentPermissionService

used to create the initial permission for a created Component

interfaceSpecificationService

used to create InterfaceSpecifications

componentVersionService

used to create ComponentVersions

intraComponentDependencySpecificationTypeRepository

Constructors

Link copied to clipboard
constructor(repository: ComponentRepository, templatedNodeService: TemplatedNodeService, componentTemplateRepository: ComponentTemplateRepository, componentPermissionService: ComponentPermissionService, interfaceSpecificationService: InterfaceSpecificationService, componentVersionService: ComponentVersionService, intraComponentDependencySpecificationTypeRepository: IntraComponentDependencySpecificationTypeRepository, templateService: TemplateService)

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
@Autowired
lateinit var nodeRepository: NodeRepository
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

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

Creates multiple new Components based on the provided input Checks the authorization status

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

Checks if the IntraComponentDependencySpecificationTypes are compatible with the new template

Link copied to clipboard

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

Link copied to clipboard

Creates a new Component based on the provided input Does not check the authorization status

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

Deletes a Component 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

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

Link copied to clipboard
private suspend fun updateComponentTemplate(input: UpdateComponentInput, component: Component, updateContext: NodeBatchUpdateContext)

Updates the template of a Component, if a new is defined Does not check the authorization status

Updates the IntraComponentDependencySpecificationTypes where the old type is incompatible with the new template based on typeMapping and removes types with no replacement Adds the updated nodes to updateContext

Link copied to clipboard

Updates node based on input Updates name and description

Link copied to clipboard

Updates node based on input Calls updateNamedAffectedByIssue Updates repositoryURL