Class RecordController

java.lang.Object
org.openforis.collect.web.controller.BasicController
org.openforis.collect.web.controller.RecordController
All Implemented Interfaces:
Serializable

@Controller @Scope("session") @RequestMapping("api") public class RecordController extends BasicController implements Serializable
Author:
S. Ricci
See Also:
  • Constructor Details

    • RecordController

      public RecordController()
  • Method Details

    • loadData

      @RequestMapping(value="survey/{surveyId}/data/records/{recordId}/binary_data.json", method=GET) @ResponseBody public Map<String,Object> loadData(@PathVariable("surveyId") int surveyId, @PathVariable("recordId") int recordId, @RequestParam("step") Integer stepNumber) throws Exception
      Throws:
      Exception
    • getCount

      @RequestMapping(value="survey/{surveyId}/data/records/count.json", method=GET) @ResponseBody public int getCount(@PathVariable("surveyId") int surveyId, @RequestParam(value="rootEntityDefinitionId",required=false) Integer rootEntityDefinitionId, @RequestParam(value="step",required=false) Integer stepNumber) throws Exception
      Throws:
      Exception
    • loadRecordSummaries

      @RequestMapping(value="survey/{surveyId}/data/records/summary", method=GET) @ResponseBody public Map<String,Object> loadRecordSummaries(@PathVariable("surveyId") int surveyId, @Valid @Valid RecordController.RecordSummarySearchParameters params)
    • loadRecord

      @RequestMapping(value="survey/{surveyId}/data/records/{recordId}", method=GET, produces="application/json") @ResponseBody public RecordProxy loadRecord(@PathVariable("surveyId") int surveyId, @PathVariable("recordId") int recordId, @RequestParam(value="step",required=false) Integer stepNumber, @RequestParam(value="lock",required=false,defaultValue="false") boolean lock) throws RecordPersistenceException
      Throws:
      RecordPersistenceException
    • updateOwner

      @RequestMapping(value="survey/{surveyId}/data/update/records/{recordId}", method=POST, produces="application/json") @ResponseBody public org.openforis.commons.web.Response updateOwner(@PathVariable("surveyId") int surveyId, @PathVariable("recordId") int recordId, @RequestBody Map<String,String> body) throws RecordLockedException, MultipleEditException
      Throws:
      RecordLockedException
      MultipleEditException
    • promoteRecord

      @RequestMapping(value="survey/{surveyId}/data/records/promote/{recordId}", method=POST, produces="application/json") @ResponseBody public org.openforis.commons.web.Response promoteRecord(@PathVariable("surveyId") int surveyId, @PathVariable("recordId") int recordId) throws MissingRecordKeyException, RecordPromoteException
      Throws:
      MissingRecordKeyException
      RecordPromoteException
    • demoteRecord

      @RequestMapping(value="survey/{surveyId}/data/records/demote/{recordId}", method=POST, produces="application/json") @ResponseBody public org.openforis.commons.web.Response demoteRecord(@PathVariable("surveyId") int surveyId, @PathVariable("recordId") int recordId) throws RecordPersistenceException
      Throws:
      RecordPersistenceException
    • moveRecords

      @RequestMapping(value="survey/{surveyId}/data/move/records", method=POST, produces="application/json") @ResponseBody public JobProxy moveRecords(@PathVariable("surveyId") int surveyId, @RequestParam String fromStep, @RequestParam boolean promote)
    • newRecord

      @Transactional @RequestMapping(value="survey/{surveyId}/data/records", method=POST, consumes="application/json") @ResponseBody public RecordProxy newRecord(@PathVariable("surveyId") int surveyId, @RequestBody RecordGenerator.NewRecordParameters params) throws RecordPersistenceException
      Throws:
      RecordPersistenceException
    • createRandomRecord

      @Transactional @RequestMapping(value="survey/{surveyId}/data/records/random", method=POST, consumes="application/json") @ResponseBody public RecordProxy createRandomRecord(@PathVariable("surveyId") int surveyId, @RequestBody RecordGenerator.NewRecordParameters params) throws RecordPersistenceException
      Throws:
      RecordPersistenceException
    • deleteRecord

      @RequestMapping(value="survey/{surveyId}/data/records", method=DELETE, produces="application/json") @ResponseBody public org.openforis.commons.web.Response deleteRecord(@PathVariable("surveyId") int surveyId, @Valid @Valid RecordController.RecordDeleteParameters params) throws RecordPersistenceException
      Throws:
      RecordPersistenceException
    • startRecordImportSummaryJob

      @RequestMapping(value="survey/{surveyId}/data/import/records/summary", method=POST, consumes="multipart/form-data") @ResponseBody public CollectJobController.JobView startRecordImportSummaryJob(@PathVariable("surveyId") int surveyId, @RequestParam("file") org.springframework.web.multipart.MultipartFile multipartFile, @RequestParam String rootEntityName) throws IOException
      Throws:
      IOException
    • downloadRecordImportSummary

      @RequestMapping(value="survey/{surveyId}/data/import/records/summary", method=GET) @ResponseBody public DataImportSummaryProxy downloadRecordImportSummary(@PathVariable("surveyId") int surveyId) throws IOException
      Throws:
      IOException
    • startRecordImport

      @RequestMapping(value="survey/{surveyId}/data/import/records", method=POST) @ResponseBody public CollectJobController.JobView startRecordImport(@PathVariable("surveyId") int surveyId, @RequestParam List<Integer> entryIdsToImport, @RequestParam(defaultValue="true") boolean validateRecords) throws IOException
      Throws:
      IOException
    • startCsvDataImportJob

      @RequestMapping(value="survey/{surveyId}/data/csvimport/records", method=POST, consumes="multipart/form-data") @ResponseBody public CollectJobController.JobView startCsvDataImportJob(@PathVariable("surveyId") int surveyId, @RequestParam("file") org.springframework.web.multipart.MultipartFile multipartFile, @RequestParam String rootEntityName, @RequestParam String importType, @RequestParam String steps, @RequestParam(required=false) Integer entityDefinitionId, @RequestParam(required=false) boolean validateRecords, @RequestParam(required=false) boolean deleteEntitiesBeforeImport, @RequestParam(required=false) String newRecordVersionName) throws IOException
      Throws:
      IOException
    • getCsvDataImportStatus

      @RequestMapping(value="survey/{surveyId}/data/csvimport/records", method=GET) @ResponseBody public DataImportStatusProxy getCsvDataImportStatus(@PathVariable("surveyId") int surveyId)
    • exportRecordToCsv

      @RequestMapping(value="survey/{survey_id}/data/records/{record_id}/steps/{step}/content/csv/data.zip", method=GET, produces="application/zip") public void exportRecordToCsv(@PathVariable("survey_id") int surveyId, @PathVariable("record_id") int recordId, @PathVariable("step") int stepNumber, javax.servlet.http.HttpServletResponse response) throws RecordPersistenceException, IOException
      Throws:
      RecordPersistenceException
      IOException
    • exportRecordToExcel

      @RequestMapping(value="survey/{survey_id}/data/records/{record_id}/steps/{step}/content/xlsx/data.zip", method=GET, produces="application/zip") public void exportRecordToExcel(@PathVariable("survey_id") int surveyId, @PathVariable("record_id") int recordId, @PathVariable("step") int stepNumber, javax.servlet.http.HttpServletResponse response) throws RecordPersistenceException, IOException
      Throws:
      RecordPersistenceException
      IOException
    • exportRecord

      public void exportRecord(int surveyId, int recordId, int stepNumber, CSVDataExportParametersBase.OutputFormat outputFormat, javax.servlet.http.HttpServletResponse response) throws RecordPersistenceException, IOException
      Throws:
      RecordPersistenceException
      IOException
    • loadSurveyId

      @RequestMapping(value="data/records/{recordId}/surveyId", method=GET) @ResponseBody public int loadSurveyId(@PathVariable("recordId") int recordId)
    • startCsvDataExportJob

      @RequestMapping(value="survey/{surveyId}/data/records/startcsvexport", method=POST) @ResponseBody public CollectJobController.JobView startCsvDataExportJob(@PathVariable("surveyId") int surveyId, @RequestBody RecordController.CSVExportParametersForm parameters) throws IOException
      Throws:
      IOException
    • getCsvDataExportJob

      @RequestMapping(value="survey/{surveyId}/data/records/currentcsvexport", method=GET) @ResponseBody public CollectJobController.JobView getCsvDataExportJob(javax.servlet.http.HttpServletResponse response)
    • downloadCsvExportResult

      @RequestMapping(value="survey/{surveyId}/data/records/csvexportresult.zip", method=GET) public void downloadCsvExportResult(javax.servlet.http.HttpServletResponse response) throws FileNotFoundException, IOException
      Throws:
      FileNotFoundException
      IOException
    • startBackupDataExportJob

      @RequestMapping(value="survey/{surveyId}/data/records/startbackupexport", method=POST) @ResponseBody public CollectJobController.JobView startBackupDataExportJob(@PathVariable("surveyId") int surveyId, @RequestBody RecordController.BackupDataExportParameters parameters) throws IOException
      Throws:
      IOException
    • downloadBackupExportResult

      @RequestMapping(value="survey/{surveyId}/data/records/exportresult.collect-data", method=GET) public void downloadBackupExportResult(javax.servlet.http.HttpServletResponse response) throws FileNotFoundException, IOException
      Throws:
      FileNotFoundException
      IOException
    • exportRecordToCollectFormat

      @RequestMapping(value="survey/{survey_id}/data/records/{record_id}/content/collect/data.collect-data", method=GET, produces="application/zip") public void exportRecordToCollectFormat(@PathVariable("survey_id") int surveyId, @PathVariable("record_id") int recordId, javax.servlet.http.HttpServletResponse response) throws RecordPersistenceException, IOException
      Throws:
      RecordPersistenceException
      IOException
    • generateStats

      @RequestMapping(value="survey/{surveyId}/data/records/stats", method=GET) @ResponseBody public RecordStatsGenerator.RecordsStats generateStats(@PathVariable("surveyId") int surveyId)
    • startValidationResportJob

      @RequestMapping(value="survey/{surveyId}/data/records/validationreport", method=POST) @ResponseBody public JobProxy startValidationResportJob(@PathVariable("surveyId") int surveyId)
    • downloadValidationReportResult

      @RequestMapping(value="survey/{surveyId}/data/records/validationreport.csv", method=GET) public void downloadValidationReportResult(javax.servlet.http.HttpServletResponse response) throws FileNotFoundException, IOException
      Throws:
      FileNotFoundException
      IOException
    • getFullBackupJobView

      @RequestMapping(value="survey/{surveyId}/data/records/backupexportjob", method=GET) @ResponseBody public CollectJobController.JobView getFullBackupJobView()
    • releaseRecordLock

      @RequestMapping(value="survey/{surveyId}/data/records/releaselock/{recordId}", method=POST) @ResponseBody public org.openforis.commons.web.Response releaseRecordLock(@PathVariable int recordId)
    • startRandomRecordsGenerationJob

      @RequestMapping(value="survey/{surveyId}/data/records/randomgrid", method=POST, produces="application/json") @ResponseBody public JobProxy startRandomRecordsGenerationJob(@PathVariable("surveyId") int surveyId, @RequestParam String oldMeasurement, @RequestParam String newMeasurement, @RequestParam Double percentage, @RequestParam String sourceGridSurveyFileName, @RequestParam Boolean countOnly)