use of org.jbei.ice.lib.dto.common.Results 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;
}
use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class CollectionEntries method getEntriesByVisibility.
/**
* Retrieves entries by the specified visibility. {@link Visibility} is used to create
* collections of entries
*
* @param visibility visibility to retrieve entries by
* @param field sort field
* @param asc sort order
* @param offset paging start
* @param limit maximum number of entries to retrieve
* @param user additional user filter
* @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> getEntriesByVisibility(Visibility visibility, ColumnField field, boolean asc, int offset, int limit, String user, String filter) {
List<Entry> entries = entryDAO.getByVisibility(user, visibility, field, asc, offset, limit, filter);
Results<PartData> results = new Results<>();
for (Entry entry : entries) {
PartData info = ModelToInfoFactory.createTableViewData(userId, entry, false);
results.getData().add(info);
}
results.setResultCount(entryDAO.getByVisibilityCount(user, visibility, filter));
return results;
}
use of org.jbei.ice.lib.dto.common.Results 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.dto.common.Results in project ice by JBEI.
the class Manuscripts method get.
public Results<Manuscript> get(String sort, boolean asc, int offset, int size, String filter) {
Results<Manuscript> results = new Results<>();
results.setResultCount(dao.getTotalCount(filter));
List<ManuscriptModel> list = dao.list(sort, asc, offset, size, filter);
if (!list.isEmpty()) {
for (ManuscriptModel manuscriptModel : list) results.getData().add(manuscriptModel.toDataTransferObject());
}
return results;
}
use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class Messages method get.
public Results<MessageInfo> get(int start, int limit) {
Account account = accountDAO.getByEmail(this.userId);
List<Group> groups = DAOFactory.getGroupDAO().retrieveMemberGroups(account);
List<Message> messages = new ArrayList<>(dao.retrieveMessages(account, groups, start, limit));
Results<MessageInfo> results = new Results<>();
for (Message message : messages) {
Account from = accountDAO.getByEmail(message.getFromEmail());
if (from == null)
continue;
MessageInfo info = new MessageInfo();
info.setId(message.getId());
// get from details
AccountTransfer accountTransfer = new AccountTransfer();
accountTransfer.setEmail(from.getEmail());
accountTransfer.setFirstName(account.getFirstName());
accountTransfer.setLastName(account.getLastName());
info.setFrom(accountTransfer);
info.setTitle(message.getTitle());
info.setRead(message.isRead());
info.setSent(message.getDateSent().getTime());
results.getData().add(info);
}
int totalSize = dao.retrieveMessageCount(account, groups);
results.setResultCount(totalSize);
return results;
}
Aggregations