@Override protected void onGrdLayoutsGridCheckBoxClicked(int column, grdLayoutsRow row, boolean isChecked) throws PresentationLogicException { if (Boolean.FALSE.equals(isChecked) && row.getValue().getFloorBedSpaceLayout() != null && row.getValue().getID_BayConfig() != null) { if (row.getValue().getID_BayConfig() != null) { BedSpaceVoCollection getBedSpaces = domain.getBedSpacesForLayout(row.getValue().getFloorBedSpaceLayout()); if (areOccupiedBeds(getBedSpaces)) { row.setActive(Boolean.TRUE); engine.showMessage("Bay cannot be Inactivated as there are occupied beds on the Ward.", "Warning", MessageButtons.OK, MessageIcon.WARNING); } } } }
private void populateBedSpaceGrid(BedSpaceVoCollection bedSpaces) { form.grdBedSpace().getRows().clear(); if(bedSpaces == null) return; for(BedSpaceVo bed : bedSpaces) { grdBedSpaceRow row = form.grdBedSpace().getRows().newRow(); row.setColBedSpaceType(bed.getBedSpaceType() != null ? bed.getBedSpaceType().getText() : null); row.setColWardType(bed.getWardType() != null ? bed.getWardType().getText() : null); row.setColBedNumber(bed.getBedNumber()); row.setColTextPosition(bed.getTextPosition()); row.setColImagePosition(bed.getImagePosition()); row.setValue(bed); } }
private Boolean areOccupiedBeds(BedSpaceVoCollection getBedSpaces) { if (getBedSpaces == null) return false; for (int i=0; i < getBedSpaces.size(); i++) { BedSpaceStateStatusLiteVo bedSpaceState = domain.getBedSpaceStateStatus(getBedSpaces.get(i)); if (BedStatus.OCCUPIED.equals(bedSpaceState.getBedStatus())) return true; } return false; }
public BedSpaceVoCollection getBedSpacesForLayout(FloorBedSpaceLayoutRefVo floorBedSpaceLayoutRef) { if (floorBedSpaceLayoutRef == null || floorBedSpaceLayoutRef.getID_FloorBedSpaceLayout() == null) throw new CodingRuntimeException("Cannot get BedSpaces on null FloorBedSpaceLayoutRef"); String hql = "select bs.bedSpaces from FloorBedSpaceLayout as bs where bs.id = " + floorBedSpaceLayoutRef.getID_FloorBedSpaceLayout(); List bedSpaces = getDomainFactory().find(hql); BedSpaceVoCollection voColl = BedSpaceVoAssembler.createBedSpaceVoCollectionFromBedSpace(bedSpaces); return voColl; }
@Override protected void onGrdLayoutsGridCheckBoxClicked(int column, grdLayoutsRow row, boolean isChecked) throws PresentationLogicException { //http://jira/browse/WDEV-20449 // if (Boolean.FALSE.equals(isChecked) && row.getValue().getFloorBedSpaceLayout() != null && row.getValue().getID_BayConfig() != null) // { // if (row.getValue().getID_BayConfig() != null) // { // BedSpaceVoCollection getBedSpaces = domain.getBedSpacesForLayout(row.getValue().getFloorBedSpaceLayout()); // // if (areOccupiedBeds(getBedSpaces)) // { // row.setActive(Boolean.TRUE); // //engine.showMessage("Bay cannot be Inactivated as there are occupied beds on the Ward.", "Warning", MessageButtons.OK, MessageIcon.WARNING); // } // } // } // // if (column == 3) // calculateNrOfBeds(); // Only perform following if user has ticked/unticked column 3 (Active) in grdLayouts if (column == COL_BAY_ACTIVE) { if (row.getValue().getID_BayConfig() != null) { BedSpaceVoCollection getBedSpaces = domain.getBedSpacesForLayout(row.getValue().getFloorBedSpaceLayout()); if (areOccupiedBeds(getBedSpaces)) { row.setActive(Boolean.TRUE); engine.showMessage("The bay cannot be inactivated as there are patients occupying a bed admitted on it.", "Warning", MessageButtons.OK, MessageIcon.WARNING); } } calculateNrOfBeds(); } //WDEV-20449 }
public BedSpaceVoCollection getBedSpacesForLayout(FloorBedSpaceLayoutRefVo floorBedSpaceLayoutRef) { if (floorBedSpaceLayoutRef == null || floorBedSpaceLayoutRef.getID_FloorBedSpaceLayout() == null) throw new CodingRuntimeException("Cannot get BedSpaces on null FloorBedSpaceLayoutRef"); String hql = "select bs.bedSpaces from FloorBedSpaceLayout as bs where bs.id = " + floorBedSpaceLayoutRef.getID_FloorBedSpaceLayout(); List<?> bedSpaces = getDomainFactory().find(hql); BedSpaceVoCollection voColl = BedSpaceVoAssembler.createBedSpaceVoCollectionFromBedSpace(bedSpaces); return voColl; }