use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.
the class UserProteinListUtilsTest method testCombineSameListThrowsException.
@Test(expected = NextProtException.class)
public void testCombineSameListThrowsException() {
UserProteinList l1 = createUserProteinList("cool1", Sets.newHashSet("NX_P123", "NX_P456"));
UserProteinListUtils.combine(l1, l1, UserProteinListService.Operator.OR, "bobleponge", "coolio", null);
}
use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.
the class UserProteinListUtilsTest method testCombineOr2.
@Test
public void testCombineOr2() {
UserProteinList l1 = createUserProteinList("cool1", Sets.newHashSet("NX_P123", "NX_P456"));
UserProteinList l2 = createUserProteinList("cool2", Sets.newHashSet("NX_P123", "NX_P321"));
UserProteinList l3 = UserProteinListUtils.combine(l2, l1, UserProteinListService.Operator.OR, "bobleponge", "coolio", null);
assertEquals("coolio", l3.getName());
assertEquals(3, l3.getAccessionNumbers().size());
assertEquals("bobleponge", l3.getOwner());
assertEquals(Sets.newHashSet("NX_P123", "NX_P456", "NX_P321"), l3.getAccessionNumbers());
}
use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.
the class UserProteinListUtilsTest method testCombineAnd2.
@Test
public void testCombineAnd2() {
UserProteinList l1 = createUserProteinList("cool1", Sets.newHashSet("NX_P123", "NX_P456"));
UserProteinList l2 = createUserProteinList("cool2", Sets.newHashSet("NX_P123", "NX_P321"));
UserProteinList l3 = UserProteinListUtils.combine(l2, l1, UserProteinListService.Operator.AND, "bobleponge", "homie", null);
assertEquals("homie", l3.getName());
assertEquals(1, l3.getAccessionNumbers().size());
assertEquals("bobleponge", l3.getOwner());
assertEquals("NX_P123", l3.getAccessionNumbers().iterator().next());
}
use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.
the class SearchController method test.
@RequestMapping(value = "/user/{username}/protein-list/{list}/results", method = RequestMethod.GET)
public String test(@PathVariable("username") String username, @PathVariable("list") String listName, @RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "order", required = false) String order, @RequestParam(value = "start", required = false) String start, @RequestParam(value = "rows", required = false) String rows, @RequestParam(value = "filter", required = false) String filter, Model model) throws SearchQueryException {
UserProteinList proteinList = this.proteinListService.getUserProteinListByNameForUser(username, listName);
Set<String> accessions = proteinList.getAccessionNumbers();
String queryString = "id:" + (accessions.size() > 1 ? "(" + Joiner.on(" ").join(accessions) + ")" : accessions.iterator().next());
// SolrIndex index = this.configuration.getIndexByName("entry");
Query query = this.queryBuilderService.buildQueryForProteinLists("entry", queryString, "", sort, order, start, rows, filter);
SearchResult result = this.queryService.executeQuery(query);
model.addAttribute("result", result);
return "search";
}
use of org.nextprot.api.user.domain.UserProteinList in project nextprot-api by calipho-sib.
the class UserProteinListServiceImpl method combine.
@Override
public UserProteinList combine(String name, String description, String username, String listName1, String listName2, Operator op) {
UserProteinList l1 = proteinListDao.getUserProteinListByName(username, listName1);
UserProteinList l2 = proteinListDao.getUserProteinListByName(username, listName2);
return UserProteinListUtils.combine(l1, l2, op, username, name, description);
}
Aggregations