io.apiman.gateway.engine.beans.Api.getOrganizationId()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中io.apiman.gateway.engine.beans.Api.getOrganizationId()方法的一些代码示例,展示了Api.getOrganizationId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Api.getOrganizationId()方法的具体详情如下:
包路径:io.apiman.gateway.engine.beans.Api
类名称:Api
方法名:getOrganizationId

Api.getOrganizationId介绍

暂无

代码示例

代码示例来源:origin: apiman/apiman

  1. @Override
  2. public void listApis(String organizationId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
  3. // For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
  4. List<String> res = map.entrySet().stream()
  5. .map(Map.Entry::getValue)
  6. .filter(entity -> entity instanceof Api)
  7. .map(entity -> (Api) entity)
  8. .filter(api -> api.getOrganizationId().equals(organizationId))
  9. .map(api -> api.getApiId())
  10. .distinct()
  11. .collect(Collectors.toList());
  12. handler.handle(AsyncResultImpl.create(res));
  13. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. @Override
  2. public void listApiVersions(String organizationId, String apiId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
  3. // For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
  4. List<String> res = map.entrySet().stream()
  5. .map(Map.Entry::getValue)
  6. .filter(entity -> entity instanceof Api)
  7. .map(entity -> (Api) entity)
  8. .filter(api -> api.getOrganizationId().equals(organizationId) && api.getApiId().equals(apiId))
  9. .map(api -> api.getVersion())
  10. .distinct()
  11. .collect(Collectors.toList());
  12. handler.handle(AsyncResultImpl.create(res));
  13. }

代码示例来源:origin: apiman/apiman

  1. @Override
  2. public void listApiVersions(String organizationId, String apiId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
  3. // For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
  4. List<String> res = map.entrySet().stream()
  5. .map(Map.Entry::getValue)
  6. .filter(entity -> entity instanceof Api)
  7. .map(entity -> (Api) entity)
  8. .filter(api -> api.getOrganizationId().equals(organizationId) && api.getApiId().equals(apiId))
  9. .map(api -> api.getVersion())
  10. .distinct()
  11. .collect(Collectors.toList());
  12. handler.handle(AsyncResultImpl.create(res));
  13. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. @Override
  2. public void listApis(String organizationId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
  3. // For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
  4. List<String> res = map.entrySet().stream()
  5. .map(Map.Entry::getValue)
  6. .filter(entity -> entity instanceof Api)
  7. .map(entity -> (Api) entity)
  8. .filter(api -> api.getOrganizationId().equals(organizationId))
  9. .map(api -> api.getApiId())
  10. .distinct()
  11. .collect(Collectors.toList());
  12. handler.handle(AsyncResultImpl.create(res));
  13. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. @Override
  2. public void listOrgs(IAsyncResultHandler<List<String>> handler) {
  3. // TODO: We should track set of OrgId -> AtomicCounter if this API has meaningfully high usage.
  4. List<String> res = map.entrySet().stream()
  5. .map(Map.Entry::getValue)
  6. .map(elem -> {
  7. if (elem instanceof Api) {
  8. return ((Api) elem).getOrganizationId();
  9. } else {
  10. return ((Client) elem).getOrganizationId();
  11. }
  12. })
  13. .distinct()
  14. .collect(Collectors.toList());
  15. handler.handle(AsyncResultImpl.create(res));
  16. }

代码示例来源:origin: apiman/apiman

  1. @Override
  2. public void listOrgs(IAsyncResultHandler<List<String>> handler) {
  3. // TODO: We should track set of OrgId -> AtomicCounter if this API has meaningfully high usage.
  4. List<String> res = map.entrySet().stream()
  5. .map(Map.Entry::getValue)
  6. .map(elem -> {
  7. if (elem instanceof Api) {
  8. return ((Api) elem).getOrganizationId();
  9. } else {
  10. return ((Client) elem).getOrganizationId();
  11. }
  12. })
  13. .distinct()
  14. .collect(Collectors.toList());
  15. handler.handle(AsyncResultImpl.create(res));
  16. }

代码示例来源:origin: apiman/apiman

  1. /**
  2. * Generates an in-memory key for an api, used to index the client for later quick
  3. * retrieval.
  4. * @param api an api
  5. * @return a api key
  6. */
  7. private String getApiIndex(Api api) {
  8. return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
  9. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-es

  1. /**
  2. * Generates a valid document ID for a api, used to index the api in ES.
  3. * @param api an api
  4. * @return a api key
  5. */
  6. private String getApiId(Api api) {
  7. return getApiId(api.getOrganizationId(), api.getApiId(), api.getVersion());
  8. }

代码示例来源:origin: apiman/apiman

  1. /**
  2. * Generates a valid document ID for a api, used to index the api in ES.
  3. * @param api an api
  4. * @return a api key
  5. */
  6. private String getApiId(Api api) {
  7. return getApiId(api.getOrganizationId(), api.getApiId(), api.getVersion());
  8. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. /**
  2. * Generates an in-memory key for an api, used to index the client for later quick
  3. * retrieval.
  4. * @param api an api
  5. * @return a api key
  6. */
  7. private String getApiIndex(Api api) {
  8. return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
  9. }

代码示例来源:origin: apiman/apiman

  1. private String getApiIndex(Api api) {
  2. return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
  3. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-vertx-shareddata

  1. private String getApiIndex(Api api) {
  2. return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
  3. }

代码示例来源:origin: apiman/apiman

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  6. List<Policy> policies = api.getApiPolicies();
  7. encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  8. encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  9. delegate.publishApi(api, handler);
  10. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  11. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  12. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  6. List<Policy> policies = api.getApiPolicies();
  7. encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  8. encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  9. delegate.publishApi(api, handler);
  10. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  11. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  12. }

代码示例来源:origin: apiman/apiman

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  6. Connection conn = null;
  7. try {
  8. conn = ds.getConnection();
  9. conn.setAutoCommit(false);
  10. QueryRunner run = new QueryRunner();
  11. // First delete any record we might already have.
  12. run.update(conn, "DELETE FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$
  13. api.getOrganizationId(), api.getApiId(), api.getVersion());
  14. // Now insert a row for the api.
  15. String bean = mapper.writeValueAsString(api);
  16. run.update(conn, "INSERT INTO gw_apis (org_id, id, version, bean) VALUES (?, ?, ?, ?)", //$NON-NLS-1$
  17. api.getOrganizationId(), api.getApiId(), api.getVersion(), bean);
  18. DbUtils.commitAndClose(conn);
  19. handler.handle(AsyncResultImpl.create((Void) null, Void.class));
  20. } catch (SQLException | JsonProcessingException e) {
  21. handler.handle(AsyncResultImpl.create(e));
  22. }
  23. }

代码示例来源:origin: apiman/apiman

  1. /**
  2. * @see io.apiman.manager.api.gateway.IGatewayLink#retireApi(io.apiman.gateway.engine.beans.Api)
  3. */
  4. @Override
  5. public void retireApi(Api api) throws PublishingException, GatewayAuthenticationException {
  6. if (!isGatewayUp()) {
  7. throw new PublishingException(Messages.i18n.format("RestGatewayLink.GatewayNotRunning")); //$NON-NLS-1$
  8. }
  9. getClient().retire(api.getOrganizationId(), api.getApiId(), api.getVersion());
  10. }

代码示例来源:origin: apiman/apiman

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#retireApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void retireApi(Api api, IAsyncResultHandler<Void> handler) {
  6. QueryRunner run = new QueryRunner(ds);
  7. try {
  8. run.update("DELETE FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$
  9. api.getOrganizationId(), api.getApiId(), api.getVersion());
  10. handler.handle(AsyncResultImpl.create((Void) null, Void.class));
  11. } catch (SQLException e) {
  12. handler.handle(AsyncResultImpl.create(e));
  13. }
  14. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-jdbc

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#retireApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void retireApi(Api api, IAsyncResultHandler<Void> handler) {
  6. QueryRunner run = new QueryRunner(ds);
  7. try {
  8. run.update("DELETE FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$
  9. api.getOrganizationId(), api.getApiId(), api.getVersion());
  10. handler.handle(AsyncResultImpl.create((Void) null, Void.class));
  11. } catch (SQLException e) {
  12. handler.handle(AsyncResultImpl.create(e));
  13. }
  14. }

代码示例来源:origin: apiman/apiman

  1. @Override
  2. public void handle(IAsyncResult<ApiContract> result) {
  3. if (result.isSuccess()) {
  4. ApiContract contract = result.getResult();
  5. List<Policy> policies = contract.getPolicies();
  6. decryptPolicies(contract.getClient().getOrganizationId(),
  7. contract.getClient().getClientId(), contract.getClient().getVersion(),
  8. EntityType.ClientApp, policies);
  9. Api api = contract.getApi();
  10. if (api != null) {
  11. List<Policy> apiPolicies = api.getApiPolicies();
  12. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
  13. EntityType.Api, apiPolicies);
  14. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
  15. api.getVersion(), EntityType.Api, api.getEndpointProperties());
  16. }
  17. }
  18. handler.handle(result);
  19. }
  20. });

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. @Override
  2. public void handle(IAsyncResult<ApiContract> result) {
  3. if (result.isSuccess()) {
  4. ApiContract contract = result.getResult();
  5. List<Policy> policies = contract.getPolicies();
  6. decryptPolicies(contract.getClient().getOrganizationId(),
  7. contract.getClient().getClientId(), contract.getClient().getVersion(),
  8. EntityType.ClientApp, policies);
  9. Api api = contract.getApi();
  10. if (api != null) {
  11. List<Policy> apiPolicies = api.getApiPolicies();
  12. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
  13. EntityType.Api, apiPolicies);
  14. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
  15. api.getVersion(), EntityType.Api, api.getEndpointProperties());
  16. }
  17. }
  18. handler.handle(result);
  19. }
  20. });

相关文章