Skip Headers
Oracle® Fusion Middleware User's Guide for Oracle Business Rules
11g Release 1 (11.1.1)
E10228-02
  Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

B Rules Extension Methods

This appendix lists the extension methods. This appendix includes the following sections:

B.1 Duration Extension Methods (oracle.rules.rl.extensions.Duration)

Table B-1 lists the Duration methods.

Use the Duration methods to calculate a duration between two dates. The Duration methods all take two date arguments. The Duration methods are overloaded so that the first argument is one of, java.util.Calendar or javax.xml.datatype.XMLGregorianCalendar, and the second argument is one of java.util.Calendar or javax.xml.datatype.XMLGregorianCalendar.

Rules Designer lists the arguments and valid types for each method in the list.

Table B-1 Oracle Business Rules Duration Methods

Method Returns Description

compare

int

Compares two dates and returns an int value of 0 if they are equal, less than 0 if date1 represents a point in time before date2, greater than 0 if date1 represents a point in time after date2.

daysBetween

int

Returns the difference between the two dates in days.

hoursBetween

long

Returns the difference between the two dates in hours.

millisecondsBetween

long

Returns the difference between the two dates in milliseconds.

minutesBetween

long

Returns the difference between the two dates in minutes.

monthsBetween

int

Returns the difference between the two dates in months.

secondsBetween

long

Returns the difference between the two dates in seconds.

weeksBetween

int

Returns the difference between the two dates in weeks.

yearsBetween

int

Returns the difference between the two dates in years.


B.2 JavaDate Extension Methods (oracle.rules.rl.extensions.JavaDate)

Table B-2 lists the JavaDate add and subtract methods. Table B-3 lists the JavaDate to and from string methods. For details see the ISO 8601 numeric representation of dates and times, at

http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/date_and_time_format.htm.

Use the JavaDate add and subtract methods to return an updated calendar. Each method in Table B-2 returns a java.util.Calendar. Each method takes a first argument of java.util.Calendar, and a second argument that is either an int or a long, depending on the method.

Table B-2 JavaDate Add To and Subtract From Calendar Methods

Method Arguments Description

addDaysTo

Calendar,int

Returns a new Calendar that is the result of adding the specified number of days to the specified date.

addHoursTo

Calendar,long

Returns a new Calendar that is the result of adding the specified number of hours to the specified date.

addMillisecondsTo

Calendar,long

Returns a new Calendar that is the result of adding the specified number of milliseconds to the specified date.

addMinutesTo

Calendar,long

Returns a new Calendar that is the result of adding the specified number of minutes to the specified date.

addMonthsTo

Calendar,int

Returns a new Calendar that is the result of adding the specified number of months to the specified date.

addSecondsTo

Calendar,long

Returns a new Calendar that is the result of adding the specified number of seconds to the specified date.

addWeeksTo

Calendar,int

Returns a new Calendar that is the result of adding the specified number of weeks to the specified date.

addYearsTo

Calendar,int

Returns a new Calendar that is the result of adding the specified number of years to the specified date.

subtractDaysFrom

Calendar,int

Returns a new Calendar that is the result of subtracting the specified number of days from the specified date.

subtractHoursFrom

Calendar,long

Returns a new Calendar that is the result of subtracting the specified number of hours from the specified date.

subtractMillisecondsFrom

Calendar,long

Returns a new Calendar that is the result of subtracting the specified number of milliseconds from the specified date.

subtractMinutesFrom

Calendar,long

Returns a new Calendar that is the result of subtracting the specified number of minutes from the specified date.

subtractMonthsFrom

Calendar,int

Returns a new Calendar that is the result of subtracting the specified number of months from the date.

subtractSecondsFrom

Calendar,long

Returns a new Calendar that is the result of subtracting the specified number of seconds from the specified date.

subtractWeeksFrom

Calendar,int

Returns a new Calendar that is the result of subtracting the specified number of weeks from the specified date.

subtractYearsFrom

Calendar,int

Returns a new Calendar that is the result of subtracting the specified number of years from the specified date.


Table B-3 JavaDate Date and Time String Methods

Method Returns Description

fromDateString

Calendar

Creates a Calendar instance for the specified ISO 8601 date. The argument is a String.

fromDateTimeString

Calendar

Creates a Calendar instance for the specified ISO 8601 date and time. The argument is a String.

fromTimeString

Calendar

Creates a Calendar instance for the specified ISO 8601 time. The argument is a String.

toDateString

String

Return the ISO 8601 representation of the specified date. The argument is a Calendar.

toDateTimeString

String

Return the ISO 8601 representation of the specified date and time. The argument is a Calendar.

toTimeString

String

Return the ISO 8601 representation of the specified time. The argument is a Calendar.


B.3 XMLDate Extension Methods (oracle.rules.rl.extensions.XMLDate)

Table B-4 lists the XMLDate add and subtract methods. Table B-5 lists the XMLDate to and from string methods. For details see the ISO 8601 numeric representation of dates and times, at

http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/date_and_time_format.htm.

Use the XMLDate add and subtract methods to return an updated XMLGregorianCalendar. Each method in Table B-4 returns a javax.xml.datatype.XMLGregorianCalendar. Each method takes a first argument of javax.xml.datatype.XMLGregorianCalendar, and a second argument that is either an int or a long, depending on the method.

Table B-4 XMLDate Add To and Subtract From Methods

Method Arguments Description

addDaysTo

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of adding the specified number of days to the specified XMLGregorianCalendar.

addHoursTo

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of adding the specified number of hours to the specified XMLGregorianCalendar.

addMillisecondsTo

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of adding the specified number of milliseconds to the specified XMLGregorianCalendar.

addMinutesTo

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of adding the specified number of minutes to the specified XMLGregorianCalendar.

addMonthsTo

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of adding the specified number of months to the specified XMLGregorianCalendar.

addSecondsTo

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of adding the specified number of seconds to the specified XMLGregorianCalendar.

addWeeksTo

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of adding the specified number of weeks to the specified XMLGregorianCalendar.

addYearsTo

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of adding the specified number of years to the specified XMLGregorianCalendar.

subtractDaysFrom

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of days from the specified XMLGregorianCalendar.

subtractHoursFrom

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of hours from the specified XMLGregorianCalendar.

subtractMillisecondsFrom

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of milliseconds from the specified XMLGregorianCalendar.

subtractMinutesFrom

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of minutes from the specified XMLGregorianCalendar.

subtractMonthsFrom

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of months from the specified XMLGregorianCalendar.

subtractSecondsFrom

XMLGregorianCalendar, long

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of seconds from the specified XMLGregorianCalendar.

subtractWeeksFrom

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of weeks from the specified XMLGregorianCalendar.

subtractYearsFrom

XMLGregorianCalendar, int

Returns a new XMLGregorianCalendar that is the result of subtracting the specified number of years from the specified XMLGregorianCalendar.


Table B-5 XMLDate To and From String Methods

Method Returns Description

fromString

XMLGregorianCalendar

Creates an XMLGregorianCalendar instance from specified ISO 8601 date, datetime or time. Takes a single String argument.

toString

String

Return the ISO 8601 representation of the specified XMLGregorianCalendar.Takes a single XMLGregorianCalendar argument.


B.4 OracleDate Methods (oracle.rules.sdk2.extensions.OracleDate)

Table B-6 lists the OracleDate add and subtract methods. Table B-7 lists the OracleDate to and from string methods. For details see the ISO 8601 numeric representation of dates and times, at http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/date_and_time_format.htm.

Use the OracleDate add and subtract methods to return an updated Timestamp. Each method in Table B-6 returns an oracle.jbo.domain.Timestamp. Each method takes a first argument of oracle.jbo.domain.Timestamp, and a second argument that is either an int or a long, depending on the method.

Table B-6 OracleDate Add To and Subtract From Methods

Method/Arguments Description

addDaysTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of days to the specified Timestamp instance.

addHoursTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of hours to the specified Timestamp instance.

addMillisecondsTooracle.jbo.domain.Timestamp, int

Returns a Timestamp instance that is the result of adding the specified number of milliseconds to the Timestamp instance.

addMinutesTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of minutes to the specified Timestamp instance.

addMonthsTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of months to the specified Timestamp instance.

addSecondsTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of seconds to the specified Timestamp instance.

addWeeksTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of weeks to the specified Timestamp instance.

addYearsTooracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of adding the specified number of years to the specified Timestamp instance.

subtractDaysFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of days from the specified Timestamp instance.

subtractHoursFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of hours from the specified Timestamp instance.

subtractMillisecondsFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of milliseconds from the Timestamp instance.

subtractMinutesFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of minutes from the specified Timestamp instance.

subtractMonthsFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of months from the date.

subtractSecondsFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of seconds from the specified Timestamp instance.

subtractWeeksFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of weeks from the specified Timestamp instance.

subtractYearsFromoracle.jbo.domain.Timestamp, int

Returns a new Timestamp instance that is the result of subtracting the specified number of years from the specified Timestamp instance.


Table B-7 OracleDate To String and From String Methods

Method Returns Description

fromString

oracle.jbo.domain.Timestamp

Creates a Timestamp instance for the specified ISO 8601 date and time string. Takes a single String argument.

toGregorianCalendar

java.util.GregorianCalendar

Return a GregorianCalendar representing the specified Timestamp. Takes a single oracle.jbo.domain.Timestamp argument.

toString

java.lang.String

Return the ISO 8601 representation of the specified Timestamp instance. Takes a single oracle.jbo.domain.Timestamp argument.


B.5 OracleDuration Methods (oracle.rules.sdk2.extensions.OracleDuration)

Use the Duration methods to calculate a duration between two dates. The Duration methods all take two date arguments. The Duration methods are overloaded so that the first argument is one of, java.util.Calendar, oracle.jbo.domain.Timestamp, javax.xml.datatype.XMLGregorianCalendar, and the second argument is one of java.util.Calendar, oracle.jbo.domain.Timestamp, or javax.xml.datatype.XMLGregorianCalendar. Note that one argument for the methods must be a Timestamp (oracle.jbo.domain.Timestamp).

Rules Designer lists the arguments and valid types for each method in the list.

Table B-8 lists the OracleDuration methods.

Table B-8 OracleDuration Methods

Method Returns Description

compare()

int

Compares two dates and returns an int value of 0 if they are equal, less than 0 if date1 represents a point in time before date2, greater than 0 if date1 represents a point in time after date2.

daysBetween()

int

Returns the difference between the two dates in days.

hoursBetween()

long

Returns the difference between the two dates in hours.

millisecondsBetween()

long

Returns the difference between the two dates in milliseconds.

minutesBetween()

long

Returns the difference between the two dates in minutes

monthsBetween()

int

Returns the difference between the two dates in months.

secondsBetween()

long

Returns the difference between the two dates in seconds.

weeksBetween()

int

Returns the difference between the two dates in weeks.

yearsBetween()

int

Returns the difference between the two dates in years.