Class ExplainErrorFolderProperty

java.lang.Object
hudson.model.AbstractDescribableImpl<com.cloudbees.hudson.plugins.folder.AbstractFolderProperty<?>>
com.cloudbees.hudson.plugins.folder.AbstractFolderProperty<com.cloudbees.hudson.plugins.folder.AbstractFolder<?>>
io.jenkins.plugins.explain_error.ExplainErrorFolderProperty
All Implemented Interfaces:
ExtensionPoint, Describable<com.cloudbees.hudson.plugins.folder.AbstractFolderProperty<?>>, ReconfigurableDescribable<com.cloudbees.hudson.plugins.folder.AbstractFolderProperty<?>>

public class ExplainErrorFolderProperty extends com.cloudbees.hudson.plugins.folder.AbstractFolderProperty<com.cloudbees.hudson.plugins.folder.AbstractFolder<?>>
Folder property for folder-level AI provider configuration. Allows teams to configure their own AI provider settings at the folder level.

enableExplanation is the box that opens the folder's section on its Configure page: when it is off, the folder sets nothing and its jobs follow the parent folder or the global configuration. Turning explanation off for a folder is disableExplanation.

  • Constructor Details

    • ExplainErrorFolderProperty

      @DataBoundConstructor public ExplainErrorFolderProperty()
  • Method Details

    • getAiProvider

      @CheckForNull public BaseAIProvider getAiProvider()
      Get the AI provider configured for this folder.
      Returns:
      the AI provider, or null if not configured
    • setAiProvider

      @DataBoundSetter public void setAiProvider(BaseAIProvider aiProvider)
      Set the AI provider for this folder.
      Parameters:
      aiProvider - the AI provider to use
    • isEnableExplanation

      public boolean isEnableExplanation()
      Whether this folder uses its section of settings. Despite the name, false does not turn explanation off: the folder then sets nothing, see isDisableExplanation().
      Returns:
      true if the folder's settings apply
    • setEnableExplanation

      @DataBoundSetter public void setEnableExplanation(boolean enableExplanation)
      Set whether this folder uses its section of settings. When false, also clears the AI provider so that the parent folder or the global provider applies.
      Parameters:
      enableExplanation - true to use the folder's settings
    • isDisableExplanation

      public boolean isDisableExplanation()
      Whether explanation is turned off for the jobs in this folder and its subfolders: no Explain Error button, no automatic explanation, and the explainError() step does nothing. A subfolder can turn it on again with a provider of its own.
      Returns:
      true if explanation is turned off here
    • setDisableExplanation

      @DataBoundSetter public void setDisableExplanation(boolean disableExplanation)
    • getLanguage

      public String getLanguage()
    • setLanguage

      @DataBoundSetter public void setLanguage(String language)
    • getCustomContext

      public String getCustomContext()
    • setCustomContext

      @DataBoundSetter public void setCustomContext(String customContext)
    • getTemperature

      public Double getTemperature()
    • setTemperature

      @DataBoundSetter public void setTemperature(Double temperature)
    • isEnableQuota

      public boolean isEnableQuota()
    • setEnableQuota

      @DataBoundSetter public void setEnableQuota(boolean enableQuota)
    • getQuotaWindow

      public QuotaWindow getQuotaWindow()
    • setQuotaWindow

      @DataBoundSetter public void setQuotaWindow(QuotaWindow quotaWindow)
    • getMaxProviderCallsPerWindow

      public int getMaxProviderCallsPerWindow()
    • setMaxProviderCallsPerWindow

      @DataBoundSetter public void setMaxProviderCallsPerWindow(int maxProviderCallsPerWindow)
    • tryAcquireQuota

      public boolean tryAcquireQuota()
      Attempts to acquire a quota slot for a real AI provider call.
      Returns:
      true if the call is allowed; false if the quota is exceeded
    • findFolderWithQuota

      @CheckForNull public static ExplainErrorFolderProperty findFolderWithQuota(@CheckForNull ItemGroup<?> itemGroup)
      Recursively search for a folder-level quota configuration. Walks up the folder hierarchy and returns the nearest folder that has enableQuota=true, or null if none is found.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      the nearest folder property with quota enabled, or null
    • findFolderProvider

      @CheckForNull public static BaseAIProvider findFolderProvider(@CheckForNull ItemGroup<?> itemGroup)
      Recursively search for folder-level AI provider configuration. Walks up the folder hierarchy until a folder with a provider of its own is found. A folder whose section is not in use (enableExplanation false) is passed over, provider or not.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      the AI provider if found at folder level, null otherwise
    • findFolderDecision

      @CheckForNull public static Boolean findFolderDecision(@CheckForNull ItemGroup<?> itemGroup)
      Whether a folder decides that its jobs are explained or not. The nearest folder that decides wins: one that turns explanation off says no, one with a provider of its own says yes. Folders that do neither are passed over.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      false if the nearest deciding folder turns explanation off, true if it has a provider of its own, null if no folder decides and the global configuration applies
    • isFolderExplanationEnabled

      public static boolean isFolderExplanationEnabled(@CheckForNull ItemGroup<?> itemGroup)
      Check if error explanation is enabled at folder level. Walks up the folder hierarchy to find the configuration.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      true if enabled at folder level (default true if not configured)
    • findFolderLanguage

      @CheckForNull public static String findFolderLanguage(@CheckForNull ItemGroup<?> itemGroup)
      Recursively search for folder-level language configuration. Walks up the folder hierarchy until a configured value is found.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      the language if found at folder level, null otherwise
    • findFolderCustomContext

      @CheckForNull public static String findFolderCustomContext(@CheckForNull ItemGroup<?> itemGroup)
      Recursively search for folder-level custom context configuration. Walks up the folder hierarchy until a configured value is found.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      the custom context if found at folder level, null otherwise
    • findFolderTemperature

      @CheckForNull public static Double findFolderTemperature(@CheckForNull ItemGroup<?> itemGroup)
      Recursively search for folder-level temperature configuration. Walks up the folder hierarchy until a configured value is found.
      Parameters:
      itemGroup - the item group to search from
      Returns:
      the temperature if found at folder level, null otherwise