Revision 50612
Added by Konstantina Galouni about 6 years ago
PageHelpContentController.java | ||
---|---|---|
36 | 36 |
private CommunityDAO communityDAO; |
37 | 37 |
|
38 | 38 |
@RequestMapping(value = "/pagehelpcontent", method = RequestMethod.GET) |
39 |
public List<PageHelpContentResponse> getPageHelpContents(@RequestParam(required=false) String community, @RequestParam(required=false) String page, @RequestParam(required=false) String position ) { |
|
39 |
public List<PageHelpContentResponse> getPageHelpContents(@RequestParam(required=false) String community, |
|
40 |
@RequestParam(required=false) String page, |
|
41 |
@RequestParam(required=false) String position, |
|
42 |
@RequestParam(required=false) String active, |
|
43 |
@RequestParam(required=false) String before) { |
|
40 | 44 |
List<PageHelpContent> pageHelpContents = null; |
41 | 45 |
|
42 | 46 |
Community _community = null; |
43 | 47 |
if(community != null) { |
44 | 48 |
_community = communityDAO.findByPid(community); |
45 | 49 |
} |
50 |
//pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsActiveAndisPriorToOrderByOrderAsc(community, position, Boolean.parseBoolean(active), Boolean.parseBoolean(before)); |
|
46 | 51 |
|
47 |
if(community != null && position != null){ |
|
52 |
if(community != null && position != null && active != null && before != null) { |
|
53 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(_community.getId(), position, Boolean.parseBoolean(active), Boolean.parseBoolean(before)); |
|
54 |
} else if(community != null && position != null && active != null) { |
|
55 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsActiveOrderByOrderAsc(_community.getId(), position, Boolean.parseBoolean(active)); |
|
56 |
} else if(community != null && position != null && before != null) { |
|
57 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsPriorToOrderByOrderAsc(_community.getId(), position, Boolean.parseBoolean(before)); |
|
58 |
} else if(community != null && active != null && before != null) { |
|
59 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(_community.getId(), Boolean.parseBoolean(active), Boolean.parseBoolean(before)); |
|
60 |
} else if(position != null && active != null && before != null) { |
|
61 |
pageHelpContents = pageHelpContentDAO.findByPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(position, Boolean.parseBoolean(active), Boolean.parseBoolean(before)); |
|
62 |
} else if(community != null && position != null ) { |
|
48 | 63 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementOrderByOrderAsc(_community.getId(), position); |
64 |
} else if(community != null && active != null ) { |
|
65 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndIsActiveOrderByPlacementAscOrderAsc(_community.getId(), Boolean.parseBoolean(active)); |
|
66 |
} else if(community != null && before != null) { |
|
67 |
pageHelpContents = pageHelpContentDAO.findByCommunityAndIsPriorToOrderByPlacementAscOrderAsc(_community.getId(), Boolean.parseBoolean(before)); |
|
68 |
} else if(position != null && active != null) { |
|
69 |
pageHelpContents = pageHelpContentDAO.findByPlacementAndIsActiveOrderByOrderAsc(position, Boolean.parseBoolean(active)); |
|
70 |
} else if(position != null && before != null) { |
|
71 |
pageHelpContents = pageHelpContentDAO.findByPlacementAndIsPriorToOrderByOrderAsc(position, Boolean.parseBoolean(before)); |
|
72 |
} else if(active != null && before != null) { |
|
73 |
pageHelpContents = pageHelpContentDAO.findByIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(Boolean.parseBoolean(active), Boolean.parseBoolean(before)); |
|
49 | 74 |
} else if(community != null) { |
50 | 75 |
pageHelpContents = pageHelpContentDAO.findByCommunityOrderByPlacementAscOrderAsc(_community.getId()); |
51 | 76 |
} else if(position != null) { |
52 | 77 |
pageHelpContents = pageHelpContentDAO.findByPlacementOrderByOrderAsc(position); |
78 |
} else if(active != null) { |
|
79 |
pageHelpContents = pageHelpContentDAO.findByIsActiveOrderByPlacementAscOrderAsc(Boolean.parseBoolean(active)); |
|
80 |
} else if(before != null) { |
|
81 |
pageHelpContents = pageHelpContentDAO.findByIsPriorToOrderByPlacementAscOrderAsc(Boolean.parseBoolean(before)); |
|
53 | 82 |
} else { |
54 | 83 |
pageHelpContents = pageHelpContentDAO.findAllByOrderByPlacementAscOrderAsc(); |
55 | 84 |
} |
... | ... | |
103 | 132 |
return pageHelpContentDAO.findById(id); |
104 | 133 |
} |
105 | 134 |
|
106 |
@RequestMapping(value = "/pagehelpcontent/{id}", method = RequestMethod.DELETE) |
|
107 |
public void deletePageHelpContent(@PathVariable(value = "id") String id) { |
|
108 |
pageHelpContentDAO.delete(id); |
|
109 |
} |
|
110 |
|
|
111 | 135 |
@RequestMapping(value = "/pagehelpcontent/toggle", method = RequestMethod.POST) |
112 | 136 |
public List<String> togglePageHelpContent(@RequestBody List<String> pageHelpContents, @RequestParam String status) throws Exception { |
113 | 137 |
for (String id: pageHelpContents) { |
... | ... | |
119 | 143 |
return pageHelpContents; |
120 | 144 |
} |
121 | 145 |
|
146 |
@RequestMapping(value = "/pagehelpcontent/{id}", method = RequestMethod.DELETE) |
|
147 |
public void deletePageHelpContent(@PathVariable(value = "id") String id) { |
|
148 |
pageHelpContentDAO.delete(id); |
|
149 |
} |
|
150 |
|
|
122 | 151 |
@RequestMapping(value = "/pagehelpcontent/delete", method = RequestMethod.POST) |
123 | 152 |
public Boolean deletePageHelpContents(@RequestBody List<String> pageHelpContents) throws Exception { |
124 | 153 |
for (String id: pageHelpContents) { |
Also available in: Unified diff
1. Added DivId class and API : special classes to be used by explore portal pages which have steps
2. Added DivHelpContent class and API
3. Added parameter 'div' (true/false) in '/community' to get communities related to some divIds
4. Added parameter 'div' (true/false) in '/community/{pid}/pages' to get pages of a community, which are related to some divIds
5. Added parameter 'before' (true/false) in '/pagehelpcontent'
6. When a community is deleted, all divIds, div contents, page contents related to this community are deleted too
7. When a page is deleted, all divIds, div contents, page contents related to this page are deleted too (page is also deleted from all communities)
8. In 'PageHelpContent' class 'before' field renamed to 'isPriorTo'
9. Bug fixes to ask community by 'pid' not 'id'