org.wso2.balana.attr.DateAttribute Java Examples

The following examples show how to use org.wso2.balana.attr.DateAttribute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DateMathFunction.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Private helper that returns the return type for the given standard function. Note that this
 * doesn't check on the return value since the method always is called after getId, so we assume
 * that the function is present.
 */
private static String getReturnType(String functionName) {
	if (functionName.equals(NAME_DATE_ADD_YEARMONTHDURATION)
			|| functionName.equals(NAME_DATE_SUBTRACT_YEARMONTHDURATION))
		return DateAttribute.identifier;
	else
		return DateTimeAttribute.identifier;
}
 
Example #2
Source File: CurrentEnvModule.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * Handles requests for the current Date.
 */
private EvaluationResult handleDate(URI type, String issuer, EvaluationCtx context) {
    // make sure they're asking for a date attribute
    if (!type.toString().equals(DateAttribute.identifier))
        return new EvaluationResult(BagAttribute.createEmptyBag(type));

    // get the value from the context
    return makeBag(context.getCurrentDate());
}
 
Example #3
Source File: DateAttributeProxy.java    From balana with Apache License 2.0 4 votes vote down vote up
public AttributeValue getInstance(Node root) throws Exception {
    return DateAttribute.getInstance(root);
}
 
Example #4
Source File: DateAttributeProxy.java    From balana with Apache License 2.0 4 votes vote down vote up
public AttributeValue getInstance(String value) throws Exception {
    return DateAttribute.getInstance(value);
}
 
Example #5
Source File: BasicEvaluationCtx.java    From balana with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the value for the current date. The current time, current date, and current dateTime
 * are consistent, so that they all represent the same moment. If this is the first time that
 * one of these three values has been requested, and caching is enabled, then the three values
 * will be resolved and stored.
 * <p/>
 * Note that the value supplied here applies only to dynamically resolved values, not those
 * supplied in the Request. In other words, this always returns a dynamically resolved value
 * local to the PDP, even if a different value was supplied in the Request. This is handled
 * correctly when the value is requested by its identifier.
 *
 * @return the current date
 */
public synchronized DateAttribute getCurrentDate() {
    long millis = dateTimeHelper();

    if (useCachedEnvValues)
        return currentDate;
    else
        return new DateAttribute(new Date(millis));
}
 
Example #6
Source File: EvaluationCtx.java    From balana with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the value for the current date as known by the PDP (if this value was also supplied
 * in the Request, this will generally be a different value). Details of caching or
 * location-based resolution are left to the underlying implementation.
 * 
 * @return the current date
 */
public DateAttribute getCurrentDate();