From 80e731f163b026811fdc46ebf50823ffc41aba01 Mon Sep 17 00:00:00 2001 From: Alex Prudencio Date: Mon, 19 Aug 2024 15:49:51 -0400 Subject: [PATCH] Adding employee classes --- .../repositories/EmployeeRepository.java | 9 ++++ .../service/EmployeeService.java | 25 +++++++++++ .../views/EmployeeView.java | 41 +++++++++++++++++++ src/main/resources/checkstyle.xml | 2 +- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/primefactorsolutions/repositories/EmployeeRepository.java create mode 100644 src/main/java/com/primefactorsolutions/service/EmployeeService.java create mode 100644 src/main/java/com/primefactorsolutions/views/EmployeeView.java diff --git a/src/main/java/com/primefactorsolutions/repositories/EmployeeRepository.java b/src/main/java/com/primefactorsolutions/repositories/EmployeeRepository.java new file mode 100644 index 0000000..323ac5b --- /dev/null +++ b/src/main/java/com/primefactorsolutions/repositories/EmployeeRepository.java @@ -0,0 +1,9 @@ +package com.primefactorsolutions.repositories; + +import com.primefactorsolutions.model.Employee; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface EmployeeRepository extends JpaRepository { +} diff --git a/src/main/java/com/primefactorsolutions/service/EmployeeService.java b/src/main/java/com/primefactorsolutions/service/EmployeeService.java new file mode 100644 index 0000000..9005783 --- /dev/null +++ b/src/main/java/com/primefactorsolutions/service/EmployeeService.java @@ -0,0 +1,25 @@ +package com.primefactorsolutions.service; + +import com.primefactorsolutions.model.Employee; +import com.primefactorsolutions.repositories.EmployeeRepository; +import lombok.Data; +import org.apache.commons.lang3.NotImplementedException; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@Data +public class EmployeeService { + private final EmployeeRepository employeeRepository; + + private List getEmployees() { + // TODO: implement + throw new NotImplementedException(); + } + + private Employee createOrUpdateEmployee(final Employee employee) { + // TODO: implement + throw new NotImplementedException(); + } +} diff --git a/src/main/java/com/primefactorsolutions/views/EmployeeView.java b/src/main/java/com/primefactorsolutions/views/EmployeeView.java new file mode 100644 index 0000000..5f5acf8 --- /dev/null +++ b/src/main/java/com/primefactorsolutions/views/EmployeeView.java @@ -0,0 +1,41 @@ +package com.primefactorsolutions.views; + +import com.primefactorsolutions.model.Employee; +import com.primefactorsolutions.service.EmployeeService; +import com.vaadin.flow.component.Component; +import com.vaadin.flow.router.BeforeEvent; +import com.vaadin.flow.router.HasUrlParameter; +import com.vaadin.flow.router.PageTitle; +import com.vaadin.flow.router.Route; +import com.vaadin.flow.spring.annotation.SpringComponent; +import jakarta.annotation.security.PermitAll; +import org.springframework.context.annotation.Scope; +import org.vaadin.firitin.form.BeanValidationForm; + +import java.util.List; + +@SpringComponent +@PermitAll +@Scope("prototype") +@PageTitle("Employee") +@Route(value = "/employees", layout = MainLayout.class) +public class EmployeeView extends BeanValidationForm implements HasUrlParameter { + + private final EmployeeService employeeService; + + public EmployeeView(final EmployeeService employeeService) { + super(Employee.class); + this.employeeService = employeeService; + } + + @Override + protected List getFormComponents() { + return null; + } + + @Override + public void setParameter(final BeforeEvent beforeEvent, final String s) { + + } +} + diff --git a/src/main/resources/checkstyle.xml b/src/main/resources/checkstyle.xml index 216d48d..38020a6 100644 --- a/src/main/resources/checkstyle.xml +++ b/src/main/resources/checkstyle.xml @@ -180,7 +180,7 @@ - +