TestDataView.java
6.71 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.web;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.CardTemplateBeanLocal;
import fi.insomnia.bortal.beans.EventBeanLocal;
import fi.insomnia.bortal.beans.PollBeanLocal;
import fi.insomnia.bortal.beans.RoleBeanLocal;
import fi.insomnia.bortal.beans.TestDataBeanLocal;
import fi.insomnia.bortal.beans.UserBeanLocal;
import fi.insomnia.bortal.beans.UserUtilBeanLocal;
/**
*
* @author tuukka
*/
@ManagedBean(name = "TestDataView")
@RequestScoped
public class TestDataView {
private static final Logger logger = LoggerFactory.getLogger(TestDataView.class);
@EJB
private TestDataBeanLocal testdatabean;
@EJB
private UserBeanLocal userbean;
@EJB
private RoleBeanLocal rolebean;
@EJB
private UserUtilBeanLocal utilbean;
@EJB
private CardTemplateBeanLocal ctbean;
@EJB
private EventBeanLocal eventbean;
@EJB
private PollBeanLocal pollbean;
public void convertUsernames() {
utilbean.convertUsernames();
}
// public void generateTestMap() {
// EventMap map = testdatabean.generateTestMap();
//
// testdatabean.generateTestPlaces(map);
// }
//
// public void executeMapTests() {
// for (long i = 100; i < 1024 * 100; i += 100) {
// logger.debug("Trying to read {} chars", i);
// EventMap map = testdatabean.readMap(i);
// // logger.debug("Got map {} with {} chars", new Object[] { map,
// // map.getMapData().length() });
// }
//
// logger.warn("All succeded Testing for original image");
// EventMap map = testdatabean.readMap(0);
// logger.info("Got orig image: {}", map);
// }
//
// /** Creates a new instance of TestDataView */
// public TestDataView() {
// }
//
// public String printPlacesInfo() {
// testdatabean.printPlacesInfo();
//
// return null;
// }
//
// public void roletest() {
// User usr = userbean.getCurrentUser();
// List<Role> roles = rolebean.listRoles();
// Role role = roles.get(roles.size() - 1);
// role.getUsers().add(usr);
// logger.debug("roles before: {}", role.getUsers());
// rolebean.mergeChanges(role);
// logger.debug("roles after: {}", usr.getRoles());
//
// }
//
// public void checkCards() {
// ctbean.checkAllUsersCardRights();
// }
//
// public String checkImages() {
// logger.debug("Cheking all users images");
// utilbean.checkAllUsersImages();
// return null;
// }
//
// public String convertImages() {
// for (User u : userbean.getUsers()) {
// utilbean.convertImage(u);
// }
//
// return null;
// }
//
// public String generatePollData() {
// LanEvent ev = eventbean.getCurrentEvent();
// Poll poll = new Poll(ev, "Tapahtumakysely");
// Calendar end = Calendar.getInstance();
// end.add(Calendar.MONTH, 1);
// poll.setEnd(end);
//
// createTextQuestion(poll, 10,
// "Millainen oli yleinen fiilis tapahtumassa?");
// createTextQuestion(poll, 20, "Mitä pidit tapahtuman kilpailuista?");
// createTextQuestion(poll, 30,
// "Mitä mieltä olit tapahtuman kilpailujen aikataulusta ja oliko neljäpäiväinen tapahtuma hyvä juttu?");
// createTextQuestion(poll, 40, "Muu palaute tapahtumasta:");
//
// createTextQuestion(poll, 60, "Mikä InsomniaGamessa oli parasta?");
// createTextQuestion(poll, 70, "Mikä InsomniaGamessa oli huonointa?");
// createTextQuestion(poll, 80,
// "Miten olisit halunnut saada tietoa InsomniaGameen liittyvistä tehtävistä?");
// createTextQuestion(poll, 90, "Palautteesi InsomniaGamen järjestäjille:");
//
// pollbean.createPoll(poll);
//
// Poll poll2 = new Poll(ev, "Gallup");
// Calendar end2 = Calendar.getInstance();
// end2.add(Calendar.MONTH, 1);
// poll2.setEnd(end);
//
// createTextQuestion(poll2, 10, "Syntymävuotesi?", 8);
// createMulticoice(poll2, 50, "Omistatko älypuhelimen?", "En", "Kyllä",
// "Olen hankkimassa seuraavaksi älypuhelmen");
//
// createMulticoice(poll2, 60, "Miten usein pelaat mobiilipelejä?",
// "En pelaa mobiilipelejä", "Olen joskus kokeillut ",
// "Pelaan lähes viikottain", "Pelaan lähes päivittäin");
//
// createMulticoice(poll2, 70,
// "Miten usein pelaat pelikonsolilla tai tietokoneella?", "En pelaa",
// "Pelaan harvoin", "Pelaan kerran, pari viikossa", "Pelaan päivittäin");
//
// createMulticoice(poll2, 80,
// "Oletko kokeillut opetuspelejä? Esimerkiksi nettiselaimella tai kännykällä?",
// "En ole kokeillut", "Olen kokeillut", "Käytän usein");
//
// createTextQuestion(poll2, 90,
// "Millaisen opetuspelin kokisit sekä hyödyllisenä että hauskana?");
//
// createMulticoice(poll2, 95,
// "Kokisitko roolipeleistä tutut kokemuspisteet ja kokemustasojen tavoittelun motivaatiota kasvattanava asiana oppimispeleissä?",
// "Kyllä", "Ei");
//
// createMulticoice(poll2, 100,
// "Oletko käyttänyt sijaintitietoon perustuvia palveluja, kuten Google Latitude tai Foursquare?",
// "En ole kokeillut", "Olen kokeillut", "Käytän usein");
//
// createTextQuestion(poll2, 110,
// "Millaisia käyttötapoja näkisit sijaintitietoon perustuvilla peleillä tai palveluilla oppimiskäytössä?");
//
// createMulticoice(poll2, 120,
// "Käytätkö sosiaalisen median palveluita, kuten Facebookia tai IRC-Galleriaa?",
// "En ole kokeillut", "Olen kokeillut", "Käytän usein");
//
// createTextQuestion(poll2, 130,
// "Millaisia käyttötapoja näkisit sosiaalisen mediaan perustuvilla palveluilla oppimiskäytössä?");
//
// createTextQuestion(poll2, 140,
// "Olet ehkä kuullut termin \"pilvipalvelut\". Miltä kuulostaisi ajatus siitä että pelikonsoli ei fyysisesti olisikaan kotonasi, vaan pelien sisältö tulisi suoraan verkkopalvelusta?");
//
// pollbean.createPoll(poll2);
//
// return null;
// }
//
// private void createMulticoice(Poll poll2, Integer sort, String question,
// String... answers) {
// PollQuestion pollq = new PollQuestion(poll2, question);
// pollq.setSort(sort);
// poll2.getQuestions().add(pollq);
// Integer anssort = 10;
// for (String ans : answers) {
// PossibleAnswer pans = new PossibleAnswer(pollq, ans);
// pans.setSort(anssort);
// pollq.getAnswers().add(pans);
// anssort += 10;
// }
// }
//
// private PollQuestion createTextQuestion(Poll poll, int sort, String
// string, int chars) {
// PollQuestion ret = createTextQuestion(poll, sort, string);
// ret.setCharacters(chars);
// return ret;
// }
//
// private PollQuestion createTextQuestion(Poll poll, int sort, String
// question) {
// PollQuestion q1 = new PollQuestion(poll, question);
// q1.setSort(sort);
// poll.getQuestions().add(q1);
//
// PossibleAnswer vapaa = new PossibleAnswer(q1, "");
//
// vapaa.setTextanswer(true);
// q1.getAnswers().add(vapaa);
// return q1;
// }
}