org.wso2.balana.attr.BooleanAttribute Java Examples

The following examples show how to use org.wso2.balana.attr.BooleanAttribute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MobiAttributeFinder.java    From mobi with GNU Affero General Public License v3.0 6 votes vote down vote up
private AttributeValue getAttributeValue(Literal literal) {
    IRI datatype = literal.getDatatype();
    switch (datatype.stringValue()) {
        case "http://www.w3.org/2001/XMLSchema#string":
            return new StringAttribute(literal.stringValue());
        case "http://www.w3.org/2001/XMLSchema#boolean":
            return BooleanAttribute.getInstance(literal.booleanValue());
        case "http://www.w3.org/2001/XMLSchema#double":
            return new DoubleAttribute(literal.doubleValue());
        case "http://www.w3.org/2001/XMLSchema#integer":
            return new IntegerAttribute(literal.longValue());
        case "http://www.w3.org/2001/XMLSchema#anyURI":
            try {
                return new AnyURIAttribute(new URI(literal.stringValue()));
            } catch (URISyntaxException e) {
                throw new ProcessingException("Not a valid URI");
            }
        case "https://www.w3.org/2001/XMLSchema#dateTime":
            return new DateTimeAttribute(new Date(literal.dateTimeValue().toInstant().toEpochMilli()));
        default:
            throw new ProcessingException("Datatype " + datatype + " is not supported");
    }
}
 
Example #2
Source File: ConditionBagFunction.java    From balana with Apache License 2.0 6 votes vote down vote up
/**
 * Evaluate the function, using the specified parameters.
 * 
 * @param inputs a <code>List</code> of <code>Evaluatable</code> objects representing the
 *            arguments passed to the function
 * @param context an <code>EvaluationCtx</code> so that the <code>Evaluatable</code> objects can
 *            be evaluated
 * @return an <code>EvaluationResult</code> representing the function's result
 */
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {

    // Evaluate the arguments
    AttributeValue[] argValues = new AttributeValue[inputs.size()];
    EvaluationResult result = evalArgs(inputs, context, argValues);
    if (result != null)
        return result;

    // *-is-in takes a bag and an element of baseType and
    // returns a single boolean value
    AttributeValue item = (AttributeValue) (argValues[0]);
    BagAttribute bag = (BagAttribute) (argValues[1]);

    return new EvaluationResult(BooleanAttribute.getInstance(bag.contains(item)));
}
 
Example #3
Source File: NOfFunction.java    From balana with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
public void checkInputsNoBag(List inputs) throws IllegalArgumentException {
    Object[] list = inputs.toArray();

    // check that there is at least one arg
    if (list.length == 0)
        throw new IllegalArgumentException("n-of requires an argument");

    // check that the first element is an Integer
    Evaluatable eval = (Evaluatable) (list[0]);
    if (!eval.getType().toString().equals(IntegerAttribute.identifier))
        throw new IllegalArgumentException("first argument to n-of must" + " be an integer");

    // now check that the rest of the args are booleans
    for (int i = 1; i < list.length; i++) {
        if (!((Evaluatable) (list[i])).getType().toString().equals(BooleanAttribute.identifier))
            throw new IllegalArgumentException("invalid parameter in n-of"
                    + ": expected boolean");
    }
}
 
Example #4
Source File: HigherOrderFunction.java    From balana with Apache License 2.0 6 votes vote down vote up
/**
 * Private helper for the all-of-any and any-of-all functions
 */
private EvaluationResult allAnyHelper(BagAttribute anyBag, BagAttribute allBag,
		Function function, EvaluationCtx context, boolean argumentsAreSwapped) {
	Iterator it = allBag.iterator();

	while (it.hasNext()) {
		AttributeValue value = (AttributeValue) (it.next());
		EvaluationResult result = any(value, anyBag, function, context, argumentsAreSwapped);

		if (result.indeterminate())
			return result;

		if (!((BooleanAttribute) (result.getAttributeValue())).getValue())
			return result;
	}

	return new EvaluationResult(BooleanAttribute.getTrueInstance());
}
 
Example #5
Source File: XACML3HigherOrderFunction.java    From balana with Apache License 2.0 6 votes vote down vote up
private EvaluationResult getEvaluationResult(EvaluationCtx context, Function function, AttributeValue val1,
                                             AttributeValue val2, boolean isAllFunction) {

    List<Evaluatable> params = new ArrayList<>();
    params.add(val1);
    params.add(val2);
    EvaluationResult result = function.evaluate(params, context);

    if (result.indeterminate()) {
        return result;
    }

    BooleanAttribute bool = (BooleanAttribute) (result.getAttributeValue());
    if (bool.getValue() != isAllFunction) {
        return result;
    }
    return null;
}
 
Example #6
Source File: NotFunction.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Evaluate the function, using the specified parameters.
 * 
 * @param inputs a <code>List</code> of <code>Evaluatable</code> objects representing the
 *            arguments passed to the function
 * @param context an <code>EvaluationCtx</code> so that the <code>Evaluatable</code> objects can
 *            be evaluated
 * @return an <code>EvaluationResult</code> representing the function's result
 */
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {

    // Evaluate the arguments
    AttributeValue[] argValues = new AttributeValue[inputs.size()];
    EvaluationResult result = evalArgs(inputs, context, argValues);
    if (result != null)
        return result;

    // Now that we have a real value, perform the not operation.
    boolean arg = ((BooleanAttribute) argValues[0]).getValue();
    return EvaluationResult.getInstance(!arg);
}
 
Example #7
Source File: EvaluationResult.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an <code>EvaluationResult</code> that represents a true value.
 * 
 * @return an <code>EvaluationResult</code> representing a true value
 */
public static EvaluationResult getTrueInstance() {
    if (trueBooleanResult == null) {
        trueBooleanResult = new EvaluationResult(BooleanAttribute.getTrueInstance());
    }
    return trueBooleanResult;
}
 
Example #8
Source File: EvaluationResult.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an <code>EvaluationResult</code> that represents a false value.
 * 
 * @return an <code>EvaluationResult</code> representing a false value
 */
public static EvaluationResult getFalseInstance() {
    if (falseBooleanResult == null) {
        falseBooleanResult = new EvaluationResult(BooleanAttribute.getFalseInstance());
    }
    return falseBooleanResult;
}
 
Example #9
Source File: LogicalFunction.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Evaluate the function, using the specified parameters.
 * 
 * @param inputs a <code>List</code> of <code>Evaluatable</code> objects representing the
 *            arguments passed to the function
 * @param context an <code>EvaluationCtx</code> so that the <code>Evaluatable</code> objects can
 *            be evaluated
 * @return an <code>EvaluationResult</code> representing the function's result
 */
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {

    // Evaluate the arguments one by one. As soon as we can
    // return a result, do so. Return Indeterminate if any argument
    // evaluated is indeterminate.
    Iterator it = inputs.iterator();
    while (it.hasNext()) {
        Evaluatable eval = (Evaluatable) (it.next());

        // Evaluate the argument
        EvaluationResult result = eval.evaluate(context);
        if (result.indeterminate())
            return result;

        AttributeValue value = result.getAttributeValue();
        boolean argBooleanValue = ((BooleanAttribute) value).getValue();

        switch (getFunctionId()) {
        case ID_OR:
            if (argBooleanValue)
                return EvaluationResult.getTrueInstance();
            break;
        case ID_AND:
            if (!argBooleanValue)
                return EvaluationResult.getFalseInstance();
            break;
        }
    }

    if (getFunctionId() == ID_OR)
        return EvaluationResult.getFalseInstance();
    else
        return EvaluationResult.getTrueInstance();
}
 
Example #10
Source File: HigherOrderFunction.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Private helper for any & all functions
 */
private EvaluationResult anyAndAllHelper(AttributeValue value, BagAttribute bag,
		Function function, EvaluationCtx context, boolean allFunction,
		boolean argumentsAreSwapped) {
	BooleanAttribute attr = BooleanAttribute.getInstance(allFunction);
	Iterator it = bag.iterator();

	while (it.hasNext()) {
		List<Evaluatable> params = new ArrayList<Evaluatable>();

		if (!argumentsAreSwapped) {
			params.add(value);
			params.add((AttributeValue) (it.next()));
		} else {
			params.add((AttributeValue) (it.next()));
			params.add(value);
		}

		EvaluationResult result = function.evaluate(params, context);

		if (result.indeterminate())
			return result;

		BooleanAttribute bool = (BooleanAttribute) (result.getAttributeValue());
		if (bool.getValue() != allFunction) {
			attr = bool;
			break;
		}
	}

	return new EvaluationResult(attr);
}
 
Example #11
Source File: XACML3HigherOrderFunction.java    From balana with Apache License 2.0 5 votes vote down vote up
private EvaluationResult anyAndAllHelper(EvaluationCtx context, Function function, List<AttributeValue> values,
                                         BagAttribute bag, boolean isAllFunction) {

    Iterator it = bag.iterator();
    while (it.hasNext()) {
        AttributeValue bagValue = (AttributeValue) (it.next());
        for (AttributeValue value : values) {
            EvaluationResult result = getEvaluationResult(context, function, value, bagValue, isAllFunction);
            if (result != null) {
                return result;
            }
        }
    }
    return new EvaluationResult(BooleanAttribute.getInstance(isAllFunction));
}
 
Example #12
Source File: XPathFunction.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Private helper that returns the return type for the given standard function. Note that this
 * doesn't check on the return value since the method always is called after getId, so we assume
 * that the function is present.
 *
 * @param functionName function name
 * @return identifier of the Data type
 */
private static String getReturnType(String functionName) {
    
    if (functionName.equals(NAME_XPATH_NODE_COUNT)){
        return IntegerAttribute.identifier;
    } else {
        return BooleanAttribute.identifier;
    }
}
 
Example #13
Source File: XACML3HigherOrderFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
private EvaluationResult anyOfAny(EvaluationCtx context, Function function, List<AttributeValue> args,
                                  List<BagAttribute> bagArgs) {

    // The expression SHALL be evaluated as if the function named in the <Function> argument was applied
    // between every tuple of the cross product on all bags and the primitive values, and the results were
    // combined using “urn:oasis:names:tc:xacml:1.0:function:or”

    EvaluationResult result = new EvaluationResult(BooleanAttribute.getInstance(false));
    if (!args.isEmpty()) {
        for (int i = 0; i < args.size() - 1; i++) {
            AttributeValue value = args.get(i);
            List<AttributeValue> bagValue = new ArrayList<>();
            bagValue.add(value);
            BagAttribute bagArg = new BagAttribute(value.getType(), bagValue);
            result = anyAndAllHelper(context, function, args.subList(i + 1, args.size()), bagArg, false);
            if (result.indeterminate() || ((BooleanAttribute) (result.getAttributeValue())).getValue()) {
                return result;
            }
        }
        return new EvaluationResult(BooleanAttribute.getInstance(false));
    }
    if (!bagArgs.isEmpty()) {
        for (int i = 0; i < bagArgs.size(); i++) {
            for (int j = i + 1; j < bagArgs.size(); j++) {
                Iterator iIterator = bagArgs.get(i).iterator();
                while (iIterator.hasNext()) {
                    AttributeValue iValue = (AttributeValue) (iIterator.next());
                    Iterator jIterator = bagArgs.get(j).iterator();
                    while (jIterator.hasNext()) {
                        AttributeValue jValue = (AttributeValue) (jIterator.next());
                        result = getEvaluationResult(context, function, jValue, iValue, false);
                        if (result != null && (result.indeterminate() ||
                                ((BooleanAttribute) (result.getAttributeValue())).getValue())) {
                            return result;
                        }
                    }
                }
            }
        }
        return new EvaluationResult(BooleanAttribute.getInstance(false));
    }
    return null;
}
 
Example #14
Source File: BooleanAttributeProxy.java    From balana with Apache License 2.0 4 votes vote down vote up
public AttributeValue getInstance(String value) throws Exception {
    return BooleanAttribute.getInstance(value);
}
 
Example #15
Source File: BooleanAttributeProxy.java    From balana with Apache License 2.0 4 votes vote down vote up
public AttributeValue getInstance(Node root) throws Exception {
    return BooleanAttribute.getInstance(root);
}
 
Example #16
Source File: TimeInRangeFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
/**
 * Default constructor.
 */
public TimeInRangeFunction() {
    super(NAME, 0, TimeAttribute.identifier, false, 3, BooleanAttribute.identifier, false);
}
 
Example #17
Source File: XACML3HigherOrderFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
@Override
public void checkInputs(List inputs) throws IllegalArgumentException {

    Object[] list = inputs.toArray();

    // First, check that we got the right number of parameters.
    if (list.length < 2) {
        throw new IllegalArgumentException("requires more than two inputs");
    }

    // Try to cast the first element into a function.
    Function function;

    if (list[0] instanceof Function) {
        function = (Function) (list[0]);
    } else {
        throw new IllegalArgumentException("first arg to higher-order "
                + " function must be a function");
    }

    // Check that the function returns a boolean
    if (!function.getReturnType().toString().equals(BooleanAttribute.identifier))
        throw new IllegalArgumentException("higher-order function must "
                + "use a boolean function");

    // Separate the remaining inputs into primitive data types or bags of primitive types.
    List<Evaluatable> bagArgs = new ArrayList();
    List<Evaluatable> args = new ArrayList();
    for (int i = 1; i < list.length; i++) {
        Evaluatable eval = (Evaluatable) (list[i]);
        if (eval.returnsBag()) {
            bagArgs.add(eval);
        } else {
            args.add(eval);
        }
    }
    if (functionId == ID_ALL_OF || functionId == ID_ANY_OF) {
        // The n-1 parameters SHALL be values of primitive data-types and one SHALL be a bag of a primitive
        // data-type for any-of and all-of.
        if (bagArgs.size() != 1) {
            throw new IllegalArgumentException("Only one argument SHALL be a bag of a primitive data-type for " +
                    getIdentifier());
        }
        //  The expression SHALL be evaluated as if the function named in the <Function> argument were applied
        //  to the n-1 non-bag arguments and each element of the bag argument for any-of and all-of.
        for (Evaluatable arg : args) {
            List<Evaluatable> inputForCheck = new ArrayList();
            inputForCheck.add(arg);
            inputForCheck.addAll(bagArgs);
            function.checkInputsNoBag(inputForCheck);
        }
    } else {
        // The remaining arguments are either primitive data types or bags of primitive types.
        if (!args.isEmpty() && !bagArgs.isEmpty()) {
            throw new IllegalArgumentException("The arguments can be are either primitive data types or " +
                    "bags of primitive types. " + getIdentifier());
        }
        // The expression SHALL be evaluated as if the function named in the <Function> argument was applied
        // between every tuple of the cross product on all bags and the primitive values.
        if (!args.isEmpty()) {
            validateAnyOfAnyInput(args, function);
        } else {
            validateAnyOfAnyInput(bagArgs, function);
        }
    }
}
 
Example #18
Source File: NOfFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
/**
 * Evaluate the function, using the specified parameters.
 * 
 * @param inputs a <code>List</code> of <code>Evaluatable</code> objects representing the
 *            arguments passed to the function
 * @param context an <code>EvaluationCtx</code> so that the <code>Evaluatable</code> objects can
 *            be evaluated
 * @return an <code>EvaluationResult</code> representing the function's result
 */
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {

    // Evaluate the arguments one by one. As soon as we can return
    // a result, do so. Return Indeterminate if any argument
    // evaluated is indeterminate.
    Iterator it = inputs.iterator();
    Evaluatable eval = (Evaluatable) (it.next());

    // Evaluate the first argument
    EvaluationResult result = eval.evaluate(context);
    if (result.indeterminate())
        return result;

    // if there were no problems, we know 'n'
    long n = ((IntegerAttribute) (result.getAttributeValue())).getValue();

    // If the number of trues needed is less than zero, report an error.
    if (n < 0)
        return makeProcessingError("First argument to " + getFunctionName()
                + " cannot be negative.");

    // If the number of trues needed is zero, return true.
    if (n == 0)
        return EvaluationResult.getTrueInstance();

    // make sure it's possible to find n true values
    long remainingArgs = inputs.size() - 1;
    if (n > remainingArgs)
        return makeProcessingError("not enough arguments to n-of to " + "find " + n
                + " true values");

    // loop through the inputs, trying to find at least n trues
    while (remainingArgs >= n) {
        eval = (Evaluatable) (it.next());

        // evaluate the next argument
        result = eval.evaluate(context);
        if (result.indeterminate())
            return result;

        // get the next value, and see if it's true
        if (((BooleanAttribute) (result.getAttributeValue())).getValue()) {
            // we're one closer to our goal...see if we met it
            if (--n == 0)
                return EvaluationResult.getTrueInstance();
        }

        // we're still looking, but we've got one fewer arguments
        remainingArgs--;
    }

    // if we got here then we didn't meet our quota
    return EvaluationResult.getFalseInstance();
}
 
Example #19
Source File: ConditionSetFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
/**
 * Evaluates the function, using the specified parameters.
 * 
 * @param inputs a <code>List</code> of <code>Evaluatable</code> objects representing the
 *            arguments passed to the function
 * @param context an <code>EvaluationCtx</code> so that the <code>Evaluatable</code> objects can
 *            be evaluated
 * @return an <code>EvaluationResult</code> representing the function's result
 */
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {

	// Evaluate the arguments
	AttributeValue[] argValues = new AttributeValue[inputs.size()];
	EvaluationResult evalResult = evalArgs(inputs, context, argValues);
	if (evalResult != null)
		return evalResult;

	// setup the two bags we'll be using
	BagAttribute[] bags = new BagAttribute[2];
	bags[0] = (BagAttribute) (argValues[0]);
	bags[1] = (BagAttribute) (argValues[1]);

	AttributeValue result = null;

	switch (getFunctionId()) {
	// *-at-least-one-member-of takes two bags of the same type and
	// returns a boolean
	case ID_BASE_AT_LEAST_ONE_MEMBER_OF:
		// true if at least one element in the first argument is in the
		// second argument (using the *-is-in semantics)

		result = BooleanAttribute.getFalseInstance();
		Iterator it = bags[0].iterator();

		while (it.hasNext()) {
			if (bags[1].contains((AttributeValue) (it.next()))) {
				result = BooleanAttribute.getTrueInstance();
				break;
			}
		}

		break;

	// *-set-equals takes two bags of the same type and returns
	// a boolean
	case ID_BASE_SUBSET:
		// returns true if the first argument is a subset of the second
		// argument (ie, all the elements in the first bag appear in
		// the second bag) ... ignore all duplicate values in both
		// input bags

		boolean subset = bags[1].containsAll(bags[0]);
		result = BooleanAttribute.getInstance(subset);

		break;

	// *-set-equals takes two bags of the same type and returns
	// a boolean
	case ID_BASE_SET_EQUALS:

		// returns true if the two inputs contain the same elements
		// discounting any duplicates in either input ... this is the same
		// as applying the and function on the subset function with
		// the two inputs, and then the two inputs reversed (ie, are the
		// two inputs subsets of each other)

		boolean equals = (bags[1].containsAll(bags[0]) && bags[0].containsAll(bags[1]));
		result = BooleanAttribute.getInstance(equals);

		break;
	}

	return new EvaluationResult(result);
}
 
Example #20
Source File: EvalPermissionTreeFunction.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
public EvalPermissionTreeFunction() {

        super(SUBJECT_HAS_PERMISSION, ID_EVAL_PERMISSION_TREE, StringAttribute.identifier, false, 2, 2,
                BooleanAttribute.identifier, false);
    }
 
Example #21
Source File: IPInRangeFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
/**
 * Default constructor.
 */
public IPInRangeFunction() {
    super(NAME, 0, IPAddressAttribute.identifier, false, 3, BooleanAttribute.identifier, false);
}
 
Example #22
Source File: HigherOrderFunction.java    From balana with Apache License 2.0 4 votes vote down vote up
/**
 * Checks that the given inputs are valid for this function.
 * 
 * @param inputs a <code>List</code> of <code>Evaluatable</code>s
 * 
 * @throws IllegalArgumentException if the inputs are invalid
 */
public void checkInputs(List inputs) throws IllegalArgumentException {
	Object[] list = inputs.toArray();

	// first off, check that we got the right number of paramaters
	if (list.length != 3)
		throw new IllegalArgumentException("requires three inputs");

	// now, try to cast the first element into a function
	Function function = null;

	if (list[0] instanceof Function) {
		function = (Function) (list[0]);
	} else if (list[0] instanceof VariableReference) {
		Expression xpr = ((VariableReference) (list[0])).getReferencedDefinition()
				.getExpression();
		if (xpr instanceof Function)
			function = (Function) xpr;
	}

	if (function == null)
		throw new IllegalArgumentException("first arg to higher-order "
				+ " function must be a function");

	// check that the function returns a boolean
	if (!function.getReturnType().toString().equals(BooleanAttribute.identifier))
		throw new IllegalArgumentException("higher-order function must "
				+ "use a boolean function");

	// get the two inputs
	Evaluatable eval1 = (Evaluatable) (list[1]);
	Evaluatable eval2 = (Evaluatable) (list[2]);

	// the first arg might be a bag
	if (secondIsBag && (!eval1.returnsBag()))
		throw new IllegalArgumentException("first arg has to be a bag");

	// the second arg must be a bag
	if (!eval2.returnsBag())
		throw new IllegalArgumentException("second arg has to be a bag");

	// finally, we need to make sure that the given type will work on
	// the given function
	List args = new ArrayList();
	args.add(eval1);
	args.add(eval2);
	function.checkInputsNoBag(args);
}
 
Example #23
Source File: NOfFunction.java    From balana with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new <code>NOfFunction</code> object.
 * 
 * @param functionName the standard XACML name of the function to be handled by this object,
 *            including the full namespace
 * 
 * @throws IllegalArgumentException if the function is unknown
 */
public NOfFunction(String functionName) {
    super(NAME_N_OF, 0, BooleanAttribute.identifier, false);

    if (!functionName.equals(NAME_N_OF))
        throw new IllegalArgumentException("unknown nOf function: " + functionName);
}
 
Example #24
Source File: NotFunction.java    From balana with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new <code>NotFunction</code> object.
 * 
 * @param functionName the standard XACML name of the function to be handled by this object,
 *            including the full namespace
 * 
 * @throws IllegalArgumentException if the function is unknown
 */
public NotFunction(String functionName) {
    super(NAME_NOT, 0, BooleanAttribute.identifier, false, 1, BooleanAttribute.identifier,
            false);

    if (!functionName.equals(NAME_NOT))
        throw new IllegalArgumentException("unknown not function: " + functionName);
}
 
Example #25
Source File: ConditionSetFunction.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that is used to create instances of condition set functions for new
 * (non-standard) datatypes. This is equivalent to using the <code>getInstance</code> methods in
 * <code>SetFunction</code> and is generally only used by the run-time configuration code.
 * 
 * @param functionName the name of the new function
 * @param datatype the full identifier for the supported datatype
 * @param functionType which kind of Set function, based on the <code>NAME_BASE_*</code> fields
 */
public ConditionSetFunction(String functionName, String datatype, String functionType) {
	super(functionName, getId(functionName), datatype, BooleanAttribute.identifier, false);
}
 
Example #26
Source File: ConditionSetFunction.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor that is used to create one of the condition standard set functions. The name
 * supplied must be one of the standard XACML functions supported by this class, including the
 * full namespace, otherwise an exception is thrown. Look in <code>SetFunction</code> for
 * details about the supported names.
 * 
 * @param functionName the name of the function to create
 * 
 * @throws IllegalArgumentException if the function is unknown
 */
public ConditionSetFunction(String functionName) {
	super(functionName, getId(functionName), getArgumentType(functionName),
			BooleanAttribute.identifier, false);
}
 
Example #27
Source File: EqualFunction.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new <code>EqualFunction</code> object.
 * 
 * @param functionName the standard XACML name of the function to be handled by this object,
 *            including the full namespace
 * @param argumentType the standard XACML name for the type of the arguments, inlcuding the full
 *            namespace
 */
public EqualFunction(String functionName, String argumentType) {
    super(functionName, getId(functionName), argumentType, false, 2, BooleanAttribute.identifier, false);
}
 
Example #28
Source File: MatchFunction.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new <code>MatchFunction</code> based on the given name.
 * 
 * @param functionName the name of the standard match function, including the complete namespace
 * 
 * @throws IllegalArgumentException if the function is unknown
 */
public MatchFunction(String functionName) {
    super(functionName, getId(functionName), getArgumentTypes(functionName), bagParams,
            BooleanAttribute.identifier, false);
}
 
Example #29
Source File: LogicalFunction.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new <code>LogicalFunction</code> object.
 * 
 * @param functionName the standard XACML name of the function to be handled by this object,
 *            including the full namespace
 * 
 * @throws IllegalArgumentException if the functionName is unknown
 */
public LogicalFunction(String functionName) {
    super(functionName, getId(functionName), BooleanAttribute.identifier, false, -1,
            BooleanAttribute.identifier, false);
}
 
Example #30
Source File: BagFunction.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Protected constuctor used by the general and condition subclasses to create a boolean
 * function with parameters of different datatypes. If you need to create a new
 * <code>BagFunction</code> instance you should either use one of the <code>getInstance</code>
 * methods or construct one of the sub-classes directly.
 * 
 * @param functionName the identitifer for the function
 * @param functionId an optional, internal numeric identifier
 * @param paramTypes the datatype of each parameter
 */
protected BagFunction(String functionName, int functionId, String[] paramTypes) {
    super(functionName, functionId, paramTypes, bagParams, BooleanAttribute.identifier, false);
}