Skip to content

Commit

Permalink
SELC-5438: Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenbegiqi committed Sep 3, 2024
1 parent bfae9ca commit bd16437
Show file tree
Hide file tree
Showing 14 changed files with 491 additions and 64 deletions.
47 changes: 47 additions & 0 deletions apps/onboarding-cdc/.factorypath
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<factorypath>
<factorypathentry kind="VARJAR" id="M2_REPO/org/mapstruct/mapstruct-processor/1.5.5.Final/mapstruct-processor-1.5.5.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.28/lombok-1.18.28.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok-mapstruct-binding/0.2.0/lombok-mapstruct-binding-0.2.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-panache-common/3.5.2/quarkus-panache-common-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-core/3.5.2/quarkus-core-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/enterprise/jakarta.enterprise.cdi-api/4.0.1/jakarta.enterprise.cdi-api-4.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/enterprise/jakarta.enterprise.lang-model/4.0.1/jakarta.enterprise.lang-model-4.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/el/jakarta.el-api/5.0.0/jakarta.el-api-5.0.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/interceptor/jakarta.interceptor-api/2.1.0/jakarta.interceptor-api-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/inject/jakarta.inject-api/2.0.1/jakarta.inject-api-2.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-os/2.1.2/smallrye-common-os-2.1.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-ide-launcher/3.5.2/quarkus-ide-launcher-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-development-mode-spi/3.5.2/quarkus-development-mode-spi-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/config/smallrye-config/3.4.4/smallrye-config-3.4.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/config/smallrye-config-core/3.4.4/smallrye-config-core-3.4.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/microprofile/config/microprofile-config-api/3.0.3/microprofile-config-api-3.0.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-annotation/2.2.0/smallrye-common-annotation-2.2.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-classloader/2.2.0/smallrye-common-classloader-2.2.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm/9.5/asm-9.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/config/smallrye-config-common/3.4.4/smallrye-config-common-3.4.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/logging/jboss-logging/3.5.3.Final/jboss-logging-3.5.3.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/logmanager/jboss-logmanager/3.0.2.Final/jboss-logmanager-3.0.2.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-constraint/2.1.0/smallrye-common-constraint-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-cpu/2.1.0/smallrye-common-cpu-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-expression/2.1.0/smallrye-common-expression-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-function/2.1.0/smallrye-common-function-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-net/2.1.0/smallrye-common-net-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-ref/2.1.0/smallrye-common-ref-2.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/json/jakarta.json-api/2.1.2/jakarta.json-api-2.1.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/parsson/parsson/1.1.4/parsson-1.1.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/2.0.6/slf4j-api-2.0.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/slf4j/slf4j-jboss-logmanager/2.0.0.Final/slf4j-jboss-logmanager-2.0.0.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-bootstrap-runner/3.5.2/quarkus-bootstrap-runner-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/common/smallrye-common-io/2.1.2/smallrye-common-io-2.1.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/github/crac/org-crac/0.1.3/org-crac-0.1.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-fs-util/0.0.9/quarkus-fs-util-0.0.9.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/quarkus-arc/3.5.2/quarkus-arc-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/quarkus/arc/arc/3.5.2/arc-3.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/transaction/jakarta.transaction-api/2.0.1/jakarta.transaction-api-2.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/smallrye/reactive/mutiny/2.2.0/mutiny-2.2.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.3/microprofile-context-propagation-api-1.3.jar" enabled="true" runInBatchMode="false"/>
</factorypath>
96 changes: 86 additions & 10 deletions apps/onboarding-ms/src/main/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@
"name" : "support"
} ],
"paths" : {
"/v1/aggregates/verification" : {
"/v1/aggregates/prova" : {
"get" : {
"tags" : [ "Aggregates Controller" ],
"responses" : {
"200" : {
"description" : "OK",
"content" : {
"text/plain" : {
"schema" : {
"type" : "string"
}
}
}
}
}
}
},
"/v1/aggregates/verification/appio" : {
"post" : {
"tags" : [ "Aggregates Controller" ],
"summary" : "Validate the data related to the aggregated entities present in a CSV file",
Expand Down Expand Up @@ -55,17 +72,76 @@
}
}
}
},
"401" : {
"description" : "Not Authorized"
},
"403" : {
"description" : "Not Allowed"
}
}
}
},
"/v1/aggregates/verification/pagopa" : {
"post" : {
"tags" : [ "Aggregates Controller" ],
"summary" : "Validate the data related to the aggregated entities present in a CSV file",
"requestBody" : {
"content" : {
"multipart/form-data" : {
"schema" : {
"required" : [ "aggregates" ],
"type" : "object",
"properties" : {
"aggregates" : {
"format" : "binary",
"type" : "string"
}
}
}
}
}
},
"security" : [ {
"SecurityScheme" : [ ]
} ]
"responses" : {
"200" : {
"description" : "OK",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/VerifyAggregateResponse"
}
}
}
}
}
}
},
"/v1/aggregates/verification/send" : {
"post" : {
"tags" : [ "Aggregates Controller" ],
"summary" : "Validate the data related to the aggregated entities present in a CSV file",
"requestBody" : {
"content" : {
"multipart/form-data" : {
"schema" : {
"required" : [ "aggregates" ],
"type" : "object",
"properties" : {
"aggregates" : {
"format" : "binary",
"type" : "string"
}
}
}
}
}
},
"responses" : {
"200" : {
"description" : "OK",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/VerifyAggregateResponse"
}
}
}
}
}
}
},
"/v1/notification/resend" : {
Expand Down
67 changes: 60 additions & 7 deletions apps/onboarding-ms/src/main/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,66 @@ tags:
- name: internal-v1
- name: support
paths:
/v1/aggregates/verification:
/v1/aggregates/prova:
get:
tags:
- Aggregates Controller
responses:
"200":
description: OK
content:
text/plain:
schema:
type: string
/v1/aggregates/verification/appio:
post:
tags:
- Aggregates Controller
summary: Validate the data related to the aggregated entities present in a CSV
file
requestBody:
content:
multipart/form-data:
schema:
required:
- aggregates
type: object
properties:
aggregates:
format: binary
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/VerifyAggregateResponse"
/v1/aggregates/verification/pagopa:
post:
tags:
- Aggregates Controller
summary: Validate the data related to the aggregated entities present in a CSV
file
requestBody:
content:
multipart/form-data:
schema:
required:
- aggregates
type: object
properties:
aggregates:
format: binary
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/VerifyAggregateResponse"
/v1/aggregates/verification/send:
post:
tags:
- Aggregates Controller
Expand All @@ -40,12 +99,6 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/VerifyAggregateResponse"
"401":
description: Not Authorized
"403":
description: Not Allowed
security:
- SecurityScheme: []
/v1/notification/resend:
post:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import it.pagopa.selfcare.onboarding.service.AggregatesService;
import jakarta.inject.Inject;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import lombok.AllArgsConstructor;
import org.eclipse.microprofile.openapi.annotations.Operation;
Expand All @@ -18,7 +15,7 @@

import java.io.File;

@Authenticated
//@Authenticated
@Path("/v1/aggregates")
@Tag(name = "Aggregates Controller")
@AllArgsConstructor
Expand All @@ -29,12 +26,37 @@ public class AggregatesController {

@Operation(summary = "Validate the data related to the aggregated entities present in a CSV file")
@POST
@Path("/verification")
@Path("/verification/appio")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Uni<VerifyAggregateResponse> verifyAggregatesCsv(@NotNull @RestForm("aggregates") File file){
public Uni<VerifyAggregateResponse> verifyAppIoAggregatesCsv(@NotNull @RestForm("aggregates") File file){

return aggregatesService.validateAggregatesCsv(file);
return aggregatesService.validateAppIoAggregatesCsv(file);
}
@Path("prova")
@GET
public String vv () {
return "ciao";
}

@Operation(summary = "Validate the data related to the aggregated entities present in a CSV file")
@POST
@Path("/verification/send")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Uni<VerifyAggregateResponse> verifySendAggregatesCsv(@NotNull @RestForm("aggregates") File file){

return aggregatesService.validateSendAggregatesCsv(file);
}

@Operation(summary = "Validate the data related to the aggregated entities present in a CSV file")
@POST
@Path("/verification/pagopa")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Uni<VerifyAggregateResponse> verifyPagoPaAggregatesCsv(@NotNull @RestForm("aggregates") File file){

return aggregatesService.validatePagoPaAggregatesCsv(file);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
import java.util.List;

public class AggregatesCsvResponse {
private List<CsvAggregate> csvAggregateList;
private List<CsvAggregate> validAggregates = new ArrayList<>();
private List<Csv> csvAggregateList;
private List<Csv> validAggregates = new ArrayList<>();
private List<RowError> rowErrorList;

public AggregatesCsvResponse(List<CsvAggregate> csvAggregateList, List<RowError> rowErrorList) {
public AggregatesCsvResponse(List<Csv> csvAggregateList, List<RowError> rowErrorList) {
this.csvAggregateList = csvAggregateList;
this.rowErrorList = rowErrorList;
}

public List<CsvAggregate> getCsvAggregateList() {
public List<Csv> getCsvAggregateList() {
return csvAggregateList;
}

public void setCsvAggregateList(List<CsvAggregate> csvAggregateList) {
public void setCsvAggregateList(List<Csv> Csv) {
this.csvAggregateList = csvAggregateList;
}

public List<CsvAggregate> getValidAggregates() {
public List<Csv> getValidAggregates() {
return validAggregates;
}

public void setValidAggregates(List<CsvAggregate> validAggregates) {
public void setValidAggregates(List<Csv> Csv) {
this.validAggregates = validAggregates;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package it.pagopa.selfcare.onboarding.model;

public interface Csv {
void setRowNumber(int lineNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import lombok.Data;

@Data
public class CsvAggregate {
public class CsvAggregate implements Csv {

@CsvBindByPosition(position = 0)
private String taxCode;
Expand All @@ -23,5 +23,10 @@ public class CsvAggregate {

private Integer rowNumber;

@Override
public void setRowNumber(int lineNumber) {
this.rowNumber = lineNumber;
}


}
Loading

0 comments on commit bd16437

Please sign in to comment.