KON-14 - Kontakte-Modulzuordnung Suche, Doku, Fix für ContactPersonen/E-Mail
diff --git a/pom.xml b/pom.xml
index 4a33097..f9cdd8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,7 @@
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
<springfox.version>2.9.2</springfox.version>
+ <spring-security-test.version>5.2.1.RELEASE</spring-security-test.version>
<powerMockReflect.version>2.0.0</powerMockReflect.version>
<sonar-maven-plugin.version>3.2</sonar-maven-plugin.version>
<asciidoctor-maven-plugin-version>1.5.3</asciidoctor-maven-plugin-version>
@@ -145,6 +146,7 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
+ <version>${spring-security-test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc b/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc
index 12b1231..313b619 100644
--- a/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc
+++ b/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc
@@ -105,8 +105,6 @@
=== Technical Constraints
-TODO: Bibliotheken und Versionen aktualisieren
-
The following technical constraints are given:
.Technical Contraints
@@ -136,7 +134,7 @@
|Programming language
a|* Backend: Java 1.8
-* Frontend: Angular 4.0.0 (Javascript, Typescript, HTML5, CSS3)
+* Frontend: Angular 7+ (Javascript, Typescript, HTML5, CSS3)
|IDE
a|* Not restricted (Eclipse, IntelliJ, Microsoft Developer Studio, Microsoft Visual Code ...)
@@ -178,11 +176,283 @@
|org.springframework.boot.spring-boot-starter-parent|2.2.1.RELEASE
a|
-[source,xml]
-----
-
-----
||Apache License 2.0|Backend
+
+|org.springframework.boot.spring-boot-starter-data-jpa|2.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.boot.spring-boot-starter-oauth2-client|2.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.boot.spring-boot-starter-security|2.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.boot.spring-boot-starter-web|2.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.flywaydb.flyway-core|6.0.8
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.cloud.spring-cloud-starter-openfeign|2.2.0.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.cloud.spring-cloud-starter-netflix-ribbon|2.2.0.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.keycloak.keycloak-core|3.4.2_Final
+a|
+||Apache License 2.0|Backend
+
+|org.postgresql.postgresql|42.2.8
+a|
+||New BSD License|Backend
+
+|org.projectlombok.lombok|1.18.10
+a|
+||MIT|Backend
+
+|org.mapstruct.mapstruct-processor|1.2.0.Final
+a|
+||Apache License 2.0|Backend
+
+|io.jsonwebtoken.jjwt|0.9.1
+a|
+||Apache License 2.0|Backend
+
+|io.springfox.springfox-swagger2|2.9.2
+a|
+||Apache License 2.0|Backend
+
+|io.springfox.springfox-swagger-ui|2.9.2
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.boot.spring-boot-starter-test|2.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.security.spring-security-test|5.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.powermock.powermock-reflect|2.0.0
+a|
+||Apache License 2.0|Backend
+
+|com.h2database.h2|1.4.200
+a|
+||EPL|Backend
+
+|org.springframework.cloud.spring-cloud-dependencies|Hoxton.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.springframework.boot.spring-boot-maven-plugin|2.2.1.RELEASE
+a|
+||Apache License 2.0|Backend
+
+|org.jacoco.jacoco-maven-plugin|0.7.9
+a|
+||EPL 2.0|Backend
+
+|org.sonarsource.scanner.maven.sonar-maven-plugin|3.2
+a|
+||LGPL 3.0|Backend
+
+|org.asciidoctor.asciidoctor-maven-plugin|1.5.3
+a|
+||Apache License 2.0|Backend
+
+
+|org.jruby.jruby-complete|9.0.0.0
+a|
+||EPL 2.0|Backend
+
+|org.asciidoctor.asciidoctorj-pdf|1.5.0-alpha.11
+a|
+||Apache 2.0|Backend
+
+
+|org.asciidoctor.asciidoctorj|1.5.4
+a|
+||Apache 2.0|Backend
+
+
+|org.asciidoctor.asciidoctorj-pdf|1.5.0-alpha.11
+a|
+||Apache 2.0|Backend
+
+
+|org.asciidoctor.asciidoctorj-diagram|1.5.4.1
+a|
+||Apache 2.0|Backend
+
+
+|Angular Font Awesome|3.1.2
+a|
+||MIT License|Frontend
+
+
+|@auth0/angular-jwt|3.0.1
+a|
+||MIT License|Frontend
+
+
+|font-awesome|4.7.0
+a|
+||MIT License|Frontend
+
+
+|@ngrx/core|1.2.0
+a|
+||MIT License|Frontend
+
+
+|@ngrx/effects|8-2-0
+a|
+||MIT License|Frontend
+
+
+|@ngrx/store|8.3.0
+a|
+||MIT License|Frontend
+
+
+|@ngrx/store-devtools|8.2.0
+a|
+||MIT License|Frontend
+
+
+|@ngx-translate/core|11.0.1
+a|
+||MIT License|Frontend
+
+
+|@ngx-translate/http-loader|4.0.0
+a|
+||MIT License|Frontend
+
+
+|ag-grid-angular|21.2.1
+a|
+||MIT License|Frontend
+
+
+|ag-grid-community|21.2.1
+a|
+||MIT License|Frontend
+
+
+|angular2-notifications|2.0.0
+a|
+||MIT License|Frontend
+
+
+|bootstrap|4.4.1
+a|
+||MIT License|Frontend
+
+
+|jquery|3.4.1
+a|
+||MIT License|Frontend
+
+
+|classlist.js|1.1.20150312
+a|
+||MIT License|Frontend
+
+
+|core-js|3.2.1
+a|
+||MIT License|Frontend
+
+
+|moment|2.24.0
+a|
+||MIT License|Frontend
+
+
+|ng2-popover|0.0.14
+a|
+||MIT License|Frontend
+
+
+|ngrx-forms|5.2.1
+a|
+||MIT License|Frontend
+
+
+|npm-install-peers|1.2.1
+a|
+||MIT License|Frontend
+
+
+|reselect|4.0.0
+a|
+||MIT License|Frontend
+
+
+|rxjs|6.5.3
+a|
+||MIT License|Frontend
+
+
+|rxjs-compat|6.5.4
+a|
+||MIT License|Frontend
+
+
+|ts-helpers|1.1.2
+a|
+||MIT License|Frontend
+
+
+|tslib|1.10.0
+a|
+||MIT License|Frontend
+
+
+|web-animations-js|2.3.2
+a|
+||MIT License|Frontend
+
+
+|zone.js|0.10.1
+a|
+||MIT License|Frontend
+
+
+|@swimlane/ngx-datatable|15.0.2
+a|
+||MIT License|Frontend
+
+
+|puppeteer|2.0.0
+a|
+||MIT License|Frontend
+
+
+|ngx-toastr|11.2.1
+a|
+||MIT License|Frontend
+
+|popper.js|1.16.0
+a|
+||MIT License|Frontend
+
+|@ng-bootstrap|5.1.5
+a|
+||MIT License|Frontend
+
+
|=========================================================
== System Scope and Context
@@ -258,7 +528,7 @@
This component implements the business functionality of the contact base data. And it provides services, that the
contactBaseDataFE can use the functions in the frontend.
-The "spring boot/sprint cloud" framework is used to implement this application.
+The "spring boot/spring cloud" framework is used to implement this application.
==== ContactBaseDataDev-DB (Database tier)
@@ -304,12 +574,12 @@
node "Contact Base Data Backend (simplified)" {
component RestService
- component ViewModel_API
+ component ViewModel_API__DTO
}
Services .. RestService
-Model .. ViewModel_API
-RestService --> ViewModel_API
+Model .. ViewModel_API__DTO
+RestService --> ViewModel_API__DTO
----
@@ -319,11 +589,12 @@
. *Presentation layer* - Represented by
.. REST-Srv
-.. View model
+.. View model/DTO
. *Controller layer* - Represented by
.. Controller
+.. Service
. *Model layer* - Represented by
-.. DAO
+.. Repository
.. Model
@@ -339,23 +610,26 @@
component RestService
- component ViewModel_API
+ component ViewModel_DTO
component Controller
- component DAO
+ component Service
- RestService --> ViewModel_API
+ component Repository
+
+ RestService --> ViewModel_DTO
RestService --> Controller
- DAO --> Model
- Controller --> DAO
- }
+ Controller --> Service
+ Service --> Repository
+ Repository --> Model
+ }
node DBMS {
component ContactBaseDataDB
}
-DAO --> ContactBaseDataDB
+Repository --> ContactBaseDataDB
----
==== ContactBaseData-DB (database tier)
@@ -440,18 +714,35 @@
===== Configuration of the contact base data backend
-When starting the microservice of the contact base data backend you have to provide a configuration "YML"
-file.
-TODO: Describe configuration possibilities.
+The backend service is configured in the * .yaml files, which are located in the JAR file.
+This yml-file can be divided into different configuration profiles.
+When starting the backend-service one has the possibility to specify
+the active profile
+
+* *spring.datasource* configuration section for the database connection
+* *flyway.enabled* If enabled=true then the database migrations
+ will automatically performed when starting the application
+ (this parameter should normally be set to "false"
+* *server.max-http-header-size* Maximum size for the http-headers
+* *jwt.tokenHeader* Name of the http-header which carries the authentication-token.
+ (should be "Authorization")
+* *jwt.useStaticJwt* If set to "true" then the backend will use *jwt.staticJwt*
+ as Authorization-token. (This won't work for calls to other modules
+ like the Auth'n'Auth-Modul, because the token will be out of date)
+* *authNAuthService.ribbon.listOfServers* Here one can configure the base
+ url to the Auth'n'Auth-Service
=== CI- and CD-Components
==== GIT-Repository
+Backend:
+https://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.contactBaseData.backend.git/
-TODO: Links to Repos
+Frontend:
+https://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.contactBaseData.frontend.git/
=== Continuous deployment
@@ -496,6 +787,7 @@
|AC|Architecture Committee|Architektur-Komittee|Gives framework and constraints according to architecture for oK projects.
|CNCU|Central Network Control Unit||
|DAO|Data Access Objects||
+|DTO|Data Transfer Object||
|DSO|Distribution System Operator|Verteilnetz-betreiber (VNB)|Manages the distribution network for energy, gas or water.
|EPL|Eclipse Public License||Underlying license model for Eclipse projects like contact-base-data@openK
|ESB|Enterprise Service Bus||Central instance to exchange data to overcome point-to-point connections.
diff --git a/src/main/java/org/eclipse/openk/contactbasedata/service/CompanyService.java b/src/main/java/org/eclipse/openk/contactbasedata/service/CompanyService.java
index bb17aaf..9957faf 100644
--- a/src/main/java/org/eclipse/openk/contactbasedata/service/CompanyService.java
+++ b/src/main/java/org/eclipse/openk/contactbasedata/service/CompanyService.java
@@ -131,6 +131,7 @@
private void mapEmail( ContactPersonDto dto, Map<UUID, TblContactPerson> cpMap ) {
+ // TODO: Move to Mapper
TblCommunication tblComm = cpMap.get(dto.getContactUuid()).getContact()
.getCommunications().stream()
.filter(comm -> comm.getRefCommunicationType().getId() == 1L)
diff --git a/src/main/java/org/eclipse/openk/contactbasedata/service/ContactPersonService.java b/src/main/java/org/eclipse/openk/contactbasedata/service/ContactPersonService.java
index f1b2521..e2bef26 100644
--- a/src/main/java/org/eclipse/openk/contactbasedata/service/ContactPersonService.java
+++ b/src/main/java/org/eclipse/openk/contactbasedata/service/ContactPersonService.java
@@ -19,6 +19,7 @@
import org.eclipse.openk.contactbasedata.exceptions.NotFoundException;
import org.eclipse.openk.contactbasedata.mapper.ContactMapper;
import org.eclipse.openk.contactbasedata.mapper.ContactPersonMapper;
+import org.eclipse.openk.contactbasedata.model.TblCommunication;
import org.eclipse.openk.contactbasedata.model.TblContact;
import org.eclipse.openk.contactbasedata.model.TblContactPerson;
import org.eclipse.openk.contactbasedata.repository.*;
@@ -58,8 +59,8 @@
public ContactPersonDto findContactPerson(UUID contactPersonUuid) {
TblContactPerson tblContactPerson = contactPersonRepository
.findByTblContactUuid(contactPersonUuid)
- .orElseThrow(() -> new NotFoundException("contact.uuid.not.existing"));
- return contactPersonMapper.toContactPersonDto(tblContactPerson);
+ .orElseThrow(() -> new NotFoundException(Constants.CONTACT_UUID_NOT_EXISTING));
+ return setFromTblContactPerson(contactPersonMapper.toContactPersonDto(tblContactPerson), tblContactPerson);
}
@Transactional
@@ -75,7 +76,9 @@
setFromContactPersonDto( contactPersonToSave, contactPersonDto );
// Then save dependent Model-Object
- return contactPersonMapper.toContactPersonDto(contactPersonRepository.save(contactPersonToSave));
+ return setFromTblContactPerson(
+ contactPersonMapper.toContactPersonDto(contactPersonRepository.save(contactPersonToSave)),
+ contactPersonToSave);
}
@Transactional
@@ -84,7 +87,7 @@
TblContactPerson existingContactPerson = contactPersonRepository
.findByTblContactUuid(contactPersonDto.getContactUuid())
- .orElseThrow(() -> new NotFoundException("contact.uuid.not.existing"));
+ .orElseThrow(() -> new NotFoundException(Constants.CONTACT_UUID_NOT_EXISTING));
existingContactPerson.setLastName(contactPersonDto.getLastName());
existingContactPerson.setFirstName(contactPersonDto.getFirstName());
@@ -93,13 +96,14 @@
setFromContactPersonDto( existingContactPerson, contactPersonDto );
contactPersonUpdated = contactPersonRepository.save(existingContactPerson);
- return contactPersonMapper.toContactPersonDto(contactPersonUpdated);
+ ContactPersonDto retDto = contactPersonMapper.toContactPersonDto(contactPersonUpdated);
+ return setFromTblContactPerson(retDto, contactPersonUpdated);
}
@Transactional
public void deleteContactPerson(UUID contactUuid) {
TblContact tblContact = contactRepository.findByUuid(contactUuid)
- .orElseThrow(() -> new NotFoundException("contact.uuid.not.existing"));
+ .orElseThrow(() -> new NotFoundException(Constants.CONTACT_UUID_NOT_EXISTING));
TblContactPerson tblContactPerson = contactPersonRepository.findByTblContactUuid(contactUuid)
.orElseThrow(() -> new NotFoundException("contact.person.uuid.not.existing"));
@@ -107,6 +111,18 @@
contactRepository.delete(tblContact);
}
+ private ContactPersonDto setFromTblContactPerson( ContactPersonDto destDto, TblContactPerson srcTblContactPerson ) {
+ TblCommunication tblComm = srcTblContactPerson.getContact()
+ .getCommunications().stream()
+ .filter(comm -> comm.getRefCommunicationType().getId() == 1L)
+ .findFirst().orElse(null);
+// TODO: exchange constant 1L with DB-Solution
+ // TODO: Move to Mapper
+ destDto.setEmail(tblComm != null ? tblComm.getCommunicationData() : null );
+
+ return destDto;
+ }
+
private void setFromContactPersonDto( TblContactPerson destTblContactPerson, ContactPersonDto sourceDto ) {
if( sourceDto.getSalutationUuid() != null ) {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 038a215..caa2f93 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -95,7 +95,7 @@
staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWV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-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg
server:
- port: 9155
+ port: 9156
cors:
allowedOrigins: http://localhost:8080
@@ -121,7 +121,7 @@
jwt:
tokenHeader: Authorization
- useStaticJwt: true
+ useStaticJwt: false
staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYTQwYy0yYjQyZTNkNjNiOGEiLCJleHAiOjE1Nzg2NTU3OTUsIm5iZiI6MCwiaWF0IjoxNTc4NjU1NDk1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiODYyNjY5NmYtZjFhMi00ZGI1LTkyZWYtZTlhMjQ2Njg1YTU0IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjJmMWIzODE5LWZjNjQtNDEzNC1iNWQxLWY3ZWY4NzU5NDBkNCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsia29uLWFkbWluIiwia29uLXdyaXRlciIsImtvbi1hY2Nlc3MiLCJrb24tcmVhZGVyIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnt9LCJuYW1lIjoiVGVzdGVyRmlyc3RuYW1lX3J3YSBUZXN0ZXJMYXN0bmFtZV9yd2EiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ0ZXN0dXNlcl9yd2EiLCJn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