Search in sources :

Example 1 with ObservationTemplateImpl

use of gov.nih.nci.ctd2.dashboard.impl.ObservationTemplateImpl in project nci-ctd2-dashboard by CBIIT.

the class DashboardDaoImpl method findObservedSubjectRole.

@Override
public ObservedSubjectRole findObservedSubjectRole(String templateName, String columnName) {
    List<ObservedSubjectRole> list = new ArrayList<ObservedSubjectRole>();
    // first grab observation template name
    List<ObservationTemplate> otList = queryWithClass("from ObservationTemplateImpl where displayName = :templateName", "templateName", templateName);
    for (ObservationTemplate ot : otList) {
        List<ObservedSubjectRole> osrList = query2ParamsWithClass("from ObservedSubjectRoleImpl as osr where columnName = :columnName and " + "osr.observationTemplate = :ot", "columnName", columnName, "ot", ot);
        for (ObservedSubjectRole o : osrList) {
            list.add(o);
        }
    }
    assert list.size() <= 1;
    return (list.size() == 1) ? list.iterator().next() : null;
}
Also used : ObservedSubjectRole(gov.nih.nci.ctd2.dashboard.model.ObservedSubjectRole) ArrayList(java.util.ArrayList) ObservationTemplate(gov.nih.nci.ctd2.dashboard.model.ObservationTemplate)

Example 2 with ObservationTemplateImpl

use of gov.nih.nci.ctd2.dashboard.impl.ObservationTemplateImpl in project nci-ctd2-dashboard by CBIIT.

the class DashboardDaoImpl method findObservedEvidenceRole.

@Override
public ObservedEvidenceRole findObservedEvidenceRole(String templateName, String columnName) {
    List<ObservedEvidenceRole> list = new ArrayList<ObservedEvidenceRole>();
    // first grab observation template name
    List<ObservationTemplate> otList = queryWithClass("from ObservationTemplateImpl where displayName = :templateName", "templateName", templateName);
    for (ObservationTemplate ot : otList) {
        List<ObservedEvidenceRole> oerList = query2ParamsWithClass("from ObservedEvidenceRoleImpl as oer where columnName = :columnName and " + "oer.observationTemplate = :ot", "columnName", columnName, "ot", ot);
        for (ObservedEvidenceRole o : oerList) {
            list.add(o);
        }
    }
    assert list.size() <= 1;
    return (list.size() == 1) ? list.iterator().next() : null;
}
Also used : ArrayList(java.util.ArrayList) ObservationTemplate(gov.nih.nci.ctd2.dashboard.model.ObservationTemplate) ObservedEvidenceRole(gov.nih.nci.ctd2.dashboard.model.ObservedEvidenceRole)

Example 3 with ObservationTemplateImpl

use of gov.nih.nci.ctd2.dashboard.impl.ObservationTemplateImpl in project nci-ctd2-dashboard by CBIIT.

the class DashboardDaoImpl method findSubmissionByIsStory.

@Override
public List<Submission> findSubmissionByIsStory(boolean isSubmissionStory, boolean sortByPriority) {
    List<ObservationTemplate> tmpList1 = queryWithClass("from ObservationTemplateImpl where isSubmissionStory = :iss order by submissionStoryRank desc", "iss", isSubmissionStory);
    List<ObservationTemplate> tmpList2 = queryWithClass("from ObservationTemplateImpl where isSubmissionStory = :iss", "iss", isSubmissionStory);
    List<ObservationTemplate> tmpList = sortByPriority ? tmpList1 : tmpList2;
    List<Submission> list = new ArrayList<Submission>();
    for (ObservationTemplate o : tmpList) {
        list.addAll(findSubmissionByObservationTemplate(o));
    }
    return list;
}
Also used : Submission(gov.nih.nci.ctd2.dashboard.model.Submission) ObservationTemplate(gov.nih.nci.ctd2.dashboard.model.ObservationTemplate) ArrayList(java.util.ArrayList)

Aggregations

ObservationTemplate (gov.nih.nci.ctd2.dashboard.model.ObservationTemplate)3 ArrayList (java.util.ArrayList)3 ObservedEvidenceRole (gov.nih.nci.ctd2.dashboard.model.ObservedEvidenceRole)1 ObservedSubjectRole (gov.nih.nci.ctd2.dashboard.model.ObservedSubjectRole)1 Submission (gov.nih.nci.ctd2.dashboard.model.Submission)1