Commit a50873a7 by Tuukka Kivilahti

lectures, now user can participate lectures etc.

1 parent 5c776ce2
......@@ -6,12 +6,16 @@ import java.util.List;
import javax.annotation.security.DeclareRoles;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.faces.model.ListDataModel;
import fi.codecrew.moya.enums.apps.LecturePermission;
import fi.codecrew.moya.facade.EventUserFacade;
import fi.codecrew.moya.facade.LectureFacade;
import fi.codecrew.moya.facade.LectureGroupFacade;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
import fi.codecrew.moya.model.Role;
/**
* Session Bean implementation class FoodWaveBean
......@@ -25,8 +29,13 @@ public class LectureBean implements LectureBeanLocal {
@EJB
LectureGroupFacade lectureGroupFacade;
@EJB
EventUserFacade eventUserFacade;
@EJB
EventBean eventBean;
@EJB
UserBeanLocal userBean;
@Override
public List<Lecture> getLecturesByLectureGroup(LectureGroup group) {
return new ArrayList<Lecture>();
......@@ -62,22 +71,114 @@ public class LectureBean implements LectureBeanLocal {
@Override
public Lecture saveLecture(Lecture lecture) {
if(lecture == null || lecture.getLectureGroup() == null) {
if (lecture == null || lecture.getLectureGroup() == null) {
throw new NullPointerException("Lecture must be in some lecturegroup!");
}
if(lecture.getId() == null) {
// let's try this, some weird cache problem
LectureGroup group = lectureGroupFacade.reload(lecture.getLectureGroup());
lecture.setLectureGroup(group);
if (lecture.getId() == null) {
lecture = lectureFacade.create(lecture);
if(!lecture.getLectureGroup().getLectures().contains(lecture))
if (!lecture.getLectureGroup().getLectures().contains(lecture))
lecture.getLectureGroup().getLectures().add(lecture);
} else {
lecture = lectureFacade.merge(lecture);
}
return lecture;
}
@Override
public List<Lecture> findAvailableLectures(LectureGroup group, EventUser user) {
LectureGroup lectureGroup = lectureGroupFacade.reload(group);
List<Role> userRoles = userBean.findUsersRoles(user);
List<Lecture> lectures = new ArrayList<Lecture>();
lectureloop: for (Lecture l : lectureGroup.getLectures()) {
for (Role r : l.getOpenForRoles()) {
if (userRoles.contains(r)) {
lectures.add(l);
continue lectureloop;
}
}
}
return lectures;
}
@Override
public List<Lecture> getParticipatedLectures(EventUser user) {
return eventUserFacade.reload(user).getLectures();
}
@Override
public Lecture participate(EventUser user, Lecture lecture) {
if(userLectureSelectsLeft(lecture.getLectureGroup(), user) <= 0)
return lecture;
EventUser targetUser = eventUserFacade.reload(user);
lecture.getParticipants().add(targetUser);
lectureFacade.merge(lecture);
targetUser.getLectures().add(lecture);
return lecture;
}
@Override
public Lecture unparticipate(EventUser user, Lecture lecture) {
EventUser targetUser = eventUserFacade.reload(user);
lecture.getParticipants().remove(targetUser);
targetUser.getLectures().remove(lecture);
lectureFacade.merge(lecture);
return lecture;
}
@Override
public int userLectureSelects(LectureGroup group, EventUser user) {
EventUser updatedUser = eventUserFacade.reload(user);
int count = 0;
for(Lecture l : updatedUser.getLectures()) {
if(l.getLectureGroup().equals(group)) {
count++;
}
}
return count;
}
@Override
public int userLectureSelectsLeft(LectureGroup group, EventUser user) {
LectureGroup updatedGroup = lectureGroupFacade.reload(group);
int maxCount = updatedGroup.getSelectCount();
if(maxCount <= 0)
return 99;
return maxCount - userLectureSelects(group, user);
}
}
......@@ -3,6 +3,7 @@ package fi.codecrew.moya.facade;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Lecture;
@Stateless
......
......@@ -3,7 +3,9 @@ package fi.codecrew.moya.beans;
import java.util.List;
import javax.ejb.Local;
import javax.faces.model.ListDataModel;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
......@@ -19,5 +21,15 @@ public interface LectureBeanLocal {
public Lecture saveLecture(Lecture lecture);
public List<Lecture> findAvailableLectures(LectureGroup group, EventUser user);
public List<Lecture> getParticipatedLectures(EventUser user);
public Lecture participate(EventUser user, Lecture lecture);
public Lecture unparticipate(EventUser user, Lecture lecture);
public int userLectureSelectsLeft(LectureGroup group, EventUser user);
public int userLectureSelects(LectureGroup group, EventUser user);
}
......@@ -473,6 +473,9 @@ public class EventUser extends GenericEntity {
}
public List<Lecture> getLectures() {
if(lectures == null)
lectures = new ArrayList<Lecture>();
return lectures;
}
......
......@@ -19,6 +19,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
......@@ -111,6 +112,9 @@ public class Lecture extends GenericEntity {
}
public List<EventUser> getParticipants() {
if(participants == null)
participants = new ArrayList<EventUser>();
return participants;
}
......@@ -173,9 +177,7 @@ public class Lecture extends GenericEntity {
setHours(new BigDecimal((int) endTime.compareTo(getStartTime()) / 1000 / 60 / 60));
}
public boolean isFull() {
return (getParticipants().size() >= maxParticipantsCount);
}
public BigDecimal getHours() {
return hours;
......@@ -203,6 +205,23 @@ public class Lecture extends GenericEntity {
return newLecture;
}
@Transient
public boolean isFull() {
if(getMaxParticipantsCount() <= 0) {
return false;
}
return (getParticipants().size() >= getMaxParticipantsCount());
}
@Transient
public int getParticipantsCount() {
return getParticipants().size();
}
}
......
......@@ -6,8 +6,10 @@ package fi.codecrew.moya.model;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
......@@ -47,7 +49,7 @@ public class LectureGroup extends GenericEntity {
private String description;
@OneToMany(mappedBy = "lectureGroup")
@OneToMany(mappedBy = "lectureGroup", cascade = CascadeType.ALL)
private List<Lecture> lectures;
......
......@@ -42,6 +42,8 @@
</p:dataTable>
</p:fieldset>
<p:commandButton value="#{i18n['lecture.createNew']}" actionListener="#{lectureView.createNew}" update=":managelectures:editcreate" />
<p:outputLabel value="#{i18n['lecture.multicreate']}" /> <p:selectBooleanButton value="#{lectureView.multicreate}" offLabel="#{i18n['off']}" onLabel="#{i18n['on']}" onIcon="ui-icon-check" offIcon="ui-icon-close" />
<br />
<br />
......@@ -69,8 +71,8 @@
<f:selectItems var="roleitem" itemLabel="#{roleitem.name}" value="#{roleDataView.roles}" />
</h:selectManyCheckbox>
<p:commandButton rendered="#{!lectureView.creatingLecture}" actionListener="#{lectureView.saveLecture}" value="#{i18n['save']}" update=":managelectures:lectures" />
<p:commandButton rendered="#{lectureView.creatingLecture}" actionListener="#{lectureView.saveLecture}" value="#{i18n['create']}" update=":managelectures:lectures" />
<p:commandButton rendered="#{!lectureView.creatingLecture}" actionListener="#{lectureView.saveLecture}" value="#{i18n['save']}" update="editcreate :managelectures:lectures" />
<p:commandButton rendered="#{lectureView.creatingLecture}" actionListener="#{lectureView.saveLecture}" value="#{i18n['create']}" update="editcreate :managelectures:lectures" />
</p:panelGrid>
</p:fieldset>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:products="http://java.sun.com/jsf/composite/cditools/products" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<f:viewParam name="lecturegroupid" value="#{lectureView.lectureGroupId}" />
<f:event type="preRenderView" listener="#{lectureGroupView.initView()}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['viewlectures.title']}</h1>
</ui:define>
<ui:define name="content">
<h:form id="viewlecturesform">
<p:fieldset id="lectureGroups" legend="#{i18n['lecture.selectgroup']}">
<p:dataTable value="#{lectureUserView.lectureGroups}" var="lectureGroup">
<p:column headerText="#{i18n['lectureGroup.name']}">
<h:outputText value="#{lectureGroup.name}" />
</p:column>
<p:column headerText="#{i18n['lectureGroup.description']}">
<h:outputText value="#{lectureGroup.description}" />
</p:column>
<p:column headerText="#{i18n['lectureGroup.selectCountUserInfo']}">
<h:outputText value="#{lectureGroup.selectCount}" />
</p:column>
<p:column>
<p:commandButton value="#{i18n['lectureGroup.view']}" actionListener="#{lectureUserView.selectCurrentLectureGroup}" update=":viewlecturesform:participatedLectures :viewlecturesform:availableLectures :viewlecturesform:title" onerror="location.reload(true)" />
</p:column>
</p:dataTable>
</p:fieldset>
<h1>
<h:outputText id="title" value="#{lectureUserView.currentLectureGroup.name}" />
</h1>
<p:fieldset id="participatedLectures" legend="#{i18n['lecture.participatedLectures']} #{lectureUserView.currentGroupParticipateCount} / #{lectureUserView.currentLectureGroup.selectCount}">
<p:dataTable value="#{lectureUserView.participatedLectures}" var="lecture">
<p:column headerText="#{i18n['lecture.name']}">
<h:outputText value="#{lecture.name}" />
</p:column>
<p:column headerText="#{i18n['lecture.description']}">
<h:outputText value="#{lecture.description}" />
</p:column>
<p:column headerText="#{i18n['lecture.hours']}">
<h:outputText value="#{lecture.hours}" />
</p:column>
<p:column headerText="#{i18n['lecture.startTime']}">
<h:outputText value="#{lecture.startTime.time}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</p:column>
<p:column headerText="#{i18n['lecture.participants']}">
<h:outputText value="#{lecture.participantsCount}" /> / <h:outputText value="#{lecture.maxParticipantsCount}" />
</p:column>
<p:column>
<p:commandButton value="#{i18n['lecture.unparticipate']}" actionListener="#{lectureUserView.unParticipateCurrent}" update=":viewlecturesform:availableLectures :viewlecturesform:participatedLectures" onerror="location.reload(true)" />
</p:column>
</p:dataTable>
</p:fieldset>
<br /><br />
<p:fieldset id="availableLectures" legend="#{i18n['lecture.availableLectures']}">
<p:dataTable value="#{lectureUserView.lectures}" var="lecture">
<p:column headerText="#{i18n['lecture.name']}">
<h:outputText value="#{lecture.name}" />
</p:column>
<p:column headerText="#{i18n['lecture.description']}">
<h:outputText value="#{lecture.description}" />
</p:column>
<p:column headerText="#{i18n['lecture.hours']}">
<h:outputText value="#{lecture.hours}" />
</p:column>
<p:column headerText="#{i18n['lecture.startTime']}">
<h:outputText value="#{lecture.startTime.time}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</p:column>
<p:column headerText="#{i18n['lecture.participants']}">
<h:outputText value="#{lecture.participantsCount}" /> / <h:outputText value="#{lecture.maxParticipantsCount}" />
</p:column>
<p:column>
<p:commandButton value="#{i18n['lecture.participate']}" rendered="#{!lectureUserView.currentGroupFull and !lecture.full}" actionListener="#{lectureUserView.participateCurrent}" update=":viewlecturesform:availableLectures :viewlecturesform:participatedLectures" onerror="location.reload(true)" />
<h:outputText value="#{i18n['lecture.full']}" rendered="#{lecture.full}" />
<h:outputText value="#{i18n['lecture.groupFull']}" rendered="#{lectureUserView.currentGroupFull}" />
</p:column>
</p:dataTable>
</p:fieldset>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -204,22 +204,32 @@ lanEventProperty.defaultValue = Default value
lanEventProperty.save = Save
lanEventProperty.textValue = Text value
lecture.availableLectures = Aihealueen kurssit ja luennot
lecture.createLecture = Uuden tiedot
lecture.createNew = Luo uusi
lecture.description = Kuvaus
lecture.groupFull = Kiinti\u00F6 t\u00E4ynn\u00E4
lecture.hours = Kesto, tunteja
lecture.maxParticipantsCount = Max. osallistujia
lecture.multicreate = Luo monta putkeen
lecture.name = Nimi
lecture.participants = Osallistujia
lecture.participate = Ilmoittaudu
lecture.participatedLectures = Kurssi-ilmoittautumisesi
lecture.roles = Roolit
lecture.saveLecture = Muokkaa
lecture.selectgroup = Valitse aihealue
lecture.startTime = Aloitusaika
lecture.unparticipate = Poista ilmoittautuminen
lectureGroup.createLectureGroup = Luo luetokokonaisuus
lectureGroup.createLectureGroup = Luo kurssikokonaisuus
lectureGroup.createNew = Luo uusi
lectureGroup.description = Kuvaus
lectureGroup.manageLectures = Hallitse luentoja
lectureGroup.name = Nimi
lectureGroup.selectCount = Montako kurssia saa valita
lectureGroup.selectCountUserInfo = Yhden osallistujan kiinti\u00F6
lectureGroup.view = Tarkastele
lecturegroup.create.success = Kurssiryhm\u00E4 luotu onnistuneesti.
lecturegroup.list.title = Luennot
......@@ -242,7 +252,8 @@ navi.auth.login = frontpage
navi.auth.loginerror = frontpage
navi.auth.logout = frontpage
off = Pois
off = Poissa
on = P\u00E4\u00E4ll\u00E4
......@@ -319,3 +330,5 @@ user.unauthenticated = Kirjautumaton
usercart.downloadCsv = CSV
usercart.showoverview = Vie tarkastusn\u00E4kym\u00E4\u00E4n
viewlectures.title = Kurssit ja luennot
......@@ -555,15 +555,23 @@ layout.editBottom = Edit bottom content
layout.editContent = Edit center
layout.editTop = Edit topcontent
lecture.availableLectures = available lectures
lecture.createLecture = New lecture
lecture.createNew = Create new
lecture.description = Description
lecture.groupFull = Limit reached
lecture.hours = Duration hours
lecture.maxParticipantsCount = Max participants
lecture.multicreate = Create multible in row
lecture.name = Name
lecture.participants = Participants
lecture.participate = Participate
lecture.participatedLectures = Your lectures
lecture.roles = Roles
lecture.saveLecture = Edit
lecture.selectgroup = Select lecturegroup
lecture.startTime = Start time
lecture.unparticipate = Remove participation
lectureGroup.createLectureGroup = Create lecturegroup
lectureGroup.createNew = Create new
......@@ -571,6 +579,8 @@ lectureGroup.description = Description
lectureGroup.manageLectures = Manage lectures
lectureGroup.name = Name
lectureGroup.selectCount = Max lecture select count
lectureGroup.selectCountUserInfo = Quota for one participant
lectureGroup.view = View
lecturegroup.create.success = Lecturegroup created successfully.
lecturegroup.list.title = Lectures
......@@ -1434,6 +1444,8 @@ userview.userExists = Username already exists! You may already have an a
viewexpired.body = Please login again.
viewexpired.title = Login expired. Please login again.
viewlectures.title = Courses and lectures
voting.allcompos.curEntries = # of entries
voting.allcompos.descri = Description
voting.allcompos.description = List of all compos and theirs information.
......
......@@ -566,22 +566,32 @@ layout.editBottom = Muokkaa alasis\u00E4lt\u00F6\u00E4
layout.editContent = Muokkaa sis\u00E4lt\u00F6\u00E4
layout.editTop = Muokkaa yl\u00E4sis\u00E4lt\u00F6\u00E4
lecture.availableLectures = Aihealueen kurssit ja luennot
lecture.createLecture = Uuden tiedot
lecture.createNew = Luo uusi
lecture.description = Kuvaus
lecture.groupFull = Kiinti\u00F6 t\u00E4ynn\u00E4
lecture.hours = Kesto tunteina
lecture.maxParticipantsCount = Osallistujia enint.
lecture.multicreate = Luo monta putkeen
lecture.name = Nimi
lecture.participants = Osallistujia
lecture.participate = Ilmoittaudu
lecture.participatedLectures = Ilmoittautumisesi
lecture.roles = Roolit
lecture.saveLecture = Muokkaa
lecture.selectgroup = Valitse aihealue
lecture.startTime = Aloitusaika
lecture.unparticipate = Poista ilmoittautuminen
lectureGroup.createLectureGroup = Luo Luentokokonaisuus
lectureGroup.createLectureGroup = Luo kurssikokonaisuus
lectureGroup.createNew = Luo uusi
lectureGroup.description = Kuvaus
lectureGroup.manageLectures = Hallitse luentoja
lectureGroup.name = Nimi
lectureGroup.selectCount = Monellekko saa osallistua
lectureGroup.selectCountUserInfo = Yhden henkil\u00F6n kiinti\u00F6
lectureGroup.view = Tarkastele kursseja
lecturegroup.create.success = Kurssiryhm\u00E4 luotu onnistuneesti.
lecturegroup.list.title = Luennot
......@@ -685,7 +695,9 @@ newsgroup.writerRole = Kirjoittajaryhm\u00E4
newslist.header = Uutisryhm\u00E4t
off = Pois
off = Poissa
on = P\u00E4\u00E4ll\u00E4
......@@ -1415,6 +1427,8 @@ userview.userExists = K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Sinu
viewexpired.body = Ole hyv\u00E4 ja kirjaudu sis\u00E4\u00E4n uudelleen.
viewexpired.title = N\u00E4kym\u00E4 on vanhentunut
viewlectures.title = Kurssit ja luennot
voting.allcompos.curEntries = Entryja
voting.allcompos.descri = Kuvaus
voting.allcompos.description = Compojen informaatiot.
......
package fi.codecrew.moya.web.cdiview.lecture;
package fi.codecrew.moya.web.lecture;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
......
package fi.codecrew.moya.web.lecture;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.model.ListDataModel;
import javax.inject.Inject;
import javax.inject.Named;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.LectureBeanLocal;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.user.UserView;
@Named
@ConversationScoped
public class LectureUserView extends GenericCDIView {
private static final long serialVersionUID = 1L;
@Inject
UserView userView;
@EJB
LectureBeanLocal lectureBean;
@EJB
EventBeanLocal eventBean;
ListDataModel<LectureGroup> lectureGroups = null;
ListDataModel<Lecture> lectures = null;
ListDataModel<Lecture> participatedLectures = null;
LectureGroup currentLectureGroup;
public ListDataModel<LectureGroup> getLectureGroups() {
lectureGroups = new ListDataModel<LectureGroup>(lectureBean.getLectureGroups());
return lectureGroups;
}
public void selectCurrentLectureGroup() {
if (lectureGroups != null && lectureGroups.isRowAvailable()) {
currentLectureGroup = lectureGroups.getRowData();
lectures = null;
}
}
public LectureGroup getCurrentLectureGroup() {
List<LectureGroup> groups = lectureBean.getLectureGroups();
if (currentLectureGroup == null && groups.size() > 0) {
currentLectureGroup = groups.get(0);
}
return currentLectureGroup;
}
public ListDataModel<Lecture> getLectures() {
if (currentLectureGroup == null)
return new ListDataModel<Lecture>();
lectures = new ListDataModel<Lecture>(lectureBean.findAvailableLectures(getCurrentLectureGroup(), userView.getCurrentUser()));
return lectures;
}
public ListDataModel<Lecture> getParticipatedLectures() {
participatedLectures = new ListDataModel<Lecture>(lectureBean.getParticipatedLectures(userView.getCurrentUser()));
return participatedLectures;
}
public void participateCurrent() {
if (lectures != null && lectures.isRowAvailable()) {
Lecture lecture = lectures.getRowData();
lectureBean.participate(userView.getCurrentUser(), lecture);
super.addFaceMessage("lecture.participated");
this.lectures = null;
}
}
public void unParticipateCurrent() {
if (participatedLectures != null && participatedLectures.isRowAvailable()) {
Lecture lecture = participatedLectures.getRowData();
lectureBean.unparticipate(userView.getCurrentUser(), lecture);
super.addFaceMessage("lecture.unparticipated");
this.lectures = null;
}
}
public boolean isCurrentGroupFull() {
return (lectureBean.userLectureSelectsLeft(getCurrentLectureGroup(), userView.getCurrentUser()) <= 0);
}
public int getCurrentGroupParticipateCount() {
return lectureBean.userLectureSelects(getCurrentLectureGroup(), userView.getCurrentUser());
}
}
package fi.codecrew.moya.web.cdiview.lecture;
package fi.codecrew.moya.web.lecture;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
......@@ -36,6 +36,7 @@ public class LectureView extends GenericCDIView {
private ListDataModel<Lecture> lectures;
private Integer lecturegroupId = null;
......@@ -53,7 +54,8 @@ public class LectureView extends GenericCDIView {
return ;
}
currentLecture= lectureBean.saveLecture(currentLecture);
currentLecture = lectureBean.saveLecture(currentLecture);
currentLectureGroup = currentLecture.getLectureGroup();
if(creatingLecture)
context.addMessage(null, new FacesMessage(I18n.get("success"), I18n.get("lecturegroup.create.success")) );
......@@ -70,6 +72,8 @@ public class LectureView extends GenericCDIView {
currentLecture.setName("");
currentLecture.setDescription("");
} else {
currentLecture = null;
}
}
......@@ -91,26 +95,20 @@ public class LectureView extends GenericCDIView {
public Integer getLectureGroupId() {
if(currentLectureGroup != null && currentLectureGroup.getId() != null)
return currentLectureGroup.getId();
return null;
return lecturegroupId;
}
public void setLectureGroupId(Integer lectureGroupId) {
if(lectureGroupId == null)
currentLectureGroup = null;
else
currentLectureGroup = lectureBean.findLectureGroup(lectureGroupId);
this.lecturegroupId = lectureGroupId;
}
public ListDataModel<Lecture> getLectures() {
if(lectures == null && currentLectureGroup != null) {
lectures = new ListDataModel<Lecture>(currentLectureGroup.getLectures());
if(lectures == null && getCurrentLectureGroup() != null) {
lectures = new ListDataModel<Lecture>(getCurrentLectureGroup().getLectures());
}
return lectures;
......@@ -138,7 +136,7 @@ public class LectureView extends GenericCDIView {
public Lecture getCurrentLecture() {
if(currentLecture == null) {
currentLecture = new Lecture(currentLectureGroup);
currentLecture = new Lecture(getCurrentLectureGroup());
}
return currentLecture;
......@@ -151,6 +149,11 @@ public class LectureView extends GenericCDIView {
public LectureGroup getCurrentLectureGroup() {
if(currentLectureGroup == null) {
currentLectureGroup = lectureBean.findLectureGroup(lecturegroupId);
}
return currentLectureGroup;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!