private void linkGPtoPractice(GpToPracticesVoCollection coll, GP gpVo, OrganisationVo orgVo, int i, boolean bSetPrimary) throws HL7Exception,StaleObjectException { orgVo = saveOrganisation(orgVo); GpToPracticesVo link = new GpToPracticesVo(); link.setGp(gpVo); link.setPractice(orgVo); if (bSetPrimary) //only HEARTS behaviour will set this { link.setIsPrimaryPractice(true); for (int j = 0; j < coll.size(); j++) coll.get(j).setIsPrimaryPractice(false); } else if (ConfigFlag.HL7.HEARTS_GP_MODEL.getValue() == false) { // set the first practice to primary if (i == 0) link.setIsPrimaryPractice(true); else link.setIsPrimaryPractice(false); } coll.add(link); }
private GpToPracticesVoCollection newGpToPracticesCollectionFromDTORecord(Gp_practiceRecord gp_practice_record, GpShortVo voGP ) { GpToPracticesVo voGpToPractice = new GpToPracticesVo(); voGpToPractice.setGp(voGP); voGpToPractice.setGpCode(gp_practice_record.Gp_code); // TODO voGpToPractice.setPractice(voGPPractice); voGpToPractice.setIsPrimaryPractice(Boolean.TRUE); GpToPracticesVoCollection voCollGpToPractices = new GpToPracticesVoCollection(); voCollGpToPractices.add(voGpToPractice); return voCollGpToPractices; }
/** * Returns a collection of all practices in the Details panel grid. * @param null * @return GpToPracticesVoCollection */ private GpToPracticesVoCollection getPractices() { GpToPracticesVoCollection voPracts = new GpToPracticesVoCollection(); for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size(); i++) { Object obj = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i).getValue(); if ( obj != null && obj instanceof GpToPracticesVo) { GpToPracticesVo voGpToPractice = (GpToPracticesVo)obj; DynamicGridRow pRow = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i); if (pRow != null) { DynamicGridCell cellPrimary = pRow.getCells().get(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PRIMARY)); if (cellPrimary != null && cellPrimary.getValue() != null && cellPrimary.getValue().equals(Boolean.TRUE)) voGpToPractice.setIsPrimaryPractice(Boolean.TRUE); else voGpToPractice.setIsPrimaryPractice(Boolean.FALSE); DynamicGridCell cellPasCode = pRow.getCells().get(form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getColumns().getByIdentifier(COL_PASCODE)); voGpToPractice.setGpCode((String)cellPasCode.getValue()); } voPracts.add(voGpToPractice); } } return voPracts; }
/** * Loops through each practice of the given GpToPracticesVoCollection calling adding them to the grid * @param GpToPracticesVoCollection * @return null */ private void populatePractices(GpToPracticesVoCollection voPracticeColl) { if (voPracticeColl != null) { for(int x = 0; x < voPracticeColl.size(); x++) { addPracticeRow(voPracticeColl.get(x)); } } }
private boolean containsPrimary(GpToPracticesVoCollection coll) { if (coll!=null) { for (GpToPracticesVo gpToPracticesVo : coll) { if(gpToPracticesVo.getIsPrimaryPracticeIsNotNull() &&gpToPracticesVo.getIsPrimaryPractice().equals(Boolean.TRUE)) { return true; } } } return false; }
private String displayGP(GpShortVo gp) { if (gp == null) return null; if (gp.getName() == null) return null; String value = gp.getName().toString(); if (gp.getPracticesIsNotNull()) { GpToPracticesVoCollection practices = gp.getPractices(); for (int i = 0; i < practices.size(); i++) { if (practices.get(i) == null) continue; if (!Boolean.TRUE.equals(practices.get(i).getIsPrimaryPractice())) continue; OrganisationWithSitesVo practice = practices.get(i).getPractice(); if (practice == null) continue; if (practice.getName() == null) continue; value += ", " + practice.getName(); PersonAddress address = practice.getAddress(); if (address == null) continue; String addressString = ((address.getLine1() == null || PersonAddress.getLine1MaxLength() == 0)? "" : (address.getLine1())) + ((address.getLine2() == null || PersonAddress.getLine2MaxLength() == 0)? "" : (" " + address.getLine2())) + ((address.getLine3() == null || PersonAddress.getLine3MaxLength() == 0)? "" : (" " + address.getLine3())) + ((address.getLine4() == null || PersonAddress.getLine4MaxLength() == 0)? "" : (" " + address.getLine4())) + ((address.getLine5() == null || PersonAddress.getLine5MaxLength() == 0)? "" : (" " + address.getLine5())) + ((address.getCounty() == null)? "" : (", " + address.getCounty().toString())); value += ", " + addressString; } } return value; }