forked from microservices-patterns/ftgo-application
-
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.
microservices-patterns#91: Changed order api to improve documentation.
- Loading branch information
Showing
14 changed files
with
119 additions
and
51 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
ftgo-common/src/main/java/net/chrisrichardson/ftgo/common/RevisedOrderLineItem.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,50 @@ | ||
package net.chrisrichardson.ftgo.common; | ||
|
||
import org.apache.commons.lang.builder.EqualsBuilder; | ||
import org.apache.commons.lang.builder.ToStringBuilder; | ||
|
||
import java.util.Objects; | ||
|
||
public class RevisedOrderLineItem { | ||
private int quantity; | ||
private String menuItemId; | ||
|
||
public RevisedOrderLineItem() { | ||
} | ||
|
||
public RevisedOrderLineItem(int quantity, String menuItemId) { | ||
this.quantity = quantity; | ||
this.menuItemId = menuItemId; | ||
} | ||
|
||
public int getQuantity() { | ||
return quantity; | ||
} | ||
|
||
public void setQuantity(int quantity) { | ||
this.quantity = quantity; | ||
} | ||
|
||
public String getMenuItemId() { | ||
return menuItemId; | ||
} | ||
|
||
public void setMenuItemId(String menuItemId) { | ||
this.menuItemId = menuItemId; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return ToStringBuilder.reflectionToString(this); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
return EqualsBuilder.reflectionEquals(this, o); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(quantity, menuItemId); | ||
} | ||
} |
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
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
16 changes: 8 additions & 8 deletions
16
...e-api/src/main/java/net/chrisrichardson/ftgo/orderservice/api/web/ReviseOrderRequest.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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
package net.chrisrichardson.ftgo.orderservice.api.web; | ||
|
||
import java.util.Map; | ||
import net.chrisrichardson.ftgo.common.RevisedOrderLineItem; | ||
|
||
public class ReviseOrderRequest { | ||
private Map<String, Integer> revisedLineItemQuantities; | ||
private RevisedOrderLineItem[] revisedOrderLineItems; | ||
|
||
private ReviseOrderRequest() { | ||
} | ||
|
||
public ReviseOrderRequest(Map<String, Integer> revisedLineItemQuantities) { | ||
this.revisedLineItemQuantities = revisedLineItemQuantities; | ||
public ReviseOrderRequest(RevisedOrderLineItem[] revisedOrderLineItems) { | ||
this.revisedOrderLineItems = revisedOrderLineItems; | ||
} | ||
|
||
public Map<String, Integer> getRevisedLineItemQuantities() { | ||
return revisedLineItemQuantities; | ||
public RevisedOrderLineItem[] getRevisedOrderLineItems() { | ||
return revisedOrderLineItems; | ||
} | ||
|
||
public void setRevisedLineItemQuantities(Map<String, Integer> revisedLineItemQuantities) { | ||
this.revisedLineItemQuantities = revisedLineItemQuantities; | ||
public void setRevisedOrderLineItems(RevisedOrderLineItem[] revisedOrderLineItems) { | ||
this.revisedOrderLineItems = revisedOrderLineItems; | ||
} | ||
} |
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
20 changes: 10 additions & 10 deletions
20
...der-service/src/main/java/net/chrisrichardson/ftgo/orderservice/domain/OrderRevision.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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
package net.chrisrichardson.ftgo.orderservice.domain; | ||
|
||
import java.util.Map; | ||
import net.chrisrichardson.ftgo.common.RevisedOrderLineItem; | ||
|
||
import java.util.Optional; | ||
|
||
public class OrderRevision { | ||
|
||
private Optional<DeliveryInformation> deliveryInformation = Optional.empty(); | ||
private Map<String, Integer> revisedLineItemQuantities; | ||
private RevisedOrderLineItem[] revisedOrderLineItems; | ||
|
||
private OrderRevision() { | ||
} | ||
|
||
public OrderRevision(Optional<DeliveryInformation> deliveryInformation, Map<String, Integer> revisedLineItemQuantities) { | ||
public OrderRevision(Optional<DeliveryInformation> deliveryInformation, RevisedOrderLineItem[] revisedOrderLineItems) { | ||
this.deliveryInformation = deliveryInformation; | ||
this.revisedLineItemQuantities = revisedLineItemQuantities; | ||
this.revisedOrderLineItems = revisedOrderLineItems; | ||
} | ||
|
||
public void setDeliveryInformation(Optional<DeliveryInformation> deliveryInformation) { | ||
this.deliveryInformation = deliveryInformation; | ||
} | ||
|
||
public void setRevisedLineItemQuantities(Map<String, Integer> revisedLineItemQuantities) { | ||
this.revisedLineItemQuantities = revisedLineItemQuantities; | ||
} | ||
|
||
public Optional<DeliveryInformation> getDeliveryInformation() { | ||
return deliveryInformation; | ||
} | ||
|
||
public RevisedOrderLineItem[] getRevisedOrderLineItems() { | ||
return revisedOrderLineItems; | ||
} | ||
|
||
public Map<String, Integer> getRevisedLineItemQuantities() { | ||
return revisedLineItemQuantities; | ||
public void setRevisedOrderLineItems(RevisedOrderLineItem[] revisedOrderLineItems) { | ||
this.revisedOrderLineItems = revisedOrderLineItems; | ||
} | ||
} |
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
Oops, something went wrong.