// transform the list to DisplayEntityModelView
List<DisplayEntityModelView> displayModelViews = new ArrayList<DisplayEntityModelView>();
for (ModelView modelView : searchResults)
{
DisplayEntityModelView displayModelView = new DisplayEntityModelView();
if (modelView instanceof PersonModelView)
{
PersonModelView person = (PersonModelView) modelView;
if (log.isTraceEnabled())
{
log.trace("Found person '" + person.getAccountId() + " with search prefix '" + searchText + "'");
}
displayModelView.setDisplayName(person.getDisplayName());
displayModelView.setStreamScopeId(person.getStreamId());
displayModelView.setType(EntityType.PERSON);
displayModelView.setUniqueKey(person.getAccountId());
displayModelView.setAccountLocked(person.isAccountLocked());
displayModelViews.add(displayModelView);
}
else if (modelView instanceof DomainGroupModelView)
{
DomainGroupModelView group = (DomainGroupModelView) modelView;
if (log.isTraceEnabled())
{
log.trace("Found domain group '" + group.getShortName() + " with search prefix '" + searchText
+ "'");
}
displayModelView.setDisplayName(group.getName());
displayModelView.setStreamScopeId(group.getStreamId());
displayModelView.setType(EntityType.GROUP);
displayModelView.setUniqueKey(group.getShortName());
displayModelViews.add(displayModelView);
}
}
return displayModelViews;