private boolean isfloorBedSpaceLayoutActive(WardBayConfigVo voWardBayConfig, LocationLiteVo voBay) { if(voWardBayConfig == null) throw new CodingRuntimeException("voWardBayConfig cannot be null in method isfloorBedSpaceLayoutActive"); if (voBay == null) throw new CodingRuntimeException("voBay cannot be null in method isfloorBedSpaceLayoutActive"); if(voWardBayConfig.getBaysIsNotNull()) { for(BayConfigVo voBayConfig : voWardBayConfig.getBays()) { if(voBayConfig.getBay().equals(voBay)) { if(voBayConfig.getFloorBedSpaceLayoutIsNotNull() && voBayConfig.getFloorBedSpaceLayout().getStatusIsNotNull()) if(voBayConfig.getFloorBedSpaceLayout().getStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)) return true; } } } return false; }
private boolean isThisRecordDuplicate(BayConfigVo voBayConfig, BayConfigVoCollection voCollBayConfig) { if (voCollBayConfig == null) throw new CodingRuntimeException("voCollBayConfig cannot be null in method isThisRecordDuplicate"); if (voBayConfig == null) throw new CodingRuntimeException("voCollBayConfig cannot be null in method isThisRecordDuplicate"); for (BayConfigVo voBayConfiglstItem : voCollBayConfig) { if(voBayConfiglstItem.getBayIsNotNull() && voBayConfiglstItem.getBay().getNameIsNotNull() && voBayConfiglstItem.getBayIsNotNull() && voBayConfiglstItem.getBayIsNotNull() && voBayConfiglstItem.getBay().getNameIsNotNull()) { if(voBayConfiglstItem.getBay().getName().equals(voBayConfig.getBay().getName())) { return true; } } } return false; }
@Override protected void onContextMenuItemClick(int menuItemID, Control sender) throws PresentationLogicException { switch(menuItemID) { case GenForm.ContextMenus.CoreNamespace.WardBayConfigDialog.ADD: grdLayoutsRow row = form.grdLayouts().getRows().newRow(); row.setBayValue(new LocationLiteVo()); row.setValue(new BayConfigVo()); addAvailableFloorLayouts(row); break; case GenForm.ContextMenus.CoreNamespace.WardBayConfigDialog.REMOVE: grdLayoutsRow lRow = form.grdLayouts().getSelectedRow(); if(lRow != null) { form.grdLayouts().removeSelectedRow(); //form.getContextMenus().Core.getWardBayConfigDialogREMOVEItem().setVisible(false); } break; default: } }
private boolean isfloorBedSpaceLayoutActive(WardBayConfigForWardViewVo voWardBayConfig, LocationLiteVo voBay) { if (voWardBayConfig == null|| voBay == null) return false; if(voWardBayConfig.getBaysIsNotNull()) { for(BayConfigVo voBayConfig : voWardBayConfig.getBays()) { if (Boolean.TRUE.equals(voBay.getIsActive()) && voBayConfig.getBay().equals(voBay)) { if(voBayConfig.getFloorBedSpaceLayoutIsNotNull() && voBayConfig.getFloorBedSpaceLayout().getStatusIsNotNull()) if(voBayConfig.getFloorBedSpaceLayout().getStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)) return true; } } } return false; }
private boolean isThisRecordDuplicate(BayConfigVo voBayConfig, BayConfigVoCollection voCollBayConfig) { if (voCollBayConfig == null) return false; if (voBayConfig == null) return false; for (BayConfigVo voBayConfiglstItem : voCollBayConfig) { if(voBayConfiglstItem.getBayIsNotNull() && voBayConfiglstItem.getBay().getNameIsNotNull() && Boolean.TRUE.equals(voBayConfiglstItem.getIsActive()) && Boolean.TRUE.equals(voBayConfig.getIsActive())) { if(voBayConfiglstItem.getBay().getName().equals(voBayConfig.getBay().getName())) { return true; } } } return false; }
@Override protected void onContextMenuItemClick(int menuItemID, Control sender) throws PresentationLogicException { switch(menuItemID) { case GenForm.ContextMenus.CoreNamespace.WardBayConfigDialog.ADD: grdLayoutsRow row = form.grdLayouts().getRows().newRow(true); row.setBayValue(new LocationLiteVo()); row.setValue(new BayConfigVo()); addAvailableFloorLayouts(row); break; case GenForm.ContextMenus.CoreNamespace.WardBayConfigDialog.REMOVE: grdLayoutsRow lRow = form.grdLayouts().getSelectedRow(); if(lRow != null) { form.grdLayouts().removeSelectedRow(); //form.getContextMenus().Core.getWardBayConfigDialogREMOVEItem().setVisible(false); } break; case GenForm.ContextMenus.CoreNamespace.WardBayConfigDialog.CONFIGURE_BED_TIMES: configureBedTimes(); break; default: } }
private DynamicGridRow addBay(DynamicGridRow parentRow, BayConfigVo bayConfigVo) { if(parentRow == null || bayConfigVo == null) return null; DynamicGridRow row = parentRow.getRows().newRow(); if(bayConfigVo.getBayIsNotNull()) { DynamicGridCell cell = row.getCells().newCell(getNameColumn(), DynamicCellType.LABEL); cell.setValue(bayConfigVo.getBay().getName()); cell.setIdentifier(bayConfigVo); } row.setExpandedImage(form.getImages().Admin.Location); row.setCollapsedImage(form.getImages().Admin.Location); row.setSelectable(false); if(bayConfigVo.getFloorBedSpaceLayoutIsNotNull()) { DynamicGridCell floorCell = row.getCells().newCell(getFloorColumn(), DynamicCellType.LABEL); FloorBedSpaceLayoutLiteVo floorLayout = bayConfigVo.getFloorBedSpaceLayout(); if(floorLayout != null) { floorCell.setValue(floorLayout.getName()); floorCell.setIdentifier(floorLayout); } } return row; }
private void populateBayConfigsGridFromData(BayConfigVoCollection voCollBayConf) { form.grdLayouts().getRows().clear(); if(voCollBayConf == null) return; for (BayConfigVo voBayConfig : voCollBayConf) { grdLayoutsRow row = form.grdLayouts().getRows().newRow(); if(voBayConfig.getBayIsNotNull()) { row.setBayValue(voBayConfig.getBay()); row.setBay(voBayConfig.getBay().getName()); //WDEV-13964 row.setActive(voBayConfig.getBay().getIsActive()); } if(voBayConfig.getFloorBedSpaceLayoutIsNotNull()) { row.getBayBedSpaceLayout().newRow(voBayConfig.getFloorBedSpaceLayout(), voBayConfig.getFloorBedSpaceLayout().getName()); row.getBayBedSpaceLayout().setValue(voBayConfig.getFloorBedSpaceLayout()); row.setBayBedSpaceLayoutReadOnly(true); } addAvailableFloorLayouts(row); row.setValue(voBayConfig); } }
/** * if there was a previously instantiated BayConfig record for this one use it * else create new * @return */ private BayConfigVo getSelectedBayConfig() { if(form.getLocalContext().getSelectedBayConfigIsNotNull()) return form.getLocalContext().getSelectedBayConfig(); return new BayConfigVo(); }
public int compare(BayConfigVo o1, BayConfigVo o2) { if (o1 != null && o1.getBayIsNotNull() && o2 != null && o2.getBayIsNotNull()) return order*o1.getBay().getName().compareToIgnoreCase(o2.getBay().getName()); if (o1 == null || !o1.getBayIsNotNull() || !o1.getBay().getNameIsNotNull()) return -1*order; if (o2 == null || !o2.getBayIsNotNull() || !o2.getBay().getNameIsNotNull()) return order; return 0; }
private void populateBayConfigsGridFromData(BayConfigVoCollection voCollBayConf) { form.grdLayouts().getRows().clear(); if(voCollBayConf == null) return; for (BayConfigVo voBayConfig : voCollBayConf) { grdLayoutsRow row = form.grdLayouts().getRows().newRow(); if(voBayConfig.getBayIsNotNull()) { row.setBayValue(voBayConfig.getBay()); row.setBay(voBayConfig.getBay().getName()); //WDEV-13964 row.setActive(voBayConfig.getBay().getIsActive()); } if(voBayConfig.getFloorBedSpaceLayoutIsNotNull()) { row.getBayBedSpaceLayout().newRow(voBayConfig.getFloorBedSpaceLayout(), voBayConfig.getFloorBedSpaceLayout().getName()); row.getBayBedSpaceLayout().setValue(voBayConfig.getFloorBedSpaceLayout()); row.setBayBedSpaceLayoutReadOnly(true); row.setColFemale(Boolean.TRUE.equals(voBayConfig.getFemale()) ? true : false); row.setColMale(Boolean.TRUE.equals(voBayConfig.getMale()) ? true : false); row.setColPaediatric(Boolean.TRUE.equals(voBayConfig.getPaediatric()) ? true : false); row.setColWeekDay(Boolean.TRUE.equals(voBayConfig.getWeekdaysOnly()) ? true : false); row.setColDependencyLevel(voBayConfig.getDependency()); row.setColOpeningTime(voBayConfig.getOpeningTime()); row.setColClosingTime(voBayConfig.getClosingTime()); } addAvailableFloorLayouts(row); row.setValue(voBayConfig); } }
public void updateOccupiedBedsForWardAndBay(LocationRefVo ward, LocationRefVo bayOne, LocationRefVo bayTwo) throws StaleObjectException { if (ward == null || bayOne == null) return; // this is a move from one bed to another in the same bay - no need to update the occupied beds if (bayOne != null && bayTwo != null && bayOne.getID_Location().equals(bayTwo.getID_Location())) return; int bayOneOccupiedBeds = 0; int bayTwoOccupiedBeds = 0; int wardOccupiedBeds = 0; WardBayConfigForWardViewVo wardBayConfig = getWardBayConfigByWard(ward); if (wardBayConfig != null && wardBayConfig.getBays() != null) { for (int j = 0; j < wardBayConfig.getBays().size(); j++) { BayConfigVo wardBay = wardBayConfig.getBays().get(j); if (wardBay == null) continue; if (wardBay.getBay() != null) { if (wardBay.getBay().getID_Location().equals(bayOne.getID_Location())) { bayOneOccupiedBeds = getNumberOfOccupiedBedsInBay(bayOne); wardBay.setNumOfOccupiedBeds(bayOneOccupiedBeds); wardOccupiedBeds += bayOneOccupiedBeds; } else if (bayTwo != null && wardBay.getBay().getID_Location().equals(bayTwo.getID_Location())) { bayTwoOccupiedBeds = getNumberOfOccupiedBedsInBay(bayTwo); wardBay.setNumOfOccupiedBeds(bayTwoOccupiedBeds); wardOccupiedBeds += bayTwoOccupiedBeds; } } else wardOccupiedBeds += wardBay.getNumOfBeds(); } } //transfer has been made from 2 bays in the same ward - no need to update the ward occupied beds if ( !(bayOne != null && bayTwo != null)) wardBayConfig.setNumOfOccupiedBeds(wardOccupiedBeds); DomainFactory factory = getDomainFactory(); WardBayConfig doWardBayConfig = WardBayConfigForWardViewVoAssembler.extractWardBayConfig(factory, wardBayConfig); factory.save(doWardBayConfig); }