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();
}
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);
}
}
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;
}
Aggregations