use of org.jbei.ice.lib.dto.entry.PartData in project ice by JBEI.
the class VisibleEntries method getEntries.
public List<PartData> getEntries(ColumnField field, boolean asc, int start, int limit, String filter) {
List<Entry> results;
if (isAdmin) {
// no filters
results = dao.retrieveAllEntries(field, asc, start, limit, filter);
} else {
// retrieve groups for account and filter by permission
Set<Group> accountGroups = new HashSet<>(account.getGroups());
accountGroups.add(everybodyGroup);
results = dao.retrieveVisibleEntries(account, accountGroups, field, asc, start, limit, filter);
}
ArrayList<PartData> data = new ArrayList<>();
for (Entry entry : results) {
PartData info = ModelToInfoFactory.createTableViewData(account.getEmail(), entry, false);
data.add(info);
}
return data;
}
use of org.jbei.ice.lib.dto.entry.PartData in project ice by JBEI.
the class OwnerEntries method retrieveOwnerEntries.
public List<PartData> retrieveOwnerEntries(ColumnField sort, boolean asc, int start, int limit, String filter) {
List<Entry> entries;
if (this.isAdmin || this.isSelf) {
entries = entryDAO.retrieveOwnerEntries(this.ownerAccount.getEmail(), sort, asc, start, limit, filter);
} else {
Set<Group> accountGroups = new HashSet<>(account.getGroups());
GroupController controller = new GroupController();
Group everybodyGroup = controller.createOrRetrievePublicGroup();
accountGroups.add(everybodyGroup);
// retrieve entries for user that can be read by others
entries = entryDAO.retrieveUserEntries(account, this.ownerAccount.getEmail(), accountGroups, sort, asc, start, limit, filter);
}
ArrayList<PartData> data = new ArrayList<>();
for (Entry entry : entries) {
PartData info = ModelToInfoFactory.createTableViewData(account.getEmail(), entry, false);
data.add(info);
}
return data;
}
use of org.jbei.ice.lib.dto.entry.PartData in project ice by JBEI.
the class SharedEntries method getEntries.
public List<PartData> getEntries(ColumnField field, boolean asc, int start, int limit, String filter) {
GroupController groupController = new GroupController();
Group publicGroup = groupController.createOrRetrievePublicGroup();
Set<Group> accountGroups = account.getGroups();
accountGroups.remove(publicGroup);
List<Entry> entries = this.entryDAO.sharedWithUserEntries(account, accountGroups, field, asc, start, limit, filter);
ArrayList<PartData> data = new ArrayList<>();
for (Entry entry : entries) {
PartData info = ModelToInfoFactory.createTableViewData(account.getEmail(), entry, false);
data.add(info);
}
return data;
}
use of org.jbei.ice.lib.dto.entry.PartData 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.entry.PartData 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;
}
Aggregations