Examples of DateTimeAttribute


Examples of com.sun.xacml.attr.DateTimeAttribute

        if (object instanceof Float)
            retVal = new DoubleAttribute((Float) object);
        if (object instanceof Integer)
            retVal = new IntegerAttribute((Integer) object);
        if (object instanceof Date)
            retVal = new DateTimeAttribute((Date) object);
        if (object instanceof Geometry) {
            Geometry g = (Geometry) object;
            String gmlType = XACMLUtil.getGMLTypeFor(g);
            try {
                retVal = new GeometryAttribute(g, g.getUserData().toString(), null,
View Full Code Here

Examples of com.sun.xacml.attr.DateTimeAttribute

        }
        if (DateAttribute.identifier.equals(type)) {
            return new DateAttribute(DateFormat.getDateInstance().parse(value));
        }
        if (DateTimeAttribute.identifier.equals(type)) {
            return new DateTimeAttribute(DateFormat.getDateInstance().parse(value));
        }
        if (TimeAttribute.identifier.equals(type)) {
            return new TimeAttribute(DateFormat.getDateInstance().parse(value));
        }
        if (HexBinaryAttribute.identifier.equals(type)) {
View Full Code Here

Examples of com.sun.xacml.attr.DateTimeAttribute

            logger.debug("AttributeFinder:findAttribute will return a String {}", iAm());
            if (attributeType.toString().equals(StringAttribute.identifier)) {
                set.add(new StringAttribute((String) temp));
            } else if (attributeType.toString()
                    .equals(DateTimeAttribute.identifier)) {
                DateTimeAttribute tempDateTimeAttribute;
                try {
                    tempDateTimeAttribute =
                            DateTimeAttribute.getInstance((String) temp);
                    set.add(tempDateTimeAttribute);
                } catch (Throwable t) {
                }
            } else if (attributeType.toString()
                    .equals(DateAttribute.identifier)) {
                DateAttribute tempDateAttribute;
                try {
                    tempDateAttribute =
                            DateAttribute.getInstance((String) temp);
                    set.add(tempDateAttribute);
                } catch (Throwable t) {
                }
            } else if (attributeType.toString()
                    .equals(TimeAttribute.identifier)) {
                TimeAttribute tempTimeAttribute;
                try {
                    tempTimeAttribute =
                            TimeAttribute.getInstance((String) temp);
                    set.add(tempTimeAttribute);
                } catch (Throwable t) {
                }
            } else if (attributeType.toString()
                    .equals(IntegerAttribute.identifier)) {
                IntegerAttribute tempIntegerAttribute;
                try {
                    tempIntegerAttribute =
                            IntegerAttribute.getInstance((String) temp);
                    set.add(tempIntegerAttribute);
                } catch (Throwable t) {
                }
            } //xacml fixup
            //was set.add(new StringAttribute((String)temp));
        } else if (temp instanceof String[]) {
            logger.debug("AttributeFinder:findAttribute will return a String[] ", iAm());
            for (int i = 0; i < ((String[]) temp).length; i++) {
                if (((String[]) temp)[i] == null) {
                    continue;
                }
                if (attributeType.toString().equals(StringAttribute.identifier)) {
                    set.add(new StringAttribute(((String[]) temp)[i]));
                } else if (attributeType.toString()
                        .equals(DateTimeAttribute.identifier)) {
                    logger.debug("USING AS DATETIME:{}", ((String[]) temp)[i]);
                    DateTimeAttribute tempDateTimeAttribute;
                    try {
                        tempDateTimeAttribute =
                                DateTimeAttribute
                                        .getInstance(((String[]) temp)[i]);
                        set.add(tempDateTimeAttribute);
View Full Code Here

Examples of com.sun.xacml.attr.DateTimeAttribute

        long millis = dateTimeHelper();

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

Examples of com.sun.xacml.attr.DateTimeAttribute

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

Examples of com.sun.xacml.attr.DateTimeAttribute

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

        AttributeFactory attrFactory = AttributeFactory.getInstance();

View Full Code Here

Examples of com.sun.xacml.attr.DateTimeAttribute

        if (object instanceof Float)
            retVal = new DoubleAttribute((Float) object);
        if (object instanceof Integer)
            retVal = new IntegerAttribute((Integer) object);
        if (object instanceof Date)
            retVal = new DateTimeAttribute((Date) object);
        if (object instanceof Geometry) {
            Geometry g = (Geometry) object;
            String gmlType = XACMLUtil.getGMLTypeFor(g);
            try {
                retVal = new GeometryAttribute(g, g.getUserData().toString(), null,
View Full Code Here

Examples of com.sun.xacml.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;
        }
View Full Code Here

Examples of com.sun.xacml.attr.DateTimeAttribute

        // 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:
        case ID_DATE_SUBTRACT_YEARMONTHDURATION: {
View Full Code Here

Examples of com.sun.xacml.attr.DateTimeAttribute

        if (object instanceof Float)
            retVal = new DoubleAttribute((Float) object);
        if (object instanceof Integer)
            retVal = new IntegerAttribute((Integer) object);
        if (object instanceof Date)
            retVal = new DateTimeAttribute((Date) object);
        if (object instanceof Geometry) {
            Geometry g = (Geometry) object;
            String gmlType = XACMLUtil.getGMLTypeFor(g);
            try {
                retVal = new GeometryAttribute(g, g.getUserData().toString(), null,
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.