Java Code Examples for ims.assessment.helper.UserAssessmentInstHelper.validateData()

The following are Jave code examples for showing how to use validateData() of the ims.assessment.helper.UserAssessmentInstHelper 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 4 votes
private boolean save() throws PresentationLogicException
{	
	if(uiErrors())
		return false;
	
	UserAssessmentInstHelper helper = getHelper();
	
	if(form.cmbStatus().getValue().equals(PatientAssessmentStatusReason.COMPLETED))
	{
		String[] herrors = helper.validateData();
		if(herrors != null && herrors.length > 0)
		{
			engine.showErrors("Validation error(s)", herrors);
			return false;
		}
	}
	
	setAnswers();			
	
	PatientAssessmentVo currentAssessment = form.getLocalContext().getCurrentAssessment();
	String[] errors = currentAssessment.validate();
	if(errors != null && errors.length > 0)
	{
		engine.showErrors("Validation error(s)", errors);
		return false;
	}
	
	try
	{
		currentAssessment = domain.save(currentAssessment);			
	}
	catch (StaleObjectException e) 
	{			
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		form.setMode(FormMode.VIEW);
		open();
		return false;
	}		
	
	form.getLocalContext().setCurrentAssessment(currentAssessment);
	return true;
}
 
Example 2
Project: openMAXIMS   File: Logic.java   Source Code and License Vote up 4 votes
private boolean save() throws PresentationLogicException
{	
	if(uiErrors())
		return false;
	
	UserAssessmentInstHelper helper = getHelper();
	
	if(form.cmbStatus().getValue().equals(PatientAssessmentStatusReason.COMPLETED))
	{
		String[] herrors = helper.validateData();
		if(herrors != null && herrors.length > 0)
		{
			engine.showErrors("Validation error(s)", herrors);
			return false;
		}
	}
	
	setAnswers();			
	
	PatientAssessmentVo currentAssessment = form.getLocalContext().getCurrentAssessment();
	String[] errors = currentAssessment.validate();
	if(errors != null && errors.length > 0)
	{
		engine.showErrors("Validation error(s)", errors);
		return false;
	}
	
	try
	{
		currentAssessment = domain.save(currentAssessment);			
	}
	catch (StaleObjectException e) 
	{			
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		form.setMode(FormMode.VIEW);
		open();
		return false;
	}		
	
	form.getLocalContext().setCurrentAssessment(currentAssessment);
	return true;
}
 
Example 3
Project: openMAXIMS   File: Logic.java   Source Code and License Vote up 4 votes
private boolean save() throws PresentationLogicException
{	
	if(uiErrors())
		return false;
	
	UserAssessmentInstHelper helper = getHelper();
	
	if(form.cmbStatus().getValue().equals(PatientAssessmentStatusReason.COMPLETED))
	{
		String[] herrors = helper.validateData();
		if(herrors != null && herrors.length > 0)
		{
			engine.showErrors("Validation error(s)", herrors);
			return false;
		}
	}
	
	setAnswers();			
	
	PatientAssessmentVo currentAssessment = form.getLocalContext().getCurrentAssessment();
	String[] errors = currentAssessment.validate();
	if(errors != null && errors.length > 0)
	{
		engine.showErrors("Validation error(s)", errors);
		return false;
	}
	
	try
	{
		currentAssessment = domain.save(currentAssessment);			
	}
	catch (StaleObjectException e) 
	{			
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		form.setMode(FormMode.VIEW);
		open();
		return false;
	}		
	
	form.getLocalContext().setCurrentAssessment(currentAssessment);
	return true;
}
 
Example 4
Project: openmaxims-linux   File: Logic.java   Source Code and License Vote up 4 votes
private boolean save() throws PresentationLogicException
{	
	if(uiErrors())
		return false;
	
	UserAssessmentInstHelper helper = getHelper();
	
	if(form.cmbStatus().getValue().equals(PatientAssessmentStatusReason.COMPLETED))
	{
		String[] herrors = helper.validateData();
		if(herrors != null && herrors.length > 0)
		{
			engine.showErrors("Validation error(s)", herrors);
			return false;
		}
	}
	
	setAnswers();			
	
	PatientAssessmentVo currentAssessment = form.getLocalContext().getCurrentAssessment();
	String[] errors = currentAssessment.validate();
	if(errors != null && errors.length > 0)
	{
		engine.showErrors("Validation error(s)", errors);
		return false;
	}
	
	try
	{
		currentAssessment = domain.save(currentAssessment);			
	}
	catch (StaleObjectException e) 
	{			
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
		form.setMode(FormMode.VIEW);
		open();
		return false;
	}		
	
	form.getLocalContext().setCurrentAssessment(currentAssessment);
	return true;
}