tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/SSLCertificateService.java
private ResponseEntity<String> processAndSaveCertificateMetadata(SSLCertificateOnboardRequest sslCertificateRequest,
			UserDetails userDetails, int containerId, String nclmAccessToken) {
		try {
			ResponseEntity<String> metadataResponse = createCertificateMetadataAndPolicies(sslCertificateRequest,
					userDetails, containerId, nclmAccessToken);

			if (metadataResponse != null && !HttpStatus.OK.equals(metadataResponse.getStatusCode())) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
						.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
						.put(LogMessage.ACTION, SSLCertificateConstants.ONBOARD_SSL_CERTIFICATE)
						.put(LogMessage.MESSAGE,
								String.format("[%s] - Certficate metadata creation failed.  ",
										sslCertificateRequest.getCertificateName()))
						.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
				return ResponseEntity.status(HttpStatus.FORBIDDEN)
						.body(ERRORS + "Certficate metadata creation failed. " + "\"]}");
			} else if (metadataResponse != null && HttpStatus.OK.equals(metadataResponse.getStatusCode())) {
				log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
						.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
						.put(LogMessage.ACTION, SSLCertificateConstants.ONBOARD_SSL_CERTIFICATE)
						.put(LogMessage.MESSAGE,
								String.format("[%s] - Certficate onboarding is successfully - completed.  ",
										sslCertificateRequest.getCertificateName()))
						.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));

			}
		} catch (Exception ex) {
			log.error(
					JSONUtil.getJSON(ImmutableMap.<String, String>builder()
							.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
							.put(LogMessage.ACTION, SSLCertificateConstants.ONBOARD_SSL_CERTIFICATE)
							.put(LogMessage.MESSAGE, String.format(
									"Onboardcertificate Exception = [%s] =  Message [%s] = certificate name = [%s]",
									Arrays.toString(ex.getStackTrace()), ex.getMessage(),
									sslCertificateRequest.getCertificateName()))
							.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL))
							.build()));

			return ResponseEntity.status(HttpStatus.FORBIDDEN)
					.body(ERRORS + "Certificate onboard failed. " + "\"]}");
		}
		return ResponseEntity.status(HttpStatus.OK)
				.body("{\"messages\":[\"Certficate onboarding is successfully completed.\"]}");
	}
/**
     * Method to Create policies and metadata for the given certificate
     * @param certObject
     */
Method to Create policies and metadata for the given certificate
@param certObject
Method to Create policies and metadata for the given certificate @param certObject
private ResponseEntity<String> processAndSaveCertificateMetadata(SSLCertificateOnboardRequest sslCertificateRequest,
			UserDetails userDetails, int containerId, String nclmAccessToken) {
		try {
			ResponseEntity<String> metadataResponse = createCertificateMetadataAndPolicies(sslCertificateRequest,
					userDetails, containerId, nclmAccessToken);
			if (metadataResponse != null && !HttpStatus.OK.equals(metadataResponse.getStatusCode())) {
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
						.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
						.put(LogMessage.ACTION, SSLCertificateConstants.ONBOARD_SSL_CERTIFICATE)
						.put(LogMessage.MESSAGE,
								String.format("[%s] - Certficate metadata creation failed.  ",
										sslCertificateRequest.getCertificateName()))
						.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
				return ResponseEntity.status(HttpStatus.FORBIDDEN)
						.body(ERRORS + "Certficate metadata creation failed. " + "\"]}");
			} else if (metadataResponse != null && HttpStatus.OK.equals(metadataResponse.getStatusCode())) {
				log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
						.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
						.put(LogMessage.ACTION, SSLCertificateConstants.ONBOARD_SSL_CERTIFICATE)
						.put(LogMessage.MESSAGE,
								String.format("[%s] - Certficate onboarding is successfully - completed.  ",
										sslCertificateRequest.getCertificateName()))
						.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build()));
			}
		} catch (Exception ex) {
			log.error(
					JSONUtil.getJSON(ImmutableMap.<String, String>builder()
							.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
							.put(LogMessage.ACTION, SSLCertificateConstants.ONBOARD_SSL_CERTIFICATE)
							.put(LogMessage.MESSAGE, String.format(
									"Onboardcertificate Exception = [%s] =  Message [%s] = certificate name = [%s]",
									Arrays.toString(ex.getStackTrace()), ex.getMessage(),
									sslCertificateRequest.getCertificateName()))
							.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL))
							.build()));
			return ResponseEntity.status(HttpStatus.FORBIDDEN)
					.body(ERRORS + "Certificate onboard failed. " + "\"]}");
		}
		return ResponseEntity.status(HttpStatus.OK)
				.body("{\"messages\":[\"Certficate onboarding is successfully completed.\"]}");
	}
private ResponseEntity < String > processAndSaveCertificateMetadata ( SSLCertificateOnboardRequest sslCertificateRequest , UserDetails userDetails , int containerId , String nclmAccessToken ) { try { ResponseEntity < String > metadataResponse = createCertificateMetadataAndPolicies ( sslCertificateRequest , userDetails , containerId , nclmAccessToken ) ; if ( metadataResponse != null && ! HttpStatus . OK . equals ( metadataResponse . getStatusCode ( ) ) ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , SSLCertificateConstants . ONBOARD_SSL_CERTIFICATE ) . put ( LogMessage . MESSAGE , String . format ( "[%s] - Certficate metadata creation failed.  " , sslCertificateRequest . getCertificateName ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; return ResponseEntity . status ( HttpStatus . FORBIDDEN ) . body ( ERRORS + "Certficate metadata creation failed. " + "\"]}" ) ; } else if ( metadataResponse != null && HttpStatus . OK . equals ( metadataResponse . getStatusCode ( ) ) ) { log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , SSLCertificateConstants . ONBOARD_SSL_CERTIFICATE ) . put ( LogMessage . MESSAGE , String . format ( "[%s] - Certficate onboarding is successfully - completed.  " , sslCertificateRequest . getCertificateName ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; } } catch ( Exception ex ) { log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , SSLCertificateConstants . ONBOARD_SSL_CERTIFICATE ) . put ( LogMessage . MESSAGE , String . format ( "Onboardcertificate Exception = [%s] =  Message [%s] = certificate name = [%s]" , Arrays . toString ( ex . getStackTrace ( ) ) , ex . getMessage ( ) , sslCertificateRequest . getCertificateName ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; return ResponseEntity . status ( HttpStatus . FORBIDDEN ) . body ( ERRORS + "Certificate onboard failed. " + "\"]}" ) ; } return ResponseEntity . status ( HttpStatus . OK ) . body ( "{\"messages\":[\"Certficate onboarding is successfully completed.\"]}" ) ; }
Method to Create policies and metadata for the given certificate
 @param certObject
Method to Create policies and metadata for the given certificate @param certObject