Search in sources :

Example 71 with StudySubjectBean

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);
}
Also used : AuditUserLoginBean(org.akaza.openclinica.domain.technicaladmin.AuditUserLoginBean) ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) Date(java.util.Date)

Example 72 with StudySubjectBean

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;
}
Also used : Locale(java.util.Locale) ResponseEntity(org.springframework.http.ResponseEntity) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 73 with StudySubjectBean

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;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO)

Example 74 with 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;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO)

Example 75 with 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;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO)

Aggregations

StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)155 ArrayList (java.util.ArrayList)102 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)86 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)71 HashMap (java.util.HashMap)66 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)66 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)49 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)45 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)43 Date (java.util.Date)42 Iterator (java.util.Iterator)38 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)35 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)29 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)26 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)26 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)26 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)23