use of org.akaza.openclinica.bean.submit.DisplaySubjectBean in project OpenClinica by OpenClinica.
the class AddNewSubjectServlet method displaySubjects.
/**
* Find study subject id for each subject, and construct displaySubjectBean
*
* @param displayArray
* @param subjects
*/
public static void displaySubjects(ArrayList displayArray, ArrayList subjects, StudySubjectDAO ssdao, StudyDAO stdao) {
for (int i = 0; i < subjects.size(); i++) {
SubjectBean subject = (SubjectBean) subjects.get(i);
ArrayList studySubs = ssdao.findAllBySubjectId(subject.getId());
String protocolSubjectIds = "";
for (int j = 0; j < studySubs.size(); j++) {
StudySubjectBean studySub = (StudySubjectBean) studySubs.get(j);
int studyId = studySub.getStudyId();
StudyBean stu = (StudyBean) stdao.findByPK(studyId);
String protocolId = stu.getIdentifier();
if (j == studySubs.size() - 1) {
protocolSubjectIds = protocolId + "-" + studySub.getLabel();
} else {
protocolSubjectIds = protocolId + "-" + studySub.getLabel() + ", ";
}
}
DisplaySubjectBean dsb = new DisplaySubjectBean();
dsb.setSubject(subject);
dsb.setStudySubjectIds(protocolSubjectIds);
displayArray.add(dsb);
}
}
use of org.akaza.openclinica.bean.submit.DisplaySubjectBean in project OpenClinica by OpenClinica.
the class DisplaySubjectRow method compareColumn.
/*
* (non-Javadoc)
*
* @see org.akaza.openclinica.core.EntityBeanRow#compareColumn(java.lang.Object,
* int)
*/
@Override
protected int compareColumn(Object row, int sortingColumn) {
if (!row.getClass().equals(DisplaySubjectRow.class)) {
return 0;
}
DisplaySubjectBean thisSubject = (DisplaySubjectBean) bean;
DisplaySubjectBean argSubject = (DisplaySubjectBean) ((DisplaySubjectRow) row).bean;
int answer = 0;
switch(sortingColumn) {
case COL_NAME:
answer = thisSubject.getSubject().getName().toLowerCase().compareTo(argSubject.getSubject().getName().toLowerCase());
break;
case COL_SUBJECT_IDS:
answer = thisSubject.getStudySubjectIds().compareTo(argSubject.getStudySubjectIds());
break;
case COL_GENDER:
answer = (thisSubject.getSubject().getGender() + "").compareTo(argSubject.getSubject().getGender() + "");
break;
case COL_DATE_CREATED:
answer = compareDate(thisSubject.getSubject().getCreatedDate(), argSubject.getSubject().getCreatedDate());
break;
case COL_OWNER:
answer = thisSubject.getSubject().getOwner().getName().toLowerCase().compareTo(argSubject.getSubject().getOwner().getName().toLowerCase());
break;
case COL_DATE_UPDATED:
answer = compareDate(thisSubject.getSubject().getUpdatedDate(), argSubject.getSubject().getUpdatedDate());
break;
case COL_UPDATER:
answer = thisSubject.getSubject().getUpdater().getName().toLowerCase().compareTo(argSubject.getSubject().getUpdater().getName().toLowerCase());
break;
case COL_STATUS:
answer = thisSubject.getSubject().getStatus().compareTo(argSubject.getSubject().getStatus());
break;
}
return answer;
}
Aggregations