Search in sources :

Example 1 with SharedEntries

use of org.jbei.ice.lib.entry.SharedEntries in project ice by JBEI.

the class CollectionEntries method getSharedEntries.

/**
     * Retrieves entries shared with user.
     *
     * @param field  sort field
     * @param asc    sort order ascending if true, descending if false
     * @param offset paging parameter start
     * @param limit  maximum number of entries to retrieve
     * @param filter optional text to filter entries by
     * @return wrapper around list of parts matching the parameters along with the maximum number of entries
     * available
     */
protected Results<PartData> getSharedEntries(ColumnField field, boolean asc, int offset, int limit, String filter) {
    SharedEntries sharedEntries = new SharedEntries(this.userId);
    List<PartData> entries = sharedEntries.getEntries(field, asc, offset, limit, filter);
    final long count = sharedEntries.getNumberOfEntries(filter);
    Results<PartData> results = new Results<>();
    results.setResultCount(count);
    results.setData(entries);
    return results;
}
Also used : Results(org.jbei.ice.lib.dto.common.Results) PartData(org.jbei.ice.lib.dto.entry.PartData) SharedEntries(org.jbei.ice.lib.entry.SharedEntries)

Example 2 with SharedEntries

use of org.jbei.ice.lib.entry.SharedEntries 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));
    // get sample entries (this is determined by folder membership
    long size = DAOFactory.getFolderDAO().getEntryCountByFolderType(FolderType.SAMPLE, null);
    collection.setSamples(size);
    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)

Example 3 with SharedEntries

use of org.jbei.ice.lib.entry.SharedEntries in project ice by JBEI.

the class CollectionEntries method getSharedEntries.

/**
 * Retrieves entries shared with user.
 *
 * @param field  sort field
 * @param asc    sort order ascending if true, descending if false
 * @param offset paging parameter start
 * @param limit  maximum number of entries to retrieve
 * @param filter optional text to filter entries by
 * @return wrapper around list of parts matching the parameters along with the maximum number of entries
 * available
 */
private Results<PartData> getSharedEntries(ColumnField field, boolean asc, int offset, int limit, String filter, List<String> fields) {
    SharedEntries sharedEntries = new SharedEntries(this.userId);
    List<PartData> entries = sharedEntries.getEntries(field, asc, offset, limit, filter, fields);
    final long count = sharedEntries.getNumberOfEntries(filter);
    Results<PartData> results = new Results<>();
    results.setResultCount(count);
    results.setData(entries);
    return results;
}
Also used : Results(org.jbei.ice.lib.dto.common.Results) PartData(org.jbei.ice.lib.dto.entry.PartData) SharedEntries(org.jbei.ice.lib.entry.SharedEntries)

Aggregations

SharedEntries (org.jbei.ice.lib.entry.SharedEntries)3 Results (org.jbei.ice.lib.dto.common.Results)2 PartData (org.jbei.ice.lib.dto.entry.PartData)2 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