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

Examples of org.jboss.security.xacml.sunxacml.attr.DateTimeAttribute


            break;
        }

        case ID_DATETIME_GREATER_THAN: {
            DateTimeAttribute arg0 = (DateTimeAttribute)(argValues[0]);
            DateTimeAttribute arg1 = (DateTimeAttribute)(argValues[1]);

            boolResult =
                (dateCompare(arg0.getValue(), arg0.getNanoseconds(),
                             arg1.getValue(), arg1.getNanoseconds()) > 0);

            break;
        }

        case ID_DATETIME_GREATER_THAN_OR_EQUAL: {
            DateTimeAttribute arg0 = (DateTimeAttribute)(argValues[0]);
            DateTimeAttribute arg1 = (DateTimeAttribute)(argValues[1]);

            boolResult =
                (dateCompare(arg0.getValue(), arg0.getNanoseconds(),
                             arg1.getValue(), arg1.getNanoseconds()) >= 0);

            break;
        }

        case ID_DATETIME_LESS_THAN: {
            DateTimeAttribute arg0 = (DateTimeAttribute)(argValues[0]);
            DateTimeAttribute arg1 = (DateTimeAttribute)(argValues[1]);

            boolResult =
                (dateCompare(arg0.getValue(), arg0.getNanoseconds(),
                             arg1.getValue(), arg1.getNanoseconds()) < 0);

            break;
        }

        case ID_DATETIME_LESS_THAN_OR_EQUAL: {
            DateTimeAttribute arg0 = (DateTimeAttribute)(argValues[0]);
            DateTimeAttribute arg1 = (DateTimeAttribute)(argValues[1]);

            boolResult =
                (dateCompare(arg0.getValue(), arg0.getNanoseconds(),
                             arg1.getValue(), arg1.getNanoseconds()) <= 0);

            break;
        }

        case ID_DATE_GREATER_THAN: {
View Full Code Here


        // These two functions are basically the same except for sign.
        // And they both need to deal with sign anyway, so they share
        // their code.
        case ID_DATETIME_ADD_DAYTIMEDURATION:
        case ID_DATETIME_SUBTRACT_DAYTIMEDURATION: {
            DateTimeAttribute dateTime = (DateTimeAttribute) argValues[0];
            DayTimeDurationAttribute duration =
                (DayTimeDurationAttribute) argValues[1];

            // Decide what sign goes with duration
            int sign = 1;
            if (getFunctionId() == ID_DATETIME_SUBTRACT_DAYTIMEDURATION)
                sign = -sign;
            if (duration.isNegative())
                sign = -sign;
            long millis = sign * duration.getTotalSeconds();
            long nanoseconds = dateTime.getNanoseconds();
            nanoseconds = nanoseconds + (sign * duration.getNanoseconds());
            if (nanoseconds >= 1000000000) {
                nanoseconds -= 1000000000;
                millis += 1000;
            }
            if (nanoseconds < 0) {
                nanoseconds += 1000000000;
                millis -= 1000;
            }
            millis = millis + dateTime.getValue().getTime();

            attrResult = new DateTimeAttribute(new Date(millis),
                                               (int) nanoseconds,
                                               dateTime.getTimeZone(),
                                               dateTime.
                                                 getDefaultedTimeZone());

            break;
        }
        case ID_DATETIME_ADD_YEARMONTHDURATION:
        case ID_DATETIME_SUBTRACT_YEARMONTHDURATION: {
            DateTimeAttribute dateTime = (DateTimeAttribute) argValues[0];
            YearMonthDurationAttribute duration =
                (YearMonthDurationAttribute) argValues[1];
           
            // Decide what sign goes with duration
            int sign = 1;
            if (getFunctionId() == ID_DATETIME_SUBTRACT_YEARMONTHDURATION)
                sign = -sign;
            if (duration.isNegative())
                sign = -sign;

            // Add (or subtract) the years and months.
            Calendar cal = new GregorianCalendar();
            cal.setTime(dateTime.getValue());
            long years = sign * duration.getYears();
            long months = sign * duration.getMonths();
            if ((years > Integer.MAX_VALUE) || (years < Integer.MIN_VALUE))
                return makeProcessingError("years too large");
            if ((months > Integer.MAX_VALUE) || (months < Integer.MIN_VALUE))
                return makeProcessingError("months too large");

            cal.add(Calendar.YEAR, (int) years);
            cal.add(Calendar.MONTH, (int) months);

            attrResult = new DateTimeAttribute(cal.getTime(),
                                               dateTime.getNanoseconds(),
                                               dateTime.getTimeZone(),
                                               dateTime.
                                                 getDefaultedTimeZone());

            break;
        }
        case ID_DATE_ADD_YEARMONTHDURATION:
View Full Code Here

    */
   public static Attribute getInstance(Node root) throws ParsingException {
      URI id = null;
      URI type = null;
      String issuer = null;
      DateTimeAttribute issueInstant = null;
      AttributeValue value = null;
     
      Set<AttributeValue> valueSet = null;

      AttributeFactory attrFactory = AttributeFactory.getInstance();
View Full Code Here

        long millis = dateTimeHelper();

        if (useCachedEnvValues)
            return currentDateTime;
        else
            return new DateTimeAttribute(new Date(millis));
    }
View Full Code Here

            // we're caching, so resolve all three values, making sure
            // to use clean copies of the date object since it may be
            // modified when creating the attributes
            currentTime = new TimeAttribute(time);
            currentDate = new DateAttribute(new Date(millis));
            currentDateTime = new DateTimeAttribute(new Date(millis));
        }
       
        return -1;
    }
View Full Code Here

        long millis = dateTimeHelper();

        if (useCachedEnvValues)
            return currentDateTime;
        else
            return new DateTimeAttribute(new Date(millis));
    }
View Full Code Here

            // we're caching, so resolve all three values, making sure
            // to use clean copies of the date object since it may be
            // modified when creating the attributes
            currentTime = new TimeAttribute(time);
            currentDate = new DateAttribute(new Date(millis));
            currentDateTime = new DateTimeAttribute(new Date(millis));
        }
       
        return -1;
    }
View Full Code Here

    */
   public static Attribute getInstance(Node root) throws ParsingException {
      URI id = null;
      URI type = null;
      String issuer = null;
      DateTimeAttribute issueInstant = null;
      AttributeValue value = null;
     
      Set<AttributeValue> valueSet = null;

      AttributeFactory attrFactory = AttributeFactory.getInstance();
View Full Code Here

   {
      URI RESOURCE_URI = new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id");
      AttributeValue attributeValue = new StringAttribute("TestAttribute");
     
      Attribute attribute = new Attribute(RESOURCE_URI, "somepackage" ,
            new DateTimeAttribute(), attributeValue);
     
      assertNotNull("Attribute type", attribute.getType());
   }
View Full Code Here

        // These two functions are basically the same except for sign.
        // And they both need to deal with sign anyway, so they share
        // their code.
        case ID_DATETIME_ADD_DAYTIMEDURATION:
        case ID_DATETIME_SUBTRACT_DAYTIMEDURATION: {
            DateTimeAttribute dateTime = (DateTimeAttribute) argValues[0];
            DayTimeDurationAttribute duration =
                (DayTimeDurationAttribute) argValues[1];

            // Decide what sign goes with duration
            int sign = 1;
            if (getFunctionId() == ID_DATETIME_SUBTRACT_DAYTIMEDURATION)
                sign = -sign;
            if (duration.isNegative())
                sign = -sign;
            long millis = sign * duration.getTotalSeconds();
            long nanoseconds = dateTime.getNanoseconds();
            nanoseconds = nanoseconds + (sign * duration.getNanoseconds());
            if (nanoseconds >= 1000000000) {
                nanoseconds -= 1000000000;
                millis += 1000;
            }
            if (nanoseconds < 0) {
                nanoseconds += 1000000000;
                millis -= 1000;
            }
            millis = millis + dateTime.getValue().getTime();

            attrResult = new DateTimeAttribute(new Date(millis),
                                               (int) nanoseconds,
                                               dateTime.getTimeZone(),
                                               dateTime.
                                                 getDefaultedTimeZone());

            break;
        }
        case ID_DATETIME_ADD_YEARMONTHDURATION:
        case ID_DATETIME_SUBTRACT_YEARMONTHDURATION: {
            DateTimeAttribute dateTime = (DateTimeAttribute) argValues[0];
            YearMonthDurationAttribute duration =
                (YearMonthDurationAttribute) argValues[1];
           
            // Decide what sign goes with duration
            int sign = 1;
            if (getFunctionId() == ID_DATETIME_SUBTRACT_YEARMONTHDURATION)
                sign = -sign;
            if (duration.isNegative())
                sign = -sign;

            // Add (or subtract) the years and months.
            Calendar cal = new GregorianCalendar();
            cal.setTime(dateTime.getValue());
            long years = sign * duration.getYears();
            long months = sign * duration.getMonths();
            if ((years > Integer.MAX_VALUE) || (years < Integer.MIN_VALUE))
                return makeProcessingError("years too large");
            if ((months > Integer.MAX_VALUE) || (months < Integer.MIN_VALUE))
                return makeProcessingError("months too large");

            cal.add(Calendar.YEAR, (int) years);
            cal.add(Calendar.MONTH, (int) months);

            attrResult = new DateTimeAttribute(cal.getTime(),
                                               dateTime.getNanoseconds(),
                                               dateTime.getTimeZone(),
                                               dateTime.
                                                 getDefaultedTimeZone());

            break;
        }
        case ID_DATE_ADD_YEARMONTHDURATION:
View Full Code Here

TOP

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

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.