All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.extension.jenkins.autoversioning.JenkinsPostProcessingSettingsManager.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.extension.jenkins.autoversioning

import net.nemerosa.ontrack.model.form.Form
import net.nemerosa.ontrack.model.form.intField
import net.nemerosa.ontrack.model.form.textField
import net.nemerosa.ontrack.model.security.SecurityService
import net.nemerosa.ontrack.model.settings.AbstractSettingsManager
import net.nemerosa.ontrack.model.settings.CachedSettingsService
import net.nemerosa.ontrack.model.support.SettingsRepository
import net.nemerosa.ontrack.model.support.setInt
import net.nemerosa.ontrack.model.support.setString
import org.springframework.stereotype.Component

@Component
class JenkinsPostProcessingSettingsManager(
    cachedSettingsService: CachedSettingsService,
    securityService: SecurityService,
    private val settingsRepository: SettingsRepository,
) : AbstractSettingsManager(
    JenkinsPostProcessingSettings::class.java,
    cachedSettingsService,
    securityService
) {
    override fun doSaveSettings(settings: JenkinsPostProcessingSettings) {
        settingsRepository.setString(settings::config)
        settingsRepository.setString(settings::job)
        settingsRepository.setInt(settings::retries)
        settingsRepository.setInt(settings::retriesDelaySeconds)
    }

    override fun getId(): String = "jenkins-auto-versioning-processing"

    override fun getTitle(): String = "Jenkins Auto Versioning Processing"

    override fun getSettingsForm(settings: JenkinsPostProcessingSettings): Form =
        Form.create()
            .textField(
                JenkinsPostProcessingSettings::config,
                settings.config
            )
            .textField(
                JenkinsPostProcessingSettings::job,
                settings.job
            )
            .intField(
                JenkinsPostProcessingSettings::retries,
                settings.retries
            )
            .intField(
                JenkinsPostProcessingSettings::retriesDelaySeconds,
                settings.retriesDelaySeconds
            )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy