File courseExportData = ImportCourseController.getExportDataDir(course);
// get the export data directory
// create the repository entry
RepositoryManager rm = RepositoryManager.getInstance();
RepositoryEntry re = rm.createRepositoryEntryInstance("administrator");
RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(courseExportData);
String softKey = importExport.getSoftkey();
RepositoryEntry existingEntry = rm.lookupRepositoryEntryBySoftkey(softKey, false);
if (existingEntry != null) {
Tracing.logInfo("RepositoryEntry with softkey " + softKey + " already exists. Course will not be deployed.", CourseFactory.class);
CourseFactory.deleteCourse(newCourseResource);
return existingEntry;
}
// ok, continue import
newCourseResource = OLATResourceManager.getInstance().findOrPersistResourceable(newCourseResource);
re.setOlatResource(newCourseResource);
re.setSoftkey(softKey);
re.setInitialAuthor(importExport.getInitialAuthor());
re.setDisplayname(importExport.getDisplayName());
re.setResourcename(importExport.getResourceName());
re.setDescription(importExport.getDescription());
re.setCanLaunch(true);
// set access configuration
re.setAccess(access);