- public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
- PfValidationResult result = super.validate(resultIn);
-
- if (type == null || type.isNullKey()) {
- result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
- "type is null or a null key"));
- } else {
- result = type.validate(result);
- }
-
- if (properties != null) {
- result = validateProperties(result);
- }
-
- if (targets != null) {
- result = validateTargets(result);
- }
-
- return result;
- }
-
- /**
- * Validate the policy properties.
- *
- * @param result The result of validations up to now
- * @return the validation result
- */
- private PfValidationResult validateProperties(final PfValidationResult resultIn) {
- PfValidationResult result = resultIn;
-
- for (Entry<String, String> propertyEntry : properties.entrySet()) {
- if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getKey())) {
- result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
- "policy property key may not be null "));
- } else if (propertyEntry.getValue() == null) {
- result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
- "policy property value may not be null "));
- }
- }
- return result;
- }