org.ametys.plugins.datainclusion.data.ldap
Class LdapQueryResult

java.lang.Object
  extended by org.ametys.plugins.datainclusion.data.ldap.LdapQueryResult
All Implemented Interfaces:
Iterable<QueryResultRow>, QueryResult

public class LdapQueryResult
extends Object
implements QueryResult

LDAP query result.


Field Summary
protected  Map<String,String> _attributes
          The attribute labels.
protected  List<String> _columnNames
          The column names (ordered)
protected  Query.ResultType _resultType
          The result type.
protected  List<QueryResultRow> _rows
          The result rows.
 
Constructor Summary
LdapQueryResult(NamingEnumeration<SearchResult> results, List<String> columnNames, Map<String,String> attributes)
          Constructs a query result around a ResultSet.
 
Method Summary
protected  void _extractResults(NamingEnumeration<SearchResult> results, List<String> columnNames, Map<String,String> attributes)
          Extract the column names and results from a LDAP naming enumeration.
 void close()
          Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.
 Collection<String> getColumnNames()
          Get the column names.
 Query.ResultType getType()
          Get the type of the result.
 Iterator<QueryResultRow> iterator()
           
 void setType(Query.ResultType resultType)
          Set the result type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_resultType

protected Query.ResultType _resultType
The result type.


_rows

protected List<QueryResultRow> _rows
The result rows.


_columnNames

protected List<String> _columnNames
The column names (ordered)


_attributes

protected Map<String,String> _attributes
The attribute labels.

Constructor Detail

LdapQueryResult

public LdapQueryResult(NamingEnumeration<SearchResult> results,
                       List<String> columnNames,
                       Map<String,String> attributes)
Constructs a query result around a ResultSet.

Parameters:
results -
columnNames -
attributes -
Method Detail

getType

public Query.ResultType getType()
Description copied from interface: QueryResult
Get the type of the result.

Specified by:
getType in interface QueryResult
Returns:
the result type.

setType

public void setType(Query.ResultType resultType)
Set the result type.

Parameters:
resultType - the result type.

getColumnNames

public Collection<String> getColumnNames()
                                  throws DataInclusionException
Description copied from interface: QueryResult
Get the column names.

Specified by:
getColumnNames in interface QueryResult
Returns:
the column names as a Collection.
Throws:
DataInclusionException

iterator

public Iterator<QueryResultRow> iterator()
Specified by:
iterator in interface Iterable<QueryResultRow>

close

public void close()
Description copied from interface: QueryResult
Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.

Specified by:
close in interface QueryResult

_extractResults

protected void _extractResults(NamingEnumeration<SearchResult> results,
                               List<String> columnNames,
                               Map<String,String> attributes)
                        throws NamingException
Extract the column names and results from a LDAP naming enumeration.

Parameters:
results - the LDAP naming enumeration.
columnNames -
attributes -
Throws:
NamingException


Copyright © 2010 Anyware Services. All Rights Reserved.