Skip to content

Instantly share code, notes, and snippets.

@chriswk
Created October 15, 2013 11:06
Show Gist options
  • Save chriswk/6989970 to your computer and use it in GitHub Desktop.
Save chriswk/6989970 to your computer and use it in GitHub Desktop.
if (pbp.getDuration() > 0) {
setEndDate(null); // The stored procedure will figure out the end date given the product's duration
final DateMidnight today = new DateMidnight();
setStartDate(new Date(today.getMillis()));
} else {
if (adBean.getStartDate() != null) {
setStartDate(adBean.getStartDate());
} else {
final DateMidnight today = new DateMidnight();
setStartDate(new Date(today.getMillis()));
}
if (adBean.getEndDate() != null) {
setEndDate(adBean.getEndDate());
} else {
// Will be configured again later
final DateMidnight today = new DateMidnight();
setEndDate(new Date(today.getMillis()));
}
}
final Date today = new Date(new DateMidnight().getMillis());
if (pbp.getDuration() > 0) {
setEndDate(null); // The stored procedure will figure out the end date given the product's duration
setStartDate(today);
} else {
Date startDate = Optional.fromNullable(adBean.getStartDate()).or(today);
setStartDate(startDate);
Date endDate = Optional.fromNullable(adBean.getEndDate()).or(today);
setEndDate(endDate);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment