Package ua.com.jpy.controllers.profile

Source Code of ua.com.jpy.controllers.profile.CustomerController

package ua.com.jpy.controllers.profile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;

import ua.com.jpy.entity.customer.Customer;
import ua.com.jpy.services.customer.ICustomerService;

/**
* @author LSD25
*
*/
@Controller
@SessionAttributes({ "customer" })
@RequestMapping(value = "/customer")
public class CustomerController {
 
  private static final Log log = LogFactory.getLog(CustomerController.class);
 
  @Autowired
  private ICustomerService customerService;

  @SuppressWarnings("deprecation")
  @RequestMapping(value = "/profile", method = RequestMethod.GET)
  public String profile(ModelMap modelMap) {
    Customer customer = customerService.getCurrentCustomer();
    if(customer != null) {
      modelMap.addAttribute(customer);
      modelMap.addObject(customer);
      log.info("Customer found, login: " + customer.getLogin());
    } else {
      log.info("Customer was not found");
    }
    return "profile";
  }
 
}
TOP

Related Classes of ua.com.jpy.controllers.profile.CustomerController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.