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

com.att.research.xacmlatt.pdp.eval.EvaluationResult Maven / Gradle / Ivy

The newest version!
/*
 *
 *          Copyright (c) 2013,2019  AT&T Knowledge Ventures
 *                     SPDX-License-Identifier: MIT
 */

package com.att.research.xacmlatt.pdp.eval;

import java.util.Collection;

import com.att.research.xacml.api.Advice;
import com.att.research.xacml.api.AttributeCategory;
import com.att.research.xacml.api.Decision;
import com.att.research.xacml.api.IdReference;
import com.att.research.xacml.api.Obligation;
import com.att.research.xacml.api.Status;
import com.att.research.xacml.std.StdMutableResult;

/**
 * EvaluationResult extends {@link com.att.research.xacml.std.StdMutableResult} with methods useful within a PDP implementation
 * 
 * @author car
 * @version $Revision: 1.1 $
 */
public class EvaluationResult extends StdMutableResult {
	public EvaluationResult() {
		super();
	}
	
	public EvaluationResult(Decision decisionIn, Status statusIn) {
		super(decisionIn, statusIn);
	}
	
	public EvaluationResult(Status statusIn) {
		super(statusIn);
	}
	
	public EvaluationResult(Decision decisionIn) {
		super(decisionIn);
	}
	
	public EvaluationResult(Decision decisionIn, 
			Collection obligationsIn, 
			Collection adviceIn, 
			Collection attributesIn, 
			Collection policyIdentifiersIn, 
			Collection policySetIdentifiersIn) {
		super(decisionIn, obligationsIn, adviceIn, attributesIn, policyIdentifiersIn, policySetIdentifiersIn);
	}
	
	/**
	 * Creates an EvaluationResult generally from a {@link com.att.research.xacmlatt.pdp.policy.Rule} evaluation
	 * call.
	 * 
	 * @param decisionIn the Decision
	 * @param obligationsIn the Collection of Obligations
	 * @param adviceIn the Collection of Advice objects
	 */
	public EvaluationResult(Decision decisionIn, Collection obligationsIn, Collection adviceIn) {
		super(decisionIn, obligationsIn, adviceIn, null, null, null);
	}
	
	public void merge(EvaluationResult evaluationResult) {
		if (this.getStatus() == null) {
			this.setStatus(evaluationResult.getStatus());
		} else {
			this.getStatus().merge(evaluationResult.getStatus());
		}
		this.addObligations(evaluationResult.getObligations());
		this.addAdvice(evaluationResult.getAssociatedAdvice());
		this.addAttributeCategories(evaluationResult.getAttributes());
		this.addPolicyIdentifiers(evaluationResult.getPolicyIdentifiers());
		this.addPolicySetIdentifiers(evaluationResult.getPolicySetIdentifiers());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy