use of org.openforis.collect.model.SurveySummary in project collect by openforis.
the class SurveySelectVM method updateSurveyList.
@GlobalCommand
public void updateSurveyList() {
if (surveyImportPopUp != null || jobStatusPopUp != null) {
// skip survey list update
return;
}
try {
List<SurveySummary> newSummaries = loadSurveySummaries(null);
if (summaries == null) {
summaries = newSummaries;
} else {
for (SurveySummary newSummary : newSummaries) {
SurveySummary oldSummary = findSummary(newSummary.getId(), newSummary.isPublished(), newSummary.isTemporary());
if (oldSummary == null) {
// TODO handle this??
} else {
oldSummary.setRecordValidationProcessStatus(newSummary.getRecordValidationProcessStatus());
BindUtils.postNotifyChange(null, null, oldSummary, "recordValidationProgressStatus");
BindUtils.postNotifyChange(null, null, oldSummary, "recordValidationInProgress");
BindUtils.postNotifyChange(null, null, oldSummary, "recordValidationProgressPercent");
}
}
}
} catch (Exception e) {
return;
}
}
use of org.openforis.collect.model.SurveySummary in project collect by openforis.
the class SurveyManager method loadSummaryByName.
public SurveySummary loadSummaryByName(String name) {
SurveySummary temporarySummary = loadTemporarySummaryByName(name);
SurveySummary publishedSummary = getPublishedSummaryByName(name);
SurveySummary result = combineSummaries(temporarySummary, publishedSummary);
return result;
}
use of org.openforis.collect.model.SurveySummary in project collect by openforis.
the class SurveyManager method combineSummaries.
private SurveySummary combineSummaries(SurveySummary temporarySummary, SurveySummary publishedSummary) {
SurveySummary result;
if (temporarySummary != null) {
result = temporarySummary;
if (publishedSummary != null) {
result.setPublished(true);
result.setPublishedId(publishedSummary.getId());
}
} else {
result = publishedSummary;
}
return result;
}
use of org.openforis.collect.model.SurveySummary in project collect by openforis.
the class SurveyManager method loadCombinedSummaries.
public List<SurveySummary> loadCombinedSummaries(String labelLang, boolean includeDetails, Set<Integer> groupIds, List<SurveySummarySortField> sortFields) {
List<SurveySummary> publishedSurveySummaries = getSurveySummaries(labelLang, groupIds);
List<SurveySummary> temporarySurveySummaries = loadTemporarySummaries(labelLang, includeDetails, groupIds);
List<SurveySummary> result = new ArrayList<SurveySummary>();
Map<String, SurveySummary> summariesByUri = new HashMap<String, SurveySummary>();
for (SurveySummary tempSummary : temporarySurveySummaries) {
tempSummary.setPublished(false);
tempSummary.setTemporary(true);
result.add(tempSummary);
summariesByUri.put(tempSummary.getUri(), tempSummary);
}
for (SurveySummary publishedSummary : publishedSurveySummaries) {
publishedSummary.setPublishedId(publishedSummary.getId());
SurveySummary temporarySurveySummary = summariesByUri.get(publishedSummary.getUri());
if (temporarySurveySummary == null) {
result.add(publishedSummary);
} else {
temporarySurveySummary.setAvailability(PUBLISHED);
temporarySurveySummary.setPublished(true);
temporarySurveySummary.setRecordValidationProcessStatus(publishedSummary.getRecordValidationProcessStatus());
}
}
sortSummaries(result, sortFields);
return result;
}
use of org.openforis.collect.model.SurveySummary in project collect by openforis.
the class SurveyManager method loadSummaryByUri.
public SurveySummary loadSummaryByUri(String uri) {
SurveySummary temporarySummary = loadTemporarySummaryByUri(uri);
SurveySummary publishedSummary = getPublishedSummaryByUri(uri);
SurveySummary result = combineSummaries(temporarySummary, publishedSummary);
return result;
}
Aggregations