Project

General

Profile

« Previous | Next » 

Revision 57987

[Trunk | Monitor Service]:
1. SectionController.java: In 'saveSection()' method add in path index where section will be stored in subcategory (path: /{stakeholderId}/{topicId}/{categoryId}/{subcategoryId}/save/{index}).
2. IndicatorController.java: In 'parameterMapping()' method add replacement in number url - add 'urlEncode()' helper method.

View differences:

SectionController.java
54 54
        return sectionFull;
55 55
    }
56 56

  
57
    @RequestMapping(value = "/{stakeholderId}/{topicId}/{categoryId}/{subcategoryId}/save", method = RequestMethod.POST)
57
    @RequestMapping(value = "/{stakeholderId}/{topicId}/{categoryId}/{subcategoryId}/save/{index}", method = RequestMethod.POST)
58 58
    public Section saveSection(@PathVariable("stakeholderId") String stakeholderId,
59
                                 @PathVariable("topicId") String topicId,
60
                                 @PathVariable("categoryId") String categoryId,
61
                                 @PathVariable("subcategoryId") String subcategoryId,
62
                                 @RequestBody Section<Indicator> sectionFull) {
59
                               @PathVariable("topicId") String topicId,
60
                               @PathVariable("categoryId") String categoryId,
61
                               @PathVariable("subcategoryId") String subcategoryId,
62
                               @PathVariable("index") String index,
63
                               @RequestBody Section<Indicator> sectionFull) {
63 64
        log.debug("save section");
64 65
        log.debug("Name: "+sectionFull.getTitle() + " - Id: "+sectionFull.getId() + " - Stakeholder: "+stakeholderId + " - Topic: "+topicId + " - Category: "+categoryId+ " - SubCategory: "+subcategoryId);
65 66

  
......
92 93
            sections = subCategory.getNumbers();
93 94
        }
94 95

  
95
        int index = sections.indexOf(sectionFull.getId());
96
        if (index == -1) {
97
            sections.add(sectionFull.getId());
96
        int existing_index = sections.indexOf(sectionFull.getId());
97
        if (existing_index == -1) {
98
            if(index != null) {
99
                sections.add(Integer.parseInt(index), sectionFull.getId());
100
            } else {
101
                sections.add(sectionFull.getId());
102
            }
98 103
            subCategoryDAO.save(subCategory);
99 104
            log.debug("Section saved!");
100 105

  

Also available in: Unified diff