Java Code Examples for ims.framework.utils.Time.copy()

The following are Jave code examples for showing how to use copy() of the ims.framework.utils.Time class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
/**
 * get first appt time and stack appts on top of each other by procedure duration
 */
private void reStackAppointments()
{
	Sch_Session_Appointment_OrderVo voSessApptOrder = form.getLocalContext().getSessApptOrder();
	if(voSessApptOrder != null && voSessApptOrder.getAppointmentsIsNotNull() &&  voSessApptOrder.getAppointments().size() > 0)
	{
		if(voSessApptOrder.getAppointments().get(0).getApptStartTime() != null)
		{
			Time nextApptStartTime = getFirstAvailableSlotTime(voSessApptOrder.getSession());
			for(int i=0;i<voSessApptOrder.getAppointments().size();i++)
			{
				
				int duration = 0;
				if(voSessApptOrder.getAppointments().get(i).getCustomProcedureDurationIsNotNull())
					duration = voSessApptOrder.getAppointments().get(i).getCustomProcedureDuration();
				
				int tciDuration = 0;
				if(voSessApptOrder.getAppointments().get(i).getApptStartTimeIsNotNull() && voSessApptOrder.getAppointments().get(i).getAppointmentTCITimeIsNotNull())
					tciDuration = SlotGenerationUtils.calculateDuration(voSessApptOrder.getAppointments().get(i).getApptStartTime().toString(), voSessApptOrder.getAppointments().get(i).getAppointmentTCITime().toString());
				
				
				if(nextApptStartTime != null)
				{
					voSessApptOrder.getAppointments().get(i).setApptStartTime(nextApptStartTime.copy());
				
					Time apptEndTime = nextApptStartTime.copy();
					apptEndTime.addMinutes(duration);
					voSessApptOrder.getAppointments().get(i).setApptEndTime(apptEndTime);
					
					Time newApptTciTime = voSessApptOrder.getAppointments().get(i).getApptStartTime().copy();
					newApptTciTime.addMinutes(tciDuration);
					voSessApptOrder.getAppointments().get(i).setAppointmentTCITime(newApptTciTime);	
				}	
				
				nextApptStartTime = Booking_AppointmentVo.calculateEndTime(voSessApptOrder.getAppointments().get(i).getApptStartTime(), duration);
				
			}
		}
	}
	
	form.grdAppts().getRows().clear();
	populateScreenFromData(form.getLocalContext().getSessApptOrder());
}
 
Example 2
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
/**
 * @param rowupped
 * @param rowdowned
 */
private void swapTCITimes(grdApptsRow rowupped, grdApptsRow rowdowned)
{
	Time newUppedApptTime = null;
	if(rowdowned.getColApptTime() != null)
		newUppedApptTime = rowdowned.getColApptTime().copy();	
	
	Time newDownedApptTime = null;
	if(newUppedApptTime != null)
		newDownedApptTime = newUppedApptTime.copy();
	
	if(rowupped.getValue().getCustomProcedureDuration() != null && newDownedApptTime != null)
		newDownedApptTime.addMinutes(rowupped.getValue().getCustomProcedureDuration());
		
	//calculate the new TCI times
	Time uppedTCiTime = null; 
	if(rowdowned.getColApptTime() != null)	
	{
		uppedTCiTime = rowdowned.getColApptTime().copy();
		if (rowupped.getColApptTime() != null && rowupped.getColComeInTime() != null)
			uppedTCiTime.addMinutes(calculateTCIMins(rowupped));
		else
			uppedTCiTime.addMinutes(calculateInitialTCIMins(rowupped.getValue()));
	}
	
	Time downedTCITime = null; 
	if(newDownedApptTime != null)	
	{
		downedTCITime = newDownedApptTime.copy();
		if (rowdowned.getColApptTime() != null && rowdowned.getColComeInTime() != null)
			downedTCITime.addMinutes(calculateTCIMins(rowdowned));
		else
			downedTCITime.addMinutes(calculateInitialTCIMins(rowdowned.getValue()));
	}
	
	rowdowned.setColComeInTime(downedTCITime);	
	rowdowned.setColApptTime(newDownedApptTime);		

	rowupped.setColApptTime(newUppedApptTime);
	rowupped.setColComeInTime(uppedTCiTime);	
}