diff --git a/poc-with-identification-counter/api/pom.xml b/poc-with-identification-counter/api/pom.xml index 82c98f0..c595681 100644 --- a/poc-with-identification-counter/api/pom.xml +++ b/poc-with-identification-counter/api/pom.xml @@ -29,11 +29,17 @@ com.devonfw.java.modules devon4j-security - + javax.servlet javax.servlet-api provided + + + com.devonfw.java.modules + devon4j-test + test + diff --git a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/common/api/CompositeEmployeeKey.java b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/common/api/CompositeEmployeeKey.java index a135c18..dfa0721 100644 --- a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/common/api/CompositeEmployeeKey.java +++ b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/common/api/CompositeEmployeeKey.java @@ -2,63 +2,77 @@ import java.io.Serializable; -public class CompositeEmployeeKey implements Serializable{ +public class CompositeEmployeeKey implements Serializable { - private static final long serialVersionUID = 1L; - private String companyId; - private String employeeId; + private static final long serialVersionUID = 1L; + private String companyId; - public CompositeEmployeeKey() { - } + private String employeeId; - public CompositeEmployeeKey(String mixed) { - super(); - String[] stringVar = mixed.split(","); - this.companyId = stringVar[0]; - this.employeeId = stringVar[1]; - } + public CompositeEmployeeKey() { - public CompositeEmployeeKey(String companyId, String employeeId) { - super(); - this.companyId = companyId; - this.employeeId = employeeId; - } + } - public String getCompanyId() { - return companyId; - } + public CompositeEmployeeKey(String mixed) { - public void setCompanyId(String companyId) { - this.companyId = companyId; - } + super(); + String[] stringVar = mixed.split(","); + this.companyId = stringVar[0]; + this.employeeId = stringVar[1]; + } - public String getEmployeeId() { - return employeeId; - } + public CompositeEmployeeKey(String companyId, String employeeId) { - public void setEmployeeId(String employeeId) { - this.employeeId = employeeId; - } + super(); + this.companyId = companyId; + this.employeeId = employeeId; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - if ( !(other instanceof CompositeEmployeeKey) ) return false; + public String getCompanyId() { - final CompositeEmployeeKey compositeEmployeeKey = (CompositeEmployeeKey) other; + return this.companyId; + } - if ( !compositeEmployeeKey.getCompanyId().equals( getCompanyId() ) ) return false; - if ( !compositeEmployeeKey.getEmployeeId().equals( getEmployeeId() ) ) return false; + public void setCompanyId(String companyId) { - return true; - } + this.companyId = companyId; + } - @Override - public int hashCode() { - int result; - result = getCompanyId().hashCode(); - result = 29 * result + getEmployeeId().hashCode(); - return result; - } + public String getEmployeeId() { + + return this.employeeId; + } + + public void setEmployeeId(String employeeId) { + + this.employeeId = employeeId; + } + + @Override + public boolean equals(Object other) { + + if (this == other) + return true; + if (!(other instanceof CompositeEmployeeKey)) + return false; + + final CompositeEmployeeKey compositeEmployeeKey = (CompositeEmployeeKey) other; + + if (!compositeEmployeeKey.getCompanyId().equals(getCompanyId())) + return false; + if (!compositeEmployeeKey.getEmployeeId().equals(getEmployeeId())) + return false; + + return true; + } + + @Override + public int hashCode() { + + int result; + result = getCompanyId().hashCode(); + result = 29 * result + getEmployeeId().hashCode(); + return result; + } } diff --git a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeEto.java b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeEto.java index 8076fed..81c9d1a 100644 --- a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeEto.java +++ b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeEto.java @@ -9,88 +9,83 @@ */ public class EmployeeEto extends AbstractComposedKeyEto implements Employee { - private static final long serialVersionUID = 1L; - - private CompositeEmployeeKey id; - - private String name; - - private String lastName; - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getLastName() { - return lastName; - } - - @Override - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public CompositeEmployeeKey getId() { - return id; - } - - public void setId(CompositeEmployeeKey id) { - this.id = id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); - result = prime * result + ((this.lastName == null) ? 0 : this.lastName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - // class check will be done by super type EntityTo! - if (!super.equals(obj)) { - return false; - } - EmployeeEto other = (EmployeeEto) obj; - if (this.id == null) { - if (other.id != null) { - return false; - } - } else if (!this.id.equals(other.id)) { - return false; - } - if (this.name == null) { - if (other.name != null) { - return false; - } - } else if (!this.name.equals(other.name)) { - return false; - } - if (this.lastName == null) { - if (other.lastName != null) { - return false; - } - } else if (!this.lastName.equals(other.lastName)) { - return false; - } - return true; - } + private static final long serialVersionUID = 1L; + + private String name; + + private String lastName; + + @Override + public String getName() { + + return this.name; + } + + @Override + public void setName(String name) { + + this.name = name; + } + + @Override + public String getLastName() { + + return this.lastName; + } + + @Override + public void setLastName(String lastName) { + + this.lastName = lastName; + } + + @Override + public int hashCode() { + + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); + result = prime * result + ((this.lastName == null) ? 0 : this.lastName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + // class check will be done by super type EntityTo! + if (!super.equals(obj)) { + return false; + } + EmployeeEto other = (EmployeeEto) obj; + if (getId() == null) { + if (other.getId() != null) { + return false; + } + } else if (!getId().equals(other.getId())) { + return false; + } + if (this.name == null) { + if (other.name != null) { + return false; + } + } else if (!this.name.equals(other.name)) { + return false; + } + if (this.lastName == null) { + if (other.lastName != null) { + return false; + } + } else if (!this.lastName.equals(other.lastName)) { + return false; + } + return true; + } } diff --git a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeSearchCriteriaTo.java b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeSearchCriteriaTo.java index 36eff82..477bc6b 100644 --- a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeSearchCriteriaTo.java +++ b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/logic/api/to/EmployeeSearchCriteriaTo.java @@ -1,6 +1,5 @@ package com.devonfw.application.pocwithidentificationcounter.employeemanagement.logic.api.to; -import com.devonfw.application.pocwithidentificationcounter.employeemanagement.common.api.CompositeEmployeeKey; import com.devonfw.application.pocwithidentificationcounter.general.common.api.to.AbstractSearchCriteriaTo; import com.devonfw.module.basic.common.api.query.StringSearchConfigTo; @@ -10,92 +9,78 @@ */ public class EmployeeSearchCriteriaTo extends AbstractSearchCriteriaTo { - private static final long serialVersionUID = 1L; - - private String name; - - private String lastName; - - private StringSearchConfigTo nameOption; - - private StringSearchConfigTo lastNameOption; - - private CompositeEmployeeKey id; - - /** - * @return nameId - */ - public String getName() { - return name; - } - - /** - * @param name setter for name attribute - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return lastNameId - */ - public String getLastName() { - return lastName; - } - - /** - * @param lastName setter for lastName attribute - */ - public void setLastName(String lastName) { - this.lastName = lastName; - } - - /** - * @return the {@link StringSearchConfigTo} used to search for {@link #getName() - * name}. - */ - public StringSearchConfigTo getNameOption() { - - return this.nameOption; - } - - /** - * @param nameOption new value of {@link #getNameOption()}. - */ - public void setNameOption(StringSearchConfigTo nameOption) { - - this.nameOption = nameOption; - } - - /** - * @return the {@link StringSearchConfigTo} used to search for - * {@link #getLastName() lastName}. - */ - public StringSearchConfigTo getLastNameOption() { - - return this.lastNameOption; - } - - /** - * @param lastNameOption new value of {@link #getLastNameOption()}. - */ - public void setLastNameOption(StringSearchConfigTo lastNameOption) { - - this.lastNameOption = lastNameOption; - } - - /** - * @return idId - */ - public CompositeEmployeeKey getId() { - return id; - } - - /** - * @param id setter for id attribute - */ - public void setId(CompositeEmployeeKey id) { - this.id = id; - } + private static final long serialVersionUID = 1L; + + private String name; + + private String lastName; + + private StringSearchConfigTo nameOption; + + private StringSearchConfigTo lastNameOption; + + /** + * @return nameId + */ + public String getName() { + + return this.name; + } + + /** + * @param name setter for name attribute + */ + public void setName(String name) { + + this.name = name; + } + + /** + * @return lastNameId + */ + public String getLastName() { + + return this.lastName; + } + + /** + * @param lastName setter for lastName attribute + */ + public void setLastName(String lastName) { + + this.lastName = lastName; + } + + /** + * @return the {@link StringSearchConfigTo} used to search for {@link #getName() name}. + */ + public StringSearchConfigTo getNameOption() { + + return this.nameOption; + } + + /** + * @param nameOption new value of {@link #getNameOption()}. + */ + public void setNameOption(StringSearchConfigTo nameOption) { + + this.nameOption = nameOption; + } + + /** + * @return the {@link StringSearchConfigTo} used to search for {@link #getLastName() lastName}. + */ + public StringSearchConfigTo getLastNameOption() { + + return this.lastNameOption; + } + + /** + * @param lastNameOption new value of {@link #getLastNameOption()}. + */ + public void setLastNameOption(StringSearchConfigTo lastNameOption) { + + this.lastNameOption = lastNameOption; + } } diff --git a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/api/rest/EmployeemanagementRestService.java b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/api/rest/EmployeemanagementRestService.java index 0e24b20..91c6fb5 100644 --- a/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/api/rest/EmployeemanagementRestService.java +++ b/poc-with-identification-counter/api/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/api/rest/EmployeemanagementRestService.java @@ -8,7 +8,9 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; + import org.springframework.data.domain.Page; + import com.devonfw.application.pocwithidentificationcounter.employeemanagement.common.api.CompositeEmployeeKey; import com.devonfw.application.pocwithidentificationcounter.employeemanagement.logic.api.Employeemanagement; import com.devonfw.application.pocwithidentificationcounter.employeemanagement.logic.api.to.EmployeeCto; @@ -16,76 +18,73 @@ import com.devonfw.application.pocwithidentificationcounter.employeemanagement.logic.api.to.EmployeeSearchCriteriaTo; /** - * The service interface for REST calls in order to execute the logic of - * component {@link Employeemanagement}. + * The service interface for REST calls in order to execute the logic of component {@link Employeemanagement}. */ @Path("/employeemanagement/v1") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public interface EmployeemanagementRestService { - /** - * Delegates to {@link Employeemanagement#findEmployee}. - * - * @param id the ID of the {@link EmployeeEto} - * @return the {@link EmployeeEto} - */ - @GET - @Path("/employee/{id}/") - public EmployeeEto getEmployee(@PathParam("id") CompositeEmployeeKey id); + /** + * Delegates to {@link Employeemanagement#findEmployee}. + * + * @param id the ID of the {@link EmployeeEto} + * @return the {@link EmployeeEto} + */ + @GET + @Path("/employee/{id}/") + public EmployeeEto getEmployee(@PathParam("id") CompositeEmployeeKey id); - /** - * Delegates to {@link Employeemanagement#saveEmployee}. - * - * @param employee the {@link EmployeeEto} to be saved - * @return the recently created {@link EmployeeEto} - */ - @POST - @Path("/employee/") - public EmployeeEto saveEmployee(EmployeeEto employee); + /** + * Delegates to {@link Employeemanagement#saveEmployee}. + * + * @param employee the {@link EmployeeEto} to be saved + * @return the recently created {@link EmployeeEto} + */ + @POST + @Path("/employee/") + public EmployeeEto saveEmployee(EmployeeEto employee); - /** - * Delegates to {@link Employeemanagement#deleteEmployee}. - * - * @param id ID of the {@link EmployeeEto} to be deleted - */ - @DELETE - @Path("/employee/{id}/") - public void deleteEmployee(@PathParam("id") CompositeEmployeeKey id); + /** + * Delegates to {@link Employeemanagement#deleteEmployee}. + * + * @param id ID of the {@link EmployeeEto} to be deleted + */ + @DELETE + @Path("/employee/{id}/") + public void deleteEmployee(@PathParam("id") CompositeEmployeeKey id); - /** - * Delegates to {@link Employeemanagement#findEmployeeEtos}. - * - * @param searchCriteriaTo the pagination and search criteria to be used for - * finding employees. - * @return the {@link Page list} of matching {@link EmployeeEto}s. - */ - @Path("/employee/search") - @POST - public Page findEmployees(EmployeeSearchCriteriaTo searchCriteriaTo); + /** + * Delegates to {@link Employeemanagement#findEmployeeEtos}. + * + * @param searchCriteriaTo the pagination and search criteria to be used for finding employees. + * @return the {@link Page list} of matching {@link EmployeeEto}s. + */ + @Path("/employee/search") + @POST + public Page findEmployees(EmployeeSearchCriteriaTo searchCriteriaTo); - /** - * Delegates to {@link Employeemanagement#findEmployeeCto}. - * - * @param id the ID of the {@link EmployeeCto} - * @return the {@link EmployeeCto} - */ - @GET - @Path("/employee/cto/{id}/") - public EmployeeCto getEmployeeCto(@PathParam("id") CompositeEmployeeKey id); + /** + * Delegates to {@link Employeemanagement#findEmployeeCto}. + * + * @param id the ID of the {@link EmployeeCto} + * @return the {@link EmployeeCto} + */ + @GET + @Path("/employee/cto/{id}/") + public EmployeeCto getEmployeeCto(@PathParam("id") CompositeEmployeeKey id); - /** - * Delegates to {@link Employeemanagement#findEmployeeCtos}. - * - * @param searchCriteriaTo the pagination and search criteria to be used for - * finding employees. - * @return the {@link Page list} of matching {@link EmployeeCto}s. - */ - @Path("/employee/cto/search") - @POST - public Page findEmployeeCtos(EmployeeSearchCriteriaTo searchCriteriaTo); + /** + * Delegates to {@link Employeemanagement#findEmployeeCtos}. + * + * @param searchCriteriaTo the pagination and search criteria to be used for finding employees. + * @return the {@link Page list} of matching {@link EmployeeCto}s. + */ + @Path("/employee/cto/search") + @POST + public Page findEmployeeCtos(EmployeeSearchCriteriaTo searchCriteriaTo); - @Path("/employee/cto") - @POST - public EmployeeCto saveEmployeePhone(EmployeeCto employee); + @Path("/employee/cto") + @POST + public EmployeeCto saveEmployeePhone(EmployeeCto employee); } diff --git a/poc-with-identification-counter/core/pom.xml b/poc-with-identification-counter/core/pom.xml index f4ae259..d946537 100644 --- a/poc-with-identification-counter/core/pom.xml +++ b/poc-with-identification-counter/core/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 @@ -10,7 +10,7 @@ poc-with-identification-counter-core jar ${project.artifactId} - Core of the server for the poc-with-identification-counter application - a simple example using the Open Application Standard Platform for Java (devon4j). + Core of the server for the poc-with-identification-counter application - a simple example based on devon4j. @@ -72,10 +72,10 @@ spring-boot-starter-jdbc - + - org.hibernate.javax.persistence - hibernate-jpa-2.1-api + javax.persistence + javax.persistence-api @@ -155,7 +155,7 @@ cglib cglib - + net.logstash.logback @@ -165,13 +165,7 @@ com.devonfw.java.modules - devon4j-test - test - - - - org.springframework.boot - spring-boot-starter-test + devon4j-test-jpa test @@ -189,12 +183,6 @@ - - - org.skyscreamer - jsonassert - test - diff --git a/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/dataaccess/api/EmployeeEntity.java b/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/dataaccess/api/EmployeeEntity.java index fac89cd..37c9d09 100644 --- a/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/dataaccess/api/EmployeeEntity.java +++ b/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/dataaccess/api/EmployeeEntity.java @@ -2,11 +2,7 @@ import java.util.List; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.OneToMany; @@ -19,60 +15,49 @@ @Entity @Table(name = "employee") -public class EmployeeEntity extends ApplicationComposedKeyPersistenceEntity implements Employee - { +public class EmployeeEntity extends ApplicationComposedKeyPersistenceEntity implements Employee { - private CompositeEmployeeKey id; + private String name; - private String name; + private String lastName; - private String lastName; + private List phones; - private List phones; + private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; + @Override + public String getName() { + return this.name; + } - @Override - @AttributeOverrides({ - @AttributeOverride(name="employeeId", - column=@Column(name="employeeId",length=10)), - @AttributeOverride(name="companyId", - column=@Column(name="companyId",length=10)), - }) - @EmbeddedId - public CompositeEmployeeKey getId() { - return id; - } + @Override + public void setName(String name) { - @Override - public void setId(CompositeEmployeeKey id) { - this.id = id; - } + this.name = name; + } - public String getName() { - return name; - } + @Override + public String getLastName() { - public void setName(String name) { - this.name = name; - } + return this.lastName; + } - public String getLastName() { - return lastName; - } + @Override + public void setLastName(String lastName) { - public void setLastName(String lastName) { - this.lastName = lastName; - } + this.lastName = lastName; + } - @OneToMany(fetch = FetchType.EAGER, cascade= CascadeType.ALL,mappedBy="employee") - public List getPhones() { - return phones; - } + @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "employee") + public List getPhones() { - public void setPhones(List phones) { - this.phones = phones; - } + return this.phones; + } + + public void setPhones(List phones) { + + this.phones = phones; + } } diff --git a/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/impl/rest/EmployeemanagementRestServiceImpl.java b/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/impl/rest/EmployeemanagementRestServiceImpl.java index ac61001..dd7fa9f 100644 --- a/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/impl/rest/EmployeemanagementRestServiceImpl.java +++ b/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/employeemanagement/service/impl/rest/EmployeemanagementRestServiceImpl.java @@ -13,48 +13,54 @@ import com.devonfw.application.pocwithidentificationcounter.employeemanagement.service.api.rest.EmployeemanagementRestService; /** - * The service implementation for REST calls in order to execute the logic of - * component {@link Employeemanagement}. + * The service implementation for REST calls in order to execute the logic of component {@link Employeemanagement}. */ @Named("EmployeemanagementRestService") public class EmployeemanagementRestServiceImpl implements EmployeemanagementRestService { - @Inject - private Employeemanagement employeemanagement; - - @Override - public EmployeeEto getEmployee(CompositeEmployeeKey id) { - return this.employeemanagement.findEmployee(id); - } - - @Override - public EmployeeEto saveEmployee(EmployeeEto employee) { - return this.employeemanagement.saveEmployee(employee); - } - - @Override - public void deleteEmployee(CompositeEmployeeKey id) { - this.employeemanagement.deleteEmployee(id); - } - - @Override - public Page findEmployees(EmployeeSearchCriteriaTo searchCriteriaTo) { - return this.employeemanagement.findEmployees(searchCriteriaTo); - } - - @Override - public EmployeeCto getEmployeeCto(CompositeEmployeeKey id) { - return this.employeemanagement.findEmployeeCto(id); - } - - @Override - public Page findEmployeeCtos(EmployeeSearchCriteriaTo searchCriteriaTo) { - return this.employeemanagement.findEmployeeCtos(searchCriteriaTo); - } - - @Override - public EmployeeCto saveEmployeePhone(EmployeeCto employee) { - return this.employeemanagement.saveEmployeePhone(employee); - } + @Inject + private Employeemanagement employeemanagement; + + @Override + public EmployeeEto getEmployee(CompositeEmployeeKey id) { + + return this.employeemanagement.findEmployee(id); + } + + @Override + public EmployeeEto saveEmployee(EmployeeEto employee) { + + return this.employeemanagement.saveEmployee(employee); + } + + @Override + public void deleteEmployee(CompositeEmployeeKey id) { + + this.employeemanagement.deleteEmployee(id); + } + + @Override + public Page findEmployees(EmployeeSearchCriteriaTo searchCriteriaTo) { + + return this.employeemanagement.findEmployees(searchCriteriaTo); + } + + @Override + public EmployeeCto getEmployeeCto(CompositeEmployeeKey id) { + + return this.employeemanagement.findEmployeeCto(id); + } + + @Override + public Page findEmployeeCtos(EmployeeSearchCriteriaTo searchCriteriaTo) { + + return this.employeemanagement.findEmployeeCtos(searchCriteriaTo); + } + + @Override + public EmployeeCto saveEmployeePhone(EmployeeCto employee) { + + return this.employeemanagement.saveEmployeePhone(employee); + } } diff --git a/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/general/common/impl/config/BeansDozerConfig.java b/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/general/common/impl/config/BeansDozerConfig.java index 05c176a..065486f 100644 --- a/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/general/common/impl/config/BeansDozerConfig.java +++ b/poc-with-identification-counter/core/src/main/java/com/devonfw/application/pocwithidentificationcounter/general/common/impl/config/BeansDozerConfig.java @@ -3,12 +3,14 @@ import java.util.ArrayList; import java.util.List; -import org.dozer.DozerBeanMapper; -import org.dozer.Mapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import com.github.dozermapper.core.DozerBeanMapper; +import com.github.dozermapper.core.DozerBeanMapperBuilder; +import com.github.dozermapper.core.Mapper; + /** * Java bean configuration for Dozer */ @@ -21,12 +23,14 @@ public class BeansDozerConfig { /** * @return the {@link DozerBeanMapper}. */ + @Bean public Mapper getDozer() { List beanMappings = new ArrayList<>(); beanMappings.add(DOZER_MAPPING_XML); - return new DozerBeanMapper(beanMappings); + Mapper mapper = DozerBeanMapperBuilder.create().withMappingFiles(beanMappings).build(); + return mapper; } } diff --git a/poc-with-identification-counter/core/src/main/resources/config/app/common/dozer-mapping.xml b/poc-with-identification-counter/core/src/main/resources/config/app/common/dozer-mapping.xml index a97c78c..8e920b0 100644 --- a/poc-with-identification-counter/core/src/main/resources/config/app/common/dozer-mapping.xml +++ b/poc-with-identification-counter/core/src/main/resources/config/app/common/dozer-mapping.xml @@ -1,9 +1,9 @@ - + - + true @@ -12,6 +12,22 @@ java.lang.Long java.lang.Integer java.lang.Number + java.time.LocalDate + java.time.LocalDateTime + java.time.LocalTime + java.time.ZonedDateTime + java.time.Instant + java.time.Year + java.time.Duration + java.time.Clock + java.time.MonthDay + java.time.OffsetDateTime + java.time.OffsetTime + java.time.Period + java.time.YearMonth + java.time.Month + java.util.regex.Pattern + com.devonfw.module.basic.common.api.reference.IdRef - - com.devonfw.application.pocwithidentificationcounter.general.dataaccess.api.ApplicationPersistenceEntity - com.devonfw.module.basic.common.api.to.AbstractEto - - this - persistentEntity - - - - com.devonfw.application.pocwithidentificationcounter.general.dataaccess.api.ApplicationComposedKeyPersistenceEntity - com.devonfw.application.pocwithidentificationcounter.general.common.api.to.AbstractComposedKeyEto - - this - persistentEntity - - + + com.devonfw.application.pocwithidentificationcounter.general.dataaccess.api.ApplicationPersistenceEntity + com.devonfw.module.basic.common.api.to.AbstractEto + + this + persistentEntity + + diff --git a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/Devon4jPackageCheckTest.java b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/Devon4jPackageCheckTest.java index 7d89a94..f4f74a2 100644 --- a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/Devon4jPackageCheckTest.java +++ b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/Devon4jPackageCheckTest.java @@ -7,7 +7,7 @@ import net.sf.mmm.util.reflect.base.ReflectionUtilImpl; import org.assertj.core.api.SoftAssertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.devonfw.module.basic.common.api.reflect.Devon4jPackage; import com.devonfw.module.test.common.base.ModuleTest; diff --git a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/PermissionCheckTest.java b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/PermissionCheckTest.java index 8a51ce0..f274f01 100644 --- a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/PermissionCheckTest.java +++ b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/PermissionCheckTest.java @@ -1,7 +1,5 @@ package com.devonfw.application.pocwithidentificationcounter.general.common.base; -import com.devonfw.module.test.common.base.ModuleTest; - import java.lang.reflect.Method; import java.util.Set; @@ -14,7 +12,9 @@ import net.sf.mmm.util.reflect.base.ReflectionUtilImpl; import org.assertj.core.api.SoftAssertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import com.devonfw.module.test.common.base.ModuleTest; /** * Tests the permission check in logic layer. diff --git a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/test/AccessControlSchemaXmlValidationTest.java b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/test/AccessControlSchemaXmlValidationTest.java index b5934b6..3f3ee09 100644 --- a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/test/AccessControlSchemaXmlValidationTest.java +++ b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/common/base/test/AccessControlSchemaXmlValidationTest.java @@ -1,7 +1,5 @@ package com.devonfw.application.pocwithidentificationcounter.general.common.base.test; -import com.devonfw.module.test.common.base.ModuleTest; - import java.io.File; import java.io.IOException; import java.net.URL; @@ -15,10 +13,12 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; +import com.devonfw.module.test.common.base.ModuleTest; + /** * Class for XML Validation Tests. * diff --git a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/service/impl/rest/SecurityRestServiceImplTest.java b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/service/impl/rest/SecurityRestServiceImplTest.java index 86e2907..7bda88c 100644 --- a/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/service/impl/rest/SecurityRestServiceImplTest.java +++ b/poc-with-identification-counter/core/src/test/java/com/devonfw/application/pocwithidentificationcounter/general/service/impl/rest/SecurityRestServiceImplTest.java @@ -1,7 +1,7 @@ package com.devonfw.application.pocwithidentificationcounter.general.service.impl.rest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; @@ -10,19 +10,18 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.web.csrf.CsrfToken; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.web.client.RestTemplate; -import com.devonfw.module.service.common.api.client.config.ServiceClientConfigBuilder; - import com.devonfw.application.pocwithidentificationcounter.general.common.api.to.UserProfileTo; import com.devonfw.application.pocwithidentificationcounter.general.service.api.rest.SecurityRestService; import com.devonfw.application.pocwithidentificationcounter.general.service.base.test.RestServiceTest; +import com.devonfw.module.service.common.api.client.config.ServiceClientConfigBuilder; /** * This class tests the login functionality of {@link SecurityRestServiceImpl}. */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class SecurityRestServiceImplTest extends RestServiceTest { /** Logger instance. */ @@ -66,6 +65,7 @@ public void testGetCsrfToken() { */ @Test public void testGetCurrentUser() { + String login = "waiter"; String password = "waiter"; SecurityRestService securityService = getServiceClientFactory().create(SecurityRestService.class, @@ -89,7 +89,8 @@ private ResponseEntity login(String userName, String tmpPassword) { HttpEntity postRequest = new HttpEntity<>( "{\"j_username\": \"" + userName + "\", \"j_password\": \"" + tmpPassword + "\"}", new HttpHeaders()); - ResponseEntity postResponse = new RestTemplate().exchange(tmpUrl, HttpMethod.POST, postRequest, String.class); + ResponseEntity postResponse = new RestTemplate().exchange(tmpUrl, HttpMethod.POST, postRequest, + String.class); return postResponse; } diff --git a/poc-with-identification-counter/pom.xml b/poc-with-identification-counter/pom.xml index 9220902..5d65c2a 100644 --- a/poc-with-identification-counter/pom.xml +++ b/poc-with-identification-counter/pom.xml @@ -7,25 +7,50 @@ v1 pom ${project.artifactId} - Application based on the Open Application Standard Platform for Java (devon4j). + Application based on the devon4j. - 2.0.4.RELEASE - 3.0.0 + 2.1.9.RELEASE + 3.2.1 1.8 + 5.5.2 UTF-8 UTF-8 - com.devonfw.module.test.common.api.category.CategorySystemTest + 2.9.9.20190727 + 28.1-jre + system api core - server + server + + + com.fasterxml.jackson + jackson-bom + ${jackson.version} + pom + import + + + + org.junit + junit-bom + ${junit.version} + pom + import + + + + com.google.guava + guava + ${guava.version} + org.springframework.boot @@ -38,8 +63,7 @@ com.devonfw.java.boms devon4j-bom - ${devon4j.version} - + ${devon4j.version} pom import @@ -47,11 +71,6 @@ - - junit - junit - test - org.slf4j slf4j-api @@ -188,7 +207,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.20.1 + 3.0.0-M3 ${basedir} @@ -220,7 +239,7 @@ org.apache.maven.plugins maven-help-plugin - 2.2 + 3.2.0 org.codehaus.mojo @@ -255,12 +274,12 @@ org.jacoco jacoco-maven-plugin - 0.8.0 + 0.8.3 org.owasp dependency-check-maven - 3.1.1 + 5.1.0 org.codehaus.mojo @@ -281,7 +300,7 @@ org.springframework.boot spring-boot-maven-plugin - 2.0.4.RELEASE + ${spring.boot.version} @@ -291,25 +310,25 @@ moduletest - com.devonfw.module.test.common.api.category.CategoryComponentTest,com.devonfw.module.test.common.api.category.CategorySubsystemTest,com.devonfw.module.test.common.api.category.CategorySystemTest + component,subsystem,system componenttest - com.devonfw.module.test.common.api.category.CategorySubsystemTest,com.devonfw.module.test.common.api.category.CategorySystemTest + subsystem,system subsystemtest - - com.devonfw.module.test.common.api.category.CategorySystemTest + + system systemtest - + none @@ -430,6 +449,9 @@ org.owasp dependency-check-maven + + false + diff --git a/poc-with-identification-counter/server/pom.xml b/poc-with-identification-counter/server/pom.xml index 51f8099..86f7f95 100644 --- a/poc-with-identification-counter/server/pom.xml +++ b/poc-with-identification-counter/server/pom.xml @@ -10,11 +10,7 @@ poc-with-identification-counter-server war ${project.artifactId} - Server for the poc-with-identification-counter application - a simple example using the Open Application Standard Platform for Java (devon4j). - - - 1.8 - + Server for the poc-with-identification-counter application - a simple example based on devon4j. @@ -22,7 +18,13 @@ poc-with-identification-counter-core ${project.version} - + + + com.devonfw.java.modules + devon4j-test-jpa + test + + @@ -124,7 +126,7 @@ org.springframework.boot spring-boot-maven-plugin - com.devonfw.application.pocwithidentificationcounter.SpringBootApp + com.devonfw.application.pocwithidentification.SpringBootApp bootified ${project.artifactId}