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

The following are Jave code examples for showing how to use isGreaterThan() 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 5 votes
private String[] getUISearchCriteriaErrors()
{
	ArrayList errors = new ArrayList();

	Date startDate = form.dteStart().getValue();
	if (startDate == null)
	{
		errors.add("From Date is mandatory");
	}

	Date endDate = form.dteEnd().getValue();
	if (endDate == null)
	{
		errors.add("To Date is mandatory");
	}

	if (startDate != null && startDate != null)
	{
		if (startDate.isGreaterThan(endDate))
		{
			errors.add("From Date cannot be greater than To Date");
		}
	}

	if (errors != null && errors.size() > 0)
	{
		String[] uiErrors = new String[errors.size()];
		errors.toArray(uiErrors);
		return uiErrors;
	}

	return null;
}
 
Example 2
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 3
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean validateDates(Date startDate, Date endDate) 
{
	if(startDate != null && endDate != null)
	{
		if(startDate.isGreaterThan(endDate))
		{	
			engine.showMessage("Start Date cannot be greater than End Date!"); //WDEV-14803
			return false;
		}
		return true;
	}
	
	return true;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean checkRequiredAndErrors()
{
	ArrayList<String> errors = new ArrayList<String>();

	if (form.cmbHospital().getValue() == null)
		errors.add("'Hospital' is mandatory");

	if (form.qmbWard().getValue() == null && form.qmbWard().isEnabled())
		errors.add("'Ward' is mandatory");

	Date fromDate = form.dteFrom().getValue();
	if (fromDate == null)
		errors.add("'From Date' is mandatory");

	Date toDate = form.dteTo().getValue();
	if (toDate == null)
		errors.add("'To Date' is mandatory");
		

	if (fromDate != null && toDate != null && fromDate.isGreaterThan(toDate))
		errors.add("Invalid Date Range Search: 'From Date' should be less than or equal to 'To Date'"); //WDEV-16691
	
	if (errors.size() > 0)
	{
		String[] searchErrors = new String[errors.size()];
		errors.toArray(searchErrors);
		engine.showErrors(searchErrors);
		return false;
	}

	return true;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean validateDates(Date startDate, Date endDate,String message) 
{
	if(startDate != null && endDate != null)
	{
		if(startDate.isGreaterThan(endDate))
		{	
			//engine.showMessage("From Date cannot be greater than To Date");
			engine.showMessage(message);
			return false;
		}
	}
	
	return true;
}
 
Example 6
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 7
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 4 votes
public String[] validateUIRules()
{
	ArrayList<String> errorsList = new ArrayList<String>();
	Date onSetDate = form.ctnDetails().dteOnset().getValue();
	if (onSetDate!=null && onSetDate.isGreaterThan(new Date()))
	{
		errorsList.add("The Onset Date cannot be in the future");
	}
	PartialDate diagnosisDate = form.ctnDetails().pdtDateDiagnosed().getValue();
	if (diagnosisDate != null && diagnosisDate.isGreaterThan(new Date()))
		{
			form.ctnDetails().pdtDateDiagnosed().setFocus();
			errorsList.add("The Date Diagnosed cannot be in the future"); // WDEV-17713 
		}
	

	if (form.ctnDetails().chkResolved().getValue())
	{
		//String resolvedByError = form.ctnDetails().customControlResolved().getError("Resolved By");
		String resolvedByError = form.ctnDetails().customControlMos().getError("Resolved By");
		if (resolvedByError != null)
		{
			errorsList.add(resolvedByError);
		}

		if (form.ctnDetails().dteResolved().getValue() == null)
		{
			errorsList.add("Please select Resolved Date");
		}
	}
	//start WDEV-13958
	if (form.ctnDetails().customControlCodingItem().getSelectedItem() == null)
	{
		errorsList.add("Please select a Clinical Term");
	}
	//end
	
	//if(form.ctnDetails().customControlAuthoring().getValue().getAuthoringDateTime() == null || form.ctnDetails().customControlAuthoring().getValue().getAuthoringHcp() == null)
	//	errorsList.add("Authoring HCP and Authoring Date Time are mandatory.");
	if (errorsList.size()==0)
		return null;
	String [] errors = new String[errorsList.size()];
	errorsList.toArray(errors);
	return errors;
		
}