Search in sources :

Example 1 with CollectionCounts

use of org.jbei.ice.lib.folder.CollectionCounts 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;
}
Also used : VisibleEntries(org.jbei.ice.lib.entry.VisibleEntries) SharedEntries(org.jbei.ice.lib.entry.SharedEntries) CollectionCounts(org.jbei.ice.lib.folder.CollectionCounts) EntryDAO(org.jbei.ice.storage.hibernate.dao.EntryDAO)

Aggregations

SharedEntries (org.jbei.ice.lib.entry.SharedEntries)1 VisibleEntries (org.jbei.ice.lib.entry.VisibleEntries)1 CollectionCounts (org.jbei.ice.lib.folder.CollectionCounts)1 EntryDAO (org.jbei.ice.storage.hibernate.dao.EntryDAO)1