package io.reactivesw.catalog.inventory.application.controller;

import static io.reactivesw.route.InventoryEntryRouter.INVENTORY_ENTRY_ROOT;

import io.reactivesw.catalog.inventory.application.model.InventoryEntry;
import io.reactivesw.catalog.inventory.application.model.InventoryEntryDraft;
import io.reactivesw.catalog.inventory.domain.service.InventoryEntryService;
import io.swagger.annotations.ApiOperation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Davis on 16/12/21.
 */
@RestController
public class InventoryEntryController {
  /**
   * log.
   */
  private static final Logger LOG = LoggerFactory.getLogger(InventoryEntryController.class);

  /**
   * The Inventory entry service.
   */
  @Autowired
  private transient InventoryEntryService inventoryEntryService;

  /**
   * Create inventory entry inventory entry.
   *
   * @param draft the draft
   * @return the inventory entry
   */
  @ApiOperation("Create InventoryEntry")
  @PostMapping(INVENTORY_ENTRY_ROOT)
  public InventoryEntry createInventoryEntry(InventoryEntryDraft draft) {
    LOG.debug("enter createInventoryEntry, inventory entry draft is : {}", draft.toString());

    InventoryEntry result = inventoryEntryService.createInventoryEntry(draft);

    LOG.debug("end createInventoryEntry, new InventoryEntry is : {}", result.toString());

    return result;
  }
}

@@ -129,20 +129,175 @@
 Y_ENTRY_
-ROOT
+ID;%0Aimport static io.reactivesw.route.InventoryEntryRouter.INVENTORY_ENTRY_ROOT;%0Aimport static io.reactivesw.route.InventoryEntryRouter.INVENTORY_ENTRY_WITH_ID
 ;%0A%0Aimpor
@@ -562,16 +562,56 @@
 eration;
+%0Aimport io.swagger.annotations.ApiParam;
 %0A%0Aimport
@@ -724,16 +724,136 @@
 owired;%0A
+import org.springframework.web.bind.annotation.GetMapping;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0A
 import o
@@ -1752,24 +1752,24 @@
 ry(draft);%0A%0A
-
     LOG.debu
@@ -1843,24 +1843,770 @@
 String());%0A%0A
+    return result;%0A  %7D%0A%0A  /**%0A   * Gets inventory entry by id.%0A   *%0A   * @param id the id%0A   * @return the inventory entry by id%0A   */%0A  @ApiOperation(%22get InventoryEntry by Id%22)%0A  @GetMapping(INVENTORY_ENTRY_WITH_ID)%0A  public InventoryEntry getInventoryEntryById(@PathVariable(value = INVENTORY_ENTRY_ID)%0A                                              @ApiParam(value = %22InventoryEntry ID%22,%0A                                                  required = true)%0A                                                  String id) %7B%0A    LOG.debug(%22enter getInventoryEntryById, id is : %7B%7D%22, id);%0A%0A    InventoryEntry result = inventoryEntryService.getInventoryEntryById(id);%0A%0A    LOG.debug(%22end getInventoryEntryById, get result is : %7B%7D%22, result.toString());%0A%0A
     return r

add get inventoryentry by id to controller