use of org.olat.modules.qpool.manager.QItemTypeDAO in project openolat by klemens.
the class QTI12To21Converter method convertItem.
/**
* @param item
* @return The name of the assesssmentItem file
*/
private boolean convertItem(QuestionItemImpl convertedQuestion, Item item) {
QItemTypeDAO qItemTypeDao = CoreSpringFactory.getImpl(QItemTypeDAO.class);
AssessmentItemBuilder itemBuilder = null;
int questionType = item.getQuestion().getType();
switch(questionType) {
case Question.TYPE_SC:
itemBuilder = convertSingleChoice(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.SC.name()));
break;
case Question.TYPE_MC:
itemBuilder = convertMultipleChoice(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.MC.name()));
break;
case Question.TYPE_KPRIM:
itemBuilder = convertKPrim(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.KPRIM.name()));
break;
case Question.TYPE_FIB:
itemBuilder = convertFIB(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.FIB.name()));
break;
case Question.TYPE_ESSAY:
itemBuilder = convertEssay(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.ESSAY.name()));
break;
}
if (itemBuilder != null) {
itemBuilder.build();
AssessmentItem assessmentItem = itemBuilder.getAssessmentItem();
String itemId = IdentifierGenerator.newAsString(itemBuilder.getQuestionType().getPrefix());
File itemFile = new File(unzippedDirRoot, itemId + ".xml");
persistAssessmentObject(itemFile, assessmentItem);
appendResourceAndMetadata(item, itemBuilder, itemFile);
convertedQuestion.setRootFilename(itemFile.getName());
return true;
}
return false;
}
use of org.olat.modules.qpool.manager.QItemTypeDAO in project OpenOLAT by OpenOLAT.
the class QTI12To21Converter method convertItem.
/**
* @param item
* @return The name of the assesssmentItem file
*/
private boolean convertItem(QuestionItemImpl convertedQuestion, Item item) {
QItemTypeDAO qItemTypeDao = CoreSpringFactory.getImpl(QItemTypeDAO.class);
AssessmentItemBuilder itemBuilder = null;
int questionType = item.getQuestion().getType();
switch(questionType) {
case Question.TYPE_SC:
itemBuilder = convertSingleChoice(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.SC.name()));
break;
case Question.TYPE_MC:
itemBuilder = convertMultipleChoice(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.MC.name()));
break;
case Question.TYPE_KPRIM:
itemBuilder = convertKPrim(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.KPRIM.name()));
break;
case Question.TYPE_FIB:
itemBuilder = convertFIB(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.FIB.name()));
break;
case Question.TYPE_ESSAY:
itemBuilder = convertEssay(item);
convertedQuestion.setType(qItemTypeDao.loadByType(QuestionType.ESSAY.name()));
break;
}
if (itemBuilder != null) {
itemBuilder.build();
AssessmentItem assessmentItem = itemBuilder.getAssessmentItem();
String itemId = IdentifierGenerator.newAsString(itemBuilder.getQuestionType().getPrefix());
File itemFile = new File(unzippedDirRoot, itemId + ".xml");
persistAssessmentObject(itemFile, assessmentItem);
appendResourceAndMetadata(item, itemBuilder, itemFile);
convertedQuestion.setRootFilename(itemFile.getName());
return true;
}
return false;
}
Aggregations