VotingCompoAddEntryView.java
2.04 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
87
88
89
90
91
92
93
94
95
96
package fi.codecrew.moya.web.cdiview.voting;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.validation.constraints.NotNull;
import org.primefaces.model.UploadedFile;
import fi.codecrew.moya.beans.VotingBeanLocal;
import fi.codecrew.moya.model.CompoEntry;
import fi.codecrew.moya.model.CompoEntryFile;
@Named
@RequestScoped
public class VotingCompoAddEntryView {
@EJB
VotingBeanLocal votingBean;
@NotNull
private String name;
private String notes;
private String screenMessage;
@NotNull
private UploadedFile uploadedFile;
private Integer compoId;
private String compoName;
public Integer getCompoId() {
return compoId;
}
public void setCompoId(Integer compoId) {
this.compoId = compoId;
}
public UploadedFile getUploadedFile() {
return uploadedFile;
}
public void setUploadedFile(UploadedFile uploadedFile) {
this.uploadedFile = uploadedFile;
}
public String getScreenMessage() {
return screenMessage;
}
public void setScreenMessage(String screenMessage) {
this.screenMessage = screenMessage;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCompoName() {
return compoName;
}
public void setCompoName(String compoName) {
this.compoName = compoName;
}
public String send() {
CompoEntry compoEntry = new CompoEntry();
compoEntry.setTitle(name);
compoEntry.setNotes(notes);
compoEntry.setScreenMessage(screenMessage);
compoEntry.setCompo(votingBean.getCompoById(compoId));
CompoEntryFile cef = new CompoEntryFile(compoEntry);
cef.setFileData(this.uploadedFile.getContents());
cef.setFileName(uploadedFile.getFileName());
votingBean.addEntry(compoEntry, cef);
return null;
}
public void initView() {
compoName = votingBean.getCompoById(compoId).getName();
}
}