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

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


            break;
        }
        case ID_DATE_ADD_YEARMONTHDURATION:
        case ID_DATE_SUBTRACT_YEARMONTHDURATION: {
            DateAttribute date = (DateAttribute) argValues[0];
            YearMonthDurationAttribute duration =
                (YearMonthDurationAttribute) argValues[1];
           
            // Decide what sign goes with duration
            int sign = 1;
            if (getFunctionId() == ID_DATE_SUBTRACT_YEARMONTHDURATION)
                sign = -sign;
            if (duration.isNegative())
                sign = -sign;

            // Add (or subtract) the years and months.
            Calendar cal = new GregorianCalendar();
            cal.setTime(date.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 DateAttribute(cal.getTime(),
                                           date.getTimeZone(),
                                           date.getDefaultedTimeZone());

            break;
        }
        }

View Full Code Here


        long millis = dateTimeHelper();

        if (useCachedEnvValues)
            return currentDate;
        else
            return new DateAttribute(new Date(millis));
    }
View Full Code Here

        } else {
            // 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 currentDate;
        else
            return new DateAttribute(new Date(millis));
    }
View Full Code Here

        } else {
            // 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

            break;
        }
        case ID_DATE_ADD_YEARMONTHDURATION:
        case ID_DATE_SUBTRACT_YEARMONTHDURATION: {
            DateAttribute date = (DateAttribute) argValues[0];
            YearMonthDurationAttribute duration =
                (YearMonthDurationAttribute) argValues[1];
           
            // Decide what sign goes with duration
            int sign = 1;
            if (getFunctionId() == ID_DATE_SUBTRACT_YEARMONTHDURATION)
                sign = -sign;
            if (duration.isNegative())
                sign = -sign;

            // Add (or subtract) the years and months.
            Calendar cal = new GregorianCalendar();
            cal.setTime(date.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 DateAttribute(cal.getTime(),
                                           date.getTimeZone(),
                                           date.getDefaultedTimeZone());

            break;
        }
        }

View Full Code Here

TOP

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

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.