@Service
class IssueService(repository: IssueRepository, val labelRepository: LabelRepository, val timelineItemRepository: TimelineItemRepository, val artefactRepository: ArtefactRepository, val trackableRepository: TrackableRepository, val issuePriorityRepository: IssuePriorityRepository, val issueTypeRepository: IssueTypeRepository, val issueStateRepository: IssueStateRepository, val affectedByIssueRepository: AffectedByIssueRepository, val templatedNodeService: TemplatedNodeService, val jsonNodeMapper: JsonNodeMapper, val userRepository: UserRepository, val assignmentRepository: AssignmentRepository, val assignmentTypeRepository: AssignmentTypeRepository, val issueRelationRepository: IssueRelationRepository, val issueRelationTypeRepository: IssueRelationTypeRepository, val issueCommentRepository: IssueCommentRepository, val bodyRepository: BodyRepository, val commentRepository: CommentRepository, val issueTemplateRepository: IssueTemplateRepository, val nodeRepository: NodeRepository, val templateService: TemplateService) : AuditedNodeService<Issue, IssueRepository>

Service for Issues. Provides function to update the deprecation status

Parameters

repository

the associated repository used for CRUD functionality

labelRepository

used to find Labels by id

timelineItemRepository

used to save TimelineItems

artefactRepository

used to find Artefacts by id

trackableRepository

used to find Trackables by id

issuePriorityRepository

used to find IssuePrioritys by id

issueTypeRepository

used to find IssueTypes by id

issueStateRepository

used to find IssueStates by id

affectedByIssueRepository

used to find AffectedByIssues by id

templatedNodeService

used to validate and update templated fields

jsonNodeMapper

used to serialize templated fields

userRepository

used to find Users by id

assignmentRepository

used to find Assignments by id

assignmentTypeRepository

used to find AssignmentTypes by id

issueRelationRepository

used to find IssueRelations by id

issueRelationTypeRepository

used to find IssueRelationTypes by id

issueCommentRepository

used to find IssueComments by id

bodyRepository

used to find Bodys by id

commentRepository

used to find Comments by id

issueTemplateRepository

used to find IssueTemplates by id

nodeRepository

used to delete Nodes

Constructors

Link copied to clipboard
constructor(repository: IssueRepository, labelRepository: LabelRepository, timelineItemRepository: TimelineItemRepository, artefactRepository: ArtefactRepository, trackableRepository: TrackableRepository, issuePriorityRepository: IssuePriorityRepository, issueTypeRepository: IssueTypeRepository, issueStateRepository: IssueStateRepository, affectedByIssueRepository: AffectedByIssueRepository, templatedNodeService: TemplatedNodeService, jsonNodeMapper: JsonNodeMapper, userRepository: UserRepository, assignmentRepository: AssignmentRepository, assignmentTypeRepository: AssignmentTypeRepository, issueRelationRepository: IssueRelationRepository, issueRelationTypeRepository: IssueRelationTypeRepository, issueCommentRepository: IssueCommentRepository, bodyRepository: BodyRepository, commentRepository: CommentRepository, issueTemplateRepository: IssueTemplateRepository, nodeRepository: NodeRepository, templateService: TemplateService)

Properties

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

Injected, used for the checkPermission function

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Injected, used to get a user based on a GropiusAuthorizationContext

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Adds an AffectedByIssue to an Issue, returns the created AddedAffectedEntityEvent, or null if the AffectedByIssue was already on the Issue. Checks the authorization status.

suspend fun addAffectedEntityToIssue(issue: Issue, affectedEntity: AffectedByIssue, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): AddedAffectedEntityEvent

Adds an affectedEntity to an issue at atTime as byUser and adds a AddedAffectedEntityEvent to the timeline. Creates the event even if the affectedEntity was already affected by the issue. Only adds the affectedEntity to the affects on the issue if no newer timeline item exists which removes it again. Does not check the authorization status. Does neither save the created AddedToPinnedIssuesEvent nor the issue. It is necessary to save the issue or returned AddedAffectedEntityEvent afterwards.

Link copied to clipboard
private suspend fun addArtefactsToIssueComment(issueComment: IssueComment, referencedArtefacts: List<Artefact>)

Adds referencedArtefacts to the referencedArtefacts of issueComment Does not mark the issueComment as updated

Link copied to clipboard

Adds a Artefact to an Issue, returns the created AddedArtefactEvent, or null if the Artefact was already present on the Issue. Checks the authorization status, checks that the Artefact can be added to the Issue

suspend fun addArtefactToIssue(issue: Issue, artefact: Artefact, atTime: OffsetDateTime, byUser: User): AddedArtefactEvent

Adds a artefact to an issue at atTime as byUser and adds a AddedArtefactEvent to the timeline. Creates the event even if the artefact was already on the issue. Only adds the artefact to the issue if no newer timeline item exists which removes it again. Does not check the authorization status. Check if the artefact can be added to this issue. Does neither save the created AddedArtefactEvent nor the issue. It is necessary to save the issue or returned AddedArtefactEvent afterwards.

Link copied to clipboard

Pins an Issue on a Trackable, returns the created AddedToPinnedIssuesEvent, or null if the Issue was already pinned on the Trackable. Checks the authorization status, checks that the Issue can be pinned on the Trackable

suspend fun addIssueToPinnedIssues(issue: Issue, trackable: Trackable, atTime: OffsetDateTime, byUser: User): AddedToPinnedIssuesEvent

Pins an issue on trackable at atTime as byUser and adds a AddedToPinnedIssuesEvent to the timeline. Creates the event even if the issue was already pinned on the trackable. Only adds the issue to the pinnedIssues on trackable if no newer timeline item exists which removes it again. Does not check the authorization status. Checks if the issue can be pinned to this trackable. Does neither save the created AddedToPinnedIssuesEvent nor the issue. It is necessary to save the issue or returned AddedToPinnedIssuesEvent afterwards.

Link copied to clipboard

Adds an Issue to a Trackable, returns the created AddedToTrackableEvent, or null if the Issue was already on the Trackable. Checks the authorization status

suspend fun addIssueToTrackable(issue: Issue, trackable: Trackable, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): AddedToTrackableEvent

Adds an issue to a trackable at atTime as byUser and adds a AddedToTrackableEvent to the timeline. Creates the event even if the issue was already on the trackable. Only adds the issue to the trackable if no newer timeline item exists which removes it again. Does not check the authorization status. Does neither save the created AddedToTrackableEvent nor the issue. It is necessary to save the issue or returned AddedToTrackableEvent afterwards.

Link copied to clipboard

Adds a Label to an Issue, returns the created AddedLabelEvent, or null if the Label was already present on the Issue. Checks the authorization status, checks that the Label can be added to the Issue

suspend fun addLabelToIssue(issue: Issue, label: Label, atTime: OffsetDateTime, byUser: User): AddedLabelEvent

Adds a label to an issue at atTime as byUser and adds a AddedLabelEvent to the timeline. Creates the event even if the label was already on the issue. Only adds the label to the issue if no newer timeline item exists which removes it again. Does not check the authorization status. Checks if the label can be added to this issue. Does neither save the created AddedLabelEvent nor the issue. It is necessary to save the issue or returned AddedLabelEvent afterwards.

Link copied to clipboard

Changes the type of an Assignment, returns the created AssignmentTypeChangedEvent or null if the type was not changed. Checks the authorization status, and checks that the new AssignmentType can be used with the Issue the Assignment is on.

suspend fun changeAssignmentType(assignment: Assignment, oldType: AssignmentType?, newType: AssignmentType?, atTime: OffsetDateTime, byUser: User): AssignmentTypeChangedEvent

Changes the type of an assignment at atTime as byUser and adds a AssignmentTypeChangedEvent to the timeline. Creates the event even if the type was not changed. Only changes the type if no newer timeline item exists which changes it. Does not check the authorization status. Checks that the newType can be used with the Issue the assignment is on. Does neither save the created AssignmentTypeChangedEvent nor the assignment nor the Issue. It is necessary to save the assignment, the returned AssignmentTypeChangedEvent or the Issue the assignment is on afterwards.

Link copied to clipboard

Changes the priority of an Issue, returns the created PriorityChangedEvent or null if the priority was not changed. Checks the authorization status, and check that the new IssuePriority can be used on the Issue

suspend fun changeIssuePriority(issue: Issue, oldPriority: IssuePriority?, newPriority: IssuePriority?, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext?): PriorityChangedEvent

Changes the priority of an issue at atTime as byUser and adds a PriorityChangedEvent to the timeline. Creates the event even if the priority was not changed. Only changes the priority if no newer timeline item exists which changes it. Does not check the authorization status. Checks that the newPriority can be used on the issue. Does neither save the created PriorityChangedEvent nor the issue. It is necessary to save the issue or returned PriorityChangedEvent afterwards.

Link copied to clipboard
private suspend fun <T, E : TimelineItem> changeIssueProperty(authorizationContext: GropiusAuthorizationContext, issue: Issue, currentValue: T, newValue: T, internalFunction: suspend (issue: Issue, oldValue: T, newValue: T, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext) -> E): E?

Changes a property of issue, returns the created event or null if the property was not changed. Checks the authorization status (TrackablePermission.MANAGE_ISSUES on the issue)

private inline suspend fun <T, E : TimelineItem> changeIssueProperty(issue: Issue, newValue: T, atTime: OffsetDateTime, byUser: User, property: KMutableProperty0<T>, event: E)

Changes a property of an issue at atTime as byUser and adds the event to the timeline. Only changes the property if no newer timeline item exists which changes it. Does not check the authorization status. Does neither save the event nor the issue. Calls createdTimelineItem on the event.

Link copied to clipboard

Changes the type of an IssueRelation, returns the created OutgoingRelationTypeChangedEvent or null if the type was not changed. Checks the authorization status, and checks that the new IssueRelationType can be used with the Issue the IssueRelation starts at.

Changes the type of an issueRelation at atTime as byUser and adds a OutgoingRelationTypeChangedEvent to the timeline on the start Issue, and an IncomingRelationTypeChangedEvent to the timeline on the related Issue. Creates the event even if the type was not changed. Only changes the type if no newer timeline item exists which changes it, this is only checked on the start Issue. Does not check the authorization status. Checks that the newType can be used with the Issue the issueRelation is on. Does neither save the created OutgoingRelationTypeChangedEvent nor the issueRelation nor the Issue. It is necessary to save the issueRelation, the returned OutgoingRelationTypeChangedEvent or the Issue the issueRelation is on afterwards. Caution: it is also necessary to save the related Issue manually!

Link copied to clipboard

Changes the state of an Issue, returns the created StateChangedEvent or null if the state was not changed. Checks the authorization status, and checks that the new IssueState can be used on the Issue

suspend fun changeIssueState(issue: Issue, oldState: IssueState, newState: IssueState, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext?): StateChangedEvent

Changes the state of an issue at atTime as byUser and adds a StateChangedEvent to the timeline. Creates the event even if the state was not changed. Only changes the state if no newer timeline item exists which changes it. Does not check the authorization status. Checks that the newState can be used with the issue. Does neither save the created StateChangedEvent nor the issue. It is necessary to save the issue or returned StateChangedEvent afterwards.

Link copied to clipboard

Changes the template of an Issue, return the created TemplateChangedEvent or null if the Issue was already pinned on the Trackable. Checks the authorization status, checks that all inputs are compatible with the new template.

suspend fun changeIssueTemplate(issue: Issue, oldTemplate: IssueTemplate, newTemplate: IssueTemplate, templatedFields: List<JSONFieldInput>, type: IssueType?, state: IssueState?, priority: IssuePriority?, assignmentTypeMapping: Map<AssignmentType, AssignmentType?>, issueRelationTypeMapping: Map<IssueRelationType, IssueRelationType?>, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): TemplateChangedEvent

Changes the template of an Issue, return the created TemplateChangedEvent. Also creates the TemplateChangedEvent if the template of the issue does not change. Uses templatedFields, type, state, priority, assignmentTypeMapping and issueRelationTypeMapping to enforce compatibility with the new template, however only updates fields which are incompatible with the new template. Does not check the authorization status. Checks that all inputs are compatible with the new template, and checks that the templatedFields are valid after the update.

Link copied to clipboard

Changes the value of a templated field on an Issue, returns the created TemplatedFieldChangedEvent or null if the value of the templated field was not changed. Checks the authorization status, and checks that the field exists and the value is compatible.

suspend fun changeIssueTemplatedField(issue: Issue, field: JSONFieldInput, oldValue: String?, atTime: OffsetDateTime, byUser: User): TemplatedFieldChangedEvent

Changes the value of a templated field on an issue at atTime as byUser and adds a TemplatedFieldChangedEvent to the timeline. Creates the event even if the templated field was not changed. Only changes the value of the templated field if no newer timeline item exists which changes it. Does not check the authorization status. Checks that the templated field exists and that the value is compatible. Does neither save the created TemplatedFieldChangedEvent nor the issue. It is necessary to save the issue or returned TemplatedFieldChangedEvent afterwards.

Link copied to clipboard

Changes the title of an Issue, returns the created TitleChangedEvent or null if the title was not changed. Checks the authorization status

suspend fun changeIssueTitle(issue: Issue, oldTitle: String, newTitle: String, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): TitleChangedEvent

Changes the title of an issue at atTime as byUser and adds a TitleChangedEvent to the timeline. Creates the event even if the title was not changed. Only changes the title if no newer timeline item exists which changes it. Does not check the authorization status. Does neither save the created TitleChangedEvent nor the issue. It is necessary to save the issue or returned TitleChangedEvent afterwards.

Link copied to clipboard

Changes the type of an Issue, returns the created TypeChangedEvent or null if the type was not changed. Checks the authorization status, and checks that the new IssueType can be used with the Issue

suspend fun changeIssueType(issue: Issue, oldType: IssueType, newType: IssueType, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext?): TypeChangedEvent

Changes the type of an issue at atTime as byUser and adds a TypeChangedEvent to the timeline. Creates the event even if the type was not changed. Only changes the type if no newer timeline item exists which changes it. Does not check the authorization status. Checks that the newType can be used with the issue. Does neither save the created TypeChangedEvent nor the issue. It is necessary to save the issue or returned TypeChangedEvent afterwards.

Link copied to clipboard
private suspend fun checkAssignmentTypeCompatibility(issue: Issue, newType: AssignmentType)

Checks that the type of an Assignment on issue can be changed to newType

Link copied to clipboard
private suspend fun checkCommentEditPermission(comment: Comment, user: GropiusUser, authorizationContext: GropiusAuthorizationContext)

Checks that a user has the permission to update a comment

Link copied to clipboard
private suspend fun checkCreateIssuesPermission(trackable: Trackable, authorizationContext: GropiusAuthorizationContext)

Checks that the user has TrackablePermission.CREATE_ISSUES on 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
private suspend fun checkIssuePriorityCompatibility(issue: Issue, newPriority: IssuePriority)

Checks that the priority of an issue can be changed to newPriority

Link copied to clipboard
private suspend fun checkIssueRelationTypeCompatibility(issue: Issue, newType: IssueRelationType)

Checks that the type of an IssueRelation on issue can be changed to newType

Link copied to clipboard
private suspend fun checkIssueStateCompatibility(issue: Issue, newState: IssueState)

Checks that the state of an issue can be changed to newState

Link copied to clipboard
private suspend fun checkIssueTypeCompatibility(issue: Issue, newType: IssueType)

Checks that the type of an issue can be changed to newType

Link copied to clipboard
private suspend fun checkManageIssuesPermission(trackable: Trackable, authorizationContext: GropiusAuthorizationContext)

Checks that the user has TrackablePermission.MANAGE_ISSUES on trackable

private suspend fun checkManageIssuesPermission(issue: Issue, authorizationContext: GropiusAuthorizationContext)

Checks that the user has TrackablePermission.MANAGE_ISSUES on issue

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

Creates a new Assignment, returns the created Assignment. Checks the authorization status, and checks that the chosen type is compatible with the template of the Issue.

suspend fun createAssignment(issue: Issue, user: User, assignmentType: AssignmentType?, atTime: OffsetDateTime, byUser: User): Assignment

Creates a new Assignment on an issue at atTime as byUser. Does not check the authorization status. If present, checks that the assignmentType is compatible with the template of the issue. Does neither save the created Assignment nor the issue. It is necessary to save the issue or returned Assignment afterwards.

Link copied to clipboard
suspend fun createdAuditedNode(node: AuditedNode, createdBy: User)

Updates node after it was created without an Input Should be called after the node was constructed Sets AuditedNode.createdBy and AuditedNode.lastModifiedBy

Link copied to clipboard
private suspend fun createdTimelineItem(issue: Issue, timelineItem: TimelineItem, atTime: OffsetDateTime, byUser: User)

Called after a TimelineItem was created Adds it to the issue, calls createdAuditedNode and updates Issue.lastUpdatedAt and Issue.participants. Also calls updateAuditedNode on the issue. Also sets TimelineItem.issue, to allow to save timelineItem instead of issue.

Link copied to clipboard
private suspend fun createdTimelineItemOnRelatedIssue(issue: Issue, timelineItem: TimelineItem, atTime: OffsetDateTime, byUser: User)

Called after a TimelineItem was created on a related Issue Adds it to the issue, calls createdAuditedNode and updates Issue.lastModifiedAt and Issue.lastUpdatedAt Also sets TimelineItem.issue, to allow to save timelineItem instead of issue. Due to confidentiality reasons, Issue.participants, Issue.lastModifiedBy are not updated.

Link copied to clipboard
suspend fun createIssue(authorizationContext: GropiusAuthorizationContext, input: CreateIssueInput): Issue

Creates an Issue. Checks the authorization status, checks that the type, state and templatedFields are compatible with the template

suspend fun createIssue(trackables: List<Trackable>, template: IssueTemplate, title: String, body: String, type: IssueType, state: IssueState, templatedFields: List<JSONFieldInput>, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): Issue

Creates an Issue at atTime as byUser on trackables. Also creates the Body of the Issue. Does not check the authorization status. Checks that trackables is not empty, checks that the type, state and templatedFields are compatible with template. Does not save the created Issue, it is required to save the returned Issue afterwards.

Link copied to clipboard

Creates a new IssueComment, returns the created IssueComment. Checks the authorization status, and checks that the referenced Artefact can be used on the Issue. Also, checks that the Comment it answers, if present, is on the same Issue

suspend fun createIssueComment(issue: Issue, answers: Comment?, body: String, referencedArtefacts: List<Artefact>, atTime: OffsetDateTime, byUser: User): IssueComment

Creates a new IssueComment on issue at atTime as byUser. Does not check the authorization status. Checks for each Artefact in referencedArtefacts that it is on a Trackable the issue is on. If present, checks that the Comment it answers is on the same issue. Does neither save the created IssueComment nor the issue. It is necessary to save the issue or returned IssueRelation afterwards.

Link copied to clipboard

Creates a new IssueRelation, returns the created IssueRelation. Checks the authorization status, and checks that the chosen type is compatible with the template of the Issue.

suspend fun createIssueRelation(issue: Issue, relatedIssue: Issue, issueRelationType: IssueRelationType?, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): IssueRelation

Creates a new IssueRelation from issue to relatedIssue at atTime as byUser and adds it to the timeline of issue. Also creates a RelatedByIssueEvent and adds it to the timeline of relatedIssue. Does not check the authorization status. If present, checks that the issueRelationType is compatible with the template of the issue. Does neither save the created IssueRelation nor the issue. It is necessary to save the issue or returned IssueRelation afterwards.

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

Deletes an Issue. Checks the authorization status

Link copied to clipboard

Deletes an IssueComment, returns the deleted IssueComment. Checks the authorization status.

suspend fun deleteIssueComment(issueComment: IssueComment, atTime: OffsetDateTime, byUser: User)

Deletes an issueComment at atTime as byUser. Does not check the authorization status. Does not save the deleted IssueComment. It is necessary to save the deleted issueComment afterwards.

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
private inline suspend fun <T : TimelineItem> existsNewerTimelineItem(issue: Issue, time: OffsetDateTime, itemFilter: (T) -> Boolean = { true }): Boolean

Checks if a TimelineItem with type T exists on issue created after time matching itemFilter

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

Gets a GropiusUser based on the userId from the authorizationContext

Link copied to clipboard
suspend fun prepareIssueDeletion(node: Issue): Collection<Node>

Gets all nodes to delete when this Issue is deleted, including the Issue itself. Also performs other updates necessary when deleting an Issue.

Link copied to clipboard

Removes an AffectedByIssue from an Issue, returns the created RemovedAffectedEntityEvent, or null if the AffectedByIssue was not affected by the Issue. Checks the authorization status

suspend fun removeAffectedEntityFromIssue(issue: Issue, affectedEntity: AffectedByIssue, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): RemovedAffectedEntityEvent

Removes an affectedEntity from an issue at atTime as byUser and adds a RemovedAffectedEntityEvent to the timeline. Creates the event even if the affectedEntity was not affected by the issue. Only removes the affectedEntity from the affects on the issue if no newer timeline item exists which adds it again. Does not check the authorization status. Does neither save the created RemovedAffectedEntityEvent nor the issue. It is necessary to save the issue or returned RemovedAffectedEntityEvent afterwards.

Link copied to clipboard

Removes a Artefact from an Issue, returns the created RemovedArtefactEvent, or null if the Artefact was not present on the Issue. Checks the authorization status

suspend fun removeArtefactFromIssue(issue: Issue, artefact: Artefact, atTime: OffsetDateTime, byUser: User): RemovedArtefactEvent

Removes a artefact from an issue at atTime as byUser and adds a RemovedArtefactEvent to the timeline. Creates the event even if the artefact was not on the issue. Only removes the artefact from the issue if no newer timeline item exists which adds it again. Does not check the authorization status. Does neither save the created RemovedArtefactEvent nor the issue. It is necessary to save the issue or returned RemovedArtefactEvent afterwards.

Link copied to clipboard

Removes an Assignment from its Issue, returns the created RemovedAssignmentEvent, or null if the Assignment was already removed from its Issue. Checks the authorization status

suspend fun removeAssignment(assignment: Assignment, atTime: OffsetDateTime, byUser: User): RemovedAssignmentEvent

Removes an assignment from its Issue at atTime as byUser and adds a RemovedAssignmentEvent to the timeline. Creates the event even if the assignment was already removed from its Issue. Does not check the authorization status. Does neither save the created RemovedAssignmentEvent nor the Issue of the assignment. It is necessary to save the Issue of the assignment or returned RemovedAssignmentEvent afterwards.

Link copied to clipboard

Unpins an Issue on a Trackable, returns the created RemovedFromPinnedIssuesEvent, or null if the Issue was not pinned on the Trackable. Checks the authorization status

Unpins an issue on a trackable at atTime as byUser and adds a RemovedFromPinnedIssuesEvent to the timeline. Creates the event even if the issue was not pinned on the trackable. Only removes the issue from the pinnedIssues on trackable if no newer timeline item exists which adds it again. Does not check the authorization status. Does neither save the created RemovedFromPinnedIssuesEvent nor the issue. It is necessary to save the issue or returned RemovedFromPinnedIssuesEvent afterwards.

Link copied to clipboard

Removes an Issue from a Trackable, returns the created RemovedFromPinnedIssuesEvent, or null if the Issue was not pinned on the Trackable. Also removes Labels and Artefacts if necessary, and unpins it on the specified Trackable. Checks the authorization status, checks that the Issue remains on at least one Trackable.

suspend fun removeIssueFromTrackable(issue: Issue, trackable: Trackable, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): RemovedFromTrackableEvent

Removes an issue from a trackable at atTime as byUser and adds a RemovedFromTrackableEvent to the timeline. Also removes Labels and Artefacts if necessary, and unpins it on the specified Trackable. Creates the event even if the issue was not on the trackable. Only removes the issue from the trackable if no newer timeline item exists which adds it again. Does not check the authorization status. Checks that the issue remains on at least one Trackable. Does neither save the created RemovedFromTrackableEvent nor the issue. It is necessary to save the issue or returned RemovedFromTrackableEvent afterwards.

Link copied to clipboard

Removes an IssueRelation from its Issue, returns the created RemovedOutgoingRelationEvent, or null if the IssueRelation was already removed from its Issue. Checks the authorization status

suspend fun removeIssueRelation(issueRelation: IssueRelation, atTime: OffsetDateTime, byUser: User, updateContext: NodeBatchUpdateContext): RemovedOutgoingRelationEvent

Removes an issueRelation from its Issue at atTime as byUser and adds a RemovedOutgoingRelationEvent to the timeline. Also creates a RemovedIncomingRelationEvent and adds it to the timeline of the related Issue. Creates the event even if the issueRelation was already removed from its Issue. Does not check the authorization status. Does neither save the created RemovedOutgoingRelationEvent nor the Issue of the issueRelation. It is necessary to save the Issue of the issueRelation or returned RemovedOutgoingRelationEvent afterwards. Caution: it is also necessary to save the related Issue manually!

Link copied to clipboard

Removes a Label from an Issue, returns the created RemovedLabelEvent, or null if the Label was not present on the Issue. Checks the authorization status

suspend fun removeLabelFromIssue(issue: Issue, label: Label, atTime: OffsetDateTime, byUser: User): RemovedLabelEvent

Removes a label from an issue at atTime as byUser and adds a RemovedLabelEvent to the timeline. Creates the event even if the label was not on the issue. Only removes the label from the issue if no newer timeline item exists which adds it again. Does not check the authorization status. Does neither save the created RemovedLabelEvent nor the issue. It is necessary to save the issue or returned RemovedLabelEvent afterwards.

Link copied to clipboard
private suspend fun removeTemplatedField(issue: Issue, field: String, atTime: OffsetDateTime, byUser: User): RemovedTemplatedFieldEvent

Removes a templated field from an Issue at atTime as byUser. Should only be used during template update. Does not check the authorization status. Assumes that a templated field with name field exists. Does neither save the created RemovedTemplatedFieldEvent or the issue. Requires to save the returned RemovedTemplatedFieldEvent or the issue.

Link copied to clipboard
private suspend fun updateAssignmentsAfterTemplateUpdate(issue: Issue, event: TemplateChangedEvent, assignmentTypeMapping: Map<AssignmentType, AssignmentType?>, atTime: OffsetDateTime, byUser: User)

Updates types of Assignment on issue where the old type is incompatible with the new template of issue based on assignmentTypeMapping and removes types with no replacement. Adds the crated events to childItems on event

Link copied to clipboard
suspend fun updateAuditedNode(node: AuditedNode, lastModifiedBy: User, lastModifiedAt: OffsetDateTime)

Updates node after it was updated without an UpdateNodeInput Sets AuditedNode.lastModifiedBy and AuditedNode.lastModifiedAt

Link copied to clipboard
suspend fun updateBody(authorizationContext: GropiusAuthorizationContext, input: UpdateBodyInput): Body

Updates an IssueComment, returns the updated IssueComment. Checks the authorization status, and checks that the added referenced Artefact can be used on the Issue.

suspend fun updateBody(body: Body, newBodyValue: String?, atTime: OffsetDateTime, byUser: User)

Updates an body at atTime as byUser. Does not check the authorization status. Does not save the updated Body. It is necessary to save the updated body afterwards.

Link copied to clipboard

Updates an IssueComment, returns the updated IssueComment. Checks the authorization status, and checks that the added referenced Artefact can be used on the Issue.

suspend fun updateIssueComment(issueComment: IssueComment, newBodyValue: String?, addedArtefacts: List<Artefact>, removedArtefacts: List<Artefact>, atTime: OffsetDateTime, byUser: User)

Updates an issueComment at atTime as byUser. Does not check the authorization status. Checks for each Artefact in addedArtefacts that it can be used with the Issue the issueComment is on Does not save the updated IssueComment. It is necessary to save the updated issueComment afterwards.

Link copied to clipboard
private suspend fun updateIssueFieldsAfterTemplateUpdate(issue: Issue, event: TemplateChangedEvent, type: IssueType?, state: IssueState?, priority: IssuePriority?, atTime: OffsetDateTime, byUser: User)

Updates type, state, and priority on issue after a template update if the old value is incompatible with the new template. Adds the crated events to childItems on event

Link copied to clipboard
private suspend fun updateIssueRelationsAfterTemplateUpdate(issue: Issue, event: TemplateChangedEvent, issueRelationTypeMapping: Map<IssueRelationType, IssueRelationType?>, atTime: OffsetDateTime, byUser: User)

Updates types of IssueRelation on issue where the old type is incompatible with the new template of issue based on issueRelationTypeMapping and removes types with no replacement. Adds the crated events to childItems on event

Link copied to clipboard
private suspend fun updateTemplatedFieldsAfterTemplateUpdate(issue: Issue, event: TemplateChangedEvent, templatedFields: List<JSONFieldInput>, atTime: OffsetDateTime, byUser: User)

Updates templated fields on issue after a template update, uses templatedFields for new values for currently incompatible fields and removes fields which are no longer defined by the template. Adds the crated events to childItems on event