This is a very common requirement in any OAF project. The logic for Validating the date can be added in EO or AM. Below is the code that will help in comparing the sysdate with any date value. Below code is writtten inside the setter method in the EO.Ofcourse you can write it anywhere in AM also.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Date startDate = getStartDateActive(); OADBTransaction txn=(OADBTransaction)getOADBTransaction(); Date endDate=(Date)txn.getCurrentDBDate(); if(endDate !=null) { long endDateLong = endDate.dateValue().getTime(); if(endDateLong < startDate.dateValue().getTime()) { thrownew OARowValException(OARowValException.TYP_ENTITY_OBJECT, getEntityDef().getFullName(), getPrimaryKey(), "AK", // Message product short name "FWK_TBX_T_START_END_BAD");// Message name } }