Java Code Examples for ims.framework.utils.Date.isLessThan()

The following are Jave code examples for showing how to use isLessThan() of the ims.framework.utils.Date class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean validateSearchCriteria() 
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("From Date can not be greater than End Date");
	}
	
	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	return true;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isSearchCriteriaValid()
{
	ArrayList<String> uiErrors = new ArrayList<String>();

	Date dateFrom = form.dteFromDate().getValue();
	Date dateTo = form.dteToDate().getValue();

	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("'Date From' can not be greater than 'Date To'");
	}

	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}

	return true;
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean validateSearchCriteria() 
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	Date dateStart = form.dteStart().getValue();
	Date dateEnd = form.dteEnd().getValue();
	
	if (dateStart != null && dateEnd != null && dateEnd.isLessThan(dateStart))
	{
		uiErrors.add("Start Date can not be greater than End Date");
	}
	
	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	return true;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isSearchCriteriaValid() 
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	
	Date dateFrom = form.dteFromDate().getValue();
	Date dateTo = form.dteToDate().getValue();
	
	if (form.txtForename().getValue()==null && form.txtSurname().getValue()==null && form.txtHospitalNo().getValue()==null && form.ccRequestor().getValue()==null && form.ccAllocate().getValue()==null && form.cmbCurrentStatus().getValue()==null && form.dteFromDate().getValue()==null && form.dteToDate().getValue()==null)
	{
		uiErrors.add("At least one search criteria must be provided!");
	}
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("'Date From' can not be greater than 'Date To'");
	}
	
	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	
	return true;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean validateSearchCriteria(boolean showErrors)
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("Date from can not be greater than date to");
	}
	
	if (uiErrors.size() > 0)
	{
		if (showErrors)
			engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	
	return true;
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isSearchCriteriaValid()
{
	if (form.txtType().getValue() != null && form.cmbType().getValue() == null)
	{
		engine.showMessage("Please select a Patient ID Type");
		return false;
	}

	ArrayList<String> uiErrors = new ArrayList<String>();

	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();

	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("'Date From' can not be greater than 'Date To'");
	}

	if (uiErrors.size() > 0)
	{
		engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}

	return true;
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void dateChanged()
{
	Date date = form.dteDate().getValue();
	form.cmbRound().clear();

	if (date == null)
		return;

	if (date.isLessThan(new Date()))
	{
		engine.showMessage("Date cannot be in the past");
		form.dteDate().setValue(null);
		return;
	}

	SpecimenCollectionListConfigDetailsVoCollection voCollCfg = domain.listSpecimenCollectionDetails(SpecimenCollectionMethod.INPATIENT, date);
	if (voCollCfg != null)
	{
		for (int i = 0; i < voCollCfg.size(); i++)
			form.cmbRound().newRow(voCollCfg.get(i).getTime(), voCollCfg.get(i).getTime().getText());
	}
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isSearchCriteriaValid()
{
	Date dateFrom = form.dteDateFrom().getValue();
	Date dateTo = form.dteDateTo().getValue();

	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		engine.showMessage("Date From cannot be greater than Date To", "Validation error", MessageButtons.OK, MessageIcon.ERROR);
		return false;
	}

	if( isAtLeastOneSearchFieldCompleted() == false)
	{
		engine.showMessage("Complete at least one search field.", "Validation error", MessageButtons.OK, MessageIcon.ERROR);
		return false;
	}

	return true;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
/**
 *	Function used to validate search criteria
 */
private String[] validateSearchCriteria()
{
	ArrayList<String> errorList = new ArrayList<String>();
	
	Date dateFrom	= form.dteFrom().getValue();
	Date dateTo		= form.dteTo().getValue();
	Date today		= new Date();
	
	if (dateTo != null && today.isLessThan(dateTo))
	{
		errorList.add("'Date to' can not be set in the future.");
	}

	if (dateFrom != null && today.isLessThan(dateFrom))
	{
		errorList.add("'Date from' can not be set in the future.");
	}
	
	if (dateTo != null && dateFrom != null && dateTo.isLessThan(dateFrom))
	{
		errorList.add("'Date from' can not be greater than 'Date to'.");
	}
	
	return errorList.toArray(new String[errorList.size()]);
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isSearchCriteriaValid()
{
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();

	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		engine.showMessage("Admission Date From cannot be greater than Admission Date To", "Validation error", MessageButtons.OK, MessageIcon.ERROR);
		return false;
	}

	if (isAtLeastOneSearchFieldCompleted())
		return true;

	engine.showMessage("Complete at least one search field.", "Validation error", MessageButtons.OK, MessageIcon.ERROR);

	return false;
}
 
Example 11
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean isOutsideRange(Date startDate)
{
	if (startDate == null)
		throw new CodingRuntimeException("CareContext StartDateTime is null in method isCareContextOutsideRange");

	Date filterdate = calculateDate();
	if (filterdate != null)
		return startDate.isLessThan(filterdate);

	return false;
}
 
Example 12
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
/**
 * Validates that at least one search criteria controls contains 
 * non-null value and if not shows an error
 * @param showErrors TODO
 * @return boolean true if valid false otherwise
 */
private boolean validateSearchCriteria(boolean showErrors)
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	if (form.ccMos().getValue() == null && form.cmbEpisodes().getValue() == null 
		&& form.cmbSpecialty().getValue() == null && dateFrom == null 
		&& dateTo == null && form.cmbDocType().getValue() == null 
		&& form.cmbDocStatus().getValue() == null)
	{
		uiErrors.add("Please fill in at least one search field");
	}
	
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("Date from can not be greater than date to");
	}
	
	if (uiErrors.size() > 0)
	{
		if (showErrors)
			engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	
	return true;
}
 
Example 13
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean validDates(Profile_Exc_DateVo voExclDate, Sch_ProfileGenericVo profile)
{
	// Any exclusion dates must be between profile start and end dates
	Date startDate = voExclDate.getStartDate();
	Date endDate = voExclDate.getEndDate();
	Date profStartDate = profile.getEffFrm();
	Date profEndDate = profile.getEffTo();
	if (startDate.isLessThan(profStartDate) || (startDate.isGreaterThan(profEndDate) && profEndDate != null) || endDate.isLessThan(profStartDate) || (endDate.isGreaterThan(profEndDate) && profEndDate != null))
		return false;
	return true;
}
 
Example 14
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean validateSearchCriteria()
{
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	if(dateTo != null && dateFrom != null && dateTo.isLessThan(dateFrom))
	{
		engine.showErrors(new String[]{"Date From cannot be before Date To"});
		return false;
	}
	
	if(form.cmbHospital().getValue() != null)
	{
		if(form.qmbPatLocation().getValue() == null)
		{
			engine.showErrors(new String[]{"Patient Location is a mandatory field."});
			return false;
		}
	}
	
	//ensuring some search criteria is specified
	if(form.dteFrom().getValue() == null && form.dteTo().getValue() == null && form.qmbRespClinician().getValue() == null && form.qmbPatLocation().getValue() == null)
	{
		engine.showErrors(new String[]{"Please enter some search criteria"});
		return false;
	}
	
	return true;
}
 
Example 15
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean validateSearchCriteria(boolean showErrors) {
	Date dateFrom = form.dteFrom().getValue();
	Date dateTo = form.dteTo().getValue();
	
	ArrayList<String> uiErrors = new ArrayList<String>();
	Date today = new Date();
	
	if (dateFrom != null)
	{
		if (dateFrom.isGreaterThan(today))
		{
			uiErrors.add("Date from can not be in the future");
		}
		if (dateTo != null && dateTo.isLessThan(dateFrom))
		{
			uiErrors.add("Date from can not be greater than date to");
		}
		if (dateFrom.isLessThan(form.getGlobalContext().Core.getPatientShort().getDob()))
		{
			uiErrors.add("Date from can not be less than patient's date of birth");
		}
	}
	
		if (today.isLessThan(dateTo))
		{
			uiErrors.add("Date to can not be in the future");
		}
		
	
	if (uiErrors.size() > 0)
	{
	
		if (showErrors)
			engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		return false;
	}
	return true;
}
 
Example 16
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean isSearchCriteriaValid(boolean isFromButton)
{
	ArrayList<String> uiErrors = new ArrayList<String>();
	
	Date dateFrom = form.dteDischargeFrom().getValue();
	Date dateTo = form.dteDischargeTo().getValue();
	
	if(form.cmbSpecialty().getValue() == null && form.qmbDischargeWard().getValue() == null && form.ccConsultant().getValue() == null && dateFrom == null && dateTo == null)
	{
		uiErrors.add("Complete at least one search field.");
	}
	
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		uiErrors.add("Discharges From can not be greater than Discharges To.");
	}
	
	if (uiErrors.size() > 0)
	{
		if(isFromButton)
		{
			engine.showErrors(uiErrors.toArray(new String[uiErrors.size()]));
		}
		
		return false;
	}
	
	return true;
}
 
Example 17
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
@Override
protected void onDteNextMeetingValueChanged() throws PresentationLogicException {
	if(form.getMode().equals(FormMode.EDIT)){
		PartialDate dob = form.getGlobalContext().Core.getPatientShort().getDob();	
		
		Date dteNextMeeting = form.ctnDetails().dteNextMeeting().getValue();
		if(dob==null ||  dteNextMeeting==null)
			return;
		if(dteNextMeeting.isLessThan(dob)){
			engine.showMessage("Date of Next Meeting cannot be before Date of Birth.");
			form.ctnDetails().dteNextMeeting().setValue(null);
		}
	}
}
 
Example 18
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private String[] validateSearchCriteria()
{
	ArrayList<String> listOfErrors = new ArrayList<String>();
	SurgicalOPNotesFilterVo sonf = populateSearchDataFromScreen();
	if (sonf.countFieldsWithValue() == 0)
	{
		listOfErrors.add("Please fill in at least one search field");
	}
	else
	{
		Date today = new Date();
		if (today.isLessThan(sonf.getDateFrom()))
		{
			listOfErrors.add("Date From can not be in the future");
		}
		if (today.isLessThan(sonf.getDateTo()))
		{
			listOfErrors.add("Date To can not be in the future");
		}
		if (sonf.getDateToIsNotNull() && sonf.getDateFromIsNotNull() && sonf.getDateFrom().isGreaterThan(sonf.getDateTo()))
		{
			
			listOfErrors.add("Date From can not be greater than Date To");
		}
	}
	if (listOfErrors.size() == 0 )
		return null;
	String[] errors = new String[listOfErrors.size()];
	errors = listOfErrors.toArray(errors);
	return errors;
}
 
Example 19
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 4 votes
private String[] validateUIRules()
{
	List<String> uiErrors = new ArrayList<String>();

	
	if( form.dtimDischargeDateTime().getValue() == null )
	{
		uiErrors.add("Discharge Date/Time is mandatory !");//WDEV-16843
	}
	else
	{
		if( form.dtimDischargeDateTime().getValue().isGreaterThan(new DateTime()))
		{
			uiErrors.add("Discharge Date/Time cannot be set it in the future");
		}
		else if(form.getLocalContext().getAdmissionDetailIsNotNull() && form.getLocalContext().getAdmissionDetail().getTransferHistoryIsNotNull()  && form.getLocalContext().getAdmissionDetail().getTransferHistory().size() > 0 ) //wdev-16770
		{
			
			DateTime dtimD = getTheLastWardTransferDateTime(form.getLocalContext().getAdmissionDetail());
			if( dtimD != null)
			{
			
   				Date dtD = dtimD.getDate();
   				Time tD = dtimD.getTime();
   				
   				Date dtD1 = form.dtimDischargeDateTime().getValue().getDate();
   				Time tD1 = form.dtimDischargeDateTime().getValue().getTime();
   				if( dtD1.isLessThan(dtD))
   					uiErrors.add("Discharge Date/Time must be later than or equal to the last Ward transfer Date/Time");
   				else if(dtD1.equals(dtD))
   				{
   					if( tD1.isLessThan(tD))
   						uiErrors.add("Discharge Date/Time must be later than or equal to the last Ward transfer Date/Time");
   				}
			}
		}
		else if(form.getLocalContext().getAdmissionDetailIsNotNull() && form.dtimDischargeDateTime().getValue().isLessThan(form.getLocalContext().getAdmissionDetail().getAdmissionDateTime()))
		{
			uiErrors.add("Discharge Date/Time must be later than or equal to the Admission Date/Time");
		}
	}
	
	
	if( form.cmbDischargeReason().getValue() == null)
	{
		uiErrors.add("Discharge Reason is mandatory.");
	}
	
	String[] result = new String[uiErrors.size()];
	uiErrors.toArray(result);
	return result;
}
 
Example 20
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 4 votes
private boolean isSearchCriteriaValid(boolean showErrors)
{
	Date dateFrom = form.dteFrom().getValue();//WDEV-13593
	Date dateTo = form.dteTo().getValue();//WDEV-13593
	
	//WDEV-13593
	if (dateFrom != null && dateTo != null && dateTo.isLessThan(dateFrom))
	{
		if (showErrors)
		{
			showValidationError("Event Date from can not be greater than Event Date to");
		}
		
		return false;
	}
	
	if (form.cmbLocation().getValue() != null && form.qmbClinic().getValue() == null)
	{
		if (showErrors)
		{
			showValidationError("Clinic is mandatory if you select a Location");
		}
		return false;
	}
	if (form.chkExcludeCompleted().getValue() && DocumentStatus.COMPLETED.equals(form.cmbDocStatus().getValue()))
	{
		if (showErrors)
		{
			showValidationError("'Exclude completed documents' and 'Completed' are mutually exclusive search options");
		}
		return false;
	}

	if (isAtLeastOneSearchFieldCompleted())
		return true;

	if (showErrors)
	{
		showValidationError("Complete at least one search field.");
	}
	return false;
}