1 package org.kuali.ole.systemintegration.rest.Controller;
2
3 import org.kuali.ole.systemintegration.rest.RestConstants;
4 import org.kuali.ole.systemintegration.rest.service.DocstoreDataRetrieveService;
5 import org.springframework.stereotype.Controller;
6 import org.springframework.web.bind.annotation.RequestMapping;
7 import org.springframework.web.bind.annotation.RequestMethod;
8 import org.springframework.web.bind.annotation.RequestParam;
9 import org.springframework.web.bind.annotation.ResponseBody;
10 import java.util.ArrayList;
11 import java.util.Arrays;
12 import java.util.List;
13
14
15
16
17
18
19
20
21 @Controller
22 @RequestMapping("/holdings")
23 public class InstanceDetailsRestController {
24
25 @RequestMapping(value = "/tree", method = RequestMethod.GET, headers="Accept=application/json" )
26 @ResponseBody
27 public String retrieveHoldingsTreeApplicationJson(@RequestParam(RestConstants.BIB_ID) String []bibId) {
28 String instanceResponse = "";
29 List<String> bibIdList = new ArrayList<>();
30 if(bibId != null){
31 bibIdList = Arrays.asList(bibId);
32 }
33 DocstoreDataRetrieveService oleDocstoreDataRetrieveService = new DocstoreDataRetrieveService();
34 instanceResponse = oleDocstoreDataRetrieveService.getHoldingsTree(bibIdList, RestConstants.JSON);
35 return instanceResponse;
36 }
37
38 @RequestMapping(value = "/tree", method = RequestMethod.GET, headers="Accept=application/xml" )
39 @ResponseBody
40 public String retrieveHoldingsTreeApplicationXml(@RequestParam(RestConstants.BIB_ID) String []bibId) {
41 String instanceResponse = "";
42 List<String> bibIdList = new ArrayList<>();
43 if(bibId != null){
44 bibIdList = Arrays.asList(bibId);
45 }
46 DocstoreDataRetrieveService oleDocstoreDataRetrieveService = new DocstoreDataRetrieveService();
47 instanceResponse = oleDocstoreDataRetrieveService.getHoldingsTree(bibIdList, RestConstants.XML);
48 return instanceResponse;
49 }
50
51 @RequestMapping(value = "/tree", method = RequestMethod.GET, headers="Accept=text/xml" )
52 @ResponseBody
53 public String retrieveHoldingsTreeApplicationText(@RequestParam(RestConstants.BIB_ID) String []bibId) {
54 String instanceResponse = "";
55 List<String> bibIdList = new ArrayList<>();
56 if(bibId != null){
57 bibIdList = Arrays.asList(bibId);
58 }
59 DocstoreDataRetrieveService oleDocstoreDataRetrieveService = new DocstoreDataRetrieveService();
60 instanceResponse = oleDocstoreDataRetrieveService.getHoldingsTree(bibIdList, RestConstants.XML);
61 return instanceResponse;
62 }
63
64 @RequestMapping(value = "/tree", method = RequestMethod.GET)
65 @ResponseBody
66 public String retrieveHoldingsTreeApplication(@RequestParam(RestConstants.BIB_ID) String []bibId) {
67 String instanceResponse = "";
68 List<String> bibIdList = new ArrayList<>();
69 if(bibId != null){
70 bibIdList = Arrays.asList(bibId);
71 }
72 DocstoreDataRetrieveService oleDocstoreDataRetrieveService = new DocstoreDataRetrieveService();
73 instanceResponse = oleDocstoreDataRetrieveService.getHoldingsTree(bibIdList, RestConstants.XML);
74 return instanceResponse;
75 }
76 }