protected JSON json(MockHttpServletResponse response) throws UnsupportedEncodingException { String content = response.getContentAsString(); return JSONSerializer.toJSON(content); }
@Override public V fromJSON(JSONObject json) { V v = super.fromJSON(json); v.setRtLifetime(getJsonUtil().getJSONValueLong(json, getCK2().rtLifetime())); v.setIssuer(getJsonUtil().getJSONValueString(json, getCK2().issuer())); v.setSignTokens(getJsonUtil().getJSONValueBoolean(json, getCK2().signTokens())); v.setPublicClient(getJsonUtil().getJSONValueBoolean(json, getCK2().publicClient())); // JSON util returns false if missing key JSON cbs = (JSON) getJsonUtil().getJSONValue(json, getCK2().callbackUri()); if (cbs != null && cbs instanceof JSONArray) { JSONArray array = (JSONArray) json.getJSONObject(getJSONComponentName()).get(getCK2().callbackUri()); Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(array); v.setCallbackURIs(zzz); } JSON scopes = (JSON) getJsonUtil().getJSONValue(json, getCK2().scopes()); if (scopes != null && scopes instanceof JSONArray) { JSONArray array = (JSONArray) json.getJSONObject(getJSONComponentName()).get(getCK2().scopes()); Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(array); v.setScopes(zzz); } JSON ldaps = (JSON) getJsonUtil().getJSONValue(json, getCK2().ldap()); if (ldaps != null) { v.setLdaps(getLdapConfigurationUtil().fromJSON(ldaps)); } JSONObject config = (JSONObject) getJsonUtil().getJSONValue(json, getCK2().cfg()); if (config != null) { v.setConfig(config); } return v; }
protected JSON json(MockHttpServletResponse response) throws UnsupportedEncodingException { String content = response.getContentAsString(); return JSONSerializer.toJSON(content); }
public static Object fromString(String string) { return JSONSerializer.toJSON(string); }
public static JSON json(String content) { return JSONSerializer.toJSON(content); }
public static Set<SecurityIndexType> jsonToIndexesTypes(String json) { List<String> securityIndexesTypes = (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json)); Set<SecurityIndexType> securityIndexes = securityIndexesTypes.stream().map(SecurityIndexType::valueOf).collect(Collectors.toSet()); return securityIndexes; }
public void setApplicationsWithVersion(List<ApplicationWithVersion> applicationsWithVersion) { JSON json = JSONSerializer.toJSON(applicationsWithVersion); this.applicationsWithVersion = json.toString(); applicationsWithVersionList = null; }
public void setApplicationsFromApplicationServer(List<ApplicationsFromApplicationServer> applicationsFromApplicationServer) { JSON json = JSONSerializer.toJSON(applicationsFromApplicationServer); this.appsFromAppServer = json.toString(); }
public Object[] fromJsonArray(String json) { if (StringUtils.isEmpty(json)) return null; JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON( json ); JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setArrayMode( JsonConfig.MODE_OBJECT_ARRAY ); Object[] output = (Object[]) JSONSerializer.toJava( jsonArray, jsonConfig ); //instancjonowanie tablicy odpowiedniego typu Object[] concreteArrayOutput = ReflectionUtil.invokeArrayConstructor(returnedClass(), output.length); System.arraycopy(output, 0, concreteArrayOutput, 0, output.length); return concreteArrayOutput; } }
public static String actionsIdsToJson(List<String> actionsIds) { return JSONSerializer.toJSON(actionsIds).toString(); }
public static ActionParameters jsonToActionParameters(String json) { ActionParameters actionParameters = new ActionParameters(); if (json != null) { List<Object> parameters = (List<Object>) JSONSerializer.toJava(JSONSerializer.toJSON(json)); for (Object parameterObject : parameters) { JSONObject parameterJsonObject = JSONObject.fromObject(parameterObject);
public static String stateIdsToJson(Collection<Integer> statesIds) { return JSONSerializer.toJSON(statesIds).toString(); }
@Override public V fromMap(ConversionMap<String, Object> map, V v) { V st = super.fromMap(map, v); Object refreshToken = map.get(getTCK().refreshToken()); if (refreshToken != null) { if (refreshToken instanceof RefreshToken) { st.setRefreshToken((RefreshToken) refreshToken); } else { st.setRefreshToken(getTF2().getRefreshToken(refreshToken.toString())); } } st.setRefreshTokenValid(map.getBoolean(getTCK().refreshTokenValid())); st.setRefreshTokenLifetime(map.getLong(getTCK().expiresIn())); st.setCallback(map.getURI(getTCK().callbackUri())); st.setNonce(map.getString(getTCK().nonce())); if (map.get(getTCK().scopes()) != null) { net.sf.json.JSONArray json = (JSONArray) JSONSerializer.toJSON(map.get(getTCK().scopes())); Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(json); st.setScopes(zzz); } if (map.get(getTCK().authTime()) != null) { st.setAuthTime(map.getDate(getTCK().authTime)); } if (map.get(getTCK().states()) != null) { st.setState((JSONObject) JSONSerializer.toJSON(map.get(getTCK().states()))); } else { st.setState(new JSONObject()); } return st; }
public static String contingenciesIdsToJson(Collection<String> contingenciesIds) { return JSONSerializer.toJSON(contingenciesIds).toString(); }
public static String indexesDataToJson(Map<String, Boolean> indexesData) { return JSONSerializer.toJSON(indexesData).toString(); }