use of org.jbei.ice.lib.group.GroupController 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<String> fields) {
List<Long> 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 (Long id : entries) {
PartData info = ModelToInfoFactory.createTableView(id, fields);
data.add(info);
}
return data;
}
use of org.jbei.ice.lib.group.GroupController in project ice by JBEI.
the class OwnerEntries method getNumberOfOwnerEntries.
public long getNumberOfOwnerEntries() {
if (this.isAdmin || this.isSelf) {
return entryDAO.ownerEntryCount(ownerAccount.getEmail());
}
Set<Group> accountGroups = new HashSet<>(account.getGroups());
GroupController controller = new GroupController();
Group everybodyGroup = controller.createOrRetrievePublicGroup();
accountGroups.add(everybodyGroup);
return entryDAO.ownerEntryCount(account, ownerAccount.getEmail(), accountGroups);
}
use of org.jbei.ice.lib.group.GroupController in project ice by JBEI.
the class Annotations method filter.
public Results<DNAFeature> filter(int offset, int limit, String filter) {
Account account = accountDAO.getByEmail(userId);
List<Group> groups = new GroupController().getAllGroups(account);
List<SequenceFeature> features = sequenceFeatureDAO.getSequenceFeatures(this.userId, groups, filter, offset, limit);
int count = sequenceFeatureDAO.getSequenceFeaturesCount(this.userId, groups, filter);
Results<DNAFeature> results = new Results<>();
results.setResultCount(count);
for (SequenceFeature feature : features) {
DNAFeature dnaFeature = feature.toDataTransferObject();
Entry entry = feature.getSequence().getEntry();
dnaFeature.setIdentifier(entry.getPartNumber());
DNAFeatureLocation location = new DNAFeatureLocation();
location.setGenbankStart(feature.getUniqueGenbankStart());
location.setEnd(feature.getUniqueEnd());
dnaFeature.getLocations().add(location);
dnaFeature.getEntries().add(entry.getId());
results.getData().add(dnaFeature);
}
return results;
}
use of org.jbei.ice.lib.group.GroupController in project ice by JBEI.
the class SharedEntries method getNumberOfEntries.
public long getNumberOfEntries(String filter) {
GroupController groupController = new GroupController();
Group publicGroup = groupController.createOrRetrievePublicGroup();
Set<Group> accountGroups = account.getGroups();
accountGroups.remove(publicGroup);
return this.entryDAO.sharedEntryCount(account, accountGroups, filter);
}
use of org.jbei.ice.lib.group.GroupController in project ice by JBEI.
the class SharedEntries method getEntries.
public List<PartData> getEntries(ColumnField field, boolean asc, int start, int limit, String filter, List<String> fields) {
GroupController groupController = new GroupController();
Group publicGroup = groupController.createOrRetrievePublicGroup();
Set<Group> accountGroups = account.getGroups();
accountGroups.remove(publicGroup);
List<Long> entries = this.entryDAO.sharedWithUserEntries(account, accountGroups, field, asc, start, limit, filter);
ArrayList<PartData> data = new ArrayList<>();
for (Long id : entries) {
PartData info = ModelToInfoFactory.createTableView(id, fields);
data.add(info);
}
return data;
}
Aggregations