use of de.bps.course.nodes.DENCourseNode in project openolat by klemens.
the class DENCourseNodeNotificationHandler method getCourseDENNodes.
/**
* @param course
* @return
*/
private List<DENCourseNode> getCourseDENNodes(ICourse course) {
List<DENCourseNode> denNodes = new ArrayList<DENCourseNode>(10);
Structure courseStruct = course.getRunStructure();
CourseNode rootNode = courseStruct.getRootNode();
getCourseDENNodes(rootNode, denNodes);
return denNodes;
}
use of de.bps.course.nodes.DENCourseNode in project OpenOLAT by OpenOLAT.
the class DENCourseNodeNotificationHandler method getCourseDENNodes.
/**
* @param course
* @return
*/
private List<DENCourseNode> getCourseDENNodes(ICourse course) {
List<DENCourseNode> denNodes = new ArrayList<DENCourseNode>(10);
Structure courseStruct = course.getRunStructure();
CourseNode rootNode = courseStruct.getRootNode();
getCourseDENNodes(rootNode, denNodes);
return denNodes;
}
use of de.bps.course.nodes.DENCourseNode in project OpenOLAT by OpenOLAT.
the class DENCourseNodeNotificationHandler method createSubscriptionInfo.
public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, Locale locale, Date compareDate) {
SubscriptionInfo si = null;
Publisher p = subscriber.getPublisher();
Date latestNews = p.getLatestNewsDate();
// can't be loaded when already deleted
try {
if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
Long courseId = new Long(p.getData());
final ICourse course = loadCourseFromId(courseId);
if (courseStatus(course)) {
final List<DENCourseNode> denNodes = getCourseDENNodes(course);
final Translator trans = Util.createPackageTranslator(DENCourseNodeNotificationHandler.class, locale);
String cssClass = new DENCourseNodeConfiguration().getIconCSSClass();
si = new SubscriptionInfo(subscriber.getKey(), p.getType(), new TitleItem(trans.translate("notifications.header", new String[] { course.getCourseTitle() }), cssClass), null);
SubscriptionListItem subListItem;
for (DENCourseNode denNode : denNodes) {
String changer = "";
String desc = trans.translate("notifications.entry", new String[] { denNode.getLongTitle(), changer });
Date modDate = new Date();
subListItem = new SubscriptionListItem(desc, null, null, modDate, cssClass);
si.addSubscriptionListItem(subListItem);
}
}
} else {
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
} catch (Exception e) {
log.error("Error creating enrollment notifications for subscriber: " + subscriber.getKey(), e);
checkPublisher(p);
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
return si;
}
use of de.bps.course.nodes.DENCourseNode in project openolat by klemens.
the class DENCourseNodeNotificationHandler method createSubscriptionInfo.
public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, Locale locale, Date compareDate) {
SubscriptionInfo si = null;
Publisher p = subscriber.getPublisher();
Date latestNews = p.getLatestNewsDate();
// can't be loaded when already deleted
try {
if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
Long courseId = new Long(p.getData());
final ICourse course = loadCourseFromId(courseId);
if (courseStatus(course)) {
final List<DENCourseNode> denNodes = getCourseDENNodes(course);
final Translator trans = Util.createPackageTranslator(DENCourseNodeNotificationHandler.class, locale);
String cssClass = new DENCourseNodeConfiguration().getIconCSSClass();
si = new SubscriptionInfo(subscriber.getKey(), p.getType(), new TitleItem(trans.translate("notifications.header", new String[] { course.getCourseTitle() }), cssClass), null);
SubscriptionListItem subListItem;
for (DENCourseNode denNode : denNodes) {
String changer = "";
String desc = trans.translate("notifications.entry", new String[] { denNode.getLongTitle(), changer });
Date modDate = new Date();
subListItem = new SubscriptionListItem(desc, null, null, modDate, cssClass);
si.addSubscriptionListItem(subListItem);
}
}
} else {
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
} catch (Exception e) {
log.error("Error creating enrollment notifications for subscriber: " + subscriber.getKey(), e);
checkPublisher(p);
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
return si;
}
Aggregations