private Rule(Repository repository, NewRule newRule) { this.pluginKey = newRule.pluginKey; this.repository = repository; this.repoKey = newRule.repoKey; this.key = newRule.key; this.name = newRule.name; this.htmlDescription = newRule.htmlDescription; this.markdownDescription = newRule.markdownDescription; this.internalKey = newRule.internalKey; this.severity = newRule.severity; this.template = newRule.template; this.status = newRule.status; this.debtRemediationFunction = newRule.debtRemediationFunction; this.gapDescription = newRule.gapDescription; this.scope = newRule.scope == null ? RuleScope.MAIN : newRule.scope; this.type = newRule.type == null ? RuleTagsToTypeConverter.convert(newRule.tags) : newRule.type; this.tags = ImmutableSortedSet.copyOf(Sets.difference(newRule.tags, RuleTagsToTypeConverter.RESERVED_TAGS)); this.securityStandards = ImmutableSortedSet.copyOf(newRule.securityStandards); Map<String, Param> paramsBuilder = new HashMap<>(); for (NewParam newParam : newRule.paramsByKey.values()) { paramsBuilder.put(newParam.key, new Param(newParam)); } this.params = Collections.unmodifiableMap(paramsBuilder); this.activatedByDefault = newRule.activatedByDefault; this.deprecatedRuleKeys = ImmutableSortedSet.copyOf(newRule.deprecatedRuleKeys); }
private Rule(Repository repository, NewRule newRule) { this.repository = repository; this.repoKey = newRule.repoKey; this.key = newRule.key; this.name = newRule.name; this.htmlDescription = newRule.htmlDescription; this.markdownDescription = newRule.markdownDescription; this.internalKey = newRule.internalKey; this.severity = newRule.severity; this.template = newRule.template; this.status = newRule.status; this.debtSubCharacteristic = newRule.debtSubCharacteristic; this.debtRemediationFunction = newRule.debtRemediationFunction; this.effortToFixDescription = newRule.effortToFixDescription; this.tags = ImmutableSortedSet.copyOf(newRule.tags); ImmutableMap.Builder<String, Param> paramsBuilder = ImmutableMap.builder(); for (NewParam newParam : newRule.paramsByKey.values()) { paramsBuilder.put(newParam.key, new Param(newParam)); } this.params = paramsBuilder.build(); }
private Rule(Repository repository, NewRule newRule) { this.pluginKey = newRule.pluginKey; this.repository = repository; this.repoKey = newRule.repoKey; this.key = newRule.key; this.name = newRule.name; this.htmlDescription = newRule.htmlDescription; this.markdownDescription = newRule.markdownDescription; this.internalKey = newRule.internalKey; this.severity = newRule.severity; this.template = newRule.template; this.status = newRule.status; this.debtRemediationFunction = newRule.debtRemediationFunction; this.gapDescription = newRule.gapDescription; this.scope = newRule.scope == null ? RuleScope.MAIN : newRule.scope; this.type = newRule.type == null ? RuleTagsToTypeConverter.convert(newRule.tags) : newRule.type; this.tags = ImmutableSortedSet.copyOf(Sets.difference(newRule.tags, RuleTagsToTypeConverter.RESERVED_TAGS)); this.securityStandards = ImmutableSortedSet.copyOf(newRule.securityStandards); Map<String, Param> paramsBuilder = new HashMap<>(); for (NewParam newParam : newRule.paramsByKey.values()) { paramsBuilder.put(newParam.key, new Param(newParam)); } this.params = Collections.unmodifiableMap(paramsBuilder); this.activatedByDefault = newRule.activatedByDefault; this.deprecatedRuleKeys = ImmutableSortedSet.copyOf(newRule.deprecatedRuleKeys); }