@Override
public Comparison compare(final Attributes remote, final Attributes local) {
if(log.isDebugEnabled()) {
log.debug(String.format("Compare timestamp for %s with %s", remote, local));
}
if(-1 == remote.getModificationDate()) {
log.warn(String.format("No remote modification date available for comparison for %s", remote));
return Comparison.unknown;
}
if(-1 == local.getModificationDate()) {
log.warn(String.format("No local modification date available for comparison for %s", local));
return Comparison.unknown;
}
if(calendarService.asDate(local.getModificationDate(), Instant.SECOND).before(
calendarService.asDate(remote.getModificationDate(), Instant.SECOND))) {
return Comparison.remote;
}
if(calendarService.asDate(local.getModificationDate(), Instant.SECOND).after(
calendarService.asDate(remote.getModificationDate(), Instant.SECOND))) {
return Comparison.local;
}
return Comparison.equal;
}
}