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; }
private void populateScreen() { BalanceActivitiesVo voBalance = form.getLocalContext().getvoBalanceAct(); if(voBalance != null) { form.dtimAuthoring().setValue(voBalance.getAuthoringDateTime()); form.qmbAuthoring().newRow(voBalance.getAuthoringHCP(), voBalance.getAuthoringHCP().toString()); form.qmbAuthoring().setValue(voBalance.getAuthoringHCP()); form.txtDetails().setValue(voBalance.getDetails()); if(voBalance.getBalanceActivitiesIsNotNull()) populateActivitiesGrid(voBalance.getBalanceActivities()); } }
public void saveBalanceActivities(BalanceActivitiesVo voBalanceActivities) throws StaleObjectException, UniqueKeyViolationException { if(!voBalanceActivities.isValidated()) throw new DomainRuntimeException("These Balance Activites have not been validated"); if (voBalanceActivities.getID_BalanceActivities() == null && getBalanceActivitiesByClinicalContact(voBalanceActivities.getClinicalContact()) != null) throw new StaleObjectException(null, "A Balance Activities record already exists for this Care Context, the screen will be refreshed."); DomainFactory factory = getDomainFactory(); BalanceActivities doBalAct = BalanceActivitiesVoAssembler.extractBalanceActivities(factory, voBalanceActivities); factory.save(doBalAct); }