use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteUtil method injectDiscNotesIntoStudyEvents.
/**
* This method links discrepancy notes to the study event and study subject
* associated with those notes
*
* @param studyBeans
* A List of StudyEventBeans.
* @param allDiscNotes
* A List of DiscrepancyNoteBeans associated with a single study.
* @param dataSource
* A DataSource used to get from the database a study subject
* associated with a study event.
*/
public void injectDiscNotesIntoStudyEvents(List<StudyEventBean> studyBeans, List<DiscrepancyNoteBean> allDiscNotes, DataSource dataSource) {
if (studyBeans == null || allDiscNotes == null) {
return;
}
StudySubjectDAO studySubjDAO = new StudySubjectDAO(dataSource);
StudySubjectBean studySubjBean = new StudySubjectBean();
for (StudyEventBean sbean : studyBeans) {
// Get the StudySubjectBean associated with the study event
studySubjBean = (StudySubjectBean) studySubjDAO.findByPK(sbean.getStudySubjectId());
// equals the StudySubjectBean's name
for (DiscrepancyNoteBean discBean : allDiscNotes) {
if (sbean.getStudyEventDefinition().getName().equalsIgnoreCase(discBean.getEventName()) && studySubjBean.getLabel().equalsIgnoreCase(discBean.getSubjectName())) {
// add discrepancy note to the study event list of notes
// Each study bean has a List property containing its
// associated
// DiscrepancyNoteBeans
sbean.getDiscBeanList().add(discBean);
}
}
}
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class ExtractBean method addStudySubjectData.
/**
* @vbc 08/06/2008 NEW EXTRACT DATA IMPLEMENTATION replaced the old one with
* a new function
*/
public void addStudySubjectData(ArrayList objs) {
for (int i = 0; i < objs.size(); i++) {
StudySubjectBean sub = new StudySubjectBean();
sub = (StudySubjectBean) objs.get(i);
subjects.add(sub);
}
// for
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method create.
/**
* @deprecated Creates a new studysubject
*/
@Override
@Deprecated
public EntityBean create(EntityBean eb) {
StudySubjectBean sb = (StudySubjectBean) eb;
HashMap variables = new HashMap();
HashMap nullVars = new HashMap();
// INSERT INTO study_subject
// (LABEL, SUBJECT_ID, STUDY_ID, STATUS_ID,
// DATE_CREATED, OWNER_ID, ENROLLMENT_DATE,SECONDARY_LABEL)
// VALUES (?,?,?,?,NOW(),?,?,?)
int ind = 1;
variables.put(new Integer(ind), sb.getLabel());
ind++;
variables.put(new Integer(ind), new Integer(sb.getSubjectId()));
ind++;
variables.put(new Integer(ind), new Integer(sb.getStudyId()));
ind++;
variables.put(new Integer(ind), new Integer(sb.getStatus().getId()));
ind++;
// Date_created is now()
variables.put(new Integer(ind), new Integer(sb.getOwnerId()));
ind++;
// ind++;
if (sb.getEnrollmentDate() == null) {
nullVars.put(new Integer(ind), new Integer(Types.DATE));
variables.put(new Integer(ind), null);
ind++;
} else {
variables.put(new Integer(ind), sb.getEnrollmentDate());
ind++;
}
variables.put(new Integer(ind), sb.getSecondaryLabel());
ind++;
this.execute(digester.getQuery("create"), variables, nullVars);
if (isQuerySuccessful()) {
sb.setId(getCurrentPK());
}
return sb;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findSameByLabelAndStudy.
/**
* Finds a study subject which has the same label provided in the same study
*
* @param label
* @param studyId
* @param id
* @return
*/
public StudySubjectBean findSameByLabelAndStudy(String label, int studyId, int id) {
StudySubjectBean answer = new StudySubjectBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), label);
variables.put(new Integer(2), new Integer(studyId));
variables.put(new Integer(3), new Integer(studyId));
variables.put(new Integer(4), new Integer(id));
String sql = digester.getQuery("findSameByLabelAndStudy");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
answer = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findAllBySubjectId.
public ArrayList findAllBySubjectId(int subjectId) {
ArrayList answer = new ArrayList();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(subjectId));
String sql = digester.getQuery("findAllBySubjectId");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
StudySubjectBean ssb = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(ssb);
}
return answer;
}
Aggregations