Search in sources :

Example 1 with TransferObject

use of org.akaza.openclinica.controller.helper.TransferObject in project OpenClinica by OpenClinica.

the class BatchCRFMigrationController method runPreview.

@Produces(MediaType.APPLICATION_JSON)
@RequestMapping(value = "/api/v1/forms/migrate/preview", method = RequestMethod.POST)
@ResponseBody
public ReportLog runPreview(HttpServletRequest request, HttpServletResponse response) throws Exception {
    TransferObject transferObject = getUIComponents(request);
    ResponseEntity<HelperObject> res = runPreviewTest(transferObject, request);
    HelperObject helperObject = res.getBody();
    helperObject.getReportLog().setReportPreview(toStringHtmlFormat(helperObject.getReportLog(), resterms));
    return helperObject.getReportLog();
}
Also used : TransferObject(org.akaza.openclinica.controller.helper.TransferObject) HelperObject(org.akaza.openclinica.controller.helper.HelperObject) Produces(javax.ws.rs.Produces) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with TransferObject

use of org.akaza.openclinica.controller.helper.TransferObject in project OpenClinica by OpenClinica.

the class BatchCRFMigrationController method runMigration.

@Produces(MediaType.APPLICATION_JSON)
@RequestMapping(value = "/api/v1/forms/migrate/run", method = RequestMethod.POST)
@ResponseBody
public String runMigration(HttpServletRequest request, HttpServletResponse response) throws Exception {
    TransferObject transferObject = getUIComponents(request);
    String crfId = request.getParameter("crfId");
    ResponseEntity<HelperObject> res = runPreviewTest(transferObject, request);
    HelperObject helperObject = res.getBody();
    fillHelperObject(helperObject);
    helperObject.setRequest(request);
    ReportLog reportLog = helperObject.getReportLog();
    String pageMessages = null;
    if (reportLog.getSubjectCount() != 0 && reportLog.getEventCrfCount() != 0 && reportLog.getErrors().size() == 0) {
        BatchCRFMigrationController bcmController = new BatchCRFMigrationController(helperObject);
        Thread thread = new Thread(bcmController);
        thread.start();
        pageMessages = resterms.getString("Batch_CRF_version_migration_is_running_You_will_receive_an_email_once_the_process_is_complete");
        return (String) redirect(request, response, "/ListCRF?module=manage" + "&isFromCRFVersionBatchChange=" + pageMessages);
    } else {
        pageMessages = resterms.getString("Error_in_Running_Migration_Please_try_again");
        return (String) redirect(request, response, "/BatchCRFMigration?module=manage&crfId=" + crfId + "&isFromCRFVersionBatchChange=" + pageMessages);
    }
}
Also used : TransferObject(org.akaza.openclinica.controller.helper.TransferObject) HelperObject(org.akaza.openclinica.controller.helper.HelperObject) ReportLog(org.akaza.openclinica.controller.helper.ReportLog) Produces(javax.ws.rs.Produces) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with TransferObject

use of org.akaza.openclinica.controller.helper.TransferObject in project OpenClinica by OpenClinica.

the class BatchCRFMigrationController method getUIComponents.

public TransferObject getUIComponents(HttpServletRequest request) {
    String selectedSites = request.getParameter("selectedSites");
    String selectedEvents = request.getParameter("selectedEvents");
    List<String> selectedSiteList = Arrays.asList(selectedSites.split(","));
    List<String> selectedEventList = Arrays.asList(selectedEvents.split(","));
    ArrayList<String> selectedSiteArrayList = new ArrayList<String>(selectedSiteList);
    ArrayList<String> selectedEventArrayList = new ArrayList<String>(selectedEventList);
    if (selectedSiteArrayList.contains("-1"))
        selectedSiteArrayList.clear();
    if (selectedEventArrayList.contains("-1"))
        selectedEventArrayList.clear();
    TransferObject transferObject = new TransferObject();
    transferObject.setSites(selectedSiteArrayList);
    transferObject.setStudyEventDefs(selectedEventArrayList);
    transferObject.setSourceFormVersion(request.getParameter("selectedSourceVersion"));
    transferObject.setTargetFormVersion(request.getParameter("selectedTargetVersion"));
    transferObject.setStudyOID(request.getParameter("studyOid"));
    return transferObject;
}
Also used : TransferObject(org.akaza.openclinica.controller.helper.TransferObject) ArrayList(java.util.ArrayList)

Aggregations

TransferObject (org.akaza.openclinica.controller.helper.TransferObject)3 Produces (javax.ws.rs.Produces)2 HelperObject (org.akaza.openclinica.controller.helper.HelperObject)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ArrayList (java.util.ArrayList)1 ReportLog (org.akaza.openclinica.controller.helper.ReportLog)1