use of org.openforis.concurrency.ProgressListener in project collect by openforis.
the class ReportingRepositoriesGeneratorJob method buildTasks.
@Override
protected void buildTasks() throws Throwable {
addTask(new Task() {
protected void execute() throws Throwable {
reportingRepositories.createRepositories(survey.getName(), input.getLanguage(), new ProgressListener() {
public void progressMade(Progress progress) {
setProcessedItems(progress.getProcessedItems());
setTotalItems(progress.getTotalItems());
}
});
}
});
}
use of org.openforis.concurrency.ProgressListener in project collect by openforis.
the class RepositoryEventHandler method handleEvent.
private void handleEvent(SurveyEvent event, final KeepAlive keepAlive) {
ProgressListener keepAliveListener = createProgressListener(keepAlive);
String surveyName = event.getSurveyName();
if (event instanceof RecordTransaction) {
repositories.process((RecordTransaction) event);
} else if (event instanceof SurveyCreatedEvent) {
repositories.createRepositories(surveyName, null, keepAliveListener);
} else if (event instanceof SurveyUpdatedEvent) {
repositories.updateRepositories(surveyName, null, keepAliveListener);
} else if (event instanceof SurveyDeletedEvent) {
repositories.deleteRepositories(surveyName);
} else if (event instanceof InitializeRDBEvent) {
repositories.createRepository(surveyName, ((InitializeRDBEvent) event).getStep(), null, keepAliveListener);
}
}
use of org.openforis.concurrency.ProgressListener in project collect by openforis.
the class RepositoryEventHandler method handleFailingEvent.
private void handleFailingEvent(SurveyEvent event, KeepAlive keepAlive) {
String surveyName = ((SurveyEvent) event).getSurveyName();
if (event instanceof RecordTransaction) {
try {
ProgressListener keepAliveListener = createProgressListener(keepAlive);
repositories.deleteRepositories(surveyName);
repositories.createRepositories(surveyName, null, keepAliveListener);
handleEvent(event, keepAlive);
considerSurveyEvents(surveyName);
} catch (Exception e) {
logEventProcessFailed(event, e);
ignoreSurveyEvents(surveyName);
}
} else {
logEventIgnored(surveyName);
ignoreSurveyEvents(surveyName);
}
}
Aggregations