// Path: connote-service/src/main/java/de/codecentric/resilient/connote/service/ConnoteService.java
// @Service
// public class ConnoteService {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(ConnoteService.class);
// 
//     private ConnoteRepository connoteRepository;
// 
//     private final RandomConnoteGenerator connoteGenerator;
// 
//     @Autowired
//     public ConnoteService(ConnoteRepository connoteRepository, RandomConnoteGenerator connoteGenerator) {
// 
//         this.connoteRepository = connoteRepository;
//         this.connoteGenerator = connoteGenerator;
//     }
// 
//     public ConnoteDTO createConnote() {
// 
//         Long nextConnote;
// 
//         do {
//             nextConnote = connoteGenerator.randomNumber();
// 
//         } while (!isUnique(nextConnote));
// 
//         Connote connoteSaved = createConnote(nextConnote);
// 
//         ConnoteDTO connoteDTO = new ConnoteDTO();
//         connoteDTO.setConnote(connoteSaved.getConnote());
// 
//         return connoteDTO;
// 
//     }
// 
//     private Connote createConnote(Long connote) {
// 
//         Connote connoteSaved = connoteRepository.save(new Connote(connote));
// 
//         LOGGER.debug(LOGGER.isDebugEnabled() ? "Saved new Connote entity: " + connoteSaved.getConnote() : null);
// 
//         return connoteSaved;
//     }
// 
//     private boolean isUnique(Long connote) {
// 
//         return connoteRepository.findOne(connote) == null;
// 
//     }
// 
// }
// 
// Path: service-library/src/main/java/de/codecentric/resilient/dto/ConnoteDTO.java
// @JsonInclude(JsonInclude.Include.NON_NULL)
// public class ConnoteDTO extends FallbackAbstractDTO {
// 
//     @JsonProperty(required = true)
//     private Long connote;
// 
//     public void setConnote(Long connote) {
//         this.connote = connote;
//     }
// 
//     public Long getConnote() {
//         return connote;
//     }
// 
// }


import javax.servlet.http.HttpServletRequest;
import de.codecentric.resilient.connote.service.ConnoteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import de.codecentric.resilient.dto.ConnoteDTO;
package de.codecentric.resilient.connote.rest;



/**
 * @author Benjamin Wilms
 */
@RestController
@RequestMapping("rest/connote")
public class ConnoteController {

    private static final Logger LOGGER = LoggerFactory.getLogger(ConnoteController.class);

// Path: connote-service/src/main/java/de/codecentric/resilient/connote/service/ConnoteService.java
// @Service
// public class ConnoteService {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(ConnoteService.class);
// 
//     private ConnoteRepository connoteRepository;
// 
//     private final RandomConnoteGenerator connoteGenerator;
// 
//     @Autowired
//     public ConnoteService(ConnoteRepository connoteRepository, RandomConnoteGenerator connoteGenerator) {
// 
//         this.connoteRepository = connoteRepository;
//         this.connoteGenerator = connoteGenerator;
//     }
// 
//     public ConnoteDTO createConnote() {
// 
//         Long nextConnote;
// 
//         do {
//             nextConnote = connoteGenerator.randomNumber();
// 
//         } while (!isUnique(nextConnote));
// 
//         Connote connoteSaved = createConnote(nextConnote);
// 
//         ConnoteDTO connoteDTO = new ConnoteDTO();
//         connoteDTO.setConnote(connoteSaved.getConnote());
// 
//         return connoteDTO;
// 
//     }
// 
//     private Connote createConnote(Long connote) {
// 
//         Connote connoteSaved = connoteRepository.save(new Connote(connote));
// 
//         LOGGER.debug(LOGGER.isDebugEnabled() ? "Saved new Connote entity: " + connoteSaved.getConnote() : null);
// 
//         return connoteSaved;
//     }
// 
//     private boolean isUnique(Long connote) {
// 
//         return connoteRepository.findOne(connote) == null;
// 
//     }
// 
// }
// 
// Path: service-library/src/main/java/de/codecentric/resilient/dto/ConnoteDTO.java
// @JsonInclude(JsonInclude.Include.NON_NULL)
// public class ConnoteDTO extends FallbackAbstractDTO {
// 
//     @JsonProperty(required = true)
//     private Long connote;
// 
//     public void setConnote(Long connote) {
//         this.connote = connote;
//     }
// 
//     public Long getConnote() {
//         return connote;
//     }
// 
// }


// Path: connote-service/src/main/java/de/codecentric/resilient/connote/rest/ConnoteController.java
import javax.servlet.http.HttpServletRequest;
import de.codecentric.resilient.connote.service.ConnoteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import de.codecentric.resilient.dto.ConnoteDTO;

package de.codecentric.resilient.connote.rest;



/**
 * @author Benjamin Wilms
 */
@RestController
@RequestMapping("rest/connote")
public class ConnoteController {

    private static final Logger LOGGER = LoggerFactory.getLogger(ConnoteController.class);

    private ConnoteService connoteService;