-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from Microarchitecturovisco/RSWW-136-transport…
…-get-data-from-datagenerator RSWW-136 transport get data from data generator
- Loading branch information
Showing
12 changed files
with
209 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...in/java/org/microarchitecturovisco/transport/model/dto/data_generator/DataUpdateType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.microarchitecturovisco.transport.model.dto.data_generator; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum DataUpdateType { | ||
CREATE("CREATE"), | ||
UPDATE("UPDATE"); | ||
|
||
private final String value; | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
...org/microarchitecturovisco/transport/model/dto/data_generator/TransportUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.microarchitecturovisco.transport.model.dto.data_generator; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class TransportUpdateRequest { | ||
|
||
private DataUpdateType updateType; | ||
|
||
private UUID id; | ||
|
||
private UUID courseId; | ||
|
||
private UUID courseLocationFromId; | ||
private UUID courseLocationToId; | ||
|
||
private LocalDateTime departureDate; | ||
|
||
private int capacity; | ||
|
||
private float pricePerAdult; | ||
} | ||
|
29 changes: 29 additions & 0 deletions
29
...src/main/java/org/microarchitecturovisco/transport/model/events/TransportUpdateEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.microarchitecturovisco.transport.model.events; | ||
|
||
import jakarta.persistence.Entity; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
|
||
@Entity | ||
@NoArgsConstructor | ||
@SuperBuilder | ||
@Getter | ||
@Setter | ||
public class TransportUpdateEvent extends TransportEvent { | ||
private int capacity; | ||
private float pricePerAdult; | ||
|
||
public TransportUpdateEvent(UUID transportId, int capacity, float pricePerAdult){ | ||
this.setEventTimeStamp(LocalDateTime.now()); | ||
this.setIdTransport(transportId); | ||
this.capacity = capacity; | ||
this.pricePerAdult = pricePerAdult; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
.../java/org/microarchitecturovisco/transport/queues/config/DataGeneratorExchangeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.microarchitecturovisco.transport.queues.config; | ||
|
||
|
||
import org.springframework.amqp.core.BindingBuilder; | ||
import org.springframework.amqp.core.FanoutExchange; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import org.springframework.amqp.core.Queue; | ||
import org.springframework.amqp.core.Binding; | ||
import java.util.UUID; | ||
|
||
@Configuration | ||
public class DataGeneratorExchangeConfig { | ||
|
||
public static final String EXCHANGE_DATA_GENERATOR = "data.generate.transports.exchange"; | ||
|
||
@Bean | ||
public FanoutExchange handleDataGeneratorExchange() { | ||
return new FanoutExchange(EXCHANGE_DATA_GENERATOR); | ||
} | ||
|
||
@Bean | ||
public Queue handleDataGeneratorCreateQueue() { | ||
String uniqueQueueName = "data.generate.transports.queue" + UUID.randomUUID(); | ||
return new Queue(uniqueQueueName, false, false, false); | ||
} | ||
|
||
@Bean | ||
public Binding handleDataGeneratorBinding( | ||
FanoutExchange handleDataGeneratorExchange, | ||
Queue handleDataGeneratorCreateQueue) { | ||
return BindingBuilder.bind(handleDataGeneratorCreateQueue).to(handleDataGeneratorExchange); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters