Java Code Examples for ims.core.vo.BedSpaceStateStatusLiteVo

The following are top voted examples for showing how to use ims.core.vo.BedSpaceStateStatusLiteVo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
	DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

	voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
	voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
	voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

	BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
	if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
	{
		voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
		voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
		voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
	}
	else
		voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

	// move to previous
	if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
	}

	voDischargedEpisode.setIsActive(true);
	voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
	return voDischargedEpisode;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
	}

	String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise();
		engine.close(DialogResult.OK);
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
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;
}
 
Example 4
Project: AvoinApotti   File: WardBayConfigDialogImpl.java   View source code 5 votes vote down vote up
public BedSpaceStateStatusLiteVo getBedSpaceStateStatus(BedSpaceRefVo bedSpaceref)
{
	if (bedSpaceref == null || bedSpaceref.getID_BedSpace() == null)
		throw new CodingRuntimeException("Cannot get BedSpaceStateStatus on null bedSpaceRef");
	
	String hql = "select bss.currentBedStatus from BedSpaceState as bss left join bss.bedSpace as bs where bs.id = " + bedSpaceref.getID_BedSpace();
	List bedSpaces = getDomainFactory().find(hql);
	
	BedSpaceStateStatusLiteVoCollection voColl = BedSpaceStateStatusLiteVoAssembler.createBedSpaceStateStatusLiteVoCollectionFromBedSpaceStateStatus((bedSpaces));
		
	if (voColl != null && voColl.size() > 0)
		return voColl.get(0);
	
	return null;
}
 
Example 5
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
	DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

	voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
	voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
	voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

	BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
	if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
	{
		voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
		voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
		voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
	}
	else
		voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

	// move to previous
	if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
	}

	voDischargedEpisode.setIsActive(true);
	voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
	return voDischargedEpisode;
}
 
Example 6
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
	}

	String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise(false, false); //WDEV-17662
		engine.close(DialogResult.OK);
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 7
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
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;
}
 
Example 8
Project: openMAXIMS   File: WardBayConfigDialogImpl.java   View source code 5 votes vote down vote up
public BedSpaceStateStatusLiteVo getBedSpaceStateStatus(BedSpaceRefVo bedSpaceref)
{
	if (bedSpaceref == null || bedSpaceref.getID_BedSpace() == null)
		throw new CodingRuntimeException("Cannot get BedSpaceStateStatus on null bedSpaceRef");
	
	String hql = "select bss.currentBedStatus from BedSpaceState as bss left join bss.bedSpace as bs where bs.id = " + bedSpaceref.getID_BedSpace();
	List<?> bedSpaces = getDomainFactory().find(hql);
	
	BedSpaceStateStatusLiteVoCollection voColl = BedSpaceStateStatusLiteVoAssembler.createBedSpaceStateStatusLiteVoCollectionFromBedSpaceStateStatus((bedSpaces));
		
	if (voColl != null && voColl.size() > 0)
		return voColl.get(0);
	
	return null;
}
 
Example 9
Project: openMAXIMS   File: WardViewPatientListImpl.java   View source code 5 votes vote down vote up
public void returnFromHomeLeaveToWard(InpatientEpisodeLiteVo voInpat, HomeLeaveVo voHomeLeave)	throws DomainInterfaceException, StaleObjectException
{
	if (voInpat == null)
		throw new CodingRuntimeException("voInpat argumment cannot be null in method returnFromHomeLeaveToWard()");
	
	BedAdmissionComponent impl = (BedAdmissionComponent) getDomainImpl(BedAdmissionComponentImpl.class);
	AdmissionDetailVo voAdmissionDetail = null;
	
	if (voInpat.getBedIsNotNull())
	{
		DomainFactory domainFactory = getDomainFactory();
		BedSpaceState doBedSpaceState = (BedSpaceState) domainFactory.getDomainObject(BedSpaceState.class, voInpat.getBed().getID_BedSpaceState());
		
		if (doBedSpaceState.getCurrentBedStatus() != null)
		{
			BedSpaceStateStatusLiteVo voBedSpaceStatus = BedSpaceStateStatusLiteVoAssembler.create(doBedSpaceState.getCurrentBedStatus());
			BedSpaceStateStatusLiteVo voPrevBedStatus = (BedSpaceStateStatusLiteVo) voBedSpaceStatus.clone();
			
			doBedSpaceState.setPreviousBedStatus(BedSpaceStateStatusLiteVoAssembler.extractBedSpaceStateStatus(domainFactory, voPrevBedStatus));
			doBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatus());
			doBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime(voHomeLeave.getDateReturnedFromHomeLeave(),(voHomeLeave.getTimeReturnedFromHomeLeave() != null ? voHomeLeave.getTimeReturnedFromHomeLeave() : new Time(0,0))).getJavaDate());
			doBedSpaceState.getCurrentBedStatus().setBedStatus(getDomLookup(BedStatus.AVAILABLE));

			voHomeLeave.setVacatedBedNumber(doBedSpaceState.getBedSpace() != null ? doBedSpaceState.getBedSpace().getBedNumber() : null);
		}

		doBedSpaceState.setInpatientEpisode(null);
		domainFactory.save(doBedSpaceState);
	}
	
	if (voInpat != null && voInpat.getPasEventIsNotNull())
		voAdmissionDetail  = impl.getAdmissionDetailByPasEvent(voInpat.getPasEvent());
	impl.returnFromHomeLeaveToWardWaitingArea(voInpat, voAdmissionDetail, voHomeLeave);		
}
 
Example 10
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
	DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

	voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
	voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
	voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

	BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
	if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
	{
		voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
		voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
		voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
	}
	else
		voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

	// move to previous
	if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
	}

	voDischargedEpisode.setIsActive(true);
	voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
	return voDischargedEpisode;
}
 
Example 11
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
	}

	String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise();
		engine.close(DialogResult.OK);
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 12
Project: openMAXIMS   File: Logic.java   View source code 5 votes vote down vote up
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;
}
 
Example 13
Project: openMAXIMS   File: WardBayConfigDialogImpl.java   View source code 5 votes vote down vote up
public BedSpaceStateStatusLiteVo getBedSpaceStateStatus(BedSpaceRefVo bedSpaceref)
{
	if (bedSpaceref == null || bedSpaceref.getID_BedSpace() == null)
		throw new CodingRuntimeException("Cannot get BedSpaceStateStatus on null bedSpaceRef");
	
	String hql = "select bss.currentBedStatus from BedSpaceState as bss left join bss.bedSpace as bs where bs.id = " + bedSpaceref.getID_BedSpace();
	List bedSpaces = getDomainFactory().find(hql);
	
	BedSpaceStateStatusLiteVoCollection voColl = BedSpaceStateStatusLiteVoAssembler.createBedSpaceStateStatusLiteVoCollectionFromBedSpaceStateStatus((bedSpaces));
		
	if (voColl != null && voColl.size() > 0)
		return voColl.get(0);
	
	return null;
}
 
Example 14
Project: openmaxims-linux   File: Logic.java   View source code 5 votes vote down vote up
private DischargedEpisodeADTVo createInfantDischarge(InpatientEpisodeLiteVo voInpat)
{
	DischargedEpisodeADTVo voDischargedEpisode = new DischargedEpisodeADTVo();

	voDischargedEpisode.setDischargeDateTime(form.lyrDetail().tabDischarge().dtimDischarge().getValue());
	voDischargedEpisode.setDischargeDestination(form.lyrDetail().tabDischarge().cmbDischargeDestination().getValue());
	voDischargedEpisode.setMethodOfDischarge(form.lyrDetail().tabDischarge().cmbMethodDischarge().getValue());

	BedSpaceStateLiteVo voBedSpaceState = domain.getBedSpaceStateByInpatientEpisode(voInpat);
	if (voBedSpaceState != null && voBedSpaceState.getInpatientEpisodeIsNotNull())
	{
		voDischargedEpisode.setPasEvent(voBedSpaceState.getInpatientEpisode().getPasEvent());
		voDischargedEpisode.setConsultantStays(voBedSpaceState.getInpatientEpisode().getConsultantStays());
		voDischargedEpisode.setWardStays(voBedSpaceState.getInpatientEpisode().getWardStays());
	}
	else
		voDischargedEpisode.setPasEvent(voInpat.getPasEvent());

	// move to previous
	if (voBedSpaceState != null && voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(form.lyrDetail().tabDischarge().chkAllocateForCleaning().getValue() ? BedStatus.FOR_CLEANING : BedStatus.AVAILABLE);
	}

	voDischargedEpisode.setIsActive(true);
	voDischargedEpisode.setBedSpaceForInfant(voBedSpaceState);
	return voDischargedEpisode;
}
 
Example 15
Project: openmaxims-linux   File: Logic.java   View source code 5 votes vote down vote up
@Override
protected void onBtnCloseClick() throws PresentationLogicException
{
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method onBtnCloseClick");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.CLOSED);
	}

	String[] arrErrors = voBedSpaceState.validate(getUIValidationForCloseBed());
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveCloseBed(voBedSpaceState, form.lyrDetail().tabCloseBed().cmbUser().getValue(), form.lyrDetail().tabCloseBed().cmbCloseReason().getValue(), form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise();
		engine.close(DialogResult.OK);
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 16
Project: openmaxims-linux   File: Logic.java   View source code 5 votes vote down vote up
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;
}
 
Example 17
Project: openmaxims-linux   File: WardBayConfigDialogImpl.java   View source code 5 votes vote down vote up
public BedSpaceStateStatusLiteVo getBedSpaceStateStatus(BedSpaceRefVo bedSpaceref)
{
	if (bedSpaceref == null || bedSpaceref.getID_BedSpace() == null)
		throw new CodingRuntimeException("Cannot get BedSpaceStateStatus on null bedSpaceRef");
	
	String hql = "select bss.currentBedStatus from BedSpaceState as bss left join bss.bedSpace as bs where bs.id = " + bedSpaceref.getID_BedSpace();
	List bedSpaces = getDomainFactory().find(hql);
	
	BedSpaceStateStatusLiteVoCollection voColl = BedSpaceStateStatusLiteVoAssembler.createBedSpaceStateStatusLiteVoCollectionFromBedSpaceStateStatus((bedSpaces));
		
	if (voColl != null && voColl.size() > 0)
		return voColl.get(0);
	
	return null;
}
 
Example 18
Project: AvoinApotti   File: Logic.java   View source code 4 votes vote down vote up
private void populateCloseBedTabFromData()
{
	BedSpaceStateStatusVo voStatus = form.getLocalContext().getCloseBedStatus();
	clearCloseTab();

	if(form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatusIsNotNull())
	{
		BedSpaceStateStatusLiteVo voBedSpaceStateStatus = form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatus();
		if(voBedSpaceStateStatus.getSysInfoIsNotNull())
		{
			String user = "";
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getLastupdateUser();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getCreationUser();
			
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().newRow(user,user);
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().setValue(user);
			
			DateTime dtime = null;
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getCreationDateTime();
			
			form.lyrDetail().tabCloseBed().dtimLastChanged().setValue(dtime);
		}		
	}
	
	
	if (voStatus != null)
	{
		if (voStatus.getSysInfoIsNotNull() && voStatus.getSysInfo().getCreationUser() != null)
		{
			form.lyrDetail().tabCloseBed().cmbUser().newRow(voStatus.getSysInfo().getCreationUser(), voStatus.getSysInfo().getCreationUser());
			form.lyrDetail().tabCloseBed().cmbUser().setValue(voStatus.getSysInfo().getCreationUser());
		}
		form.lyrDetail().tabCloseBed().cmbCloseReason().setValue(voStatus.getReasonForClosure());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(voStatus.getStatusDateTime());
		form.lyrDetail().tabCloseBed().dtimEstReOpen().setValue(voStatus.getEstReopeningDateTime());
	}
	else
	{
		form.lyrDetail().tabCloseBed().cmbUser().newRow(engine.getLoggedInUser().getUsername(), engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().cmbUser().setValue(engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(new DateTime());
	}
}
 
Example 19
Project: AvoinApotti   File: Logic.java   View source code 4 votes vote down vote up
private void saveReOpenOrAssign(BedStatus status)
{
	////WDEV-17935
	if (BedStatus.FOR_CLEANING.equals(status))
	{
		String[] errCleaningBed = getUIValidationForCloseBed();
		if (errCleaningBed != null)
		{
			engine.showErrors(errCleaningBed);
			return;
		}
	}
	
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method saveReOpenOrAssign");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(status);
		
		//WDEV-17935
		if (BedStatus.FOR_CLEANING.equals(status))
		{
			voBedSpaceState.getCurrentBedStatus().setReasonForClosure(form.lyrDetail().tabCloseBed().cmbCloseReason().getValue());
			voBedSpaceState.getCurrentBedStatus().setEstReopeningDateTime(form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
		}
	}

	String[] arrErrors = voBedSpaceState.validate();
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveReOpenOrAssignBed(voBedSpaceState);
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise();
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 20
Project: openMAXIMS   File: Logic.java   View source code 4 votes vote down vote up
private void populateCloseBedTabFromData()
{
	BedSpaceStateStatusVo voStatus = form.getLocalContext().getCloseBedStatus();
	clearCloseTab();

	if(form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatusIsNotNull())
	{
		BedSpaceStateStatusLiteVo voBedSpaceStateStatus = form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatus();
		if(voBedSpaceStateStatus.getSysInfoIsNotNull())
		{
			String user = "";
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getLastupdateUser();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getCreationUser();
			
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().newRow(user,user);
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().setValue(user);
			
			DateTime dtime = null;
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getCreationDateTime();
			
			form.lyrDetail().tabCloseBed().dtimLastChanged().setValue(dtime);
		}		
	}
	
	
	if (voStatus != null)
	{
		if (voStatus.getSysInfoIsNotNull() && voStatus.getSysInfo().getCreationUser() != null)
		{
			form.lyrDetail().tabCloseBed().cmbUser().newRow(voStatus.getSysInfo().getCreationUser(), voStatus.getSysInfo().getCreationUser());
			form.lyrDetail().tabCloseBed().cmbUser().setValue(voStatus.getSysInfo().getCreationUser());
		}
		form.lyrDetail().tabCloseBed().cmbCloseReason().setValue(voStatus.getReasonForClosure());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(voStatus.getStatusDateTime());
		form.lyrDetail().tabCloseBed().dtimEstReOpen().setValue(voStatus.getEstReopeningDateTime());
	}
	else
	{
		form.lyrDetail().tabCloseBed().cmbUser().newRow(engine.getLoggedInUser().getUsername(), engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().cmbUser().setValue(engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(new DateTime());
	}
}
 
Example 21
Project: openMAXIMS   File: Logic.java   View source code 4 votes vote down vote up
private void saveReOpenOrAssign(BedStatus status)
{
	////WDEV-17935
	if (BedStatus.FOR_CLEANING.equals(status))
	{
		String[] errCleaningBed = getUIValidationForCloseBed();
		if (errCleaningBed != null)
		{
			engine.showErrors(errCleaningBed);
			return;
		}
	}
	
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method saveReOpenOrAssign");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(form.lyrDetail().tabCloseBed().dtimClose().getValue()); // WDEV-22423 - take date from screen
		voBedSpaceState.getCurrentBedStatus().setBedStatus(status);
		
		//WDEV-17935
		if (BedStatus.FOR_CLEANING.equals(status))
		{
			voBedSpaceState.getCurrentBedStatus().setReasonForClosure(form.lyrDetail().tabCloseBed().cmbCloseReason().getValue());
			voBedSpaceState.getCurrentBedStatus().setEstReopeningDateTime(form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
		}
	}

	String[] arrErrors = voBedSpaceState.validate();
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveReOpenOrAssignBed(voBedSpaceState);
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise(false, false); //WDEV-17662
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 22
Project: openMAXIMS   File: Logic.java   View source code 4 votes vote down vote up
private Bed getBedColor(Boolean chair, BedSpaceStateShortVo bedSpaceState)
{
	if (bedSpaceState == null)
		return Boolean.TRUE.equals(chair) ? Bed.WHITE_CHAIR : Bed.WHITE_BED;
	
	BedSpaceStateStatusLiteVo bedStateStatus = bedSpaceState.getCurrentBedStatus();
	
	if (bedStateStatus == null || bedStateStatus.getBedStatus() == null)
		return Boolean.TRUE.equals(chair) ? Bed.WHITE_CHAIR : Bed.WHITE_BED;
	
	
	if (BedStatus.AVAILABLE.equals(bedStateStatus.getBedStatus()))
		return Boolean.TRUE.equals(chair) ? Bed.GREEN_CHAIR : Bed.GREEN_BED;
	
	if (BedStatus.CLOSED.equals(bedStateStatus.getBedStatus()))
		return Boolean.TRUE.equals(chair) ? Bed.DARKGRAY_CHAIR : Bed.DARKGRAY_BED;
	
	if (BedStatus.FOR_CLEANING.equals(bedStateStatus.getBedStatus()))
		return Boolean.TRUE.equals(chair) ? Bed.PINK_CHAIR : Bed.PINK_BED;
	
	
	if (BedStatus.OCCUPIED.equals(bedStateStatus.getBedStatus()))
	{
		if (isPatientDead(bedSpaceState.getInpatientEpisode()))
			return Boolean.TRUE.equals(chair) ? Bed.YELLOW_CHAIR : Bed.YELLOW_BED;
		
		if (isPatientOnTrackingMove(bedSpaceState.getInpatientEpisode()))
			return Boolean.TRUE.equals(chair) ? Bed.DARKBLUE_CHAIR : Bed.DARKBLUE_BED;
		
		if (isPatientOnHomeLeaveWithBedRetained(bedSpaceState.getInpatientEpisode()))
			return Boolean.TRUE.equals(chair) ? Bed.GREY_CHAIR : Bed.GREY_BED;
		
		if (bedSpaceState.getInpatientEpisode() != null)
		{
			if (isInpatientEpisodeonTransefrOutList(bedSpaceState.getInpatientEpisode()))
				return Boolean.TRUE.equals(chair) ? Bed.LIGHTBLUE_CHAIR : Bed.LIGHTBLUE_BED;	
			
			if (bedSpaceState.getInpatientEpisode().isDischargeDueWithin24Hrs())
			{
				if (Boolean.TRUE.equals(bedSpaceState.getInpatientEpisode().getIsConfirmedDischarge()))
					return Boolean.TRUE.equals(chair) ? Bed.RED_CHAIR : Bed.RED_BED;
				
				return Boolean.TRUE.equals(chair) ? Bed.ORANGE_CHAIR : Bed.ORANGE_BED;
			}
		}					
	}
	
	return Boolean.TRUE.equals(chair) ? Bed.WHITE_CHAIR : Bed.WHITE_BED;
}
 
Example 23
Project: openMAXIMS   File: BedInfoDialogImpl.java   View source code 4 votes vote down vote up
public void saveTransferOut(PendingTransfersLiteVo pendingTransfer) throws StaleObjectException, DomainInterfaceException  //WDEV-20023
{
	if(pendingTransfer == null)
		throw new CodingRuntimeException("pendingTransfer is null in method saveTransferOut");
	if(!pendingTransfer.isValidated())
		throw new CodingRuntimeException("pendingTransfer has not been validated in method saveTransferOut");
	
	DomainFactory domainFactory = getDomainFactory();
	//WDEV-9192
	if(pendingTransfer.getInpatientEpisodeIsNotNull())
	{
		String currentTransfer = "";
		if(pendingTransfer.getID_PendingTransfers() != null)
			currentTransfer = " and pt.id <> '" +  pendingTransfer.getID_PendingTransfers() + "'";
		
		List existingPTs = getDomainFactory().find("from PendingTransfers pt where pt.inpatientEpisode.id = '" + pendingTransfer.getInpatientEpisode().getID_InpatientEpisode() + "'" + currentTransfer);
		if(existingPTs != null && existingPTs.size() > 0)
			throw new DomainInterfaceException("Patient already has a transfer pending, the screen will be refreshed");
	}
	
	//WDEV-10421
	PendingTransfers doTransfer = PendingTransfersLiteVoAssembler.extractPendingTransfers(getDomainFactory(), pendingTransfer);
	//get the admission detail record and update its history for transfers
	AdmissionDetail doAdmissionDetail = populateTransferHistory(doTransfer, TRANSFEROUT, null, null);
	//WDEV-20291 - starts here
	BedSpaceStateLiteVo bedSpaceVo = null;
	if (Boolean.TRUE.equals(pendingTransfer.getNoLongerInBed())) 
	{
		InpatientEpisode doInpatEp = doTransfer.getInpatientEpisode();
		if (doInpatEp != null && doInpatEp.getBed() != null)
		{
			bedSpaceVo = BedSpaceStateLiteVoAssembler.create(doInpatEp.getBed());
	
			if (bedSpaceVo.getCurrentBedStatusIsNotNull())
			{
				bedSpaceVo.setPreviousBedStatus((BedSpaceStateStatusLiteVo) bedSpaceVo.getCurrentBedStatus().clone());
				BedSpaceStateStatusLiteVo bedStatusVo = new BedSpaceStateStatusLiteVo();
				bedStatusVo.setBedStatus(BedStatus.AVAILABLE);
				bedStatusVo.setStatusDateTime(pendingTransfer.getTransferRequestDateTime());
				
				bedSpaceVo.setCurrentBedStatus(bedStatusVo);				
				
			}
			bedSpaceVo.setInpatientEpisode(null);	
			updateOccupiedBedsForWardAndBay(LocationLiteVoAssembler.create(doInpatEp.getBed().getWard()), LocationLiteVoAssembler.create(doInpatEp.getBed().getBay()), null);
		}
		doInpatEp.setBedNo(null); //WDEV-20291
	}
	try
	{
		if (bedSpaceVo != null && Boolean.TRUE.equals(pendingTransfer.getNoLongerInBed()))
		{	
			BedSpaceState bedDO = BedSpaceStateLiteVoAssembler.extractBedSpaceState(domainFactory, bedSpaceVo);
			domainFactory.save(bedDO);			
		}
		domainFactory.save(doTransfer);
		
		// WDEV-19774 - Trigger creation of A15 Pending Transfer HL7 message
		InpatientEpisodeVo inpatEpisodeVo = InpatientEpisodeVoAssembler.create(doTransfer.getInpatientEpisode());
		
		if(inpatEpisodeVo.getPasEvent()!=null)
		{
	    	ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
			adtimpl.triggerPendingTransferEvent(inpatEpisodeVo.getPasEvent());
		} //WDEV-19974
					
		if(doAdmissionDetail != null)
			getDomainFactory().save(doAdmissionDetail);	
		
	}
	catch (IllegalArgumentException e)
	{
		//where object has been deleted - this happens when a transfer in has been deleted (transfer complete) and this user has the old pending transfer record and is trying to update it
		throw new DomainInterfaceException("Patient's transfer has already been processed, the screen will be refreshed");
	}
}
 
Example 24
Project: openMAXIMS   File: BedInfoDialogImpl.java   View source code 4 votes vote down vote up
public void cancelHomeLeaveReturn(InpatientEpisodeLiteVo voInpat,BedSpaceStateLiteVo voBedSpaceState, HomeLeaveVo voHlToReOpen) throws DomainInterfaceException,StaleObjectException
{
	if (voInpat == null)
		throw new CodingRuntimeException("The InpatientEpisodeLiteVo argument cannot be null in method cancelHomeLeaveReturn()");
	if (voHlToReOpen == null)
		throw new CodingRuntimeException("The HomeLeaveVo argument cannot be null in method cancelHomeLeaveReturn()");
	if (!voHlToReOpen.isValidated())
		throw new CodingRuntimeException("The HomeLeaveVo is not validated in method cancelHomeLeaveReturn()");
	DomainFactory factory = getDomainFactory();

	InpatientEpisode inpatEpisodeDO = (InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, voInpat.getID_InpatientEpisode());
	
	if (inpatEpisodeDO == null)
		throw new DomainInterfaceException("This patient is no longer an inpatient. The screen will be refreshed.");
	if (inpatEpisodeDO != null && inpatEpisodeDO.getVersion() > voInpat.getVersion_InpatientEpisode() &&  Boolean.TRUE.equals(inpatEpisodeDO.isIsOnHomeLeave()))
		throw new DomainInterfaceException("This inpatient has been sent on home leave or their home leave return was cancelled by another user. The screen will be refreshed.");
	
	if (inpatEpisodeDO.getHomeLeaves() != null && !inpatEpisodeDO.getHomeLeaves().isEmpty())
	{	
		HomeLeave homeLeaveDO = HomeLeaveVoAssembler.extractHomeLeave(factory, voHlToReOpen);
		
		if (homeLeaveDO != null)
		{
			if (inpatEpisodeDO.getHomeLeaves().contains(homeLeaveDO))
				inpatEpisodeDO.getHomeLeaves().set(inpatEpisodeDO.getHomeLeaves().indexOf(homeLeaveDO), homeLeaveDO);
			
			inpatEpisodeDO.setIsOnHomeLeave(true);
			inpatEpisodeDO.setDateOnHomeLeave(homeLeaveDO.getDateOnHomeLeave() != null ? homeLeaveDO.getDateOnHomeLeave() : null);
			inpatEpisodeDO.setTimeOnHomeLeave(homeLeaveDO.getTimeOnHomeLeave() != null ? homeLeaveDO.getTimeOnHomeLeave() : null);
			inpatEpisodeDO.setExpectedDateOfReturn(homeLeaveDO.getExpectedDateOfReturn() != null ? homeLeaveDO.getExpectedDateOfReturn() : null);
			inpatEpisodeDO.setExpectedTimeOfReturn(homeLeaveDO.getExpectedTimeOfReturn() != null ? homeLeaveDO.getExpectedTimeOfReturn()  : null);
			inpatEpisodeDO.setVacatedBedNumber(homeLeaveDO.getVacatedBedNumber() != null ? homeLeaveDO.getVacatedBedNumber() : null);

			if (voBedSpaceState != null && !Boolean.TRUE.equals(homeLeaveDO.isBedRetained()))
			{
				if (voBedSpaceState.getCurrentBedStatusIsNotNull())
				{
					voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
					voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
					voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
					voBedSpaceState.getCurrentBedStatus().setBedStatus(BedStatus.AVAILABLE);						
				}
							
				voBedSpaceState.setInpatientEpisode(null);
				
				inpatEpisodeDO.setBed(null);
			}
		}
		if (inpatEpisodeDO.getPasEvent() != null)
		{
			ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class);
			adtimpl.triggerCancelReturnFromLeaveOfAbsenceEvent(new PASEventRefVo(inpatEpisodeDO.getPasEvent().getId(), inpatEpisodeDO.getPasEvent().getVersion()));
		}
		factory.save(inpatEpisodeDO);

		if (voBedSpaceState != null)
		{
			BedSpaceState doBed = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBedSpaceState);
			factory.save(doBed);				
		}

		if (voBedSpaceState != null && !Boolean.TRUE.equals(voHlToReOpen.getBedRetained()))
			updateOccupiedBedsForWardAndBay(voBedSpaceState.getWard(), voBedSpaceState.getBay(), null);
		
		if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceState != null && !Boolean.TRUE.equals(voHlToReOpen.getBedRetained()))
		{
			Sex tempGender = voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() && voInpat.getPasEvent().getPatient().getSexIsNotNull() && !Sex.UNKNOWN.equals(voInpat.getPasEvent().getPatient().getSex())? voInpat.getPasEvent().getPatient().getSex() : null;
			checkAndUpdateBayConfig(factory, voBedSpaceState,tempGender);
		}
	}		
}
 
Example 25
Project: openMAXIMS   File: Logic.java   View source code 4 votes vote down vote up
private void populateCloseBedTabFromData()
{
	BedSpaceStateStatusVo voStatus = form.getLocalContext().getCloseBedStatus();
	clearCloseTab();

	if(form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatusIsNotNull())
	{
		BedSpaceStateStatusLiteVo voBedSpaceStateStatus = form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatus();
		if(voBedSpaceStateStatus.getSysInfoIsNotNull())
		{
			String user = "";
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getLastupdateUser();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getCreationUser();
			
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().newRow(user,user);
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().setValue(user);
			
			DateTime dtime = null;
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getCreationDateTime();
			
			form.lyrDetail().tabCloseBed().dtimLastChanged().setValue(dtime);
		}		
	}
	
	
	if (voStatus != null)
	{
		if (voStatus.getSysInfoIsNotNull() && voStatus.getSysInfo().getCreationUser() != null)
		{
			form.lyrDetail().tabCloseBed().cmbUser().newRow(voStatus.getSysInfo().getCreationUser(), voStatus.getSysInfo().getCreationUser());
			form.lyrDetail().tabCloseBed().cmbUser().setValue(voStatus.getSysInfo().getCreationUser());
		}
		form.lyrDetail().tabCloseBed().cmbCloseReason().setValue(voStatus.getReasonForClosure());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(voStatus.getStatusDateTime());
		form.lyrDetail().tabCloseBed().dtimEstReOpen().setValue(voStatus.getEstReopeningDateTime());
	}
	else
	{
		form.lyrDetail().tabCloseBed().cmbUser().newRow(engine.getLoggedInUser().getUsername(), engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().cmbUser().setValue(engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(new DateTime());
	}
}
 
Example 26
Project: openMAXIMS   File: Logic.java   View source code 4 votes vote down vote up
private void saveReOpenOrAssign(BedStatus status)
{
	////WDEV-17935
	if (BedStatus.FOR_CLEANING.equals(status))
	{
		String[] errCleaningBed = getUIValidationForCloseBed();
		if (errCleaningBed != null)
		{
			engine.showErrors(errCleaningBed);
			return;
		}
	}
	
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method saveReOpenOrAssign");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(status);
		
		//WDEV-17935
		if (BedStatus.FOR_CLEANING.equals(status))
		{
			voBedSpaceState.getCurrentBedStatus().setReasonForClosure(form.lyrDetail().tabCloseBed().cmbCloseReason().getValue());
			voBedSpaceState.getCurrentBedStatus().setEstReopeningDateTime(form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
		}
	}

	String[] arrErrors = voBedSpaceState.validate();
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveReOpenOrAssignBed(voBedSpaceState);
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise();
		return;
	}

	engine.close(DialogResult.OK);
}
 
Example 27
Project: openmaxims-linux   File: Logic.java   View source code 4 votes vote down vote up
private void populateCloseBedTabFromData()
{
	BedSpaceStateStatusVo voStatus = form.getLocalContext().getCloseBedStatus();
	clearCloseTab();

	if(form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatusIsNotNull())
	{
		BedSpaceStateStatusLiteVo voBedSpaceStateStatus = form.getGlobalContext().Core.getSelectedBedSpaceState().getCurrentBedStatus();
		if(voBedSpaceStateStatus.getSysInfoIsNotNull())
		{
			String user = "";
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getLastupdateUser();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationUser() != null)
				user = voBedSpaceStateStatus.getSysInfo().getCreationUser();
			
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().newRow(user,user);
			form.lyrDetail().tabCloseBed().cmbLastChangedUser().setValue(user);
			
			DateTime dtime = null;
			if(voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getLastupdateDateTime();
			else if(voBedSpaceStateStatus.getSysInfo().getCreationDateTime() != null)
				dtime = voBedSpaceStateStatus.getSysInfo().getCreationDateTime();
			
			form.lyrDetail().tabCloseBed().dtimLastChanged().setValue(dtime);
		}		
	}
	
	
	if (voStatus != null)
	{
		if (voStatus.getSysInfoIsNotNull() && voStatus.getSysInfo().getCreationUser() != null)
		{
			form.lyrDetail().tabCloseBed().cmbUser().newRow(voStatus.getSysInfo().getCreationUser(), voStatus.getSysInfo().getCreationUser());
			form.lyrDetail().tabCloseBed().cmbUser().setValue(voStatus.getSysInfo().getCreationUser());
		}
		form.lyrDetail().tabCloseBed().cmbCloseReason().setValue(voStatus.getReasonForClosure());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(voStatus.getStatusDateTime());
		form.lyrDetail().tabCloseBed().dtimEstReOpen().setValue(voStatus.getEstReopeningDateTime());
	}
	else
	{
		form.lyrDetail().tabCloseBed().cmbUser().newRow(engine.getLoggedInUser().getUsername(), engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().cmbUser().setValue(engine.getLoggedInUser().getUsername());
		form.lyrDetail().tabCloseBed().dtimClose().setValue(new DateTime());
	}
}
 
Example 28
Project: openmaxims-linux   File: Logic.java   View source code 4 votes vote down vote up
private void saveReOpenOrAssign(BedStatus status)
{
	////WDEV-17935
	if (BedStatus.FOR_CLEANING.equals(status))
	{
		String[] errCleaningBed = getUIValidationForCloseBed();
		if (errCleaningBed != null)
		{
			engine.showErrors(errCleaningBed);
			return;
		}
	}
	
	BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState();

	if (voBedSpaceState == null)
		throw new CodingRuntimeException("voBedSpaceState is null in method saveReOpenOrAssign");

	// move to previous
	if (voBedSpaceState.getCurrentBedStatusIsNotNull())
	{
		voBedSpaceState.setPreviousBedStatus((BedSpaceStateStatusLiteVo) voBedSpaceState.getCurrentBedStatus().clone());
		voBedSpaceState.setCurrentBedStatus(new BedSpaceStateStatusLiteVo());
		voBedSpaceState.getCurrentBedStatus().setStatusDateTime(new DateTime());
		voBedSpaceState.getCurrentBedStatus().setBedStatus(status);
		
		//WDEV-17935
		if (BedStatus.FOR_CLEANING.equals(status))
		{
			voBedSpaceState.getCurrentBedStatus().setReasonForClosure(form.lyrDetail().tabCloseBed().cmbCloseReason().getValue());
			voBedSpaceState.getCurrentBedStatus().setEstReopeningDateTime(form.lyrDetail().tabCloseBed().dtimEstReOpen().getValue());
		}
	}

	String[] arrErrors = voBedSpaceState.validate();
	if (arrErrors != null)
	{
		engine.showErrors(arrErrors);
		return;
	}

	try
	{
		domain.saveReOpenOrAssignBed(voBedSpaceState);
	}
	catch (StaleObjectException e)
	{
		engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		initialise();
		return;
	}

	engine.close(DialogResult.OK);
}