use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class StudyGroupClassDAO method findByPK.
public EntityBean findByPK(int id) {
StudyGroupClassBean eb = new StudyGroupClassBean();
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);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (StudyGroupClassBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class StudyGroupClassDAO method getEntityFromHashMap.
/**
* <p>
* getEntityFromHashMap, the method that gets the object from the database
* query.
*/
public Object getEntityFromHashMap(HashMap hm) {
StudyGroupClassBean eb = new StudyGroupClassBean();
super.setEntityAuditInformation(eb, hm);
// STUDY_GROUP_ID NAME STUDY_ID OWNER_ID DATE_CREATED
// GROUP_TYPE_ID STATUS_ID DATE_UPDATED UPDATE_ID
eb.setId(((Integer) hm.get("study_group_class_id")).intValue());
eb.setName((String) hm.get("name"));
eb.setStudyId(((Integer) hm.get("study_id")).intValue());
eb.setGroupClassTypeId(((Integer) hm.get("group_class_type_id")).intValue());
String classTypeName = GroupClassType.get(((Integer) hm.get("group_class_type_id")).intValue()).getName();
eb.setGroupClassTypeName(classTypeName);
eb.setSubjectAssignment((String) hm.get("subject_assignment"));
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class StudyGroupClassDAO method findAll.
public Collection findAll() {
this.setTypesExpected();
ArrayList alist = this.select(digester.getQuery("findAll"));
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyGroupClassBean eb = (StudyGroupClassBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class StudyGroupClassDAO method create.
/**
* Creates a new StudyGroup
*/
public EntityBean create(EntityBean eb) {
StudyGroupClassBean sb = (StudyGroupClassBean) eb;
HashMap variables = new HashMap();
int id = getNextPK();
// INSERT INTO study_group_class
// (NAME,STUDY_ID,OWNER_ID,DATE_CREATED, GROUP_CLASS_TYPE_ID,
// STATUS_ID,subject_assignment)
// VALUES (?,?,?,NOW(),?,?,?)
variables.put(new Integer(1), new Integer(id));
variables.put(new Integer(2), sb.getName());
variables.put(new Integer(3), new Integer(sb.getStudyId()));
variables.put(new Integer(4), new Integer(sb.getOwner().getId()));
variables.put(new Integer(5), new Integer(sb.getGroupClassTypeId()));
// Date_created is now()
variables.put(new Integer(6), new Integer(sb.getStatus().getId()));
variables.put(new Integer(7), sb.getSubjectAssignment());
this.execute(digester.getQuery("create"), variables);
if (isQuerySuccessful()) {
sb.setId(id);
}
return sb;
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class StudyGroupClassDAO method findAllActiveByStudy.
@Override
public ArrayList findAllActiveByStudy(StudyBean study) {
ArrayList answer = new ArrayList();
this.setTypesExpected();
this.setTypeExpected(11, TypeNames.STRING);
this.setTypeExpected(12, TypeNames.STRING);
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(study.getId()));
variables.put(new Integer(2), new Integer(study.getId()));
ArrayList alist = this.select(digester.getQuery("findAllActiveByStudy"), variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
StudyGroupClassBean group = (StudyGroupClassBean) this.getEntityFromHashMap(hm);
group.setStudyName((String) hm.get("study_name"));
// logger.info("study Name " + group.getStudyName());
group.setGroupClassTypeName((String) hm.get("type_name"));
group.setSelected(false);
answer.add(group);
}
return answer;
}
Aggregations