Added warehouse context

This commit is contained in:
Kenny Bastani
2017-01-09 09:22:37 -08:00
parent 95d594bdac
commit 7b21e0c579
187 changed files with 8160 additions and 112 deletions

View File

@@ -29,9 +29,9 @@ import java.net.URI;
* @see EventService
*/
@SuppressWarnings("unchecked")
class EventServiceImpl<T extends Event, ID extends Serializable> implements EventService<T, ID> {
public class BasicEventService<T extends Event, ID extends Serializable> implements EventService<T, ID> {
private static final Logger log = Logger.getLogger(EventServiceImpl.class);
private static final Logger log = Logger.getLogger(BasicEventService.class);
@Value("${events.worker:http://localhost:8080/v1/events}")
private String eventsWorker;
@@ -40,7 +40,7 @@ class EventServiceImpl<T extends Event, ID extends Serializable> implements Even
private final Source eventStream;
private final RestTemplate restTemplate;
EventServiceImpl(EventRepository<T, ID> eventRepository, Source eventStream, @LoadBalanced RestTemplate
public BasicEventService(EventRepository<T, ID> eventRepository, Source eventStream, @LoadBalanced RestTemplate
restTemplate) {
this.eventRepository = eventRepository;
this.eventStream = eventStream;

View File

@@ -10,8 +10,6 @@ import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
/**
* Abstract implementation of the {@link Event} entity.
*
@@ -62,9 +60,4 @@ public abstract class Event<T extends Aggregate, E, ID extends Serializable> ext
public String toString() {
return String.format("links: %s", getLinks().toString());
}
@Override
public Link getId() {
return linkTo(EventController.class).slash("events").slash(getEventId()).withSelfRel();
}
}

View File

@@ -1,6 +1,7 @@
package demo.event;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
@@ -8,12 +9,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* This class auto-configures a {@link EventServiceImpl} bean.
* This class auto-configures a {@link BasicEventService} bean.
*
* @author Kenny Bastani
*/
@Configuration
@ConditionalOnClass({ EventRepository.class, Source.class, RestTemplate.class })
@ConditionalOnClass({EventRepository.class, Source.class, RestTemplate.class})
@ConditionalOnMissingBean(EventService.class)
@EnableConfigurationProperties(EventProperties.class)
public class EventAutoConfig {
@@ -30,6 +32,6 @@ public class EventAutoConfig {
@SuppressWarnings("unchecked")
@Bean
public EventService eventService() {
return new EventServiceImpl(eventRepository, source, restTemplate);
return new BasicEventService(eventRepository, source, restTemplate);
}
}

View File

@@ -12,8 +12,6 @@ import java.util.Optional;
*
* @author Kenny Bastani
*/
@RestController
@RequestMapping("/v1")
public class EventController<T extends Event, ID extends Serializable> {
private final EventService<T, Long> eventService;

View File

@@ -11,7 +11,7 @@ import java.io.Serializable;
* @author Kenny Bastani
* @see Event
* @see Events
* @see EventServiceImpl
* @see BasicEventService
*/
public interface EventService<T extends Event, ID extends Serializable> {