use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class Features method get.
public Results<DNAFeature> get(int start, int count) {
Entry entry = super.getEntry(this.sequenceIdentifier);
List<SequenceFeature> list = dao.pageSequenceFeatures(entry, start, count);
long number = dao.countSequenceFeatures(entry);
Sequence sequence = new Sequence();
sequence.setEntry(entry);
FeaturedDNASequence featuredDNASequence = SequenceUtil.sequenceToDNASequence(sequence, list);
Results<DNAFeature> results = new Results<>();
results.setResultCount(number);
results.setData(featuredDNASequence.getFeatures());
return results;
}
use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class Annotations method get.
/**
* Retrieves list of annotations that are available
*
* @param offset paging start
* @param limit maximum number of annotations to return
* @param sort paging sort
* @return available annotations that conform to parameters along with the total number that are available
* @throws PermissionException if the requesting user's account does not have administrative privileges
*/
public Results<DNAFeatures> get(int offset, int limit, String sort) {
if (!isAdministrator())
throw new PermissionException("Administrative privileges required to retrieve features");
long count = this.featureDAO.getFeaturesGroupByCount();
Results<DNAFeatures> results = new Results<>();
results.setResultCount(count);
Map<String, List<Feature>> map = this.featureDAO.getFeaturesGroupBy(offset, limit);
for (String key : map.keySet()) {
DNAFeatures features = new DNAFeatures(key);
for (Feature feature : map.get(key)) {
DNAFeature dnaFeature = feature.toDataTransferObject();
dnaFeature.setSequence(feature.getSequence());
List<Long> entries = this.sequenceFeatureDAO.getEntryIdsByFeature(feature);
if (entries != null)
dnaFeature.getEntries().addAll(entries);
features.getFeatures().add(dnaFeature);
}
results.getData().add(features);
}
return results;
}
use of org.jbei.ice.lib.dto.common.Results 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.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
*/
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;
}
use of org.jbei.ice.lib.dto.common.Results in project ice by JBEI.
the class CollectionEntries method getPersonalEntries.
/**
* Retrieves entries owned by user
*
* @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
* @throws PermissionException on null user id which is required for owner entries
*/
private Results<PartData> getPersonalEntries(ColumnField field, boolean asc, int offset, int limit, String filter, List<String> fields) {
if (userId == null || userId.isEmpty())
throw new PermissionException("User id is required to retrieve owner entries");
OwnerEntries ownerEntries = new OwnerEntries(userId, userId);
final List<PartData> entries = ownerEntries.retrieveOwnerEntries(field, asc, offset, limit, filter, fields);
final long count = ownerEntries.getNumberOfOwnerEntries();
Results<PartData> results = new Results<>();
results.setResultCount(count);
results.setData(entries);
return results;
}
Aggregations