private void validateCopyRetentionRules( RetentionRule retentionRule, MetadataSchema schema, ValidationErrors validationErrors, ConfigProvider configProvider) { List<CopyRetentionRule> copyRetentionRules = retentionRule.getCopyRetentionRules(); boolean validIntegrity = true; for (int i = 0; i < copyRetentionRules.size(); i++) { validIntegrity &= validateIntegrity(copyRetentionRules.get(i), i, schema, validationErrors); } if (validIntegrity) { int principalCount = 0; int secondaryCount = 0; // // List<String> duplicateContentTypes = new ArrayList<>(); // List<String> mediumTypeIds = new ArrayList<>(); for (CopyRetentionRule copyRetentionRule : retentionRule.getCopyRetentionRules()) { if (copyRetentionRule.getCopyType() == CopyType.PRINCIPAL) { principalCount++; // for (String mediumTypeId : copyRetentionRule.getMediumTypeIds()) { // if (mediumTypeIds.contains(mediumTypeId)) { // duplicateContentTypes.add(mediumTypeId); // } else { // mediumTypeIds.add(mediumTypeId); // } // } } else { secondaryCount++; } } boolean copyRulePrincipalRequired = configProvider.get(RMConfigs.COPY_RULE_PRINCIPAL_REQUIRED); if (principalCount == 0 && copyRulePrincipalRequired) { addCopyRetentionRuleError( MUST_SPECIFY_AT_LEAST_ONE_PRINCIPAL_COPY_RETENTON_RULE, schema, validationErrors); } if (secondaryCount != 1) { addCopyRetentionRuleError( MUST_SPECIFY_ONE_SECONDARY_COPY_RETENTON_RULE, schema, validationErrors); } // if (!duplicateContentTypes.isEmpty()) { // addCopyRetentionRuleDuplicatedContentTypesError(duplicateContentTypes, schema, // validationErrors); // } } }