use of org.olat.ims.qti.QTIResult in project openolat by klemens.
the class QTIExportManager method selectAndExportResults.
/**
* @param locale
* @param olatResource
* @param shortTitle
* @param olatResourceDetail
* @param repositoryRef
* @param type
* @param exportDirectory
* @param anonymizerCallback callback that should be used to anonymize the user names or NULL if row counter
* should be used (only for type 2 and 3)
* @return
*/
public boolean selectAndExportResults(QTIExportFormatter qef, Long courseResId, String shortTitle, String olatResourceDetail, Long testReKey, File exportDirectory, String charset, String fileNameSuffix) {
boolean resultsFoundAndExported = false;
QTIResultManager qrm = QTIResultManager.getInstance();
List<QTIResult> results = qrm.selectResults(courseResId, olatResourceDetail, testReKey, null, qef.getType());
if (results.size() > 0) {
QTIResult res0 = results.get(0);
List<QTIItemObject> qtiItemObjectList = new QTIObjectTreeBuilder().getQTIItemObjectList(new Long(res0.getResultSet().getRepositoryRef()));
qef.setQTIItemObjectList(qtiItemObjectList);
if (results.size() > 0) {
createContentOfExportFile(results, qtiItemObjectList, qef);
writeContentToFile(shortTitle, exportDirectory, charset, qef, fileNameSuffix);
resultsFoundAndExported = true;
}
}
return resultsFoundAndExported;
}
use of org.olat.ims.qti.QTIResult in project openolat by klemens.
the class QTIExportManager method createContentOfExportFile.
/**
* @param locale Locale used for export file headers / default values
* @param results
* @param type
* @param anonymizerCallback
* @return String
*/
private void createContentOfExportFile(List<QTIResult> qtiResults, List<QTIItemObject> qtiItemObjectList, QTIExportFormatter qef) {
qef.openReport();
// formatter has information about how to format the different qti objects
Map<Class<?>, QTIExportItemFormatConfig> mapWithConfigs = qef.getMapWithExportItemConfigs();
QTIExportItemFactory qeif = new QTIExportItemFactory(mapWithConfigs);
while (qtiResults.size() > 0) {
List<QTIResult> assessIDresults = stripNextAssessID(qtiResults);
qef.openResultSet(new QTIExportSet(assessIDresults.get(0)));
for (QTIItemObject element : qtiItemObjectList) {
QTIResult qtir = element.extractQTIResult(assessIDresults);
qef.visit(qeif.getExportItem(qtir, element));
}
qef.closeResultSet();
}
qef.closeReport();
}
Aggregations