use of org.olat.repository.model.RepositoryEntryAuthorImpl in project OpenOLAT by OpenOLAT.
the class RepositoryEntryAuthorQueries method searchViews.
public List<RepositoryEntryAuthorView> searchViews(SearchAuthorRepositoryEntryViewParams params, int firstResult, int maxResults) {
if (params.getIdentity() == null) {
log.error("No identity defined for query");
return Collections.emptyList();
}
TypedQuery<Object[]> query = createViewQuery(params, Object[].class);
query.setFirstResult(firstResult);
if (maxResults > 0) {
query.setMaxResults(maxResults);
}
List<Object[]> objects = query.getResultList();
List<RepositoryEntryAuthorView> views = new ArrayList<>(objects.size());
for (Object[] object : objects) {
RepositoryEntry re = (RepositoryEntry) object[0];
Number numOfMarks = (Number) object[1];
boolean hasMarks = numOfMarks == null ? false : numOfMarks.longValue() > 0;
Number numOffers = (Number) object[2];
long offers = numOffers == null ? 0l : numOffers.longValue();
Number numOfReferences = (Number) object[3];
int references = numOfReferences == null ? 0 : numOfReferences.intValue();
String deletedByName = null;
if (params.isDeleted()) {
Identity deletedBy = re.getDeletedBy();
if (deletedBy != null) {
deletedByName = userManager.getUserDisplayName(deletedBy);
}
}
views.add(new RepositoryEntryAuthorImpl(re, hasMarks, offers, references, deletedByName));
}
return views;
}
use of org.olat.repository.model.RepositoryEntryAuthorImpl in project openolat by klemens.
the class RepositoryEntryAuthorQueries method searchViews.
public List<RepositoryEntryAuthorView> searchViews(SearchAuthorRepositoryEntryViewParams params, int firstResult, int maxResults) {
if (params.getIdentity() == null) {
log.error("No identity defined for query");
return Collections.emptyList();
}
TypedQuery<Object[]> query = createViewQuery(params, Object[].class);
query.setFirstResult(firstResult);
if (maxResults > 0) {
query.setMaxResults(maxResults);
}
List<Object[]> objects = query.getResultList();
List<RepositoryEntryAuthorView> views = new ArrayList<>(objects.size());
for (Object[] object : objects) {
RepositoryEntry re = (RepositoryEntry) object[0];
Number numOfMarks = (Number) object[1];
boolean hasMarks = numOfMarks == null ? false : numOfMarks.longValue() > 0;
Number numOffers = (Number) object[2];
long offers = numOffers == null ? 0l : numOffers.longValue();
Number numOfReferences = (Number) object[3];
int references = numOfReferences == null ? 0 : numOfReferences.intValue();
String deletedByName = null;
if (params.isDeleted()) {
Identity deletedBy = re.getDeletedBy();
if (deletedBy != null) {
deletedByName = userManager.getUserDisplayName(deletedBy);
}
}
views.add(new RepositoryEntryAuthorImpl(re, hasMarks, offers, references, deletedByName));
}
return views;
}
Aggregations