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

Make MailUtils lazy #2204

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading