Skip to content

Commit

Permalink
Make MailUtils lazy
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Nuyanzin <[email protected]>
  • Loading branch information
snuyanzin committed Jan 17, 2024
1 parent 090959a commit 94b1455
Show file tree
Hide file tree
Showing 11 changed files with 299 additions and 231 deletions.
32 changes: 0 additions & 32 deletions core/src/main/java/io/aiven/klaw/model/enums/MailType.java

This file was deleted.

13 changes: 10 additions & 3 deletions core/src/main/java/io/aiven/klaw/service/AclControllerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
import static io.aiven.klaw.error.KlawErrorMessages.REQ_ERR_101;
import static io.aiven.klaw.helpers.KwConstants.REQUESTOR_SUBSCRIPTIONS;
import static io.aiven.klaw.helpers.UtilMethods.updateEnvStatus;
import static io.aiven.klaw.model.enums.MailType.*;
import static io.aiven.klaw.service.MailUtils.MailType.ACL_DELETE_REQUESTED;
import static io.aiven.klaw.service.MailUtils.MailType.ACL_REQUESTED;
import static io.aiven.klaw.service.MailUtils.MailType.ACL_REQUEST_APPROVAL_ADDED;
import static io.aiven.klaw.service.MailUtils.MailType.ACL_REQUEST_APPROVED;
import static io.aiven.klaw.service.MailUtils.MailType.ACL_REQUEST_DENIED;
import static io.aiven.klaw.service.MailUtils.MailType.ACL_REQUEST_FAILURE;
import static org.springframework.beans.BeanUtils.copyProperties;

import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -34,6 +39,7 @@
import io.aiven.klaw.model.response.AclRequestsResponseModel;
import io.aiven.klaw.model.response.OffsetDetails;
import io.aiven.klaw.model.response.ServiceAccountDetails;
import io.aiven.klaw.service.MailUtils.MailType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -206,7 +212,8 @@ void handleIpAddressAndCNString(AclRequestsModel aclRequestsModel, AclRequests a
}

private ApiResponse executeAclRequestModel(
String userDetails, AclRequests aclRequestsDao, MailType mailType) throws KlawException {
String userDetails, AclRequests aclRequestsDao, MailUtils.MailType mailType)
throws KlawException {
try {
String execRes =
manageDatabase.getHandleDbRequests().requestForAcl(aclRequestsDao).get("result");
Expand Down Expand Up @@ -662,7 +669,7 @@ public ApiResponse approveAclRequests(String req_no)
updateAclReqStatus =
handleAclRequestClusterApiResponse(userDetails, dbHandle, aclReq, response, tenantId);

MailType notifyUserType = ACL_REQUEST_APPROVED;
MailUtils.MailType notifyUserType = ACL_REQUEST_APPROVED;
if (!updateAclReqStatus.equals(ApiResultStatus.SUCCESS.value)) {
notifyUserType = ACL_REQUEST_FAILURE;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import io.aiven.klaw.error.KlawException;
import io.aiven.klaw.helpers.HandleDbRequests;
import io.aiven.klaw.model.enums.ApprovalType;
import io.aiven.klaw.model.enums.MailType;
import io.aiven.klaw.model.enums.RequestEntityType;
import io.aiven.klaw.model.enums.RequestOperationType;
import io.aiven.klaw.service.MailUtils.MailType;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import static io.aiven.klaw.error.KlawErrorMessages.*;
import static io.aiven.klaw.helpers.KwConstants.ORDER_OF_KAFKA_CONNECT_ENVS;
import static io.aiven.klaw.model.enums.MailType.CONNECTOR_CLAIM_REQUESTED;
import static io.aiven.klaw.model.enums.MailType.CONNECTOR_CREATE_REQUESTED;
import static io.aiven.klaw.model.enums.MailType.CONNECTOR_DELETE_REQUESTED;
import static io.aiven.klaw.model.enums.MailType.CONNECTOR_REQUEST_APPROVED;
import static io.aiven.klaw.model.enums.MailType.CONNECTOR_REQUEST_DENIED;
import static io.aiven.klaw.service.MailUtils.MailType.CONNECTOR_CLAIM_REQUESTED;
import static io.aiven.klaw.service.MailUtils.MailType.CONNECTOR_CREATE_REQUESTED;
import static io.aiven.klaw.service.MailUtils.MailType.CONNECTOR_DELETE_REQUESTED;
import static io.aiven.klaw.service.MailUtils.MailType.CONNECTOR_REQUEST_APPROVED;
import static io.aiven.klaw.service.MailUtils.MailType.CONNECTOR_REQUEST_DENIED;
import static org.springframework.beans.BeanUtils.copyProperties;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down
Loading

0 comments on commit 94b1455

Please sign in to comment.