VotingDetailsView.java
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package fi.codecrew.moya.web.cdiview.voting;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.VotingBeanLocal;
import fi.codecrew.moya.enums.apps.CompoPermission;
import fi.codecrew.moya.model.Compo;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@ConversationScoped
public class VotingDetailsView extends GenericCDIView {
/**
*
*/
private static final long serialVersionUID = -8373473936336396427L;
@EJB
private transient VotingBeanLocal votingBean;
private Integer compoId;
private String compoName;
private Compo compo;
private transient ListDataModel<EntryWrapper> entries;
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(VotingDetailsView.class);
public Integer getCompoId() {
return compoId;
}
public String saveSort()
{
for (EntryWrapper e : entries)
{
setCompo(votingBean.saveSort(e.getEntry()).getCompo());
}
entries = EntryWrapper.init(getCompo().getCompoEntries(), votingBean, true);
return null;
}
public void setCompoId(Integer compoId) {
this.compoId = compoId;
}
public ListDataModel<EntryWrapper> getEntries() {
return entries;
}
public void initView() {
if (super.requirePermissions(CompoPermission.MANAGE))
{
setCompo(votingBean.getCompoById(compoId));
entries = EntryWrapper.init(getCompo().getCompoEntries(), votingBean, true);
super.beginConversation();
}
}
public String getCompoName() {
return compoName;
}
public void setCompoName(String compoName) {
this.compoName = compoName;
}
public Compo getCompo() {
return compo;
}
public void setCompo(Compo compo) {
this.compo = compo;
}
}