Java tutorial
/* * The MIT License * * Copyright 2015 Christiaan Hoijtink <christiaan.hoijtink@hva.nl>. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.klm.workshop.controller.participant; import java.util.HashMap; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; /** * Participant Target Behavior controller * * @author Christiaan Hoijtink <christiaan.hoijtink@hva.nl> */ @Controller("participantTargetBehaviorController") @RequestMapping(value = "/participant/target-behavior") public class TargetBehaviorController { /** * The current workshop step. Used to identify the current step in the steps * breadcrumbs above every page. The current step is defined as PascalCase. */ public static final String CURRENT_STEP = "TargetBehavior"; /** * Path where the view folder of this controller is located. */ public static final String VIEW_FOLDER = "participant/target-behavior"; /** * Show panel with verbs for the "Define Target Behavior" part * * @param model Objects and view * @return Panel with the verbs for selecting the Target Behavior */ @RequestMapping(value = "/index", method = RequestMethod.GET) public ModelAndView index(ModelAndView model) { model.addObject("workshopStep", CURRENT_STEP); model.addObject("verbs", getVerbsForCurrentSession()); model.setViewName(VIEW_FOLDER + "/index"); return model; } /** * The verbs that need to be displayed during the current session. * It's returning dummy data at the moment. * * @return Target behaviors hash map with key value */ private HashMap getVerbsForCurrentSession() { HashMap<String, String> verbs = new HashMap(); verbs.put("advocate", "Advocate"); verbs.put("argue", "Argue"); verbs.put("comment", "Comment"); verbs.put("compare", "Compare"); verbs.put("compete", "Compete"); verbs.put("curate", "Curate"); verbs.put("dance", "Dance"); verbs.put("discuss", "Discuss"); verbs.put("explore", "Explore"); verbs.put("focus", "Focus"); verbs.put("flirt", "Flirt"); verbs.put("give", "Give"); verbs.put("greet", "Greet"); verbs.put("harass", "Harass"); verbs.put("help", "Help"); verbs.put("inform", "Inform"); verbs.put("join", "Join"); verbs.put("learn", "Learn"); verbs.put("like", "Like"); verbs.put("poke", "Poke"); verbs.put("plan", "Plan"); verbs.put("rate", "Rate"); verbs.put("read", "Read"); verbs.put("recommend", "Recommend"); verbs.put("share", "Share"); verbs.put("show-off", "Show Off"); verbs.put("taunt", "Taunt"); verbs.put("view", "View"); verbs.put("vote", "Vote"); verbs.put("yell", "Yell"); return verbs; } }