use of org.olat.modules.scorm.server.servermodels.ScoDocument in project openolat by klemens.
the class ScormAssessmentManager method collectData.
/**
* Collects the cmi data of the given Scorm-file.
* @param scoFile
* @return
*/
private List<CmiData> collectData(VFSItem scoFile) {
List<CmiData> datas = new ArrayList<CmiData>();
ScoDocument document = new ScoDocument(null);
try {
if (scoFile instanceof LocalFileImpl) {
document.loadDocument(((LocalFileImpl) scoFile).getBasefile());
} else {
logger.warn("Cannot use this type of VSFItem to load a SCO Datamodel: " + scoFile.getClass().getName(), null);
return null;
}
String fileName = scoFile.getName();
String itemId = fileName.substring(0, fileName.length() - 4);
String[][] scoModel = document.getScoModel();
for (String[] line : scoModel) {
datas.add(new CmiData(itemId, line[0], line[1]));
}
} catch (Exception e) {
logger.error("Cannot load a SCO Datamodel", e);
}
return datas;
}
Aggregations