use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method setDeliveryOptions.
@Override
public void setDeliveryOptions(RepositoryEntry testEntry, QTI21DeliveryOptions options) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(testEntry.getOlatResource());
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
if (options == null) {
if (configXml.exists()) {
configXml.delete();
}
} else {
try (OutputStream out = new FileOutputStream(configXml)) {
configXstream.toXML(options, out);
} catch (IOException e) {
log.error("", e);
}
}
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method needManualCorrection.
@Override
public boolean needManualCorrection(RepositoryEntry testEntry) {
FileResourceManager frm = FileResourceManager.getInstance();
File fUnzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = loadAndResolveAssessmentTest(fUnzippedDirRoot, false, false);
return AssessmentTestHelper.needManualCorrection(resolvedAssessmentTest);
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method setDeliveryOptions.
@Override
public void setDeliveryOptions(OLATResource resource, BinderDeliveryOptions options) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(resource);
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
if (options == null) {
if (configXml.exists()) {
configXml.delete();
}
} else {
try (OutputStream out = new FileOutputStream(configXml)) {
configXstream.toXML(options, out);
} catch (IOException e) {
log.error("", e);
}
}
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class QTI21EditForm method update.
protected void update(RepositoryEntry testEntry) {
Double minValue = null;
Double maxValue = null;
Double cutValue = null;
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
if (assessmentTest != null) {
AssessmentTestBuilder testBuilder = new AssessmentTestBuilder(assessmentTest);
maxValue = testBuilder.getMaxScore();
cutValue = testBuilder.getCutValue();
if (maxValue != null && "OpenOLAT".equals(assessmentTest.getToolName())) {
minValue = 0d;
}
}
// Put values to module configuration
minScoreEl.setValue(minValue == null ? "" : AssessmentHelper.getRoundedScore(minValue));
minScoreEl.setVisible(minValue != null);
maxScoreEl.setValue(maxValue == null ? "" : AssessmentHelper.getRoundedScore(maxValue));
maxScoreEl.setVisible(maxValue != null);
cutValueEl.setValue(cutValue == null ? "" : AssessmentHelper.getRoundedScore(cutValue));
cutValueEl.setVisible(cutValue != null);
update();
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class QTIEditorPackageImpl method unzipPackage.
/**
* Unzip package into temporary directory.
* @return true if successfull, false otherwise
*/
private boolean unzipPackage() {
FileResourceManager frm = FileResourceManager.getInstance();
File fPackageZIP = frm.getFileResource(fileResource);
return ZipUtil.unzip(fPackageZIP, packageDir);
}
Aggregations