package gw.bizrules.pcf uses gw.api.locale.DisplayKey uses gw.bizrules.management.BizRulesVersionController @ReadOnly enhancement GWRuleHeadEnhancement : RuleHead { /** * Returns the execution status of the rule in the current environment based on the deployment * version, system deployment enabled, validity and rule enablement. * @param versionController The current version controller object from the rules use case * @return RuleExecutionStatus */ function getExecutionStatus(versionController : BizRulesVersionController) : RuleExecutionStatus { var headVersion = this.HeadVersion if (versionController.DeploymentEnabled and !versionController.isVersionDeployed(headVersion)) { var deployedVersion = this.DeployedVersion if (deployedVersion == null) { return TC_NOTDEPLOYED } return deployedVersion.Rule.AvailableToRun ? TC_PREVENABLED : TC_PREVDISABLED } if (!headVersion.Rule.AvailableToRun) { return TC_DISABLED } if (headVersion.Rule.Valid == null) { return TC_UNKNOWN } if(!headVersion.Rule.Valid) { return TC_INVALID } return TC_ENABLED } /** * Returns the text for display on screen if the RuleExecutionStatus is TC_PREVENABLED * This method assumes the caller has already checked to see the above status is true * @param versionController The current version controller object from the rules use case * @return text with the deployed version number if available, otherwise generic text */ function getPrevExecutionTooltip(versionController : BizRulesVersionController) : String { var deployedVersion = this.DeployedVersion if(deployedVersion != null) { return DisplayKey.get('BizRules.RulesPage.LV.RunStatus.PrevEnabledTooltip',versionController.getVersionNumberLabel(deployedVersion)) } return RuleExecutionStatus.TC_PREVENABLED.Description } }