use of org.olat.core.logging.OLATRuntimeException in project openolat by klemens.
the class ModifyCourseEvent method getCourseBaseContainer.
/**
* the provided resourceableID must belong to a ICourse.getResourceableId(), otherwise you
* risk to use a wrong course base container.
* @param resourceableId
* @return
*/
public static VFSContainer getCourseBaseContainer(Long resourceableId) {
String relPath = "/course/" + resourceableId.longValue();
OlatRootFolderImpl courseRootContainer = new OlatRootFolderImpl(relPath, null);
File fBasePath = courseRootContainer.getBasefile();
if (!fBasePath.exists())
throw new OLATRuntimeException(PersistingCourseImpl.class, "Could not resolve course base path:" + courseRootContainer, null);
return courseRootContainer;
}
use of org.olat.core.logging.OLATRuntimeException in project openolat by klemens.
the class XMLParser method parse.
/**
* @param in
* @param validateXML
* @return parsed document
*/
public Document parse(InputStream in, boolean validateXML) {
Document document;
try {
SAXReader reader = new SAXReader();
reader.setEntityResolver(er);
reader.setValidation(validateXML);
document = reader.read(in, "");
document.normalize();
} catch (Exception e) {
throw new OLATRuntimeException(XMLParser.class, "Exception reading XML", e);
}
return document;
}
use of org.olat.core.logging.OLATRuntimeException in project openolat by klemens.
the class XStreamHelper method readObject.
/**
* Read an object from the given leaf using the xStream object. It is
* usefull to add field and attribute mappers to the stream.
*
* @param xStream
* The (configured) xStream.
* @param file
* @return
*/
public static Object readObject(XStream xStream, VFSLeaf file) {
InputStream fis = null;
BufferedInputStream bis = null;
try {
fis = file.getInputStream();
bis = new BufferedInputStream(fis);
return readObject(xStream, bis);
} catch (Exception e) {
throw new OLATRuntimeException(XStreamHelper.class, "could not read Object from file: " + file.getName(), e);
} finally {
try {
if (fis != null)
fis.close();
if (bis != null)
bis.close();
} catch (Exception e) {
// we did our best to close the inputStream
}
}
}
use of org.olat.core.logging.OLATRuntimeException in project openolat by klemens.
the class MSCourseNode method getMaxScoreConfiguration.
/**
* @see org.olat.course.nodes.AssessableCourseNode#getMaxScoreConfiguration()
*/
@Override
public Float getMaxScoreConfiguration() {
if (!hasScoreConfigured()) {
throw new OLATRuntimeException(MSCourseNode.class, "getMaxScore not defined when hasScore set to false", null);
}
ModuleConfiguration config = getModuleConfiguration();
Float max = (Float) config.get(CONFIG_KEY_SCORE_MAX);
return max;
}
use of org.olat.core.logging.OLATRuntimeException in project openolat by klemens.
the class PortfolioCourseNode method getCutValueConfiguration.
@Override
public Float getCutValueConfiguration() {
if (!hasPassedConfigured()) {
throw new OLATRuntimeException(PortfolioCourseNode.class, "getCutValue not defined when hasPassed set to false", null);
}
ModuleConfiguration config = getModuleConfiguration();
Float cut = (Float) config.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
return cut;
}
Aggregations