public static void update(AccessGroup accessGroup, Policy policy) { accessGroup.setId(policy.getId()); accessGroup.setGroup(policy.getAuthId()); accessGroup.setDefault(false); accessGroup.getAccess().clear(); for (String apiId : policy.getApiIds()) { Access access = new Access(); accessGroup.getAccess().add(access); access.setId(apiId); } }
public static void update(AccessGroup accessGroup, Map<String, Api> apisById) { Iterator<Access> iterator = accessGroup.getAccess().iterator(); while (iterator.hasNext()) { Access access = iterator.next(); Api api = apisById.get(access.getId()); if (api == null) { iterator.remove(); continue; } update(access, api); } }
public static void update(Access access, Api api) { access.setUri(api.getRoutingUri()); access.setUriRegex(String.format(URI_REGEX_FORMAT, api.getCaptureUri())); access.getHttpMethods().clear(); access.getHttpMethods().add(HttpMethod.ALL); }