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