Class CachingAutomationConfigStore
java.lang.Object
com.codebarrel.jira.plugin.automation.store.CachingAutomationConfigStore
- All Implemented Interfaces:
AutomationConfigStore
-
Constructor Summary
ConstructorsConstructorDescriptionCachingAutomationConfigStore(AutomationConfigStore delegateStore, com.atlassian.cache.CacheManager cacheManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLabel(TenantContext tenantContext, Long ruleId, Long labelId) Adds a new rule label to rulecom.codebarrel.automation.api.config.RuleConfigBeancreateRule(TenantContext tenantContext, com.codebarrel.automation.api.config.RuleConfigBean ruleConfigBean) Creates a new rule.voiddelete(TenantContext tenantContext, Long ruleId) Deletes the rule with the id provided.voiddeleteAssociatedRuleProjects(TenantContext tenantContext, Long ruleId, String... projectIds) Deletes the associated project ids from a rulevoiddisableRule(TenantContext tenantContext, Long ruleId) This is an 'internal' method to be called by the rule executor when an execution loop may have been detected.List<com.codebarrel.automation.api.config.RuleConfigBean>getBillableRules(TenantContext tenantContext) Returns rules that are considered billable i.e.longgetEnabledRuleCount(TenantContext tenantContext) Counts enabled rules on a tenant.List<com.codebarrel.automation.api.config.RuleConfigBean>getProjectRules(TenantContext tenantContext, String... projectIds) Get rules restricted to the the given projects only, unlike getRules() rules without a project restriction will be ignored.Optional<com.codebarrel.automation.api.config.RuleConfigBean>getRule(TenantContext tenantContext, Long ruleId) Retrieve a rule by idList<com.codebarrel.automation.api.config.RuleConfigBean>getRules(TenantContext tenantContext, String... projectIds) Get all rules for the given projects, and also rules without a project restriction.List<com.codebarrel.automation.api.config.RuleConfigBean>getRules(TenantContext tenantContext, Set<String> projectIds) List<com.codebarrel.automation.api.config.RuleConfigBean>getRulesWithTag(TenantContext tenantContext, Tag tag) Returns all automation rules tagged with the provided tag.getRulesWithTagGlobally(Environment environment, Tag tag, com.codebarrel.automation.api.config.RuleState state) Returns all automation rules tagged with the provided tag irrelevant of tenant contextlonggetTotalRuleCount(TenantContext tenantContext) Returns a count of all the rules for tenantbooleanhasRulesInScope(TenantContext tenantContext, Long projectId) Whether there are any rule specifically in the given scopevoidremoveLabel(TenantContext tenantContext, Long ruleId, Long labelId) Removes a rule labelcom.codebarrel.automation.api.config.RuleConfigBeanupdateRule(TenantContext tenantContext, Long ruleId, com.codebarrel.automation.api.config.RuleConfigBean ruleConfigBean) Updates the rule with the provided configuration.
-
Constructor Details
-
CachingAutomationConfigStore
public CachingAutomationConfigStore(AutomationConfigStore delegateStore, com.atlassian.cache.CacheManager cacheManager)
-
-
Method Details
-
getRules
public List<com.codebarrel.automation.api.config.RuleConfigBean> getRules(TenantContext tenantContext, String... projectIds) Description copied from interface:AutomationConfigStoreGet all rules for the given projects, and also rules without a project restriction.- Specified by:
getRulesin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextprojectIds- The project ids to look up rules for- Returns:
- List of automation rules in this project and tenant
-
getRules
public List<com.codebarrel.automation.api.config.RuleConfigBean> getRules(TenantContext tenantContext, Set<String> projectIds) - Specified by:
getRulesin interfaceAutomationConfigStore
-
getProjectRules
public List<com.codebarrel.automation.api.config.RuleConfigBean> getProjectRules(TenantContext tenantContext, String... projectIds) Description copied from interface:AutomationConfigStoreGet rules restricted to the the given projects only, unlike getRules() rules without a project restriction will be ignored.- Specified by:
getProjectRulesin interfaceAutomationConfigStore
-
getBillableRules
public List<com.codebarrel.automation.api.config.RuleConfigBean> getBillableRules(TenantContext tenantContext) Description copied from interface:AutomationConfigStoreReturns rules that are considered billable i.e. multi-project and global rules- Specified by:
getBillableRulesin interfaceAutomationConfigStore- Parameters:
tenantContext- Tenant context- Returns:
- List of billable automation rules for the tenant
-
getRule
public Optional<com.codebarrel.automation.api.config.RuleConfigBean> getRule(TenantContext tenantContext, Long ruleId) Description copied from interface:AutomationConfigStoreRetrieve a rule by id- Specified by:
getRulein interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- The id of the rule to retrieve- Returns:
- the automation rule or empty if none exists.
-
getRulesWithTagGlobally
public List<TenantRuleId> getRulesWithTagGlobally(Environment environment, Tag tag, com.codebarrel.automation.api.config.RuleState state) Description copied from interface:AutomationConfigStoreReturns all automation rules tagged with the provided tag irrelevant of tenant contextUse with care! Generally you should use
AutomationConfigStore.getRulesWithTag(TenantContext, Tag)!- Specified by:
getRulesWithTagGloballyin interfaceAutomationConfigStore- Parameters:
environment- The db environment to run this query intag- The tag to search forstate- Only retrieve rules matching this state. Maybe null for all states.- Returns:
- List of matching ruleIds the tag
-
getRulesWithTag
public List<com.codebarrel.automation.api.config.RuleConfigBean> getRulesWithTag(TenantContext tenantContext, Tag tag) Description copied from interface:AutomationConfigStoreReturns all automation rules tagged with the provided tag.- Specified by:
getRulesWithTagin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contexttag- The tag to search for- Returns:
- List of rules matching the tag
-
createRule
public com.codebarrel.automation.api.config.RuleConfigBean createRule(TenantContext tenantContext, com.codebarrel.automation.api.config.RuleConfigBean ruleConfigBean) Description copied from interface:AutomationConfigStoreCreates a new rule.- Specified by:
createRulein interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleConfigBean- Data needed to create the new rule- Returns:
- The newly created rule or an error collection
-
addLabel
Description copied from interface:AutomationConfigStoreAdds a new rule label to rule- Specified by:
addLabelin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- the id of the rule to update
-
removeLabel
Description copied from interface:AutomationConfigStoreRemoves a rule label- Specified by:
removeLabelin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- the id of the rule to update
-
updateRule
public com.codebarrel.automation.api.config.RuleConfigBean updateRule(TenantContext tenantContext, Long ruleId, com.codebarrel.automation.api.config.RuleConfigBean ruleConfigBean) Description copied from interface:AutomationConfigStoreUpdates the rule with the provided configuration.- Specified by:
updateRulein interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- The id of the rule to udpateruleConfigBean- Data needed to update the rule- Returns:
- The updated rule or an error collection
-
disableRule
Description copied from interface:AutomationConfigStoreThis is an 'internal' method to be called by the rule executor when an execution loop may have been detected.- Specified by:
disableRulein interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- The id of the rule to disable
-
delete
Description copied from interface:AutomationConfigStoreDeletes the rule with the id provided.- Specified by:
deletein interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- The id of the rule to delete
-
deleteAssociatedRuleProjects
public void deleteAssociatedRuleProjects(TenantContext tenantContext, Long ruleId, String... projectIds) Description copied from interface:AutomationConfigStoreDeletes the associated project ids from a rule- Specified by:
deleteAssociatedRuleProjectsin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextruleId- The id of the rule to delete projects fromprojectIds- List of projects to remove from rule
-
getTotalRuleCount
Description copied from interface:AutomationConfigStoreReturns a count of all the rules for tenant- Specified by:
getTotalRuleCountin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant context- Returns:
- Count of all rules
-
hasRulesInScope
Description copied from interface:AutomationConfigStoreWhether there are any rule specifically in the given scope- Specified by:
hasRulesInScopein interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant contextprojectId- The scope to retrieve rules for
-
getEnabledRuleCount
Description copied from interface:AutomationConfigStoreCounts enabled rules on a tenant.- Specified by:
getEnabledRuleCountin interfaceAutomationConfigStore- Parameters:
tenantContext- The tenant- Returns:
- count of enabled rules
-