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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations