master #1
|
@ -688,7 +688,7 @@ public class StakeholderController {
|
|||
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
@RequestMapping(value = "/{stakeholderId}/change-visibility", method = RequestMethod.POST)
|
||||
public Visibility changeStakeholderVisibility(@PathVariable("stakeholderId") String stakeholderId,
|
||||
public Stakeholder changeStakeholderVisibility(@PathVariable("stakeholderId") String stakeholderId,
|
||||
@RequestParam("visibility") Visibility visibility, @RequestParam(required = false) Boolean propagate) {
|
||||
log.debug("change stakeholder visibility: "+visibility + " - toggle propagate: "+((propagate != null && propagate) ? "true" : "false"));
|
||||
log.debug("Stakeholder: "+stakeholderId);
|
||||
|
@ -713,17 +713,24 @@ public class StakeholderController {
|
|||
return changeStakeholderVisibilityTree(stakeholder, visibility, propagate);
|
||||
}
|
||||
|
||||
private Visibility changeStakeholderVisibilityTree(Stakeholder<String> stakeholder, Visibility visibility, Boolean propagate) {
|
||||
private Stakeholder changeStakeholderVisibilityTree(Stakeholder<String> stakeholder, Visibility visibility, Boolean propagate) {
|
||||
Stakeholder<Topic> stakeholderFull = new Stakeholder<>(stakeholder);
|
||||
List<Topic> topicsFull = new ArrayList<>();
|
||||
|
||||
if(propagate != null && propagate) {
|
||||
for (String topicId : stakeholder.getTopics()) {
|
||||
topicController.changeVisibilityTree(topicId, visibility, propagate);
|
||||
topicsFull.add(topicController.changeVisibilityTree(topicId, visibility, propagate));
|
||||
}
|
||||
}
|
||||
stakeholder.setVisibility(visibility);
|
||||
|
||||
stakeholder.setVisibility(visibility);
|
||||
stakeholderDAO.save(stakeholder);
|
||||
log.debug("Stakeholder toggled!");
|
||||
return stakeholder.getVisibility();
|
||||
|
||||
stakeholderFull.setVisibility(visibility);
|
||||
stakeholderFull.setTopics(topicsFull);
|
||||
|
||||
return stakeholder;
|
||||
}
|
||||
|
||||
// The following are not supposed to be used
|
||||
|
|
Loading…
Reference in New Issue