Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SELC-5434] feat: split csv aggregate API for some product #464

Merged
merged 12 commits into from
Sep 11, 2024
47 changes: 47 additions & 0 deletions apps/onboarding-cdc/.factorypath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be better to add this path inside .gitignore file because it is about eclipse project

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>
79 changes: 69 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,7 @@
"name" : "support"
} ],
"paths" : {
"/v1/aggregates/verification" : {
"/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 +55,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
56 changes: 49 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,55 @@ tags:
- name: internal-v1
- name: support
paths:
/v1/aggregates/verification:
/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 +88,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 @@ -29,12 +26,32 @@ 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);
}

@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 @@ -3,29 +3,29 @@
import java.util.ArrayList;
import java.util.List;

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

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

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

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

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

public void setValidAggregates(List<CsvAggregate> validAggregates) {
public void setValidAggregates(List<T> 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,24 +4,45 @@
import lombok.Data;

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

@CsvBindByPosition(position = 0)
private String taxCode;
@CsvBindByPosition(position = 1)
private String description;

@CsvBindByPosition(position = 1)
private String pec;

@CsvBindByPosition(position = 2)
private String vatNumber;
private String taxCode;

@CsvBindByPosition(position = 3)
private String subunitType;
private String vatNumber;

@CsvBindByPosition(position = 4)
private String subunitCode;
@CsvBindByPosition(position = 5)
private String address;

@CsvBindByPosition(position = 5)
private String city;

@CsvBindByPosition(position = 6)
private String originId;
private String province;

@CsvBindByPosition(position = 7)
private String ipaCode;

@CsvBindByPosition(position = 8)
private String subunitType;

@CsvBindByPosition(position = 9)
private String subunitCode;

@CsvBindByPosition(position = 10)
private String originId;
private Integer rowNumber;

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

}
Loading
Loading