master #1

Merged
konstantina.galouni merged 4 commits from master into beta 2023-05-03 12:07:48 +02:00
1 changed files with 12 additions and 5 deletions
Showing only changes of commit 4080c5326e - Show all commits

View File

@ -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