tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/SSLCertificateService.java
private void processWorkloadDetailsAndConstructMetadata(SSLCertificateOnboardRequest sslCertificateRequest,
			SSLCertificateMetadataDetails sslCertificateMetadataDetails, String applicationName, JsonObject response) {
		String projectLeadEmail = "";
		JsonObject jsonElement = null;
		if (Objects.nonNull(response)) {
			jsonElement = response.get("spec").getAsJsonObject();
			if (Objects.nonNull(jsonElement)) {
				String applicationTag = validateString(jsonElement.get("tag"));
				projectLeadEmail = validateString(jsonElement.get("projectLeadEmail"));

				if (projectLeadEmail != null && !StringUtils.isEmpty(projectLeadEmail)) {
					String[] projectLeadEmails = Arrays.stream(projectLeadEmail.split(",")).map(String::trim)
							.toArray(String[]::new);
					sslCertificateMetadataDetails.setProjectLeadEmailId(projectLeadEmails[0]);
				} else {
					log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
							.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
							.put(LogMessage.ACTION, SSLCertificateConstants.POPULATE_ONBOARD_METADATA)
							.put(LogMessage.MESSAGE,
									String.format(
											"Project lead email id is not available for given "
													+ "certificate = [%s]",
											sslCertificateRequest.getCertificateName()))
							.build()));
					projectLeadEmail = sslCertificateRequest.getCertOwnerEmailId();
					sslCertificateMetadataDetails
							.setProjectLeadEmailId(sslCertificateRequest.getCertOwnerEmailId());
				}
				String appOwnerEmail = validateString(jsonElement.get("brtContactEmail"));
				String akmid = validateString(jsonElement.get("akmid"));
				String notificationEmails = sslCertificateRequest.getNotificationEmail();
				log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
						.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
						.put(LogMessage.ACTION, "Populate Application details in SSL Certificate Metadata")
						.put(LogMessage.MESSAGE,
								String.format("Application Details  for an "
										+ "applicationName = [%s] , applicationTag = [%s], "
										+ "projectLeadEmail =  [%s],appOwnerEmail =  [%s], akmid = [%s]",
										applicationName, applicationTag, projectLeadEmail, appOwnerEmail,
										akmid))
						.build()));

				sslCertificateMetadataDetails.setAkmid(akmid);
				sslCertificateMetadataDetails.setApplicationOwnerEmailId(appOwnerEmail);
				sslCertificateMetadataDetails.setApplicationTag(applicationTag);
				sslCertificateMetadataDetails.setApplicationName(applicationName);
				String[] notifEmailLst = notificationEmails.split(",");
				notifEmailLst = Arrays.stream(notifEmailLst).map(String::toLowerCase).distinct().toArray(String[]::new);
				sslCertificateMetadataDetails.setNotificationEmails(String.join(",", notifEmailLst));
			}
		}
	}
/**
	 * Method to process workload details and construct the metadata for onboarding the certificate
	 * @param sslCertificateRequest
	 * @param sslCertificateMetadataDetails
	 * @param applicationName
	 * @param response
	 */
Method to process workload details and construct the metadata for onboarding the certificate
@param sslCertificateRequest
@param sslCertificateMetadataDetails
@param applicationName
@param response
Method to process workload details and construct the metadata for onboarding the certificate @param sslCertificateRequest @param sslCertificateMetadataDetails @param applicationName @param response
private void processWorkloadDetailsAndConstructMetadata(SSLCertificateOnboardRequest sslCertificateRequest,
			SSLCertificateMetadataDetails sslCertificateMetadataDetails, String applicationName, JsonObject response) {
		String projectLeadEmail = "";
		JsonObject jsonElement = null;
		if (Objects.nonNull(response)) {
			jsonElement = response.get("spec").getAsJsonObject();
			if (Objects.nonNull(jsonElement)) {
				String applicationTag = validateString(jsonElement.get("tag"));
				projectLeadEmail = validateString(jsonElement.get("projectLeadEmail"));
				if (projectLeadEmail != null && !StringUtils.isEmpty(projectLeadEmail)) {
					String[] projectLeadEmails = Arrays.stream(projectLeadEmail.split(",")).map(String::trim)
							.toArray(String[]::new);
					sslCertificateMetadataDetails.setProjectLeadEmailId(projectLeadEmails[0]);
				} else {
					log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
							.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
							.put(LogMessage.ACTION, SSLCertificateConstants.POPULATE_ONBOARD_METADATA)
							.put(LogMessage.MESSAGE,
									String.format(
											"Project lead email id is not available for given "
													+ "certificate = [%s]",
											sslCertificateRequest.getCertificateName()))
							.build()));
					projectLeadEmail = sslCertificateRequest.getCertOwnerEmailId();
					sslCertificateMetadataDetails
							.setProjectLeadEmailId(sslCertificateRequest.getCertOwnerEmailId());
				}
				String appOwnerEmail = validateString(jsonElement.get("brtContactEmail"));
				String akmid = validateString(jsonElement.get("akmid"));
				String notificationEmails = sslCertificateRequest.getNotificationEmail();
				log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
						.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
						.put(LogMessage.ACTION, "Populate Application details in SSL Certificate Metadata")
						.put(LogMessage.MESSAGE,
								String.format("Application Details  for an "
										+ "applicationName = [%s] , applicationTag = [%s], "
										+ "projectLeadEmail =  [%s],appOwnerEmail =  [%s], akmid = [%s]",
										applicationName, applicationTag, projectLeadEmail, appOwnerEmail,
										akmid))
						.build()));
				sslCertificateMetadataDetails.setAkmid(akmid);
				sslCertificateMetadataDetails.setApplicationOwnerEmailId(appOwnerEmail);
				sslCertificateMetadataDetails.setApplicationTag(applicationTag);
				sslCertificateMetadataDetails.setApplicationName(applicationName);
				String[] notifEmailLst = notificationEmails.split(",");
				notifEmailLst = Arrays.stream(notifEmailLst).map(String::toLowerCase).distinct().toArray(String[]::new);
				sslCertificateMetadataDetails.setNotificationEmails(String.join(",", notifEmailLst));
			}
		}
	}
private void processWorkloadDetailsAndConstructMetadata ( SSLCertificateOnboardRequest sslCertificateRequest , SSLCertificateMetadataDetails sslCertificateMetadataDetails , String applicationName , JsonObject response ) { String projectLeadEmail = "" ; JsonObject jsonElement = null ; if ( Objects . nonNull ( response ) ) { jsonElement = response . get ( "spec" ) . getAsJsonObject ( ) ; if ( Objects . nonNull ( jsonElement ) ) { String applicationTag = validateString ( jsonElement . get ( "tag" ) ) ; projectLeadEmail = validateString ( jsonElement . get ( "projectLeadEmail" ) ) ; if ( projectLeadEmail != null && ! StringUtils . isEmpty ( projectLeadEmail ) ) { String [ ] projectLeadEmails = Arrays . stream ( projectLeadEmail . split ( "," ) ) . map ( String :: trim ) . toArray ( String [ ] :: new ) ; sslCertificateMetadataDetails . setProjectLeadEmailId ( projectLeadEmails [ 0 ] ) ; } else { log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , SSLCertificateConstants . POPULATE_ONBOARD_METADATA ) . put ( LogMessage . MESSAGE , String . format ( "Project lead email id is not available for given " + "certificate = [%s]" , sslCertificateRequest . getCertificateName ( ) ) ) . build ( ) ) ) ; projectLeadEmail = sslCertificateRequest . getCertOwnerEmailId ( ) ; sslCertificateMetadataDetails . setProjectLeadEmailId ( sslCertificateRequest . getCertOwnerEmailId ( ) ) ; } String appOwnerEmail = validateString ( jsonElement . get ( "brtContactEmail" ) ) ; String akmid = validateString ( jsonElement . get ( "akmid" ) ) ; String notificationEmails = sslCertificateRequest . getNotificationEmail ( ) ; log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "Populate Application details in SSL Certificate Metadata" ) . put ( LogMessage . MESSAGE , String . format ( "Application Details  for an " + "applicationName = [%s] , applicationTag = [%s], " + "projectLeadEmail =  [%s],appOwnerEmail =  [%s], akmid = [%s]" , applicationName , applicationTag , projectLeadEmail , appOwnerEmail , akmid ) ) . build ( ) ) ) ; sslCertificateMetadataDetails . setAkmid ( akmid ) ; sslCertificateMetadataDetails . setApplicationOwnerEmailId ( appOwnerEmail ) ; sslCertificateMetadataDetails . setApplicationTag ( applicationTag ) ; sslCertificateMetadataDetails . setApplicationName ( applicationName ) ; String [ ] notifEmailLst = notificationEmails . split ( "," ) ; notifEmailLst = Arrays . stream ( notifEmailLst ) . map ( String :: toLowerCase ) . distinct ( ) . toArray ( String [ ] :: new ) ; sslCertificateMetadataDetails . setNotificationEmails ( String . join ( "," , notifEmailLst ) ) ; } } }
Method to process workload details and construct the metadata for onboarding the certificate
 @param sslCertificateRequest
 @param sslCertificateMetadataDetails
 @param applicationName
 @param response
Method to process workload details and construct the metadata for onboarding the certificate @param sslCertificateRequest @param sslCertificateMetadataDetails @param applicationName @param response