Пример #1
0
  @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
 @Override
 public List<RpslObjectInfo> findByAttribute(
     final AttributeType attributeType, final String attributeValue) {
   final IndexStrategy indexStrategy = IndexStrategies.get(attributeType);
   return indexStrategy.findInIndex(jdbcTemplate, attributeValue);
 }
Пример #3
0
 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);
 }