tvaultapi/src/main/java/com/tmobile/cso/vault/api/controller/ControllerUtil.java
public static Response updateMetadataOnSvcaccPwdReset(Map<String,String> params,String token){
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
				put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
				put(LogMessage.ACTION, UPDATEMETADATASTR).
				put(LogMessage.MESSAGE, "Trying to upate metadata on Service account password reset").
				put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
				build()));
		String _type = params.get("type");
		String path = params.get("path");
		path = METADATASTR+path;

		ObjectMapper objMapper = new ObjectMapper();
		String pathjson =PATHSTR+path+"\"}";
		// Read info for the path
		Response metadataResponse = reqProcessor.process(READSTR,pathjson,token);
		Map<String,Object> _metadataMap = null;
		if(HttpStatus.OK.equals(metadataResponse.getHttpstatus())){
			try {
				_metadataMap = objMapper.readValue(metadataResponse.getResponse(), new TypeReference<Map<String,Object>>() {});
			} catch (IOException e) {
				log.error(e);
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
						put(LogMessage.ACTION, UPDATEMETADATASTR).
						put(LogMessage.MESSAGE, String.format ("Error creating _metadataMap for type [%s] and path [%s] message [%s]", _type, path, e.getMessage())).
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
						build()));
			}

			@SuppressWarnings("unchecked")
			Map<String,Object> metadataMap = (Map<String,Object>) _metadataMap.get("data");

			@SuppressWarnings("unchecked")
			boolean initialPasswwordReset = (boolean) metadataMap.get(_type);
			if(StringUtils.isEmpty(initialPasswwordReset) || !initialPasswwordReset) {
				metadataMap.put(_type, true);
				String metadataJson = "";
				try {
					metadataJson = objMapper.writeValueAsString(metadataMap);
				} catch (JsonProcessingException e) {
					log.error(e);
					log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
							put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
							put(LogMessage.ACTION, UPDATEMETADATASTR).
							put(LogMessage.MESSAGE, String.format ("Error in creating metadataJson for type [%s] and path [%s] with message [%s]", _type, path, e.getMessage())).
							put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
							build()));
				}

				String writeJson =  PATHSTR+path+DATASTR+ metadataJson +"}";
				metadataResponse = reqProcessor.process(WRITESTR,writeJson,token);
				return metadataResponse;
			}
            return metadataResponse;
		}
		return null;
	}
/**
	 * Update metadata for the service account on password reset
	 * @param params
	 * @param token
	 * @return
	 */
Update metadata for the service account on password reset
@param params
@param token
@return
Update metadata for the service account on password reset @param params @param token @return
public static Response updateMetadataOnSvcaccPwdReset(Map<String,String> params,String token){
		log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
				put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
				put(LogMessage.ACTION, UPDATEMETADATASTR).
				put(LogMessage.MESSAGE, "Trying to upate metadata on Service account password reset").
				put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
				build()));
		String _type = params.get("type");
		String path = params.get("path");
		path = METADATASTR+path;
		ObjectMapper objMapper = new ObjectMapper();
		String pathjson =PATHSTR+path+"\"}";
		Response metadataResponse = reqProcessor.process(READSTR,pathjson,token);
		Map<String,Object> _metadataMap = null;
		if(HttpStatus.OK.equals(metadataResponse.getHttpstatus())){
			try {
				_metadataMap = objMapper.readValue(metadataResponse.getResponse(), new TypeReference<Map<String,Object>>() {});
			} catch (IOException e) {
				log.error(e);
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
						put(LogMessage.ACTION, UPDATEMETADATASTR).
						put(LogMessage.MESSAGE, String.format ("Error creating _metadataMap for type [%s] and path [%s] message [%s]", _type, path, e.getMessage())).
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
						build()));
			}
			@SuppressWarnings("unchecked")
			Map<String,Object> metadataMap = (Map<String,Object>) _metadataMap.get("data");
			@SuppressWarnings("unchecked")
			boolean initialPasswwordReset = (boolean) metadataMap.get(_type);
			if(StringUtils.isEmpty(initialPasswwordReset) || !initialPasswwordReset) {
				metadataMap.put(_type, true);
				String metadataJson = "";
				try {
					metadataJson = objMapper.writeValueAsString(metadataMap);
				} catch (JsonProcessingException e) {
					log.error(e);
					log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
							put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()).
							put(LogMessage.ACTION, UPDATEMETADATASTR).
							put(LogMessage.MESSAGE, String.format ("Error in creating metadataJson for type [%s] and path [%s] with message [%s]", _type, path, e.getMessage())).
							put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()).
							build()));
				}
				String writeJson =  PATHSTR+path+DATASTR+ metadataJson +"}";
				metadataResponse = reqProcessor.process(WRITESTR,writeJson,token);
				return metadataResponse;
			}
            return metadataResponse;
		}
		return null;
	}
public static Response updateMetadataOnSvcaccPwdReset ( Map < String , String > params , String token ) { log . debug ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) . toString ( ) ) . put ( LogMessage . ACTION , UPDATEMETADATASTR ) . put ( LogMessage . MESSAGE , "Trying to upate metadata on Service account password reset" ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) . toString ( ) ) . build ( ) ) ) ; String _type = params . get ( "type" ) ; String path = params . get ( "path" ) ; path = METADATASTR + path ; ObjectMapper objMapper = new ObjectMapper ( ) ; String pathjson = PATHSTR + path + "\"}" ; Response metadataResponse = reqProcessor . process ( READSTR , pathjson , token ) ; Map < String , Object > _metadataMap = null ; if ( HttpStatus . OK . equals ( metadataResponse . getHttpstatus ( ) ) ) { try { _metadataMap = objMapper . readValue ( metadataResponse . getResponse ( ) , new TypeReference < Map < String , Object > > ( ) { } ) ; } catch ( IOException e ) { log . error ( e ) ; log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) . toString ( ) ) . put ( LogMessage . ACTION , UPDATEMETADATASTR ) . put ( LogMessage . MESSAGE , String . format ( "Error creating _metadataMap for type [%s] and path [%s] message [%s]" , _type , path , e . getMessage ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) . toString ( ) ) . build ( ) ) ) ; } @ SuppressWarnings ( "unchecked" ) Map < String , Object > metadataMap = ( Map < String , Object > ) _metadataMap . get ( "data" ) ; @ SuppressWarnings ( "unchecked" ) boolean initialPasswwordReset = ( boolean ) metadataMap . get ( _type ) ; if ( StringUtils . isEmpty ( initialPasswwordReset ) || ! initialPasswwordReset ) { metadataMap . put ( _type , true ) ; String metadataJson = "" ; try { metadataJson = objMapper . writeValueAsString ( metadataMap ) ; } catch ( JsonProcessingException e ) { log . error ( e ) ; log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) . toString ( ) ) . put ( LogMessage . ACTION , UPDATEMETADATASTR ) . put ( LogMessage . MESSAGE , String . format ( "Error in creating metadataJson for type [%s] and path [%s] with message [%s]" , _type , path , e . getMessage ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) . toString ( ) ) . build ( ) ) ) ; } String writeJson = PATHSTR + path + DATASTR + metadataJson + "}" ; metadataResponse = reqProcessor . process ( WRITESTR , writeJson , token ) ; return metadataResponse ; } return metadataResponse ; } return null ; }
Update metadata for the service account on password reset
 @param params
 @param token
 @return
Update metadata for the service account on password reset @param params @param token @return
// Read info for the path