use of org.olat.core.gui.control.generic.portal.PortletEntry in project openolat by klemens.
the class RepositoryPortletRunController method convertShortRepositoryEntriesToPortletEntryList.
private List<PortletEntry<RepositoryEntryLight>> convertShortRepositoryEntriesToPortletEntryList(List<RepositoryEntryLight> items) {
List<PortletEntry<RepositoryEntryLight>> convertedList = new ArrayList<PortletEntry<RepositoryEntryLight>>();
for (RepositoryEntryLight item : items) {
boolean closed = RepositoryManager.getInstance().createRepositoryEntryStatus(item.getStatusCode()).isClosed();
if (!closed) {
RepositoryPortletEntry entry = new RepositoryPortletEntry(item);
convertedList.add(entry);
}
}
return convertedList;
}
use of org.olat.core.gui.control.generic.portal.PortletEntry in project openolat by klemens.
the class InfoMessagePortletRunController method reloadModel.
@Override
protected void reloadModel(SortingCriteria criteria) {
List<SubscriptionInfo> infos = NotificationsManager.getInstance().getSubscriptionInfos(getIdentity(), "InfoMessage");
List<InfoSubscriptionItem> items = new ArrayList<InfoSubscriptionItem>();
for (SubscriptionInfo info : infos) {
for (SubscriptionListItem item : info.getSubscriptionListItems()) {
items.add(new InfoSubscriptionItem(info, item));
}
}
items = getSortedList(items, criteria);
List<PortletEntry<InfoSubscriptionItem>> entries = convertToPortletEntryList(items);
InfosTableModel model = new InfosTableModel(entries);
tableController.setTableDataModel(model);
}
use of org.olat.core.gui.control.generic.portal.PortletEntry in project openolat by klemens.
the class NotificationsPortletRunController method reloadModel.
/**
* @see org.olat.core.gui.control.generic.portal.AbstractPortletRunController#reloadModel(org.olat.core.gui.UserRequest, org.olat.core.gui.control.generic.portal.SortingCriteria)
*/
protected void reloadModel(SortingCriteria sortingCriteria) {
if (sortingCriteria.getSortingType() == SortingCriteria.AUTO_SORTING) {
Map<Subscriber, SubscriptionInfo> subscriptionMap = NotificationHelper.getSubscriptionMap(getIdentity(), getLocale(), true, compareDate);
notificationsList = new ArrayList<Subscriber>();
for (Iterator<Map.Entry<Subscriber, SubscriptionInfo>> it_subs = subscriptionMap.entrySet().iterator(); it_subs.hasNext(); ) {
Map.Entry<Subscriber, SubscriptionInfo> sInfo = it_subs.next();
Subscriber subscrer = sInfo.getKey();
SubscriptionInfo infos = sInfo.getValue();
if (infos.hasNews()) {
notificationsList.add(subscrer);
}
}
notificationsList = getSortedList(notificationsList, sortingCriteria);
List<PortletEntry<Subscriber>> entries = convertNotificationToPortletEntryList(notificationsList);
notificationListModel = new NotificationsPortletTableDataModel(entries, getLocale(), subscriptionMap);
tableCtr.setTableDataModel(notificationListModel);
} else {
reloadModel(getPersistentManuallySortedItems());
}
}
use of org.olat.core.gui.control.generic.portal.PortletEntry in project openolat by klemens.
the class GroupsPortletRunController method getPersistentManuallySortedItems.
/**
* Retrieves the persistent manually sorted items for the current portlet.
* @param ureq
* @return
*/
private List<PortletEntry<BusinessGroupEntry>> getPersistentManuallySortedItems() {
@SuppressWarnings("unchecked") Map<Long, Integer> storedPrefs = (Map<Long, Integer>) guiPreferences.get(Map.class, getPreferenceKey(SORTED_ITEMS_PREF));
List<PortletEntry<BusinessGroupEntry>> portletEntryList;
if (storedPrefs != null) {
SearchBusinessGroupParams params = new SearchBusinessGroupParams(getIdentity(), true, true);
params.setGroupKeys(storedPrefs.keySet());
List<BusinessGroup> groups = businessGroupService.findBusinessGroups(params, null, 0, -1);
portletEntryList = convertBusinessGroupToPortletEntryList(groups, false);
} else {
List<BusinessGroup> groups = new ArrayList<BusinessGroup>();
portletEntryList = convertShortBusinessGroupToPortletEntryList(groups, false);
}
return getPersistentManuallySortedItems(portletEntryList);
}
use of org.olat.core.gui.control.generic.portal.PortletEntry in project openolat by klemens.
the class GroupsPortletRunController method convertBusinessGroupToPortletEntryList.
private List<PortletEntry<BusinessGroupEntry>> convertBusinessGroupToPortletEntryList(List<BusinessGroup> groups, boolean withDescription) {
List<PortletEntry<BusinessGroupEntry>> convertedList = new ArrayList<PortletEntry<BusinessGroupEntry>>();
for (BusinessGroup group : groups) {
GroupPortletEntry entry = new GroupPortletEntry(group);
if (withDescription) {
entry.getValue().setDescription(group.getDescription());
}
convertedList.add(entry);
}
return convertedList;
}
Aggregations