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

com.att.research.xacmlatt.pdp.policy.FunctionArgumentBag 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 java.util.Iterator;

import com.att.research.xacml.api.AttributeValue;
import com.att.research.xacml.api.Status;
import com.att.research.xacml.std.StdStatus;

/**
 * FunctionArgumentBag implements the {@link com.att.research.xacmlatt.pdp.policy.FunctionArgument} interface for
 * a {@link com.att.research.xacmlatt.pdp.policy.Bag} objects.
 * 
 * @author car
 * @version $Revision: 1.3 $
 */
public class FunctionArgumentBag implements FunctionArgument {
	private Bag	bag;
	
	/**
	 * Creates a new FunctionArgumentBag from the given Bag.
	 * 
	 * @param bagIn the Bag for the new FunctionArgumentBag.
	 */
	public FunctionArgumentBag(Bag bagIn) {
		this.bag	= bagIn;
	}
	
	@Override
	public Status getStatus() {
		return StdStatus.STATUS_OK;
	}
	
	@Override
	public boolean isOk() {
		return true;
	}

	@Override
	public boolean isBag() {
		return true;
	}

	@Override
	public AttributeValue getValue() {
		Iterator> iterAttributeValues	= this.bag.getAttributeValues();
		if (iterAttributeValues == null || !iterAttributeValues.hasNext()) {
			return null;
		} else {
			return iterAttributeValues.next();
		}
	}

	@Override
	public Bag getBag() {
		return this.bag;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy