private void fillRecordBrowser() { EnvironmentalVisitShortVoCollection voEnvirVisitShortColl = domain.getEnvironmentalVisitByCareContext(form.getGlobalContext().Core.getCurrentCareContext()); loadCurrentCareContext(); loadEnvironmentalVisitsOfCareContext(voEnvirVisitShortColl); boolean currentClinicalContactFound = false; if(voEnvirVisitShortColl != null) { for(int i=0; i<voEnvirVisitShortColl.size(); i++) { if(voEnvirVisitShortColl.get(i).getClinicalContactIsNotNull()) { currentClinicalContactFound = loadEnvironmentalVisitsOfClinicalContact(voEnvirVisitShortColl.get(i)); } } } if(!currentClinicalContactFound) loadCurrentClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact(), Color.Green); browseRecord(); }
private void loadEnvironmentalVisitsOfCareContext(EnvironmentalVisitShortVoCollection voEnvirVisitShortColl) { if(voEnvirVisitShortColl != null) { for(int i =0; i<voEnvirVisitShortColl.size(); i++) { EnvironmentalVisitShortVo voEnvironmentalVisit = voEnvirVisitShortColl.get(i); if(voEnvironmentalVisit.getClinicalContact() == null && voEnvironmentalVisit.getCareContext().getID_CareContext().equals(form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext())) { loadEnvironmentalVisitsForACareContext(voEnvironmentalVisit); } } } }
public EnvironmentalVisitShortVoCollection getEnvironmentalVisitByCareContext(CareContextRefVo voCareContextRefVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from EnvironmentalVisit ev "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voCareContextRefVo != null) { hql.append(andStr + " ev.careContext.id = :id_CareContext"); markers.add("id_CareContext"); values.add(voCareContextRefVo.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List visit = factory.find(query, markers, values); EnvironmentalVisitShortVoCollection collEnvironmentalVisitShortVo = EnvironmentalVisitShortVoAssembler.createEnvironmentalVisitShortVoCollectionFromEnvironmentalVisit(visit); if(collEnvironmentalVisitShortVo != null) return collEnvironmentalVisitShortVo.sort(); return null; }