TestDataView.java 6.71 KB
/*
 * 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;
	// }
}