Java Code Examples for ims.core.vo.AssessmentQuestionVoCollection

The following are top voted examples for showing how to use ims.core.vo.AssessmentQuestionVoCollection. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onBtnOkClick() throws PresentationLogicException
{
	QuestionInformationShortVoCollection voColl = getSelectedQuestions();
	
	if(isUserAssessmentQuestion())
	{
		AssessmentQuestionVoCollection voAssmntColl = new AssessmentQuestionVoCollection();
		for(int i=0; voColl != null && i<voColl.size(); i++)
		{
			AssessmentQuestionVo voAssmntQ = new AssessmentQuestionVo();
			voAssmntQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation()));
			voAssmntQ.setLegendText(voAssmntQ.getQuestion().getLegendText());
			voAssmntColl.add(voAssmntQ);
		}
		form.getGlobalContext().Core.setSelectedAssessmentQuestions(voAssmntColl);
		closeDialog(DialogResult.OK);
	}
	else
	{
		form.getGlobalContext().Admin.setSelectedQuestions(voColl);
		closeDialog(DialogResult.OK);			
	}
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void removeQuestionFromMap(Integer roleId, AssessmentQuestionVo voAssessQuestions)
{
	if (roleId == null || voAssessQuestions == null)
		return;

	HashMap map = form.getLocalContext().getAssessmentRoles();

	if (map != null)
	{
		AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);

		int index = voAssQColl.indexOf(voAssessQuestions);
		if (index >= 0)
		{
			voAssQColl.remove(index);
			map.put(roleId, voAssQColl);
			form.getLocalContext().setAssessmentRoles(map);
		}
	}
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	Integer roleId = form.getLocalContext().getSelectedRoleId();
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);

	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();

	for (int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if (data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null && data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers());
			for (int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}

	return result;
}
 
Example 5
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if(data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);		
	
	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();
	
	for(int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if(data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null
				&& data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers()); 
			for(int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}
	
	return result;
}
 
Example 6
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onBtnOkClick() throws PresentationLogicException
{
	QuestionInformationShortVoCollection voColl = getSelectedQuestions();
	
	if(isUserAssessmentQuestion())
	{
		AssessmentQuestionVoCollection voAssmntColl = new AssessmentQuestionVoCollection();
		for(int i=0; voColl != null && i<voColl.size(); i++)
		{
			AssessmentQuestionVo voAssmntQ = new AssessmentQuestionVo();
			voAssmntQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation()));
			voAssmntQ.setLegendText(voAssmntQ.getQuestion().getLegendText());
			voAssmntColl.add(voAssmntQ);
		}
		form.getGlobalContext().Core.setSelectedAssessmentQuestions(voAssmntColl);
		closeDialog(DialogResult.OK);
	}
	else
	{
		form.getGlobalContext().Admin.setSelectedQuestions(voColl);
		closeDialog(DialogResult.OK);			
	}
}
 
Example 7
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void removeQuestionFromMap(Integer roleId, AssessmentQuestionVo voAssessQuestions)
{
	if (roleId == null || voAssessQuestions == null)
		return;

	HashMap map = form.getLocalContext().getAssessmentRoles();

	if (map != null)
	{
		AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);

		int index = voAssQColl.indexOf(voAssessQuestions);
		if (index >= 0)
		{
			voAssQColl.remove(index);
			map.put(roleId, voAssQColl);
			form.getLocalContext().setAssessmentRoles(map);
		}
	}
}
 
Example 8
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	Integer roleId = form.getLocalContext().getSelectedRoleId();
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 9
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);

	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();

	for (int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if (data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null && data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers());
			for (int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}

	return result;
}
 
Example 10
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if(data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);		
	
	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();
	
	for(int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if(data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null
				&& data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers()); 
			for(int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}
	
	return result;
}
 
Example 11
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onBtnOkClick() throws PresentationLogicException
{
	QuestionInformationShortVoCollection voColl = getSelectedQuestions();
	
	if(isUserAssessmentQuestion())
	{
		AssessmentQuestionVoCollection voAssmntColl = new AssessmentQuestionVoCollection();
		for(int i=0; voColl != null && i<voColl.size(); i++)
		{
			AssessmentQuestionVo voAssmntQ = new AssessmentQuestionVo();
			voAssmntQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation()));
			voAssmntQ.setLegendText(voAssmntQ.getQuestion().getLegendText());
			voAssmntColl.add(voAssmntQ);
		}
		form.getGlobalContext().Core.setSelectedAssessmentQuestions(voAssmntColl);
		closeDialog(DialogResult.OK);
	}
	else
	{
		form.getGlobalContext().Admin.setSelectedQuestions(voColl);
		closeDialog(DialogResult.OK);			
	}
}
 
Example 12
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void removeQuestionFromMap(Integer roleId, AssessmentQuestionVo voAssessQuestions)
{
	if (roleId == null || voAssessQuestions == null)
		return;

	HashMap map = form.getLocalContext().getAssessmentRoles();

	if (map != null)
	{
		AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);

		int index = voAssQColl.indexOf(voAssessQuestions);
		if (index >= 0)
		{
			voAssQColl.remove(index);
			map.put(roleId, voAssQColl);
			form.getLocalContext().setAssessmentRoles(map);
		}
	}
}
 
Example 13
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	Integer roleId = form.getLocalContext().getSelectedRoleId();
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 14
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);

	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();

	for (int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if (data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null && data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers());
			for (int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}

	return result;
}
 
Example 15
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if(data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);		
	
	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();
	
	for(int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if(data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null
				&& data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers()); 
			for(int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}
	
	return result;
}
 
Example 16
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onBtnOkClick() throws PresentationLogicException
{
	QuestionInformationShortVoCollection voColl = getSelectedQuestions();
	
	if(isUserAssessmentQuestion())
	{
		AssessmentQuestionVoCollection voAssmntColl = new AssessmentQuestionVoCollection();
		for(int i=0; voColl != null && i<voColl.size(); i++)
		{
			AssessmentQuestionVo voAssmntQ = new AssessmentQuestionVo();
			voAssmntQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation()));
			voAssmntQ.setLegendText(voAssmntQ.getQuestion().getLegendText());
			voAssmntColl.add(voAssmntQ);
		}
		form.getGlobalContext().Core.setSelectedAssessmentQuestions(voAssmntColl);
		closeDialog(DialogResult.OK);
	}
	else
	{
		form.getGlobalContext().Admin.setSelectedQuestions(voColl);
		closeDialog(DialogResult.OK);			
	}
}
 
Example 17
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void removeQuestionFromMap(Integer roleId, AssessmentQuestionVo voAssessQuestions)
{
	if (roleId == null || voAssessQuestions == null)
		return;

	HashMap map = form.getLocalContext().getAssessmentRoles();

	if (map != null)
	{
		AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);

		int index = voAssQColl.indexOf(voAssessQuestions);
		if (index >= 0)
		{
			voAssQColl.remove(index);
			map.put(roleId, voAssQColl);
			form.getLocalContext().setAssessmentRoles(map);
		}
	}
}
 
Example 18
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	Integer roleId = form.getLocalContext().getSelectedRoleId();
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 19
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);

	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();

	for (int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if (data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null && data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers());
			for (int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}

	return result;
}
 
Example 20
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
private AssessmentQuestionVoCollection buildExistingQuestions(PatientAssessmentDataVo data, AssessmentQuestionGroupVo group) throws PresentationLogicException
{
	if(data.getAnswerGroups() == null || group == null)
		return new AssessmentQuestionVoCollection();
	checkDataIntegrity(data);		
	
	AssessmentQuestionVoCollection result = new AssessmentQuestionVoCollection();
	
	for(int x = 0; x < data.getAnswerGroups().size(); x++)
	{
		if(data.getAnswerGroups().get(x).getAssessmentQuestionGroup() != null
				&& data.getAnswerGroups().get(x).getAssessmentQuestionGroup().equals(group))
		{
			PatientAssessmentQuestionVoCollection answers = sortAnswersBySequence(data.getAnswerGroups().get(x).getAssessmentAnswers()); 
			for(int y = 0; y < answers.size(); y++)
			{
				result.add(data.getAnswerGroups().get(x).getAssessmentAnswers().get(y).getAssessmentQuestion());
			}
		}
	}
	
	return result;
}
 
Example 21
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean populateGroupCollectionFromScreenMultipleGroupNoFlat(UserAssessmentVo assessment)
{
	assessment.getQuestionGroups().clear();
	int seqNo = 1;
	for(int i = 0; i < form.lyrTabs().tabAssessments().dyngrdDetails().getRows().size(); i++)
	{
		DynamicGridRow row = form.lyrTabs().tabAssessments().dyngrdDetails().getRows().get(i);
		
		AssessmentQuestionGroupVo assessmentQuestionGroupVo = (AssessmentQuestionGroupVo) row.getValue();
		if(assessmentQuestionGroupVo.getQuestionsIsNotNull())
			assessmentQuestionGroupVo.getQuestions().clear();
		else
			assessmentQuestionGroupVo.setQuestions(new AssessmentQuestionVoCollection());
		
		for (int j = 0; j < row.getRows().size(); j++)
		{
			DynamicGridRow childRow = row.getRows().get(j);
			
			if(childRow.getValue() instanceof AssessmentQuestionVo)
			{
				AssessmentQuestionVo value = (AssessmentQuestionVo) childRow.getValue();
				value.setIsMandatory((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MANDATORY)).getValue());
				if(value.getIsMandatory() == null)
					value.setIsMandatory(Boolean.FALSE);
				value.setAllowsMultipleAnswers((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MULTIANSWERS)).getValue());
				if(value.getAllowsMultipleAnswers() == null)
					value.setAllowsMultipleAnswers(Boolean.FALSE);
				value.setActiveStatus( (PreActiveActiveInactiveStatus) childRow.getCells().get(getGridColumn(COLUMN_STATUS)).getValue());
				value.setSequence(new Integer(seqNo++));
				value.setAssessmentAnswerRole(getQuestionRole(value));
				assessmentQuestionGroupVo.getQuestions().add(value);
			}
		}
		
		if(assessment.getQuestionGroups().contains(assessmentQuestionGroupVo) == false)
			assessment.getQuestionGroups().add(assessmentQuestionGroupVo);
	}
	
	return true;
}
 
Example 22
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private UserAssessmentVo getCopyOfAssessmentVo(UserAssessmentVo assessment)
{
	if(assessment == null)
		return null;
	
	// Clear all ids where the aggregation is composite
	assessment.setID_UserAssessment(null);
	assessment.setActiveStatus(PreActiveActiveInactiveStatus.PREACTIVE);
	for (int i = 0; assessment.getAssessmentRolesIsNotNull() && i < assessment.getAssessmentRoles().size(); i++)
	{
		assessment.getAssessmentRoles().get(i).setID_AssessmentRole(null);
	}

	for (int i = 0; assessment.getQuestionGroupsIsNotNull() && i < assessment.getQuestionGroups().size(); i++)
	{
		assessment.getQuestionGroups().get(i).setID_AssessmentQuestionGroup(null);

		AssessmentQuestionVoCollection voColl = new AssessmentQuestionVoCollection();
		for (int j = 0; assessment.getQuestionGroups().get(i).getQuestionsIsNotNull() && j < assessment.getQuestionGroups().get(i).getQuestions().size(); j++)
		{
			AssessmentQuestionVo voAssessmentQuestion = assessment.getQuestionGroups().get(i).getQuestions().get(j);
			if (voAssessmentQuestion.getActiveStatusIsNotNull() && voAssessmentQuestion.getActiveStatus().equals(PreActiveActiveInactiveStatus.INACTIVE))
				continue;

			voAssessmentQuestion.setID_AssessmentQuestion(null);
			for (int k = 0; voAssessmentQuestion.getAssessmentAnswerRoleIsNotNull() && k < voAssessmentQuestion.getAssessmentAnswerRole().size(); k++)
			{
				voAssessmentQuestion.getAssessmentAnswerRole().get(k).setID_AssessmentQuestionRole(null);
			}
			voColl.add(voAssessmentQuestion);
		}
		assessment.getQuestionGroups().get(i).setQuestions(voColl);
	}
	// End clear
	
	return assessment;
}
 
Example 23
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private AssessmentQuestionRoleVoCollection getQuestionRole(AssessmentQuestionVo voAssessmentQuestion)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	if (map == null)
		return null;

	AssessmentQuestionRoleVoCollection voColl = new AssessmentQuestionRoleVoCollection();

	AssessmentRoleVoCollection roleVoColl = getRoles();
	for (int i = 0; i < roleVoColl.size(); i++)
	{
		AssessmentRoleVo voAssessRole = roleVoColl.get(i);
		if (voAssessRole.getAnswerAllIsNotNull() && voAssessRole.getAnswerAll().booleanValue() == false)
		{
			AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(voAssessRole.getAppRole().getID_AppRole());
			if (voAssQColl != null)
			{
				if (voAssQColl.indexOf(voAssessmentQuestion) >= 0)
				{
					AssessmentQuestionRoleVo voAssessQuestionRole = new AssessmentQuestionRoleVo();
					voAssessQuestionRole.setAppRole(voAssessRole.getAppRole());
					voColl.add(voAssessQuestionRole);
				}
			}
		}
	}

	return voColl;
}
 
Example 24
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private int countActiveQuestions(AssessmentQuestionVoCollection questions)
{
	if (questions == null)
		return 0;

	int count = 0;
	for (int x = 0; x < questions.size(); x++)
	{
		AssessmentQuestionVo question = questions.get(x);
		//WDEV-11366
		if (question.getActiveStatusIsNotNull() && question.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE) && !isQuestionInvalidForPatient(question.getQuestion()))
			count++;
	}
	return count;
}
 
Example 25
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateQuestionsHierarchical(PatientAssessmentDataVo data) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null)
		return;
	checkDataIntegrity(data);
	boolean flatView = data.getUserAssessment().getIsFlatView().booleanValue();
	boolean userCanAnswerToAllQuestion = checkUserRole(data.getUserAssessment());//wdev-3709

	AssessmentQuestionGroupVoCollection existingGroups = buildExistingGroups(data);

	for (int x = 0; x < existingGroups.size(); x++)
	{
		if (existingGroups.get(x) != null)
		{
			AssessmentQuestionVoCollection existingQuestions = buildExistingQuestions(data, existingGroups.get(x));

			if (flatView)
			{
				for (int y = 0; y < existingQuestions.size(); y++)
				{
					addQuestionRow(existingQuestions.get(y), existingGroups.get(x), getInstAnswer(data, existingGroups.get(x), existingQuestions.get(y)), userCanAnswerToAllQuestion);//wdev- 3709
				}
			}
			else
			{
				addGroupRow(existingGroups.get(x), existingQuestions, data, userCanAnswerToAllQuestion);//wdev-3709
			}
		}
	}
}
 
Example 26
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionVoCollection sortQuestionsBySequence(AssessmentQuestionVoCollection questionsToBeSorted)
{
	if (questionsToBeSorted == null)
		return new AssessmentQuestionVoCollection();

	int size = questionsToBeSorted.size();
	int[] sorted = new int[size];
	for (int x = 0; x < size; x++)
	{
		sorted[x] = x;
	}

	for (int x = 0; x < size; x++)
	{
		for (int y = 0; y < size; y++)
		{
			AssessmentQuestionVo source = questionsToBeSorted.get(sorted[x]);
			AssessmentQuestionVo compare = questionsToBeSorted.get(sorted[y]);

			if (source.getSequenceIsNotNull() && compare.getSequenceIsNotNull())
			{
				if (source.getSequence().compareTo(compare.getSequence()) < 0)
				{
					int temp = sorted[x];
					sorted[x] = sorted[y];
					sorted[y] = temp;
				}
			}
		}
	}

	AssessmentQuestionVoCollection sortedQuestions = new AssessmentQuestionVoCollection();
	for (int x = 0; x < size; x++)
	{
		sortedQuestions.add(questionsToBeSorted.get(sorted[x]));
	}

	return sortedQuestions;
}
 
Example 27
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow addGroupRow(AssessmentQuestionGroupVo group, AssessmentQuestionVoCollection questions, PatientAssessmentDataVo data, boolean userCanAnswerToAllQuestion) throws PresentationLogicException
{
	checkDataIntegrity(group);

	if (group.getLegendTextIsNotNull() && group.getLegendText().trim().length() > 0)
		addGroupLegend(group);

	DynamicGridColumn column = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN);
	DynamicGridRow row = this.grid.getRows().newRow();
	row.setBackColor(Color.Beige);
	row.setBold(true);
	row.setIdentifier(new GroupRowData(group, null));
	row.setExpanded(true);

	DynamicGridCell cell = row.getCells().newCell(column, DynamicCellType.WRAPTEXT);
	cell.setValue(group.getName());
	cell.setReadOnly(true);

	if (questions != null)
	{
		for (int x = 0; x < questions.size(); x++)
		{
			if (questions.get(x).getActiveStatusIsNotNull() && (data != null || questions.get(x).getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)))
			{
				if (data == null)
				{
					//WDEV-11366
					if (!isQuestionInvalidForPatient(questions.get(x).getQuestion()))
						addQuestionRow(row, questions.get(x), group, null, userCanAnswerToAllQuestion);//wdev-3709
				}
				else
					addQuestionRow(row, questions.get(x), group, getInstAnswer(data, group, questions.get(x)), userCanAnswerToAllQuestion);//wdev-3709
			}
		}
	}

	return row;
}
 
Example 28
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private int countActiveQuestions(AssessmentQuestionVoCollection questions)
{
	if(questions == null)
		return 0;
	
	int count = 0;
	for(int x = 0; x < questions.size(); x++)
	{
		AssessmentQuestionVo question = questions.get(x);
		if(question.getActiveStatusIsNotNull() 
				&& question.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE))
			count++;
	}		
	return count;
}
 
Example 29
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private void populateQuestionsHierarchical(PatientAssessmentDataVo data) throws PresentationLogicException 
{
	if(data.getAnswerGroups() == null)
		return;		
	checkDataIntegrity(data);		
	boolean flatView = data.getUserAssessment().getIsFlatView().booleanValue();
	
	AssessmentQuestionGroupVoCollection existingGroups = buildExistingGroups(data);
	
	for(int x = 0; x < existingGroups.size(); x++)
	{
		if(existingGroups.get(x) != null)
		{
			AssessmentQuestionVoCollection existingQuestions = buildExistingQuestions(data, existingGroups.get(x));
			
			if(flatView)
			{
				for(int y = 0; y < existingQuestions.size(); y++)
				{
					addQuestionRow(existingQuestions.get(y), existingGroups.get(x), getInstAnswer(data, existingGroups.get(x), existingQuestions.get(y)));						
				}
			}
			else
			{		
				addGroupRow(existingGroups.get(x), existingQuestions, data);
			}
		}
	}
}
 
Example 30
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionVoCollection sortQuestionsBySequence(AssessmentQuestionVoCollection questionsToBeSorted)
{
	if(questionsToBeSorted == null)
		return new AssessmentQuestionVoCollection();

	int size = questionsToBeSorted.size();
	int[] sorted = new int[size];
	for(int x = 0; x < size; x++)
	{
		sorted[x] = x;
	}
	
	for(int x = 0; x < size; x++)
	{
		for(int y = 0; y < size; y++)
		{
			AssessmentQuestionVo source = questionsToBeSorted.get(sorted[x]);
			AssessmentQuestionVo compare = questionsToBeSorted.get(sorted[y]);
				
			if(source.getSequenceIsNotNull() && compare.getSequenceIsNotNull())
			{
				if(source.getSequence().compareTo(compare.getSequence()) < 0)
				{
					int temp = sorted[x]; 
					sorted[x] = sorted[y];
					sorted[y] = temp;	
				}
			}
		}
	}
	
	AssessmentQuestionVoCollection sortedQuestions = new AssessmentQuestionVoCollection();
	for(int x = 0; x < size; x++)
	{
		sortedQuestions.add(questionsToBeSorted.get(sorted[x]));
	}
	
	return sortedQuestions;
}
 
Example 31
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow addGroupRow(AssessmentQuestionGroupVo group, AssessmentQuestionVoCollection questions, PatientAssessmentDataVo data) throws PresentationLogicException
{
	checkDataIntegrity(group);		
	
	DynamicGridColumn column = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN);
	DynamicGridRow row = this.grid.getRows().newRow();		
	row.setBackColor(Color.Beige);
	row.setBold(true);
		row.setIdentifier(new GroupRowData(group, null));
	row.setExpanded(true);
	
	DynamicGridCell cell = row.getCells().newCell(column, DynamicCellType.WRAPTEXT);
	cell.setValue(group.getName());			
	cell.setReadOnly(true);	
	
	if(questions != null)
	{
		for(int x = 0; x < questions.size(); x++)
		{
			if(questions.get(x).getActiveStatusIsNotNull() 
					&& (data != null || questions.get(x).getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)))
			{
				if(data == null)
					addQuestionRow(row, questions.get(x), group, null);
				else
					addQuestionRow(row, questions.get(x), group, getInstAnswer(data, group, questions.get(x)));
			}
		}
	}
	
	return row;
}
 
Example 32
Project: AvoinApotti   File: StructuredAssessmentsHelper.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionRoleVoCollection getQuestionRole(AssessmentQuestionVo voAssessmentQuestion, HashMap assessmentRoleMap)
{
	if (assessmentRoleMap == null)
		return null;

	AssessmentQuestionRoleVoCollection voColl = new AssessmentQuestionRoleVoCollection();

	for (int i = 0; roleVoColl != null && i < roleVoColl.size(); i++)
	{
		AssessmentRoleVo voAssessRole = roleVoColl.get(i);
		if (voAssessRole.getAnswerAllIsNotNull() && voAssessRole.getAnswerAll().booleanValue() == false)
		{
			AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) assessmentRoleMap.get(voAssessRole.getAppRole().getID_AppRole());
			if (voAssQColl != null)
			{
				if (voAssQColl.indexOf(voAssessmentQuestion) >= 0)
				{
					AssessmentQuestionRoleVo voAssessQuestionRole = new AssessmentQuestionRoleVo();
					voAssessQuestionRole.setAppRole(voAssessRole.getAppRole());
					voColl.add(voAssessQuestionRole);
				}
			}
		}
	}

	return voColl;
}
 
Example 33
Project: AvoinApotti   File: StructuredAssessmentsHelper.java   Source Code and License 5 votes vote down vote up
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 34
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean populateGroupCollectionFromScreenMultipleGroupNoFlat(UserAssessmentVo assessment)
{
	assessment.getQuestionGroups().clear();
	int seqNo = 1;
	for(int i = 0; i < form.lyrTabs().tabAssessments().dyngrdDetails().getRows().size(); i++)
	{
		DynamicGridRow row = form.lyrTabs().tabAssessments().dyngrdDetails().getRows().get(i);
		
		AssessmentQuestionGroupVo assessmentQuestionGroupVo = (AssessmentQuestionGroupVo) row.getValue();
		if(assessmentQuestionGroupVo.getQuestionsIsNotNull())
			assessmentQuestionGroupVo.getQuestions().clear();
		else
			assessmentQuestionGroupVo.setQuestions(new AssessmentQuestionVoCollection());
		
		for (int j = 0; j < row.getRows().size(); j++)
		{
			DynamicGridRow childRow = row.getRows().get(j);
			
			if(childRow.getValue() instanceof AssessmentQuestionVo)
			{
				AssessmentQuestionVo value = (AssessmentQuestionVo) childRow.getValue();
				value.setIsMandatory((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MANDATORY)).getValue());
				if(value.getIsMandatory() == null)
					value.setIsMandatory(Boolean.FALSE);
				value.setAllowsMultipleAnswers((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MULTIANSWERS)).getValue());
				if(value.getAllowsMultipleAnswers() == null)
					value.setAllowsMultipleAnswers(Boolean.FALSE);
				value.setActiveStatus( (PreActiveActiveInactiveStatus) childRow.getCells().get(getGridColumn(COLUMN_STATUS)).getValue());
				value.setSequence(new Integer(seqNo++));
				value.setAssessmentAnswerRole(getQuestionRole(value));
				assessmentQuestionGroupVo.getQuestions().add(value);
			}
		}
		
		if(assessment.getQuestionGroups().contains(assessmentQuestionGroupVo) == false)
			assessment.getQuestionGroups().add(assessmentQuestionGroupVo);
	}
	
	return true;
}
 
Example 35
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private UserAssessmentVo getCopyOfAssessmentVo(UserAssessmentVo assessment)
{
	if(assessment == null)
		return null;
	
	// Clear all ids where the aggregation is composite
	assessment.setID_UserAssessment(null);
	assessment.setActiveStatus(PreActiveActiveInactiveStatus.PREACTIVE);
	for (int i = 0; assessment.getAssessmentRolesIsNotNull() && i < assessment.getAssessmentRoles().size(); i++)
	{
		assessment.getAssessmentRoles().get(i).setID_AssessmentRole(null);
	}

	for (int i = 0; assessment.getQuestionGroupsIsNotNull() && i < assessment.getQuestionGroups().size(); i++)
	{
		assessment.getQuestionGroups().get(i).setID_AssessmentQuestionGroup(null);

		AssessmentQuestionVoCollection voColl = new AssessmentQuestionVoCollection();
		for (int j = 0; assessment.getQuestionGroups().get(i).getQuestionsIsNotNull() && j < assessment.getQuestionGroups().get(i).getQuestions().size(); j++)
		{
			AssessmentQuestionVo voAssessmentQuestion = assessment.getQuestionGroups().get(i).getQuestions().get(j);
			if (voAssessmentQuestion.getActiveStatusIsNotNull() && voAssessmentQuestion.getActiveStatus().equals(PreActiveActiveInactiveStatus.INACTIVE))
				continue;

			voAssessmentQuestion.setID_AssessmentQuestion(null);
			for (int k = 0; voAssessmentQuestion.getAssessmentAnswerRoleIsNotNull() && k < voAssessmentQuestion.getAssessmentAnswerRole().size(); k++)
			{
				voAssessmentQuestion.getAssessmentAnswerRole().get(k).setID_AssessmentQuestionRole(null);
			}
			voColl.add(voAssessmentQuestion);
		}
		assessment.getQuestionGroups().get(i).setQuestions(voColl);
	}
	// End clear
	
	return assessment;
}
 
Example 36
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private AssessmentQuestionRoleVoCollection getQuestionRole(AssessmentQuestionVo voAssessmentQuestion)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	if (map == null)
		return null;

	AssessmentQuestionRoleVoCollection voColl = new AssessmentQuestionRoleVoCollection();

	AssessmentRoleVoCollection roleVoColl = getRoles();
	for (int i = 0; i < roleVoColl.size(); i++)
	{
		AssessmentRoleVo voAssessRole = roleVoColl.get(i);
		if (voAssessRole.getAnswerAllIsNotNull() && voAssessRole.getAnswerAll().booleanValue() == false)
		{
			AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(voAssessRole.getAppRole().getID_AppRole());
			if (voAssQColl != null)
			{
				if (voAssQColl.indexOf(voAssessmentQuestion) >= 0)
				{
					AssessmentQuestionRoleVo voAssessQuestionRole = new AssessmentQuestionRoleVo();
					voAssessQuestionRole.setAppRole(voAssessRole.getAppRole());
					voColl.add(voAssessQuestionRole);
				}
			}
		}
	}

	return voColl;
}
 
Example 37
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private int countActiveQuestions(AssessmentQuestionVoCollection questions)
{
	if (questions == null)
		return 0;

	int count = 0;
	for (int x = 0; x < questions.size(); x++)
	{
		AssessmentQuestionVo question = questions.get(x);
		//WDEV-11366
		if (question.getActiveStatusIsNotNull() && question.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE) && !isQuestionInvalidForPatient(question.getQuestion()))
			count++;
	}
	return count;
}
 
Example 38
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateQuestionsHierarchical(PatientAssessmentDataVo data) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null)
		return;
	checkDataIntegrity(data);
	boolean flatView = data.getUserAssessment().getIsFlatView().booleanValue();
	boolean userCanAnswerToAllQuestion = checkUserRole(data.getUserAssessment());//wdev-3709

	AssessmentQuestionGroupVoCollection existingGroups = buildExistingGroups(data);

	for (int x = 0; x < existingGroups.size(); x++)
	{
		if (existingGroups.get(x) != null)
		{
			AssessmentQuestionVoCollection existingQuestions = buildExistingQuestions(data, existingGroups.get(x));

			if (flatView)
			{
				for (int y = 0; y < existingQuestions.size(); y++)
				{
					addQuestionRow(existingQuestions.get(y), existingGroups.get(x), getInstAnswer(data, existingGroups.get(x), existingQuestions.get(y)), userCanAnswerToAllQuestion);//wdev- 3709
				}
			}
			else
			{
				addGroupRow(existingGroups.get(x), existingQuestions, data, userCanAnswerToAllQuestion);//wdev-3709
			}
		}
	}
}
 
Example 39
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionVoCollection sortQuestionsBySequence(AssessmentQuestionVoCollection questionsToBeSorted)
{
	if (questionsToBeSorted == null)
		return new AssessmentQuestionVoCollection();

	int size = questionsToBeSorted.size();
	int[] sorted = new int[size];
	for (int x = 0; x < size; x++)
	{
		sorted[x] = x;
	}

	for (int x = 0; x < size; x++)
	{
		for (int y = 0; y < size; y++)
		{
			AssessmentQuestionVo source = questionsToBeSorted.get(sorted[x]);
			AssessmentQuestionVo compare = questionsToBeSorted.get(sorted[y]);

			if (source.getSequenceIsNotNull() && compare.getSequenceIsNotNull())
			{
				if (source.getSequence().compareTo(compare.getSequence()) < 0)
				{
					int temp = sorted[x];
					sorted[x] = sorted[y];
					sorted[y] = temp;
				}
			}
		}
	}

	AssessmentQuestionVoCollection sortedQuestions = new AssessmentQuestionVoCollection();
	for (int x = 0; x < size; x++)
	{
		sortedQuestions.add(questionsToBeSorted.get(sorted[x]));
	}

	return sortedQuestions;
}
 
Example 40
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow addGroupRow(AssessmentQuestionGroupVo group, AssessmentQuestionVoCollection questions, PatientAssessmentDataVo data, boolean userCanAnswerToAllQuestion) throws PresentationLogicException
{
	checkDataIntegrity(group);

	if (group.getLegendTextIsNotNull() && group.getLegendText().trim().length() > 0)
		addGroupLegend(group);

	DynamicGridColumn column = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN);
	DynamicGridRow row = this.grid.getRows().newRow();
	row.setBackColor(Color.Beige);
	row.setBold(true);
	row.setIdentifier(new GroupRowData(group, null));
	row.setExpanded(true);

	DynamicGridCell cell = row.getCells().newCell(column, DynamicCellType.WRAPTEXT);
	cell.setValue(group.getName());
	cell.setReadOnly(true);

	if (questions != null)
	{
		for (int x = 0; x < questions.size(); x++)
		{
			if (questions.get(x).getActiveStatusIsNotNull() && (data != null || questions.get(x).getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)))
			{
				if (data == null)
				{
					//WDEV-11366
					if (!isQuestionInvalidForPatient(questions.get(x).getQuestion()))
						addQuestionRow(row, questions.get(x), group, null, userCanAnswerToAllQuestion);//wdev-3709
				}
				else
					addQuestionRow(row, questions.get(x), group, getInstAnswer(data, group, questions.get(x)), userCanAnswerToAllQuestion);//wdev-3709
			}
		}
	}

	return row;
}
 
Example 41
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private int countActiveQuestions(AssessmentQuestionVoCollection questions)
{
	if(questions == null)
		return 0;
	
	int count = 0;
	for(int x = 0; x < questions.size(); x++)
	{
		AssessmentQuestionVo question = questions.get(x);
		if(question.getActiveStatusIsNotNull() 
				&& question.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE))
			count++;
	}		
	return count;
}
 
Example 42
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private void populateQuestionsHierarchical(PatientAssessmentDataVo data) throws PresentationLogicException 
{
	if(data.getAnswerGroups() == null)
		return;		
	checkDataIntegrity(data);		
	boolean flatView = data.getUserAssessment().getIsFlatView().booleanValue();
	
	AssessmentQuestionGroupVoCollection existingGroups = buildExistingGroups(data);
	
	for(int x = 0; x < existingGroups.size(); x++)
	{
		if(existingGroups.get(x) != null)
		{
			AssessmentQuestionVoCollection existingQuestions = buildExistingQuestions(data, existingGroups.get(x));
			
			if(flatView)
			{
				for(int y = 0; y < existingQuestions.size(); y++)
				{
					addQuestionRow(existingQuestions.get(y), existingGroups.get(x), getInstAnswer(data, existingGroups.get(x), existingQuestions.get(y)));						
				}
			}
			else
			{		
				addGroupRow(existingGroups.get(x), existingQuestions, data);
			}
		}
	}
}
 
Example 43
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionVoCollection sortQuestionsBySequence(AssessmentQuestionVoCollection questionsToBeSorted)
{
	if(questionsToBeSorted == null)
		return new AssessmentQuestionVoCollection();

	int size = questionsToBeSorted.size();
	int[] sorted = new int[size];
	for(int x = 0; x < size; x++)
	{
		sorted[x] = x;
	}
	
	for(int x = 0; x < size; x++)
	{
		for(int y = 0; y < size; y++)
		{
			AssessmentQuestionVo source = questionsToBeSorted.get(sorted[x]);
			AssessmentQuestionVo compare = questionsToBeSorted.get(sorted[y]);
				
			if(source.getSequenceIsNotNull() && compare.getSequenceIsNotNull())
			{
				if(source.getSequence().compareTo(compare.getSequence()) < 0)
				{
					int temp = sorted[x]; 
					sorted[x] = sorted[y];
					sorted[y] = temp;	
				}
			}
		}
	}
	
	AssessmentQuestionVoCollection sortedQuestions = new AssessmentQuestionVoCollection();
	for(int x = 0; x < size; x++)
	{
		sortedQuestions.add(questionsToBeSorted.get(sorted[x]));
	}
	
	return sortedQuestions;
}
 
Example 44
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow addGroupRow(AssessmentQuestionGroupVo group, AssessmentQuestionVoCollection questions, PatientAssessmentDataVo data) throws PresentationLogicException
{
	checkDataIntegrity(group);		
	
	DynamicGridColumn column = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN);
	DynamicGridRow row = this.grid.getRows().newRow();		
	row.setBackColor(Color.Beige);
	row.setBold(true);
		row.setIdentifier(new GroupRowData(group, null));
	row.setExpanded(true);
	
	DynamicGridCell cell = row.getCells().newCell(column, DynamicCellType.WRAPTEXT);
	cell.setValue(group.getName());			
	cell.setReadOnly(true);	
	
	if(questions != null)
	{
		for(int x = 0; x < questions.size(); x++)
		{
			if(questions.get(x).getActiveStatusIsNotNull() 
					&& (data != null || questions.get(x).getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)))
			{
				if(data == null)
					addQuestionRow(row, questions.get(x), group, null);
				else
					addQuestionRow(row, questions.get(x), group, getInstAnswer(data, group, questions.get(x)));
			}
		}
	}
	
	return row;
}
 
Example 45
Project: openMAXIMS   File: StructuredAssessmentsHelper.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionRoleVoCollection getQuestionRole(AssessmentQuestionVo voAssessmentQuestion, HashMap assessmentRoleMap)
{
	if (assessmentRoleMap == null)
		return null;

	AssessmentQuestionRoleVoCollection voColl = new AssessmentQuestionRoleVoCollection();

	for (int i = 0; roleVoColl != null && i < roleVoColl.size(); i++)
	{
		AssessmentRoleVo voAssessRole = roleVoColl.get(i);
		if (voAssessRole.getAnswerAllIsNotNull() && voAssessRole.getAnswerAll().booleanValue() == false)
		{
			AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) assessmentRoleMap.get(voAssessRole.getAppRole().getID_AppRole());
			if (voAssQColl != null)
			{
				if (voAssQColl.indexOf(voAssessmentQuestion) >= 0)
				{
					AssessmentQuestionRoleVo voAssessQuestionRole = new AssessmentQuestionRoleVo();
					voAssessQuestionRole.setAppRole(voAssessRole.getAppRole());
					voColl.add(voAssessQuestionRole);
				}
			}
		}
	}

	return voColl;
}
 
Example 46
Project: openMAXIMS   File: StructuredAssessmentsHelper.java   Source Code and License 5 votes vote down vote up
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 47
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean populateGroupCollectionFromScreenMultipleGroupNoFlat(UserAssessmentVo assessment)
{
	assessment.getQuestionGroups().clear();
	int seqNo = 1;
	for(int i = 0; i < form.lyrTabs().tabAssessments().dyngrdDetails().getRows().size(); i++)
	{
		DynamicGridRow row = form.lyrTabs().tabAssessments().dyngrdDetails().getRows().get(i);
		
		AssessmentQuestionGroupVo assessmentQuestionGroupVo = (AssessmentQuestionGroupVo) row.getValue();
		if(assessmentQuestionGroupVo.getQuestionsIsNotNull())
			assessmentQuestionGroupVo.getQuestions().clear();
		else
			assessmentQuestionGroupVo.setQuestions(new AssessmentQuestionVoCollection());
		
		for (int j = 0; j < row.getRows().size(); j++)
		{
			DynamicGridRow childRow = row.getRows().get(j);
			
			if(childRow.getValue() instanceof AssessmentQuestionVo)
			{
				AssessmentQuestionVo value = (AssessmentQuestionVo) childRow.getValue();
				value.setIsMandatory((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MANDATORY)).getValue());
				if(value.getIsMandatory() == null)
					value.setIsMandatory(Boolean.FALSE);
				value.setAllowsMultipleAnswers((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MULTIANSWERS)).getValue());
				if(value.getAllowsMultipleAnswers() == null)
					value.setAllowsMultipleAnswers(Boolean.FALSE);
				value.setActiveStatus( (PreActiveActiveInactiveStatus) childRow.getCells().get(getGridColumn(COLUMN_STATUS)).getValue());
				value.setSequence(new Integer(seqNo++));
				value.setAssessmentAnswerRole(getQuestionRole(value));
				assessmentQuestionGroupVo.getQuestions().add(value);
			}
		}
		
		if(assessment.getQuestionGroups().contains(assessmentQuestionGroupVo) == false)
			assessment.getQuestionGroups().add(assessmentQuestionGroupVo);
	}
	
	return true;
}
 
Example 48
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private UserAssessmentVo getCopyOfAssessmentVo(UserAssessmentVo assessment)
{
	if(assessment == null)
		return null;
	
	// Clear all ids where the aggregation is composite
	assessment.setID_UserAssessment(null);
	assessment.setActiveStatus(PreActiveActiveInactiveStatus.PREACTIVE);
	for (int i = 0; assessment.getAssessmentRolesIsNotNull() && i < assessment.getAssessmentRoles().size(); i++)
	{
		assessment.getAssessmentRoles().get(i).setID_AssessmentRole(null);
	}

	for (int i = 0; assessment.getQuestionGroupsIsNotNull() && i < assessment.getQuestionGroups().size(); i++)
	{
		assessment.getQuestionGroups().get(i).setID_AssessmentQuestionGroup(null);

		AssessmentQuestionVoCollection voColl = new AssessmentQuestionVoCollection();
		for (int j = 0; assessment.getQuestionGroups().get(i).getQuestionsIsNotNull() && j < assessment.getQuestionGroups().get(i).getQuestions().size(); j++)
		{
			AssessmentQuestionVo voAssessmentQuestion = assessment.getQuestionGroups().get(i).getQuestions().get(j);
			if (voAssessmentQuestion.getActiveStatusIsNotNull() && voAssessmentQuestion.getActiveStatus().equals(PreActiveActiveInactiveStatus.INACTIVE))
				continue;

			voAssessmentQuestion.setID_AssessmentQuestion(null);
			for (int k = 0; voAssessmentQuestion.getAssessmentAnswerRoleIsNotNull() && k < voAssessmentQuestion.getAssessmentAnswerRole().size(); k++)
			{
				voAssessmentQuestion.getAssessmentAnswerRole().get(k).setID_AssessmentQuestionRole(null);
			}
			voColl.add(voAssessmentQuestion);
		}
		assessment.getQuestionGroups().get(i).setQuestions(voColl);
	}
	// End clear
	
	return assessment;
}
 
Example 49
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private AssessmentQuestionRoleVoCollection getQuestionRole(AssessmentQuestionVo voAssessmentQuestion)
{
	HashMap map = form.getLocalContext().getAssessmentRoles();
	if (map == null)
		return null;

	AssessmentQuestionRoleVoCollection voColl = new AssessmentQuestionRoleVoCollection();

	AssessmentRoleVoCollection roleVoColl = getRoles();
	for (int i = 0; i < roleVoColl.size(); i++)
	{
		AssessmentRoleVo voAssessRole = roleVoColl.get(i);
		if (voAssessRole.getAnswerAllIsNotNull() && voAssessRole.getAnswerAll().booleanValue() == false)
		{
			AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(voAssessRole.getAppRole().getID_AppRole());
			if (voAssQColl != null)
			{
				if (voAssQColl.indexOf(voAssessmentQuestion) >= 0)
				{
					AssessmentQuestionRoleVo voAssessQuestionRole = new AssessmentQuestionRoleVo();
					voAssessQuestionRole.setAppRole(voAssessRole.getAppRole());
					voColl.add(voAssessQuestionRole);
				}
			}
		}
	}

	return voColl;
}
 
Example 50
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private int countActiveQuestions(AssessmentQuestionVoCollection questions)
{
	if (questions == null)
		return 0;

	int count = 0;
	for (int x = 0; x < questions.size(); x++)
	{
		AssessmentQuestionVo question = questions.get(x);
		//WDEV-11366
		if (question.getActiveStatusIsNotNull() && question.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE) && !isQuestionInvalidForPatient(question.getQuestion()))
			count++;
	}
	return count;
}
 
Example 51
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateQuestionsHierarchical(PatientAssessmentDataVo data) throws PresentationLogicException
{
	if (data.getAnswerGroups() == null)
		return;
	checkDataIntegrity(data);
	boolean flatView = data.getUserAssessment().getIsFlatView().booleanValue();
	boolean userCanAnswerToAllQuestion = checkUserRole(data.getUserAssessment());//wdev-3709

	AssessmentQuestionGroupVoCollection existingGroups = buildExistingGroups(data);

	for (int x = 0; x < existingGroups.size(); x++)
	{
		if (existingGroups.get(x) != null)
		{
			AssessmentQuestionVoCollection existingQuestions = buildExistingQuestions(data, existingGroups.get(x));

			if (flatView)
			{
				for (int y = 0; y < existingQuestions.size(); y++)
				{
					addQuestionRow(existingQuestions.get(y), existingGroups.get(x), getInstAnswer(data, existingGroups.get(x), existingQuestions.get(y)), userCanAnswerToAllQuestion);//wdev- 3709
				}
			}
			else
			{
				addGroupRow(existingGroups.get(x), existingQuestions, data, userCanAnswerToAllQuestion);//wdev-3709
			}
		}
	}
}
 
Example 52
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionVoCollection sortQuestionsBySequence(AssessmentQuestionVoCollection questionsToBeSorted)
{
	if (questionsToBeSorted == null)
		return new AssessmentQuestionVoCollection();

	int size = questionsToBeSorted.size();
	int[] sorted = new int[size];
	for (int x = 0; x < size; x++)
	{
		sorted[x] = x;
	}

	for (int x = 0; x < size; x++)
	{
		for (int y = 0; y < size; y++)
		{
			AssessmentQuestionVo source = questionsToBeSorted.get(sorted[x]);
			AssessmentQuestionVo compare = questionsToBeSorted.get(sorted[y]);

			if (source.getSequenceIsNotNull() && compare.getSequenceIsNotNull())
			{
				if (source.getSequence().compareTo(compare.getSequence()) < 0)
				{
					int temp = sorted[x];
					sorted[x] = sorted[y];
					sorted[y] = temp;
				}
			}
		}
	}

	AssessmentQuestionVoCollection sortedQuestions = new AssessmentQuestionVoCollection();
	for (int x = 0; x < size; x++)
	{
		sortedQuestions.add(questionsToBeSorted.get(sorted[x]));
	}

	return sortedQuestions;
}
 
Example 53
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow addGroupRow(AssessmentQuestionGroupVo group, AssessmentQuestionVoCollection questions, PatientAssessmentDataVo data, boolean userCanAnswerToAllQuestion) throws PresentationLogicException
{
	checkDataIntegrity(group);

	if (group.getLegendTextIsNotNull() && group.getLegendText().trim().length() > 0)
		addGroupLegend(group);

	DynamicGridColumn column = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN);
	DynamicGridRow row = this.grid.getRows().newRow();
	row.setBackColor(Color.Beige);
	row.setBold(true);
	row.setIdentifier(new GroupRowData(group, null));
	row.setExpanded(true);

	DynamicGridCell cell = row.getCells().newCell(column, DynamicCellType.WRAPTEXT);
	cell.setValue(group.getName());
	cell.setReadOnly(true);

	if (questions != null)
	{
		for (int x = 0; x < questions.size(); x++)
		{
			if (questions.get(x).getActiveStatusIsNotNull() && (data != null || questions.get(x).getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)))
			{
				if (data == null)
				{
					//WDEV-11366
					if (!isQuestionInvalidForPatient(questions.get(x).getQuestion()))
						addQuestionRow(row, questions.get(x), group, null, userCanAnswerToAllQuestion);//wdev-3709
				}
				else
					addQuestionRow(row, questions.get(x), group, getInstAnswer(data, group, questions.get(x)), userCanAnswerToAllQuestion);//wdev-3709
			}
		}
	}

	return row;
}
 
Example 54
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private int countActiveQuestions(AssessmentQuestionVoCollection questions)
{
	if(questions == null)
		return 0;
	
	int count = 0;
	for(int x = 0; x < questions.size(); x++)
	{
		AssessmentQuestionVo question = questions.get(x);
		if(question.getActiveStatusIsNotNull() 
				&& question.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE))
			count++;
	}		
	return count;
}
 
Example 55
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private void populateQuestionsHierarchical(PatientAssessmentDataVo data) throws PresentationLogicException 
{
	if(data.getAnswerGroups() == null)
		return;		
	checkDataIntegrity(data);		
	boolean flatView = data.getUserAssessment().getIsFlatView().booleanValue();
	
	AssessmentQuestionGroupVoCollection existingGroups = buildExistingGroups(data);
	
	for(int x = 0; x < existingGroups.size(); x++)
	{
		if(existingGroups.get(x) != null)
		{
			AssessmentQuestionVoCollection existingQuestions = buildExistingQuestions(data, existingGroups.get(x));
			
			if(flatView)
			{
				for(int y = 0; y < existingQuestions.size(); y++)
				{
					addQuestionRow(existingQuestions.get(y), existingGroups.get(x), getInstAnswer(data, existingGroups.get(x), existingQuestions.get(y)));						
				}
			}
			else
			{		
				addGroupRow(existingGroups.get(x), existingQuestions, data);
			}
		}
	}
}
 
Example 56
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionVoCollection sortQuestionsBySequence(AssessmentQuestionVoCollection questionsToBeSorted)
{
	if(questionsToBeSorted == null)
		return new AssessmentQuestionVoCollection();

	int size = questionsToBeSorted.size();
	int[] sorted = new int[size];
	for(int x = 0; x < size; x++)
	{
		sorted[x] = x;
	}
	
	for(int x = 0; x < size; x++)
	{
		for(int y = 0; y < size; y++)
		{
			AssessmentQuestionVo source = questionsToBeSorted.get(sorted[x]);
			AssessmentQuestionVo compare = questionsToBeSorted.get(sorted[y]);
				
			if(source.getSequenceIsNotNull() && compare.getSequenceIsNotNull())
			{
				if(source.getSequence().compareTo(compare.getSequence()) < 0)
				{
					int temp = sorted[x]; 
					sorted[x] = sorted[y];
					sorted[y] = temp;	
				}
			}
		}
	}
	
	AssessmentQuestionVoCollection sortedQuestions = new AssessmentQuestionVoCollection();
	for(int x = 0; x < size; x++)
	{
		sortedQuestions.add(questionsToBeSorted.get(sorted[x]));
	}
	
	return sortedQuestions;
}
 
Example 57
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow addGroupRow(AssessmentQuestionGroupVo group, AssessmentQuestionVoCollection questions, PatientAssessmentDataVo data) throws PresentationLogicException
{
	checkDataIntegrity(group);		
	
	DynamicGridColumn column = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN);
	DynamicGridRow row = this.grid.getRows().newRow();		
	row.setBackColor(Color.Beige);
	row.setBold(true);
		row.setIdentifier(new GroupRowData(group, null));
	row.setExpanded(true);
	
	DynamicGridCell cell = row.getCells().newCell(column, DynamicCellType.WRAPTEXT);
	cell.setValue(group.getName());			
	cell.setReadOnly(true);	
	
	if(questions != null)
	{
		for(int x = 0; x < questions.size(); x++)
		{
			if(questions.get(x).getActiveStatusIsNotNull() 
					&& (data != null || questions.get(x).getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE)))
			{
				if(data == null)
					addQuestionRow(row, questions.get(x), group, null);
				else
					addQuestionRow(row, questions.get(x), group, getInstAnswer(data, group, questions.get(x)));
			}
		}
	}
	
	return row;
}
 
Example 58
Project: openMAXIMS   File: StructuredAssessmentsHelper.java   Source Code and License 5 votes vote down vote up
private AssessmentQuestionRoleVoCollection getQuestionRole(AssessmentQuestionVo voAssessmentQuestion, HashMap assessmentRoleMap)
{
	if (assessmentRoleMap == null)
		return null;

	AssessmentQuestionRoleVoCollection voColl = new AssessmentQuestionRoleVoCollection();

	for (int i = 0; roleVoColl != null && i < roleVoColl.size(); i++)
	{
		AssessmentRoleVo voAssessRole = roleVoColl.get(i);
		if (voAssessRole.getAnswerAllIsNotNull() && voAssessRole.getAnswerAll().booleanValue() == false)
		{
			AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) assessmentRoleMap.get(voAssessRole.getAppRole().getID_AppRole());
			if (voAssQColl != null)
			{
				if (voAssQColl.indexOf(voAssessmentQuestion) >= 0)
				{
					AssessmentQuestionRoleVo voAssessQuestionRole = new AssessmentQuestionRoleVo();
					voAssessQuestionRole.setAppRole(voAssessRole.getAppRole());
					voColl.add(voAssessQuestionRole);
				}
			}
		}
	}

	return voColl;
}
 
Example 59
Project: openMAXIMS   File: StructuredAssessmentsHelper.java   Source Code and License 5 votes vote down vote up
private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo)
{
	if (map == null || roleId == null)
		return Boolean.FALSE;

	AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId);
	if (voAssQColl != null)
	{
		int index = voAssQColl.indexOf(assessmentQuestionVo);
		if (index >= 0)
			return Boolean.TRUE;
	}

	return Boolean.FALSE;
}
 
Example 60
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean populateGroupCollectionFromScreenMultipleGroupNoFlat(UserAssessmentVo assessment)
{
	assessment.getQuestionGroups().clear();
	int seqNo = 1;
	for(int i = 0; i < form.lyrTabs().tabAssessments().dyngrdDetails().getRows().size(); i++)
	{
		DynamicGridRow row = form.lyrTabs().tabAssessments().dyngrdDetails().getRows().get(i);
		
		AssessmentQuestionGroupVo assessmentQuestionGroupVo = (AssessmentQuestionGroupVo) row.getValue();
		if(assessmentQuestionGroupVo.getQuestionsIsNotNull())
			assessmentQuestionGroupVo.getQuestions().clear();
		else
			assessmentQuestionGroupVo.setQuestions(new AssessmentQuestionVoCollection());
		
		for (int j = 0; j < row.getRows().size(); j++)
		{
			DynamicGridRow childRow = row.getRows().get(j);
			
			if(childRow.getValue() instanceof AssessmentQuestionVo)
			{
				AssessmentQuestionVo value = (AssessmentQuestionVo) childRow.getValue();
				value.setIsMandatory((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MANDATORY)).getValue());
				if(value.getIsMandatory() == null)
					value.setIsMandatory(Boolean.FALSE);
				value.setAllowsMultipleAnswers((Boolean) childRow.getCells().get(getGridColumn(COLUMN_MULTIANSWERS)).getValue());
				if(value.getAllowsMultipleAnswers() == null)
					value.setAllowsMultipleAnswers(Boolean.FALSE);
				value.setActiveStatus( (PreActiveActiveInactiveStatus) childRow.getCells().get(getGridColumn(COLUMN_STATUS)).getValue());
				value.setSequence(new Integer(seqNo++));
				value.setAssessmentAnswerRole(getQuestionRole(value));
				assessmentQuestionGroupVo.getQuestions().add(value);
			}
		}
		
		if(assessment.getQuestionGroups().contains(assessmentQuestionGroupVo) == false)
			assessment.getQuestionGroups().add(assessmentQuestionGroupVo);
	}
	
	return true;
}