use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.
the class BlogCourseNode method importNode.
@Override
public void importNode(File importDirectory, ICourse course, Identity owner, Locale locale, boolean withReferences) {
if (withReferences) {
RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(BlogFileResource.TYPE_NAME);
importFeed(handler, importDirectory, owner, locale);
} else {
FeedNodeEditController.removeReference(getModuleConfiguration());
}
}
use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.
the class CPCourseNode method importNode.
@Override
public void importNode(File importDirectory, ICourse course, Identity owner, Locale locale, boolean withReferences) {
RepositoryEntryImportExport rie = new RepositoryEntryImportExport(importDirectory, getIdent());
if (withReferences && rie.anyExportedPropertiesAvailable()) {
RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(ImsCPFileResource.TYPE_NAME);
RepositoryEntry re = handler.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, rie.importGetExportedFile(), null);
CPEditController.setCPReference(re, getModuleConfiguration());
} else {
CPEditController.removeCPReference(getModuleConfiguration());
}
}
use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.
the class ReferencableEntriesSearchController method event.
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == segmentView) {
if (event instanceof SegmentViewEvent) {
SegmentViewEvent sve = (SegmentViewEvent) event;
String segmentCName = sve.getComponentName();
Component clickedLink = mainVC.getComponent(segmentCName);
if (clickedLink == myEntriesLink) {
searchCtr.doSearchByOwnerLimitType(ureq.getIdentity(), limitTypes);
} else if (clickedLink == allEntriesLink) {
switch(canBe) {
case referenceable:
searchCtr.doSearchForReferencableResourcesLimitType(ureq.getIdentity(), limitTypes, ureq.getUserSession().getRoles());
break;
case copyable:
searchCtr.doSearchForCopyableResourcesLimitType(ureq.getIdentity(), limitTypes, ureq.getUserSession().getRoles());
break;
case all:
searchCtr.doSearchByTypeLimitAccess(limitTypes, ureq);
break;
}
} else if (clickedLink == searchEntriesLink) {
searchCtr.displaySearchForm();
} else if (clickedLink == adminEntriesLink) {
searchCtr.displayAdminSearchForm();
}
mainVC.setDirty(true);
}
} else if (source == createRessourceCmp || (source instanceof Link && ((Link) source).getUserObject() instanceof RepositoryHandler)) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(createController);
RepositoryHandler handler = (RepositoryHandler) ((Link) source).getUserObject();
createController = handler.createCreateRepositoryEntryController(ureq, getWindowControl());
listenTo(createController);
String title = translate(handler.getCreateLabelI18nKey());
cmc = new CloseableModalController(getWindowControl(), translate("close"), createController.getInitialComponent(), true, title);
cmc.setCustomWindowCSS("o_sel_author_create_popup");
listenTo(cmc);
cmc.activate();
} else if (source == importRessourceButton) {
removeAsListenerAndDispose(importController);
importController = new ImportRepositoryEntryController(ureq, getWindowControl(), limitTypes);
listenTo(importController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), importController.getInitialComponent(), true, "");
listenTo(cmc);
cmc.activate();
}
}
use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.
the class RepositoryServiceImpl method deletePermanently.
@Override
public ErrorList deletePermanently(RepositoryEntry entry, Identity identity, Roles roles, Locale locale) {
ErrorList errors = new ErrorList();
boolean debug = log.isDebug();
// invoke handler delete callback
if (debug)
log.debug("deleteRepositoryEntry start entry=" + entry);
entry = (RepositoryEntry) dbInstance.loadObject(entry, true);
if (debug)
log.debug("deleteRepositoryEntry after load entry=" + entry);
RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(entry);
OLATResource resource = entry.getOlatResource();
// delete old context
if (!handler.readyToDelete(entry, identity, roles, locale, errors)) {
return errors;
}
userCourseInformationsManager.deleteUserCourseInformations(entry);
certificatesManager.deleteRepositoryEntry(entry);
// delete all bookmarks referencing deleted entry
CoreSpringFactory.getImpl(MarkManager.class).deleteMarks(entry);
// delete all catalog entries referencing deleted entry
catalogManager.resourceableDeleted(entry);
// delete assessment modes
assessmentModeDao.delete(entry);
// delete reminders
reminderDao.delete(entry);
// delete all policies
securityManager.deletePolicies(resource);
// delete reservations
reservationDao.deleteReservations(resource);
// delete references
referenceManager.deleteAllReferencesOf(resource);
// delete all pending tasks
persistentTaskDao.delete(resource);
dbInstance.commit();
// delete lectures
CoreSpringFactory.getImpl(LectureService.class).delete(entry);
dbInstance.commit();
// delete license
CoreSpringFactory.getImpl(LicenseService.class).delete(resource);
dbInstance.commit();
// detach portfolio if there are some lost
CoreSpringFactory.getImpl(PortfolioService.class).detachCourseFromBinders(entry);
dbInstance.commit();
// inform handler to do any cleanup work... handler must delete the
// referenced resourceable a swell.
handler.cleanupOnDelete(entry, resource);
dbInstance.commit();
// delete all test sessions
assessmentTestSessionDao.deleteAllUserTestSessionsByCourse(entry);
// nullify the reference
assessmentEntryDao.removeEntryForReferenceEntry(entry);
assessmentEntryDao.deleteEntryForRepositoryEntry(entry);
dbInstance.commit();
if (debug)
log.debug("deleteRepositoryEntry after reload entry=" + entry);
deleteRepositoryEntryAndBaseGroups(entry);
if (debug)
log.debug("deleteRepositoryEntry Done");
return errors;
}
use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.
the class RepositoryServiceImpl method getIntroductionMovie.
@Override
public VFSLeaf getIntroductionMovie(RepositoryEntry re) {
RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(re);
VFSContainer mediaContainer = handler.getMediaContainer(re);
if (mediaContainer != null) {
List<VFSItem> items = mediaContainer.getItems();
for (VFSItem item : items) {
if (item instanceof VFSLeaf && item.getName().startsWith(re.getKey().toString()) && (item.getName().endsWith(".mp4") || item.getName().endsWith(".m4v") || item.getName().endsWith(".flv"))) {
return (VFSLeaf) item;
}
}
}
return null;
}
Aggregations