}
}
private boolean diffAndCopy(UniqueId sourceId, UniqueId destinationId, boolean fastCopy, boolean verbose) {
if (fastCopy) {
ManageableHistoricalTimeSeries sourceTimeSeries = _sourceMaster.getTimeSeries(sourceId, HistoricalTimeSeriesGetFilter.ofLatestPoint());
ManageableHistoricalTimeSeries destTimeSeries = _destinationMaster.getTimeSeries(destinationId, HistoricalTimeSeriesGetFilter.ofLatestPoint());
if (!sourceTimeSeries.getTimeSeries().equals(destTimeSeries.getTimeSeries())) {
HistoricalTimeSeriesGetFilter filter = new HistoricalTimeSeriesGetFilter();
LocalDate lastSourceDate = sourceTimeSeries.getTimeSeries().getLatestTime();
LocalDate lastDestinationDate = destTimeSeries.getTimeSeries().getLatestTime();
if (lastSourceDate.isAfter(lastDestinationDate)) {
filter.setEarliestDate(lastDestinationDate.plusDays(1));
filter.setLatestDate(lastSourceDate);
sourceTimeSeries = _sourceMaster.getTimeSeries(sourceId, filter);
// get JUST the new days
_destinationMaster.updateTimeSeriesDataPoints(destinationId, sourceTimeSeries.getTimeSeries());
if (verbose) {
System.out.println("Fast updating " + sourceTimeSeries.getTimeSeries().size() + " data points");
}
return true;
} else {
s_logger.warn("Destination for " + destinationId + " has more up to date data than source, skipping!");
return false;
}
} else {
if (verbose) {
System.out.println("Fast compare of source and destination show they are the same, skipping");
}
}
return false;
} else {
ManageableHistoricalTimeSeries sourceTimeSeries = _sourceMaster.getTimeSeries(sourceId);
ManageableHistoricalTimeSeries destTimeSeries = _destinationMaster.getTimeSeries(destinationId);
if (!sourceTimeSeries.getTimeSeries().equals(destTimeSeries.getTimeSeries())) {
sourceTimeSeries = _sourceMaster.getTimeSeries(sourceId);
HistoricalTimeSeriesMasterUtils masterUtils = new HistoricalTimeSeriesMasterUtils(_destinationMaster);
masterUtils.writeTimeSeries(destinationId, sourceTimeSeries.getTimeSeries());
if (verbose) {
System.out.println("Full (slow) copy of source data to destination");
} else {
System.out.println("Full (slow) compare of source and destination show they are the same, skipping");
}
}
return sourceTimeSeries.getTimeSeries().equals(destTimeSeries.getTimeSeries());
}
}