tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/SSLCertificateService.java
private CertResponse prepareEnrollCARequest(CertResponse response){
        Gson gson = new GsonBuilder().setLenient().create();
        JsonObject json = gson.fromJson(response.getResponse(),JsonObject.class);
        JsonParser jsonParser = new JsonParser();
        JsonObject jsonObject = (JsonObject) jsonParser.parse(json.toString());
        JsonObject jsonObject1 = jsonObject.getAsJsonObject("ca");
        JsonArray jsonArray = jsonObject1.getAsJsonArray("items");
        JsonObject jsonObject2 = null;
        int selectedId = 0;
        for (int i = 0; i < jsonArray.size(); i++) {
            jsonObject2 = jsonArray.get(i).getAsJsonObject();
            if (jsonObject2.get("displayName").getAsString().equals("Entrust CA")) {
                selectedId = Integer.parseInt(jsonObject2.get("policyLinkId").getAsString());
            }
        }
        jsonObject1.addProperty("selectedId",selectedId);
        response.setResponse(jsonObject.toString());
        return response;
    }
/**
     * Update the selectedId value
     * @param response
     * @return
     */
Update the selectedId value
@param response
@return
Update the selectedId value @param response @return
private CertResponse prepareEnrollCARequest(CertResponse response){
        Gson gson = new GsonBuilder().setLenient().create();
        JsonObject json = gson.fromJson(response.getResponse(),JsonObject.class);
        JsonParser jsonParser = new JsonParser();
        JsonObject jsonObject = (JsonObject) jsonParser.parse(json.toString());
        JsonObject jsonObject1 = jsonObject.getAsJsonObject("ca");
        JsonArray jsonArray = jsonObject1.getAsJsonArray("items");
        JsonObject jsonObject2 = null;
        int selectedId = 0;
        for (int i = 0; i < jsonArray.size(); i++) {
            jsonObject2 = jsonArray.get(i).getAsJsonObject();
            if (jsonObject2.get("displayName").getAsString().equals("Entrust CA")) {
                selectedId = Integer.parseInt(jsonObject2.get("policyLinkId").getAsString());
            }
        }
        jsonObject1.addProperty("selectedId",selectedId);
        response.setResponse(jsonObject.toString());
        return response;
    }
private CertResponse prepareEnrollCARequest ( CertResponse response ) { Gson gson = new GsonBuilder ( ) . setLenient ( ) . create ( ) ; JsonObject json = gson . fromJson ( response . getResponse ( ) , JsonObject . class ) ; JsonParser jsonParser = new JsonParser ( ) ; JsonObject jsonObject = ( JsonObject ) jsonParser . parse ( json . toString ( ) ) ; JsonObject jsonObject1 = jsonObject . getAsJsonObject ( "ca" ) ; JsonArray jsonArray = jsonObject1 . getAsJsonArray ( "items" ) ; JsonObject jsonObject2 = null ; int selectedId = 0 ; for ( int i = 0 ; i < jsonArray . size ( ) ; i ++ ) { jsonObject2 = jsonArray . get ( i ) . getAsJsonObject ( ) ; if ( jsonObject2 . get ( "displayName" ) . getAsString ( ) . equals ( "Entrust CA" ) ) { selectedId = Integer . parseInt ( jsonObject2 . get ( "policyLinkId" ) . getAsString ( ) ) ; } } jsonObject1 . addProperty ( "selectedId" , selectedId ) ; response . setResponse ( jsonObject . toString ( ) ) ; return response ; }
Update the selectedId value
 @param response
 @return
Update the selectedId value @param response @return