Search in sources :

Example 31 with UserAccountDAO

use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.

the class TechAdminServlet method processRequest.

/*
     * (non-Javadoc)
     *
     * @see org.akaza.openclinica.control.core.SecureController#processRequest()
     */
@Override
protected void processRequest() throws Exception {
    // find last 5 modifed studies
    StudyDAO sdao = new StudyDAO(sm.getDataSource());
    // ArrayList studies = (ArrayList) sdao.findAllByLimit(true);
    // request.setAttribute("studies", studies);
    ArrayList allStudies = (ArrayList) sdao.findAll();
    // request.setAttribute("allStudyNumber", new
    // Integer(allStudies.size()));
    UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
    // ArrayList users = (ArrayList) udao.findAllByLimit(true);
    // request.setAttribute("users", users);
    ArrayList allUsers = (ArrayList) udao.findAll();
    // request.setAttribute("allUserNumber", new Integer(allUsers.size()));
    SubjectDAO subdao = new SubjectDAO(sm.getDataSource());
    // ArrayList subjects = (ArrayList) subdao.findAllByLimit(true);
    // request.setAttribute("subjects", subjects);
    ArrayList allSubjects = (ArrayList) subdao.findAll();
    // request.setAttribute("allSubjectNumber", new
    // Integer(allSubjects.size()));
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    // ArrayList crfs = (ArrayList) cdao.findAllByLimit(true);
    // request.setAttribute("crfs", subjects);
    ArrayList allCrfs = (ArrayList) cdao.findAll();
    // request.setAttribute("allCrfNumber", new Integer(allCrfs.size()));
    resetPanel();
    panel.setStudyInfoShown(false);
    panel.setOrderedData(true);
    setToPanel(resword.getString("in_the_application"), "");
    if (allSubjects.size() > 0) {
        setToPanel(resword.getString("subjects"), new Integer(allSubjects.size()).toString());
    }
    if (allUsers.size() > 0) {
        setToPanel(resword.getString("users"), new Integer(allUsers.size()).toString());
    }
    if (allStudies.size() > 0) {
        setToPanel(resword.getString("studies"), new Integer(allStudies.size()).toString());
    }
    if (allCrfs.size() > 0) {
        setToPanel(resword.getString("CRFs"), new Integer(allCrfs.size()).toString());
    }
    forwardPage(Page.TECH_ADMIN_SYSTEM);
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) ArrayList(java.util.ArrayList) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 32 with UserAccountDAO

use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.

the class AccountController method getUserAccount.

private UserAccountBean getUserAccount(String userName) {
    udao = new UserAccountDAO(dataSource);
    UserAccountBean userAccountBean = (UserAccountBean) udao.findByUserName(userName);
    return userAccountBean;
}
Also used : UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 33 with UserAccountDAO

use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.

the class AccountController method getAccount3.

/**
	 * @api {get} /pages/accounts/study/:studyOid/studysubject/:studySubjectId Retrieve a user account - participant
	 * @apiName getAccount3
	 * @apiPermission Module participate - enabled & admin
	 * @apiVersion 3.8.0
	 * @apiParam {String} studyOid Study Oid.
	 * @apiParam {String} studySubjectId Study Subject Id .
	 * @apiGroup User Account
	 * @apiDescription Retrieves the participant user account with the given studySubjectId and studyOid
	 * @apiParamExample {json} Request-Example:
	 *                  {
	 *                  "studyOid": " S_BL101",
	 *                  "studySubjectId": "Sub100"
	 *                  }
	 * @apiSuccessExample {json} Success-Response:
	 *                    HTTP/1.1 200 OK
	 *                    {
	 *                    "lName": "",
	 *                    "mobile": "JTaa7WGRdH5dGs42XyTrgA==",
	 *                    "accessCode": "5s02UFpiMBijWuzaxSOojg==",
	 *                    "password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
	 *                    "email": "XzJadh3l3V7uUoPCggbSoIfoNW8IQU3qsvrtHfJH7J0=",
	 *                    "userName": "S_BL101.SS_SUB100",
	 *                    "studySubjectId": null,
	 *                    "fName": "pdyGCN1CdAKIGOUEERz/yQ=="
	 *                    }
	 */
@RequestMapping(value = "/study/{studyOid}/studysubject/{studySubjectId}", method = RequestMethod.GET)
public ResponseEntity<UserDTO> getAccount3(@PathVariable("studyOid") String studyOid, @PathVariable("studySubjectId") String studySubjectId) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    uDTO = null;
    System.out.println("I'm in getAccount3");
    StudyBean parentStudy = getParentStudy(studyOid);
    String oid = parentStudy.getOid();
    StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
    if (isStudyASiteLevelStudy(studyOid))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (!mayProceed(oid, studySubjectBean))
        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 (isStudySubjectDoesNotExist(studySubjectBean))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    // build UserName
    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 (!userAccountBean.isActive()) {
        uDTO = new UserDTO();
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
    } else {
        buildUserDTO(userAccountBean);
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
    }
}
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) UserDTO(org.akaza.openclinica.bean.login.UserDTO) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 34 with UserAccountDAO

use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.

the class AccountController method getAccessCodeAccount.

private UserAccountBean getAccessCodeAccount(String accessCode) {
    udao = new UserAccountDAO(dataSource);
    UserAccountBean userAccountBean = (UserAccountBean) udao.findByAccessCode(accessCode);
    return userAccountBean;
}
Also used : UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 35 with UserAccountDAO

use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.

the class AccountController method getUserAccountByStudy.

private ArrayList<UserAccountBean> getUserAccountByStudy(String userName, ArrayList allStudies) {
    udao = new UserAccountDAO(dataSource);
    ArrayList<UserAccountBean> userAccountBeans = udao.findStudyByUser(userName, allStudies);
    return userAccountBeans;
}
Also used : UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Aggregations

UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)92 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)64 ArrayList (java.util.ArrayList)42 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)42 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)39 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)36 Date (java.util.Date)23 StudyUserRoleBean (org.akaza.openclinica.bean.login.StudyUserRoleBean)22 HashMap (java.util.HashMap)21 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)17 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)16 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)14 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)14 Locale (java.util.Locale)13 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)13 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)12 SubjectDAO (org.akaza.openclinica.dao.submit.SubjectDAO)12 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)11 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)11 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)10