Class LdapQueryResult
- java.lang.Object
-
- org.ametys.plugins.externaldata.data.ldap.LdapQueryResult
-
- All Implemented Interfaces:
Iterable<QueryResultRow>,QueryResult
public class LdapQueryResult extends Object implements QueryResult
LDAP query result.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>_attributesThe attribute labels.protected List<String>_columnNamesThe column names (ordered)protected Query.ResultType_resultTypeThe result type.protected List<QueryResultRow>_rowsThe result rows.
-
Constructor Summary
Constructors Constructor Description LdapQueryResult(List<SearchResult> results, List<String> columnNames, Map<String,String> attributes)Constructs a query result around a ResultSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_extractResults(List<SearchResult> results, List<String> columnNames, Map<String,String> attributes)Extract the column names and results from a LDAP naming enumeration.voidclose()Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.Collection<String>getColumnNames()Get the column names.intgetSize()Get sizeQuery.ResultTypegetType()Get the type of the result.Iterator<QueryResultRow>iterator()voidsetType(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
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
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(List<SearchResult> results, List<String> columnNames, Map<String,String> attributes)
Constructs a query result around a ResultSet.- Parameters:
results- the list of search resultscolumnNames- the names of the columnsattributes- the attributes
-
-
Method Detail
-
getType
public Query.ResultType getType()
Description copied from interface:QueryResultGet the type of the result.- Specified by:
getTypein interfaceQueryResult- Returns:
- the result type.
-
setType
public void setType(Query.ResultType resultType)
Set the result type.- Parameters:
resultType- the result type.
-
getSize
public int getSize()
Description copied from interface:QueryResultGet size- Specified by:
getSizein interfaceQueryResult- Returns:
- the size
-
getColumnNames
public Collection<String> getColumnNames() throws DataInclusionException
Description copied from interface:QueryResultGet the column names.- Specified by:
getColumnNamesin interfaceQueryResult- Returns:
- the column names as a Collection.
- Throws:
DataInclusionException- if an error occurs while manipulating the data sources
-
iterator
public Iterator<QueryResultRow> iterator()
- Specified by:
iteratorin interfaceIterable<QueryResultRow>
-
close
public void close()
Description copied from interface:QueryResultClose and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.- Specified by:
closein interfaceQueryResult
-
_extractResults
protected void _extractResults(List<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- the names of the columnsattributes- the attributes- Throws:
NamingException- if something goes wrong when manipulating the context
-
-