master e194c6ca377c cached
143 files
221.3 KB
70.7k tokens
202 symbols
1 requests
Download .txt
Showing preview only (272K chars total). Download the full file or copy to clipboard to get everything.
Repository: JonathanM2ndoza/Hexagonal-Architecture-DDD
Branch: master
Commit: e194c6ca377c
Files: 143
Total size: 221.3 KB

Directory structure:
gitextract_phlx012v/

├── Customer/
│   ├── .gitignore
│   ├── README.md
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── jmendoza/
│       │   │           └── swa/
│       │   │               └── hexagonal/
│       │   │                   └── customer/
│       │   │                       ├── CustomerApplication.java
│       │   │                       ├── application/
│       │   │                       │   ├── rest/
│       │   │                       │   │   ├── controller/
│       │   │                       │   │   │   └── CustomerController.java
│       │   │                       │   │   ├── request/
│       │   │                       │   │   │   └── README.md
│       │   │                       │   │   └── response/
│       │   │                       │   │       ├── CreateCustomerResponse.java
│       │   │                       │   │       ├── CustomerLoginResponse.java
│       │   │                       │   │       └── ResponseMapper.java
│       │   │                       │   └── soap/
│       │   │                       │       └── README.md
│       │   │                       ├── common/
│       │   │                       │   ├── config/
│       │   │                       │   │   └── CreateBean.java
│       │   │                       │   ├── constants/
│       │   │                       │   │   └── CustomerConstanst.java
│       │   │                       │   ├── customannotations/
│       │   │                       │   │   └── UseCase.java
│       │   │                       │   └── exception/
│       │   │                       │       ├── CustomExceptionHandler.java
│       │   │                       │       ├── ErrorDetails.java
│       │   │                       │       ├── GlobalException.java
│       │   │                       │       ├── ParameterNotFoundException.java
│       │   │                       │       └── ResourceNotFoundException.java
│       │   │                       ├── domain/
│       │   │                       │   ├── model/
│       │   │                       │   │   └── Customer.java
│       │   │                       │   ├── ports/
│       │   │                       │   │   ├── inbound/
│       │   │                       │   │   │   ├── CreateCustomerUseCase.java
│       │   │                       │   │   │   ├── CustomerLoginUseCase.java
│       │   │                       │   │   │   ├── DeleteCustomerUseCase.java
│       │   │                       │   │   │   └── UpdateCustomerUseCase.java
│       │   │                       │   │   └── outbound/
│       │   │                       │   │       ├── CreateCustomerPort.java
│       │   │                       │   │       ├── DeleteCustomerPort.java
│       │   │                       │   │       ├── ExistsCustomerPort.java
│       │   │                       │   │       ├── GetCustomerEmailPort.java
│       │   │                       │   │       ├── GetCustomerIdPort.java
│       │   │                       │   │       ├── PasswordEncodePort.java
│       │   │                       │   │       ├── PasswordMatchesPort.java
│       │   │                       │   │       └── UpdateCustomerPort.java
│       │   │                       │   └── services/
│       │   │                       │       ├── CreateCustomerService.java
│       │   │                       │       ├── CustomerLoginService.java
│       │   │                       │       ├── DeleteCustomerService.java
│       │   │                       │       └── UpdateCustomerService.java
│       │   │                       └── infrastructure/
│       │   │                           ├── databases/
│       │   │                           │   ├── mongo/
│       │   │                           │   │   ├── CreateCustomerAdapter.java
│       │   │                           │   │   ├── CustomerRepository.java
│       │   │                           │   │   ├── DeleteCustomerAdapter.java
│       │   │                           │   │   ├── ExistsCustomerAdapter.java
│       │   │                           │   │   ├── GetCustomerEmailAdapter.java
│       │   │                           │   │   ├── GetCustomerIdAdapter.java
│       │   │                           │   │   └── UpdateCustomerAdapter.java
│       │   │                           │   └── postgresql/
│       │   │                           │       └── README.md
│       │   │                           ├── messagebroker/
│       │   │                           │   └── README.md
│       │   │                           └── security/
│       │   │                               ├── PasswordEncodeAdapter.java
│       │   │                               └── PasswordMatchesAdapter.java
│       │   └── resources/
│       │       ├── application.properties
│       │       └── log4j2.xml
│       └── test/
│           └── java/
│               └── com/
│                   └── jmendoza/
│                       └── swa/
│                           └── hexagonal/
│                               └── customer/
│                                   └── CustomerApplicationTests.java
├── Order/
│   ├── .gitignore
│   ├── README.md
│   ├── application/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── application/
│   │                                   ├── rest/
│   │                                   │   ├── controller/
│   │                                   │   │   └── OrderController.java
│   │                                   │   ├── request/
│   │                                   │   │   └── README.md
│   │                                   │   └── response/
│   │                                   │       └── CreateOrderResponse.java
│   │                                   └── soap/
│   │                                       └── README.md
│   ├── common/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── common/
│   │                                   ├── constants/
│   │                                   │   └── OrderConstanst.java
│   │                                   ├── customannotations/
│   │                                   │   └── UseCase.java
│   │                                   └── exception/
│   │                                       ├── CustomExceptionHandler.java
│   │                                       ├── ErrorDetails.java
│   │                                       ├── GlobalException.java
│   │                                       ├── ParameterNotFoundException.java
│   │                                       └── ResourceNotFoundException.java
│   ├── configuration/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── jmendoza/
│   │           │           └── swa/
│   │           │               └── hexagonal/
│   │           │                   └── configuration/
│   │           │                       ├── HexagonalArchitectureConfigurationApplication.java
│   │           │                       └── db/
│   │           │                           └── DataSourceConfig.java
│   │           └── resources/
│   │               ├── application.properties
│   │               └── log4j2.xml
│   ├── domain/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── domain/
│   │                                   ├── model/
│   │                                   │   ├── Order.java
│   │                                   │   └── OrderProduct.java
│   │                                   ├── ports/
│   │                                   │   ├── inbound/
│   │                                   │   │   ├── CreateOrderUseCase.java
│   │                                   │   │   └── GetOrderUseCase.java
│   │                                   │   └── outbound/
│   │                                   │       ├── CreateOrderPort.java
│   │                                   │       └── GetOrderPort.java
│   │                                   └── services/
│   │                                       ├── CreateOrderService.java
│   │                                       └── GetOrderService.java
│   ├── infrastructure/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── infrastracture/
│   │                                   ├── databases/
│   │                                   │   ├── mongo/
│   │                                   │   │   └── README.md
│   │                                   │   └── postgresql/
│   │                                   │       ├── CreateOrderAdapter.java
│   │                                   │       └── GetOrderAdapter.java
│   │                                   └── messagebroker/
│   │                                       └── README.md
│   ├── logs/
│   │   ├── Order-2020-06-05-1.log
│   │   └── Order.log
│   ├── pom.xml
│   └── postgresql/
│       ├── 1-create_table_orders.sql
│       ├── 2-create_sequence_order_id.sql
│       ├── 3-create_function_create_order.sql
│       ├── 4-create_table_order_product.sql
│       ├── 5-create_order_product_id_seq.sql
│       └── 6-create_function_get_order.sql
├── Product/
│   ├── .gitignore
│   ├── README.md
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── jmendoza/
│       │   │           └── swa/
│       │   │               └── hexagonal/
│       │   │                   └── product/
│       │   │                       ├── ProductApplication.java
│       │   │                       ├── application/
│       │   │                       │   ├── rest/
│       │   │                       │   │   ├── controller/
│       │   │                       │   │   │   └── ProductController.java
│       │   │                       │   │   ├── request/
│       │   │                       │   │   │   └── README.md
│       │   │                       │   │   └── response/
│       │   │                       │   │       └── CreateProductResponse.java
│       │   │                       │   └── soap/
│       │   │                       │       └── README.md
│       │   │                       ├── common/
│       │   │                       │   ├── config/
│       │   │                       │   │   └── README.md
│       │   │                       │   ├── constants/
│       │   │                       │   │   └── ProductConstanst.java
│       │   │                       │   ├── customannotations/
│       │   │                       │   │   └── UseCase.java
│       │   │                       │   └── exception/
│       │   │                       │       ├── CustomExceptionHandler.java
│       │   │                       │       ├── ErrorDetails.java
│       │   │                       │       ├── GlobalException.java
│       │   │                       │       ├── ParameterNotFoundException.java
│       │   │                       │       └── ResourceNotFoundException.java
│       │   │                       ├── domain/
│       │   │                       │   ├── model/
│       │   │                       │   │   └── Product.java
│       │   │                       │   ├── ports/
│       │   │                       │   │   ├── inbound/
│       │   │                       │   │   │   ├── CreateProductUseCase.java
│       │   │                       │   │   │   ├── DeleteProductUseCase.java
│       │   │                       │   │   │   ├── GetProductUseCase.java
│       │   │                       │   │   │   └── GetProductsUseCase.java
│       │   │                       │   │   └── outbound/
│       │   │                       │   │       ├── CreateProductPort.java
│       │   │                       │   │       ├── DeleteProductPort.java
│       │   │                       │   │       ├── ExistsProductPort.java
│       │   │                       │   │       ├── GetProductIdPort.java
│       │   │                       │   │       └── GetProductsPort.java
│       │   │                       │   └── services/
│       │   │                       │       ├── CreateProductService.java
│       │   │                       │       ├── DeleteProductService.java
│       │   │                       │       ├── GetProductService.java
│       │   │                       │       └── GetProductsService.java
│       │   │                       └── infrastructure/
│       │   │                           ├── databases/
│       │   │                           │   ├── mongo/
│       │   │                           │   │   ├── CreateProductAdapter.java
│       │   │                           │   │   ├── DeleteProductAdapter.java
│       │   │                           │   │   ├── ExistsProductAdapter.java
│       │   │                           │   │   ├── GetProductIdAdapter.java
│       │   │                           │   │   ├── GetProductsAdapter.java
│       │   │                           │   │   └── ProductRepository.java
│       │   │                           │   └── postgresql/
│       │   │                           │       └── README.md
│       │   │                           └── messagebroker/
│       │   │                               └── README.md
│       │   └── resources/
│       │       ├── application.properties
│       │       └── log4j2.xml
│       └── test/
│           └── java/
│               └── com/
│                   └── jmendoza/
│                       └── swa/
│                           └── hexagonal/
│                               └── product/
│                                   └── ProductApplicationTests.java
├── README.md
├── logs/
│   ├── Customer.log
│   ├── Order.log
│   └── Product.log
└── prtsc/
    └── Hexagonal-Architecture-Microservices.drawio

================================================
FILE CONTENTS
================================================

================================================
FILE: Customer/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Customer/README.md
================================================
# Customer Microservice

Example of Customer Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD) and SOLID principles.

This example was implemented with Spring Boot, MongoDB Atlas. The microservices are deployed locally and the DB in the cloud.

## MongoDB Atlas
- Signup free at https://www.mongodb.com/cloud/atlas/signup 
- Create DATABASE and COLLECTION (Optional)
- Create Database User
- Add your IP Address (public) in IP Whitelist, Network Access

![Screenshot](prtsc/Customer-1.png)

![Screenshot](prtsc/Customer-1.1.png)

## Configure your application.properties

![Screenshot](prtsc/Customer-2.png)

## Create Customer

**Postman**

![Screenshot](prtsc/Customer-3.png)

![Screenshot](prtsc/Customer-3.1.png)

![Screenshot](prtsc/Customer-3.2.png)

**MongoDB Atlas**

![Screenshot](prtsc/Customer-3.3.png)

## Customer Login

**Postman**

![Screenshot](prtsc/Customer-4.png)




================================================
FILE: Customer/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.jmendoza.swa.hexagonal</groupId>
    <artifactId>customer</artifactId>
    <version>1.0</version>
    <name>customer</name>
    <description>Example of Hexagonal Architecture - Customers</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>2.3.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>2.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
            <version>3.3.6</version>
        </dependency>
        <dependency>
            <groupId>org.zalando</groupId>
            <artifactId>logbook-spring-boot-starter</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/CustomerApplication.java
================================================
package com.jmendoza.swa.hexagonal.customer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(exclude = {
        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
        org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class}
)
public class CustomerApplication {

    public static void main(String[] args) {
        SpringApplication.run(CustomerApplication.class, args);
    }

}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/controller/CustomerController.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.controller;

import com.jmendoza.swa.hexagonal.customer.application.rest.response.CreateCustomerResponse;
import com.jmendoza.swa.hexagonal.customer.application.rest.response.CustomerLoginResponse;
import com.jmendoza.swa.hexagonal.customer.application.rest.response.ResponseMapper;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CreateCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CustomerLoginUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.DeleteCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.UpdateCustomerUseCase;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/v1/customers")
@AllArgsConstructor
public class CustomerController {

    private final CreateCustomerUseCase createCustomerUseCase;
    private final CustomerLoginUseCase customerLoginUseCase;
    private final DeleteCustomerUseCase deleteCustomerUseCase;
    private final UpdateCustomerUseCase updateCustomerUseCase;

    private final ResponseMapper responseMapper;

    @PostMapping
    public ResponseEntity<CreateCustomerResponse> createCustomer(@Valid @RequestBody Customer customer) throws GlobalException, ParameterNotFoundException {
        createCustomerUseCase.createCustomer(customer);
        return ResponseEntity.ok().body(CreateCustomerResponse.builder().id(customer.getId()).build());
    }

    @PostMapping("/login")
    public ResponseEntity<CustomerLoginResponse> customerLogin(@Valid @RequestBody Customer customer) throws ResourceNotFoundException, GlobalException, ParameterNotFoundException {
        CustomerLoginResponse customerLoginResponse = responseMapper.convertCustomerToCustomerLoginResponse(customerLoginUseCase.customerLogin(customer.getEmail(), customer.getPassword()));
        return ResponseEntity.ok().body(customerLoginResponse);
    }

    @DeleteMapping("/{id}")
    public ResponseEntity deleteCustomer(@PathVariable(value = "id") String id) throws ResourceNotFoundException {
        deleteCustomerUseCase.deleteCustomer(id);
        return ResponseEntity.noContent().build();
    }

    @PutMapping("/{id}")
    public ResponseEntity updateCustomer(@PathVariable(value = "id") String id,
                                         @Valid @RequestBody Customer customer) throws ResourceNotFoundException {
        updateCustomerUseCase.updateCustomer(id, customer);
        return ResponseEntity.noContent().build();
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/request/README.md
================================================
*In this directory you can add specialized requests, to only request minimum data, for example CreateUserRequest.*


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CreateCustomerResponse.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateCustomerResponse {
    private String id;
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CustomerLoginResponse.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomerLoginResponse {
    private String id;
    private String firstName;
    private String lastName;
    private String email;
    private String createdAt;
    private String updatedAt;
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/ResponseMapper.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.response;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ResponseMapper {

    @Autowired
    ModelMapper modelMapper;

    public CustomerLoginResponse convertCustomerToCustomerLoginResponse(Customer customer) {
        return modelMapper.map(customer, CustomerLoginResponse.class);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/soap/README.md
================================================
*In this directory you can add another type of adapter to access the domain, for example a CustomerController class to expose SOAP.*


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/config/CreateBean.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.config;

import org.modelmapper.ModelMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CreateBean {
    @Bean
    public ModelMapper modelMapper() {
        return new ModelMapper();
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/constants/CustomerConstanst.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.constants;

public class CustomerConstanst {
    public static final String CUSTOMER_NOT_FOUND = "Customer not found :: ";
    public static final String THIS_EMAIL_IS_ALREADY_REGISTERED = "This email is already registered ";
    public static final String THE_PASSWORD_IS_INCORRECT = "The password is incorrect ";
    public static final String REQUIRED_PARAMETER = "Required parameter ";
    public static final String IS_NOT_PRESENT = " is not present";

    private CustomerConstanst() {
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/customannotations/UseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.customannotations;

import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface UseCase {

    @AliasFor(annotation = Component.class)
    String value() default "";
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/CustomExceptionHandler.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;

import java.util.Date;

@ControllerAdvice
public class CustomExceptionHandler {

    private static final Logger loggerException = LogManager.getLogger(CustomExceptionHandler.class);

    @ExceptionHandler(ResourceNotFoundException.class)
    public ResponseEntity resourceNotFoundException(ResourceNotFoundException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
    }

    @ExceptionHandler({GlobalException.class})
    public ResponseEntity globalExceptionHandler(GlobalException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
    }

    @ExceptionHandler({ParameterNotFoundException.class})
    public ResponseEntity parameterNotFoundExceptionHandler(ParameterNotFoundException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ErrorDetails.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Date;

@Getter
@AllArgsConstructor
public class ErrorDetails {
    private Date timestamp;
    private String message;
    private String details;
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/GlobalException.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class GlobalException extends Exception {
    private static final long serialVersionUID = 1L;

    public GlobalException(String message) {
        super(message);
    }

    public GlobalException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ParameterNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class ParameterNotFoundException extends Exception {

    private static final long serialVersionUID = 1L;

    public ParameterNotFoundException(String message) {
        super(message);
    }

    public ParameterNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ResourceNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {

    private static final long serialVersionUID = 1L;

    public ResourceNotFoundException(String message) {
        super(message);
    }

    public ResourceNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/model/Customer.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.model;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class Customer {
    private String id;
    private String firstName;
    private String lastName;
    private String email;
    private String password;
    private String createdAt;
    private String updatedAt;
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CreateCustomerUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

public interface CreateCustomerUseCase {
    void createCustomer(Customer customer) throws GlobalException, ParameterNotFoundException;
}

================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CustomerLoginUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

public interface CustomerLoginUseCase {
    Customer customerLogin(String email, String password) throws ResourceNotFoundException, GlobalException, ParameterNotFoundException;
}

================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/DeleteCustomerUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;

public interface DeleteCustomerUseCase {
    void deleteCustomer(String id) throws ResourceNotFoundException;
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/UpdateCustomerUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

public interface UpdateCustomerUseCase {
    void updateCustomer(String id, Customer customer) throws ResourceNotFoundException;
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/CreateCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

public interface CreateCustomerPort {
    void createCustomer(Customer customer);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/DeleteCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

public interface DeleteCustomerPort {
    void deleteCustomer(Customer customer);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/ExistsCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

public interface ExistsCustomerPort {
    boolean existsByEmail(String email);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerEmailPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

import java.util.Optional;

public interface GetCustomerEmailPort {
    Optional<Customer> getCustomerByEmail(String email);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerIdPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

import java.util.Optional;

public interface GetCustomerIdPort {
    Optional<Customer> getCustomerById(String id);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordEncodePort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

public interface PasswordEncodePort {
    String passwordEncoder(String password);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordMatchesPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

public interface PasswordMatchesPort {

    boolean passwordMatchesPort(CharSequence rawPassword, String encodedPassword);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/UpdateCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;

public interface UpdateCustomerPort {
    void updateCustomer(Customer customer);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CreateCustomerService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;

import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CreateCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.CreateCustomerPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.ExistsCustomerPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordEncodePort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@AllArgsConstructor
@UseCase
public class CreateCustomerService implements CreateCustomerUseCase {

    private CreateCustomerPort createCustomerPort;
    private PasswordEncodePort passwordEncodePort;
    private ExistsCustomerPort existsCustomerPort;

    @Override
    public void createCustomer(Customer customer) throws GlobalException, ParameterNotFoundException {

        if (StringUtils.isBlank(customer.getFirstName()))
            getMessageParameterNotFoundException("firstName");
        if (StringUtils.isBlank(customer.getLastName()))
            getMessageParameterNotFoundException("lastName");
        if (StringUtils.isBlank(customer.getEmail()))
            getMessageParameterNotFoundException("email");
        if (StringUtils.isBlank(customer.getPassword()))
            getMessageParameterNotFoundException("password");
        if (StringUtils.isBlank(customer.getCreatedAt()))
            getMessageParameterNotFoundException("createdAt");

        if (existsCustomerPort.existsByEmail(customer.getEmail()))
            throw new GlobalException(CustomerConstanst.THIS_EMAIL_IS_ALREADY_REGISTERED);

        customer.setPassword(passwordEncodePort.passwordEncoder(customer.getPassword()));
        createCustomerPort.createCustomer(customer);
    }

    private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
        throw new ParameterNotFoundException(CustomerConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + CustomerConstanst.IS_NOT_PRESENT);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CustomerLoginService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;

import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CustomerLoginUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerEmailPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordMatchesPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Optional;

@AllArgsConstructor
@UseCase
public class CustomerLoginService implements CustomerLoginUseCase {

    private GetCustomerEmailPort getCustomerEmailPort;
    private PasswordMatchesPort passwordMatchesPort;

    @Override
    public Customer customerLogin(String email, String password) throws ResourceNotFoundException, GlobalException, ParameterNotFoundException {

        if (StringUtils.isBlank(email))
            getMessageParameterNotFoundException("email");
        if (StringUtils.isBlank(password))
            getMessageParameterNotFoundException("password");

        Optional<Customer> customerOptional;
        Customer customer = null;
        customerOptional = Optional.ofNullable(getCustomerEmailPort.getCustomerByEmail(email).orElseThrow(() -> new ResourceNotFoundException(CustomerConstanst.CUSTOMER_NOT_FOUND + email)));
        if (customerOptional.isPresent()) {
            customer = customerOptional.get();
            if (!passwordMatchesPort.passwordMatchesPort(password, customer.getPassword()))
                throw new GlobalException(CustomerConstanst.THE_PASSWORD_IS_INCORRECT);

            customer.setPassword(StringUtils.EMPTY);
        }
        return customer;
    }

    private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
        throw new ParameterNotFoundException(CustomerConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + CustomerConstanst.IS_NOT_PRESENT);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/DeleteCustomerService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;

import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.DeleteCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.DeleteCustomerPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerIdPort;
import lombok.AllArgsConstructor;

@AllArgsConstructor
@UseCase
public class DeleteCustomerService implements DeleteCustomerUseCase {

    private GetCustomerIdPort getCustomerIdPort;
    private DeleteCustomerPort deleteCustomerPort;

    @Override
    public void deleteCustomer(String id) throws ResourceNotFoundException {
        Customer customer = getCustomerIdPort.getCustomerById(id)
                .orElseThrow(() -> new ResourceNotFoundException(CustomerConstanst.CUSTOMER_NOT_FOUND + id));
        deleteCustomerPort.deleteCustomer(customer);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/UpdateCustomerService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;

import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.UpdateCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerIdPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordEncodePort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.UpdateCustomerPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.modelmapper.Conditions;
import org.modelmapper.ModelMapper;

@AllArgsConstructor
@UseCase
public class UpdateCustomerService implements UpdateCustomerUseCase {

    private GetCustomerIdPort getCustomerIdPort;
    private UpdateCustomerPort updateCustomerPort;
    private PasswordEncodePort passwordEncodePort;

    private ModelMapper modelMapper;

    @Override
    public void updateCustomer(String id, Customer customer) throws ResourceNotFoundException {
        Customer customer1 = getCustomerIdPort.getCustomerById(id)
                .orElseThrow(() -> new ResourceNotFoundException(CustomerConstanst.CUSTOMER_NOT_FOUND + id));

        if (!StringUtils.isBlank(customer.getPassword()))
            customer.setPassword(passwordEncodePort.passwordEncoder(customer.getPassword()));

        customer.setId(id);
        modelMapper.getConfiguration().setPropertyCondition(Conditions.isNotNull());
        modelMapper.map(customer, customer1);
        updateCustomerPort.updateCustomer(customer1);
    }
}

================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CreateCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.CreateCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CreateCustomerAdapter implements CreateCustomerPort {
    @Autowired
    private CustomerRepository customerRepository;

    @Override
    public void createCustomer(Customer customer) {
        customerRepository.save(customer);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CustomerRepository.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface CustomerRepository extends MongoRepository<Customer, String> {

    boolean existsByEmail(String email);

    Optional<Customer> findByEmail(String email);
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/DeleteCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.DeleteCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DeleteCustomerAdapter implements DeleteCustomerPort {

    @Autowired
    private CustomerRepository customerRepository;

    @Override
    public void deleteCustomer(Customer customer) {
        customerRepository.delete(customer);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/ExistsCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.ExistsCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ExistsCustomerAdapter implements ExistsCustomerPort {
    @Autowired
    private CustomerRepository customerRepository;

    @Override
    public boolean existsByEmail(String email) {
        return customerRepository.existsByEmail(email);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerEmailAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerEmailPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Optional;

@Component
public class GetCustomerEmailAdapter implements GetCustomerEmailPort {
    @Autowired
    private CustomerRepository customerRepository;

    @Override
    public Optional<Customer> getCustomerByEmail(String email) {
        return customerRepository.findByEmail(email);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerIdAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerIdPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Optional;

@Component
public class GetCustomerIdAdapter implements GetCustomerIdPort {

    @Autowired
    private CustomerRepository customerRepository;

    @Override
    public Optional<Customer> getCustomerById(String id) {
        return customerRepository.findById(id);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/UpdateCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.UpdateCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UpdateCustomerAdapter implements UpdateCustomerPort {

    @Autowired
    private CustomerRepository customerRepository;

    @Override
    public void updateCustomer(Customer customer) {
        customerRepository.save(customer);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/postgresql/README.md
================================================
*In this directory you can add another type of DB adapter for example PostgreSQL.*


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/messagebroker/README.md
================================================
*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ.*


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordEncodeAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.security;

import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordEncodePort;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class PasswordEncodeAdapter implements PasswordEncodePort {

    BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

    @Override
    public String passwordEncoder(String password) {
        return bCryptPasswordEncoder.encode(password);
    }
}


================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordMatchesAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.security;

import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordMatchesPort;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class PasswordMatchesAdapter implements PasswordMatchesPort {

    BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

    @Override
    public boolean passwordMatchesPort(CharSequence rawPassword, String encodedPassword) {
        return bCryptPasswordEncoder.matches(rawPassword, encodedPassword);
    }
}


================================================
FILE: Customer/src/main/resources/application.properties
================================================
# Application Server
server.port=3000

# MongoDB Atlas
spring.data.mongodb.uri=mongodb+srv://jmendoza:zuZYkSpMIpSGqgLD@cluster0-7rxkw.mongodb.net/customer?retryWrites=true&w=majority&connectTimeoutMS=60000

# Logbook: HTTP request and response logging
logging.level.org.zalando.logbook = TRACE


================================================
FILE: Customer/src/main/resources/log4j2.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Don't forget to set system property -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
     to make all loggers asynchronous. -->

<!-- No need to set system property "log4j2.contextSelector" to any value
     when using <asyncLogger> or <asyncRoot>. -->

<Configuration status="WARN" monitorInterval="30">
    <Properties>
        <Property name="LOG_PATTERN">
            [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%p] [${hostName}] [%t] [%c{3}] ==> %m%n
        </Property>
    </Properties>
    <Appenders>
        <Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true">
            <PatternLayout pattern="${LOG_PATTERN}"/>
        </Console>
        <!-- Rolling File Appender -->
        <RollingFile name="FileAppender" fileName="logs/Customer.log"
                     filePattern="logs/Customer-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout>
                <Pattern>${LOG_PATTERN}</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1"/>
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <AsyncLogger name="com.jmendoza.swa.hexagonal.customer" level="debug" additivity="false">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </AsyncLogger>
        <AsyncLogger name="org.hibernate" level="info" additivity="false">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </AsyncLogger>

        <Root level="info">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </Root>
    </Loggers>
</Configuration>


================================================
FILE: Customer/src/test/java/com/jmendoza/swa/hexagonal/customer/CustomerApplicationTests.java
================================================
package com.jmendoza.swa.hexagonal.customer;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class CustomerApplicationTests {

    @Test
    void contextLoads() {
    }

}


================================================
FILE: Order/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Order/README.md
================================================
# Orders Microservice

Example of Orders Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD) and SOLID principles. I recommend using this Multiple Modules structure to decouple the code. In this way, part of the code can be migrated to another project in the future.

This example was implemented with Spring Boot, PostgreSQL. The microservices and the DB are deployed locally.

### Start a PostgreSQL Server 

1. Start a PostgreSQL server instance with Docker Hub

```shell
jmendoza@jmendoza-ThinkPad-T420:~$ docker run -d --name postgres -e POSTGRES_PASSWORD=root.jmtizure.k201 postgres
```

2. Start pgAdmin 4 (Container), is a GUI client for PostgreSQL
```shell
jmendoza@jmendoza-ThinkPad-T420:~$ docker run --name pgadmin4 -p 5050:80 -e "PGADMIN_DEFAULT_EMAIL=jmtizure@gmail.com" -e "PGADMIN_DEFAULT_PASSWORD=123456789" -d  dpage/pgadmin4
```

![Screenshot](prtsc/Order-9.png)

![Screenshot](prtsc/Order-5.png)

3. Create a new "customers" database

![Screenshot](prtsc/Order-6.png)

4. Execute the following scripts in the public schema.

![Screenshot](prtsc/Order-4.png)

## Configure your application.properties

Find the IP address of your postgres container

```shell
jmendoza@jmendoza-ThinkPad-T420:~$ docker inspect postgres
```

![Screenshot](prtsc/Order-8.png)

![Screenshot](prtsc/Order-7.png)

## Create Order

**Postman**

![Screenshot](prtsc/Order-1.png)

```shell
[2020-06-03 22:35:27.350] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"ab783ac9bce46b82","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["32678e26-1a2d-450e-865d-5ea8429540ac"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-06-03 22:35:27.513] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"ab783ac9bce46b82","duration":255,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Thu, 04 Jun 2020 02:35:27 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"31"}}
```

**PostgreSQL**

![Screenshot](prtsc/Order-2.png)

![Screenshot](prtsc/Order-3.png)

## Get Orders

**Postman**

![Screenshot](prtsc/Order-12.png)

**PostgreSQL**

![Screenshot](prtsc/Order-10.png)

![Screenshot](prtsc/Order-11.png)

```shell
[2020-06-04 21:52:50.882] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-7] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"91d731033f99fbed","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/33","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["8fe08c78-dcb0-9f1e-a0a8-62f731d232a4"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:52:50.893] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-7] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"91d731033f99fbed","duration":11,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:52:50 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"33","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":13,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":14,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
```


================================================
FILE: Order/application/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Order/application/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.jmendoza.swa.hexagonal</groupId>
        <artifactId>order</artifactId>
        <version>1.0</version>
    </parent>

    <artifactId>application</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>hexagonal-architecture-application</name>
    <description>Example of Hexagonal Architecture - Application</description>

    <dependencies>
        <dependency>
            <groupId>com.jmendoza.swa.hexagonal</groupId>
            <artifactId>domain</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

</project>


================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/controller/OrderController.java
================================================
package com.jmendoza.swa.hexagonal.application.rest.controller;

import com.jmendoza.swa.hexagonal.application.rest.response.CreateOrderResponse;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.CreateOrderUseCase;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.GetOrderUseCase;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/v1/orders")
@AllArgsConstructor
public class OrderController {

    private final CreateOrderUseCase createOrderUseCase;
    private final GetOrderUseCase getOrderUseCase;

    @PostMapping
    public ResponseEntity<CreateOrderResponse> createOrder(@Valid @RequestBody Order order) throws ParameterNotFoundException, GlobalException {
        createOrderUseCase.createOrder(order);
        return ResponseEntity.ok().body(CreateOrderResponse.builder().orderId(order.getOrderId()).build());
    }

    @GetMapping("/{id}")
    public ResponseEntity<Order> getOrder(@PathVariable(value = "id") String id) throws ResourceNotFoundException, GlobalException {
        return ResponseEntity.ok().body(getOrderUseCase.getOrder(id));
    }
}


================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/request/README.md
================================================
*In this directory you can add specialized requests, to only request minimum data, for example CreateOrderRequest.*


================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/response/CreateOrderResponse.java
================================================
package com.jmendoza.swa.hexagonal.application.rest.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateOrderResponse {
    private String orderId;
}


================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/soap/README.md
================================================
*In this directory you can add another type of adapter to access the domain, for example a OrderController class to expose SOAP.*


================================================
FILE: Order/common/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Order/common/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.jmendoza.swa.hexagonal</groupId>
        <artifactId>order</artifactId>
        <version>1.0</version>
    </parent>

    <artifactId>common</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>hexagonal-architecture-common</name>
    <description>Example of Hexagonal Architecture - Common</description>

</project>


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/constants/OrderConstanst.java
================================================
package com.jmendoza.swa.hexagonal.common.constants;

public class OrderConstanst {
    public static final String ORDER_NOT_FOUND = "Order not found :: ";
    public static final String REQUIRED_PARAMETER = "Required parameter ";
    public static final String IS_NOT_PRESENT = " is not present";
    public static final String ORDERS_NOT_FOUND = "Orders not found";

    private OrderConstanst() {
    }
}


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/customannotations/UseCase.java
================================================
package com.jmendoza.swa.hexagonal.common.customannotations;

import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface UseCase {

    @AliasFor(annotation = Component.class)
    String value() default "";
}


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/CustomExceptionHandler.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;

import java.util.Date;

@ControllerAdvice
public class CustomExceptionHandler {

    private static final Logger loggerException = LogManager.getLogger(CustomExceptionHandler.class);

    @ExceptionHandler(ResourceNotFoundException.class)
    public ResponseEntity resourceNotFoundException(ResourceNotFoundException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
    }

    @ExceptionHandler({GlobalException.class})
    public ResponseEntity globalExceptionHandler(GlobalException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
    }

    @ExceptionHandler({ParameterNotFoundException.class})
    public ResponseEntity parameterNotFoundExceptionHandler(ParameterNotFoundException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
    }
}


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ErrorDetails.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Date;

@Getter
@AllArgsConstructor
public class ErrorDetails {
    private Date timestamp;
    private String message;
    private String details;
}


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/GlobalException.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class GlobalException extends Exception {
    private static final long serialVersionUID = 1L;

    public GlobalException(String message) {
        super(message);
    }

    public GlobalException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ParameterNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class ParameterNotFoundException extends Exception {

    private static final long serialVersionUID = 1L;

    public ParameterNotFoundException(String message) {
        super(message);
    }

    public ParameterNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ResourceNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {

    private static final long serialVersionUID = 1L;

    public ResourceNotFoundException(String message) {
        super(message);
    }

    public ResourceNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Order/configuration/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Order/configuration/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.jmendoza.swa.hexagonal</groupId>
        <artifactId>order</artifactId>
        <version>1.0</version>
    </parent>

    <artifactId>configuration</artifactId>
    <version>1.0</version>
    <name>hexagonal-architecture-configuration</name>
    <description>Example of Hexagonal Architecture - Configuration</description>

    <dependencies>
        <dependency>
            <groupId>com.jmendoza.swa.hexagonal</groupId>
            <artifactId>application</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.jmendoza.swa.hexagonal</groupId>
            <artifactId>infrastructure</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.zalando</groupId>
            <artifactId>logbook-spring-boot-starter</artifactId>
            <version>2.1.0</version>
        </dependency>
    </dependencies>

</project>


================================================
FILE: Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/HexagonalArchitectureConfigurationApplication.java
================================================
package com.jmendoza.swa.hexagonal.configuration;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages = {"com.jmendoza.swa.hexagonal.*"})
public class HexagonalArchitectureConfigurationApplication {

    public static void main(String[] args) {
        SpringApplication.run(HexagonalArchitectureConfigurationApplication.class, args);
    }

}


================================================
FILE: Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/db/DataSourceConfig.java
================================================
package com.jmendoza.swa.hexagonal.configuration.db;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

import javax.sql.DataSource;
import java.util.Properties;

@Configuration
public class DataSourceConfig {

    @Bean
    @Primary
    @ConfigurationProperties("spring.datasource.tomcat")
    public DataSource getDataSource(Environment env) {
        final DriverManagerDataSource dataSource = new DriverManagerDataSource();
        final Properties properties = new Properties();

        dataSource.setDriverClassName(env.getProperty("spring.datasource.driverClassName"));
        dataSource.setUrl(env.getProperty("spring.datasource.url"));
        dataSource.setUsername(env.getProperty("spring.datasource.username"));
        dataSource.setPassword(env.getProperty("spring.datasource.password"));

        properties.setProperty("initialSize", env.getProperty("spring.datasource.tomcat.initial-size"));
        properties.setProperty("minIdle", env.getProperty("spring.datasource.tomcat.min-idle"));
        properties.setProperty("maxActive", env.getProperty("spring.datasource.tomcat.max-active"));
        properties.setProperty("maxIdle", env.getProperty("spring.datasource.tomcat.max-idle"));
        properties.setProperty("minEvictableIdleTimeMillis", env.getProperty("spring.datasource.tomcat.min-evictable-idle-time-millis"));
        properties.setProperty("maxWait", env.getProperty("spring.datasource.tomcat.max-idle"));

        dataSource.setConnectionProperties(properties);

        return dataSource;
    }
}




================================================
FILE: Order/configuration/src/main/resources/application.properties
================================================
## Server
server.port=3002

## Spring DATASOURCE
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://172.17.0.2:5432/customers
spring.datasource.username=postgres
spring.datasource.password=root.jmtizure.k201

spring.datasource.tomcat.initial-size=15
spring.datasource.tomcat.min-idle=15
spring.datasource.tomcat.max-active=50
spring.datasource.tomcat.max-idle=50
spring.datasource.tomcat.min-evictable-idle-time-millis=60000
spring.datasource.tomcat.max-wait=20000

# Logbook: HTTP request and response logging
logging.level.org.zalando.logbook = TRACE


================================================
FILE: Order/configuration/src/main/resources/log4j2.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Don't forget to set system property -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
     to make all loggers asynchronous. -->

<!-- No need to set system property "log4j2.contextSelector" to any value
     when using <asyncLogger> or <asyncRoot>. -->

<Configuration status="WARN" monitorInterval="30">
    <Properties>
        <Property name="LOG_PATTERN">
            [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%p] [${hostName}] [%t] [%c{3}] ===> %m%n
        </Property>
    </Properties>
    <Appenders>
        <Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true">
            <PatternLayout pattern="${LOG_PATTERN}"/>
        </Console>
        <!-- Rolling File Appender -->
        <RollingFile name="FileAppender" fileName="logs/Order.log"
                     filePattern="logs/Order-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout>
                <Pattern>${LOG_PATTERN}</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1"/>
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <AsyncLogger name="com.jmendoza.swa.hexagonal.order" level="debug" additivity="false">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </AsyncLogger>
        <AsyncLogger name="org.hibernate" level="info" additivity="false">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </AsyncLogger>

        <Root level="info">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </Root>
    </Loggers>
</Configuration>


================================================
FILE: Order/domain/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Order/domain/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.jmendoza.swa.hexagonal</groupId>
        <artifactId>order</artifactId>
        <version>1.0</version>
    </parent>

    <artifactId>domain</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>hexagonal-architecture-domain</name>
    <description>Example of Hexagonal Architecture - Domain</description>

    <!--The Domain can't have dependencies on any layer.-->
    <dependencies>
        <dependency>
            <groupId>com.jmendoza.swa.hexagonal</groupId>
            <artifactId>common</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

</project>


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/Order.java
================================================
package com.jmendoza.swa.hexagonal.domain.model;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.List;

@Getter
@Setter
@ToString
public class Order {
    private String orderId;
    private String customerId;
    private Date createdAt;
    private List<OrderProduct> orderProductList;
    private Double amountOrder;

    public Double getAmountOrder() {
        return orderProductList.stream().mapToDouble(OrderProduct::getAmount).sum();
    }
}


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/OrderProduct.java
================================================
package com.jmendoza.swa.hexagonal.domain.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

@Getter
@Setter
@ToString
@AllArgsConstructor
public class OrderProduct implements Serializable {

    private static final long serialVersionUID = 1L;

    private int orderProductId;
    private int quantity;
    private String productId;
    private Double productPrice;

    Double getAmount() {
        return productPrice.doubleValue() * this.getQuantity();
    }
}


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/CreateOrderUseCase.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;

public interface CreateOrderUseCase {
    void createOrder(Order order) throws ParameterNotFoundException, GlobalException;
}

================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/GetOrderUseCase.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;

public interface GetOrderUseCase {
    Order getOrder(String orderId) throws ResourceNotFoundException, GlobalException;
}


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/CreateOrderPort.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;

public interface CreateOrderPort {
    void createOrder(Order order) throws GlobalException;
}


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/GetOrderPort.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;

public interface GetOrderPort {
    Order getOrder(String orderId) throws GlobalException;
}


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/CreateOrderService.java
================================================
package com.jmendoza.swa.hexagonal.domain.services;

import com.jmendoza.swa.hexagonal.common.constants.OrderConstanst;
import com.jmendoza.swa.hexagonal.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.CreateOrderUseCase;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@AllArgsConstructor
@UseCase
public class CreateOrderService implements CreateOrderUseCase {

    private CreateOrderPort createOrderPort;

    @Override
    public void createOrder(Order order) throws ParameterNotFoundException, GlobalException {
        try {
            if (StringUtils.isBlank(order.getCustomerId()))
                getMessageParameterNotFoundException("customerId");
            if (order.getCreatedAt() == null)
                getMessageParameterNotFoundException("createdAt");
            if (order.getOrderProductList() == null || order.getOrderProductList().isEmpty())
                getMessageParameterNotFoundException("orderProductList");

            //TODO: pending validate orderProductList

            createOrderPort.createOrder(order);
        } catch (Exception e) {
            throw new GlobalException("createOrder: " + e.getMessage());
        }
    }

    private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
        throw new ParameterNotFoundException(OrderConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + OrderConstanst.IS_NOT_PRESENT);
    }
}


================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/GetOrderService.java
================================================
package com.jmendoza.swa.hexagonal.domain.services;

import com.jmendoza.swa.hexagonal.common.constants.OrderConstanst;
import com.jmendoza.swa.hexagonal.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.GetOrderUseCase;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.GetOrderPort;
import lombok.AllArgsConstructor;

@AllArgsConstructor
@UseCase
public class GetOrderService implements GetOrderUseCase {

    private GetOrderPort getOrderPort;

    @Override
    public Order getOrder(String orderId) throws ResourceNotFoundException, GlobalException {
        try {
            final Order order = getOrderPort.getOrder(orderId);
            if (order == null)
                throw new ResourceNotFoundException(OrderConstanst.ORDER_NOT_FOUND + orderId);

            return order;
        } catch (Exception e) {
            throw new GlobalException("getOrder: " + e.getMessage());
        }

    }
}


================================================
FILE: Order/infrastructure/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Order/infrastructure/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.jmendoza.swa.hexagonal</groupId>
        <artifactId>order</artifactId>
        <version>1.0</version>
    </parent>

    <artifactId>infrastructure</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>hexagonal-architecture-infrastructure</name>
    <description>Example of Hexagonal Architecture - Infrastructure</description>

    <dependencies>
        <dependency>
            <groupId>com.jmendoza.swa.hexagonal</groupId>
            <artifactId>domain</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.zaxxer</groupId>
                    <artifactId>HikariCP</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
    </dependencies>

</project>


================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/mongo/README.md
================================================
*In this directory you can add another type of DB adapter for example Mongo.*


================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/CreateOrderAdapter.java
================================================
package com.jmendoza.swa.hexagonal.infrastracture.databases.postgresql;

import com.google.gson.Gson;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;

@Component
public class CreateOrderAdapter implements CreateOrderPort {

    private JdbcTemplate jdbcTemplate;

    @Autowired
    public CreateOrderAdapter(final DataSource dataSource) {
        jdbcTemplate = new JdbcTemplate(dataSource);
    }

    @Override
    public void createOrder(Order order) throws GlobalException {

        final String procedureCall = "{ ? = call create_order(?, ?, ?, ?)}";

        try (Connection connection = jdbcTemplate.getDataSource().getConnection();
             CallableStatement callableStatement = connection.prepareCall(procedureCall)
        ) {
            Gson gson = new Gson();
            String json = gson.toJson(order.getOrderProductList());

            callableStatement.registerOutParameter(1, Types.BIGINT);
            callableStatement.setString(2, order.getCustomerId());
            callableStatement.setTimestamp(3, new java.sql.Timestamp(order.getCreatedAt().getTime()));
            callableStatement.setDouble(4, order.getAmountOrder());
            callableStatement.setString(5, json);

            callableStatement.execute();

            order.setOrderId(Long.toString(callableStatement.getLong(1)));
        } catch (Exception e) {
            throw new GlobalException("Exception createOrder: " + e.getMessage());
        }
    }
}


================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/GetOrderAdapter.java
================================================
package com.jmendoza.swa.hexagonal.infrastracture.databases.postgresql;

import com.google.gson.Gson;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.GetOrderPort;
import org.postgresql.util.PGobject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;

@Component
public class GetOrderAdapter implements GetOrderPort {

    private JdbcTemplate jdbcTemplate;

    @Autowired
    public GetOrderAdapter(final DataSource dataSource) {
        jdbcTemplate = new JdbcTemplate(dataSource);
    }

    @Override
    public Order getOrder(String orderId) throws GlobalException {

        final String procedureCall = "{ ? = call get_order(?)}";
        Order order = null;

        try (Connection connection = jdbcTemplate.getDataSource().getConnection();
             CallableStatement callableStatement = connection.prepareCall(procedureCall)
        ) {
            PGobject pGobject;

            callableStatement.registerOutParameter(1, Types.OTHER);
            callableStatement.setLong(2, Long.parseLong(orderId));
            callableStatement.execute();

            pGobject = (PGobject) callableStatement.getObject(1);
            if (pGobject != null) {
                Gson gson = new Gson();
                order = gson.fromJson(pGobject.toString(), Order.class);
            }

        } catch (Exception e) {
            throw new GlobalException("Exception getOrder: " + e.getMessage());
        }
        return order;
    }
}


================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/messagebroker/README.md
================================================
*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ.*


================================================
FILE: Order/logs/Order-2020-06-05-1.log
================================================
[2020-06-05 23:59:49.755] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 12245 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-06-05 23:59:49.773] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | No active profile set, falling back to default profiles: default
[2020-06-05 23:59:50.885] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-05 23:59:50.905] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 16ms. Found 0 JDBC repository interfaces.
[2020-06-05 23:59:51.469] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-05 23:59:51.479] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-05 23:59:51.480] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-05 23:59:51.481] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-05 23:59:51.592] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-05 23:59:51.593] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1550 ms
[2020-06-05 23:59:51.938] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-05 23:59:52.237] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-05 23:59:52.439] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-05 23:59:52.615] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-05 23:59:52.692] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-05 23:59:52.712] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Started HexagonalArchitectureConfigurationApplication in 3.799 seconds (JVM running for 5.472)


================================================
FILE: Order/logs/Order.log
================================================
[2020-09-18 18:46:56.843] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 31880 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 18:46:57.023] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | No active profile set, falling back to default profiles: default
[2020-09-18 18:46:58.392] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 18:46:58.425] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 26ms. Found 0 JDBC repository interfaces.
[2020-09-18 18:46:59.341] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-09-18 18:46:59.366] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:46:59.367] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-09-18 18:46:59.368] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 18:46:59.564] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-09-18 18:46:59.565] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2475 ms
[2020-09-18 18:46:59.889] [WARN] [jmendoza-ThinkPad-T420] [main] [servlet.context.AnnotationConfigServletWebServerApplicationContext] | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderController' defined in file [/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/application/target/classes/com/jmendoza/swa/hexagonal/application/rest/controller/OrderController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'createOrderService' defined in file [/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/domain/target/classes/com/jmendoza/swa/hexagonal/domain/services/CreateOrderService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[2020-09-18 18:46:59.895] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Stopping service [Tomcat]
[2020-09-18 18:46:59.929] [INFO] [jmendoza-ThinkPad-T420] [main] [autoconfigure.logging.ConditionEvaluationReportLoggingListener] | 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2020-09-18 18:47:00.165] [ERROR] [jmendoza-ThinkPad-T420] [main] [boot.diagnostics.LoggingFailureAnalysisReporter] | 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.jmendoza.swa.hexagonal.domain.services.CreateOrderService required a bean of type 'com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort' that could not be found.


Action:

Consider defining a bean of type 'com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort' in your configuration.

[2020-09-18 18:47:00.168] [WARN] [jmendoza-ThinkPad-T420] [main] [springframework.boot.SpringApplication] | Unable to close ApplicationContext
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at com.jmendoza.swa.hexagonal.configuration.HexagonalArchitectureConfigurationApplication.main(HexagonalArchitectureConfigurationApplication.java:10) [classes/:?]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:94) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	... 28 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:814) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor.postProcessBeforeInitialization(ConfigurationClassPostProcessor.java:456) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:94) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
	... 28 more
[2020-09-18 18:48:24.419] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 32302 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 18:48:24.437] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | No active profile set, falling back to default profiles: default
[2020-09-18 18:48:25.832] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 18:48:25.859] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 21ms. Found 0 JDBC repository interfaces.
[2020-09-18 18:48:26.638] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-09-18 18:48:26.652] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:48:26.653] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-09-18 18:48:26.669] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 18:48:26.773] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-09-18 18:48:26.774] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2003 ms
[2020-09-18 18:48:27.296] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:48:27.655] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-09-18 18:48:27.963] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-09-18 18:48:28.195] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:48:28.279] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-09-18 18:48:28.293] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Started HexagonalArchitectureConfigurationApplication in 4.93 seconds (JVM running for 6.902)
[2020-09-18 18:53:33.328] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:53:33.330] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-09-18 18:53:33.343] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-09-18 18:53:59.925] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 32731 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 18:53:59.973] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> No active profile set, falling back to default profiles: default
[2020-09-18 18:54:01.235] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 18:54:01.262] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Finished Spring Data repository scanning in 22ms. Found 0 JDBC repository interfaces.
[2020-09-18 18:54:02.009] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat initialized with port(s): 3002 (http)
[2020-09-18 18:54:02.022] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:54:02.023] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] ===> Starting service [Tomcat]
[2020-09-18 18:54:02.023] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] ===> Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 18:54:02.115] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] ===> Initializing Spring embedded WebApplicationContext
[2020-09-18 18:54:02.115] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] ===> Root WebApplicationContext: initialization completed in 1863 ms
[2020-09-18 18:54:02.541] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Initializing ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:54:02.780] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Starting...
[2020-09-18 18:54:02.994] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Start completed.
[2020-09-18 18:54:03.139] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Starting ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:54:03.174] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat started on port(s): 3002 (http) with context path ''
[2020-09-18 18:54:03.189] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Started HexagonalArchitectureConfigurationApplication in 3.973 seconds (JVM running for 5.737)
[2020-09-18 18:55:19.058] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] ===> Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-09-18 18:55:19.059] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Initializing Servlet 'dispatcherServlet'
[2020-09-18 18:55:19.109] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Completed initialization in 49 ms
[2020-09-18 18:55:19.415] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"e7f998e53c885f2d","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["ac8ea573-8463-712c-1cd5-8c575789dbc3"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-09-18 18:55:19.876] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"e7f998e53c885f2d","duration":682,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:19 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36"}}
[2020-09-18 18:55:43.478] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"90a2cd79829db3ea","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/36","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["31da7306-62b6-22f8-37e0-2a251f892506"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 18:55:43.526] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"90a2cd79829db3ea","duration":48,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:43 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12.000+00:00","orderProductList":[{"orderProductId":19,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":20,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 18:55:49.901] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"9e2e64d736239f87","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/37","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["f9b7108d-6dd7-a3a8-acf5-57fed7be75f8"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 18:55:49.924] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [common.exception.CustomExceptionHandler] ===> com.jmendoza.swa.hexagonal.common.exception.GlobalException: getOrder: Order not found :: 37
[2020-09-18 18:55:49.930] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"9e2e64d736239f87","duration":30,"protocol":"HTTP/1.1","status":500,"headers":{"Connection":["close"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:49 GMT"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-09-18T22:55:49.924+00:00","message":"getOrder: Order not found :: 37","details":"uri=/v1/orders/37"}}
[2020-09-18 18:55:57.137] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"8646799f85278cc7","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/36","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["676e731d-bfde-122b-485a-c0d11ebfca11"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 18:55:57.145] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"8646799f85278cc7","duration":9,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:57 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12.000+00:00","orderProductList":[{"orderProductId":19,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":20,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 18:57:04.151] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Shutting down ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:57:04.153] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Shutdown initiated...
[2020-09-18 18:57:04.179] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Shutdown completed.
[2020-09-18 19:12:00.790] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 1942 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 19:12:00.804] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> No active profile set, falling back to default profiles: default
[2020-09-18 19:12:01.880] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 19:12:01.899] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Finished Spring Data repository scanning in 14ms. Found 0 JDBC repository interfaces.
[2020-09-18 19:12:02.490] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat initialized with port(s): 3002 (http)
[2020-09-18 19:12:02.501] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 19:12:02.502] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] ===> Starting service [Tomcat]
[2020-09-18 19:12:02.502] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] ===> Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 19:12:02.601] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] ===> Initializing Spring embedded WebApplicationContext
[2020-09-18 19:12:02.601] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] ===> Root WebApplicationContext: initialization completed in 1564 ms
[2020-09-18 19:12:02.948] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Initializing ExecutorService 'applicationTaskExecutor'
[2020-09-18 19:12:03.469] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Starting ProtocolHandler ["http-nio-3002"]
[2020-09-18 19:12:03.488] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat started on port(s): 3002 (http) with context path ''
[2020-09-18 19:12:03.500] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Started HexagonalArchitectureConfigurationApplication in 3.643 seconds (JVM running for 5.417)
[2020-09-18 19:12:41.175] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] ===> Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-09-18 19:12:41.176] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Initializing Servlet 'dispatcherServlet'
[2020-09-18 19:12:41.192] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Completed initialization in 16 ms
[2020-09-18 19:12:41.344] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"808a493284b4f071","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/36","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["169d375b-96ac-4c72-0fc0-6b9afe8dfc58"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 19:12:41.495] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"808a493284b4f071","duration":259,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:12:41 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12.000+00:00","orderProductList":[{"orderProductId":19,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":20,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 19:12:56.461] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"b611a2d00884de84","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["d55bc226-c078-a37b-cad2-19222f8bc47b"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:30:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-09-18 19:12:56.552] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"b611a2d00884de84","duration":93,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:12:56 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"37"}}
[2020-09-18 19:13:03.370] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"88a9e0808f9cc457","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/37","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["cefcfe7f-4d3a-b730-02c7-851e5b2ba822"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 19:13:03.388] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"88a9e0808f9cc457","duration":18,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:13:03 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"37","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:30:12.000+00:00","orderProductList":[{"orderProductId":21,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":22,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 19:13:06.905] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"820cbaa656edc6c7","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/37","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["ab49a767-8eba-61f4-557a-e999b2b4c07d"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 19:13:06.923] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"820cbaa656edc6c7","duration":19,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:13:06 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"37","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:30:12.000+00:00","orderProductList":[{"orderProductId":21,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":22,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 19:13:11.071] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Shutting down ExecutorService 'applicationTaskExecutor'


================================================
FILE: Order/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.jmendoza.swa.hexagonal</groupId>
    <artifactId>order</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>
    <name>hexagonal-architecture-order</name>
    <description>Example of Hexagonal Architecture - Orders</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <modules>
        <module>application</module>
        <module>common</module>
        <module>configuration</module>
        <module>domain</module>
        <module>infrastructure</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>2.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
            <version>3.3.6</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.12</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.10</version>
        </dependency>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>2.3.5</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.9</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

</project>


================================================
FILE: Order/postgresql/1-create_table_orders.sql
================================================
-- Table: public.ORDERS

-- DROP TABLE public."ORDERS";

CREATE TABLE public."ORDERS"
(
    order_id bigint NOT NULL,
    customer_id character varying COLLATE pg_catalog."default" NOT NULL,
    created_at timestamp with time zone NOT NULL,
    amount_order double precision NOT NULL,
    CONSTRAINT "ORDERS_pkey" PRIMARY KEY (order_id)
)

    TABLESPACE pg_default;

ALTER TABLE public."ORDERS"
    OWNER to postgres;

GRANT ALL ON TABLE public."ORDERS" TO postgres;

================================================
FILE: Order/postgresql/2-create_sequence_order_id.sql
================================================
-- SEQUENCE: public.order_id_seq

-- DROP SEQUENCE public.order_id_seq;

CREATE SEQUENCE public.order_id_seq
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 9223372036854775807
    CACHE 1;

ALTER SEQUENCE public.order_id_seq
    OWNER TO postgres;

GRANT ALL ON SEQUENCE public.order_id_seq TO postgres;

================================================
FILE: Order/postgresql/3-create_function_create_order.sql
================================================
-- FUNCTION: public.create_order(character varying, timestamp with time zone, double precision, text)

-- DROP FUNCTION public.create_order(character varying, timestamp with time zone, double precision, text);

CREATE OR REPLACE FUNCTION public.create_order(
	p_customer_id character varying,
	p_created_at timestamp with time zone,
	p_amount_order double precision,
	p_order_product text)
    RETURNS bigint
    LANGUAGE 'plpgsql'

    COST 100
    VOLATILE

AS $BODY$
DECLARE
    p_order_id bigint;
    p_order_product_id bigint;
	p_json json;
BEGIN
    p_order_id := nextval('order_id_seq');
    INSERT INTO public."ORDERS"(
        order_id, customer_id, created_at, amount_order)
    VALUES (p_order_id, p_customer_id, p_created_at, p_amount_order);

	FOR p_json IN SELECT * FROM json_array_elements(p_order_product::json)
  	LOOP
	    p_order_product_id := nextval('order_product_id_seq');
            INSERT INTO public."ORDERS_PRODUCTS"(
                order_product_id, quantity, product_id, product_price, order_id)
            VALUES (p_order_product_id, CAST (p_json->>'quantity' AS bigint) , p_json->>'productId', CAST(p_json->>'productPrice' AS double precision), p_order_id);
  	END LOOP;

    RETURN p_order_id;

END;
$BODY$;

ALTER FUNCTION public.create_order(character varying, timestamp with time zone, double precision, text)
    OWNER TO postgres;


================================================
FILE: Order/postgresql/4-create_table_order_product.sql
================================================
-- Table: public.ORDERS_PRODUCTS

-- DROP TABLE public."ORDERS_PRODUCTS";

CREATE TABLE public."ORDERS_PRODUCTS"
(
    order_product_id bigint NOT NULL,
    quantity bigint NOT NULL,
    product_id character varying COLLATE pg_catalog."default" NOT NULL,
    product_price double precision NOT NULL,
    order_id bigint NOT NULL,
    CONSTRAINT "ORDERS_PRODUCTS_pkey" PRIMARY KEY (order_product_id),
    CONSTRAINT order_id_fk FOREIGN KEY (order_id)
        REFERENCES public."ORDERS" (order_id) MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
        NOT VALID
)

    TABLESPACE pg_default;

ALTER TABLE public."ORDERS_PRODUCTS"
    OWNER to postgres;

GRANT ALL ON TABLE public."ORDERS_PRODUCTS" TO postgres;

================================================
FILE: Order/postgresql/5-create_order_product_id_seq.sql
================================================
-- SEQUENCE: public.order_product_id_seq

-- DROP SEQUENCE public.order_product_id_seq;

CREATE SEQUENCE public.order_product_id_seq
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 9223372036854775807
    CACHE 1;

ALTER SEQUENCE public.order_product_id_seq
    OWNER TO postgres;

GRANT ALL ON SEQUENCE public.order_product_id_seq TO postgres;

================================================
FILE: Order/postgresql/6-create_function_get_order.sql
================================================
-- FUNCTION: public.get_order(bigint)

-- DROP FUNCTION public.get_order(bigint);

CREATE OR REPLACE FUNCTION public.get_order(
    p_order_id bigint)
    RETURNS json
    LANGUAGE 'plpgsql'

    COST 100
    VOLATILE

AS $BODY$
DECLARE
    json_op json;
    json_result json;
BEGIN

    json_op:= (SELECT
                   json_agg(
                           json_build_object(
                                   'orderProductId',OP.order_product_id,
                                   'quantity', OP.quantity,
                                   'productId',OP.product_id,
                                   'productPrice',OP.product_price))
               FROM public."ORDERS_PRODUCTS" AS OP
               WHERE OP.order_id = p_order_id);

    json_result:= (SELECT
                       json_build_object(
                               'orderId', O.order_id,
                               'customerId', O.customer_id,
                               'createdAt', O.created_at,
                               'orderProductList',json_op,
                               'amountOrder', O.amount_order)
                   FROM public."ORDERS" AS O
                   WHERE O.order_id = p_order_id);

    RETURN json_result;

END;
$BODY$;

ALTER FUNCTION public.get_order(bigint)
    OWNER TO postgres;

GRANT EXECUTE ON FUNCTION public.get_order(bigint) TO postgres;

GRANT EXECUTE ON FUNCTION public.get_order(bigint) TO PUBLIC;



================================================
FILE: Product/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/


================================================
FILE: Product/README.md
================================================
# Products Microservice

Example of Products Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD) and SOLID principles.

This example was implemented with Spring Boot, MongoDB Atlas. The microservices are deployed locally and the DB in the cloud.

## MongoDB Atlas
- Signup free at https://www.mongodb.com/cloud/atlas/signup 
- Create DATABASE and COLLECTION (Optional)
- Create Database User
- Add your IP Address (public) in IP Whitelist, Network Access

![Screenshot](prtsc/Product-1.png)

## Configure your application.properties

![Screenshot](prtsc/Product-2.png)

## Create Products

**Postman**

![Screenshot](prtsc/Product-3.png)

![Screenshot](prtsc/Product-3.1.png)


**MongoDB Atlas**

![Screenshot](prtsc/Product-3.2.png)

## Get Products

**Postman**

![Screenshot](prtsc/Product-4.png)



================================================
FILE: Product/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.jmendoza.swa.hexagonal</groupId>
    <artifactId>product</artifactId>
    <version>1.0</version>
    <name>product</name>
    <description>Example of Hexagonal Architecture - Products</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>2.3.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>2.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
            <version>3.3.6</version>
        </dependency>
        <dependency>
            <groupId>org.zalando</groupId>
            <artifactId>logbook-spring-boot-starter</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/ProductApplication.java
================================================
package com.jmendoza.swa.hexagonal.product;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ProductApplication {

    public static void main(String[] args) {
        SpringApplication.run(ProductApplication.class, args);
    }

}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/controller/ProductController.java
================================================
package com.jmendoza.swa.hexagonal.product.application.rest.controller;

import com.jmendoza.swa.hexagonal.product.application.rest.response.CreateProductResponse;
import com.jmendoza.swa.hexagonal.product.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.product.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.CreateProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.DeleteProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductsUseCase;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/v1/products")
@AllArgsConstructor
public class ProductController {

    private final CreateProductUseCase createProductUseCase;
    private final DeleteProductUseCase deleteProductUseCase;
    private final GetProductsUseCase getProductsUseCase;
    private final GetProductUseCase getProductUseCase;

    @PostMapping
    public ResponseEntity<CreateProductResponse> createProduct(@Valid @RequestBody Product product) throws GlobalException, ParameterNotFoundException {
        createProductUseCase.createProduct(product);
        return ResponseEntity.ok().body(CreateProductResponse.builder().id(product.getId()).build());
    }

    @DeleteMapping("/{id}")
    public ResponseEntity deleteCustomer(@PathVariable(value = "id") String id) throws ResourceNotFoundException {
        deleteProductUseCase.deleteProduct(id);
        return ResponseEntity.noContent().build();
    }

    @GetMapping
    public ResponseEntity<List<Product>> getProducts() throws ResourceNotFoundException {
        List<Product> productList = getProductsUseCase.getProducts();
        return ResponseEntity.ok().body(productList);
    }

    @GetMapping("/{id}")
    public ResponseEntity<Product> getProduct(@PathVariable(value = "id") String id) throws ResourceNotFoundException {
        Product product = getProductUseCase.getProduct(id);
        return ResponseEntity.ok().body(product);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/request/README.md
================================================
*In this directory you can add specialized requests, to only request minimum data, for example CreateProductRequest.*


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/response/CreateProductResponse.java
================================================
package com.jmendoza.swa.hexagonal.product.application.rest.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateProductResponse {
    private String id;
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/soap/README.md
================================================
*In this directory you can add another type of adapter to access the domain, for example a ProductController class to expose SOAP.*


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/config/README.md
================================================
*In this directory you can add settings for the infrastructure layer or the application layer.*


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/constants/ProductConstanst.java
================================================
package com.jmendoza.swa.hexagonal.product.common.constants;

public class ProductConstanst {
    public static final String PRODUCT_NOT_FOUND = "Product not found :: ";
    public static final String REQUIRED_PARAMETER = "Required parameter ";
    public static final String IS_NOT_PRESENT = " is not present";
    public static final double D_2 = 0.0;
    public static final int INT = 0;
    public static final String THIS_PRODUCT_IS_ALREADY_REGISTERED = "This Product is already registered ";
    public static final String PRODUCTS_NOT_FOUND = "Products not found";

    private ProductConstanst() {
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/customannotations/UseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.common.customannotations;

import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface UseCase {

    @AliasFor(annotation = Component.class)
    String value() default "";
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/CustomExceptionHandler.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;

import java.util.Date;

@ControllerAdvice
public class CustomExceptionHandler {

    private static final Logger loggerException = LogManager.getLogger(CustomExceptionHandler.class);

    @ExceptionHandler(ResourceNotFoundException.class)
    public ResponseEntity resourceNotFoundException(ResourceNotFoundException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
    }

    @ExceptionHandler({GlobalException.class})
    public ResponseEntity globalExceptionHandler(GlobalException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
    }

    @ExceptionHandler({ParameterNotFoundException.class})
    public ResponseEntity parameterNotFoundExceptionHandler(ParameterNotFoundException ex, WebRequest request) {
        ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
        loggerException.error(ex);
        return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ErrorDetails.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Date;

@Getter
@AllArgsConstructor
public class ErrorDetails {
    private Date timestamp;
    private String message;
    private String details;
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/GlobalException.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class GlobalException extends Exception {
    private static final long serialVersionUID = 1L;

    public GlobalException(String message) {
        super(message);
    }

    public GlobalException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ParameterNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class ParameterNotFoundException extends Exception {

    private static final long serialVersionUID = 1L;

    public ParameterNotFoundException(String message) {
        super(message);
    }

    public ParameterNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ResourceNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {

    private static final long serialVersionUID = 1L;

    public ResourceNotFoundException(String message) {
        super(message);
    }

    public ResourceNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/model/Product.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.model;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class Product {
    private String id;
    private String productName;
    private String productDescription;
    private Double price;
    private String createdAt;
    private String serialNumber;
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/CreateProductUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.product.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.product.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;

public interface CreateProductUseCase {
    void createProduct(Product product) throws ParameterNotFoundException, GlobalException;
}

================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/DeleteProductUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;

public interface DeleteProductUseCase {
    void deleteProduct(String id) throws ResourceNotFoundException;
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;

public interface GetProductUseCase {

    Product getProduct(String id) throws ResourceNotFoundException;
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductsUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;

import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;

import java.util.List;

public interface GetProductsUseCase {
    List<Product> getProducts() throws ResourceNotFoundException;
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/CreateProductPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;

public interface CreateProductPort {
    void createProduct(Product product);
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/DeleteProductPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;

public interface DeleteProductPort {
    void deleteProduct(Product product);
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/ExistsProductPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;

public interface ExistsProductPort {
    boolean existsBySerialNumber(String serialNumber);
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductIdPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;

import java.util.Optional;

public interface GetProductIdPort {
    Optional<Product> getProductById(String id);
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductsPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;

import java.util.List;

public interface GetProductsPort {
    List<Product> getProducts();
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/CreateProductService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;

import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.product.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.CreateProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.CreateProductPort;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.ExistsProductPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@AllArgsConstructor
@UseCase
public class CreateProductService implements CreateProductUseCase {

    private CreateProductPort createProductPort;
    private ExistsProductPort existsProductPort;

    @Override
    public void createProduct(Product product) throws ParameterNotFoundException, GlobalException {

        if (StringUtils.isBlank(product.getProductName()))
            getMessageParameterNotFoundException("productName");
        if (StringUtils.isBlank(product.getProductDescription()))
            getMessageParameterNotFoundException("productDescription");
        if (product.getPrice() == null || Double.compare(product.getPrice(), ProductConstanst.D_2) <= ProductConstanst.INT)
            getMessageParameterNotFoundException("price");
        if (StringUtils.isBlank(product.getCreatedAt()))
            getMessageParameterNotFoundException("createdAt");
        if (StringUtils.isBlank(product.getSerialNumber()))
            getMessageParameterNotFoundException("serialNumber");

        if (existsProductPort.existsBySerialNumber(product.getSerialNumber()))
            throw new GlobalException(ProductConstanst.THIS_PRODUCT_IS_ALREADY_REGISTERED);

        createProductPort.createProduct(product);
    }

    private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
        throw new ParameterNotFoundException(ProductConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + ProductConstanst.IS_NOT_PRESENT);
    }
}

================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/DeleteProductService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;

import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.DeleteProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.DeleteProductPort;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductIdPort;
import lombok.AllArgsConstructor;

@AllArgsConstructor
@UseCase
public class DeleteProductService implements DeleteProductUseCase {

    private GetProductIdPort getProductIdPort;
    private DeleteProductPort deleteProductPort;

    @Override
    public void deleteProduct(String id) throws ResourceNotFoundException {
        Product product = getProductIdPort.getProductById(id)
                .orElseThrow(() -> new ResourceNotFoundException(ProductConstanst.PRODUCT_NOT_FOUND + id));
        deleteProductPort.deleteProduct(product);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;

import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductIdPort;
import lombok.AllArgsConstructor;

@AllArgsConstructor
@UseCase
public class GetProductService implements GetProductUseCase {

    private GetProductIdPort getProductIdPort;

    @Override
    public Product getProduct(String id) throws ResourceNotFoundException {
        return getProductIdPort.getProductById(id)
                .orElseThrow(() -> new ResourceNotFoundException(ProductConstanst.PRODUCT_NOT_FOUND + id));
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductsService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;

import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductsUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductsPort;
import lombok.AllArgsConstructor;

import java.util.List;

@AllArgsConstructor
@UseCase
public class GetProductsService implements GetProductsUseCase {

    private GetProductsPort getProductsPort;

    @Override
    public List<Product> getProducts() throws ResourceNotFoundException {

        List<Product> productList = getProductsPort.getProducts();
        if (productList.isEmpty())
            throw new ResourceNotFoundException(ProductConstanst.PRODUCTS_NOT_FOUND);

        return productList;
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/CreateProductAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.CreateProductPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CreateProductAdapter implements CreateProductPort {
    @Autowired
    private ProductRepository productRepository;

    @Override
    public void createProduct(Product product) {
        productRepository.save(product);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/DeleteProductAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.DeleteProductPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DeleteProductAdapter implements DeleteProductPort {
    @Autowired
    private ProductRepository productRepository;

    @Override
    public void deleteProduct(Product product) {
        productRepository.delete(product);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ExistsProductAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.ExistsProductPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ExistsProductAdapter implements ExistsProductPort {

    @Autowired
    private ProductRepository productRepository;

    @Override
    public boolean existsBySerialNumber(String serialNumber) {
        return productRepository.existsBySerialNumber(serialNumber);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductIdAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductIdPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Optional;

@Component
public class GetProductIdAdapter implements GetProductIdPort {

    @Autowired
    private ProductRepository productRepository;

    @Override
    public Optional<Product> getProductById(String id) {
        return productRepository.findById(id);
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductsAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductsPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class GetProductsAdapter implements GetProductsPort {

    @Autowired
    private ProductRepository productRepository;

    @Override
    public List<Product> getProducts() {
        return productRepository.findAll();
    }
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ProductRepository.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;

import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ProductRepository extends MongoRepository<Product, String> {
    boolean existsBySerialNumber(String serialNumber);
}


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/postgresql/README.md
================================================
*In this directory you can add another type of DB adapter for example PostgreSQL.*


================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/messagebroker/README.md
================================================
*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ.*


================================================
FILE: Product/src/main/resources/application.properties
================================================
# Application Server
server.port=3001

# MongoDB Atlas
spring.data.mongodb.uri=mongodb+srv://jmendoza:zuZYkSpMIpSGqgLD@cluster0-7rxkw.mongodb.net/product?retryWrites=true&w=majority&maxIdleTimeMS=600000&connectTimeoutMS=60000

# Logbook: HTTP request and response logging
logging.level.org.zalando.logbook = TRACE


================================================
FILE: Product/src/main/resources/log4j2.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Don't forget to set system property -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
     to make all loggers asynchronous. -->

<!-- No need to set system property "log4j2.contextSelector" to any value
     when using <asyncLogger> or <asyncRoot>. -->

<Configuration status="WARN" monitorInterval="30">
    <Properties>
        <Property name="LOG_PATTERN">
            [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%p] [${hostName}] [%t] [%c{3}] ==> %m%n
        </Property>
    </Properties>
    <Appenders>
        <Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true">
            <PatternLayout pattern="${LOG_PATTERN}"/>
        </Console>
        <!-- Rolling File Appender -->
        <RollingFile name="FileAppender" fileName="logs/Product.log"
                     filePattern="logs/Product-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout>
                <Pattern>${LOG_PATTERN}</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1"/>
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <AsyncLogger name="com.jmendoza.swa.hexagonal.product" level="debug" additivity="false">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </AsyncLogger>
        <AsyncLogger name="org.hibernate" level="info" additivity="false">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </AsyncLogger>

        <Root level="info">
            <AppenderRef ref="ConsoleAppender"/>
            <AppenderRef ref="FileAppender"/>
        </Root>
    </Loggers>
</Configuration>


================================================
FILE: Product/src/test/java/com/jmendoza/swa/hexagonal/product/ProductApplicationTests.java
================================================
package com.jmendoza.swa.hexagonal.product;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class ProductApplicationTests {

    @Test
    void contextLoads() {
    }

}


================================================
FILE: README.md
================================================
# Hexagonal-Architecture-DDD

Ports and Adapters or also known as Hexagonal Architecture, is a popular architecture invented by Alistair Cockburn in 2005.

Example of how to use Hexagonal Architecture and the basic of Domain Driven Design (DDD) 

This example is made with Spring Boot, MongoDB, PostgreSQL

## Domain Driven Design (DDD)

Domain-Driven Design is an approach to software development that centers the development on programming a domain model that has a rich understanding of the processes and rules of a domain.

Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships.

![Screenshot](prtsc/Hexa-Arch-DDD-1.png)

*Reference:*
- https://martinfowler.com/tags/domain%20driven%20design.html

## Hexagonal Architecture

The hexagonal architecture, or ports and adapters architecture, is an architectural pattern used in software design. It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters. This makes components exchangeable at any level and facilitates test automation.

The business logic interacts with other components through ports and adapters. This way, we can change the underlying technologies without having to modify the application core.

**The hexagonal architecture is based on three principles and techniques:**

1. Explicitly separate Application, Domain, and Infrastructure
2. Dependencies are going from Application and Infrastructure to the Domain
3. We isolate the boundaries by using Ports and Adapters

Note: The words Application, Domain and Infrastructure do not come from the original article but from the frequent use of hexagonal architecture by Domain-Driven Design practitioners. 

![Screenshot](prtsc/Hexa-Arch-DDD-2.png)

**Note: A port in Java is an interface. An adapter is one implementation of that interface.**

### Domain Layer, in the center

- The domain layer represents the inside of the application and provides ports to interact with application use cases (business logic).

- This is the part that we want to isolate from both left and right sides. It contains all the code that concerns and implements business logic (use cases).
 
- Because domain objects have no dependencies on other layers of the application, changes in other layers don’t affect them.

### Application Layer, on the left

- The application layer provides different adapters for outside entities to interact with the domain through the port.

- This is the side through which the user or external programs will interact with the application. It contains the code that allows these interactions. Typically, your user interface code, your HTTP routes for an API, your JSON serializations to programs that consume your application are here.

### Infrastructure Layer, on the right

- Provide adapters and server-side logic to interact with the application from the right side. Server-side entities, such as a database or other run-time devices, use these adapters to interact with the domain.

- It contains essential infrastructure details such as the code that interacts with your database, makes calls to the file system, or code that handles HTTP calls to other applications on which you depend for example.

*Reference:*
- https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)
- https://dzone.com/articles/hexagonal-architecture-in-java-2
- https://blog.octo.com/en/hexagonal-architecture-three-principles-and-an-implementation-example/#principles

## Microservices Architecture

![Screenshot](prtsc/Hexagonal-Architecture-Microservices.jpg)

In our example we will use the basic architecture above without API Gateway. Customer, Product, Order do not necessarily have to be in different databases, it depends on the bounded context. The main objective is to highlight the use of Hexagonal Architecture in the microservices code. 

All microservices are implemented with Spring Boot, however microservices can be implemented with different technologies.


================================================
FILE: logs/Customer.log
================================================
[2020-06-05 19:35:13.967] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Starting CustomerApplication on jmendoza-ThinkPad-T420 with PID 21851 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Customer/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-05 19:35:13.985] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-05 19:35:13.987] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | No active profile set, falling back to default profiles: default
[2020-06-05 19:35:16.606] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
[2020-06-05 19:35:16.751] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 138ms. Found 1 MongoDB repository interfaces.
[2020-06-05 19:35:19.121] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3000 (http)
[2020-06-05 19:35:19.135] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3000"]
[2020-06-05 19:35:19.135] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-05 19:35:19.136] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-05 19:35:19.312] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-05 19:35:19.312] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 5088 ms
[2020-06-05 19:35:20.056] [INFO] [jmendoza-ThinkPad-T420] [main] [mongodb.driver.cluster] | Cluster created with settings {hosts=[127.0.0.1:27017], srvHost=cluster0-7rxkw.mongodb.net, mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', requiredReplicaSetName='Cluster0-shard-0'}
[2020-06-05 19:35:20.156] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-00-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:35:20.207] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-01-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:35:20.209] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-02-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:35:21.354] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-05 19:35:21.686] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-02-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:3, serverValue:117268}] to cluster0-shard-00-02-7rxkw.mongodb.net:27017
[2020-06-05 19:35:21.732] [INFO] [jmendoza-ThinkPad-T420] [main] [endpoint.web.EndpointLinksResolver] | Exposing 2 endpoint(s) beneath base path '/actuator'
[2020-06-05 19:35:21.770] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3000"]
[2020-06-05 19:35:21.810] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3000 (http) with context path ''
[2020-06-05 19:35:21.827] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Started CustomerApplication in 8.835 seconds (JVM running for 12.734)
[2020-06-05 19:35:21.881] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-02-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-02-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=192045575, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-02-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:35:02 VET 2020, lastUpdateTimeNanos=16852466771751}
[2020-06-05 19:35:22.285] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(5)-127.0.0.1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-05 19:35:22.286] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(5)-127.0.0.1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-05 19:35:22.294] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(5)-127.0.0.1] [web.servlet.DispatcherServlet] | Completed initialization in 8 ms
[2020-06-05 19:35:22.386] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(4)-127.0.0.1] [mongodb.driver.cluster] | No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=cluster0-shard-00-00-7rxkw.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=cluster0-shard-00-01-7rxkw.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=cluster0-shard-00-02-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=192045575, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-02-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:35:02 VET 2020, lastUpdateTimeNanos=16852466771751}]}. Waiting for 30000 ms before timing out
[2020-06-05 19:35:22.552] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:2, serverValue:137759}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.699] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-00-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:1, serverValue:112761}] to cluster0-shard-00-00-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.735] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-01-7rxkw.mongodb.net:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=182361086, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-01-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=7fffffff0000000000000027, setVersion=4, lastWriteDate=Fri Jun 05 19:35:03 VET 2020, lastUpdateTimeNanos=16853322260844}
[2020-06-05 19:35:22.736] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Setting max election id to 7fffffff0000000000000027 from replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.736] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Setting max set version to 4 from replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.736] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Discovered replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.881] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-00-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-00-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=181270372, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-00-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:35:04 VET 2020, lastUpdateTimeNanos=16853467593939}
[2020-06-05 19:35:24.120] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(4)-127.0.0.1] [mongodb.driver.connection] | Opened connection [connectionId{localValue:4, serverValue:137759}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:42.449] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3000-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"ed06e08d93d52b31","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3000/v1/customers/login","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["65"],"content-type":["application/json"],"host":["localhost:3000"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["6b0758a1-1971-c17a-0e71-452421211679"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]},"body":{"email":"jmendoza@gmail.com","password":"123456789"}}
[2020-06-05 19:35:43.389] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3000-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"ed06e08d93d52b31","duration":1012,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 23:35:43 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"id":"5ed047dda2923f1ac2c64463","firstName":"Jonathan","lastName":"Mendoza","email":"jmendoza@gmail.com","createdAt":"2020-05-28T19:15:07"}}
[2020-06-05 19:35:53.372] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-05 19:35:53.566] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [mongodb.driver.connection] | Closed connection [connectionId{localValue:4, serverValue:137759}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017 because the pool has been closed.


================================================
FILE: logs/Order.log
================================================
[2020-06-04 20:02:21.856] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 409 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:02:21.864] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:02:21.865] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:02:23.473] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:02:23.512] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 32ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:02:24.391] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:02:24.416] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:02:24.418] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:02:24.419] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:02:24.520] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:02:24.520] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2463 ms
[2020-06-04 20:02:25.181] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:02:25.470] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 20:02:25.718] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 20:02:25.869] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:02:25.954] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 20:02:25.986] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 4.937 seconds (JVM running for 8.358)
[2020-06-04 20:02:40.615] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 20:02:40.615] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 20:02:40.623] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 8 ms
[2020-06-04 20:02:40.978] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"b794ba38ddd228dc","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["5af5b78f-62a6-d224-fb1a-13c7c657372d"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:02:41.087] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.GlobalException: Exception getOrder: A CallableStatement function was executed and the out parameter 1 was of type java.sql.Types=1111 however type java.sql.Types=12 was registered.
[2020-06-04 20:02:41.132] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"b794ba38ddd228dc","duration":363,"protocol":"HTTP/1.1","status":500,"headers":{"Connection":["close"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:02:41 GMT"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:02:41.087+00:00","message":"Exception getOrder: A CallableStatement function was executed and the out parameter 1 was of type java.sql.Types=1111 however type java.sql.Types=12 was registered.","details":"uri=/v1/orders/32"}}
[2020-06-04 20:02:50.032] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:02:50.033] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 20:02:50.047] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-06-04 20:04:10.045] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 819 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:04:10.060] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:04:10.062] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:04:11.159] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:04:11.182] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 19ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:04:11.701] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:04:11.710] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:04:11.711] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:04:11.711] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:04:11.775] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:04:11.775] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: ini
Download .txt
gitextract_phlx012v/

├── Customer/
│   ├── .gitignore
│   ├── README.md
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── jmendoza/
│       │   │           └── swa/
│       │   │               └── hexagonal/
│       │   │                   └── customer/
│       │   │                       ├── CustomerApplication.java
│       │   │                       ├── application/
│       │   │                       │   ├── rest/
│       │   │                       │   │   ├── controller/
│       │   │                       │   │   │   └── CustomerController.java
│       │   │                       │   │   ├── request/
│       │   │                       │   │   │   └── README.md
│       │   │                       │   │   └── response/
│       │   │                       │   │       ├── CreateCustomerResponse.java
│       │   │                       │   │       ├── CustomerLoginResponse.java
│       │   │                       │   │       └── ResponseMapper.java
│       │   │                       │   └── soap/
│       │   │                       │       └── README.md
│       │   │                       ├── common/
│       │   │                       │   ├── config/
│       │   │                       │   │   └── CreateBean.java
│       │   │                       │   ├── constants/
│       │   │                       │   │   └── CustomerConstanst.java
│       │   │                       │   ├── customannotations/
│       │   │                       │   │   └── UseCase.java
│       │   │                       │   └── exception/
│       │   │                       │       ├── CustomExceptionHandler.java
│       │   │                       │       ├── ErrorDetails.java
│       │   │                       │       ├── GlobalException.java
│       │   │                       │       ├── ParameterNotFoundException.java
│       │   │                       │       └── ResourceNotFoundException.java
│       │   │                       ├── domain/
│       │   │                       │   ├── model/
│       │   │                       │   │   └── Customer.java
│       │   │                       │   ├── ports/
│       │   │                       │   │   ├── inbound/
│       │   │                       │   │   │   ├── CreateCustomerUseCase.java
│       │   │                       │   │   │   ├── CustomerLoginUseCase.java
│       │   │                       │   │   │   ├── DeleteCustomerUseCase.java
│       │   │                       │   │   │   └── UpdateCustomerUseCase.java
│       │   │                       │   │   └── outbound/
│       │   │                       │   │       ├── CreateCustomerPort.java
│       │   │                       │   │       ├── DeleteCustomerPort.java
│       │   │                       │   │       ├── ExistsCustomerPort.java
│       │   │                       │   │       ├── GetCustomerEmailPort.java
│       │   │                       │   │       ├── GetCustomerIdPort.java
│       │   │                       │   │       ├── PasswordEncodePort.java
│       │   │                       │   │       ├── PasswordMatchesPort.java
│       │   │                       │   │       └── UpdateCustomerPort.java
│       │   │                       │   └── services/
│       │   │                       │       ├── CreateCustomerService.java
│       │   │                       │       ├── CustomerLoginService.java
│       │   │                       │       ├── DeleteCustomerService.java
│       │   │                       │       └── UpdateCustomerService.java
│       │   │                       └── infrastructure/
│       │   │                           ├── databases/
│       │   │                           │   ├── mongo/
│       │   │                           │   │   ├── CreateCustomerAdapter.java
│       │   │                           │   │   ├── CustomerRepository.java
│       │   │                           │   │   ├── DeleteCustomerAdapter.java
│       │   │                           │   │   ├── ExistsCustomerAdapter.java
│       │   │                           │   │   ├── GetCustomerEmailAdapter.java
│       │   │                           │   │   ├── GetCustomerIdAdapter.java
│       │   │                           │   │   └── UpdateCustomerAdapter.java
│       │   │                           │   └── postgresql/
│       │   │                           │       └── README.md
│       │   │                           ├── messagebroker/
│       │   │                           │   └── README.md
│       │   │                           └── security/
│       │   │                               ├── PasswordEncodeAdapter.java
│       │   │                               └── PasswordMatchesAdapter.java
│       │   └── resources/
│       │       ├── application.properties
│       │       └── log4j2.xml
│       └── test/
│           └── java/
│               └── com/
│                   └── jmendoza/
│                       └── swa/
│                           └── hexagonal/
│                               └── customer/
│                                   └── CustomerApplicationTests.java
├── Order/
│   ├── .gitignore
│   ├── README.md
│   ├── application/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── application/
│   │                                   ├── rest/
│   │                                   │   ├── controller/
│   │                                   │   │   └── OrderController.java
│   │                                   │   ├── request/
│   │                                   │   │   └── README.md
│   │                                   │   └── response/
│   │                                   │       └── CreateOrderResponse.java
│   │                                   └── soap/
│   │                                       └── README.md
│   ├── common/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── common/
│   │                                   ├── constants/
│   │                                   │   └── OrderConstanst.java
│   │                                   ├── customannotations/
│   │                                   │   └── UseCase.java
│   │                                   └── exception/
│   │                                       ├── CustomExceptionHandler.java
│   │                                       ├── ErrorDetails.java
│   │                                       ├── GlobalException.java
│   │                                       ├── ParameterNotFoundException.java
│   │                                       └── ResourceNotFoundException.java
│   ├── configuration/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── jmendoza/
│   │           │           └── swa/
│   │           │               └── hexagonal/
│   │           │                   └── configuration/
│   │           │                       ├── HexagonalArchitectureConfigurationApplication.java
│   │           │                       └── db/
│   │           │                           └── DataSourceConfig.java
│   │           └── resources/
│   │               ├── application.properties
│   │               └── log4j2.xml
│   ├── domain/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── domain/
│   │                                   ├── model/
│   │                                   │   ├── Order.java
│   │                                   │   └── OrderProduct.java
│   │                                   ├── ports/
│   │                                   │   ├── inbound/
│   │                                   │   │   ├── CreateOrderUseCase.java
│   │                                   │   │   └── GetOrderUseCase.java
│   │                                   │   └── outbound/
│   │                                   │       ├── CreateOrderPort.java
│   │                                   │       └── GetOrderPort.java
│   │                                   └── services/
│   │                                       ├── CreateOrderService.java
│   │                                       └── GetOrderService.java
│   ├── infrastructure/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── jmendoza/
│   │                       └── swa/
│   │                           └── hexagonal/
│   │                               └── infrastracture/
│   │                                   ├── databases/
│   │                                   │   ├── mongo/
│   │                                   │   │   └── README.md
│   │                                   │   └── postgresql/
│   │                                   │       ├── CreateOrderAdapter.java
│   │                                   │       └── GetOrderAdapter.java
│   │                                   └── messagebroker/
│   │                                       └── README.md
│   ├── logs/
│   │   ├── Order-2020-06-05-1.log
│   │   └── Order.log
│   ├── pom.xml
│   └── postgresql/
│       ├── 1-create_table_orders.sql
│       ├── 2-create_sequence_order_id.sql
│       ├── 3-create_function_create_order.sql
│       ├── 4-create_table_order_product.sql
│       ├── 5-create_order_product_id_seq.sql
│       └── 6-create_function_get_order.sql
├── Product/
│   ├── .gitignore
│   ├── README.md
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── jmendoza/
│       │   │           └── swa/
│       │   │               └── hexagonal/
│       │   │                   └── product/
│       │   │                       ├── ProductApplication.java
│       │   │                       ├── application/
│       │   │                       │   ├── rest/
│       │   │                       │   │   ├── controller/
│       │   │                       │   │   │   └── ProductController.java
│       │   │                       │   │   ├── request/
│       │   │                       │   │   │   └── README.md
│       │   │                       │   │   └── response/
│       │   │                       │   │       └── CreateProductResponse.java
│       │   │                       │   └── soap/
│       │   │                       │       └── README.md
│       │   │                       ├── common/
│       │   │                       │   ├── config/
│       │   │                       │   │   └── README.md
│       │   │                       │   ├── constants/
│       │   │                       │   │   └── ProductConstanst.java
│       │   │                       │   ├── customannotations/
│       │   │                       │   │   └── UseCase.java
│       │   │                       │   └── exception/
│       │   │                       │       ├── CustomExceptionHandler.java
│       │   │                       │       ├── ErrorDetails.java
│       │   │                       │       ├── GlobalException.java
│       │   │                       │       ├── ParameterNotFoundException.java
│       │   │                       │       └── ResourceNotFoundException.java
│       │   │                       ├── domain/
│       │   │                       │   ├── model/
│       │   │                       │   │   └── Product.java
│       │   │                       │   ├── ports/
│       │   │                       │   │   ├── inbound/
│       │   │                       │   │   │   ├── CreateProductUseCase.java
│       │   │                       │   │   │   ├── DeleteProductUseCase.java
│       │   │                       │   │   │   ├── GetProductUseCase.java
│       │   │                       │   │   │   └── GetProductsUseCase.java
│       │   │                       │   │   └── outbound/
│       │   │                       │   │       ├── CreateProductPort.java
│       │   │                       │   │       ├── DeleteProductPort.java
│       │   │                       │   │       ├── ExistsProductPort.java
│       │   │                       │   │       ├── GetProductIdPort.java
│       │   │                       │   │       └── GetProductsPort.java
│       │   │                       │   └── services/
│       │   │                       │       ├── CreateProductService.java
│       │   │                       │       ├── DeleteProductService.java
│       │   │                       │       ├── GetProductService.java
│       │   │                       │       └── GetProductsService.java
│       │   │                       └── infrastructure/
│       │   │                           ├── databases/
│       │   │                           │   ├── mongo/
│       │   │                           │   │   ├── CreateProductAdapter.java
│       │   │                           │   │   ├── DeleteProductAdapter.java
│       │   │                           │   │   ├── ExistsProductAdapter.java
│       │   │                           │   │   ├── GetProductIdAdapter.java
│       │   │                           │   │   ├── GetProductsAdapter.java
│       │   │                           │   │   └── ProductRepository.java
│       │   │                           │   └── postgresql/
│       │   │                           │       └── README.md
│       │   │                           └── messagebroker/
│       │   │                               └── README.md
│       │   └── resources/
│       │       ├── application.properties
│       │       └── log4j2.xml
│       └── test/
│           └── java/
│               └── com/
│                   └── jmendoza/
│                       └── swa/
│                           └── hexagonal/
│                               └── product/
│                                   └── ProductApplicationTests.java
├── README.md
├── logs/
│   ├── Customer.log
│   ├── Order.log
│   └── Product.log
└── prtsc/
    └── Hexagonal-Architecture-Microservices.drawio
Download .txt
SYMBOL INDEX (202 symbols across 93 files)

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/CustomerApplication.java
  class CustomerApplication (line 6) | @SpringBootApplication(exclude = {
    method main (line 12) | public static void main(String[] args) {

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/controller/CustomerController.java
  class CustomerController (line 20) | @RestController
    method createCustomer (line 32) | @PostMapping
    method customerLogin (line 38) | @PostMapping("/login")
    method deleteCustomer (line 44) | @DeleteMapping("/{id}")
    method updateCustomer (line 50) | @PutMapping("/{id}")

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CreateCustomerResponse.java
  class CreateCustomerResponse (line 8) | @Getter

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CustomerLoginResponse.java
  class CustomerLoginResponse (line 9) | @Getter

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/ResponseMapper.java
  class ResponseMapper (line 8) | @Component
    method convertCustomerToCustomerLoginResponse (line 14) | public CustomerLoginResponse convertCustomerToCustomerLoginResponse(Cu...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/config/CreateBean.java
  class CreateBean (line 7) | @Configuration
    method modelMapper (line 9) | @Bean

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/constants/CustomerConstanst.java
  class CustomerConstanst (line 3) | public class CustomerConstanst {
    method CustomerConstanst (line 10) | private CustomerConstanst() {

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/CustomExceptionHandler.java
  class CustomExceptionHandler (line 13) | @ControllerAdvice
    method resourceNotFoundException (line 18) | @ExceptionHandler(ResourceNotFoundException.class)
    method globalExceptionHandler (line 25) | @ExceptionHandler({GlobalException.class})
    method parameterNotFoundExceptionHandler (line 32) | @ExceptionHandler({ParameterNotFoundException.class})

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ErrorDetails.java
  class ErrorDetails (line 8) | @Getter

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/GlobalException.java
  class GlobalException (line 6) | @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    method GlobalException (line 10) | public GlobalException(String message) {
    method GlobalException (line 14) | public GlobalException(String message, Throwable cause) {

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ParameterNotFoundException.java
  class ParameterNotFoundException (line 6) | @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    method ParameterNotFoundException (line 11) | public ParameterNotFoundException(String message) {
    method ParameterNotFoundException (line 15) | public ParameterNotFoundException(String message, Throwable cause) {

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ResourceNotFoundException.java
  class ResourceNotFoundException (line 6) | @ResponseStatus(value = HttpStatus.NOT_FOUND)
    method ResourceNotFoundException (line 11) | public ResourceNotFoundException(String message) {
    method ResourceNotFoundException (line 15) | public ResourceNotFoundException(String message, Throwable cause) {

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/model/Customer.java
  class Customer (line 7) | @Getter

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CreateCustomerUseCase.java
  type CreateCustomerUseCase (line 7) | public interface CreateCustomerUseCase {
    method createCustomer (line 8) | void createCustomer(Customer customer) throws GlobalException, Paramet...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CustomerLoginUseCase.java
  type CustomerLoginUseCase (line 8) | public interface CustomerLoginUseCase {
    method customerLogin (line 9) | Customer customerLogin(String email, String password) throws ResourceN...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/DeleteCustomerUseCase.java
  type DeleteCustomerUseCase (line 5) | public interface DeleteCustomerUseCase {
    method deleteCustomer (line 6) | void deleteCustomer(String id) throws ResourceNotFoundException;

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/UpdateCustomerUseCase.java
  type UpdateCustomerUseCase (line 6) | public interface UpdateCustomerUseCase {
    method updateCustomer (line 7) | void updateCustomer(String id, Customer customer) throws ResourceNotFo...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/CreateCustomerPort.java
  type CreateCustomerPort (line 5) | public interface CreateCustomerPort {
    method createCustomer (line 6) | void createCustomer(Customer customer);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/DeleteCustomerPort.java
  type DeleteCustomerPort (line 5) | public interface DeleteCustomerPort {
    method deleteCustomer (line 6) | void deleteCustomer(Customer customer);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/ExistsCustomerPort.java
  type ExistsCustomerPort (line 3) | public interface ExistsCustomerPort {
    method existsByEmail (line 4) | boolean existsByEmail(String email);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerEmailPort.java
  type GetCustomerEmailPort (line 7) | public interface GetCustomerEmailPort {
    method getCustomerByEmail (line 8) | Optional<Customer> getCustomerByEmail(String email);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerIdPort.java
  type GetCustomerIdPort (line 7) | public interface GetCustomerIdPort {
    method getCustomerById (line 8) | Optional<Customer> getCustomerById(String id);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordEncodePort.java
  type PasswordEncodePort (line 3) | public interface PasswordEncodePort {
    method passwordEncoder (line 4) | String passwordEncoder(String password);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordMatchesPort.java
  type PasswordMatchesPort (line 3) | public interface PasswordMatchesPort {
    method passwordMatchesPort (line 5) | boolean passwordMatchesPort(CharSequence rawPassword, String encodedPa...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/UpdateCustomerPort.java
  type UpdateCustomerPort (line 5) | public interface UpdateCustomerPort {
    method updateCustomer (line 6) | void updateCustomer(Customer customer);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CreateCustomerService.java
  class CreateCustomerService (line 15) | @AllArgsConstructor
    method createCustomer (line 23) | @Override
    method getMessageParameterNotFoundException (line 44) | private void getMessageParameterNotFoundException(String parameter) th...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CustomerLoginService.java
  class CustomerLoginService (line 17) | @AllArgsConstructor
    method customerLogin (line 24) | @Override
    method getMessageParameterNotFoundException (line 45) | private void getMessageParameterNotFoundException(String parameter) th...

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/DeleteCustomerService.java
  class DeleteCustomerService (line 12) | @AllArgsConstructor
    method deleteCustomer (line 19) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/UpdateCustomerService.java
  class UpdateCustomerService (line 16) | @AllArgsConstructor
    method updateCustomer (line 26) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CreateCustomerAdapter.java
  class CreateCustomerAdapter (line 8) | @Component
    method createCustomer (line 13) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CustomerRepository.java
  type CustomerRepository (line 9) | @Repository
    method existsByEmail (line 12) | boolean existsByEmail(String email);
    method findByEmail (line 14) | Optional<Customer> findByEmail(String email);

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/DeleteCustomerAdapter.java
  class DeleteCustomerAdapter (line 8) | @Component
    method deleteCustomer (line 14) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/ExistsCustomerAdapter.java
  class ExistsCustomerAdapter (line 7) | @Component
    method existsByEmail (line 12) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerEmailAdapter.java
  class GetCustomerEmailAdapter (line 10) | @Component
    method getCustomerByEmail (line 15) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerIdAdapter.java
  class GetCustomerIdAdapter (line 10) | @Component
    method getCustomerById (line 16) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/UpdateCustomerAdapter.java
  class UpdateCustomerAdapter (line 8) | @Component
    method updateCustomer (line 14) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordEncodeAdapter.java
  class PasswordEncodeAdapter (line 7) | @Component
    method passwordEncoder (line 12) | @Override

FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordMatchesAdapter.java
  class PasswordMatchesAdapter (line 7) | @Component
    method passwordMatchesPort (line 12) | @Override

FILE: Customer/src/test/java/com/jmendoza/swa/hexagonal/customer/CustomerApplicationTests.java
  class CustomerApplicationTests (line 6) | @SpringBootTest
    method contextLoads (line 9) | @Test

FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/controller/OrderController.java
  class OrderController (line 16) | @RestController
    method createOrder (line 24) | @PostMapping
    method getOrder (line 30) | @GetMapping("/{id}")

FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/response/CreateOrderResponse.java
  class CreateOrderResponse (line 8) | @Getter

FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/constants/OrderConstanst.java
  class OrderConstanst (line 3) | public class OrderConstanst {
    method OrderConstanst (line 9) | private OrderConstanst() {

FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/CustomExceptionHandler.java
  class CustomExceptionHandler (line 13) | @ControllerAdvice
    method resourceNotFoundException (line 18) | @ExceptionHandler(ResourceNotFoundException.class)
    method globalExceptionHandler (line 25) | @ExceptionHandler({GlobalException.class})
    method parameterNotFoundExceptionHandler (line 32) | @ExceptionHandler({ParameterNotFoundException.class})

FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ErrorDetails.java
  class ErrorDetails (line 8) | @Getter

FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/GlobalException.java
  class GlobalException (line 6) | @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    method GlobalException (line 10) | public GlobalException(String message) {
    method GlobalException (line 14) | public GlobalException(String message, Throwable cause) {

FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ParameterNotFoundException.java
  class ParameterNotFoundException (line 6) | @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    method ParameterNotFoundException (line 11) | public ParameterNotFoundException(String message) {
    method ParameterNotFoundException (line 15) | public ParameterNotFoundException(String message, Throwable cause) {

FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ResourceNotFoundException.java
  class ResourceNotFoundException (line 6) | @ResponseStatus(value = HttpStatus.NOT_FOUND)
    method ResourceNotFoundException (line 11) | public ResourceNotFoundException(String message) {
    method ResourceNotFoundException (line 15) | public ResourceNotFoundException(String message, Throwable cause) {

FILE: Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/HexagonalArchitectureConfigurationApplication.java
  class HexagonalArchitectureConfigurationApplication (line 6) | @SpringBootApplication(scanBasePackages = {"com.jmendoza.swa.hexagonal.*"})
    method main (line 9) | public static void main(String[] args) {

FILE: Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/db/DataSourceConfig.java
  class DataSourceConfig (line 13) | @Configuration
    method getDataSource (line 16) | @Bean

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/Order.java
  class Order (line 10) | @Getter
    method getAmountOrder (line 20) | public Double getAmountOrder() {

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/OrderProduct.java
  class OrderProduct (line 10) | @Getter
    method getAmount (line 23) | Double getAmount() {

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/CreateOrderUseCase.java
  type CreateOrderUseCase (line 7) | public interface CreateOrderUseCase {
    method createOrder (line 8) | void createOrder(Order order) throws ParameterNotFoundException, Globa...

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/GetOrderUseCase.java
  type GetOrderUseCase (line 7) | public interface GetOrderUseCase {
    method getOrder (line 8) | Order getOrder(String orderId) throws ResourceNotFoundException, Globa...

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/CreateOrderPort.java
  type CreateOrderPort (line 6) | public interface CreateOrderPort {
    method createOrder (line 7) | void createOrder(Order order) throws GlobalException;

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/GetOrderPort.java
  type GetOrderPort (line 6) | public interface GetOrderPort {
    method getOrder (line 7) | Order getOrder(String orderId) throws GlobalException;

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/CreateOrderService.java
  class CreateOrderService (line 13) | @AllArgsConstructor
    method createOrder (line 19) | @Override
    method getMessageParameterNotFoundException (line 37) | private void getMessageParameterNotFoundException(String parameter) th...

FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/GetOrderService.java
  class GetOrderService (line 12) | @AllArgsConstructor
    method getOrder (line 18) | @Override

FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/CreateOrderAdapter.java
  class CreateOrderAdapter (line 16) | @Component
    method CreateOrderAdapter (line 21) | @Autowired
    method createOrder (line 26) | @Override

FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/GetOrderAdapter.java
  class GetOrderAdapter (line 17) | @Component
    method GetOrderAdapter (line 22) | @Autowired
    method getOrder (line 27) | @Override

FILE: Order/postgresql/1-create_table_orders.sql
  type public (line 5) | CREATE TABLE public."ORDERS"

FILE: Order/postgresql/3-create_function_create_order.sql
  function public (line 5) | CREATE OR REPLACE FUNCTION public.create_order(

FILE: Order/postgresql/4-create_table_order_product.sql
  type public (line 5) | CREATE TABLE public."ORDERS_PRODUCTS"

FILE: Order/postgresql/6-create_function_get_order.sql
  function public (line 5) | CREATE OR REPLACE FUNCTION public.get_order(

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/ProductApplication.java
  class ProductApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/controller/ProductController.java
  class ProductController (line 19) | @RestController
    method createProduct (line 29) | @PostMapping
    method deleteCustomer (line 35) | @DeleteMapping("/{id}")
    method getProducts (line 41) | @GetMapping
    method getProduct (line 47) | @GetMapping("/{id}")

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/response/CreateProductResponse.java
  class CreateProductResponse (line 8) | @Getter

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/constants/ProductConstanst.java
  class ProductConstanst (line 3) | public class ProductConstanst {
    method ProductConstanst (line 12) | private ProductConstanst() {

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/CustomExceptionHandler.java
  class CustomExceptionHandler (line 13) | @ControllerAdvice
    method resourceNotFoundException (line 18) | @ExceptionHandler(ResourceNotFoundException.class)
    method globalExceptionHandler (line 25) | @ExceptionHandler({GlobalException.class})
    method parameterNotFoundExceptionHandler (line 32) | @ExceptionHandler({ParameterNotFoundException.class})

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ErrorDetails.java
  class ErrorDetails (line 8) | @Getter

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/GlobalException.java
  class GlobalException (line 6) | @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    method GlobalException (line 10) | public GlobalException(String message) {
    method GlobalException (line 14) | public GlobalException(String message, Throwable cause) {

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ParameterNotFoundException.java
  class ParameterNotFoundException (line 6) | @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    method ParameterNotFoundException (line 11) | public ParameterNotFoundException(String message) {
    method ParameterNotFoundException (line 15) | public ParameterNotFoundException(String message, Throwable cause) {

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ResourceNotFoundException.java
  class ResourceNotFoundException (line 6) | @ResponseStatus(value = HttpStatus.NOT_FOUND)
    method ResourceNotFoundException (line 11) | public ResourceNotFoundException(String message) {
    method ResourceNotFoundException (line 15) | public ResourceNotFoundException(String message, Throwable cause) {

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/model/Product.java
  class Product (line 7) | @Getter

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/CreateProductUseCase.java
  type CreateProductUseCase (line 7) | public interface CreateProductUseCase {
    method createProduct (line 8) | void createProduct(Product product) throws ParameterNotFoundException,...

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/DeleteProductUseCase.java
  type DeleteProductUseCase (line 5) | public interface DeleteProductUseCase {
    method deleteProduct (line 6) | void deleteProduct(String id) throws ResourceNotFoundException;

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductUseCase.java
  type GetProductUseCase (line 6) | public interface GetProductUseCase {
    method getProduct (line 8) | Product getProduct(String id) throws ResourceNotFoundException;

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductsUseCase.java
  type GetProductsUseCase (line 8) | public interface GetProductsUseCase {
    method getProducts (line 9) | List<Product> getProducts() throws ResourceNotFoundException;

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/CreateProductPort.java
  type CreateProductPort (line 5) | public interface CreateProductPort {
    method createProduct (line 6) | void createProduct(Product product);

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/DeleteProductPort.java
  type DeleteProductPort (line 5) | public interface DeleteProductPort {
    method deleteProduct (line 6) | void deleteProduct(Product product);

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/ExistsProductPort.java
  type ExistsProductPort (line 3) | public interface ExistsProductPort {
    method existsBySerialNumber (line 4) | boolean existsBySerialNumber(String serialNumber);

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductIdPort.java
  type GetProductIdPort (line 7) | public interface GetProductIdPort {
    method getProductById (line 8) | Optional<Product> getProductById(String id);

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductsPort.java
  type GetProductsPort (line 7) | public interface GetProductsPort {
    method getProducts (line 8) | List<Product> getProducts();

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/CreateProductService.java
  class CreateProductService (line 14) | @AllArgsConstructor
    method createProduct (line 21) | @Override
    method getMessageParameterNotFoundException (line 41) | private void getMessageParameterNotFoundException(String parameter) th...

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/DeleteProductService.java
  class DeleteProductService (line 12) | @AllArgsConstructor
    method deleteProduct (line 19) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductService.java
  class GetProductService (line 11) | @AllArgsConstructor
    method getProduct (line 17) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductsService.java
  class GetProductsService (line 13) | @AllArgsConstructor
    method getProducts (line 19) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/CreateProductAdapter.java
  class CreateProductAdapter (line 8) | @Component
    method createProduct (line 13) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/DeleteProductAdapter.java
  class DeleteProductAdapter (line 8) | @Component
    method deleteProduct (line 13) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ExistsProductAdapter.java
  class ExistsProductAdapter (line 7) | @Component
    method existsBySerialNumber (line 13) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductIdAdapter.java
  class GetProductIdAdapter (line 10) | @Component
    method getProductById (line 16) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductsAdapter.java
  class GetProductsAdapter (line 10) | @Component
    method getProducts (line 16) | @Override

FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ProductRepository.java
  type ProductRepository (line 7) | @Repository
    method existsBySerialNumber (line 9) | boolean existsBySerialNumber(String serialNumber);

FILE: Product/src/test/java/com/jmendoza/swa/hexagonal/product/ProductApplicationTests.java
  class ProductApplicationTests (line 6) | @SpringBootTest
    method contextLoads (line 9) | @Test
Condensed preview — 143 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (250K chars).
[
  {
    "path": "Customer/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Customer/README.md",
    "chars": 916,
    "preview": "# Customer Microservice\n\nExample of Customer Microservice applying Hexagonal Architecture pattern, Domain Driven Design "
  },
  {
    "path": "Customer/pom.xml",
    "chars": 3883,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/CustomerApplication.java",
    "chars": 573,
    "preview": "package com.jmendoza.swa.hexagonal.customer;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframew"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/controller/CustomerController.java",
    "chars": 2980,
    "preview": "package com.jmendoza.swa.hexagonal.customer.application.rest.controller;\n\nimport com.jmendoza.swa.hexagonal.customer.app"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/request/README.md",
    "chars": 115,
    "preview": "*In this directory you can add specialized requests, to only request minimum data, for example CreateUserRequest.*\n"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CreateCustomerResponse.java",
    "chars": 324,
    "preview": "package com.jmendoza.swa.hexagonal.customer.application.rest.response;\n\nimport com.fasterxml.jackson.annotation.JsonIncl"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CustomerLoginResponse.java",
    "chars": 542,
    "preview": "package com.jmendoza.swa.hexagonal.customer.application.rest.response;\n\nimport com.fasterxml.jackson.annotation.JsonIncl"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/ResponseMapper.java",
    "chars": 546,
    "preview": "package com.jmendoza.swa.hexagonal.customer.application.rest.response;\n\nimport com.jmendoza.swa.hexagonal.customer.domai"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/soap/README.md",
    "chars": 133,
    "preview": "*In this directory you can add another type of adapter to access the domain, for example a CustomerController class to e"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/config/CreateBean.java",
    "chars": 342,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.config;\n\nimport org.modelmapper.ModelMapper;\nimport org.springframewo"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/constants/CustomerConstanst.java",
    "chars": 551,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.constants;\n\npublic class CustomerConstanst {\n    public static final "
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/customannotations/UseCase.java",
    "chars": 399,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.customannotations;\n\nimport org.springframework.core.annotation.AliasF"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/CustomExceptionHandler.java",
    "chars": 1783,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.exception;\n\nimport org.apache.logging.log4j.LogManager;\nimport org.ap"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ErrorDetails.java",
    "chars": 286,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.exception;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Getter;\n\n"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/GlobalException.java",
    "chars": 509,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.sp"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ParameterNotFoundException.java",
    "chars": 533,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.sp"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ResourceNotFoundException.java",
    "chars": 528,
    "preview": "package com.jmendoza.swa.hexagonal.customer.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.sp"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/model/Customer.java",
    "chars": 377,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.model;\n\nimport lombok.Getter;\nimport lombok.Setter;\nimport lombok.ToS"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CreateCustomerUseCase.java",
    "chars": 436,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.customer.common.exc"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CustomerLoginUseCase.java",
    "chars": 564,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.customer.common.exc"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/DeleteCustomerUseCase.java",
    "chars": 267,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.customer.common.exc"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/UpdateCustomerUseCase.java",
    "chars": 352,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.customer.common.exc"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/CreateCustomerPort.java",
    "chars": 219,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.customer.domain.mo"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/DeleteCustomerPort.java",
    "chars": 219,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.customer.domain.mo"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/ExistsCustomerPort.java",
    "chars": 149,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\npublic interface ExistsCustomerPort {\n    boolean ex"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerEmailPort.java",
    "chars": 262,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.customer.domain.mo"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerIdPort.java",
    "chars": 253,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.customer.domain.mo"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordEncodePort.java",
    "chars": 153,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\npublic interface PasswordEncodePort {\n    String pas"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordMatchesPort.java",
    "chars": 193,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\npublic interface PasswordMatchesPort {\n\n    boolean "
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/UpdateCustomerPort.java",
    "chars": 219,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.customer.domain.mo"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CreateCustomerService.java",
    "chars": 2407,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.services;\n\nimport com.jmendoza.swa.hexagonal.customer.common.constant"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CustomerLoginService.java",
    "chars": 2373,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.services;\n\nimport com.jmendoza.swa.hexagonal.customer.common.constant"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/DeleteCustomerService.java",
    "chars": 1191,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.services;\n\nimport com.jmendoza.swa.hexagonal.customer.common.constant"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/UpdateCustomerService.java",
    "chars": 1814,
    "preview": "package com.jmendoza.swa.hexagonal.customer.domain.services;\n\nimport com.jmendoza.swa.hexagonal.customer.common.constant"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CreateCustomerAdapter.java",
    "chars": 603,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CustomerRepository.java",
    "chars": 477,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/DeleteCustomerAdapter.java",
    "chars": 606,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/ExistsCustomerAdapter.java",
    "chars": 547,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerEmailAdapter.java",
    "chars": 661,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerIdAdapter.java",
    "chars": 641,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/UpdateCustomerAdapter.java",
    "chars": 604,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.customer."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/postgresql/README.md",
    "chars": 83,
    "preview": "*In this directory you can add another type of DB adapter for example PostgreSQL.*\n"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/messagebroker/README.md",
    "chars": 123,
    "preview": "*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ"
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordEncodeAdapter.java",
    "chars": 567,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.security;\n\nimport com.jmendoza.swa.hexagonal.customer.domain."
  },
  {
    "path": "Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordMatchesAdapter.java",
    "chars": 629,
    "preview": "package com.jmendoza.swa.hexagonal.customer.infrastructure.security;\n\nimport com.jmendoza.swa.hexagonal.customer.domain."
  },
  {
    "path": "Customer/src/main/resources/application.properties",
    "chars": 294,
    "preview": "# Application Server\nserver.port=3000\n\n# MongoDB Atlas\nspring.data.mongodb.uri=mongodb+srv://jmendoza:zuZYkSpMIpSGqgLD@c"
  },
  {
    "path": "Customer/src/main/resources/log4j2.xml",
    "chars": 1861,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Don't forget to set system property -Dlog4j2.contextSelector=org.apache.logg"
  },
  {
    "path": "Customer/src/test/java/com/jmendoza/swa/hexagonal/customer/CustomerApplicationTests.java",
    "chars": 238,
    "preview": "package com.jmendoza.swa.hexagonal.customer;\n\nimport org.junit.jupiter.api.Test;\nimport org.springframework.boot.test.co"
  },
  {
    "path": "Order/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Order/README.md",
    "chars": 4767,
    "preview": "# Orders Microservice\n\nExample of Orders Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD"
  },
  {
    "path": "Order/application/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Order/application/pom.xml",
    "chars": 907,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/controller/OrderController.java",
    "chars": 1505,
    "preview": "package com.jmendoza.swa.hexagonal.application.rest.controller;\n\nimport com.jmendoza.swa.hexagonal.application.rest.resp"
  },
  {
    "path": "Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/request/README.md",
    "chars": 116,
    "preview": "*In this directory you can add specialized requests, to only request minimum data, for example CreateOrderRequest.*\n"
  },
  {
    "path": "Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/response/CreateOrderResponse.java",
    "chars": 317,
    "preview": "package com.jmendoza.swa.hexagonal.application.rest.response;\n\nimport com.fasterxml.jackson.annotation.JsonInclude;\nimpo"
  },
  {
    "path": "Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/soap/README.md",
    "chars": 130,
    "preview": "*In this directory you can add another type of adapter to access the domain, for example a OrderController class to expo"
  },
  {
    "path": "Order/common/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Order/common/pom.xml",
    "chars": 672,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/constants/OrderConstanst.java",
    "chars": 408,
    "preview": "package com.jmendoza.swa.hexagonal.common.constants;\n\npublic class OrderConstanst {\n    public static final String ORDER"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/customannotations/UseCase.java",
    "chars": 390,
    "preview": "package com.jmendoza.swa.hexagonal.common.customannotations;\n\nimport org.springframework.core.annotation.AliasFor;\nimpor"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/CustomExceptionHandler.java",
    "chars": 1774,
    "preview": "package com.jmendoza.swa.hexagonal.common.exception;\n\nimport org.apache.logging.log4j.LogManager;\nimport org.apache.logg"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ErrorDetails.java",
    "chars": 277,
    "preview": "package com.jmendoza.swa.hexagonal.common.exception;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Getter;\n\nimport ja"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/GlobalException.java",
    "chars": 500,
    "preview": "package com.jmendoza.swa.hexagonal.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.springframe"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ParameterNotFoundException.java",
    "chars": 524,
    "preview": "package com.jmendoza.swa.hexagonal.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.springframe"
  },
  {
    "path": "Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ResourceNotFoundException.java",
    "chars": 519,
    "preview": "package com.jmendoza.swa.hexagonal.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.springframe"
  },
  {
    "path": "Order/configuration/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Order/configuration/pom.xml",
    "chars": 1263,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/HexagonalArchitectureConfigurationApplication.java",
    "chars": 454,
    "preview": "package com.jmendoza.swa.hexagonal.configuration;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springf"
  },
  {
    "path": "Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/db/DataSourceConfig.java",
    "chars": 1848,
    "preview": "package com.jmendoza.swa.hexagonal.configuration.db;\n\nimport org.springframework.boot.context.properties.ConfigurationPr"
  },
  {
    "path": "Order/configuration/src/main/resources/application.properties",
    "chars": 598,
    "preview": "## Server\nserver.port=3002\n\n## Spring DATASOURCE\nspring.datasource.driverClassName=org.postgresql.Driver\nspring.datasour"
  },
  {
    "path": "Order/configuration/src/main/resources/log4j2.xml",
    "chars": 1853,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Don't forget to set system property -Dlog4j2.contextSelector=org.apache.logg"
  },
  {
    "path": "Order/domain/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Order/domain/pom.xml",
    "chars": 952,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/Order.java",
    "chars": 512,
    "preview": "package com.jmendoza.swa.hexagonal.domain.model;\n\nimport lombok.Getter;\nimport lombok.Setter;\nimport lombok.ToString;\n\ni"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/OrderProduct.java",
    "chars": 555,
    "preview": "package com.jmendoza.swa.hexagonal.domain.model;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Getter;\nimport lombok."
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/CreateOrderUseCase.java",
    "chars": 385,
    "preview": "package com.jmendoza.swa.hexagonal.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.common.exception.GlobalExcep"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/GetOrderUseCase.java",
    "chars": 382,
    "preview": "package com.jmendoza.swa.hexagonal.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.common.exception.GlobalExcep"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/CreateOrderPort.java",
    "chars": 277,
    "preview": "package com.jmendoza.swa.hexagonal.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.common.exception.GlobalExce"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/GetOrderPort.java",
    "chars": 275,
    "preview": "package com.jmendoza.swa.hexagonal.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.common.exception.GlobalExce"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/CreateOrderService.java",
    "chars": 1769,
    "preview": "package com.jmendoza.swa.hexagonal.domain.services;\n\nimport com.jmendoza.swa.hexagonal.common.constants.OrderConstanst;\n"
  },
  {
    "path": "Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/GetOrderService.java",
    "chars": 1153,
    "preview": "package com.jmendoza.swa.hexagonal.domain.services;\n\nimport com.jmendoza.swa.hexagonal.common.constants.OrderConstanst;\n"
  },
  {
    "path": "Order/infrastructure/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Order/infrastructure/pom.xml",
    "chars": 1431,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/mongo/README.md",
    "chars": 78,
    "preview": "*In this directory you can add another type of DB adapter for example Mongo.*\n"
  },
  {
    "path": "Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/CreateOrderAdapter.java",
    "chars": 1882,
    "preview": "package com.jmendoza.swa.hexagonal.infrastracture.databases.postgresql;\n\nimport com.google.gson.Gson;\nimport com.jmendoz"
  },
  {
    "path": "Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/GetOrderAdapter.java",
    "chars": 1802,
    "preview": "package com.jmendoza.swa.hexagonal.infrastracture.databases.postgresql;\n\nimport com.google.gson.Gson;\nimport com.jmendoz"
  },
  {
    "path": "Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/messagebroker/README.md",
    "chars": 123,
    "preview": "*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ"
  },
  {
    "path": "Order/logs/Order-2020-06-05-1.log",
    "chars": 2868,
    "preview": "[2020-06-05 23:59:49.755] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigura"
  },
  {
    "path": "Order/logs/Order.log",
    "chars": 43191,
    "preview": "[2020-09-18 18:46:56.843] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigura"
  },
  {
    "path": "Order/pom.xml",
    "chars": 3463,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Order/postgresql/1-create_table_orders.sql",
    "chars": 467,
    "preview": "-- Table: public.ORDERS\n\n-- DROP TABLE public.\"ORDERS\";\n\nCREATE TABLE public.\"ORDERS\"\n(\n    order_id bigint NOT NULL,\n  "
  },
  {
    "path": "Order/postgresql/2-create_sequence_order_id.sql",
    "chars": 312,
    "preview": "-- SEQUENCE: public.order_id_seq\n\n-- DROP SEQUENCE public.order_id_seq;\n\nCREATE SEQUENCE public.order_id_seq\n    INCREME"
  },
  {
    "path": "Order/postgresql/3-create_function_create_order.sql",
    "chars": 1371,
    "preview": "-- FUNCTION: public.create_order(character varying, timestamp with time zone, double precision, text)\n\n-- DROP FUNCTION "
  },
  {
    "path": "Order/postgresql/4-create_table_order_product.sql",
    "chars": 731,
    "preview": "-- Table: public.ORDERS_PRODUCTS\n\n-- DROP TABLE public.\"ORDERS_PRODUCTS\";\n\nCREATE TABLE public.\"ORDERS_PRODUCTS\"\n(\n    o"
  },
  {
    "path": "Order/postgresql/5-create_order_product_id_seq.sql",
    "chars": 352,
    "preview": "-- SEQUENCE: public.order_product_id_seq\n\n-- DROP SEQUENCE public.order_product_id_seq;\n\nCREATE SEQUENCE public.order_pr"
  },
  {
    "path": "Order/postgresql/6-create_function_get_order.sql",
    "chars": 1434,
    "preview": "-- FUNCTION: public.get_order(bigint)\n\n-- DROP FUNCTION public.get_order(bigint);\n\nCREATE OR REPLACE FUNCTION public.get"
  },
  {
    "path": "Product/.gitignore",
    "chars": 333,
    "preview": "HELP.md\ntarget/\n!.mvn/wrapper/maven-wrapper.jar\n!**/src/main/**\n!**/src/test/**\n\n### STS ###\n.apt_generated\n.classpath\n."
  },
  {
    "path": "Product/README.md",
    "chars": 830,
    "preview": "# Products Microservice\n\nExample of Products Microservice applying Hexagonal Architecture pattern, Domain Driven Design "
  },
  {
    "path": "Product/pom.xml",
    "chars": 3715,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/ProductApplication.java",
    "chars": 341,
    "preview": "package com.jmendoza.swa.hexagonal.product;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframewo"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/controller/ProductController.java",
    "chars": 2418,
    "preview": "package com.jmendoza.swa.hexagonal.product.application.rest.controller;\n\nimport com.jmendoza.swa.hexagonal.product.appli"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/request/README.md",
    "chars": 118,
    "preview": "*In this directory you can add specialized requests, to only request minimum data, for example CreateProductRequest.*\n"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/response/CreateProductResponse.java",
    "chars": 322,
    "preview": "package com.jmendoza.swa.hexagonal.product.application.rest.response;\n\nimport com.fasterxml.jackson.annotation.JsonInclu"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/soap/README.md",
    "chars": 132,
    "preview": "*In this directory you can add another type of adapter to access the domain, for example a ProductController class to ex"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/config/README.md",
    "chars": 96,
    "preview": "*In this directory you can add settings for the infrastructure layer or the application layer.*\n"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/constants/ProductConstanst.java",
    "chars": 614,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.constants;\n\npublic class ProductConstanst {\n    public static final St"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/customannotations/UseCase.java",
    "chars": 398,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.customannotations;\n\nimport org.springframework.core.annotation.AliasFo"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/CustomExceptionHandler.java",
    "chars": 1782,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.exception;\n\nimport org.apache.logging.log4j.LogManager;\nimport org.apa"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ErrorDetails.java",
    "chars": 285,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.exception;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Getter;\n\ni"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/GlobalException.java",
    "chars": 508,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.spr"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ParameterNotFoundException.java",
    "chars": 532,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.spr"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ResourceNotFoundException.java",
    "chars": 527,
    "preview": "package com.jmendoza.swa.hexagonal.product.common.exception;\n\nimport org.springframework.http.HttpStatus;\nimport org.spr"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/model/Product.java",
    "chars": 361,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.model;\n\nimport lombok.Getter;\nimport lombok.Setter;\nimport lombok.ToSt"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/CreateProductUseCase.java",
    "chars": 427,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.product.common.excep"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/DeleteProductUseCase.java",
    "chars": 263,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.product.common.excep"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductUseCase.java",
    "chars": 325,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.product.common.excep"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductsUseCase.java",
    "chars": 347,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;\n\nimport com.jmendoza.swa.hexagonal.product.common.excep"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/CreateProductPort.java",
    "chars": 212,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.product.domain.mode"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/DeleteProductPort.java",
    "chars": 212,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.product.domain.mode"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/ExistsProductPort.java",
    "chars": 161,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;\n\npublic interface ExistsProductPort {\n    boolean exis"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductIdPort.java",
    "chars": 247,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.product.domain.mode"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductsPort.java",
    "chars": 226,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;\n\nimport com.jmendoza.swa.hexagonal.product.domain.mode"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/CreateProductService.java",
    "chars": 2263,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.services;\n\nimport com.jmendoza.swa.hexagonal.product.common.constants."
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/DeleteProductService.java",
    "chars": 1162,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.services;\n\nimport com.jmendoza.swa.hexagonal.product.common.constants."
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductService.java",
    "chars": 960,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.services;\n\nimport com.jmendoza.swa.hexagonal.product.common.constants."
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductsService.java",
    "chars": 1041,
    "preview": "package com.jmendoza.swa.hexagonal.product.domain.services;\n\nimport com.jmendoza.swa.hexagonal.product.common.constants."
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/CreateProductAdapter.java",
    "chars": 589,
    "preview": "package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.product.do"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/DeleteProductAdapter.java",
    "chars": 591,
    "preview": "package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.product.do"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ExistsProductAdapter.java",
    "chars": 568,
    "preview": "package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.product.do"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductIdAdapter.java",
    "chars": 629,
    "preview": "package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.product.do"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductsAdapter.java",
    "chars": 603,
    "preview": "package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.product.do"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ProductRepository.java",
    "chars": 406,
    "preview": "package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;\n\nimport com.jmendoza.swa.hexagonal.product.do"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/postgresql/README.md",
    "chars": 83,
    "preview": "*In this directory you can add another type of DB adapter for example PostgreSQL.*\n"
  },
  {
    "path": "Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/messagebroker/README.md",
    "chars": 123,
    "preview": "*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ"
  },
  {
    "path": "Product/src/main/resources/application.properties",
    "chars": 314,
    "preview": "# Application Server\nserver.port=3001\n\n# MongoDB Atlas\nspring.data.mongodb.uri=mongodb+srv://jmendoza:zuZYkSpMIpSGqgLD@c"
  },
  {
    "path": "Product/src/main/resources/log4j2.xml",
    "chars": 1858,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Don't forget to set system property -Dlog4j2.contextSelector=org.apache.logg"
  },
  {
    "path": "Product/src/test/java/com/jmendoza/swa/hexagonal/product/ProductApplicationTests.java",
    "chars": 236,
    "preview": "package com.jmendoza.swa.hexagonal.product;\n\nimport org.junit.jupiter.api.Test;\nimport org.springframework.boot.test.con"
  },
  {
    "path": "README.md",
    "chars": 4229,
    "preview": "# Hexagonal-Architecture-DDD\n\nPorts and Adapters or also known as Hexagonal Architecture, is a popular architecture inve"
  },
  {
    "path": "logs/Customer.log",
    "chars": 13170,
    "preview": "[2020-06-05 19:35:13.967] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Starting Cus"
  },
  {
    "path": "logs/Order.log",
    "chars": 46257,
    "preview": "[2020-06-04 20:02:21.856] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderAppl"
  },
  {
    "path": "logs/Product.log",
    "chars": 11922,
    "preview": "[2020-06-05 19:40:06.294] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.product.ProductApplication] | Starting Produ"
  },
  {
    "path": "prtsc/Hexagonal-Architecture-Microservices.drawio",
    "chars": 2599,
    "preview": "<mxfile host=\"www.draw.io\" modified=\"2020-06-04T16:25:55.399Z\" agent=\"5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,"
  }
]

About this extraction

This page contains the full source code of the JonathanM2ndoza/Hexagonal-Architecture-DDD GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 143 files (221.3 KB), approximately 70.7k tokens, and a symbol index with 202 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!