use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.
the class UserCourseInformationsManagerTest method updateInitialLaunchDates_loop.
/**
* This test is to analyze a red screen
*/
@Test
public void updateInitialLaunchDates_loop() {
Identity user = JunitTestHelper.createAndPersistIdentityAsUser("user-launch-5-" + UUID.randomUUID().toString());
ICourse course = CoursesWebService.createEmptyCourse(user, "course-launch-dates", "course long name", null);
dbInstance.commitAndCloseSession();
for (int i = 0; i < 10; i++) {
OLATResource courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseResource();
userCourseInformationsManager.updateUserCourseInformations(courseResource, user);
}
dbInstance.commitAndCloseSession();
List<Identity> users = Collections.singletonList(user);
OLATResource courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseResource();
Map<Long, Date> launchDates = userCourseInformationsManager.getInitialLaunchDates(courseResource, users);
Assert.assertNotNull(launchDates);
Assert.assertEquals(1, launchDates.size());
Assert.assertTrue(launchDates.containsKey(user.getKey()));
Assert.assertNotNull(launchDates.get(user.getKey()));
}
use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.
the class EditorUserCourseEnvironmentImpl method getLifecycle.
@Override
public RepositoryEntryLifecycle getLifecycle() {
if (lifecycle == null) {
CourseGroupManager cgm = courseEditorEnv.getCourseGroupManager();
OLATResource courseResource = cgm.getCourseResource();
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(courseResource, false);
if (re != null) {
lifecycle = re.getLifecycle();
}
}
return lifecycle;
}
use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.
the class QTIPreWarm method run.
@Override
public void run() {
long start = System.nanoTime();
log.info("Start scanning for QTI resources");
List<String> types = new ArrayList<>(2);
types.add(TestFileResource.TYPE_NAME);
types.add(SurveyFileResource.TYPE_NAME);
List<OLATResource> qtiResources = olatResourceManager.findResourceByTypes(types);
dbInstance.commitAndCloseSession();
for (OLATResource qtiResource : qtiResources) {
OnyxModule.isOnyxTest(qtiResource);
}
log.info(qtiResources.size() + " QTI Resources scanned in (ms): " + CodeHelper.nanoToMilliTime(start));
}
use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.
the class ScormCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, NODE_TYPE);
Document nodeDocument = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(nodeDocument);
RepositoryEntry repoEntry = courseNode.getReferencedRepositoryEntry();
if (repoEntry != null) {
OLATResource ores = repoEntry.getOlatResource();
File cpRoot = FileResourceManager.getInstance().unzipFileResource(ores);
doIndex(courseNodeResourceContext, indexWriter, cpRoot);
}
}
use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.
the class PortfolioRepositoryIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext resourceContext, Object object, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (!portfolioModule.isEnabled())
return;
if (isLogDebugEnabled())
logDebug("Index portfolio templates...");
RepositoryEntry repositoryEntry = (RepositoryEntry) object;
OLATResource ores = repositoryEntry.getOlatResource();
PortfolioStructure element = structureManager.loadPortfolioStructure(ores);
// only index templates
if (element instanceof EPStructuredMapTemplate) {
resourceContext.setDocumentType(TYPE);
resourceContext.setParentContextType(TYPE);
resourceContext.setParentContextName(repositoryEntry.getDisplayname());
resourceContext.setFilePath(element.getKey().toString());
Document document = PortfolioMapDocument.createDocument(resourceContext, element);
indexWriter.addDocument(document);
}
}
Aggregations