All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.att.research.xacmlatt.pdp.policy.PolicyIdReference Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
/*
 *
 *          Copyright (c) 2013,2019  AT&T Knowledge Ventures
 *                     SPDX-License-Identifier: MIT
 */
package com.att.research.xacmlatt.pdp.policy;

import com.att.research.xacml.api.StatusCode;
import com.att.research.xacmlatt.pdp.eval.EvaluationContext;
import com.att.research.xacmlatt.pdp.eval.EvaluationException;

/**
 * PolicyIdReference extends {@link com.att.research.xacmlatt.pdp.policy.PolicyIdReferenceBase} for
 * {@link com.att.research.xacmlatt.pdp.policy.Policy} objects with an implementation of the ensureReferencee
 * method to find a Policy.
 * 
 * @author car
 * @version $Revision: 1.2 $
 */
public class PolicyIdReference extends PolicyIdReferenceBase {

	public PolicyIdReference(PolicySet policySetParent, StatusCode statusCodeIn, String statusMessageIn) {
		super(policySetParent, statusCodeIn, statusMessageIn);
	}
	
	public PolicyIdReference(StatusCode statusCodeIn, String statusMessageIn) {
		super(statusCodeIn, statusMessageIn);
	}

	public PolicyIdReference(StatusCode statusCodeIn) {
		super(statusCodeIn);
	}
	
	public PolicyIdReference(PolicySet policySetParent) {
		super(policySetParent);
	}

	public PolicyIdReference() {
	}

	@Override
	protected Policy ensureReferencee(EvaluationContext evaluationContext) throws EvaluationException {
		if (this.getReferencee() == null) {
			PolicyFinderResult policyFactoryResult	= evaluationContext.getPolicy(this.getIdReferenceMatch());
			if (policyFactoryResult.getStatus() == null || policyFactoryResult.getStatus().isOk()) {
				this.setReferencee(policyFactoryResult.getPolicyDef());
			}
		}
		return this.getReferencee();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy