Search in sources :

Example 6 with StudyGroupClassBean

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;
}
Also used : HashMap(java.util.HashMap) StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 7 with StudyGroupClassBean

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;
}
Also used : StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean)

Example 8 with StudyGroupClassBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean)

Example 9 with StudyGroupClassBean

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;
}
Also used : HashMap(java.util.HashMap) StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean)

Example 10 with StudyGroupClassBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean)

Aggregations

StudyGroupClassBean (org.akaza.openclinica.bean.managestudy.StudyGroupClassBean)44 ArrayList (java.util.ArrayList)35 StudyGroupClassDAO (org.akaza.openclinica.dao.managestudy.StudyGroupClassDAO)21 HashMap (java.util.HashMap)17 StudyGroupDAO (org.akaza.openclinica.dao.managestudy.StudyGroupDAO)16 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)15 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)14 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)14 StudyGroupBean (org.akaza.openclinica.bean.managestudy.StudyGroupBean)10 SubjectGroupMapBean (org.akaza.openclinica.bean.submit.SubjectGroupMapBean)10 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)9 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)9 SubjectGroupMapDAO (org.akaza.openclinica.dao.submit.SubjectGroupMapDAO)9 Iterator (java.util.Iterator)8 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)7 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)6 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)6 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)5 DatasetBean (org.akaza.openclinica.bean.extract.DatasetBean)5