// Path: data-care/src/main/java/de/michlb/sample/rabbit/service/ProductMessageService.java
// @Service
// public class ProductMessageService {
//     private static final Logger LOGGER = LoggerFactory.getLogger(ProductMessageService.class);
// 
//     @Autowired
//     private ObjectMapper objectMapper = null;
// 
//     @Autowired
//     private MessageService messageService = null;
// 
//     /**
//      * convert product to json and send it to product-queue
//      * @param product ProductForm object to send
//      * @return true if success, otherwise false
//      * @throws JsonProcessingException when error occurs in amqp process
//      */
//     public boolean sendQueueMessage(ProductForm product) throws JsonProcessingException {
//         String queueName = "product-queue";
// 
//         String jsonMessage = objectMapper.writeValueAsString(product);
// 
//         return messageService.sendQueueMessage(queueName, jsonMessage);
//     }
// }
// 
// Path: data-care/src/main/java/de/michlb/sample/rabbit/web/bean/ProductForm.java
// @Data
// public class ProductForm {
//     private String name;
//     private String pictureUrl;
//     private Double price;
// }


import com.fasterxml.jackson.core.JsonProcessingException;
import de.michlb.sample.rabbit.service.ProductMessageService;
import de.michlb.sample.rabbit.web.bean.ProductForm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
package de.michlb.sample.rabbit.web.controller;


/**
 * @author Michael Bartsch
 */
@Controller
public class ProductCareController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ProductCareController.class);

    @Autowired
    private ProductMessageService ProductMessageService = null;

    @GetMapping("/product")
    public String show(Model model) {

        model.addAttribute("productForm", new ProductForm());

// Path: data-care/src/main/java/de/michlb/sample/rabbit/service/ProductMessageService.java
// @Service
// public class ProductMessageService {
//     private static final Logger LOGGER = LoggerFactory.getLogger(ProductMessageService.class);
// 
//     @Autowired
//     private ObjectMapper objectMapper = null;
// 
//     @Autowired
//     private MessageService messageService = null;
// 
//     /**
//      * convert product to json and send it to product-queue
//      * @param product ProductForm object to send
//      * @return true if success, otherwise false
//      * @throws JsonProcessingException when error occurs in amqp process
//      */
//     public boolean sendQueueMessage(ProductForm product) throws JsonProcessingException {
//         String queueName = "product-queue";
// 
//         String jsonMessage = objectMapper.writeValueAsString(product);
// 
//         return messageService.sendQueueMessage(queueName, jsonMessage);
//     }
// }
// 
// Path: data-care/src/main/java/de/michlb/sample/rabbit/web/bean/ProductForm.java
// @Data
// public class ProductForm {
//     private String name;
//     private String pictureUrl;
//     private Double price;
// }


// Path: data-care/src/main/java/de/michlb/sample/rabbit/web/controller/ProductCareController.java
import com.fasterxml.jackson.core.JsonProcessingException;
import de.michlb.sample.rabbit.service.ProductMessageService;
import de.michlb.sample.rabbit.web.bean.ProductForm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;

package de.michlb.sample.rabbit.web.controller;


/**
 * @author Michael Bartsch
 */
@Controller
public class ProductCareController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ProductCareController.class);

    @Autowired
    private ProductMessageService ProductMessageService = null;

    @GetMapping("/product")
    public String show(Model model) {

        model.addAttribute("productForm", new ProductForm());

        return "product";