public BalanceActivitiesVo getBalanceActivitiesByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if (voClinicalContactRef == null) throw new RuntimeException("Cannot get Balance Activity for null Clinical Contact"); StringBuffer query = new StringBuffer("from BalanceActivities as b1_1 where b1_1.clinicalContact.id = :CCID order by b1_1.systemInformation.creationDateTime desc"); //wdev-13637 List list = getDomainFactory().find(query.toString(), "CCID", voClinicalContactRef.getID_ClinicalContact()); if (list == null || list.size() == 0) return null; BalanceActivitiesVoCollection voColl = BalanceActivitiesVoAssembler.createBalanceActivitiesVoCollectionFromBalanceActivities(list); if (voColl != null && voColl.size() > 0) { return voColl.get(0); } return null; }
public BalanceActivitiesVoCollection getBalanceActivitiesByCareContext(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from BalanceActivities b "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voCareContextRef != null) { hql.append(andStr + " b.clinicalContact.careContext.id = :id_CareContext"); markers.add("id_CareContext"); values.add(voCareContextRef.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List driving = factory.find(query, markers, values); return BalanceActivitiesVoAssembler.createBalanceActivitiesVoCollectionFromBalanceActivities(driving); }
private void fillRecordBrowser(BalanceActivitiesVoCollection voBalanceActivitiesColl) { form.recbrBalance().clear(); boolean selectedClinicalContactFound = false; CareContextShortVo voSelectedCareContext = form.getGlobalContext().Core.getCurrentCareContext(); ClinicalContactShortVo voSelectedClinicalContact = form.getGlobalContext().Core.getCurrentClinicalContact(); form.recbrBalance().newRow(voSelectedCareContext, voSelectedCareContext.getRecordBrowserText()); if(voBalanceActivitiesColl != null) { for(int i=0; i<voBalanceActivitiesColl.size(); i++) { ClinicalContactShortVo voClinicalContact = voBalanceActivitiesColl.get(i).getClinicalContact(); if(voSelectedClinicalContact != null && voClinicalContact.getID_ClinicalContact().equals(voSelectedClinicalContact.getID_ClinicalContact())) { selectedClinicalContactFound = true; form.recbrBalance().newRow(voClinicalContact, "\t\t\t\tClinical Contact: " + voClinicalContact.getStartDateTime().toString() + " - " + voClinicalContact.getSeenBy().toString(), Color.Green); form.recbrBalance().setValue(voClinicalContact); } else { form.recbrBalance().newRow(voClinicalContact, "\t\t\t\tClinical Contact: " + voClinicalContact.getStartDateTime().toString() + " - " + voClinicalContact.getSeenBy().toString()); } } } if(!selectedClinicalContactFound && voSelectedClinicalContact != null) { form.recbrBalance().newRow(voSelectedClinicalContact, "\t\t\t\tClinical Contact: " + voSelectedClinicalContact.getStartDateTime().toString() + " - " + voSelectedClinicalContact.getSeenBy().toString(), Color.Green); form.recbrBalance().setValue(voSelectedClinicalContact); } browseRecord(); }