use of org.olat.core.util.FileNameSuffixFilter in project OpenOLAT by OpenOLAT.
the class ProjectBrokerCourseNode method postImport.
@Override
public void postImport(File importDirectory, ICourse course, CourseEnvironmentMapper envMapper, Processing processType) {
// initialize managers
if (processType == Processing.editor && importDirectory != null) {
ProjectBrokerManager projectBrokerManager = CoreSpringFactory.getImpl(ProjectBrokerManager.class);
CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
// create a new projectBroker
ProjectBroker projectBroker = projectBrokerManager.createAndSaveProjectBroker();
projectBrokerManager.saveProjectBrokerId(projectBroker.getKey(), cpm, this);
// get the node folder inside of the importDirectory
File folderNodeData = new File(importDirectory, getIdent());
// for the broker prefs
File projectBrokerFile = new File(folderNodeData, "projectbroker.xml");
if (projectBrokerFile.exists()) {
XStream xstream = XStreamHelper.createXStreamInstance();
ProjectGroupManager projectGroupManager = CoreSpringFactory.getImpl(ProjectGroupManager.class);
ProjectBrokerConfig brokerConfig = (ProjectBrokerConfig) XStreamHelper.readObject(xstream, projectBrokerFile);
if (brokerConfig != null && brokerConfig.getAccountGroupKey() != null) {
Long accountGroupKey = envMapper.toGroupKeyFromOriginalKey(brokerConfig.getAccountGroupKey());
if (accountGroupKey != null) {
projectGroupManager.saveAccountManagerGroupKey(accountGroupKey, cpm, this);
}
}
}
// loop through the project directories
if (folderNodeData.exists()) {
for (File projectDir : folderNodeData.listFiles(DirectoryFilter.DIRECTORY_FILTER)) {
for (File projectFile : projectDir.listFiles(new FileNameSuffixFilter("xml"))) {
importProject(projectDir, projectFile, projectBroker, course, envMapper);
}
}
}
}
super.postImport(importDirectory, course, envMapper, processType);
}
use of org.olat.core.util.FileNameSuffixFilter in project openolat by klemens.
the class ProjectBrokerCourseNode method postImport.
@Override
public void postImport(File importDirectory, ICourse course, CourseEnvironmentMapper envMapper, Processing processType) {
// initialize managers
if (processType == Processing.editor && importDirectory != null) {
ProjectBrokerManager projectBrokerManager = CoreSpringFactory.getImpl(ProjectBrokerManager.class);
CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
// create a new projectBroker
ProjectBroker projectBroker = projectBrokerManager.createAndSaveProjectBroker();
projectBrokerManager.saveProjectBrokerId(projectBroker.getKey(), cpm, this);
// get the node folder inside of the importDirectory
File folderNodeData = new File(importDirectory, getIdent());
// for the broker prefs
File projectBrokerFile = new File(folderNodeData, "projectbroker.xml");
if (projectBrokerFile.exists()) {
XStream xstream = XStreamHelper.createXStreamInstance();
ProjectGroupManager projectGroupManager = CoreSpringFactory.getImpl(ProjectGroupManager.class);
ProjectBrokerConfig brokerConfig = (ProjectBrokerConfig) XStreamHelper.readObject(xstream, projectBrokerFile);
if (brokerConfig != null && brokerConfig.getAccountGroupKey() != null) {
Long accountGroupKey = envMapper.toGroupKeyFromOriginalKey(brokerConfig.getAccountGroupKey());
if (accountGroupKey != null) {
projectGroupManager.saveAccountManagerGroupKey(accountGroupKey, cpm, this);
}
}
}
// loop through the project directories
if (folderNodeData.exists()) {
for (File projectDir : folderNodeData.listFiles(DirectoryFilter.DIRECTORY_FILTER)) {
for (File projectFile : projectDir.listFiles(new FileNameSuffixFilter("xml"))) {
importProject(projectDir, projectFile, projectBroker, course, envMapper);
}
}
}
}
super.postImport(importDirectory, course, envMapper, processType);
}
Aggregations