Search in sources :

Example 1 with SubjectType

use of org.openclinica.ws.beans.SubjectType in project OpenClinica by OpenClinica.

the class StudySubjectEndpoint method mapListStudySubjectsInStudyResponse.

/**
     * Build the response for listStudySubjectsInStudy method
     * 
     * @param study
     * @param message
     * @param studyRef
     * @return ListAllByStudyResponse
     * @throws Exception
     */
private ListAllByStudyResponse mapListStudySubjectsInStudyResponse(StudyBean study, String message, StudyRefType studyRef) throws Exception {
    ListAllByStudyResponse response = new ListAllByStudyResponse();
    response.setResult(message);
    StudySubjectsType studySubjectsType = new StudySubjectsType();
    response.setStudySubjects(studySubjectsType);
    List<StudySubjectBean> studySubjects = this.subjectService.getStudySubject(study);
    for (StudySubjectBean studySubjectBean : studySubjects) {
        StudySubjectWithEventsType studySubjectType = new StudySubjectWithEventsType();
        SubjectType subjectType = new SubjectType();
        studySubjectType.setLabel(studySubjectBean.getLabel());
        studySubjectType.setSecondaryLabel(studySubjectBean.getSecondaryLabel());
        if (studySubjectBean.getEnrollmentDate() != null) {
            studySubjectType.setEnrollmentDate(getXMLGregorianCalendarDate(studySubjectBean.getEnrollmentDate()));
        }
        SubjectBean subjectBean = (SubjectBean) getSubjectDao().findByPK(studySubjectBean.getSubjectId());
        subjectType.setUniqueIdentifier(subjectBean.getUniqueIdentifier());
        String genderStr = String.valueOf(subjectBean.getGender());
        if (!"".equals(genderStr.trim())) {
            subjectType.setGender(GenderType.fromValue(genderStr));
        }
        if (subjectBean.getDateOfBirth() != null) {
            subjectType.setDateOfBirth(getXMLGregorianCalendarDate(subjectBean.getDateOfBirth()));
        }
        studySubjectType.setSubject(subjectType);
        // studySubjectType.setStudyRef(studyRef);
        logger.debug(studySubjectBean.getLabel());
        studySubjectType.setEvents(getEvents(studySubjectBean));
        studySubjectsType.getStudySubject().add(studySubjectType);
    }
    return response;
}
Also used : SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) SubjectType(org.openclinica.ws.beans.SubjectType) ListAllByStudyResponse(org.openclinica.ws.studysubject.v1.ListAllByStudyResponse) StudySubjectWithEventsType(org.openclinica.ws.beans.StudySubjectWithEventsType) StudySubjectsType(org.openclinica.ws.beans.StudySubjectsType)

Aggregations

SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)1 StudySubjectWithEventsType (org.openclinica.ws.beans.StudySubjectWithEventsType)1 StudySubjectsType (org.openclinica.ws.beans.StudySubjectsType)1 SubjectType (org.openclinica.ws.beans.SubjectType)1 ListAllByStudyResponse (org.openclinica.ws.studysubject.v1.ListAllByStudyResponse)1