Revision 62394
Added by Konstantina Galouni almost 2 years ago
CommunityController.java | ||
---|---|---|
159 | 159 |
} |
160 | 160 |
return layoutService.save(layout); |
161 | 161 |
} |
162 |
|
|
163 |
@PreAuthorize("hasAnyAuthority(" + |
|
164 |
"@AuthorizationService.PORTAL_ADMIN, " + |
|
165 |
"@AuthorizationService.curator('community'))") |
|
166 |
@RequestMapping(value = "/{pid}/layout", method = RequestMethod.DELETE) |
|
167 |
public boolean deleteLayoutForCommunity(@PathVariable(value = "pid") String pid) { |
|
168 |
Portal portal = portalService.getPortal(pid); |
|
169 |
if(portal == null) { |
|
170 |
// EXCEPTION - Entity Not Found |
|
171 |
throw new ContentNotFoundException("CommunityController - Delete layout: Portal with pid: " + pid + " not found"); |
|
172 |
} |
|
173 |
if(!portal.getType().equals("community")) { |
|
174 |
// EXCEPTION - MismatchingContent |
|
175 |
throw new MismatchingContentException("CommunityController - Delete layout: Portal with pid: "+pid+" has type: "+portal.getType()+" instead of community"); |
|
176 |
} |
|
177 |
return layoutService.deleteByPid(pid); |
|
178 |
} |
|
162 | 179 |
} |
163 | 180 |
|
Also available in: Unified diff
[Admin Tools | Trunk]:
1. pom.xml: Increased version.
2. LayoutDAO.java & MongoDBLayoutDAO.java: Updated return type of "findByPortalPid()" to be List<Layout>.
3. LayoutService.java: Updated all usages of "findByPortalPid()" | In "save()" method, if there is one existing Layout for this pid already, set id to update layout instead of saving a new one.
4. CommunityController.java: Added method "deleteLayoutForCommunity()" (DELETE /community/{pid}/layout).
5. ConnectController.java: Added methods for "connect" and "default" pids:
"getLayoutForConnect()" (GET /connect/{pid}/layout - no authorization), "updateLayoutForConnect()" (POST /connect/{pid}/layout), "deleteLayoutForConnect()" (DELETE /connect/{pid}/layout).