public NewAdHocRule(ScannerReport.AdHocRule ruleFromScannerReport) { Preconditions.checkArgument(isNotBlank(ruleFromScannerReport.getEngineId()), "'engine id' not expected to be null for an ad hoc rule"); Preconditions.checkArgument(isNotBlank(ruleFromScannerReport.getRuleId()), "'rule id' not expected to be null for an ad hoc rule"); Preconditions.checkArgument(isNotBlank(ruleFromScannerReport.getName()), "'name' not expected to be null for an ad hoc rule"); Preconditions.checkArgument(ruleFromScannerReport.getSeverity() != Constants.Severity.UNSET_SEVERITY , "'severity' not expected to be null for an ad hoc rule"); Preconditions.checkArgument(ruleFromScannerReport.getType() != ScannerReport.IssueType.UNSET, "'issue type' not expected to be null for an ad hoc rule"); this.key = RuleKey.of(RuleKey.EXTERNAL_RULE_REPO_PREFIX + ruleFromScannerReport.getEngineId(), ruleFromScannerReport.getRuleId()); this.engineId = ruleFromScannerReport.getEngineId(); this.ruleId = ruleFromScannerReport.getRuleId(); this.name = ruleFromScannerReport.getName(); this.description = trimToNull(ruleFromScannerReport.getDescription()); this.severity = ruleFromScannerReport.getSeverity().name(); this.ruleType = RuleType.valueOf(ruleFromScannerReport.getType().name()); this.hasDetails = true; }