Commit 35d1d257 by Antti Tonkyra

Implement endConversation for GenericCDIBean, tournament stuff

1 parent e772f104
...@@ -21,7 +21,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -21,7 +21,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class TournamentRule extends GenericEntity implements Serializable { public class TournamentRule extends GenericEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name="name") @Column(name="name")
private String name; private String name;
...@@ -70,6 +70,4 @@ public class TournamentRule extends GenericEntity implements Serializable { ...@@ -70,6 +70,4 @@ public class TournamentRule extends GenericEntity implements Serializable {
public void setTournamentGame(TournamentGame tournamentGame) { public void setTournamentGame(TournamentGame tournamentGame) {
this.tournamentGame = tournamentGame; this.tournamentGame = tournamentGame;
} }
} }
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</p:column> </p:column>
</p:dataTable> </p:dataTable>
<h:form> <h:form>
<p:commandButton value="#{i18n['tournament.admin.create']}" action="#{tournamentAdminView.create}"/> <p:commandButton value="#{i18n['tournament.admin.create']}" action="#{tournamentAdminView.create}" />
</h:form> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -41,6 +41,10 @@ public abstract class GenericCDIView implements Serializable { ...@@ -41,6 +41,10 @@ public abstract class GenericCDIView implements Serializable {
} }
} }
public void endConversation() {
if(!conversation.isTransient()) conversation.end();
}
public boolean hasPermission(IAppPermission perm) { public boolean hasPermission(IAppPermission perm) {
// boolean ret = // boolean ret =
// FacesContext.getCurrentInstance().getExternalContext().isUserInRole(perm.getFullName()); // FacesContext.getCurrentInstance().getExternalContext().isUserInRole(perm.getFullName());
......
...@@ -14,6 +14,7 @@ import fi.codecrew.moya.model.TournamentRule; ...@@ -14,6 +14,7 @@ import fi.codecrew.moya.model.TournamentRule;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Remove;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.inject.Named; import javax.inject.Named;
...@@ -63,6 +64,7 @@ public class TournamentCreateView extends GenericCDIView { ...@@ -63,6 +64,7 @@ public class TournamentCreateView extends GenericCDIView {
tournamentBean.createTournament(tournament); tournamentBean.createTournament(tournament);
this.endConversation();
return "success"; return "success";
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!