Search in sources :

Example 26 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method doSearchMyCoursesStudent.

private void doSearchMyCoursesStudent(UserRequest ureq, String limitType, boolean updateFilters) {
    searchType = SearchType.myAsStudent;
    RepositoryManager rm = RepositoryManager.getInstance();
    List<RepositoryEntry> entries = rm.getLearningResourcesAsStudent(ureq.getIdentity(), null, 0, -1);
    filterRepositoryEntries(entries);
    doSearchMyRepositoryEntries(ureq, entries, limitType, updateFilters);
}
Also used : RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 27 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method doSearchByOwnerLimitTypeInternal.

private void doSearchByOwnerLimitTypeInternal(Identity owner, String[] limitTypes, boolean updateFilters) {
    searchType = SearchType.byOwner;
    RepositoryManager rm = RepositoryManager.getInstance();
    List<RepositoryEntry> entries = rm.queryByOwner(owner, limitTypes);
    filterRepositoryEntries(entries);
    if (updateFilters) {
        updateFilters(entries, owner);
    }
    repoTableModel.setObjects(entries);
    tableCtr.modelChanged(updateFilters);
    displaySearchResults(null);
}
Also used : RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 28 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class WikiEditController method getWikiReference.

/**
 * @param config the moduleConfig
 * @param strict an assertion exception is thrown if no entry is found when
 *          strict is set to true, otherwise, null is returned
 * @return the repositoryentry or null if not in strict mode and no entry
 *         found
 * @throws AssertException when in strict mode and no entry is found
 */
public static RepositoryEntry getWikiReference(ModuleConfiguration config, boolean strict) {
    if (config == null) {
        if (strict)
            throw new AssertException("missing config in Wiki");
        else
            return null;
    }
    String repoSoftkey = (String) config.get(WikiEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    if (repoSoftkey == null) {
        if (strict)
            throw new AssertException("invalid config when being asked for references");
        else
            return null;
    }
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repoSoftkey, strict);
    // entry can be null only if !strict
    return entry;
}
Also used : AssertException(org.olat.core.logging.AssertException) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 29 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class WikiEditController method getWikiRepoReference.

/**
 * @param config the moduleConfig
 * @param strict an assertion exception is thrown if no entry is found when
 *          strict is set to true, otherwise, null is returned
 * @return the repositoryentry or null if not in strict mode and no entry
 *         found
 * @throws AssertException when in strict mode and no entry is found
 */
public static RepositoryEntry getWikiRepoReference(ModuleConfiguration config, boolean strict) {
    if (config == null)
        throw new AssertException("missing config in wiki course node");
    String repoSoftkey = (String) config.get(WikiEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    if (repoSoftkey == null)
        throw new AssertException("invalid config when being asked for references");
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repoSoftkey, strict);
    // entry can be null only if !strict
    return entry;
}
Also used : AssertException(org.olat.core.logging.AssertException) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 30 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class PublishProcess method changeAccessAndProperties.

public void changeAccessAndProperties(Identity author, CourseAccessAndProperties accessAndProps) {
    RepositoryManager manager = RepositoryManager.getInstance();
    manager.setAccessAndProperties(accessAndProps.getRepositoryEntry(), accessAndProps.getAccess(), accessAndProps.isMembersOnly(), accessAndProps.isCanCopy(), accessAndProps.isCanReference(), accessAndProps.isCanDownload());
    manager.setLeaveSetting(accessAndProps.getRepositoryEntry(), accessAndProps.getSetting());
    List<OfferAccess> offerAccess = accessAndProps.getOfferAccess();
    // 1: add new and update existing offerings
    ACService acService = CoreSpringFactory.getImpl(ACService.class);
    for (OfferAccess newLink : offerAccess) {
        if (accessAndProps.getConfirmationEmail() != null) {
            Offer offer = newLink.getOffer();
            boolean confirmation = accessAndProps.getConfirmationEmail().booleanValue();
            if (offer.isConfirmationEmail() != confirmation) {
                offer.setConfirmationEmail(confirmation);
                if (offer.getKey() != null) {
                    offer = acService.save(offer);
                }
            }
        }
        acService.saveOfferAccess(newLink);
    }
    // 2: remove offerings not available anymore
    List<OfferAccess> deletedOfferAccess = accessAndProps.getDeletedOfferAccess();
    for (OfferAccess deletedLink : deletedOfferAccess) {
        acService.deletedLinkToMethod(deletedLink);
    }
    MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish");
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, repositoryEntry);
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES);
}
Also used : OfferAccess(org.olat.resource.accesscontrol.OfferAccess) Offer(org.olat.resource.accesscontrol.Offer) EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) ACService(org.olat.resource.accesscontrol.ACService) RepositoryManager(org.olat.repository.RepositoryManager) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Aggregations

RepositoryManager (org.olat.repository.RepositoryManager)136 RepositoryEntry (org.olat.repository.RepositoryEntry)122 Path (javax.ws.rs.Path)42 Identity (org.olat.core.id.Identity)32 Produces (javax.ws.rs.Produces)30 Roles (org.olat.core.id.Roles)30 RestSecurityHelper.getIdentity (org.olat.restapi.security.RestSecurityHelper.getIdentity)26 ArrayList (java.util.ArrayList)20 Consumes (javax.ws.rs.Consumes)20 PUT (javax.ws.rs.PUT)18 MailPackage (org.olat.core.util.mail.MailPackage)16 GET (javax.ws.rs.GET)14 BaseSecurity (org.olat.basesecurity.BaseSecurity)14 AssertException (org.olat.core.logging.AssertException)14 SearchRepositoryEntryParameters (org.olat.repository.model.SearchRepositoryEntryParameters)14 IdentitiesAddEvent (org.olat.admin.securitygroup.gui.IdentitiesAddEvent)12 Controller (org.olat.core.gui.control.Controller)12 OLATResourceable (org.olat.core.id.OLATResourceable)12 UserRequest (org.olat.core.gui.UserRequest)10 WindowControl (org.olat.core.gui.control.WindowControl)10