1 package org.opendaylight.groupbasedpolicy.resolver.validator.validators;
4 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
6 * This program and the accompanying materials are made available under the
7 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 import org.opendaylight.groupbasedpolicy.resolver.validator.AbstractValidator;
11 import org.opendaylight.groupbasedpolicy.resolver.validator.SimpleResult;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.subject.feature.instances.ActionInstance;
16 * Validator for {@link ActionInstance}
18 public class ActionInstanceValidator extends AbstractValidator<ActionInstance> {
21 protected SimpleResult validateSelf(ActionInstance objectToValidate) {
22 org.opendaylight.groupbasedpolicy.resolver.ActionInstanceValidator action = getPolicyResolver().getActionInstanceValidator(objectToValidate.getActionDefinitionId());
24 return new SimpleResult(false, "Action not registered in PolicyResolver.");
27 boolean isValid = action.isValid(objectToValidate);
29 return new SimpleResult(isValid, "Validation result of " + action.getClass().getName() + " class.");
33 public Class<ActionInstance> getType() {
34 return ActionInstance.class;