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

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

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

QueryParam.params介绍

暂无

代码示例

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

public static List<QueryParam> buildEdgesFromQueryParam(Long topologyId,
                            Long versionId,
                            Long componentId) {
  return QueryParam.params(
      TOPOLOGY_ID, topologyId.toString(),
      VERSION_ID, versionId.toString(),
      FROM_ID, componentId.toString()
  );
}

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

public static List<QueryParam> buildEdgesToQueryParam(Long topologyId,
                            Long versionId,
                            Long componentId) {
  return QueryParam.params(
      TOPOLOGY_ID, topologyId.toString(),
      VERSION_ID, versionId.toString(),
      TO_ID, componentId.toString()
  );
}

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

public Optional<Role> getRole(String roleName) {
  List<QueryParam> qps = QueryParam.params(Role.NAME, String.valueOf(roleName));
  Collection<Role> roles = listRoles(qps);
  return roles.isEmpty() ? Optional.empty() : Optional.of(roles.iterator().next());
}

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

public Optional<TopologyEditorToolbar> getTopologyEditorToolbar(long userId) {
  List<QueryParam> qps = QueryParam.params(TopologyEditorToolbar.USER_ID, String.valueOf(userId));
  Collection<TopologyEditorToolbar> res = listTopologyEditorToolbar(qps);
  return res.isEmpty() ? Optional.empty() : Optional.ofNullable(res.iterator().next());
}

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

public Collection<AclEntry> listRoleAcls(Long roleId, String targetEntityNamespace, Long targetEntityId) {
  List<QueryParam> qps = QueryParam.params(AclEntry.SID_ID, roleId.toString(),
      AclEntry.SID_TYPE, AclEntry.SidType.ROLE.toString(),
      AclEntry.OBJECT_NAMESPACE, targetEntityNamespace,
      AclEntry.OBJECT_ID, targetEntityId.toString());
  return listAcls(qps);
}

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

public User getUser(String name) {
  List<QueryParam> qps = QueryParam.params(User.NAME, name);
  Collection<User> users = listUsers(qps);
  if (users.size() == 1) {
    return fillRoles(users.iterator().next());
  }
  return null;
}

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

public Collection<AclEntry> listUserAcls(Long userId, String targetEntityNamespace, Long targetEntityId) {
  List<QueryParam> qps = QueryParam.params(AclEntry.SID_ID, userId.toString(),
      AclEntry.SID_TYPE, AclEntry.SidType.USER.toString(),
      AclEntry.OBJECT_NAMESPACE, targetEntityNamespace,
      AclEntry.OBJECT_ID, targetEntityId.toString());
  return listAcls(qps);
}

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

private Set<Role> getParentRoles(Long childRoleId) {
  List<QueryParam> qps = QueryParam.params(RoleHierarchy.CHILD_ID, String.valueOf(childRoleId));
  Collection<RoleHierarchy> roleHierarchies = dao.find(RoleHierarchy.NAMESPACE, qps);
  Set<Role> res = new HashSet<>();
  roleHierarchies.forEach(rh -> {
    res.add(getRole(rh.getParentId()));
  });
  return res;
}

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

private void validateTopology(Topology topology) {
  StorageUtils.ensureUnique(topology, this::listTopologies,
      QueryParam.params(Topology.NAME, topology.getName()));
}

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

public Collection<User> listUsers(Role role) {
  List<QueryParam> qps = QueryParam.params(UserRole.ROLE_ID, role.getId().toString());
  return listUserRoles(qps).stream().map(ur -> getUser(ur.getUserId())).collect(Collectors.toSet());
}

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

private void updateNotifierJarFileName(TopologySink sink) {
  String notifierClassName = sink.getConfig().getString(Notifier.CLASS_NAME, "");
  if (!notifierClassName.isEmpty()) {
    Collection<Notifier> notifiers = listNotifierInfos(QueryParam.params(Notifier.CLASS_NAME, notifierClassName));
    if (notifiers.isEmpty()) {
      throw new IllegalStateException("No registered notifier in the cluster for class '" + notifierClassName + "'");
    }
    Notifier current = notifiers.iterator().next();
    sink.getConfig().setAny(Notifier.JARFILE_NAME, current.getJarFileName());
  }
}

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

private void validateTopologySink(TopologySink topologySink) {
  StorageUtils.ensureUnique(topologySink, this::listTopologySinks,
      QueryParam.params(TopologySink.TOPOLOGYID, topologySink.getTopologyId().toString(),
          TopologySink.VERSIONID, topologySink.getVersionId().toString(),
          TopologySink.NAME, topologySink.getName()));
}

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

private void validateStreamInfo(TopologyStream topologyStream) {
  if (topologyStream.getFields().isEmpty()) {
    throw new IllegalArgumentException("Stream with empty fields: " + topologyStream);
  }
  StorageUtils.ensureUnique(topologyStream, this::listStreamInfos,
      QueryParam.params(TopologyStream.TOPOLOGYID, topologyStream.getTopologyId().toString(),
          TopologyStream.VERSIONID, topologyStream.getVersionId().toString(),
          TopologyStream.STREAMID, topologyStream.getStreamId()));
}

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

private void validateModelInfo(MLModel modelInfo) throws SAXException, JAXBException {
    List<MLModelField> outputFields = doGetOutputFieldsForPMMLStream(modelInfo.getPmml());
    if (outputFields.isEmpty()) {
      throw new RuntimeException(
          String.format("PMML File %s does not support empty output", modelInfo.getUploadedFileName()));
    }
    StorageUtils.ensureUnique(modelInfo, this::listModelInfo, QueryParam.params(
        MLModel.NAME, modelInfo.getName()));
  }
}

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

private void validateModelInfo(MLModel modelInfo) throws SAXException, JAXBException, UnsupportedEncodingException {
    List<MLModelField> outputFields = doGetOutputFieldsForPMMLStream(modelInfo.getPmml());
    if (outputFields.isEmpty()) {
      throw new RuntimeException(
          String.format("PMML File %s does not support empty output", modelInfo.getUploadedFileName()));
    }
    StorageUtils.ensureUnique(modelInfo, this::listModelInfo, QueryParam.params(
        MLModel.NAME, modelInfo.getName()));
  }
}

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

private void validateTopologySource(TopologySource topologySource) {
  StorageUtils.ensureUnique(topologySource, this::listTopologySources,
      QueryParam.params(TopologySource.TOPOLOGYID, topologySource.getTopologyId().toString(),
          TopologySource.VERSIONID, topologySource.getVersionId().toString(),
          TopologySource.NAME, topologySource.getName()));
}

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

private void validateTopologyProcessor(TopologyProcessor topologyProcessor) {
  StorageUtils.ensureUnique(topologyProcessor, this::listTopologyProcessors,
      QueryParam.params(TopologyProcessor.TOPOLOGYID, topologyProcessor.getTopologyId().toString(),
          TopologyProcessor.VERSIONID, topologyProcessor.getVersionId().toString(),
          TopologyProcessor.NAME, topologyProcessor.getName()));
}

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

private void validateRole(Role role) {
  Utils.requireNonEmpty(role.getName(), "Role name");
  if (StringUtils.isNumeric(role.getName())) {
    throw new IllegalArgumentException("Role name cannot be numeric");
  }
  StorageUtils.ensureUnique(role, this::listRoles, QueryParam.params(User.NAME, role.getName()));
}

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

private User fillRoles(User user) {
  User res = null;
  if (user != null) {
    User userWithRole = new User(user);
    userWithRole.setRoles(Collections.emptySet());
    List<QueryParam> qps = QueryParam.params(UserRole.USER_ID, String.valueOf(user.getId()));
    listUserRoles(qps).forEach(userRole -> {
      userWithRole.addRole(getRole(userRole.getRoleId()).getName());
    });
    res = userWithRole;
  }
  return res;
}

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

private void checkDuplicate(UDF udf) {
  List<QueryParam> qps = QueryParam.params(UDF.NAME, udf.getName(), UDF.CLASSNAME, udf.getClassName(),
      UDF.TYPE, udf.getType().toString());
  Collection<UDF> existing = catalogService.listUDFs(qps);
  if (!existing.isEmpty()) {
    LOG.warn("UDF with same (name, classname, type) already exists, udf: {}", udf);
    throw EntityAlreadyExistsException.byName(udf.getName());
  }
}

相关文章