Examples of BagAttribute


Examples of com.sun.xacml.attr.BagAttribute

                             + "] " + s);
            }

        }

        BagAttribute bag = new BagAttribute(type, bagValues);
        return new EvaluationResult(bag);

    }
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

        switch (getFunctionId()) {

        // *-one-and-only takes a single bag and returns a
        // single value of baseType
        case ID_BASE_ONE_AND_ONLY: {
            BagAttribute bag = (BagAttribute) (argValues[0]);

            if (bag.size() != 1)
                return makeProcessingError(getFunctionName() + " expects "
                        + "a bag that contains a single " + "element, got a bag with " + bag.size()
                        + " elements");

            attrResult = (AttributeValue) (bag.iterator().next());
            break;
        }

            // *-size takes a single bag and returns an integer
        case ID_BASE_BAG_SIZE: {
            BagAttribute bag = (BagAttribute) (argValues[0]);

            attrResult = new IntegerAttribute(bag.size());
            break;
        }

            // *-bag takes any number of elements of baseType and
            // returns a bag containing those elements
        case ID_BASE_BAG: {
            List<AttributeValue> argsList = Arrays.asList(argValues);

            attrResult = new BagAttribute(getReturnType(), argsList);
            break;
        }
        }

        return new EvaluationResult(attrResult);
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

            // simply return INDETERMINATE
            return new MatchResult(MatchResult.INDETERMINATE, result.getStatus());
        }

        // an AD/AS will always return a bag
        BagAttribute bag = (BagAttribute) (result.getAttributeValue());

        if (!bag.isEmpty()) {
            // we got back a set of attributes, so we need to iterate through
            // them, seeing if at least one matches
            Iterator<AttributeValue> it = bag.iterator();
            boolean atLeastOneError = false;
            Status firstIndeterminateStatus = null;

            while (it.hasNext()) {
                ArrayList<AttributeValue> inputs = new ArrayList<AttributeValue>();
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

            // the first bag and a single value from the second bag, and if
            // any evaluation is true return true, otherwise return false

            result = new EvaluationResult(BooleanAttribute.getInstance(false));
            Iterator<AttributeValue> it = ((BagAttribute) args[0]).iterator();
            BagAttribute bag = (BagAttribute) (args[1]);

            while (it.hasNext()) {
                AttributeValue value = it.next();
                result = any(value, bag, function, context, false);

                if (result.indeterminate())
                    return result;

                if (((BooleanAttribute) (result.getAttributeValue())).getValue())
                    break;
            }
            break;
        }

        case ID_ALL_OF_ANY: {

            // param: boolean-function, bag, bag of same type
            // return: boolean
            // iterate through the first bag, and if for each of those values
            // one of the values in the second bag matches then return true,
            // otherwise return false

            result = allOfAny((BagAttribute) (args[1]), (BagAttribute) (args[0]), function, context);
            break;
        }

        case ID_ANY_OF_ALL: {

            // param: boolean-function, bag, bag of same type
            // return: boolean
            // iterate through the second bag, and if for each of those values
            // one of the values in the first bag matches then return true,
            // otherwise return false

            result = anyOfAll((BagAttribute) (args[0]), (BagAttribute) (args[1]), function, context);
            break;
        }

        case ID_ALL_OF_ALL: {

            // param: boolean-function, bag, bag of same type
            // return: boolean
            // iterate through the first bag, and for each of those values
            // if every value in the second bag matches using the given
            // function, then return true, otherwise return false

            result = new EvaluationResult(BooleanAttribute.getInstance(true));
            Iterator<AttributeValue> it = ((BagAttribute) args[0]).iterator();
            BagAttribute bag = (BagAttribute) (args[1]);

            while (it.hasNext()) {
                AttributeValue value = it.next();
                result = all(value, bag, function, context);
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

        if (valueList.isEmpty())
            throw new ParsingException("Attribute must contain a value");
        else if (valueList.size() == 1)
            return new Attribute(id, type, issuer, issueInstant, valueList.get(0));
        else {
            BagAttribute bag = new BagAttribute(type, valueList);
            return new Attribute(id, type, issuer, issueInstant, bag);
        }
    }
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

        // in a higher-order case, if anything is INDETERMINATE, then
        // we stop right away
        if (result.indeterminate())
            return result;

        BagAttribute bag = (BagAttribute) (result.getAttributeValue());

        // param: function, bag
        // return: bag
        // for each value in the bag evaluate the given function with
        // the value and put the function result in a new bag that
        // is ultimately returned

        Iterator<AttributeValue> it = bag.iterator();
        List<AttributeValue> outputs = new ArrayList<AttributeValue>();

        while (it.hasNext()) {
            List<AttributeValue> params = new ArrayList<AttributeValue>();
            params.add(it.next());
            result = function.evaluate(params, context);

            if (result.indeterminate())
                return result;

            outputs.add(result.getAttributeValue());
        }

        return new EvaluationResult(new BagAttribute(returnType, outputs));
    }
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

                                + result.getStatus().getMessage());
                    return result;
                }

                // if the result wasn't empty, then return the result
                BagAttribute bag = (BagAttribute) (result.getAttributeValue());
                if (!bag.isEmpty())
                    return result;
            }
        }

        // if we got here then there were no errors but there were also no
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

                            + result.getStatus().getMessage());
                return result;
            }

            // if the result wasn't empty, then return the result
            BagAttribute bag = (BagAttribute) (result.getAttributeValue());
            if (!bag.isEmpty())
                return result;
        }

        // if we got here then there were no errors but there were also no
        // matches, so we have to return an empty bag
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

                issuer, subjectCategory);
        if (result.indeterminate())
            return result;

        // check that we succeeded in getting the subject identifier
        BagAttribute bag = (BagAttribute) (result.getAttributeValue());
        if (bag.isEmpty()) {
            ArrayList<String> code = new ArrayList<String>();
            code.add(Status.STATUS_MISSING_ATTRIBUTE);
            Status status = new Status(code, "missing subject-id");
            return new EvaluationResult(status);
        }

        // finally, look for the subject who has the role-mapping defined,
        // and if they're the identified subject, add their role
        BagAttribute returnBag = null;
        Iterator<AttributeValue> it = bag.iterator();
        while (it.hasNext()) {
            StringAttribute attr = (StringAttribute) (it.next());
            if (attr.getValue().equals("Julius Hibbert")) {
                Set<AttributeValue> set = new HashSet<AttributeValue>();
                set.add(new StringAttribute("Physician"));
                returnBag = new BagAttribute(attributeType, set);
                break;
            }
        }

        return new EvaluationResult(returnBag);
View Full Code Here

Examples of com.sun.xacml.attr.BagAttribute

                    // sets won't allow duplicates, so this addition is ok
                    set.add(value);
                }
            }

            result = new BagAttribute(bags[0].getType(), set);

            break;

        // *-union takes two bags of the same type and returns a bag of
        // that type
        case ID_BASE_UNION:
            // create a bag with all the elements from both inputs, removing
            // all duplicate values

            Iterator<AttributeValue> it0 = bags[0].iterator();
            while (it0.hasNext()) {
                // first off, add all elements from the first bag...the set
                // will ignore all duplicates
                set.add(it0.next());
            }

            Iterator<AttributeValue> it1 = bags[1].iterator();
            while (it1.hasNext()) {
                // now add all the elements from the second bag...again, all
                // duplicates will be ignored by the set
                set.add(it1.next());
            }

            result = new BagAttribute(bags[0].getType(), set);

            break;
        }

        return new EvaluationResult(result);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.