Skip to content

Commit

Permalink
code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
manuraf committed Nov 10, 2023
1 parent bc188ef commit 0ba5e0c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ public class OnboardingFunctions {
public static final String SEND_MAIL_REGISTRATION_REQUEST_ACTIVITY_NAME = "SendMailRegistrationRequest";
public static final String SEND_MAIL_REGISTRATION_APPROVE_ACTIVITY_NAME = "SendMailRegistrationApprove";
public static final String SEND_MAIL_ONBOARDING_APPROVE_ACTIVITY_NAME = "SendMailOnboardingApprove";
@Inject
OnboardingService service;

@Inject
ObjectMapper objectMapper;
private final OnboardingService service;

private final ObjectMapper objectMapper;

public OnboardingFunctions(OnboardingService service, ObjectMapper objectMapper) {
this.service = service;
this.objectMapper = objectMapper;
}

private static final TaskOptions optionsRetry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ public class ContractServiceDefault implements ContractService {
private static final Logger log = LoggerFactory.getLogger(ContractServiceDefault.class);
public static final String PDF_FORMAT_FILENAME = "%s.pdf";

@Inject
AzureStorageConfig azureStorageConfig;
private final AzureStorageConfig azureStorageConfig;

@Inject
AzureBlobClient azureBlobClient;
private final AzureBlobClient azureBlobClient;

public ContractServiceDefault(AzureStorageConfig azureStorageConfig, AzureBlobClient azureBlobClient) {
this.azureStorageConfig = azureStorageConfig;
this.azureBlobClient = azureBlobClient;
}

/**
* Creates a PDF contract document from a given contract template file and institution data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ public class NotificationServiceDefault implements NotificationService {

private static final Logger log = LoggerFactory.getLogger(NotificationServiceDefault.class);

final private MailTemplatePlaceholdersConfig templatePlaceholdersConfig;
final private MailTemplatePathConfig templatePathConfig;
final private AzureBlobClient azureBlobClient;
final private ObjectMapper objectMapper;
final private ContractService contractService;
final private String senderMail;
final private Boolean destinationMailTest;
final private String destinationMailTestAddress;

final private String notificationAdminMail;
final private Mailer mailer;
private final MailTemplatePlaceholdersConfig templatePlaceholdersConfig;
private final MailTemplatePathConfig templatePathConfig;
private final AzureBlobClient azureBlobClient;
private final ObjectMapper objectMapper;
private final ContractService contractService;
private final String senderMail;
private final Boolean destinationMailTest;
private final String destinationMailTestAddress;

private final String notificationAdminMail;
private final Mailer mailer;

public NotificationServiceDefault(MailTemplatePlaceholdersConfig templatePlaceholdersConfig, MailTemplatePathConfig templatePathConfig,
AzureBlobClient azureBlobClient, ObjectMapper objectMapper, Mailer mailer, ContractService contractService,
Expand Down Expand Up @@ -158,7 +158,7 @@ private void sendMailWithFile(List<String> destinationMail, String templateName,

log.info("End of sending mail to {}, with subject {}", destinationMail, subject);
} catch (Exception e) {
log.error(ERROR_DURING_SEND_MAIL + ":" + e.getMessage());
log.error(String.format("%s: %s", ERROR_DURING_SEND_MAIL, e.getMessage()));
throw new GenericOnboardingException(ERROR_DURING_SEND_MAIL.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class OnboardingService {

public static final String USERS_FIELD_LIST = "fiscalCode,familyName,name";
public static final String TOKEN_DOES_NOT_EXISTS_FOR_ONBOARDING_S = "Token does not exists for onboarding %s";
public static final String loggedUserName = "example";
public static final String loggedUserSurname = "example";

@RestClient
@Inject
Expand Down Expand Up @@ -119,7 +121,7 @@ public void sendMailRegistration(Onboarding onboarding) {
Product product = productService.getProduct(onboarding.getProductId());

notificationService.sendMailRegistration(onboarding.getInstitution().getDescription(),
onboarding.getInstitution().getDigitalAddress(), "example", "example",
onboarding.getInstitution().getDigitalAddress(), loggedUserName, loggedUserSurname,
product.getTitle());

}
Expand All @@ -131,7 +133,7 @@ public void sendMailRegistrationWithContract(Onboarding onboarding) {
Product product = productService.getProduct(onboarding.getProductId());

notificationService.sendMailRegistrationWithContract(onboarding.getOnboardingId(),
onboarding.getInstitution().getDigitalAddress(), "example", "example",
onboarding.getInstitution().getDigitalAddress(), loggedUserName, loggedUserSurname,
product.getTitle(), token.getId().toHexString());
}

Expand All @@ -155,7 +157,7 @@ public void sendMailRegistrationApprove(Onboarding onboarding) {
Product product = productService.getProduct(onboarding.getProductId());

notificationService.sendMailRegistrationApprove(onboarding.getInstitution().getDescription(),
"example", "example", product.getTitle(), token.getId().toHexString());
loggedUserName, loggedUserSurname, product.getTitle(), token.getId().toHexString());

}

Expand All @@ -166,7 +168,7 @@ public void sendMailOnboardingApprove(Onboarding onboarding) {
Product product = productService.getProduct(onboarding.getProductId());

notificationService.sendMailOnboardingApprove(onboarding.getInstitution().getDescription(),
"example", "example", product.getTitle(), token.getId().toHexString());
loggedUserName, loggedUserSurname, product.getTitle(), token.getId().toHexString());

}
}

0 comments on commit 0ba5e0c

Please sign in to comment.