use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class StudyEventDefinitionDAO method findAllByStudy.
@Override
public ArrayList findAllByStudy(StudyBean study) {
StudyDAO studyDao = new StudyDAO(this.getDs());
if (study.getParentStudyId() > 0) {
// If the study has a parent than it is a site, in this case we
// should get the event definitions of the parent
StudyBean parentStudy = new StudyBean();
parentStudy = (StudyBean) studyDao.findByPK(study.getParentStudyId());
return super.findAllByStudy(parentStudy);
} else {
return super.findAllByStudy(study);
}
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class StudyDAO method findByPK.
public EntityBean findByPK(int ID) {
StudyBean eb = new StudyBean();
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 = (StudyBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class StudyDAO method create.
/**
* <b>create </b>, the method that creates a study in the database.
* <P>
* note: create is split up into four custom functions, per the use case; we
* are creating the standard create function here which calls all four
* functions at once, but the seperate functions may be required in the
* control servlets.
*
* @return eb the created entity bean.
*/
public EntityBean create(EntityBean eb) {
StudyBean sb = (StudyBean) eb;
sb = this.createStepOne(sb);
// in the above step, we will have created a primary key,
// and in the next steps, we update the study bean
// in phases
sb = this.createStepTwo(sb);
sb = this.createStepThree(sb);
sb = this.createStepFour(sb);
return sb;
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class StudyDAO method findByOid.
public StudyBean findByOid(String oid) {
StudyBean sb = null;
this.unsetTypeExpected();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), oid);
ArrayList alist = this.select(digester.getQuery("findByOid"), variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
sb = (StudyBean) this.getEntityFromHashMap((HashMap) it.next());
return sb;
} else {
logger.info("returning null from find by oid...");
return null;
}
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class StudyDAO method findAllByParentStudyIdOrderedByIdAsc.
public Collection findAllByParentStudyIdOrderedByIdAsc(int parentStudyId) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(parentStudyId));
variables.put(new Integer(2), new Integer(parentStudyId));
ArrayList alist = this.select(digester.getQuery("findAllByParentStudyIdOrderedByIdAsc"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyBean eb = (StudyBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
Aggregations