Font Size:
Ask Joget AI

Governance Health Check Actions Plugin Developer Guide

This document describes how to create custom actionable buttons in the Joget Governance Health Check framework.
By implementing the provided interfaces and classes, developers can extend the Governance Health Check feature with interactive actions — for example, allowing users to remove, recheck, or remediate scan results directly from the UI.

Overview

A GovHealthCheckAction represents an interactive button shown for each scanned result in the Governance Health Check.
When a user clicks the button, a defined handler is executed, and the system displays the corresponding result (success/failure message, redirect, etc).

Developers can define these actions by implementing:

  1. GovHealthCheckActionProvider — to declare available actions
  2. GovHealthCheckAction — to define action metadata and behavior
  3. GovHealthCheckActionHandler — to handle logic on click
  4. GovHealthCheckActionResult — to describe the action outcome

GovHealthCheckActionProvider

Purpose

Defines a provider that can return one or more GovHealthCheckAction objects.

Implement this interface in your custom GovHealthCheck plugin to declare which actions are available for each scan result.

public interface GovHealthCheckActionProvider {
    List<GovHealthCheckAction> getActions();
}
Example Implementation
public class MyHealthCheckPlugin extends GovHealthCheckAbstract implements GovHealthCheckActionProvider {

    @Override
    public List<GovHealthCheckAction> getActions() {
        return List.of(
            new GovHealthCheckAction(
                "remove",                   // Action ID
                "Remove",                   // Label
                "fas fa-trash-alt",         // FontAwesome icon
                "Are you sure to remove?",  // Confirmation message
                false,                      // Popup (optional)
                (action, pluginClass, detail, request, response) -> 
                    GovHealthCheckActionResult.success(true, "Removed successfully!")
            )
        );
    }
}
Tips
  • Each action will be shown as a clickable button under the Health Check details.
  • You can define multiple actions per plugin.

GovHealthCheckAction

Purpose

Defines a single actionable button, including its metadata and behavior when executed.

public class GovHealthCheckAction {
    private String id;
    private String label;
    private String icon;
    private String confirmMessage;
    private Boolean popup;
    private GovHealthCheckActionHandler handler;
}

Key Parameters

Field Type Description
id String Unique identifier for the action
label String Button label (shown in UI)
icon String Icon (e.g., FontAwesome class)
confirmMessage String Confirmation message before execution
popup Boolean Whether to open in popup mode
handler GovHealthCheckActionHandler Logic to execute when clicked

Example

GovHealthCheckAction action = new GovHealthCheckAction(
    "resolve",
    "Resolve",
    "fas fa-ok",
    "Do you want to resolve the issue?",
    false,
    (actionObj, pluginClass, detail, request, response) -> {
        // Custom logic to resolve the issue
        boolean resolveSuccess = reRunHealthCheck(pluginClass, detail);
        if (resolveSuccess) {
            return GovHealthCheckActionResult.success(true, "Resolved successfully!");
        }
        return GovHealthCheckActionResult.fail(false, "Failed to resolve the issue.");
    }
);

GovHealthCheckActionHandler

Purpose

Defines the functional interface (i.e., executable logic) that runs when a user clicks the button.

@FunctionalInterface
public interface GovHealthCheckActionHandler {
    GovHealthCheckActionResult handle(
        GovHealthCheckAction action,
        String pluginClass,
        String detail,
        HttpServletRequest request,
        HttpServletResponse response
    );
}

Example Handler

GovHealthCheckActionHandler deleteHandler = (action, pluginClass, detail, request, response) -> {
    try {
        resolve(pluginClass, detail);
        return GovHealthCheckActionResult.success(true, "Resolve successfully!");
    } catch (Exception e) {
        return GovHealthCheckActionResult.fail(false, "Resolve failed: " + e.getMessage());
    }
};

Notes

  • Can be defined as a lambda or an anonymous class.
  • Has access to:
    • The triggered action (GovHealthCheckAction)
    • The related plugin class name
    • The scanned result detail
    • Current HttpServletRequest and HttpServletResponse for advanced logic
    • Returning null GovHealthCheckActionResult from the handle method means the HTTP Response is already handled and written in the handler itself and no further action is needed. Usually used for "popup" action.

GovHealthCheckActionResult

Purpose

Represents the result of performing an action — whether it succeeded, failed, or triggered a redirect.

public class GovHealthCheckActionResult {
    private boolean success;
    private boolean removeFromResult;
    private String message;
    private String redirectUrl;
}

Factory Methods

Method Description
success(boolean removeFromResult, String message) Returns a success result
fail(boolean removeFromResult, String message) Returns a failure result

Example

return GovHealthCheckActionResult.success(
    true,   // remove scanned result from list
    "The issue has been successfully fixed!"
);

or

GovHealthCheckActionResult result = GovHealthCheckActionResult.fail(
    false, "Unable to process this action."
);
result.setRedirectUrl("/web/console/app/governance");

Putting It All Together

Here’s a full example of a custom Governance Health Check plugin that provides an action button to “Resolve” issues.

public class ResolveHealthCheckPlugin extends GovHealthCheckAbstract implements GovHealthCheckActionProvider {

    @Override
    public List<GovHealthCheckAction> getActions() {
        return List.of(
            new GovHealthCheckAction(
                "resolve",
                "Resolve",
                "fas fa-check-circle",
                "Mark this issue as resolved?",
                false,
                (action, pluginClass, detail, request, response) -> {
                    boolean resolved = resolveIssue(detail);
                    if (resolved) {
                        return GovHealthCheckActionResult.success(true, "Issue resolved successfully!");
                    }
                    return GovHealthCheckActionResult.fail(false, "Failed to resolve issue.");
                }
            )
        );
    }

    private boolean resolveIssue(String detail) {
        // Custom logic to resolve issue here
        return true;
    }
}

Other Tips

  • Keep action logic lightweight and stateless when possible.
  • Always handle exceptions gracefully in the action handler.
  • Use confirmMessage for actions with side effects (e.g., delete).
  • Use removeFromResult = true only when the issue should disappear from the Health Check view after completion.
  • Returning a null GovHealthCheckActionResult from the handle method means the Http Response is already handled and written in the handler itself, and no further action is needed.
Created by Debanraj Ravindran Last modified by Debanraj Ravindran on Jul 22, 2026