use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class AccountController method auditcrc.
@RequestMapping(value = "/auditcrc", method = RequestMethod.POST)
public ResponseEntity<HashMap> auditcrc(@RequestBody HashMap<String, String> requestMap) throws Exception {
HashMap map = new HashMap();
String crcUserName = requestMap.get("crcUserName");
String studyOid = requestMap.get("studyOid");
String studySubjectId = requestMap.get("studySubjectId");
StudyBean parentStudy = getParentStudy(studyOid);
StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
// build UserName
HashMap<String, String> mapValues = buildParticipantUserName(studySubjectBean);
// Participant User Name
String pUserName = mapValues.get("pUserName");
AuditUserLoginBean auditUserLogin = new AuditUserLoginBean();
UserAccountBean userAccount = getUserAccount(crcUserName);
auditUserLogin.setUserName(userAccount.getName());
auditUserLogin.setLoginStatus(LoginStatus.ACCESS_CODE_VIEWED);
auditUserLogin.setLoginAttemptDate(new Date());
auditUserLogin.setUserAccountId(userAccount != null ? userAccount.getId() : null);
auditUserLogin.setDetails(pUserName);
getAuditUserLoginDao().save(auditUserLogin);
return new ResponseEntity<HashMap>(map, org.springframework.http.HttpStatus.OK);
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class AccountController method updateTimezone.
/**
* @api {post} /pages/accounts/timezone Update subject time zone
* @apiName updateTimezone
* @apiPermission admin
* @apiVersion 3.8.0
* @apiParam {String} studyOid Study Oid.
* @apiParam {String} studySubjectId Study Subject Oid .
* @apiParam {String} timeZone Time Zone .
* @apiGroup Subject
* @apiDescription Updates the subject time zone
* @apiParamExample {json} Request-Example:
* {
* "studyOid": "S_BL101",
* "studySubjectId": "SS_SUB100",
* "timeZone": "America/New_York"
* }
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {
* }
*/
@RequestMapping(value = "/timezone", method = RequestMethod.POST)
public ResponseEntity<UserDTO> updateTimezone(@RequestBody HashMap<String, String> map) throws Exception {
uDTO = null;
System.out.println("I'm in update Timezone method");
StudyBean parentStudy = getParentStudy(map.get("studyOid"));
String oid = parentStudy.getOid();
String studySubjectId = map.get("studySubjectId");
String timeZone = map.get("timeZone");
ResourceBundleProvider.updateLocale(new Locale("en_US"));
System.out.println("****************** You are in the Rest Service *****************");
StudySubjectBean studySubjectBean = getStudySubjectByOidAndStudy(studySubjectId, parentStudy.getId());
HashMap<String, String> mapValues = buildParticipantUserName(studySubjectBean);
// Participant User Name
String pUserName = mapValues.get("pUserName");
udao = new UserAccountDAO(dataSource);
UserAccountBean userAccountBean = (UserAccountBean) udao.findByUserName(pUserName);
if (studySubjectBean.isActive()) {
studySubjectBean.setTime_zone(timeZone);
studySubjectBean.setUpdater(userAccountBean);
updateStudySubjectBean(studySubjectBean);
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
}
return null;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class AccountController method getStudySubjectByOidAndStudy.
private StudySubjectBean getStudySubjectByOidAndStudy(String oid, int studyId) {
ssdao = new StudySubjectDAO(dataSource);
StudySubjectBean studySubjectBean = (StudySubjectBean) ssdao.findByOidAndStudy(oid, studyId);
return studySubjectBean;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class AccountController method getStudySubject.
private StudySubjectBean getStudySubject(String oid) {
ssdao = new StudySubjectDAO(dataSource);
StudySubjectBean studySubjectBean = (StudySubjectBean) ssdao.findByOid(oid);
return studySubjectBean;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class OdmStudySubjectController method getODM.
private ODM getODM(String studyOID, String studySubjectLabel, String crcUserName) {
StudyDAO studyDAO = new StudyDAO(dataSource);
StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
StudyBean studyBean = null;
StudySubjectBean studySubjectBean = null;
try {
// Retrieve crfs for next event
studyBean = studyDAO.findByOid(studyOID);
if (studyBean != null) {
studySubjectBean = (StudySubjectBean) studySubjectDAO.findByLabelAndStudy(studySubjectLabel, studyBean);
if (!mayProceed(studyOID, studySubjectBean))
return null;
if (studySubjectBean.getId() != 0 && !accountController.isCRCHasAccessToStudySubject(studyOID, crcUserName, studySubjectLabel)) {
return createOdm(studyBean, studySubjectBean);
} else if (studySubjectBean.getId() != 0 && accountController.isCRCHasAccessToStudySubject(studyOID, crcUserName, studySubjectLabel)) {
return null;
} else {
return createOdm(studyBean, null);
}
} else {
return createOdm(null, null);
}
} catch (Exception e) {
logger.debug(e.getMessage());
logger.debug(ExceptionUtils.getStackTrace(e));
}
return null;
}
Aggregations