コード例 #1
0
ファイル: JdbcRpslObjectDao.java プロジェクト: RIPE-NCC/whois
  @Override
  public List<RpslObjectInfo> findMemberOfByObjectTypeWithoutMbrsByRef(
      final ObjectType objectType, final String attributeValue) {
    final ObjectTemplate objectTemplate = ObjectTemplate.getTemplate(objectType);
    final Set<AttributeType> keyAttributes = objectTemplate.getKeyAttributes();
    Validate.isTrue(keyAttributes.size() == 1);

    final IndexStrategy indexStrategy = IndexStrategies.get(keyAttributes.iterator().next());

    final String query =
        MessageFormat.format(
            "SELECT l.object_id, l.object_type, l.pkey "
                + "  FROM {0}, member_of"
                + "  LEFT OUTER JOIN mnt_by ON member_of.object_id = mnt_by.object_id "
                + "  LEFT JOIN last l ON l.object_id = member_of.object_id "
                + "  WHERE {0}.object_id = member_of.set_id "
                + "  AND {0}.{1} = ?"
                + "  AND l.sequence_id != 0 ",
            indexStrategy.getLookupTableName(), indexStrategy.getLookupColumnName());

    return jdbcTemplate.query(query, new RpslObjectInfoResultSetExtractor(), attributeValue);
  }
コード例 #2
0
ファイル: JdbcRpslObjectDao.java プロジェクト: RIPE-NCC/whois
 private List<RpslObjectInfo> findByKeyInIndex(final ObjectType type, final String key) {
   final AttributeType keyLookupAttribute =
       ObjectTemplate.getTemplate(type).getKeyLookupAttribute();
   final IndexStrategy indexStrategy = IndexStrategies.get(keyLookupAttribute);
   return indexStrategy.findInIndex(jdbcTemplate, key, type);
 }