use of org.jbei.ice.lib.entry.VisibleEntries in project ice by JBEI.
the class CollectionEntries method getAvailableEntries.
/**
* Retrieves entries available to user. "Availability" is determined by any permissions set on the entries
*
* @param field sort field
* @param asc sort order
* @param offset paging start
* @param limit maximum number of entries to retrieve
* @param filter optional text to filter entries by
* @return wrapper around list of parts that conform to the parameters and the maximum number
* of such entries that are available
*/
protected Results<PartData> getAvailableEntries(ColumnField field, boolean asc, int offset, int limit, String filter) {
VisibleEntries visibleEntries = new VisibleEntries(userId);
List<PartData> entries = visibleEntries.getEntries(field, asc, offset, limit, filter);
long count = visibleEntries.getEntryCount(filter);
Results<PartData> results = new Results<>();
results.setResultCount(count);
results.setData(entries);
return results;
}
use of org.jbei.ice.lib.entry.VisibleEntries in project ice by JBEI.
the class Collections method getAllCounts.
public CollectionCounts getAllCounts() {
String userId = this.account.getEmail();
EntryDAO entryDAO = DAOFactory.getEntryDAO();
CollectionCounts collection = new CollectionCounts();
VisibleEntries visibleEntries = new VisibleEntries(userId);
collection.setAvailable(visibleEntries.getEntryCount());
collection.setDeleted(entryDAO.getDeletedCount(userId));
long ownerEntryCount = DAOFactory.getEntryDAO().ownerEntryCount(userId);
collection.setPersonal(ownerEntryCount);
SharedEntries sharedEntries = new SharedEntries(userId);
collection.setShared(sharedEntries.getNumberOfEntries(null));
collection.setDrafts(entryDAO.getByVisibilityCount(userId, Visibility.DRAFT, null));
if (account.getType() != AccountType.ADMIN)
return collection;
// admin only options
collection.setPending(entryDAO.getByVisibilityCount(Visibility.PENDING));
collection.setTransferred(entryDAO.getByVisibilityCount(Visibility.TRANSFERRED));
return collection;
}
Aggregations