use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class RemoteEntries method getPublicEntries.
public PartnerEntries getPublicEntries(long remoteId, int offset, int limit, String sort, boolean asc) {
if (!hasRemoteAccessEnabled())
return null;
RemotePartner partner = this.remotePartnerDAO.get(remoteId);
if (partner == null)
return null;
FolderDetails details;
try {
HashMap<String, Object> queryParams = new HashMap<>();
queryParams.put("offset", offset);
queryParams.put("limit", limit);
queryParams.put("asc", asc);
queryParams.put("sort", sort);
details = this.remoteContact.getFolderEntries(partner.getUrl(), queryParams, partner.getApiKey());
if (details == null)
return null;
} catch (Exception e) {
Logger.error(e);
return null;
}
Results<PartData> results = new Results<>();
results.setData(details.getEntries());
results.setResultCount(details.getCount());
return new PartnerEntries(partner.toDataTransferObject(), results);
}
use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class CollectionEntries method getSampleEntries.
private Results<PartData> getSampleEntries(ColumnField field, boolean asc, int offset, int limit, String filter, List<String> fields) {
SampleEntries entries = new SampleEntries(this.userId);
final List<PartData> list = entries.get(field, asc, offset, limit, filter, fields);
final long count = entries.getCount(filter);
Results<PartData> results = new Results<>();
results.setResultCount(count);
results.setData(list);
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
*/
private Results<PartData> getEntriesByVisibility(Visibility visibility, ColumnField field, boolean asc, int offset, int limit, String user, String filter, List<String> fields) {
List<Long> entries = entryDAO.getByVisibility(user, visibility, field, asc, offset, limit, filter);
Results<PartData> results = new Results<>();
for (Long id : entries) {
PartData info = ModelToInfoFactory.createTableView(id, fields);
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
*/
private Results<PartData> getAvailableEntries(ColumnField field, boolean asc, int offset, int limit, String filter, List<String> fields) {
VisibleEntries visibleEntries = new VisibleEntries(userId);
List<PartData> entries = visibleEntries.getEntries(field, asc, offset, limit, filter, fields);
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 Groups method get.
public Results<UserGroup> get(GroupType groupType, int offset, int limit) {
List<Group> groupList = dao.getGroupsByType(groupType, offset, limit);
Results<UserGroup> results = new Results<>();
results.setResultCount(dao.getGroupsByTypeCount(groupType));
for (Group group : groupList) {
UserGroup userGroup = group.toDataTransferObject();
long memberCount = dao.getMemberCount(group.getUuid());
userGroup.setMemberCount(memberCount);
results.getData().add(userGroup);
}
return results;
}
Aggregations