From bc892956028fd645bdcd8c83c963c22968d545a4 Mon Sep 17 00:00:00 2001 From: deepcloudlabs Date: Thu, 25 Jun 2020 14:37:11 +0300 Subject: [PATCH] add mongo repository --- hr-microservice-hexagonal/pom.xml | 4 + .../HrMicroserviceHexagonalApplication.java | 34 ++++- ...java => EmployeeRepositoryJpaAdapter.java} | 5 +- .../EmployeeRepositoryMongoAdapter.java | 55 +++++++ .../java/com/example/hr/config/AppConfig.java | 5 +- .../example/hr/config/ModelMapperConfig.java | 34 +++++ .../example/hr/document/EmployeeDocument.java | 140 ++++++++++++++++++ .../java/com/example/hr/meta/Persistence.java | 15 ++ .../example/hr/meta/PersistenceTarget.java | 5 + .../hr/repository/EmployeeJpaRepository.java | 5 +- .../repository/EmployeeMongoRepository.java | 16 ++ .../src/main/resources/application.properties | 6 +- 12 files changed, 318 insertions(+), 6 deletions(-) rename hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/{EmployeeRepositoryAdapter.java => EmployeeRepositoryJpaAdapter.java} (89%) create mode 100644 hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryMongoAdapter.java create mode 100644 hr-microservice-hexagonal/src/main/java/com/example/hr/document/EmployeeDocument.java create mode 100644 hr-microservice-hexagonal/src/main/java/com/example/hr/meta/Persistence.java create mode 100644 hr-microservice-hexagonal/src/main/java/com/example/hr/meta/PersistenceTarget.java create mode 100644 hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeMongoRepository.java diff --git a/hr-microservice-hexagonal/pom.xml b/hr-microservice-hexagonal/pom.xml index 164b8bb..c6ecaa4 100644 --- a/hr-microservice-hexagonal/pom.xml +++ b/hr-microservice-hexagonal/pom.xml @@ -81,6 +81,10 @@ org.springframework.boot spring-boot-starter-websocket + + org.springframework.boot + spring-boot-starter-data-mongodb + diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/HrMicroserviceHexagonalApplication.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/HrMicroserviceHexagonalApplication.java index b997a82..b75bcff 100644 --- a/hr-microservice-hexagonal/src/main/java/com/example/hr/HrMicroserviceHexagonalApplication.java +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/HrMicroserviceHexagonalApplication.java @@ -1,18 +1,48 @@ package com.example.hr; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import com.example.hr.adapter.EmployeeRepositoryMongoAdapter; +import com.example.hr.document.EmployeeDocument; +import com.example.hr.domain.Department; +import com.example.hr.domain.Employee; +import com.example.hr.domain.MoneyCurrency; +import com.example.hr.repository.EmployeeMongoRepository; + /** * * @author Binnur Kurt * */ @SpringBootApplication -public class HrMicroserviceHexagonalApplication { - +public class HrMicroserviceHexagonalApplication implements ApplicationRunner { + @Autowired private EmployeeRepositoryMongoAdapter mongoAdapter; + @Autowired private EmployeeMongoRepository mongoRepo; + public static void main(String[] args) { SpringApplication.run(HrMicroserviceHexagonalApplication.class, args); } + @Override + public void run(ApplicationArguments args) throws Exception { + /* + Employee jack = new Employee.Builder("40310900232").fullname("jack", "bauer").birthYear(1956) + .salary(100_000, MoneyCurrency.USD).iban("TR820006235455781668847562").fulltime(true) + .department(Department.IT) + .photo("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" + .getBytes()) + .build(); + mongoAdapter.save(jack); + */ + List employees = mongoRepo.findAllByBirthYearBetweenAndDepartment(1950, 1960,Department.IT); + System.err.println(employees); + employees.forEach(System.out::println); + } + } diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryAdapter.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryJpaAdapter.java similarity index 89% rename from hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryAdapter.java rename to hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryJpaAdapter.java index dd7b123..02b6e75 100644 --- a/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryAdapter.java +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryJpaAdapter.java @@ -8,6 +8,8 @@ import com.example.hr.domain.Employee; import com.example.hr.domain.FullName; import com.example.hr.domain.TcKimlikNo; +import com.example.hr.meta.Persistence; +import com.example.hr.meta.PersistenceTarget; import com.example.hr.orm.EmployeeEntity; import com.example.hr.repository.EmployeeJpaRepository; import com.example.hr.repository.EmployeeRepository; @@ -18,7 +20,8 @@ * */ @Repository -public class EmployeeRepositoryAdapter implements EmployeeRepository { +@Persistence(PersistenceTarget.JPA_MYSQL) +public class EmployeeRepositoryJpaAdapter implements EmployeeRepository { @Autowired private EmployeeJpaRepository empJpaRepo; diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryMongoAdapter.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryMongoAdapter.java new file mode 100644 index 0000000..1c6addb --- /dev/null +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/adapter/EmployeeRepositoryMongoAdapter.java @@ -0,0 +1,55 @@ +package com.example.hr.adapter; + +import java.util.Optional; + +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.example.hr.document.EmployeeDocument; +import com.example.hr.domain.Employee; +import com.example.hr.domain.FullName; +import com.example.hr.domain.TcKimlikNo; +import com.example.hr.meta.Persistence; +import com.example.hr.meta.PersistenceTarget; +import com.example.hr.repository.EmployeeMongoRepository; +import com.example.hr.repository.EmployeeRepository; + +@Repository +@Persistence(PersistenceTarget.MONGO) +public class EmployeeRepositoryMongoAdapter implements EmployeeRepository{ + @Autowired + private EmployeeMongoRepository empRepo; + @Autowired + private ModelMapper mapper; + + @Override + public Optional findByIdentity(TcKimlikNo identity) { + Optional empDoc = empRepo.findById(identity.getValue()); + if (!empDoc.isEmpty()) return Optional.empty(); + Employee employee = mapper.map(empDoc.get(), Employee.class); + return Optional.of(employee); + } + + @Override + public void save(Employee employee) { + //EmployeeDocument empDoc= mapper.map(employee, EmployeeDocument.class); + EmployeeDocument employeeDocument = new EmployeeDocument(); + employeeDocument.setIdentity(employee.getIdentityNo().getValue()); + FullName fullname = employee.getFullname(); + employeeDocument.setFullname(fullname.getFirst() + " " + fullname.getLast()); + employeeDocument.setSalary(employee.getSalary().getValue()); + employeeDocument.setIban(employee.getIban().getValue()); + employeeDocument.setPhoto(new String(employee.getPhoto().getValue())); + employeeDocument.setBirthYear(employee.getBirthYear().getValue()); + employeeDocument.setDepartment(employee.getDepartment()); + employeeDocument.setFulltime(employee.isFulltime()); + empRepo.save(employeeDocument); + } + + @Override + public void remove(Employee employee) { + empRepo.deleteById(employee.getIdentityNo().getValue()); + } + +} diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/config/AppConfig.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/config/AppConfig.java index 66f13b6..a485de7 100644 --- a/hr-microservice-hexagonal/src/main/java/com/example/hr/config/AppConfig.java +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/config/AppConfig.java @@ -6,6 +6,8 @@ import com.example.hr.application.EmployeeApplication; import com.example.hr.application.business.SimpleEmployeeApplication; import com.example.hr.infrastructure.EventPushlisher; +import com.example.hr.meta.Persistence; +import com.example.hr.meta.PersistenceTarget; import com.example.hr.repository.EmployeeRepository; /** @@ -17,7 +19,8 @@ public class AppConfig { @Bean - public EmployeeApplication employeeApplication(EmployeeRepository employeeRepository, + public EmployeeApplication employeeApplication( + @Persistence(PersistenceTarget.JPA_MYSQL) EmployeeRepository employeeRepository, EventPushlisher eventPushlisher) { SimpleEmployeeApplication employeeApplication = new SimpleEmployeeApplication(); employeeApplication.setEmployeeRepository(employeeRepository); diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/config/ModelMapperConfig.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/config/ModelMapperConfig.java index 4efdec3..0d8386e 100644 --- a/hr-microservice-hexagonal/src/main/java/com/example/hr/config/ModelMapperConfig.java +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/config/ModelMapperConfig.java @@ -5,7 +5,9 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import com.example.hr.document.EmployeeDocument; import com.example.hr.domain.Employee; +import com.example.hr.domain.FullName; import com.example.hr.domain.MoneyCurrency; import com.example.hr.dto.EmployeeRequest; @@ -33,6 +35,38 @@ public ModelMapper modelMapper() { .birthYear(employeeRequest.getBirthYear()).fulltime(employeeRequest.isFulltime()) .department(employeeRequest.getDepartment()).photo(employeeRequest.getPhoto()).build(); }); + TypeMap employeeDocumentToEmployeeTypeMap = mapper + .getTypeMap(EmployeeDocument.class, Employee.class); + if (employeeDocumentToEmployeeTypeMap == null) { + employeeDocumentToEmployeeTypeMap = mapper.createTypeMap(EmployeeDocument.class, Employee.class); + } + employeeRequestToEmployeeTypeMap.setProvider(provisionRequest -> { + var employeeDocument = EmployeeDocument.class.cast(provisionRequest.getSource()); + String[] tokens = employeeDocument.getFullname().split("\\w+"); + return new Employee.Builder(employeeDocument.getIdentity()).fullname(tokens[0], tokens[1]) + .iban(employeeDocument.getIban()).salary(employeeDocument.getSalary(), MoneyCurrency.TL) + .birthYear(employeeDocument.getBirthYear()).fulltime(employeeDocument.getFulltime()) + .department(employeeDocument.getDepartment()).photo(employeeDocument.getPhoto().getBytes()).build(); + }); + TypeMap employeeToEmployeeDocumentTypeMap = mapper.getTypeMap(Employee.class, + EmployeeDocument.class); + if (employeeToEmployeeDocumentTypeMap == null) { + employeeToEmployeeDocumentTypeMap = mapper.createTypeMap(Employee.class, EmployeeDocument.class); + } + employeeToEmployeeDocumentTypeMap.setProvider(provisionRequest -> { + var employee = Employee.class.cast(provisionRequest.getSource()); + EmployeeDocument employeeDocument = new EmployeeDocument(); + employeeDocument.setIdentity(employee.getIdentityNo().getValue()); + FullName fullname = employee.getFullname(); + employeeDocument.setFullname(fullname.getFirst() + " " + fullname.getLast()); + employeeDocument.setSalary(employee.getSalary().getValue()); + employeeDocument.setIban(employee.getIban().getValue()); + employeeDocument.setPhoto(new String(employee.getPhoto().getValue())); + employeeDocument.setBirthYear(employee.getBirthYear().getValue()); + employeeDocument.setDepartment(employee.getDepartment()); + employeeDocument.setFulltime(employee.isFulltime()); + return employeeDocument; + }); return mapper; } } diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/document/EmployeeDocument.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/document/EmployeeDocument.java new file mode 100644 index 0000000..3b76381 --- /dev/null +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/document/EmployeeDocument.java @@ -0,0 +1,140 @@ +package com.example.hr.document; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.Size; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import com.example.hr.domain.Department; +import com.example.validation.Iban; +import com.example.validation.TcKimlikNo; + +@Document(collection = "employees") +public class EmployeeDocument { + @TcKimlikNo + @Id + private String identity; + @Size(min = 5) + private String fullname; + @Min(3_000) + private Double salary; + @Iban + private String iban; + private Boolean fulltime; + @Max(2002) + private int birthYear; + private String photo; + private Department department; + + public EmployeeDocument() { + } + + public EmployeeDocument(String identity, @Size(min = 5) String fullname, @Min(3000) Double salary, String iban, + Boolean fulltime, @Max(2002) int birthYear, Department department) { + this.identity = identity; + this.fullname = fullname; + this.salary = salary; + this.iban = iban; + this.fulltime = fulltime; + this.birthYear = birthYear; + this.department = department; + } + + public String getIdentity() { + return identity; + } + + public void setIdentity(String identity) { + this.identity = identity; + } + + public String getFullname() { + return fullname; + } + + public void setFullname(String fullname) { + this.fullname = fullname; + } + + public Double getSalary() { + return salary; + } + + public void setSalary(Double salary) { + this.salary = salary; + } + + public String getIban() { + return iban; + } + + public void setIban(String iban) { + this.iban = iban; + } + + public Boolean getFulltime() { + return fulltime; + } + + public void setFulltime(Boolean fulltime) { + this.fulltime = fulltime; + } + + public int getBirthYear() { + return birthYear; + } + + public void setBirthYear(int birthYear) { + this.birthYear = birthYear; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public Department getDepartment() { + return department; + } + + public void setDepartment(Department department) { + this.department = department; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((identity == null) ? 0 : identity.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmployeeDocument other = (EmployeeDocument) obj; + if (identity == null) { + if (other.identity != null) + return false; + } else if (!identity.equals(other.identity)) + return false; + return true; + } + + @Override + public String toString() { + return "EmployeeDocument [identity=" + identity + ", fullname=" + fullname + ", salary=" + salary + ", iban=" + + iban + ", fulltime=" + fulltime + ", birthYear=" + birthYear + ", department=" + department + "]"; + } + +} diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/meta/Persistence.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/meta/Persistence.java new file mode 100644 index 0000000..7271aa8 --- /dev/null +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/meta/Persistence.java @@ -0,0 +1,15 @@ +package com.example.hr.meta; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.beans.factory.annotation.Qualifier; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.PARAMETER, ElementType.FIELD}) +@Qualifier +public @interface Persistence { + PersistenceTarget value() ; +} diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/meta/PersistenceTarget.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/meta/PersistenceTarget.java new file mode 100644 index 0000000..693bc4e --- /dev/null +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/meta/PersistenceTarget.java @@ -0,0 +1,5 @@ +package com.example.hr.meta; + +public enum PersistenceTarget { + JPA_MYSQL, MONGO, CASSANDRA, REDIS, ELASTIC_SEARCH +} diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeJpaRepository.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeJpaRepository.java index c2efb4b..8e7f4fa 100644 --- a/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeJpaRepository.java +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeJpaRepository.java @@ -1,7 +1,10 @@ package com.example.hr.repository; +import java.util.List; + import org.springframework.data.jpa.repository.JpaRepository; +import com.example.hr.document.EmployeeDocument; import com.example.hr.orm.EmployeeEntity; /** @@ -10,5 +13,5 @@ * */ public interface EmployeeJpaRepository extends JpaRepository { - + List findByBirthYearBetween(int fromYear,int toYear); } diff --git a/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeMongoRepository.java b/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeMongoRepository.java new file mode 100644 index 0000000..bf7c56a --- /dev/null +++ b/hr-microservice-hexagonal/src/main/java/com/example/hr/repository/EmployeeMongoRepository.java @@ -0,0 +1,16 @@ +package com.example.hr.repository; + +import java.util.List; + +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.data.mongodb.repository.Query; + +import com.example.hr.document.EmployeeDocument; +import com.example.hr.domain.Department; + +public interface EmployeeMongoRepository extends MongoRepository{ + List findAllByBirthYearBetweenAndDepartment(int fromYear,int toYear,Department department); + @Query(value = "{'birthYear': {'$gt': 'fromYear', '$lt': 'toYear'}}") + List araBul(int fromYear,int toYear); + +} diff --git a/hr-microservice-hexagonal/src/main/resources/application.properties b/hr-microservice-hexagonal/src/main/resources/application.properties index da5a087..1ae4cb9 100644 --- a/hr-microservice-hexagonal/src/main/resources/application.properties +++ b/hr-microservice-hexagonal/src/main/resources/application.properties @@ -22,4 +22,8 @@ spring.datasource.password=Secret_123 #hibernate configuration spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true -#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl \ No newline at end of file +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + + +#mongodb configuration +spring.data.mongodb.uri=mongodb://localhost:27017/hr \ No newline at end of file