Revision 58395
Added by Konstantina Galouni about 4 years ago
PortalService.java | ||
---|---|---|
88 | 88 |
|
89 | 89 |
public PortalResponse getPortalFull(String pid) { |
90 | 90 |
Portal portal = portalDAO.findByPid(pid); |
91 |
if(pid != null && portal == null) { |
|
92 |
return null; |
|
93 |
} |
|
91 | 94 |
PortalResponse portalResponse = new PortalResponse(portal); |
92 | 95 |
|
93 | 96 |
setEnabledPagesForPortalByType(portal, portalResponse); |
... | ... | |
133 | 136 |
portalEntities.add(portalEntity); |
134 | 137 |
} |
135 | 138 |
|
136 |
for(Page page : pageService.getAllPages(null, null, null)) {
|
|
139 |
for(Page page : pageService.getPagesByPortalType(portal.getType())) {
|
|
137 | 140 |
pages.put(page.getId(), true); |
138 | 141 |
|
139 | 142 |
PortalPage portalPage = new PortalPage(page); |
... | ... | |
159 | 162 |
|
160 | 163 |
String id = savedPortal.getId(); |
161 | 164 |
|
162 |
divHelpContentService.addDivHelpContentsInPortal(savedPortal.getPid(), id, null);
|
|
163 |
pageHelpContentService.addPageHelpContentsInPortal(savedPortal.getPid(), id);
|
|
165 |
divHelpContentService.addDivHelpContentsInPortal(id, savedPortal.getType());
|
|
166 |
pageHelpContentService.addPageHelpContentsInPortal(id, savedPortal.getType());
|
|
164 | 167 |
|
165 | 168 |
return portalResponse; |
166 | 169 |
} |
... | ... | |
211 | 214 |
} |
212 | 215 |
|
213 | 216 |
// delete page contents related to this portal |
214 |
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(pid, null,null, null, null); |
|
217 |
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(pid, null, null,null, null, null);
|
|
215 | 218 |
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) { |
216 | 219 |
pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId()); |
217 | 220 |
} |
... | ... | |
237 | 240 |
return true; |
238 | 241 |
} |
239 | 242 |
|
243 |
public String deletePortal(String id) { |
|
244 |
Portal portal = portalDAO.findById(id); |
|
245 |
String pid = portal.getPid(); |
|
246 |
|
|
247 |
// delete div contents related to this portal |
|
248 |
List<DivHelpContentResponse> divHelpContentResponses = divHelpContentService.getDivHelpContents(pid, null, null, null); |
|
249 |
for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) { |
|
250 |
divHelpContentService.deleteDivHelpContent(divHelpContentResponse.getId()); |
|
251 |
} |
|
252 |
|
|
253 |
// delete page contents related to this portal |
|
254 |
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(pid, null, null,null, null, null); |
|
255 |
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) { |
|
256 |
pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId()); |
|
257 |
} |
|
258 |
|
|
259 |
// if no other portlas with the same type, delete pages and divIds for this portal type |
|
260 |
List<Portal> portalsWithSameType = portalDAO.findByType(portal.getType()); |
|
261 |
if(portalsWithSameType == null || portalsWithSameType.size() == 1) { |
|
262 |
// delete pages for this portal type |
|
263 |
for(String pageId : portal.getPages().keySet()) { |
|
264 |
pageService.deletePage(pageId); |
|
265 |
} |
|
266 |
|
|
267 |
// delete divIds for this portal type |
|
268 |
List<DivId> divIds = divIdService.getDivIdsByPortalType(portal.getType()); |
|
269 |
for(DivId divId : divIds) { |
|
270 |
divIdService.deleteDivId(divId.getId()); |
|
271 |
} |
|
272 |
} |
|
273 |
|
|
274 |
portalDAO.delete(id); |
|
275 |
return pid; |
|
276 |
} |
|
277 |
|
|
240 | 278 |
public Portal insertOrUpdatePortal(Portal portal) { |
241 | 279 |
return portalDAO.save(portal); |
242 | 280 |
} |
... | ... | |
251 | 289 |
return portalDAO.findByPid(pid); |
252 | 290 |
} |
253 | 291 |
|
254 |
public void deletePortal(String id) { |
|
292 |
public void deletePortalId(String id) {
|
|
255 | 293 |
portalDAO.delete(id); |
256 | 294 |
} |
257 | 295 |
|
... | ... | |
407 | 445 |
Map<String, List<PageHelpContentResponse>> pageHelpContentResponses = new HashMap<>(); |
408 | 446 |
|
409 | 447 |
List<PageHelpContentResponse> pageHelpContents = null; |
410 |
pageHelpContents = pageHelpContentService.getPageHelpContents(pid, page, null, active, null); |
|
448 |
pageHelpContents = pageHelpContentService.getPageHelpContents(pid, null, page, null, active, null);
|
|
411 | 449 |
|
412 | 450 |
pageHelpContentResponses.put("top", new ArrayList<>()); |
413 | 451 |
pageHelpContentResponses.put("bottom", new ArrayList<>()); |
Also available in: Unified diff
[Trunk | Admin Tools Library Service]:
1. DivHelpContentController.java: In "getDivHelpContents()" (/divhelpcontent) method rename parameter "div" to "divId" | Delete unnecessary method "addDivHelpContentsInPortal()".
2. PageHelpContentController.java: In "getPageHelpContents()" (/pagehelpconent) method add request parameter "portalType".
3. PortalController.java: Controller added for common methods of "ExploreController", "ConnectController" and "CommunityController" in "Admin Tools Service" - @RequestMapping with multiple paths.
4. DivIdDAO.java & MongoDBDivIdDAO.java:
a. Method "findByName()" returns List with new schema.
b. Added methods: "List<DivId> findByPagesContainingAndPortalType()", "DivId findByPagesContainingAndNameAndPortalType()", "DivId findByNameAndPortalType()".
5. PortalDAO.java & MongoDBPortalDAO.java: Added method "findByType()".
6. Portal.java & PortalResponse.java: Removed "layout" field and its methods.
7. DivHelpContentService.java:
a. In "getDivHelpContents()" (/divhelpcontent) method rename parameter "div" to "divId"
b. public void addDivHelpContentsInPortal(String pid, String portalId, String divIdName) --> public void addDivHelpContentsInPortal(String portalId, String portalType)
8. DivIdService.java:
a. [Bug fix] "getDivIds()", "getDivIdsFull()", "deleteDivIds()", "getDivIdsPages()" methods
b. Added method "getDivIdsByPortalType()"
c. Commented "getDivIdByName()" method.
9. PageHelpContentService.java:
a. In "getPageHelpContents()" method add parameter "portalType" and do bug fixes.
b. public void addPageHelpContentsInPortal(String pid, String portalId) --> public void addPageHelpContentsInPortal(String portalId, String portalType).
10. PageService.java:
a. [Bug fix] "getPagesFull()", "getAllPages()", "deletePageHelpContentsForPositionsIfDisabled()" methods.
b. Added methods "getPagesByPortalType()" and "getPageByPortalTypeAndRoute()".
11. PortalService.java:
a. [Bug fix] "getPortalFull()".
b. Method "deletePortal()" renamed to "deletePortalId()" and added NEW "deletePortal()" which deletes related page and div contents (and if no portal with the same type, also pages and divIds).