Skip to content

Commit d158e6f

Browse files
committed
Added JSON and XML examples
1 parent 196c4b8 commit d158e6f

File tree

5 files changed

+28
-29
lines changed

5 files changed

+28
-29
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@
100100
<groupId>org.springframework.boot</groupId>
101101
<artifactId>spring-boot-starter-jooq</artifactId>
102102
</dependency>
103+
104+
<dependency>
105+
<groupId>com.fasterxml.jackson.dataformat</groupId>
106+
<artifactId>jackson-dataformat-xml</artifactId>
107+
</dependency>
108+
103109
<dependency>
104110
<groupId>org.flywaydb</groupId>
105111
<artifactId>flyway-core</artifactId>

src/main/java/io/seventytwo/demo/api/order/OrderControllerV3.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public OrderControllerV3(DSLContext dslContext) {
2525
}
2626

2727
@GetMapping(value = "/api/v3/orders", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
28-
public List<OrderDTO> getOrdersAsRecords(@RequestParam Integer customerId) {
28+
public List<OrderDTO> getOrdersAsJson(@RequestParam Integer customerId) {
2929
return dslContext
3030
.select(PURCHASE_ORDER.ID,
3131
PURCHASE_ORDER.ORDER_DATE,
@@ -40,4 +40,5 @@ public List<OrderDTO> getOrdersAsRecords(@RequestParam Integer customerId) {
4040
.where(PURCHASE_ORDER.CUSTOMER_ID.eq(customerId))
4141
.fetch(mapping(OrderDTO::new));
4242
}
43+
4344
}

src/main/java/io/seventytwo/demo/views/hello/HelloView.java

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.seventytwo.demo.views.home;
2+
3+
import com.vaadin.flow.component.html.H1;
4+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
5+
import com.vaadin.flow.router.PageTitle;
6+
import com.vaadin.flow.router.Route;
7+
import io.seventytwo.demo.views.layout.ApplicationLayout;
8+
9+
@Route(value = "", layout = ApplicationLayout.class)
10+
@PageTitle("Home")
11+
public class HomeView extends VerticalLayout {
12+
13+
public HomeView() {
14+
setHeightFull();
15+
16+
add(new H1("High-performance data access with Vaadin"));
17+
}
18+
}

src/main/java/io/seventytwo/demo/views/layout/ApplicationLayout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.seventytwo.demo.views.layout;
22

33
import io.seventytwo.demo.views.employee.EmployeeTreeView;
4-
import io.seventytwo.demo.views.hello.HelloView;
4+
import io.seventytwo.demo.views.home.HomeView;
55
import io.seventytwo.demo.views.order.CustomerRevenueV10JpaView;
66
import io.seventytwo.demo.views.order.CustomerRevenueV11JpaPagingView;
77
import io.seventytwo.demo.views.order.CustomerRevenueV12JpaCountView;
@@ -86,7 +86,7 @@ private Tabs createMenu() {
8686

8787
private Component[] createMenuItems() {
8888
return new Tab[]{
89-
createTab("Hello", HelloView.class),
89+
createTab("Hello", HomeView.class),
9090
createTab("Customer Revenue List", CustomerRevenueV10JpaView.class),
9191
createTab("Customer Revenue Paging", CustomerRevenueV11JpaPagingView.class),
9292
createTab("Customer Revenue Count", CustomerRevenueV12JpaCountView.class),

0 commit comments

Comments
 (0)