Search in sources :

Example 1 with ReportingRepositoryInfo

use of org.openforis.collect.reporting.ReportingRepositoryInfo in project collect by openforis.

the class SaikuController method getInfo.

@RequestMapping(value = "datasources/{surveyName}/info", method = GET)
@ResponseBody
public Response getInfo(@PathVariable String surveyName) {
    ReportingRepositoryInfo info = reportingRepositories.getInfo(surveyName);
    Response response = new Response();
    response.setObject(info);
    return response;
}
Also used : ReportingRepositoryInfo(org.openforis.collect.reporting.ReportingRepositoryInfo) Response(org.openforis.commons.web.Response) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with ReportingRepositoryInfo

use of org.openforis.collect.reporting.ReportingRepositoryInfo in project collect by openforis.

the class RDBReportingRepositories method getInfo.

@Override
public ReportingRepositoryInfo getInfo(String surveyName) {
    Date rdbFileDate = localRDBStorageManager.getRDBFileDate(surveyName, RecordStep.ENTRY);
    if (rdbFileDate == null) {
        return null;
    } else {
        ReportingRepositoryInfo info = new ReportingRepositoryInfo();
        info.setLastUpdate(rdbFileDate);
        RecordFilter filter = new RecordFilter(surveyManager.get(surveyName));
        filter.setModifiedSince(rdbFileDate);
        info.setUpdatedRecordsSinceLastUpdate(recordManager.countRecords(filter));
        return info;
    }
}
Also used : ReportingRepositoryInfo(org.openforis.collect.reporting.ReportingRepositoryInfo) Date(java.util.Date) RecordFilter(org.openforis.collect.model.RecordFilter)

Aggregations

ReportingRepositoryInfo (org.openforis.collect.reporting.ReportingRepositoryInfo)2 Date (java.util.Date)1 RecordFilter (org.openforis.collect.model.RecordFilter)1 Response (org.openforis.commons.web.Response)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1