Java Code Examples for ims.core.vo.QuestionAnswerTypeVo.getAnswerType()

The following are Jave code examples for showing how to use getAnswerType() of the ims.core.vo.QuestionAnswerTypeVo 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 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if (answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if (answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 2
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if(answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if(answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 3
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if(answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if(answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 4
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
private boolean addAnswers(DynamicGridRow row, DynamicGridColumn[] columns, GeneralQuestionAnswerVo question)
{
	if(row == null || question == null || question.getIQuestionTypeQuestion() == null ||  question.getIQuestionTypeQuestion().getAnswerTypes() == null  || question.getIQuestionTypeQuestion().getAnswerTypes().size() == 0)
		return false;
		
	for(int x = 0; x < question.getIQuestionTypeQuestion().getAnswerTypes().size(); x++)
	{
		QuestionAnswerTypeVo answer = question.getIQuestionTypeQuestion().getAnswerTypes().get(x);
		if(answer != null)
		{
			QuestionAnswerType type = answer.getAnswerType();
			DynamicCellType cellType = getQuestionAnswerType(type);
			DynamicGridCell answerCell = row.getCells().newCell(columns[x], getQuestionAnswerType(type));
			answerCell.setWidth(getAnswerCellWidth(cellType));
			answerCell.setReadOnly(false);
			
			setAnswerCellValue(answerCell, answer);
			
			if(cellType == DynamicCellType.DYNAMICLABEL || cellType == DynamicCellType.BOOL)
				answerCell.setDecoratorType(DynamicCellDecoratorMode.NEVER);
			else
				answerCell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS);
			
			answerCell.setTooltip(getAnswerCellTooltip(cellType));
			answerCell.setIdentifier(answer);
			
			addAnswerData(row, question);
		}
	}
	
	return true;		
}
 
Example 5
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if (answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if (answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 6
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if(answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if(answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 7
Project: openMAXIMS   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
private boolean addAnswers(DynamicGridRow row, DynamicGridColumn[] columns, GeneralQuestionAnswerVo question)
{
	if(row == null || question == null || question.getIQuestionTypeQuestion() == null ||  question.getIQuestionTypeQuestion().getAnswerTypes() == null  || question.getIQuestionTypeQuestion().getAnswerTypes().size() == 0)
		return false;
		
	for(int x = 0; x < question.getIQuestionTypeQuestion().getAnswerTypes().size(); x++)
	{
		QuestionAnswerTypeVo answer = question.getIQuestionTypeQuestion().getAnswerTypes().get(x);
		if(answer != null)
		{
			QuestionAnswerType type = answer.getAnswerType();
			DynamicCellType cellType = getQuestionAnswerType(type);
			DynamicGridCell answerCell = row.getCells().newCell(columns[x], getQuestionAnswerType(type));
			answerCell.setWidth(getAnswerCellWidth(cellType));
			answerCell.setReadOnly(false);
			
			setAnswerCellValue(answerCell, answer);
			
			if(cellType == DynamicCellType.DYNAMICLABEL || cellType == DynamicCellType.BOOL)
				answerCell.setDecoratorType(DynamicCellDecoratorMode.NEVER);
			else
				answerCell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS);
			
			answerCell.setTooltip(getAnswerCellTooltip(cellType));
			answerCell.setIdentifier(answer);
			
			addAnswerData(row, question);
		}
	}
	
	return true;		
}
 
Example 8
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if (answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if (answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 9
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   View Source Code Vote up 5 votes
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if(answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if(answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 10
Project: openmaxims-linux   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
private boolean addAnswers(DynamicGridRow row, DynamicGridColumn[] columns, GeneralQuestionAnswerVo question)
{
	if(row == null || question == null || question.getIQuestionTypeQuestion() == null ||  question.getIQuestionTypeQuestion().getAnswerTypes() == null  || question.getIQuestionTypeQuestion().getAnswerTypes().size() == 0)
		return false;
		
	for(int x = 0; x < question.getIQuestionTypeQuestion().getAnswerTypes().size(); x++)
	{
		QuestionAnswerTypeVo answer = question.getIQuestionTypeQuestion().getAnswerTypes().get(x);
		if(answer != null)
		{
			QuestionAnswerType type = answer.getAnswerType();
			DynamicCellType cellType = getQuestionAnswerType(type);
			DynamicGridCell answerCell = row.getCells().newCell(columns[x], getQuestionAnswerType(type));
			answerCell.setWidth(getAnswerCellWidth(cellType));
			answerCell.setReadOnly(false);
			
			setAnswerCellValue(answerCell, answer);
			
			if(cellType == DynamicCellType.DYNAMICLABEL || cellType == DynamicCellType.BOOL)
				answerCell.setDecoratorType(DynamicCellDecoratorMode.NEVER);
			else
				answerCell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS);
			
			answerCell.setTooltip(getAnswerCellTooltip(cellType));
			answerCell.setIdentifier(answer);
			
			addAnswerData(row, question);
		}
	}
	
	return true;		
}
 
Example 11
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
public String getDPPQuestionAndAnswers(PatientAssessmentQuestionVo question, int index)
{
	if (question == null)
		return null;

	StringBuffer sb = new StringBuffer();
	if (index != -1)
	{
		sb.append(index);
		sb.append(". ");
	}
	if (question.getAssessmentQuestion().getQuestionIsNotNull())
	{
		sb.append(question.getAssessmentQuestion().getQuestion().getShortText());
	}

	for (int i = 0; i < question.getPatientAnswers().size(); i++)
	{
		PatientAssessmentAnswerVo vo = question.getPatientAnswers().get(i);

		AnswerDetailsVoCollection answerColl = vo.getAnswerDetails();
		if (answerColl != null)
		{
			for (int j = 0; j < answerColl.size(); j++)
			{
				AnswerDetailsVo ans = answerColl.get(j);
				QuestionAnswerTypeVo ansType = ans.getAnswerType();
				if (ansType == null || ansType.getAnswerType() == null)
					continue;
				if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
					sb.append(ans.getDateAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
					sb.append(ans.getDecimalAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
					sb.append(ans.getIntegerAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
				{
					for (int k = 0; k < ans.getMultiSelectAnswers().size(); k++)
					{
						if (i == 0 && j == 0 && k == 0)
							sb.append(" - ");
						AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
						sb.append(multi.getOptionText());
						if (j < (answerColl.size() - 1))
							sb.append(", ");
					}
				}
				else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
					sb.append(ans.getPartialDate());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
				{
					if (ans.getPicklistIsNotNull())
						sb.append(ans.getPicklist().getOptionText());
				}
				else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
					sb.append(ans.getStringAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
					sb.append(ans.getTimeAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
					if (!ans.getBoolValueAnswerIsNotNull())
						sb.append("Not Specified");
					else if (ans.getBoolValueAnswer().booleanValue() == true)
						sb.append("Yes");
					else
						sb.append("No");
			}
			sb.append("\r");
		}
	}
	return sb.toString();
}
 
Example 12
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
public String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			// Ensure you don't add unnecessary <BR>
			if (!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length() - 1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		// sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull() ? ans.getPicklist().getOptionText() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull() ? ans.getStringAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");

	return tooltip.toString();
}
 
Example 13
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if (configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;

	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();

	if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;

	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 14
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
public static String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			//Ensure you don't add unnecessary <BR>
			if(!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length()-1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if(ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		//sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull()?ans.getPicklist().getOptionText():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull()?ans.getStringAnswer().toString():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");
	
	return tooltip.toString();
}
 
Example 15
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if(configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;
	
	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();
	
	if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if(isDPP)
			defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH + 190;
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;
	
	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 16
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if(configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;
	
	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();
	
	if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;
	
	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 17
Project: openmaxims-linux   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if(configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;
	
	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();
	
	if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;
	
	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 18
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
public String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			// Ensure you don't add unnecessary <BR>
			if (!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length() - 1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		// sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull() ? ans.getPicklist().getOptionText() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull() ? ans.getStringAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");

	return tooltip.toString();
}
 
Example 19
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if (configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;

	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();

	if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;

	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 20
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
public static String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			//Ensure you don't add unnecessary <BR>
			if(!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length()-1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if(ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		//sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull()?ans.getPicklist().getOptionText():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull()?ans.getStringAnswer().toString():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");
	
	return tooltip.toString();
}
 
Example 21
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if(configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;
	
	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();
	
	if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if(isDPP)
			defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH + 190;
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;
	
	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 22
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if(configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;
	
	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();
	
	if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if(isDPP)
			defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH + 190;
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;
	
	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 23
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 4 votes
public String getDPPQuestionAndAnswers(PatientAssessmentQuestionVo question, int index)
{
	if (question == null)
		return null;

	StringBuffer sb = new StringBuffer();
	if (index != -1)
	{
		sb.append(index);
		sb.append(". ");
	}
	if (question.getAssessmentQuestion().getQuestionIsNotNull())
	{
		sb.append(question.getAssessmentQuestion().getQuestion().getShortText());
	}

	for (int i = 0; i < question.getPatientAnswers().size(); i++)
	{
		PatientAssessmentAnswerVo vo = question.getPatientAnswers().get(i);

		AnswerDetailsVoCollection answerColl = vo.getAnswerDetails();
		if (answerColl != null)
		{
			for (int j = 0; j < answerColl.size(); j++)
			{
				AnswerDetailsVo ans = answerColl.get(j);
				QuestionAnswerTypeVo ansType = ans.getAnswerType();
				if (ansType == null || ansType.getAnswerType() == null)
					continue;
				if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
					sb.append(ans.getDateAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
					sb.append(ans.getDecimalAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
					sb.append(ans.getIntegerAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
				{
					for (int k = 0; k < ans.getMultiSelectAnswers().size(); k++)
					{
						if (i == 0 && j == 0 && k == 0)
							sb.append(" - ");
						AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
						sb.append(multi.getOptionText());
						if (j < (answerColl.size() - 1))
							sb.append(", ");
					}
				}
				else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
					sb.append(ans.getPartialDate());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
				{
					if (ans.getPicklistIsNotNull())
						sb.append(ans.getPicklist().getOptionText());
				}
				else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
					sb.append(ans.getStringAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
					sb.append(ans.getTimeAnswer());
				else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
					if (!ans.getBoolValueAnswerIsNotNull())
						sb.append("Not Specified");
					else if (ans.getBoolValueAnswer().booleanValue() == true)
						sb.append("Yes");
					else
						sb.append("No");
			}
			sb.append("\r");
		}
	}
	return sb.toString();
}
 
Example 24
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if (configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;

	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();

	if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;

	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 25
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 4 votes
public String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			// Ensure you don't add unnecessary <BR>
			if (!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length() - 1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		// sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull() ? ans.getPicklist().getOptionText() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull() ? ans.getStringAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");

	return tooltip.toString();
}
 
Example 26
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
public String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			// Ensure you don't add unnecessary <BR>
			if (!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length() - 1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		// sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull() ? ans.getPicklist().getOptionText() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull() ? ans.getStringAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");

	return tooltip.toString();
}
 
Example 27
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if (configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;

	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();

	if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if (instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();

		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;

	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}
 
Example 28
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
public static String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			//Ensure you don't add unnecessary <BR>
			if(!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length()-1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if(ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		//sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull()?ans.getPicklist().getOptionText():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull()?ans.getStringAnswer().toString():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");
	
	return tooltip.toString();
}
 
Example 29
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
public static String getAnswerDetail(AnswerDetailsVo ans)
{
	StringBuffer tooltip = new StringBuffer();
	QuestionAnswerTypeVo ansType = ans.getAnswerType();
	if (ansType == null || ansType.getAnswerType() == null)
		return "";
	if (ansType.getAnswerType().equals(QuestionAnswerType.DATE))
		tooltip.append(ans.getDateAnswerIsNotNull() ? ans.getDateAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.DECIMAL))
		tooltip.append(ans.getDecimalAnswerIsNotNull() ? ans.getDecimalAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.INTEGER))
		tooltip.append(ans.getIntegerAnswerIsNotNull() ? ans.getIntegerAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.MULTISELECT))
	{
		int size = ans.getMultiSelectAnswers().size();
		for (int k = 0; k < size; k++)
		{
			AnswerOptionVo multi = ans.getMultiSelectAnswers().get(k);
			//Ensure you don't add unnecessary <BR>
			if(!(k == 0 && tooltip.lastIndexOf("<BR>") == tooltip.length()-1))
				tooltip.append("<BR>");
			tooltip.append(multi.getOptionTextIsNotNull() ? multi.getOptionText() : "");
		}
	}
	else if(ansType.getAnswerType().equals(QuestionAnswerType.SEPARATOR) && ans.getAnswerType().getSeparatorTextIsNotNull())
	{
		//sb.append("<br>");
		tooltip.append("<font color=#0000FF>" + ans.getAnswerType().getSeparatorText() + "</font>");
	}
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PARTIALDATE))
		tooltip.append(ans.getPartialDateIsNotNull() ? ans.getPartialDate().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.PICKLIST))
		tooltip.append(ans.getPicklistIsNotNull()?ans.getPicklist().getOptionText():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TEXT))
		tooltip.append(ans.getStringAnswerIsNotNull()?ans.getStringAnswer().toString():"");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.TIME))
		tooltip.append(ans.getTimeAnswerIsNotNull() ? ans.getTimeAnswer().toString() : "");
	else if (ansType.getAnswerType().equals(QuestionAnswerType.YESNO))
		if (!ans.getBoolValueAnswerIsNotNull())
			tooltip.append("Not Specified");
		else if (ans.getBoolValueAnswer().booleanValue() == true)
			tooltip.append("Yes");
		else
			tooltip.append("No");
	
	return tooltip.toString();
}
 
Example 30
Project: openMAXIMS   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 4 votes
private int getCellAnswerWidth(QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	if(configAnswer == null || configAnswer.getAnswerType() == null)
		return 0;
	
	ims.core.vo.lookups.QuestionAnswerType answerType = configAnswer.getAnswerType();
	
	if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE))
		return DEFAULT_DATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL))
		return DEFAULT_DECIMAL_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER))
		return DEFAULT_INTEGER_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT))
	{
		int defaultMultiSelect = DEFAULT_MULTISELECT_ANSWER_CELL_WIDTH;
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? defaultMultiSelect : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? defaultMultiSelect : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE))
		return DEFAULT_PARTIALDATE_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_PICKLIST_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR))
		return DEFAULT_SEPARATOR_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT))
	{
		if(instAnswer != null)
			return instAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : instAnswer.getAnswerWidth().intValue();
		
		return configAnswer.getAnswerWidth() == null ? DEFAULT_TEXT_ANSWER_CELL_WIDTH : configAnswer.getAnswerWidth().intValue();
	}
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME))
		return DEFAULT_TIME_ANSWER_CELL_WIDTH;
	else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO))
		return DEFAULT_YESNO_ANSWER_CELL_WIDTH;
	
	return DEFAULT_UNKNOWN_ANSWER_CELL_WIDTH;
}