Skip to content

Commit

Permalink
Fixed logic into workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
giampieroferrara committed Jan 20, 2025
1 parent 91c024a commit bd5faae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void onboardingsOrchestrator(
case CONFIRMATION_AGGREGATE ->
workflowExecutor = new WorkflowExecutorConfirmAggregate(objectMapper, optionsRetry);
case IMPORT -> workflowExecutor = new WorkflowExecutorImport(objectMapper, optionsRetry);
case IMPORT_AGGREGATION -> workflowExecutor = new WorkflowExecutorImportAggregation(objectMapper, optionsRetry);
case IMPORT_AGGREGATION -> workflowExecutor = new WorkflowExecutorImportAggregation(objectMapper, optionsRetry, onboardingMapper);
case USERS -> workflowExecutor = new WorkflowExecutorForUsers(objectMapper, optionsRetry);
case INCREMENT_REGISTRATION_AGGREGATOR ->
workflowExecutor =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package it.pagopa.selfcare.onboarding.workflow;

import static it.pagopa.selfcare.onboarding.entity.OnboardingWorkflowType.INSTITUTION;
import static it.pagopa.selfcare.onboarding.utils.Utils.readOnboardingValue;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.microsoft.durabletask.TaskOptions;
Expand All @@ -9,9 +10,10 @@
import it.pagopa.selfcare.onboarding.entity.Onboarding;
import it.pagopa.selfcare.onboarding.entity.OnboardingWorkflow;
import it.pagopa.selfcare.onboarding.entity.OnboardingWorkflowInstitution;
import it.pagopa.selfcare.onboarding.mapper.OnboardingMapper;
import java.util.Optional;

public record WorkflowExecutorImportAggregation(ObjectMapper objectMapper, TaskOptions optionsRetry) implements WorkflowExecutor {
public record WorkflowExecutorImportAggregation(ObjectMapper objectMapper, TaskOptions optionsRetry, OnboardingMapper onboardingMapper) implements WorkflowExecutor {

@Override
public Optional<OnboardingStatus> executeRequestState(TaskOrchestrationContext ctx, OnboardingWorkflow onboardingWorkflow) {
Expand All @@ -25,11 +27,17 @@ public Optional<OnboardingStatus> executeToBeValidatedState(TaskOrchestrationCon

@Override
public Optional<OnboardingStatus> executePendingState(TaskOrchestrationContext ctx, OnboardingWorkflow onboardingWorkflow) {
return onboardingCompletionActivityWithoutMail(ctx, onboardingWorkflow.getOnboarding());
String onboardingWithInstitutionIdString = createInstitutionAndOnboarding(ctx, onboardingWorkflow.getOnboarding());
Onboarding onboarding = readOnboardingValue(objectMapper(), onboardingWithInstitutionIdString);

createInstitutionAndOnboardingAggregate(ctx, onboarding, onboardingMapper());

return Optional.of(OnboardingStatus.COMPLETED);
}

@Override
public OnboardingWorkflow createOnboardingWorkflow(Onboarding onboarding) {
return new OnboardingWorkflowInstitution(onboarding, INSTITUTION.name());
}

}

0 comments on commit bd5faae

Please sign in to comment.