Revision 57934
Added by Konstantina Galouni over 4 years ago
IndicatorController.java | ||
---|---|---|
563 | 563 |
SubCategory<String> subcategory = subCategoryDAO.findById(subcategoryId); |
564 | 564 |
if (subcategory != null) { |
565 | 565 |
if (category.getSubCategories().contains(subcategoryId)) { |
566 |
indicatorDAO.save(indicator); |
|
567 |
log.debug("Indicator toggled!"); |
|
566 |
List<String> indicators = null; |
|
567 |
if(indicator.getType().equals("chart")) { |
|
568 |
indicators = subcategory.getCharts(); |
|
569 |
} else if(indicator.getType().equals("number")) { |
|
570 |
indicators = subcategory.getNumbers(); |
|
571 |
} |
|
572 |
|
|
573 |
if(indicators.contains(indicator.getId())) { |
|
574 |
indicatorDAO.save(indicator); |
|
575 |
log.debug("Indicator toggled!"); |
|
576 |
} else { |
|
577 |
// EXCEPTION - Indicator not found in Stakeholder: stakeholder.getAlias(); -> Topic: topic.getAlias(); -> Category: category.getAlias(); -> SubCategory: subCategory.getAlias(); |
|
578 |
throw new PathNotValidException("Toggle indicators: Indicator with id: "+indicator.getId()+" not found in SubCategory: "+subcategoryId); |
|
579 |
} |
|
568 | 580 |
} else { |
569 | 581 |
// EXCEPTION - SubCategory not found in Stakeholder: stakeholder.getAlias(); -> Topic: topic.getAlias(); -> Category: category.getAlias(); |
570 |
throw new PathNotValidException("Reorder indicators: SubCategory with id: "+subcategoryId+" not found in Category: "+categoryId);
|
|
582 |
throw new PathNotValidException("Toggle indicators: SubCategory with id: "+subcategoryId+" not found in Category: "+categoryId);
|
|
571 | 583 |
} |
572 | 584 |
} else { |
573 | 585 |
// EXCEPTION - SubCategory not found |
574 |
throw new EntityNotFoundException("Reorder indicators: SubCategory with id: "+subcategoryId+" not found");
|
|
586 |
throw new EntityNotFoundException("Toggle indicators: SubCategory with id: "+subcategoryId+" not found");
|
|
575 | 587 |
} |
576 | 588 |
} else { |
577 | 589 |
// EXCEPTION - Category not found in Stakeholder: stakeholder.getAlias(); -> Topic: topic.getAlias(); |
578 |
throw new PathNotValidException("Reorder indicators: Category with id: "+categoryId+" not found in Topic: "+topicId);
|
|
590 |
throw new PathNotValidException("Toggle indicators: Category with id: "+categoryId+" not found in Topic: "+topicId);
|
|
579 | 591 |
} |
580 | 592 |
} else { |
581 | 593 |
// EXCEPTION - Category not found |
582 |
throw new EntityNotFoundException("Reorder indicators: Category with id: "+categoryId+" not found");
|
|
594 |
throw new EntityNotFoundException("Toggle indicators: Category with id: "+categoryId+" not found");
|
|
583 | 595 |
} |
584 | 596 |
} else { |
585 | 597 |
// EXCEPTION - Topic not found in Stakeholder: stakeholder.getAlias(); |
586 |
throw new PathNotValidException("Reorder indicators: Topic with id: "+topicId+" not found in Stakeholder: "+stakeholderId);
|
|
598 |
throw new PathNotValidException("Toggle indicators: Topic with id: "+topicId+" not found in Stakeholder: "+stakeholderId);
|
|
587 | 599 |
} |
588 | 600 |
} else { |
589 | 601 |
// EXCEPTION - Topic not found |
590 |
throw new EntityNotFoundException("Reorder indicators: Topic with id: "+topicId+" not found");
|
|
602 |
throw new EntityNotFoundException("Toggle indicators: Topic with id: "+topicId+" not found");
|
|
591 | 603 |
} |
592 | 604 |
} else { |
593 | 605 |
// EXCEPTION - Stakeholder not found |
594 |
throw new EntityNotFoundException("Reorder indicators: Stakeholder with id: "+stakeholderId+" not found");
|
|
606 |
throw new EntityNotFoundException("Toggle indicators: Stakeholder with id: "+stakeholderId+" not found");
|
|
595 | 607 |
} |
596 | 608 |
} |
597 | 609 |
} |
Also available in: Unified diff
StakeholderController.java & TopicController.java & CategoryController.java & SubCategoryController.java: toggle methods for status and access added.