tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/SSLCertificateService.java
private void deleteMeataDataIfOwnerPermissionFailed(SSLCertificateOnboardRequest sslCertificateRequest,
			ResponseEntity<String> permissionResponse) {
		boolean isDeleted = false;
		if (permissionResponse != null && !(HttpStatus.OK.equals(permissionResponse.getStatusCode()))) {
			String certificateName = sslCertificateRequest.getCertificateName();
			log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "Onboard SSL certificate")
					.put(LogMessage.MESSAGE,
							String.format(" [%s] - ERROR - Sudo Policy Creation Failed  ",
									certificateName))
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL))
					.build()));
			SSLCertificateMetadataDetails certificateMetaData = certificateUtils.getCertificateMetaData(
					tokenUtils.getSelfServiceToken(), certificateName,
					sslCertificateRequest.getCertType());
			String metaDataPath = (sslCertificateRequest.getCertType().equalsIgnoreCase(SSLCertificateConstants.INTERNAL))
					? SSLCertificateConstants.SSL_CERT_PATH
					: SSLCertificateConstants.SSL_EXTERNAL_CERT_PATH;
			String certificatePath = metaDataPath + '/' + certificateName;
			isDeleted = deleteMetaDataAndPermissions(certificateMetaData, certificatePath,
					tokenUtils.getSelfServiceToken());
			if (isDeleted) {
				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] - ERROR - Metadata and policy deletion Completed  ",
										certificateName))
						.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL))
						.build()));
			}
		}
	}
/**
	 * Method to process and call the deleteMetaDataAndPermissions method for
	 * deleting the metadata and permissions
	 *
	 * @param sslCertificateRequest
	 * @param permissionResponse
	 */
Method to process and call the deleteMetaDataAndPermissions method for
deleting the metadata and permissions

@param sslCertificateRequest
@param permissionResponse
Method to process and call the deleteMetaDataAndPermissions method for deleting the metadata and permissions @param sslCertificateRequest @param permissionResponse
private void deleteMeataDataIfOwnerPermissionFailed(SSLCertificateOnboardRequest sslCertificateRequest,
			ResponseEntity<String> permissionResponse) {
		boolean isDeleted = false;
		if (permissionResponse != null && !(HttpStatus.OK.equals(permissionResponse.getStatusCode()))) {
			String certificateName = sslCertificateRequest.getCertificateName();
			log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder()
					.put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER))
					.put(LogMessage.ACTION, "Onboard SSL certificate")
					.put(LogMessage.MESSAGE,
							String.format(" [%s] - ERROR - Sudo Policy Creation Failed  ",
									certificateName))
					.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL))
					.build()));
			SSLCertificateMetadataDetails certificateMetaData = certificateUtils.getCertificateMetaData(
					tokenUtils.getSelfServiceToken(), certificateName,
					sslCertificateRequest.getCertType());
			String metaDataPath = (sslCertificateRequest.getCertType().equalsIgnoreCase(SSLCertificateConstants.INTERNAL))
					? SSLCertificateConstants.SSL_CERT_PATH
					: SSLCertificateConstants.SSL_EXTERNAL_CERT_PATH;
			String certificatePath = metaDataPath + '/' + certificateName;
			isDeleted = deleteMetaDataAndPermissions(certificateMetaData, certificatePath,
					tokenUtils.getSelfServiceToken());
			if (isDeleted) {
				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] - ERROR - Metadata and policy deletion Completed  ",
										certificateName))
						.put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL))
						.build()));
			}
		}
	}
private void deleteMeataDataIfOwnerPermissionFailed ( SSLCertificateOnboardRequest sslCertificateRequest , ResponseEntity < String > permissionResponse ) { boolean isDeleted = false ; if ( permissionResponse != null && ! ( HttpStatus . OK . equals ( permissionResponse . getStatusCode ( ) ) ) ) { String certificateName = sslCertificateRequest . getCertificateName ( ) ; log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , "Onboard SSL certificate" ) . put ( LogMessage . MESSAGE , String . format ( " [%s] - ERROR - Sudo Policy Creation Failed  " , certificateName ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; SSLCertificateMetadataDetails certificateMetaData = certificateUtils . getCertificateMetaData ( tokenUtils . getSelfServiceToken ( ) , certificateName , sslCertificateRequest . getCertType ( ) ) ; String metaDataPath = ( sslCertificateRequest . getCertType ( ) . equalsIgnoreCase ( SSLCertificateConstants . INTERNAL ) ) ? SSLCertificateConstants . SSL_CERT_PATH : SSLCertificateConstants . SSL_EXTERNAL_CERT_PATH ; String certificatePath = metaDataPath + '/' + certificateName ; isDeleted = deleteMetaDataAndPermissions ( certificateMetaData , certificatePath , tokenUtils . getSelfServiceToken ( ) ) ; if ( isDeleted ) { 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] - ERROR - Metadata and policy deletion Completed  " , certificateName ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; } } }
Method to process and call the deleteMetaDataAndPermissions method for
 deleting the metadata and permissions
Method to process and call the deleteMetaDataAndPermissions method for deleting the metadata and permissions