use of gov.nih.nci.ctd2.dashboard.impl.SubjectImpl in project nci-ctd2-dashboard by CBIIT.
the class DashboardDaoImpl method findSubjectsBySynonym.
@Override
public List<Subject> findSubjectsBySynonym(String synonym, boolean exact) {
Set<Subject> subjects = new HashSet<Subject>();
// First grab the synonyms
String query = "from SynonymImpl where displayName " + (exact ? " = :synonym" : "like concat('%', :synonym, '%')");
List<Synonym> synonymList = queryWithClass(query, "synonym", synonym);
for (Synonym o : synonymList) {
// Second: find subjects with the synonym
List<Subject> subjectList = queryWithClass("select o from SubjectImpl as o where :synonyms member of o.synonyms", "synonyms", o);
for (Subject o2 : subjectList) {
subjects.add(o2);
}
}
return new ArrayList<Subject>(subjects);
}
Aggregations