use of org.jbei.ice.lib.entry.OwnerEntries 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
*/
protected Results<PartData> getPersonalEntries(ColumnField field, boolean asc, int offset, int limit, String filter) {
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);
final long count = ownerEntries.getNumberOfOwnerEntries();
Results<PartData> results = new Results<>();
results.setResultCount(count);
results.setData(entries);
return results;
}
use of org.jbei.ice.lib.entry.OwnerEntries in project ice by JBEI.
the class UserResource method getProfileEntries.
/**
* @return collection for user's part entries
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/entries")
public FolderDetails getProfileEntries(@PathParam("id") long userId, @DefaultValue("0") @QueryParam("offset") int offset, @DefaultValue("15") @QueryParam("limit") int limit, @DefaultValue("created") @QueryParam("sort") String sort, @DefaultValue("false") @QueryParam("asc") boolean asc, @DefaultValue("") @QueryParam("filter") String filter) {
String userIdString = getUserId();
ColumnField field = ColumnField.valueOf(sort.toUpperCase());
OwnerEntries ownerEntries = new OwnerEntries(userIdString, userId);
List<PartData> entries = ownerEntries.retrieveOwnerEntries(field, asc, offset, limit, filter);
long count = ownerEntries.getNumberOfOwnerEntries();
FolderDetails details = new FolderDetails();
details.getEntries().addAll(entries);
details.setCount(count);
return details;
}
Aggregations