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); } }