Hey seamers :)
I have a quite simple question:
Suppose I have the following code in my domain model:
/**
*Check if given date is with a certain range
* @param date The date
* @return is it valid
*/
private boolean isSubProjectStartDateValid(Date date){
long after=project.getStartdate().getTime();
long before=project.getEnddate().getTime();
long lValue=date.getTime();
if(lValue<after) return false;
if(lValue>before) return false;
if((lValue>=after) &&(lValue<=before))return true;
return false;
}
public Date getStartDate() {
if(this.startDate==null)this.startDate=project.getStartdate();
return startDate;
}
public void setStartDate(Date startDate)throws Exception {
if(!isSubProjectStartDateValid(startDate)){
throw new Exception(" the date is invalid...);
}
this.startDate = startDate;
}For now I want to internationalize the exception message itself.
Note that the exception is correctly displayed on UI
I do not want to pollute my domain model with UI concerns as
FaceMessages.getInstance.addFrom...
would do
If you ever have any clues, they'd be welcome :P
Thanx in advance!
Laurent