use of org.jbei.ice.lib.dto.DNAFeatures 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;
}
Aggregations