criteria.addFilterId(driftId);
criteria.fetchChangeSet(true);
criteria.setPageControl(PageControl.getSingleRowInstance());
DriftDetails driftDetails = new DriftDetails();
DriftServerPluginFacet driftServerPlugin = getServerPlugin();
DriftFile newFile = null;
DriftFile oldFile = null;
PageList<? extends Drift<?, ?>> results = driftServerPlugin.findDriftsByCriteria(subject, criteria);
if (results.size() == 0) {
log.warn("Unable to get the drift details for drift id " + driftId
+ ". No drift object found with that id.");
return null;
}
Drift<?, ?> drift = results.get(0);
driftDetails.setDrift(drift);
try {
switch (drift.getCategory()) {
case FILE_ADDED:
newFile = driftServerPlugin.getDriftFile(subject, drift.getNewDriftFile().getHashId());
driftDetails.setNewFileStatus(newFile.getStatus());
break;
case FILE_CHANGED:
newFile = driftServerPlugin.getDriftFile(subject, drift.getNewDriftFile().getHashId());
oldFile = driftServerPlugin.getDriftFile(subject, drift.getOldDriftFile().getHashId());
driftDetails.setNewFileStatus(newFile.getStatus());
driftDetails.setOldFileStatus(oldFile.getStatus());
driftDetails.setPreviousChangeSet(loadPreviousChangeSet(subject, drift));
break;
case FILE_REMOVED:
oldFile = driftServerPlugin.getDriftFile(subject, drift.getOldDriftFile().getHashId());
driftDetails.setOldFileStatus(oldFile.getStatus());
break;
}
} catch (Exception e) {
log.error("An error occurred while loading the drift details for drift id " + driftId + ": "