com.hortonworks.registries.common.QueryParam.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(84)

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

QueryParam.<init>介绍

暂无

代码示例

代码示例来源:origin: com.hortonworks.registries/common

public static List<QueryParam> params(String... args) {
    List<QueryParam> queryParams = new ArrayList<>();
    if (args.length % 2 != 0) {
      throw new IllegalArgumentException("Expects even number of arguments");
    }
    for (int i = 0; i < args.length; i += 2) {
      queryParams.add(new QueryParam(args[i], args[i + 1]));
    }
    return queryParams;
  }
}

代码示例来源:origin: hortonworks/registry

public static List<QueryParam> params(String... args) {
    List<QueryParam> queryParams = new ArrayList<>();
    if (args.length % 2 != 0) {
      throw new IllegalArgumentException("Expects even number of arguments");
    }
    for (int i = 0; i < args.length; i += 2) {
      queryParams.add(new QueryParam(args[i], args[i + 1]));
    }
    return queryParams;
  }
}

代码示例来源:origin: com.hortonworks.registries/registry-common

public static List<QueryParam> params(String... args) {
    List<QueryParam> queryParams = new ArrayList<>();
    if (args.length % 2 != 0) {
      throw new IllegalArgumentException("Expects even number of arguments");
    }
    for (int i = 0; i < args.length; i += 2) {
      queryParams.add(new QueryParam(args[i], args[i + 1]));
    }
    return queryParams;
  }
}

代码示例来源:origin: hortonworks/streamline

private Collection<TopologyStream> getStreamInfos() throws Exception {
  return catalogService.listStreamInfos(ImmutableList.<QueryParam>builder()
      .add(new QueryParam(TopologyRule.TOPOLOGY_ID, String.valueOf(topologyId)))
      .add(new QueryParam(TopologyStream.VERSIONID, String.valueOf(versionId)))
      .build());
}

代码示例来源:origin: hortonworks/streamline

public Collection<TopologyTestRunCase> listTopologyTestRunCase(Long topologyId, Long versionId) {
  List<QueryParam> queryParams = new ArrayList<>();
  queryParams.add(new QueryParam("topologyId", String.valueOf(topologyId)));
  queryParams.add(new QueryParam("versionId", String.valueOf(versionId)));
  return dao.find(TopologyTestRunCase.NAMESPACE, queryParams);
}

代码示例来源:origin: hortonworks/streamline

public Service getServiceByName(Long clusterId, String serviceName) {
  Collection<Service> services = listServices(
      Lists.newArrayList(new QueryParam("clusterId", String.valueOf(clusterId)), new QueryParam("name", serviceName)));
  if (services.size() > 1) {
    LOG.warn("Multiple Services have same name {} in cluster {}. returning first match.", serviceName, clusterId);
    return services.iterator().next();
  } else if (services.size() == 1) {
    return services.iterator().next();
  }
  return null;
}

代码示例来源:origin: com.hortonworks.registries/common

public static List<QueryParam> buildQueryParameters(MultivaluedMap<String, String> params) {
  if (params == null || params.isEmpty()) {
    return Collections.<QueryParam>emptyList();
  }
  List<QueryParam> queryParams = new ArrayList<>();
  for (String param : params.keySet()) {
    queryParams.add(new QueryParam(param, params.getFirst(param)));
  }
  return queryParams;
}

代码示例来源:origin: com.hortonworks.registries/registry-common

public static List<QueryParam> buildQueryParameters(MultivaluedMap<String, String> params) {
  if (params == null || params.isEmpty()) {
    return Collections.<QueryParam>emptyList();
  }
  List<QueryParam> queryParams = new ArrayList<>();
  for (String param : params.keySet()) {
    queryParams.add(new QueryParam(param, params.getFirst(param)));
  }
  return queryParams;
}

代码示例来源:origin: hortonworks/streamline

public ServiceBundle getServiceBundleByName(String serviceName) {
  Collection<ServiceBundle> serviceBundles = listServiceBundles(Lists.newArrayList(new QueryParam("name", serviceName)));
  if (serviceBundles.size() > 1) {
    LOG.warn("Multiple service bundles with the same name: {} returning first match.", serviceName);
    return serviceBundles.iterator().next();
  } else if (serviceBundles.size() == 1) {
    return serviceBundles.iterator().next();
  }
  return null;
}

代码示例来源:origin: hortonworks/streamline

public Collection<TopologyTestRunCaseSink> listTopologyTestRunCaseSink(Long testCaseId) {
  List<QueryParam> queryParams = new ArrayList<>();
  queryParams.add(new QueryParam("testCaseId", String.valueOf(testCaseId)));
  return dao.find(TopologyTestRunCaseSink.NAMESPACE, queryParams);
}

代码示例来源:origin: hortonworks/streamline

private List<QueryParam> queryParam(Topology topology) {
    List<QueryParam> queryParams = new ArrayList<>();
    queryParams.add(new QueryParam(TopologyComponent.TOPOLOGYID, topology.getId().toString()));
    queryParams.add(new QueryParam(TopologyComponent.VERSIONID, topology.getVersionId().toString()));
    return queryParams;
  }
}

代码示例来源:origin: hortonworks/streamline

private TopologyComponentBundle getCurrentTopologyComponentBundle(TopologyComponentBundle.TopologyComponentType type, String subType) {
  Collection<TopologyComponentBundle> bundles = listTopologyComponentBundlesForTypeWithFilter(type, Collections.singletonList(
      new QueryParam(TopologyComponentBundle.SUB_TYPE, subType)
  ));
  if (bundles.size() != 1) {
    throw new IllegalStateException("Not able to find topology component bundle for type " + type
    + " sub type " + subType);
  }
  return bundles.iterator().next();
}

代码示例来源:origin: hortonworks/registry

public static List<QueryParam> buildQueryParameters(MultivaluedMap<String, String> params) {
  if (params == null || params.isEmpty()) {
    return Collections.<QueryParam>emptyList();
  }
  List<QueryParam> queryParams = new ArrayList<>();
  for (String param : params.keySet()) {
    queryParams.add(new QueryParam(param, params.getFirst(param)));
  }
  return queryParams;
}

代码示例来源:origin: hortonworks/streamline

public Set<Long> getWidgetDatasourceMapping(Widget widget) {
  List<QueryParam> queryParams = Collections.singletonList(
      new QueryParam(WidgetDatasourceMap.WIDGET_ID, widget.getId().toString()));
  Collection<WidgetDatasourceMap> mappings = dao.find(WIDGET_DATASOURCE_MAPPING_NAMESPACE, queryParams);
  if (mappings != null) {
    return mappings.stream().map(WidgetDatasourceMap::getWidgetId).collect(Collectors.toSet());
  }
  return Collections.emptySet();
}

代码示例来源:origin: hortonworks/streamline

/**
   * See if there is already a jar with the same digest
   */
  private Optional<String> getExistingJarPath(String digest) {
    Collection<UDF> existing = catalogService.listUDFs(
        Collections.singletonList(new QueryParam(UDF.DIGEST, digest)));
    if (existing.size() >= 1) {
      return Optional.of(existing.iterator().next().getJarStoragePath());
    }
    return Optional.empty();
  }
}

代码示例来源:origin: hortonworks/streamline

private List<QueryParam> buildClusterIdAwareQueryParams(Long clusterId, UriInfo uriInfo) {
  List<QueryParam> queryParams = new ArrayList<>();
  queryParams.add(new QueryParam("clusterId", clusterId.toString()));
  if (uriInfo != null) {
    MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    if (!params.isEmpty()) {
      queryParams.addAll(WSUtils.buildQueryParameters(params));
    }
  }
  return queryParams;
}

代码示例来源:origin: hortonworks/streamline

public static List<QueryParam> buildTopologyIdAndVersionIdAwareQueryParams(Long topologyId,
                                     Long versionId,
                                     UriInfo uriInfo) {
  List<QueryParam> queryParams = new ArrayList<>();
  queryParams.add(new QueryParam(TOPOLOGY_ID, topologyId.toString()));
  queryParams.addAll(versionIdQueryParam(versionId));
  addQueryParams(uriInfo, queryParams);
  return queryParams;
}

代码示例来源:origin: hortonworks/registry

private SchemaBranch getSchemaBranch(Long id) throws SchemaBranchNotFoundException {
  List<QueryParam> schemaBranchQueryParam = new ArrayList<>();
  schemaBranchQueryParam.add(new QueryParam(SchemaBranchStorable.ID, id.toString()));
  Collection<SchemaBranchStorable> schemaBranchStorables = storageManager.find(SchemaBranchStorable.NAME_SPACE, schemaBranchQueryParam);
  if(schemaBranchStorables == null || schemaBranchStorables.isEmpty())
    throw new SchemaBranchNotFoundException(String.format("Schema branch with id : '%s' not found", id.toString()));
  // size of the collection will always be less than 2, as ID is a primary key, so no need handle the case where size > 1
  return schemaBranchStorables.iterator().next().toSchemaBranch();
}

代码示例来源:origin: hortonworks/streamline

public void setReconfigureOnAllComponentsInTopology(Topology topology) {
  List<TopologyComponent> topologyComponents = new ArrayList<>();
  List<com.hortonworks.registries.common.QueryParam> queryParams = new ArrayList<>();
  queryParams.add(new com.hortonworks.registries.common.QueryParam("topologyId", String.valueOf(topology.getId())));
  queryParams.add(new com.hortonworks.registries.common.QueryParam("versionId", String.valueOf(topology.getVersionId())));
  topologyComponents.addAll(listTopologySources(queryParams));
  topologyComponents.addAll(listTopologyProcessors(queryParams));
  topologyComponents.addAll(listTopologySinks(queryParams));
  for (TopologyComponent topologyComponent : topologyComponents) {
    setReconfigureOnTopologyComponent(topologyComponent);
  }
}

代码示例来源:origin: hortonworks/registry

public Set<SchemaBranch> getSchemaBranches(Long schemaVersionId) throws SchemaBranchNotFoundException {
  List<QueryParam> schemaVersionMappingStorableQueryParams = new ArrayList<>();
  Set<SchemaBranch> schemaBranches = new HashSet<>();
  schemaVersionMappingStorableQueryParams.add(new QueryParam(SchemaBranchVersionMapping.SCHEMA_VERSION_INFO_ID, schemaVersionId
      .toString()));
  for (Storable storable : storageManager.find(SchemaBranchVersionMapping.NAMESPACE, schemaVersionMappingStorableQueryParams)) {
    schemaBranches.add(schemaBranchCache.get(SchemaBranchCache.Key.of(((SchemaBranchVersionMapping) storable).getSchemaBranchId())));
  }
  return schemaBranches;
}

相关文章