Search in sources :

Example 11 with Mark

use of org.olat.core.commons.services.mark.Mark in project OpenOLAT by OpenOLAT.

the class BookmarksPortletRunController method convertMarkToBookmark.

private List<Bookmark> convertMarkToBookmark(List<Mark> items) {
    List<Bookmark> convertedList = new ArrayList<Bookmark>();
    List<Long> reKeys = new ArrayList<Long>();
    for (Mark mark : items) {
        reKeys.add(mark.getOLATResourceable().getResourceableId());
    }
    List<RepositoryEntry> repositoryEntries = repositoryManager.lookupRepositoryEntries(reKeys);
    Map<Long, RepositoryEntry> keyToRepositoryEntryMap = new HashMap<Long, RepositoryEntry>();
    for (RepositoryEntry repositoryEntry : repositoryEntries) {
        keyToRepositoryEntryMap.put(repositoryEntry.getKey(), repositoryEntry);
    }
    for (Mark mark : items) {
        RepositoryEntry repositoryEntry = keyToRepositoryEntryMap.get(mark.getOLATResourceable().getResourceableId());
        if (repositoryEntry != null) {
            convertedList.add(new Bookmark(mark, repositoryEntry));
        }
    }
    return convertedList;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Mark(org.olat.core.commons.services.mark.Mark) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 12 with Mark

use of org.olat.core.commons.services.mark.Mark in project openolat by klemens.

the class BookmarksPortletRunController method convertMarkToBookmark.

private List<Bookmark> convertMarkToBookmark(List<Mark> items) {
    List<Bookmark> convertedList = new ArrayList<Bookmark>();
    List<Long> reKeys = new ArrayList<Long>();
    for (Mark mark : items) {
        reKeys.add(mark.getOLATResourceable().getResourceableId());
    }
    List<RepositoryEntry> repositoryEntries = repositoryManager.lookupRepositoryEntries(reKeys);
    Map<Long, RepositoryEntry> keyToRepositoryEntryMap = new HashMap<Long, RepositoryEntry>();
    for (RepositoryEntry repositoryEntry : repositoryEntries) {
        keyToRepositoryEntryMap.put(repositoryEntry.getKey(), repositoryEntry);
    }
    for (Mark mark : items) {
        RepositoryEntry repositoryEntry = keyToRepositoryEntryMap.get(mark.getOLATResourceable().getResourceableId());
        if (repositoryEntry != null) {
            convertedList.add(new Bookmark(mark, repositoryEntry));
        }
    }
    return convertedList;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Mark(org.olat.core.commons.services.mark.Mark) RepositoryEntry(org.olat.repository.RepositoryEntry)

Aggregations

Mark (org.olat.core.commons.services.mark.Mark)12 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)8 MarkResourceStat (org.olat.core.commons.services.mark.MarkResourceStat)6 RepositoryEntry (org.olat.repository.RepositoryEntry)4 HashSet (java.util.HashSet)2 Component (org.olat.core.gui.components.Component)2 Link (org.olat.core.gui.components.link.Link)2 LinkPopupSettings (org.olat.core.gui.components.link.LinkPopupSettings)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 DialogBoxController (org.olat.core.gui.control.generic.modal.DialogBoxController)2 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 VFSItemMetaFilter (org.olat.core.util.vfs.filters.VFSItemMetaFilter)2 MessageLight (org.olat.modules.fo.MessageLight)2