@Override
protected void executeFetch(final DSRequest request, final DSResponse response,
GenericDriftChangeSetCriteria criteria) {
if (null == this.templateId) {
DriftSnapshotRequest snapshotRequest = new DriftSnapshotRequest(driftDefId, version, null, null, true,
false);
executeGetSnapshot(request, response, snapshotRequest);
} else {
if (null == this.templateChangeSetId) {
DriftDefinitionTemplateCriteria templateCriteria = new DriftDefinitionTemplateCriteria();
templateCriteria.addFilterId(this.templateId);
GWTServiceLookup.getDriftService().findDriftDefinitionTemplatesByCriteria(templateCriteria,
new AsyncCallback<PageList<DriftDefinitionTemplate>>() {
public void onSuccess(final PageList<DriftDefinitionTemplate> result) {
templateChangeSetId = String.valueOf(result.get(0).getChangeSetId());
DriftSnapshotRequest snapshotRequest = new DriftSnapshotRequest(templateChangeSetId, null,
true, false);
executeGetSnapshot(request, response, snapshotRequest);
}
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to load definition.", caught);
}
});
} else {
DriftSnapshotRequest snapshotRequest = new DriftSnapshotRequest(templateChangeSetId, null, true, false);
executeGetSnapshot(request, response, snapshotRequest);
}
}
}