-
Notifications
You must be signed in to change notification settings - Fork 3
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 #14 from CJSCommonPlatform/dev/TP-1102-update-cake…
…shop-to-utilise-pojo-compatible-requester-and-sender-methods Update cakeshop query api and view with pojo examples
- Loading branch information
Showing
18 changed files
with
300 additions
and
32 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
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
23 changes: 23 additions & 0 deletions
23
.../src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCake.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,23 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.api.request; | ||
|
||
import java.util.UUID; | ||
|
||
public class SearchCake { | ||
|
||
private final UUID id; | ||
private final String name; | ||
|
||
public SearchCake(final UUID id, final String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public UUID getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCakeOrder.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,31 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.api.request; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.UUID; | ||
|
||
public class SearchCakeOrder { | ||
private UUID orderId; | ||
|
||
private UUID recipeId; | ||
|
||
private ZonedDateTime deliveryDate; | ||
|
||
|
||
public SearchCakeOrder(final UUID orderId, final UUID recipeId, final ZonedDateTime deliveryDate) { | ||
this.orderId = orderId; | ||
this.recipeId = recipeId; | ||
this.deliveryDate = deliveryDate; | ||
} | ||
|
||
public UUID getOrderId() { | ||
return orderId; | ||
} | ||
|
||
public UUID getRecipeId() { | ||
return recipeId; | ||
} | ||
|
||
public ZonedDateTime getDeliveryDate() { | ||
return deliveryDate; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...c/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchRecipes.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 uk.gov.justice.services.example.cakeshop.query.api.request; | ||
|
||
public class SearchRecipes { | ||
|
||
private int pagesize; | ||
private String name; | ||
private boolean glutenFree; | ||
|
||
public SearchRecipes(final int pagesize) { | ||
this.pagesize = pagesize; | ||
} | ||
|
||
public int getPagesize() { | ||
return pagesize; | ||
} | ||
|
||
public void setPagesize(final int pagesize) { | ||
this.pagesize = pagesize; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(final String name) { | ||
this.name = name; | ||
} | ||
|
||
public boolean isGlutenFree() { | ||
return glutenFree; | ||
} | ||
|
||
public void setGlutenFree(final boolean glutenFree) { | ||
this.glutenFree = glutenFree; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
.../main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakeOrderView.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,31 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.api.response; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.UUID; | ||
|
||
public class CakeOrderView { | ||
private UUID orderId; | ||
|
||
private UUID recipeId; | ||
|
||
private ZonedDateTime deliveryDate; | ||
|
||
|
||
public CakeOrderView(final UUID orderId, final UUID recipeId, final ZonedDateTime deliveryDate) { | ||
this.orderId = orderId; | ||
this.recipeId = recipeId; | ||
this.deliveryDate = deliveryDate; | ||
} | ||
|
||
public UUID getOrderId() { | ||
return orderId; | ||
} | ||
|
||
public UUID getRecipeId() { | ||
return recipeId; | ||
} | ||
|
||
public ZonedDateTime getDeliveryDate() { | ||
return deliveryDate; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakesView.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,18 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.api.response; | ||
|
||
import uk.gov.justice.services.example.cakeshop.query.api.request.SearchCake; | ||
|
||
import java.util.List; | ||
|
||
public class CakesView { | ||
|
||
private final List<SearchCake> cakes; | ||
|
||
public CakesView(final List<SearchCake> cakes) { | ||
this.cakes = cakes; | ||
} | ||
|
||
public List<SearchCake> getCakes() { | ||
return cakes; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipeView.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,55 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.api.response; | ||
|
||
import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; | ||
|
||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
/** | ||
* View representation of an {@link Recipe}. | ||
*/ | ||
public class RecipeView { | ||
|
||
private final UUID id; | ||
private final String name; | ||
private final boolean glutenFree; | ||
|
||
public RecipeView(final UUID id, final String name, final boolean glutenFree) { | ||
this.id = id; | ||
this.name = name; | ||
this.glutenFree = glutenFree; | ||
} | ||
|
||
public RecipeView(final Recipe recipe) { | ||
this.id = recipe.getId(); | ||
this.name = recipe.getName(); | ||
this.glutenFree = recipe.isGlutenFree(); | ||
} | ||
|
||
public UUID getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public boolean isGlutenFree() { | ||
return glutenFree; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
RecipeView that = (RecipeView) o; | ||
return Objects.equals(getId(), that.getId()) && | ||
Objects.equals(getName(), that.getName()) && | ||
isGlutenFree() == that.isGlutenFree(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(getId(), getName()); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...rc/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipesView.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,35 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.api.response; | ||
|
||
import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* View representation of a list of {@link Recipe}'s. | ||
*/ | ||
public class RecipesView { | ||
|
||
private final List<RecipeView> recipes; | ||
|
||
public RecipesView(final List<RecipeView> recipes) { | ||
this.recipes = recipes; | ||
} | ||
|
||
public List<RecipeView> getRecipes() { | ||
return recipes; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
final RecipesView that = (RecipesView) o; | ||
return Objects.equals(recipes, that.getRecipes()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(recipes); | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...ain/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchCakeOrder.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,31 @@ | ||
package uk.gov.justice.services.example.cakeshop.query.view.request; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.UUID; | ||
|
||
public class SearchCakeOrder { | ||
private UUID orderId; | ||
|
||
private UUID recipeId; | ||
|
||
private ZonedDateTime deliveryDate; | ||
|
||
|
||
public SearchCakeOrder(final UUID orderId, final UUID recipeId, final ZonedDateTime deliveryDate) { | ||
this.orderId = orderId; | ||
this.recipeId = recipeId; | ||
this.deliveryDate = deliveryDate; | ||
} | ||
|
||
public UUID getOrderId() { | ||
return orderId; | ||
} | ||
|
||
public UUID getRecipeId() { | ||
return recipeId; | ||
} | ||
|
||
public ZonedDateTime getDeliveryDate() { | ||
return deliveryDate; | ||
} | ||
} |
Oops, something went wrong.