- public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
- PfValidationResult result = super.validate(resultIn);
-
- if (properties != null) {
- result = validateProperties(result);
- }
-
- if (targets != null) {
- result = validateTargets(result);
- }
-
- if (triggers != null) {
- result = validateTriggers(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 (JpaToscaProperty property : properties.values()) {
- if (property == null) {
- result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
- "policy property may not be null "));
- } else {
- result = property.validate(result);
- }
- }
- return result;
- }
-
- /**
- * Validate the policy targets.
- *
- * @param result The result of validations up to now
- * @return the validation result
- */
- private PfValidationResult validateTargets(final PfValidationResult resultIn) {
- PfValidationResult result = resultIn;
-
- for (PfConceptKey target : targets) {
- if (target == null) {
- result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
- "policy target may not be null "));
- } else {
- result = target.validate(result);
- }
- }
- return result;
- }
-
- /**
- * Validate the policy triggers.
- *
- * @param result The result of validations up to now
- * @return the validation result
- */
- private PfValidationResult validateTriggers(final PfValidationResult resultIn) {
- PfValidationResult result = resultIn;
-
- for (JpaToscaTrigger trigger : triggers) {
- if (trigger == null) {
- result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
- "policy trigger may not be null "));
- } else {
- result = trigger.validate(result);
- }
- }
- return result;