Package org.jboss.security.xacml.sunxacml.attr

Examples of org.jboss.security.xacml.sunxacml.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 it = bag.iterator();
        List outputs = new ArrayList();

        while (it.hasNext()) {
            List params = new ArrayList();
            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


            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)));
    }
View Full Code Here

                    // 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 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 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

            // 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 it = ((BagAttribute)args[0]).iterator();
            BagAttribute bag = (BagAttribute)(args[1]);
           
            while (it.hasNext()) {
                AttributeValue value = (AttributeValue)(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 it = ((BagAttribute)args[0]).iterator();
            BagAttribute bag = (BagAttribute)(args[1]);

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

        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 argsList = Arrays.asList(argValues);

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

        return new EvaluationResult(attrResult);
View Full Code Here

            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 it = bag.iterator();
            boolean atLeastOneError = false;
            Status firstIndeterminateStatus = null;

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

                                    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

                                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

            return callHelper(type, id, issuer, category, designatorType);
        }
               
        // if we got here, then we found at least one useful AttributeValue
        return new EvaluationResult(new BagAttribute(type, attributes));
    }
View Full Code Here

                }

                list.add(attrFactory.createValue(type, text));
            }
           
            return new EvaluationResult(new BagAttribute(type, list));
        } catch (ParsingException pe) {
            return createProcessingError(pe.getMessage());
        } catch (UnknownIdentifierException uie) {
            return createProcessingError("unknown attribute type: " + type);
        }
View Full Code Here

TOP

Related Classes of org.jboss.security.xacml.sunxacml.attr.BagAttribute

Copyright © 2018 www.massapicom. 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.