Search in sources :

Example 1 with Speaker

use of site.model.Speaker in project jprime by bgjug.

the class AbstractCfpController method handleSubmittedSpeaker.

private Speaker handleSubmittedSpeaker(Speaker speaker, MultipartFile image) {
    Speaker existingSpeaker = userFacade.findSpeaker(speaker.getEmail());
    if (existingSpeaker != null) {
        return existingSpeaker;
    } else {
        // new speaker.. file is required
        fixTwitterHandle(speaker);
        speaker.setBranch(Globals.CURRENT_BRANCH);
        formatPicture(speaker, image);
        return speaker;
    }
}
Also used : Speaker(site.model.Speaker)

Example 2 with Speaker

use of site.model.Speaker in project jprime by bgjug.

the class AdminSpeakerController method edit.

@RequestMapping(value = "/add", method = RequestMethod.GET)
public String edit(Model model) {
    model.addAttribute("speaker", new Speaker());
    model.addAttribute("branches", Branch.values());
    return "/admin/speaker/edit.jsp";
}
Also used : Speaker(site.model.Speaker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with Speaker

use of site.model.Speaker in project jprime by bgjug.

the class AdminSpeakerController method add.

@Transactional
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String add(@Valid final Speaker speaker, BindingResult bindingResult, @RequestParam("file") MultipartFile file, Model model) {
    if (bindingResult.hasErrors()) {
        model.addAttribute("branches", Branch.values());
        return "/admin/speaker/edit.jsp";
    }
    if (!file.isEmpty()) {
        try {
            byte[] bytes = file.getBytes();
            speaker.setPicture(thumbnailService.thumbImage(bytes, 280, 326));
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        // empty file is it edit?
        if (speaker.getId() != null) {
            Speaker oldSpeaker = adminFacade.findOneSpeaker(speaker.getId());
            byte[] oldImage = oldSpeaker.getPicture();
            speaker.setPicture(oldImage);
        }
    }
    this.adminFacade.saveSpeaker(speaker);
    return "redirect:/admin/speaker/view";
}
Also used : Speaker(site.model.Speaker) Transactional(javax.transaction.Transactional) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with Speaker

use of site.model.Speaker in project jprime by bgjug.

the class AdminSpeakerController method edit.

@Transactional
@RequestMapping(value = "/edit/{itemId}", method = RequestMethod.GET)
public String edit(@PathVariable("itemId") Long itemId, Model model) {
    Speaker speaker = adminFacade.findOneSpeaker(itemId);
    model.addAttribute("speaker", speaker);
    model.addAttribute("branches", Branch.values());
    return "/admin/speaker/edit.jsp";
}
Also used : Speaker(site.model.Speaker) Transactional(javax.transaction.Transactional) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with Speaker

use of site.model.Speaker in project jprime by bgjug.

the class SubmissionControllerTest method setUp.

@Before
public void setUp() throws Exception {
    final SubmissionController bean = wac.getBean(SubmissionController.class);
    this.mailer = new MailServiceMock();
    bean.setMailFacade(mailer);
    mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
    Speaker brianGoetz = new Speaker("Brian", "Goetz", "brian@oracle.com", "The Java Language Architect", "@briangoetz", true, true);
    Speaker ivanIvanov = new Speaker("Ivan St.", "Ivanov", "ivan@jprime.io", "JBoss Forge", "@ivan_stefanov", false, true);
    Speaker naydenGochev = new Speaker("Nayden", "Gochev", "nayden@jprio.io", "The Spring Guy", "@gochev", false, true);
    Speaker ivanIvanov2 = new Speaker("Ivan St.", "Ivanov", "ivan@forge.com", "JBoss Forge", "@ivan_stefanov", false, true);
    valhalla = submissionRepository.save(new Submission("Project Valhalla", "Primitives in Generics", SessionLevel.ADVANCED, SessionType.ConferenceSession, brianGoetz));
    valhalla.setBranch(Globals.CURRENT_BRANCH);
    forge = submissionRepository.save(new Submission("JBoss Forge", "Productivity for Java EE", SessionLevel.INTERMEDIATE, SessionType.ConferenceSession, ivanIvanov));
    forge.setBranch(Globals.CURRENT_BRANCH);
    bootAddon = submissionRepository.save(new Submission("Spring Boot Forge Addon", "We are not hipsters", SessionLevel.BEGINNER, SessionType.ConferenceSession, naydenGochev, ivanIvanov2));
    bootAddon.setBranch(Branch.YEAR_2016);
}
Also used : Submission(site.model.Submission) Speaker(site.model.Speaker) Before(org.junit.Before)

Aggregations

Speaker (site.model.Speaker)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 Transactional (javax.transaction.Transactional)2 Before (org.junit.Before)2 Test (org.junit.Test)2 Submission (site.model.Submission)2 Session (site.model.Session)1 VenueHall (site.model.VenueHall)1