Search in sources :

Example 91 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean 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) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 92 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean 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;
    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"));
    UserAccountDAO udao = new UserAccountDAO(dataSource);
    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) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 93 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class AccountController method getStudy.

private StudyBean getStudy(String oid) {
    StudyDAO sdao = new StudyDAO(dataSource);
    StudyBean studyBean = (StudyBean) sdao.findByOid(oid);
    return studyBean;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 94 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class AccountController method getAccount1.

/**
 * @api {get} /pages/accounts/study/:studyOid/crc/:crcUserName Retrieve a user account - crc
 * @apiName getAccount1
 * @apiPermission Module participate - enabled & admin
 * @apiVersion 3.8.0
 * @apiParam {String} studyOid Study Oid.
 * @apiParam {String} crcUserName CRC Username .
 * @apiGroup User Account
 * @apiDescription Retrieves the crc user account with the given crcUserName and studyOid
 * @apiParamExample {json} Request-Example:
 *                  {
 *                  "studyOid": " S_BL101",
 *                  "crcUserName": "crc_user"
 *                  }
 * @apiSuccessExample {json} Success-Response:
 *                    HTTP/1.1 200 OK
 *                    {
 *                    "lName": "Jackson",
 *                    "mobile": "",
 *                    "accessCode": "",
 *                    "apiKey": "6e8b69f6fb774e899f9a6c349c5adace",
 *                    "password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
 *                    "email": "abc@yahoo.com",
 *                    "userName": "crc_user",
 *                    "studySubjectId": null,
 *                    "fName": "joe"
 *                    }
 */
@RequestMapping(value = "/study/{studyOid}/crc/{crcUserName}", method = RequestMethod.GET)
public ResponseEntity<UserDTO> getAccount1(@PathVariable("studyOid") String studyOid, @PathVariable("crcUserName") String crcUserName) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    UserAccountDAO udao = new UserAccountDAO(dataSource);
    uDTO = null;
    StudyBean parentStudy = getParentStudy(studyOid);
    Integer pStudyId = parentStudy.getId();
    String oid = parentStudy.getOid();
    if (isStudyASiteLevelStudy(studyOid))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (!mayProceed(oid))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (isStudyDoesNotExist(oid))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (isCRCUserAccountDoesNotExist(crcUserName))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (doesCRCNotHaveStudyAccessRole(crcUserName, pStudyId))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    UserAccountBean userAccountBean = (UserAccountBean) udao.findByUserName(crcUserName);
    buildUserDTO(userAccountBean);
    return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
}
Also used : Locale(java.util.Locale) ResponseEntity(org.springframework.http.ResponseEntity) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserDTO(org.akaza.openclinica.bean.login.UserDTO) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 95 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class AccountController method isStudySubjecAndCRCRolesMatch.

private Boolean isStudySubjecAndCRCRolesMatch(String studySubjectId, String crcUserName, String studyOid) {
    // crc is siteA studySubject is siteA , pass (same site)
    // crc is siteA studySubject is siteB , Fail
    // crc is siteA studySubject is study , Fail
    // crc is study studySubject is siteA , pass
    // crc is study studySubject is siteB , pass
    // crc is study studySubject is study , pass
    StudyBean parentStudy = getParentStudy(studyOid);
    Integer studyIdFromStudyOid = parentStudy.getId();
    StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
    Integer studyIdFromStudySubjectId = studySubjectBean.getStudyId();
    return doesStudySubjecAndCRCRolesMatch(crcUserName, studyIdFromStudySubjectId);
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean)

Aggregations

StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)366 ArrayList (java.util.ArrayList)185 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)184 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)92 HashMap (java.util.HashMap)85 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)68 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)65 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)62 Date (java.util.Date)61 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)59 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)58 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)56 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)45 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)42 Locale (java.util.Locale)41 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)41 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)38