Skip to content

Commit

Permalink
merged integration_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
candreac committed Oct 31, 2023
2 parents abf12ae + c6177b2 commit c91dd4d
Show file tree
Hide file tree
Showing 31 changed files with 538 additions and 243 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package it.gov.pagopa.atmlayer.service.model.client;

import io.smallrye.mutiny.Uni;
import it.gov.pagopa.atmlayer.service.model.dto.DeployResponseDto;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

@RegisterRestClient(configKey = "process-deploy")
public interface ProcessClient {
@POST
@Path("/api/v1/processes/deploy")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
Uni<DeployResponseDto> deploy(@FormParam("url") String url);
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
package it.gov.pagopa.atmlayer.service.model.constraint;

import it.gov.pagopa.atmlayer.service.model.validators.BankKeyValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.constraintvalidation.SupportedValidationTarget;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static jakarta.validation.constraintvalidation.ValidationTarget.ANNOTATED_ELEMENT;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Retention(RUNTIME)
@Constraint(validatedBy = BankKeyValidator.class)
@Target({ElementType.TYPE_USE, FIELD, METHOD, PARAMETER, ANNOTATION_TYPE})
@SupportedValidationTarget(ANNOTATED_ELEMENT)
@Documented
public @interface BankKeyConstraint {
String message() default "{the BankKey is invalid}";

Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};
}
//package it.gov.pagopa.atmlayer.service.model.constraint;
//
//import it.gov.pagopa.atmlayer.service.model.validators.BankKeyValidator;
//import jakarta.validation.Constraint;
//import jakarta.validation.Payload;
//import jakarta.validation.constraintvalidation.SupportedValidationTarget;
//
//import java.lang.annotation.Documented;
//import java.lang.annotation.ElementType;
//import java.lang.annotation.Retention;
//import java.lang.annotation.Target;
//
//import static jakarta.validation.constraintvalidation.ValidationTarget.ANNOTATED_ELEMENT;
//import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
//import static java.lang.annotation.ElementType.FIELD;
//import static java.lang.annotation.ElementType.METHOD;
//import static java.lang.annotation.ElementType.PARAMETER;
//import static java.lang.annotation.RetentionPolicy.RUNTIME;
//
//@Retention(RUNTIME)
//@Constraint(validatedBy = BankKeyValidator.class)
//@Target({ElementType.TYPE_USE, FIELD, METHOD, PARAMETER, ANNOTATION_TYPE})
//@SupportedValidationTarget(ANNOTATED_ELEMENT)
//@Documented
//public @interface BankKeyConstraint {
// String message() default "{the BankKey is invalid}";
//
// Class<?>[] groups() default {};
//
// Class<? extends Payload>[] payload() default {};
//}
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import it.gov.pagopa.atmlayer.service.model.constraint.BankKeyConstraint;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;
import java.util.UUID;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class BpmnAssociationDto {

private List<@BankKeyConstraint @Valid BankKeyDto> bankKeyDtoList;
private UUID defaultTemplateId;

private Long defaultTemplateVersion;

private List<BranchConfigs> branchesConfigs;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import it.gov.pagopa.atmlayer.service.model.enumeration.functionTypeEnum;
import it.gov.pagopa.atmlayer.service.model.enumeration.FunctionTypeEnum;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.ws.rs.FormParam;
Expand All @@ -26,5 +26,5 @@ public class BpmnCreationDto {

@FormParam("functionType")
@NotNull(message = "function type is required")
private functionTypeEnum functionType;
private FunctionTypeEnum functionType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.util.List;
import java.util.UUID;

@Data
public class BranchConfigs {
//TODO: Validatore custom
private String branchId;

private UUID branchDefaultTemplateId;

private Long branchDefaultTemplateVersion;

private List<TerminalConfigs> terminals;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DeployResponseDto {
private List<LinkDto> links;
private UUID id;
private String name;
private String source;
private String deploymentTime;
private String tenantId;
private Map<String, DeployedProcessInfoDto> deployedProcessDefinitions;
private String deployedCaseDefinitions;
private String deployedDecisionDefinitions;
private String deployedDecisionRequirementsDefinitions;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.UUID;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DeployedProcessInfoDto {
private String id;
private String key;
private String category;
private String description;
private String name;
private Integer version;
private String resource;
private UUID deploymentId;
private String diagram;
private Boolean suspended;
private String tenantId;
private String versionTag;
private int historyTimeToLeave;
private Boolean startableInTasklist;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class LinkDto {
private String method;
private String href;
private String rel;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package it.gov.pagopa.atmlayer.service.model.dto;

import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.util.List;
import java.util.UUID;

@Data
public class TerminalConfigs {
@NotNull
private UUID templateId;
@NotNull
private Long templateVersion;

private List<String> terminalIds;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
package it.gov.pagopa.atmlayer.service.model.entity;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
import it.gov.pagopa.atmlayer.service.model.enumeration.functionTypeEnum;
import jakarta.persistence.CascadeType;
import it.gov.pagopa.atmlayer.service.model.enumeration.FunctionTypeEnum;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinColumns;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand All @@ -37,7 +31,7 @@ public class BpmnBankConfig extends PanacheEntityBase implements Serializable {

@Column(name = "function_type")
@Enumerated(EnumType.STRING)
private functionTypeEnum functionType;
private FunctionTypeEnum functionType;

@Column(name = "enabled", columnDefinition = "boolean default true")
private Boolean enabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public class BpmnBankConfigPK implements Serializable {
@NotNull(message = "acquirer id cannot be null")
@Column(name = "acquirer_id")
private String acquirerId;

@Column(name = "branch_id")
private String branchId;
private String branchId = "null";

@Column(name = "terminal_id")
private String terminalId;
private String terminalId = "null";
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package it.gov.pagopa.atmlayer.service.model.entity;

import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
import it.gov.pagopa.atmlayer.service.model.enumeration.FunctionTypeEnum;
import it.gov.pagopa.atmlayer.service.model.enumeration.StatusEnum;
import it.gov.pagopa.atmlayer.service.model.enumeration.functionTypeEnum;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
Expand Down Expand Up @@ -47,9 +47,10 @@ public class BpmnVersion extends PanacheEntityBase implements Serializable {

@Column(name = "function_type")
@Enumerated(EnumType.STRING)
private functionTypeEnum functionType;
private FunctionTypeEnum functionType;

@Column(name = "status")
@Enumerated(EnumType.STRING)
private StatusEnum status;

@Column(name = "sha256", unique = true)
Expand Down Expand Up @@ -86,4 +87,5 @@ public class BpmnVersion extends PanacheEntityBase implements Serializable {

@Column(name = "last_updated_by")
private String lastUpdatedBy;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.CONSTRAINT_VIOLATION;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.GENERIC;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.INTERNAL;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.INVALID_FUNCTION_TYPE;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.NOT_DELETABLE;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.NOT_DEPLOYABLE_STATUS;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.NOT_DEPLOYED_STATUS;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType.NOT_EXISTING_REFERENCED_ENTITY;

/**
Expand All @@ -14,8 +18,12 @@
public enum AppErrorCodeEnum {

ATMLM_500("ATMLM_500", "An unexpected error has occurred, see logs for more info", GENERIC),
BPMN_FILE_WITH_SAME_CONTENT_ALREADY_EXIST("ATMLM_4000001", "A BPMN file with the same content already Exist", CONSTRAINT_VIOLATION),
BPMN_FILE_DOES_NOT_EXIST("ATMLM_4000002", "The referenced BPMN file does not exists", NOT_EXISTING_REFERENCED_ENTITY),
BPMN_FILE_WITH_SAME_CONTENT_ALREADY_EXIST("ATMLM_4000001", "A BPMN file with the same content already exists", CONSTRAINT_VIOLATION),
BPMN_FILE_DOES_NOT_EXIST("ATMLM_4000002", "The referenced BPMN file does not exist", NOT_EXISTING_REFERENCED_ENTITY),
BPMN_FILE_NOT_DEPLOYED("ATMLM_4000003", "The referenced BPMN file is not deployed", NOT_DEPLOYED_STATUS),
BPMN_FILE_CANNOT_BE_DEPLOYED("ATMLM_4000004", "The referenced BPMN file can not be deployed", NOT_DEPLOYABLE_STATUS),
BPMN_FUNCTION_TYPE_DIFFERENT_FROM_REQUESTED("ATMLM_4000005", "The referenced BPMN file has a function type different from the requested", INVALID_FUNCTION_TYPE),
BPMN_CANNOT_BE_DELETED_FOR_STATUS("ATMLM_4000006", "The referenced BPMN file can not be deleted in the actual state", NOT_DELETABLE),
OBJECT_STORE_SAVE_FILE_ERROR("ATMLM_4000100", "Error on persisting file on Object Store ", INTERNAL);

private final String errorCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
public enum AppErrorType {
GENERIC,
VALIDATION,
INTERNAL,
CONSTRAINT_VIOLATION,
NOT_EXISTING_REFERENCED_ENTITY
NOT_EXISTING_REFERENCED_ENTITY,
NOT_VALID_REFERENCED_ENTITY,
NOT_DEPLOYABLE_STATUS,
NOT_DEPLOYED_STATUS,
INVALID_FUNCTION_TYPE,
NOT_DELETABLE,
INTERNAL
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package it.gov.pagopa.atmlayer.service.model.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum BankConfigUtilityValues {
NULL_VALUE("NULL");

private String value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package it.gov.pagopa.atmlayer.service.model.enumeration;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum FunctionTypeEnum {
MENU("MENU"),
SPONTANEOUS_PAYMENT("SPONTANEOUS_PAYMENT");

@JsonValue
private String value;
}
Loading

0 comments on commit c91dd4d

Please sign in to comment.