private void initializeCubiclesRoomsBedsCombo() { form.cmbCubicle().clear(); if( form.getLocalContext().getCurrentTrackingIsNotNull()) { TrackingAreaCubiclesVo tempVo = domain.getTrackingAreaCubicles(form.getLocalContext().getCurrentTracking().getCurrentArea()); if( tempVo != null && tempVo.getCubiclesRoomsBedsIsNotNull()) { for(int i = 0;i < tempVo.getCubiclesRoomsBeds().size();i++) { form.cmbCubicle().newRow(tempVo.getCubiclesRoomsBeds().get(i), tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName()); } } } }
private void comboAreaValueChanged() { form.grdCubiclesRoomsBeds().getRows().clear(); if( form.cmbArea().getValue() != null) { TrackingAreaCubiclesVo tempVo = domain.getTrackingAreaCubicle(form.cmbArea().getValue()); form.getLocalContext().setCurrentTrackingAreaCubicles(tempVo); form.getLocalContext().setTrackingArea(form.cmbArea().getValue()); if( tempVo != null && tempVo.getCubiclesRoomsBedsIsNotNull()&& tempVo.getCubiclesRoomsBeds().size() > 0 ) { for(int i = 0; i < tempVo.getCubiclesRoomsBeds().size();i++) { grdCubiclesRoomsBedsRow row = form.grdCubiclesRoomsBeds().getRows().newRow(); row.setCubilcelsRoomsBeds(tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName()); row.setValue(tempVo.getCubiclesRoomsBeds().get(i)); } } } else form.getLocalContext().setCurrentTrackingAreaCubicles(null); form.getLocalContext().setSelectedEvent(SendToConfigEvent.COMBOVALUECHANGED); form.fireCustomControlValueChanged(); }
private void initializeCubiclesRoomsBedsCombo() { form.cmbCubicle().clear(); if( form.getLocalContext().getCurrentTrackingIsNotNull()) { TrackingAreaCubiclesVo tempVo = domain.getTrackingAreaCubicles(form.getLocalContext().getCurrentTracking().getCurrentArea()); if( tempVo != null && tempVo.getCubiclesRoomsBedsIsNotNull()) { //WDEV-20720 TrackingCubicleRoomBedVoCollection collCurrentlyAllocatedCubicle = domain.getCurrentlyAllocatedCubicles(form.getLocalContext().getCurrentTracking().getCurrentArea()); for(int i = 0;i < tempVo.getCubiclesRoomsBeds().size();i++) { if (collCurrentlyAllocatedCubicle!=null && collCurrentlyAllocatedCubicle.size()>0 && collCurrentlyAllocatedCubicle.contains(tempVo.getCubiclesRoomsBeds().get(i))) { form.cmbCubicle().newRow(tempVo.getCubiclesRoomsBeds().get(i), tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName(), Color.Red); } else { form.cmbCubicle().newRow(tempVo.getCubiclesRoomsBeds().get(i), tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName()); } } } } }
private void populateCubicleRooms() { form.cmbCubicleRoom().clear(); if (form.grdSendToArea().getSelectedRow() != null) { TrackingAreaCubiclesVo cubicle = domain.getTrackingAreaCubicle(form.grdSendToArea().getSelectedRow().getValue()); if( cubicle != null && cubicle.getCubiclesRoomsBeds() != null && cubicle.getCubiclesRoomsBeds().size() > 0 ) { for(int i = 0; i < cubicle.getCubiclesRoomsBeds().size();i++) { form.cmbCubicleRoom().newRow(cubicle.getCubiclesRoomsBeds().get(i), cubicle.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName()); } } } }
public TrackingAreaCubiclesVo getTrackingAreaCubicle(TrackingAreaRefVo trackingAreaRef) { if(trackingAreaRef == null || trackingAreaRef.getID_TrackingArea() == null) return null; StringBuffer hql = new StringBuffer(); hql.append("select t1_1 from TrackingAreaCubicles as t1_1 left join t1_1.trackingArea as t2_1 "); hql.append("where (t2_1.id = :trackinAreaId) "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"trackinAreaId"}, new Object[] {trackingAreaRef.getID_TrackingArea()}); if (list!=null && list.size()>0) { return TrackingAreaCubiclesVoAssembler.createTrackingAreaCubiclesVoCollectionFromTrackingAreaCubicles(list).get(0); } return null; }
private void populateScreenFromData(CubicleAllocationVo cubic) { clearControlDetails(); if(cubic != null) { form.ccAllocatedBy().setValue(cubic.getAllocatedBy()); form.dtimAllocatedCubicle().setValue(cubic.getAllocatedCubicleDateTime()); form.cmbCubicle().setValue(cubic.getCubicleRoomBed()); //wdev-16011 form.lblNameOfTrackingArea().setValue(cubic.getTrackingAreaIsNotNull()? cubic.getTrackingArea().getAreaDisplayName():""); //wdev-16011 form.cmbCubicle().clear(); if( cubic.getTrackingAreaIsNotNull()) { TrackingAreaCubiclesVo tempVo = domain.getTrackingAreaCubicles(cubic.getTrackingArea()); if( tempVo != null && tempVo.getCubiclesRoomsBedsIsNotNull()) { for(int i = 0;i < tempVo.getCubiclesRoomsBeds().size();i++) { form.cmbCubicle().newRow(tempVo.getCubiclesRoomsBeds().get(i), tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName()); } } form.cmbCubicle().setValue(cubic.getCubicleRoomBed()); } //--------- } }
private boolean save() { TrackingForAllocateCubicleVo trackinrecord = null; String[] uiErrors = getUiErrors(); if (uiErrors != null) { engine.showErrors(uiErrors); return false; } CubicleAllocationVo record = populateDataFromScreen(form.getLocalContext().getCurrentCubicleAllocation()); String[] errors = record.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } //verify if is new record and the patient is in ED if( record.getID_CubicleAllocation() == null && form.getLocalContext().getCurrentTrackingIsNotNull() && !Boolean.TRUE.equals(form.getLocalContext().getCurrentTracking().getIsDischarged())) { trackinrecord = form.getLocalContext().getCurrentTracking(); trackinrecord.setCurrentCubicle(record); errors = trackinrecord.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } } //WDEV-17469 -> verify if Cubicle was removed from configuration by another user TrackingAreaCubiclesVo cubicles = domain.getTrackingAreaCubicles(form.getLocalContext().getCurrentTracking().getCurrentArea()); if (cubicles != null && cubicles.getCubiclesRoomsBeds() != null && (! cubicles.getCubiclesRoomsBeds().contains(form.cmbCubicle().getValue()))) { engine.showMessage("Selected Cubicle/Room/Bed was removed from Configuration. Please select another."); return false; } try { if( trackinrecord != null) record = domain.saveCubicleAllocation(null,trackinrecord); else record = domain.saveCubicleAllocation(record,null); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); if( form.getGlobalContext().Emergency.getTracking() != null) form.getLocalContext().setCurrentTracking(domain.getTracking(form.getGlobalContext().Emergency.getTracking())); } form.getLocalContext().setCurrentCubicleAllocation(record); return true; }
public Boolean removedCubicleAreUsed() { TrackingAreaCubiclesVo tempVo = domain.getTrackingAreaCubicle(form.cmbArea().getValue()); TrackingCubicleRoomBedVoCollection collRemovedCubicle=new TrackingCubicleRoomBedVoCollection(); if( tempVo != null && tempVo.getCubiclesRoomsBedsIsNotNull()&& tempVo.getCubiclesRoomsBeds().size() > 0 ) { TrackingCubicleRoomBedVoCollection collCubicleFromDB = tempVo.getCubiclesRoomsBeds(); TrackingCubicleRoomBedVoCollection collCubicleFromScreen = new TrackingCubicleRoomBedVoCollection(); if( form.grdCubiclesRoomsBeds().getRows().size() > 0) { for(int i = 0; i < form.grdCubiclesRoomsBeds().getRows().size();i++) { collCubicleFromScreen.add(form.grdCubiclesRoomsBeds().getRows().get(i).getValue()); } } else collCubicleFromScreen = null; for(int i = 0; i < collCubicleFromDB.size();i++) { if (collCubicleFromDB!=null && collCubicleFromScreen!=null && !collCubicleFromScreen.contains(collCubicleFromDB.get(i))) { collRemovedCubicle.add(collCubicleFromDB.get(i)); } } } if (collRemovedCubicle==null || collRemovedCubicle.size()==0) return false; for (int i=0;i<collRemovedCubicle.size();i++) { CubicleAllocationVoCollection tempColl = domain.getAllcotiobCubilce(collRemovedCubicle.get(i)); if( tempColl != null) { return true; } } return false; }
public TrackingAreaCubiclesVo getTrackingAreaCubicles(TrackingAreaRefVo trackingAreaRef) { if( trackingAreaRef == null ) return null; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select t1_1 from TrackingAreaCubicles as t1_1 left join t1_1.trackingArea as t2_1 where (t2_1.id = :trackingAreaId) "); List list = factory.find(hql.toString(), new String[] {"trackingAreaId"}, new Object[] {trackingAreaRef.getID_TrackingArea()}); if( list != null && list.size() > 0) { TrackingAreaCubiclesVoCollection tempColl = TrackingAreaCubiclesVoAssembler.createTrackingAreaCubiclesVoCollectionFromTrackingAreaCubicles(list); if( tempColl != null ) return tempColl.get(0); } return null; }
public TrackingAreaCubiclesVo saveTrackingAreaCubicle(TrackingAreaCubiclesVo trackingAreaCubicle) throws StaleObjectException, UniqueKeyViolationException { if( trackingAreaCubicle == null) throw new CodingRuntimeException("TrackingAreaCubiclesVo is null"); DomainFactory factory = getDomainFactory(); if( trackingAreaCubicle != null && trackingAreaCubicle.getID_TrackingAreaCubicles() == null ) { if( existTrackingAreaCubiclesForTrackingArea(trackingAreaCubicle.getTrackingArea().getID_TrackingArea(),factory) == true) { throw new StaleObjectException(null); } } TrackingAreaCubicles trackingAreaCub = TrackingAreaCubiclesVoAssembler.extractTrackingAreaCubicles(factory, trackingAreaCubicle); factory.save(trackingAreaCub); return TrackingAreaCubiclesVoAssembler.create(trackingAreaCub); }
private void populateScreenFromData(CubicleAllocationVo cubic) { clearControlDetails(); if(cubic != null) { form.ccAllocatedBy().setValue(cubic.getAllocatedBy()); form.dtimAllocatedCubicle().setValue(cubic.getAllocatedCubicleDateTime()); form.cmbCubicle().setValue(cubic.getCubicleRoomBed()); //wdev-16011 form.lblNameOfTrackingArea().setValue(cubic.getTrackingAreaIsNotNull()? cubic.getTrackingArea().getAreaDisplayName():""); //wdev-16011 form.cmbCubicle().clear(); if( cubic.getTrackingAreaIsNotNull()) { TrackingAreaCubiclesVo tempVo = domain.getTrackingAreaCubicles(cubic.getTrackingArea()); if( tempVo != null && tempVo.getCubiclesRoomsBedsIsNotNull()) { //WDEV-20720 TrackingCubicleRoomBedVoCollection collCurrentlyAllocatedCubicle = domain.getCurrentlyAllocatedCubicles(form.getLocalContext().getCurrentTracking().getCurrentArea()); for(int i = 0;i < tempVo.getCubiclesRoomsBeds().size();i++) { if (collCurrentlyAllocatedCubicle!=null && collCurrentlyAllocatedCubicle.size()>0 && collCurrentlyAllocatedCubicle.contains(tempVo.getCubiclesRoomsBeds().get(i))) { form.cmbCubicle().newRow(tempVo.getCubiclesRoomsBeds().get(i), tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName(), Color.Red); } else { form.cmbCubicle().newRow(tempVo.getCubiclesRoomsBeds().get(i), tempVo.getCubiclesRoomsBeds().get(i).getCubicleRoomBedName()); } } } form.cmbCubicle().setValue(cubic.getCubicleRoomBed()); } //--------- } }