modules/IssueProcessor/Jira/JiraTechnicalNotes.psm1
using module '..\..\Config.psm1' using module '..\Enums.psm1' using module '..\Issue.psm1' using module '.\JiraNotes.psm1' class JiraTechnicalNotes: JiraNotes { [string] $headerTemplate = '{0}/main-header.html' [string] $issueListHeaderTemplate = '{0}/issueList-header.html' [string] $issueListBodyTemplate = '{0}/issueList-body.html' [string] $issueListNoteTemplate = '{0}/issueList-note.html' [string] $issueListFooterTemplate = '{0}/issueList-footer.html' [string] $footerTemplate = '{0}/issueList-footer.html' JiraTechnicalNotes([string] $projectName, [Issue[]] $issues): base($projectName, $issues) { } [PSCustomObject[]] getAsObject(){ $return = @() foreach ($issue in $this.issues){ $item += ([PSCustomObject]@{ PSTypeName = 'TechnicalNote'; key = $issue.key; type = $issue.type; status = $issue.status; assignee = $issue.assignee; priority = $issue.priority; linked = $issue.linkedIsssuesToString(); notes = $issue.developerNotes; config = $issue.configurationChanges; database = $issue.databaseChanges }) $return += $item } return $return } [string] getAsHtml([string] $releaseStage, [string] $version){ # Parameters $config = [Config]::Load() # Parameters $header = Get-Item ($this.headerTemplate -f $config.templates.releaseNotes) $issueHeader = Get-Item ($this.issueListHeaderTemplate -f $config.templates.releaseNotes) $issueBody = Get-Item ($this.issueListBodyTemplate -f $config.templates.releaseNotes) $issueNote = Get-Item ($this.issueListNoteTemplate -f $config.templates.releaseNotes) $issueFooter = Get-Item ($this.issueListFooterTemplate -f $config.templates.releaseNotes) $footer = Get-Item ($this.footer -f $config.templates.releaseNotes) $return = $header $issueType = '' $returnType = '' foreach ($issue in $this.issues){ if ($issueType -ne $issue.type){ if ($issueType -ne '') { $returnType = $returnType + $issueHeader } $returnType = $returnType + $issueHeader.Replace('{{type}}', $issue.type) $issueType = $issue.type } $itemBody = $issueBody.Replace('{{key}}', $issue.key).Replace('{{type}}', $issue.type) $itemBody = $itemBody.Replace('{{priority}}', $issue.priority).Replace('{{priorityIcon}}', $issue.priorityIcon.Replace('.svg', '.png')) $itemBody = $itemBody.Replace('{{summary}}', $issue.summary).Replace('{{links}}', $issue.linkedIssuesToString('<br />')) $itemBody = $itemBody.Replace('{{status}}', $issue.status).Replace('{{assignee}}', $issue.assignee) $itemNote = '' for ($i=0; $i -lt 3; $i++){ $title=''; $notes='' switch ($i) { 0 { $title = "Developer notes"; $notes = $issue.developerNotes } 1 { $title = "Database notes"; $notes = $issue.developerNotes } 2 { $title = "Configuration changes"; $notes = $issue.developerNotes } } if ($notes) { $itemNote += $issueNote.Replace('{{title}}', $title).Replace('{{notes}}', $notes) } } $returnType = $itemNote + $itemBody $returnType = $returnType + $itemBody } $returnType = $returnType + $issueFooter $return = $return + $returnType + $footer $return = $return.Replace('{{project}}', $this.projectName).Replace('{{version}}', $version) $return = $return.Replace('{{stage}}', $releaseStage) return $return } } |