override fun doHandle()

in src/main/kotlin/jetbrains/buildServer/notification/slackNotifier/BuildTypeSlackNotifierSettingsController.kt [36:66]


    override fun doHandle(request: HttpServletRequest, response: HttpServletResponse): ModelAndView {
        val mv = ModelAndView(pluginDescriptor.getPluginResourcesPath("editBuildTypeSlackNotifierSettings.jsp"))

        val buildTypeId = request.getParameter("buildTypeId")
        val featureId = request.getParameter("featureId")

        val buildType = projectManager.findBuildTypeSettingsByExternalId(buildTypeId)
            ?: throw BuildTypeNotFoundException("Can't find build type or build template with id '${buildTypeId}'")

        val project = buildType.project

        val availableConnections = oAuthConnectionsManager.getAvailableConnectionsOfType(project, SlackConnection.type)
        mv.model["availableConnections"] = availableConnections

        val feature = buildType.findBuildFeatureById(featureId)

        val defaultProperties = mapOf(
                SlackProperties.maximumNumberOfChangesProperty.key to VerboseMessageBuilderFactory.defaultMaximumNumberOfChanges.toString()
        )

        mv.model["propertiesBean"] = BasePropertiesBean(
            feature?.parameters ?: defaultProperties,
            defaultProperties
        )
        mv.model["properties"] = SlackProperties()
        mv.model["buildTypeId"] = buildTypeId
        mv.model["createConnectionUrl"] =
            webLinks.getEditProjectPageUrl(buildType.project.externalId) + "&tab=oauthConnections"

        return mv
    }