Search in sources :

Example 6 with UserAccountBean

use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.

the class UserAccountDAO method findAllParticipantsByStudyOid.

public Collection findAllParticipantsByStudyOid(String studyOid) {
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), studyOid + ".%");
    ArrayList alist = this.select(digester.getQuery("findAllParticipantsByStudyOid"), variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        UserAccountBean eb = (UserAccountBean) this.getEntityFromHashMap((HashMap) it.next(), false);
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean)

Example 7 with UserAccountBean

use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.

the class UserAccountDAO method findAllByLimit.

public Collection findAllByLimit(boolean hasLimit) {
    this.setTypesExpected();
    ArrayList alist = null;
    if (hasLimit) {
        alist = this.select(digester.getQuery("findAllByLimit"));
    } else {
        alist = this.select(digester.getQuery("findAll"));
    }
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        UserAccountBean eb = (UserAccountBean) this.getEntityFromHashMap((HashMap) it.next(), true);
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean)

Example 8 with UserAccountBean

use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.

the class UserAccountDAO method create.

@Override
public EntityBean create(EntityBean eb) {
    UserAccountBean uab = (UserAccountBean) eb;
    HashMap variables = new HashMap();
    int id = getNextPK();
    variables.put(new Integer(1), new Integer(id));
    variables.put(new Integer(2), uab.getName());
    variables.put(new Integer(3), uab.getPasswd());
    variables.put(new Integer(4), uab.getFirstName());
    variables.put(new Integer(5), uab.getLastName());
    variables.put(new Integer(6), uab.getEmail());
    variables.put(new Integer(7), new Integer(uab.getActiveStudyId()));
    variables.put(new Integer(8), uab.getInstitutionalAffiliation());
    variables.put(new Integer(9), new Integer(uab.getStatus().getId()));
    variables.put(new Integer(10), new Integer(uab.getOwnerId()));
    variables.put(new Integer(11), uab.getPasswdChallengeQuestion());
    variables.put(new Integer(12), uab.getPasswdChallengeAnswer());
    variables.put(new Integer(13), uab.getPhone());
    if (uab.isTechAdmin()) {
        variables.put(new Integer(14), new Integer(UserType.TECHADMIN.getId()));
    } else if (uab.isSysAdmin()) {
        variables.put(new Integer(14), new Integer(UserType.SYSADMIN.getId()));
    } else {
        variables.put(new Integer(14), new Integer(UserType.USER.getId()));
    }
    variables.put(new Integer(15), uab.getRunWebservices());
    variables.put(new Integer(16), uab.getAccessCode());
    variables.put(new Integer(17), uab.isEnableApiKey());
    variables.put(new Integer(18), uab.getApiKey());
    boolean success = true;
    this.execute(digester.getQuery("insert"), variables);
    success = success && isQuerySuccessful();
    setSysAdminRole(uab, true);
    ArrayList userRoles = uab.getRoles();
    for (int i = 0; i < userRoles.size(); i++) {
        StudyUserRoleBean studyRole = (StudyUserRoleBean) userRoles.get(i);
        if (studyRole.equals(Role.ADMIN)) {
            continue;
        }
        createStudyUserRole(uab, studyRole);
        success = success && isQuerySuccessful();
    }
    if (success) {
        uab.setId(id);
    }
    return uab;
}
Also used : HashMap(java.util.HashMap) StudyUserRoleBean(org.akaza.openclinica.bean.login.StudyUserRoleBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) ArrayList(java.util.ArrayList)

Example 9 with UserAccountBean

use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.

the class UserAccountDAO method findByAccessCode.

public EntityBean findByAccessCode(String name) {
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), name);
    ArrayList alist = this.select(digester.getQuery("findByAccessCode"), variables);
    UserAccountBean eb = new UserAccountBean();
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        eb = (UserAccountBean) this.getEntityFromHashMap((HashMap) it.next(), true);
    }
    return eb;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) Iterator(java.util.Iterator)

Example 10 with UserAccountBean

use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.

the class UserAccountDAO method findByPK.

@Override
public EntityBean findByPK(int ID) {
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(ID));
    String sql = digester.getQuery("findByPK");
    ArrayList alist = this.select(sql, variables);
    UserAccountBean eb = new UserAccountBean();
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        eb = (UserAccountBean) this.getEntityFromHashMap((HashMap) it.next(), true);
    }
    return eb;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) Iterator(java.util.Iterator)

Aggregations

UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)152 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)64 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)56 ArrayList (java.util.ArrayList)52 HashMap (java.util.HashMap)38 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)36 StudyUserRoleBean (org.akaza.openclinica.bean.login.StudyUserRoleBean)35 Date (java.util.Date)32 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)32 Locale (java.util.Locale)30 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)18 Iterator (java.util.Iterator)16 InsufficientPermissionException (org.akaza.openclinica.web.InsufficientPermissionException)16 ResponseEntity (org.springframework.http.ResponseEntity)16 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)15 Validator (org.akaza.openclinica.control.form.Validator)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 Role (org.akaza.openclinica.bean.core.Role)11 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)10 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)10