Skip to content

Commit

Permalink
Update ReturnAttributes Override
Browse files Browse the repository at this point in the history
Issue gh-465
  • Loading branch information
orlandosso authored and jzheaux committed Feb 1, 2022
1 parent 5de2694 commit df40b39
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1830,8 +1830,10 @@ public <T> List<T> find(Name base, Filter filter, SearchControls searchControls,
}

// extend search controls with the attributes to return
String[] attributes = odm.manageClass(clazz);
searchControls.setReturningAttributes(attributes);
if (isNotCustomReturningAttributes(searchControls)) {
String[] attributes = this.odm.manageClass(clazz);
searchControls.setReturningAttributes(attributes);
}

if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Searching - base=%1$s, finalFilter=%2$s, scope=%3$s", base, finalFilter, searchControls));
Expand Down Expand Up @@ -1877,6 +1879,10 @@ else if (result.size() != 1) {

return result.get(0);
}

private boolean isNotCustomReturningAttributes(SearchControls searchControls) {
return searchControls.getReturningAttributes() == null || searchControls.getReturningAttributes().length == 0;
}

/**
* The status of an authentication attempt.
Expand Down

0 comments on commit df40b39

Please sign in to comment.