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

Merge back from hotfix send user fd notification #559

Merged
merged 32 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
985b230
Update azure linux function app configuration
andrea-putzu Oct 4, 2024
ee09253
Update azure linux function app configuration (#527)
andrea-putzu Oct 7, 2024
004dbb7
[SELC-5332] Add gh infra apply pipeline (#535)
andrea-putzu Oct 8, 2024
3861fdd
chore: Working on send user notification
andrea-putzu Oct 15, 2024
4e776d0
Merge remote-tracking branch 'origin/releases/0.4.0' into releases/0.4.0
andrea-putzu Oct 15, 2024
be86016
chore: Working on send user notification
andrea-putzu Oct 15, 2024
2f33ea5
chore: Working on send user notification
andrea-putzu Oct 15, 2024
e4e53da
chore: Adding Test
andrea-putzu Oct 15, 2024
5840350
chore: Adding Test
andrea-putzu Oct 15, 2024
85b15a0
chore: Adding Test
andrea-putzu Oct 15, 2024
c8c2135
chore: Adding Test
andrea-putzu Oct 15, 2024
ed58da4
Merge branch 'feature/SELC-5779' into releases/0.4.0_user_fd_notifica…
andrea-putzu Oct 15, 2024
3d19a11
chore: Adding Logs
andrea-putzu Oct 15, 2024
33a7e2a
chore: Adding Logs
andrea-putzu Oct 15, 2024
66e8ffa
chore: Set createdAt as string
andrea-putzu Oct 15, 2024
ae6392c
chore: Set createdAt as string
andrea-putzu Oct 15, 2024
879763c
chore: Set createdAt as string
andrea-putzu Oct 15, 2024
8a0fdb3
chore: Set createdAt as string
andrea-putzu Oct 15, 2024
4492f5a
chore: Set createdAt as string
andrea-putzu Oct 15, 2024
b00d704
chore: Update model
andrea-putzu Oct 16, 2024
c418c55
chore: Update model
andrea-putzu Oct 16, 2024
d6bbf19
chore: Update model
andrea-putzu Oct 16, 2024
1f85a87
chore: Update model adding Z to date
andrea-putzu Oct 16, 2024
03bafe8
chore: Fix test model adding Z to date
andrea-putzu Oct 16, 2024
5867412
chore: Removing unused code
andrea-putzu Oct 16, 2024
e03a5b1
chore: Avoiding send too user notification
andrea-putzu Oct 17, 2024
2215da3
Merge branch 'main' into temp/back_from_0.4.0_fd
andrea-putzu Oct 21, 2024
0f41cb7
chore: Update test
andrea-putzu Oct 21, 2024
731b4ca
chore: Update test
andrea-putzu Oct 21, 2024
e50904a
chore: Update test
andrea-putzu Oct 21, 2024
4adc6c4
chore: Update test
andrea-putzu Oct 21, 2024
f92e909
chore: Update test
andrea-putzu Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package it.pagopa.selfcare.onboarding.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import it.pagopa.selfcare.onboarding.utils.CustomOffsetDateTimeSerializer;

import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class NotificationUserToSend {

private String id;
private String institutionId;
private String product;

private String onboardingTokenId;

private String createdAt;
@JsonSerialize(using = CustomOffsetDateTimeSerializer.class)
private OffsetDateTime closedAt;

private String updatedAt;

private NotificationUserType type;
private UserToNotify user;


public String getInstitutionId() {
return institutionId;
}

public void setInstitutionId(String institutionId) {
this.institutionId = institutionId;
}


public NotificationUserType getType() {
return type;
}

public void setType(NotificationUserType type) {
this.type = type;
}


public String getOnboardingTokenId() {
return onboardingTokenId;
}

public void setOnboardingTokenId(String onboardingTokenId) {
this.onboardingTokenId = onboardingTokenId;
}

public OffsetDateTime getClosedAt() {
return closedAt;
}

public void setClosedAt(OffsetDateTime closedAt) {
this.closedAt = closedAt;
}


public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getProduct() {
return product;
}

public void setProduct(String product) {
this.product = product;
}


public String getCreatedAt() {
return createdAt;
}

public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}

public String getUpdatedAt() {
return updatedAt;
}

public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}

public UserToNotify getUser() {
return user;
}

public void setUser(UserToNotify user) {
this.user = user;
}

@Override
public String toString() {
return "NotificationToSend{" +
"id='" + id + '\'' +
", institutionId='" + institutionId + '\'' +
", product='" + product + '\'' +
", onboardingTokenId='" + onboardingTokenId + '\'' +
", createdAt=" + createdAt +
", closedAt=" + closedAt +
", updatedAt=" + updatedAt +
", userId=" + user.getUserId() +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package it.pagopa.selfcare.onboarding.dto;

public enum NotificationUserType {
ADD_INSTITUTE(QueueUserEvent.ADD_INSTITUTE),
UPDATE_INSTITUTION(QueueUserEvent.UPDATE_INSTITUTION),
ACTIVE_USER(QueueUserEvent.ACTIVE_USER),
SUSPEND_USER(QueueUserEvent.SUSPEND_USER),
DELETE_USER(QueueUserEvent.DELETE_USER);


private final QueueUserEvent queueUserEvent;

NotificationUserType(QueueUserEvent queueUserEvent) {
this.queueUserEvent = queueUserEvent;
}

public static NotificationUserType getNotificationTypeFromQueueEvent(QueueUserEvent queueEvent) {
for (NotificationUserType notificationType : NotificationUserType.values()) {
if (notificationType.queueUserEvent == queueEvent) {
return notificationType;
}
}
return null; // Return null if no matching NotificationType is found
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package it.pagopa.selfcare.onboarding.dto;

public enum QueueUserEvent {
ADD_INSTITUTE,
UPDATE_INSTITUTION,
ACTIVE_USER,
SUSPEND_USER,
DELETE_USER
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package it.pagopa.selfcare.onboarding.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import it.pagopa.selfcare.onboarding.common.PartyRole;

import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserToNotify {

private String userId;
private String role;
private List<String> roles;

public String getUserId() {
return userId;
}

public void setUserId(String userId) {
this.userId = userId;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

public List<String> getRoles() {
return roles;
}

public void setRoles(List<String> roles) {
this.roles = roles;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public HttpResponseMessage startOrchestration(
try {

/* if timeout is null, caller wants response asynchronously */
if(Objects.isNull(timeoutString)) {
if (Objects.isNull(timeoutString)) {
return durableContext.createCheckStatusResponse(request, instanceId);
}

Expand All @@ -94,11 +94,11 @@ public HttpResponseMessage startOrchestration(
true);

boolean isFailed = Optional.ofNullable(metadata)
.map(orchestration -> OrchestrationRuntimeStatus.FAILED.equals(orchestration.getRuntimeStatus()) )
.map(orchestration -> OrchestrationRuntimeStatus.FAILED.equals(orchestration.getRuntimeStatus()))
.orElse(true);

return isFailed
? request.createResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR)
? request.createResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR)
.build()
: request.createResponseBuilder(HttpStatus.OK)
.build();
Expand All @@ -107,6 +107,7 @@ public HttpResponseMessage startOrchestration(
return durableContext.createCheckStatusResponse(request, instanceId);
}
}

@FunctionName(ONBOARDINGS_AGGREGATE_ORCHESTRATOR)
public void onboardingsAggregateOrchestrator(
@DurableOrchestrationTrigger(name = "taskOrchestrationContext") TaskOrchestrationContext ctx,
Expand All @@ -115,7 +116,7 @@ public void onboardingsAggregateOrchestrator(
try {
String onboardingAggregate = ctx.getInput(String.class);
boolean existsDelegation = Boolean.parseBoolean(ctx.callActivity(EXISTS_DELEGATION_ACTIVITY, onboardingAggregate, optionsRetry, String.class).await());
if(!existsDelegation) {
if (!existsDelegation) {
onboardingId = ctx.callActivity(CREATE_AGGREGATE_ONBOARDING_REQUEST_ACTIVITY, onboardingAggregate, optionsRetry, String.class).await();
ctx.callSubOrchestrator("Onboardings", onboardingId, String.class).await();
}
Expand Down Expand Up @@ -148,15 +149,19 @@ public void onboardingsOrchestrator(
.orElseThrow(() -> new ResourceNotFoundException(String.format("Onboarding with id %s not found!", onboardingId)));

switch (onboarding.getWorkflowType()) {
case CONTRACT_REGISTRATION -> workflowExecutor = new WorkflowExecutorContractRegistration(objectMapper, optionsRetry);
case CONTRACT_REGISTRATION_AGGREGATOR -> workflowExecutor = new WorkflowExecutorContractRegistrationAggregator(objectMapper, optionsRetry, onboardingMapper);
case FOR_APPROVE -> workflowExecutor = new WorkflowExecutorForApprove(objectMapper, optionsRetry);
case CONTRACT_REGISTRATION ->
workflowExecutor = new WorkflowExecutorContractRegistration(objectMapper, optionsRetry);
case CONTRACT_REGISTRATION_AGGREGATOR ->
workflowExecutor = new WorkflowExecutorContractRegistrationAggregator(objectMapper, optionsRetry, onboardingMapper);
case FOR_APPROVE -> workflowExecutor = new WorkflowExecutorForApprove(objectMapper, optionsRetry);
case FOR_APPROVE_PT -> workflowExecutor = new WorkflowExecutorForApprovePt(objectMapper, optionsRetry);
case CONFIRMATION -> workflowExecutor = new WorkflowExecutorConfirmation(objectMapper, optionsRetry);
case CONFIRMATION_AGGREGATE -> workflowExecutor = new WorkflowExecutorConfirmAggregate(objectMapper, optionsRetry);
case CONFIRMATION_AGGREGATE ->
workflowExecutor = new WorkflowExecutorConfirmAggregate(objectMapper, optionsRetry);
case IMPORT -> workflowExecutor = new WorkflowExecutorImport(objectMapper, optionsRetry);
case USERS -> workflowExecutor = new WorkflowExecutorForUsers(objectMapper, optionsRetry);
case INCREMENT_REGISTRATION_AGGREGATOR -> workflowExecutor = new WorkflowExecutorIncrementRegistrationAggregator(objectMapper, optionsRetry, onboardingMapper);
case INCREMENT_REGISTRATION_AGGREGATOR ->
workflowExecutor = new WorkflowExecutorIncrementRegistrationAggregator(objectMapper, optionsRetry, onboardingMapper);
case USERS_PG -> workflowExecutor = new WorkflowExecutorForUsersPg(objectMapper, optionsRetry);
default -> throw new IllegalArgumentException("Workflow options not found!");
}
Expand Down
Loading
Loading