Package io.jenkins.plugins.explain_error
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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolderProperty
owner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringfindFolderCustomContext(ItemGroup<?> itemGroup) Recursively search for folder-level custom context configuration.static BooleanfindFolderDecision(ItemGroup<?> itemGroup) Whether a folder decides that its jobs are explained or not.static StringfindFolderLanguage(ItemGroup<?> itemGroup) Recursively search for folder-level language configuration.static BaseAIProviderfindFolderProvider(ItemGroup<?> itemGroup) Recursively search for folder-level AI provider configuration.static DoublefindFolderTemperature(ItemGroup<?> itemGroup) Recursively search for folder-level temperature configuration.static ExplainErrorFolderPropertyfindFolderWithQuota(ItemGroup<?> itemGroup) Recursively search for a folder-level quota configuration.Get the AI provider configured for this folder.intbooleanWhether explanation is turned off for the jobs in this folder and its subfolders: no Explain Error button, no automatic explanation, and theexplainError()step does nothing.booleanWhether this folder uses its section of settings.booleanstatic booleanisFolderExplanationEnabled(ItemGroup<?> itemGroup) Check if error explanation is enabled at folder level.voidsetAiProvider(BaseAIProvider aiProvider) Set the AI provider for this folder.voidsetCustomContext(String customContext) voidsetDisableExplanation(boolean disableExplanation) voidsetEnableExplanation(boolean enableExplanation) Set whether this folder uses its section of settings.voidsetEnableQuota(boolean enableQuota) voidsetLanguage(String language) voidsetMaxProviderCallsPerWindow(int maxProviderCallsPerWindow) voidsetQuotaWindow(QuotaWindow quotaWindow) voidsetTemperature(Double temperature) booleanAttempts to acquire a quota slot for a real AI provider call.Methods inherited from class com.cloudbees.hudson.plugins.folder.AbstractFolderProperty
getDescriptor, getHealthMetrics, getHealthReports, getItemContainerOverrides, getOwner, reconfigure, reconfigure, setOwner
-
Constructor Details
-
ExplainErrorFolderProperty
@DataBoundConstructor public ExplainErrorFolderProperty()
-
-
Method Details
-
getAiProvider
Get the AI provider configured for this folder.- Returns:
- the AI provider, or null if not configured
-
setAiProvider
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,falsedoes not turn explanation off: the folder then sets nothing, seeisDisableExplanation().- 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 theexplainError()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
-
setLanguage
-
getCustomContext
-
setCustomContext
-
getTemperature
-
setTemperature
-
isEnableQuota
public boolean isEnableQuota() -
setEnableQuota
@DataBoundSetter public void setEnableQuota(boolean enableQuota) -
getQuotaWindow
-
setQuotaWindow
-
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:
trueif the call is allowed;falseif 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 hasenableQuota=true, ornullif none is found.- Parameters:
itemGroup- the item group to search from- Returns:
- the nearest folder property with quota enabled, or null
-
findFolderProvider
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 (enableExplanationfalse) 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
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:
falseif the nearest deciding folder turns explanation off,trueif it has a provider of its own,nullif no folder decides and the global configuration applies
-
isFolderExplanationEnabled
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
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
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
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
-