From f15b35295da1e13299abebe9b61b19175595a266 Mon Sep 17 00:00:00 2001 From: filippo-ferrari Date: Mon, 9 Sep 2024 18:10:17 +0200 Subject: [PATCH] refactor: change service name --- .../services/{ServiceView.java => ViewsService.java} | 4 ++-- .../munera/views/expenses/ExpensesView.java | 8 ++++---- .../application/munera/views/people/PeopleView.java | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) rename src/main/java/com/application/munera/services/{ServiceView.java => ViewsService.java} (95%) diff --git a/src/main/java/com/application/munera/services/ServiceView.java b/src/main/java/com/application/munera/services/ViewsService.java similarity index 95% rename from src/main/java/com/application/munera/services/ServiceView.java rename to src/main/java/com/application/munera/services/ViewsService.java index 28c1d2b..a806a4b 100644 --- a/src/main/java/com/application/munera/services/ServiceView.java +++ b/src/main/java/com/application/munera/services/ViewsService.java @@ -9,11 +9,11 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; @Service -public class ServiceView { +public class ViewsService { private final ExpenseService expenseService; - public ServiceView(ExpenseService expenseService) { + public ViewsService(ExpenseService expenseService) { this.expenseService = expenseService; } diff --git a/src/main/java/com/application/munera/views/expenses/ExpensesView.java b/src/main/java/com/application/munera/views/expenses/ExpensesView.java index a6f02e6..a294a29 100644 --- a/src/main/java/com/application/munera/views/expenses/ExpensesView.java +++ b/src/main/java/com/application/munera/views/expenses/ExpensesView.java @@ -59,7 +59,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver { private final CategoryService categoryService; private final PersonService personService; private final EventService eventService; - private final ServiceView serviceView; + private final ViewsService viewsService; private final UserService userService; private TextField name; private TextField cost; @@ -75,12 +75,12 @@ public class ExpensesView extends Div implements BeforeEnterObserver { private ComboBox event; @Autowired - public ExpensesView(ExpenseService expenseService, CategoryService categoryService, PersonService personService, EventService eventService, ServiceView serviceView, UserService userService) { + public ExpensesView(ExpenseService expenseService, CategoryService categoryService, PersonService personService, EventService eventService, ViewsService viewsService, UserService userService) { this.expenseService = expenseService; this.categoryService = categoryService; this.personService = personService; this.eventService = eventService; - this.serviceView = serviceView; + this.viewsService = viewsService; this.userService = userService; addClassNames("expenses-view"); @@ -100,7 +100,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver { grid.addColumn(Expense::getPeriodUnit).setHeader("Period Unit").setSortable(true); grid.addColumn(Expense::getDate).setHeader("Date").setSortable(true).setSortProperty("date"); // grid.addColumn(expenseEvent -> expenseEvent.getEvent().getName()).setHeader("Event").setSortable(true); - grid.addColumn(new ComponentRenderer<>(this.serviceView::createExpenseBadge)).setHeader("Status").setSortable(true); + grid.addColumn(new ComponentRenderer<>(this.viewsService::createExpenseBadge)).setHeader("Status").setSortable(true); grid.getColumns().forEach(col -> col.setAutoWidth(true)); grid.setItems(this.expenseService.findAllOrderByDateDescending()); diff --git a/src/main/java/com/application/munera/views/people/PeopleView.java b/src/main/java/com/application/munera/views/people/PeopleView.java index e2b3d4b..8ee4e71 100644 --- a/src/main/java/com/application/munera/views/people/PeopleView.java +++ b/src/main/java/com/application/munera/views/people/PeopleView.java @@ -4,7 +4,7 @@ import com.application.munera.data.Expense; import com.application.munera.data.Person; import com.application.munera.services.ExpenseService; import com.application.munera.services.PersonService; -import com.application.munera.services.ServiceView; +import com.application.munera.services.ViewsService; import com.application.munera.views.MainLayout; import com.vaadin.flow.component.UI; import com.vaadin.flow.component.button.Button; @@ -56,15 +56,15 @@ public class PeopleView extends Div implements BeforeEnterObserver { private Person person; private final PersonService personService; private final ExpenseService expenseService; - private final ServiceView serviceView; + private final ViewsService viewsService; private TextField firstName; private TextField lastName; private EmailField email; - public PeopleView(PersonService personService, ExpenseService expenseService, ServiceView serviceView) { + public PeopleView(PersonService personService, ExpenseService expenseService, ViewsService viewsService) { this.personService = personService; this.expenseService = expenseService; - this.serviceView = serviceView; + this.viewsService = viewsService; addClassNames("expenses-view"); // Create UI @@ -79,8 +79,8 @@ public class PeopleView extends Div implements BeforeEnterObserver { grid.addHierarchyColumn(this::getNodeName).setHeader("Name"); grid.addColumn(this::getNodeCost).setHeader("Total Expenses Value").setSortable(true); grid.addColumn(new ComponentRenderer<>(persona -> { - if (persona instanceof Person) return this.serviceView.createPersonBadge(personService.calculateNetBalance((Person) persona)); - else return this.serviceView.createExpenseBadge(((Expense) persona)); + if (persona instanceof Person) return this.viewsService.createPersonBadge(personService.calculateNetBalance((Person) persona)); + else return this.viewsService.createExpenseBadge(((Expense) persona)); })).setHeader("Balance Status"); grid.addColumn(new ComponentRenderer<>(persona -> {