getMaxDateBO()

From a list of business objects, return those that contain the latest date.

Syntax

public static BusObj[] getMaxDateBO(BusObj[] boList, String attr,
       String dateFormat)
 public static BusObj[] getMaxDateBO(BusObjArray boList, String attr, 
       String dateFormat)
 

Parameters

boList
A list of business objects. It can be either an array of BusObj or an instance of BusObjArray. These business objects must be of the same business object type.

attr
The attribute of the business object to compare with. The attribute must be of type Date.

dateFormat
This is the date format. See DtpDate() for more details. If this is null, it is assumed that the date is the number of milliseconds since 1970.

Return values

An array of business objects that have the latest date.

Exceptions

All of these three exceptions are subclasses of RunTimeEntityException.

DtpIncompatibleBOTypeException - When the business objects in the list are not the same business object type.

DtpUnknownAttributeException - When the specified attribute is not a valid attribute in the business objects passed in.

DtpUnsupportedAttributeTypeException - When the type of the specified attribute is not one of the supported attribute types listed above.

DtpDateException - When the date format is invalid.

Notes

The getMaxDateBO() method scans through the list of business objects looking for the business object with the latest date and returns that business object. If multiple business objects have the same max date, all objects with that date are returned.

Tip:
This method is a static method.

In the evaluation of which date is earliest, Jan 1, 2004 000000 is later than Jan 1, 2002 000000, which is later than Jan 1, 1999 000000.

The date information is assumed to be stored in the attribute name passed into the method. If an object has null date information, that object is ignored. If all of the objects have null date information, null is returned.

Examples

try
    {
    BusObj[] max = DtpDate.getMaxDateBO(bos, "Start Date", 
       "D/M/Y h:m:s");
    }
 catch ( RunTimeEntityException err )
    {
    System.out.println(err.getMessage());
    }
 

See also

getMaxDate(), getMinDateBO()

Copyright IBM Corp. 1997, 2003