use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class QTIQPoolServiceProvider method importRepositoryEntry.
public List<QuestionItem> importRepositoryEntry(Identity owner, RepositoryEntry repositoryEntry, Locale defaultLocale) {
OLATResourceable ores = repositoryEntry.getOlatResource();
FileResourceManager frm = FileResourceManager.getInstance();
File testFile = frm.getFileResource(ores);
List<QuestionItem> importedItem = importItems(owner, defaultLocale, testFile.getName(), testFile);
if (importedItem != null && importedItem.size() > 0) {
dbInstance.getCurrentEntityManager().flush();
}
return importedItem;
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method getDeliveryOptions.
@Override
public BinderDeliveryOptions getDeliveryOptions(OLATResource resource) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(resource);
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
BinderDeliveryOptions config;
if (configXml.exists()) {
config = (BinderDeliveryOptions) configXstream.fromXML(configXml);
} else {
// set default config
config = BinderDeliveryOptions.defaultOptions();
setDeliveryOptions(resource, config);
}
return config;
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class CPManagerImpl method getCPPackageConfig.
@Override
public CPPackageConfig getCPPackageConfig(OLATResourceable ores) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(ores);
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
CPPackageConfig config;
if (configXml.exists()) {
config = (CPPackageConfig) configXstream.fromXML(configXml);
} else {
// set default config
config = new CPPackageConfig();
config.setDeliveryOptions(DeliveryOptions.defaultWithGlossary());
setCPPackageConfig(ores, config);
}
return config;
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class CPManagerImpl method setCPPackageConfig.
@Override
public void setCPPackageConfig(OLATResourceable ores, CPPackageConfig config) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(ores);
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
if (config == null) {
if (configXml.exists()) {
configXml.delete();
}
} else {
OutputStream out = null;
try {
out = new FileOutputStream(configXml);
configXstream.toXML(config, out);
} catch (IOException e) {
log.error("", e);
} finally {
IOUtils.closeQuietly(out);
}
}
}
use of org.olat.fileresource.FileResourceManager in project OpenOLAT by OpenOLAT.
the class ScormMainManager method setScormPackageConfig.
public void setScormPackageConfig(OLATResourceable ores, ScormPackageConfig config) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(ores);
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
if (config == null) {
if (configXml.exists()) {
configXml.delete();
}
} else {
OutputStream out = null;
try {
out = new FileOutputStream(configXml);
configXstream.toXML(config, out);
} catch (IOException e) {
log.error("", e);
} finally {
IOUtils.closeQuietly(out);
}
}
}
Aggregations