Revision 51508
Added by Argiro Kokogiannaki about 6 years ago
PageController.java | ||
---|---|---|
9 | 9 |
import org.springframework.web.bind.annotation.*; |
10 | 10 |
import org.springframework.beans.factory.annotation.Autowired; |
11 | 11 |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Iterator; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
12 |
import java.util.*; |
|
16 | 13 |
|
17 | 14 |
@RestController |
18 | 15 |
@CrossOrigin(origins = "*") |
... | ... | |
38 | 35 |
private DivIdController divIdController; |
39 | 36 |
|
40 | 37 |
@RequestMapping(value = "/page", method = RequestMethod.GET) |
41 |
public List<Page> getAllPages() { |
|
42 |
return pageDAO.findAll(); |
|
38 |
public List<Page> getAllPages(@RequestParam String pid) { |
|
39 |
List<Page> pages; |
|
40 |
if(pid !=null){ |
|
41 |
pages = (pid=="openaire")? pageDAO.findByOpenaire(true):pageDAO.findByConnect(true); |
|
42 |
} |
|
43 |
else{ |
|
44 |
pages = pageDAO.findAll(); |
|
45 |
} |
|
46 |
pages.sort(Comparator.comparing(Page::getName)); |
|
47 |
return pages; |
|
43 | 48 |
} |
44 | 49 |
|
45 | 50 |
@RequestMapping(value = "/page", method = RequestMethod.DELETE) |
Also available in: Unified diff
organize init script with methods, add connect and openaire fields in Page, filter pages by pid depending on connect and openaire field | order page results by name | update update script with methods