| Line 77... |
Line 77... |
| 77 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
77 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 78 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
78 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 79 |
LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
|
79 |
LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
|
| 80 |
schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
|
80 |
schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
|
| 81 |
LOGGER.info("Scheme saved successfully");
|
81 |
LOGGER.info("Scheme saved successfully");
|
| 82 |
|
- |
|
| - |
|
82 |
long size = schemeRepository.selectAllCount();
|
| 83 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
83 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 84 |
long count = schemeRepository.selectCount(offset, limit);
|
- |
|
| 85 |
model.addAttribute("schemes", schemes);
|
84 |
model.addAttribute("schemes", schemes);
|
| 86 |
model.addAttribute("start", offset + 1);
|
85 |
model.addAttribute("start", offset + 1);
|
| 87 |
model.addAttribute("size", count);
|
86 |
model.addAttribute("size", size);
|
| 88 |
if (schemes.size() < limit){
|
87 |
if (schemes.size() < limit){
|
| 89 |
model.addAttribute("end", offset + schemes.size());
|
88 |
model.addAttribute("end", offset + schemes.size());
|
| 90 |
}
|
89 |
}
|
| 91 |
else{
|
90 |
else{
|
| 92 |
model.addAttribute("end", offset + limit);
|
91 |
model.addAttribute("end", offset + limit);
|
| Line 96... |
Line 95... |
| 96 |
}
|
95 |
}
|
| 97 |
|
96 |
|
| 98 |
@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
|
97 |
@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
|
| 99 |
public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model){
|
98 |
public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model){
|
| 100 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
99 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 101 |
long count = schemeRepository.selectCount(offset, limit);
|
100 |
long size = schemeRepository.selectAllCount();
|
| 102 |
model.addAttribute("schemes", schemes);
|
101 |
model.addAttribute("schemes", schemes);
|
| 103 |
model.addAttribute("start", offset + 1);
|
102 |
model.addAttribute("start", offset + 1);
|
| 104 |
model.addAttribute("size", count);
|
103 |
model.addAttribute("size", size);
|
| 105 |
if (schemes.size() < limit){
|
104 |
if (schemes.size() < limit){
|
| 106 |
model.addAttribute("end", offset + schemes.size());
|
105 |
model.addAttribute("end", offset + schemes.size());
|
| 107 |
}
|
106 |
}
|
| 108 |
else{
|
107 |
else{
|
| 109 |
model.addAttribute("end", offset + limit);
|
108 |
model.addAttribute("end", offset + limit);
|
| Line 111... |
Line 110... |
| 111 |
return "schemes";
|
110 |
return "schemes";
|
| 112 |
}
|
111 |
}
|
| 113 |
|
112 |
|
| 114 |
@RequestMapping(value = "/getPaginatedSchemes", method = RequestMethod.GET)
|
113 |
@RequestMapping(value = "/getPaginatedSchemes", method = RequestMethod.GET)
|
| 115 |
public String getPaginatedSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model){
|
114 |
public String getPaginatedSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model){
|
| - |
|
115 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 116 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
116 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 117 |
model.addAttribute("schemes", schemes);
|
117 |
model.addAttribute("schemes", schemes);
|
| 118 |
return "schemes-paginated";
|
118 |
return "schemes-paginated";
|
| 119 |
}
|
119 |
}
|
| 120 |
|
120 |
|