Project

General

Profile

« Previous | Next » 

Revision 58395

[Trunk | Admin Tools Library Service]:
1. DivHelpContentController.java: In "getDivHelpContents()" (/divhelpcontent) method rename parameter "div" to "divId" | Delete unnecessary method "addDivHelpContentsInPortal()".
2. PageHelpContentController.java: In "getPageHelpContents()" (/pagehelpconent) method add request parameter "portalType".
3. PortalController.java: Controller added for common methods of "ExploreController", "ConnectController" and "CommunityController" in "Admin Tools Service" - @RequestMapping with multiple paths.
4. DivIdDAO.java & MongoDBDivIdDAO.java:
a. Method "findByName()" returns List with new schema.
b. Added methods: "List<DivId> findByPagesContainingAndPortalType()", "DivId findByPagesContainingAndNameAndPortalType()", "DivId findByNameAndPortalType()".
5. PortalDAO.java & MongoDBPortalDAO.java: Added method "findByType()".
6. Portal.java & PortalResponse.java: Removed "layout" field and its methods.
7. DivHelpContentService.java:
a. In "getDivHelpContents()" (/divhelpcontent) method rename parameter "div" to "divId"
b. public void addDivHelpContentsInPortal(String pid, String portalId, String divIdName) --> public void addDivHelpContentsInPortal(String portalId, String portalType)
8. DivIdService.java:
a. [Bug fix] "getDivIds()", "getDivIdsFull()", "deleteDivIds()", "getDivIdsPages()" methods
b. Added method "getDivIdsByPortalType()"
c. Commented "getDivIdByName()" method.
9. PageHelpContentService.java:
a. In "getPageHelpContents()" method add parameter "portalType" and do bug fixes.
b. public void addPageHelpContentsInPortal(String pid, String portalId) --> public void addPageHelpContentsInPortal(String portalId, String portalType).
10. PageService.java:
a. [Bug fix] "getPagesFull()", "getAllPages()", "deletePageHelpContentsForPositionsIfDisabled()" methods.
b. Added methods "getPagesByPortalType()" and "getPageByPortalTypeAndRoute()".
11. PortalService.java:
a. [Bug fix] "getPortalFull()".
b. Method "deletePortal()" renamed to "deletePortalId()" and added NEW "deletePortal()" which deletes related page and div contents (and if no portal with the same type, also pages and divIds).

View differences:

modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/DivIdDAO.java
5 5
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
6 6

  
7 7
public interface DivIdDAO {
8
    List<DivId> findAll();
9

  
10
    List<DivId> findByPagesContaining(String page);
11

  
8
    DivId findByPagesContainingAndNameAndPortalType(String page, String name, String portalType);
12 9
    DivId findByPagesContainingAndName(String page, String name);
13
    DivId findByName(String name);
14

  
10
    DivId findByNameAndPortalType(String name, String portalType);
15 11
    DivId findById(String Id);
16 12

  
13
    List<DivId> findAll();
14
    List<DivId> findByPagesContaining(String page);
15
    List<DivId> findByName(String name);
17 16
    List<DivId> findByPortalType(String portalType);
17
    List<DivId> findByPagesContainingAndPortalType(String page, String portalType);
18 18

  
19 19
    DivId save(DivId divId);
20 20

  
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/PortalDAO.java
6 6

  
7 7
public interface PortalDAO {
8 8
    List<Portal> findAll();
9
    List<Portal> findByType(String Type);
9 10

  
10 11
    Portal findById(String Id);
11 12

  
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBDivIdDAO.java
8 8
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
9 9

  
10 10
public interface MongoDBDivIdDAO extends DivIdDAO, MongoRepository<DivId, String> {
11
    List<DivId> findAll();
12

  
13
    List<DivId> findByPagesContaining(String page);
14

  
11
    DivId findByPagesContainingAndNameAndPortalType(String page, String name, String portalType);
15 12
    DivId findByPagesContainingAndName(String page, String name);
16
    DivId findByName(String name);
17

  
13
    DivId findByNameAndPortalType(String name, String portalType);
18 14
    DivId findById(String Id);
19 15

  
16
    List<DivId> findAll();
17
    List<DivId> findByPagesContaining(String page);
18
    List<DivId> findByName(String name);
20 19
    List<DivId> findByPortalType(String portalType);
20
    List<DivId> findByPagesContainingAndPortalType(String page, String portalType);
21 21

  
22 22
    DivId save(DivId divId);
23 23

  
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBPortalDAO.java
9 9

  
10 10
public interface MongoDBPortalDAO extends PortalDAO, MongoRepository<Portal, String> {
11 11
    List<Portal> findAll();
12
    List<Portal> findByType(String Type);
12 13

  
13 14
    Portal findById(String Id);
14 15

  
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/DivIdService.java
30 30
    private DivHelpContentService divHelpContentService;
31 31

  
32 32
    public List<DivId> getDivIds(String page, String name, String pid) {
33
        Portal portal = portalService.getPortal(pid);
34
        String portalType = portal.getType();
35

  
36 33
        List<DivId> divIds = null;
37 34

  
38
        if(page != null && name != null) {
35
        if(page != null && name != null && pid != null) {
36
            Portal portal = portalService.getPortal(pid);
37
            if(portal == null) {
38
                return null;
39
            }
40
            String portalType = portal.getType();
41

  
42
            DivId divId = divIdDAO.findByPagesContainingAndNameAndPortalType(page, name, portalType);
43
            if(divId != null) {
44
                divIds = new ArrayList<>();
45
                divIds.add(divId);
46
            }
47
        }
48
        else if(page != null && name != null) {
39 49
            DivId divId = divIdDAO.findByPagesContainingAndName(page, name);
40 50
            if(divId != null) {
41 51
                divIds = new ArrayList<>();
42 52
                divIds.add(divId);
43 53
            }
44
        } else if(page != null) {
45
            divIds = divIdDAO.findByPagesContaining(page);
46
        } else if(name != null) {
47
            DivId divId = divIdDAO.findByName(name);
54
        } else if(page != null && pid != null) {
55
            Portal portal = portalService.getPortal(pid);
56
            if(portal == null) {
57
                return null;
58
            }
59
            String portalType = portal.getType();
60
            divIds = divIdDAO.findByPagesContainingAndPortalType(page, portalType);
61
        } else if(name != null && pid != null) {
62
            Portal portal = portalService.getPortal(pid);
63
            if(portal == null) {
64
                return null;
65
            }
66

  
67
            String portalType = portal.getType();
68

  
69
            DivId divId = divIdDAO.findByNameAndPortalType(name, portalType);
48 70
            if(divId != null) {
49 71
                divIds = new ArrayList<>();
50 72
                divIds.add(divId);
51 73
            }
74
        } else if(page != null) {
75
            divIds = divIdDAO.findByPagesContaining(page);
76
        } else if(name != null) {
77
            divIds = divIdDAO.findByName(name);
78
        } else if(pid != null) {
79
            Portal portal = portalService.getPortal(pid);
80
            if(portal == null) {
81
                return null;
82
            }
83
            String portalType = portal.getType();
84
            divIds = divIdDAO.findByPortalType(portalType);
52 85
        } else {
53 86
            divIds = divIdDAO.findAll();
54 87
        }
55 88

  
56
        if(portalType != null) {
57
            Iterator<DivId> iteratorDivIds = divIds.iterator();
58
            while(iteratorDivIds.hasNext()) {
59
                DivId divId = iteratorDivIds.next();
60
                if (!portalType.equals(divId.getPortalType())) {
61
                    iteratorDivIds.remove();
62
                }
63
            }
64
        }
89
//        if(portalType != null) {
90
//            Iterator<DivId> iteratorDivIds = divIds.iterator();
91
//            while(iteratorDivIds.hasNext()) {
92
//                DivId divId = iteratorDivIds.next();
93
//                if (!portalType.equals(divId.getPortalType())) {
94
//                    iteratorDivIds.remove();
95
//                }
96
//            }
97
//        }
65 98

  
66 99
        return divIds;
67 100
    }
68 101

  
102
    public List<DivId> getDivIdsByPortalType(String portalType) {
103
        if (portalType == null) {
104
            return null;
105
        }
106
        return divIdDAO.findByPortalType(portalType);
107
    }
108

  
69 109
    public List<DivIdResponse> getDivIdsFull(String page, String name, String pid) {
70

  
71 110
        List<DivId> divIds = this.getDivIds(page, name, pid);
111
        if(divIds == null) {
112
            return null;
113
        }
72 114

  
73 115
        List<DivIdResponse> divIdResponses = new ArrayList<>();
74 116
        for(DivId divId : divIds) {
......
85 127
        return divIdResponses;
86 128
    }
87 129

  
88
    public DivId getDivIdByName(String name) {
89
        return divIdDAO.findByName(name);
90
    }
130
//    public DivId getDivIdByName(String name) {
131
//        return divIdDAO.findByName(name);
132
//    }
91 133

  
92 134
    public DivId getDivId(String id) {
93 135
        return divIdDAO.findById(id);
......
208 250

  
209 251
    public Boolean deleteDivIds(List<String> divIds) throws Exception {
210 252
        for (String id: divIds) {
211
            DivId divId = divIdDAO.findById(id);
212

  
213 253
            // delete div contents related to this divId
214
            List<DivHelpContentResponse> divHelpContentResponses = divHelpContentService.getDivHelpContents(null, null, divId.getName(), null);
254
            List<DivHelpContentResponse> divHelpContentResponses = divHelpContentService.getDivHelpContents(null, null, id, null);
215 255
            for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) {
216 256
                divHelpContentService.deleteDivHelpContent(divHelpContentResponse.getId());
217 257
            }
......
226 266
    }
227 267

  
228 268
    public Set<String> getDivIdsPages(String pid) {
229
        Portal portal = portalService.getPortal(pid);
230
        String portalType = portal.getType();
231

  
232 269
        List<DivId> divIds = null;
233 270
        Set<String> hasPortalPageDivIds = new HashSet<>();
234 271

  
235
        if(portalType != null) {
272
        if(pid != null) {
273
            Portal portal = portalService.getPortal(pid);
274
            if(portal == null) {
275
                return null;
276
            }
277
            String portalType = portal.getType();
236 278
            divIds = divIdDAO.findByPortalType(portalType);
237 279
        } else {
238 280
            divIds = divIdDAO.findAll();
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/PageHelpContentService.java
26 26
    @Autowired
27 27
    private PortalService portalService;
28 28

  
29
    public List<PageHelpContentResponse> getPageHelpContents(String pid, String page, String position, String active, String before) {
29
    public List<PageHelpContentResponse> getPageHelpContents(String pid, String portalType, String page, String position, String active, String before) {
30 30
        List<PageHelpContent> pageHelpContents = null;
31 31

  
32 32
        Portal _portal = null;
......
75 75
        List<PageHelpContentResponse> pageHelpContentResponses = new ArrayList<>();
76 76
        for (PageHelpContent pageHelpContent : pageHelpContents) {
77 77
            Page _page = pageService.getPage(pageHelpContent.getPage());
78
            if(page == null || page.equals(_page.getRoute())) {
78
            if((page == null || page.equals(_page.getRoute())) && (portalType == null || portalType.equals(_page.getPortalType()))) {
79 79
                PageHelpContentResponse pageHelpContentResponse = new PageHelpContentResponse(pageHelpContent);
80 80

  
81 81
                pageHelpContentResponse.setPage(_page);
......
125 125
        return true;
126 126
    }
127 127

  
128
    public void addPageHelpContentsInPortal(String pid, String portalId) {
129
        if (pid != "connect" && pid != "openaire") {
128
    public void addPageHelpContentsInPortal(String portalId, String portalType) {
129
        Page organizationsPage = pageService.getPageByPortalTypeAndRoute(portalType, "/organizations");
130
        if(organizationsPage != null) {
130 131
            String organizations_page_content = "<div> <p>Here you can write more details about the organizations related to your community.</p> </div>";
131
            Page organizationsPage = (pageService.getAllPages(null, "/organizations", null)).get(0);
132 132

  
133
            PageHelpContent organizations_pageHelpContent = new PageHelpContent(organizationsPage.getId(), pid, "top", 1, organizations_page_content, false, false);
133
            PageHelpContent organizations_pageHelpContent = new PageHelpContent(organizationsPage.getId(), portalId, "top", 1, organizations_page_content, false, false);
134 134
            this.insertPageHelpContent(organizations_pageHelpContent);
135
        }
135 136

  
137
        Page depositLearnHowPage = pageService.getPageByPortalTypeAndRoute(portalType, "/participate/deposit/learn-how");
138
        if(depositLearnHowPage != null) {
136 139
            String depositLearnHow_page_content = "" +
137 140
                    "<div class=\"uk-width-3-5 uk-align-center\"> " +
138 141
                    " <div class=\"uk-text-bold\">How to comply with funder Open Access policies</div> " +
......
143 146
                    "   <li>All OpenAIRE guides can be found <a class=\"custom-external\" href=\"https://www.openaire.eu/guides\" target=\"_blank\">here</a></li> " +
144 147
                    " </ul> " +
145 148
                    "</div>";
146
            Page depositLearnHowPage = (pageService.getAllPages(null, "/participate/deposit/learn-how", null)).get(0);
147 149

  
148
            PageHelpContent depositLearnHow_pageHelpContent = new PageHelpContent(depositLearnHowPage.getId(), pid, "bottom", 1, depositLearnHow_page_content, true, false);
150
            PageHelpContent depositLearnHow_pageHelpContent = new PageHelpContent(depositLearnHowPage.getId(), portalId, "bottom", 1, depositLearnHow_page_content, true, false);
149 151
            this.insertPageHelpContent(depositLearnHow_pageHelpContent);
150 152
        }
151 153
    }
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/PortalService.java
88 88

  
89 89
    public PortalResponse getPortalFull(String pid) {
90 90
        Portal portal = portalDAO.findByPid(pid);
91
        if(pid != null && portal == null) {
92
            return null;
93
        }
91 94
        PortalResponse portalResponse = new PortalResponse(portal);
92 95

  
93 96
        setEnabledPagesForPortalByType(portal, portalResponse);
......
133 136
            portalEntities.add(portalEntity);
134 137
        }
135 138

  
136
        for(Page page : pageService.getAllPages(null, null, null)) {
139
        for(Page page : pageService.getPagesByPortalType(portal.getType())) {
137 140
            pages.put(page.getId(), true);
138 141

  
139 142
            PortalPage portalPage = new PortalPage(page);
......
159 162

  
160 163
        String id = savedPortal.getId();
161 164

  
162
        divHelpContentService.addDivHelpContentsInPortal(savedPortal.getPid(), id, null);
163
        pageHelpContentService.addPageHelpContentsInPortal(savedPortal.getPid(), id);
165
        divHelpContentService.addDivHelpContentsInPortal(id, savedPortal.getType());
166
        pageHelpContentService.addPageHelpContentsInPortal(id, savedPortal.getType());
164 167

  
165 168
        return portalResponse;
166 169
    }
......
211 214
            }
212 215

  
213 216
            // delete page contents related to this portal
214
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(pid, null,null, null, null);
217
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(pid, null, null,null, null, null);
215 218
            for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
216 219
                pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
217 220
            }
......
237 240
        return true;
238 241
    }
239 242

  
243
    public String deletePortal(String id) {
244
        Portal portal = portalDAO.findById(id);
245
        String pid = portal.getPid();
246

  
247
        // delete div contents related to this portal
248
        List<DivHelpContentResponse> divHelpContentResponses = divHelpContentService.getDivHelpContents(pid, null, null, null);
249
        for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) {
250
            divHelpContentService.deleteDivHelpContent(divHelpContentResponse.getId());
251
        }
252

  
253
        // delete page contents related to this portal
254
        List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(pid, null, null,null, null, null);
255
        for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
256
            pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
257
        }
258

  
259
        // if no other portlas with the same type, delete pages and divIds for this portal type
260
        List<Portal> portalsWithSameType = portalDAO.findByType(portal.getType());
261
        if(portalsWithSameType == null || portalsWithSameType.size() == 1) {
262
            // delete pages for this portal type
263
            for(String pageId : portal.getPages().keySet()) {
264
                pageService.deletePage(pageId);
265
            }
266

  
267
            // delete divIds for this portal type
268
            List<DivId> divIds = divIdService.getDivIdsByPortalType(portal.getType());
269
            for(DivId divId : divIds) {
270
                divIdService.deleteDivId(divId.getId());
271
            }
272
        }
273

  
274
        portalDAO.delete(id);
275
        return pid;
276
    }
277

  
240 278
    public Portal insertOrUpdatePortal(Portal portal) {
241 279
        return portalDAO.save(portal);
242 280
    }
......
251 289
        return portalDAO.findByPid(pid);
252 290
    }
253 291

  
254
    public void deletePortal(String id) {
292
    public void deletePortalId(String id) {
255 293
        portalDAO.delete(id);
256 294
    }
257 295

  
......
407 445
        Map<String, List<PageHelpContentResponse>> pageHelpContentResponses = new HashMap<>();
408 446

  
409 447
        List<PageHelpContentResponse> pageHelpContents = null;
410
        pageHelpContents = pageHelpContentService.getPageHelpContents(pid, page, null, active, null);
448
        pageHelpContents = pageHelpContentService.getPageHelpContents(pid, null, page, null, active, null);
411 449

  
412 450
        pageHelpContentResponses.put("top", new ArrayList<>());
413 451
        pageHelpContentResponses.put("bottom", new ArrayList<>());
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/DivHelpContentService.java
28 28
    @Autowired
29 29
    private PortalService portalService;
30 30

  
31
    public List<DivHelpContentResponse> getDivHelpContents(String pid, String page, String div, String active) {
31
    public List<DivHelpContentResponse> getDivHelpContents(String pid, String page, String divIdId, String active) {
32 32

  
33 33
        Portal _portal = portalService.getPortal(pid);
34 34
        String portalId = null;
......
36 36
            portalId = _portal.getId();
37 37
        }
38 38

  
39
        DivId divId = divIdService.getDivIdByName(div);
40
        String divIdId = null;
41
        if(divId != null) {
42
            divIdId = divId.getId();
43
        }
39
//        DivId divId = divIdService.getDivIdByName(divId);
40
//        String divIdId = null;
41
//        if(divId != null) {
42
//            divIdId = divId.getId();
43
//        }
44 44

  
45 45
        List<DivHelpContentResponse> divHelpContentResponses = new ArrayList<>();
46 46

  
47 47
        List<DivHelpContent> divHelpContents = null;
48
        if(pid != null && div != null && active != null) {
48
        if(pid != null && divIdId != null && active != null) {
49 49
            divHelpContents = divHelpContentDAO.findByPortalAndDivIdAndIsActive(portalId, divIdId, Boolean.parseBoolean(active));
50
        } else if(pid != null && div != null) {
50
        } else if(pid != null && divIdId != null) {
51 51
            divHelpContents = divHelpContentDAO.findByPortalAndDivId(portalId, divIdId);
52 52
        } else if(pid != null && active != null) {
53 53
            divHelpContents = divHelpContentDAO.findByPortalAndIsActive(portalId, Boolean.parseBoolean(active));
54
        } else if(div != null && active != null) {
54
        } else if(divIdId != null && active != null) {
55 55
            divHelpContents = divHelpContentDAO.findByDivIdAndIsActive(divIdId, Boolean.parseBoolean(active));
56 56
        } else if(pid != null) {
57 57
            divHelpContents = divHelpContentDAO.findByPortal(portalId);
58
        } else if(div != null) {
58
        } else if(divIdId != null) {
59 59
            divHelpContents = divHelpContentDAO.findByDivId(divIdId);
60 60
        } else if(active != null){
61 61
            divHelpContents = divHelpContentDAO.findByIsActive(Boolean.parseBoolean(active));
......
65 65

  
66 66
        for (DivHelpContent divHelpContent : divHelpContents) {
67 67
            DivIdResponse divIdResponse = null;
68
            if(div == null) {
68
            DivId divId;
69
            if(divIdId == null) {
69 70
                divId = divIdService.getDivId(divHelpContent.getDivId());
71
            } else {
72
                divId = divIdService.getDivId(divIdId);
70 73
            }
71 74
            divIdResponse = divIdService.divIdResponseFromDivId(divId);
72 75

  
......
117 120
        return divHelpContents;
118 121
    }
119 122

  
120
    public void addDivHelpContentsInPortal(String pid, String portalId, String divIdName) {
121
        Portal portal = portalService.getPortal(pid);
122
        String portalType = portal.getType();
123

  
123
    public void addDivHelpContentsInPortal(String portalId, String portalType) {
124 124
        //String organizations_class_content = "<div> <p>Here you can write more details about the organizations related to your portal.</p> </div>";
125 125
        String link_context_form_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\">&nbsp;</span> Information:</span> Select a research portal and/or a category and search for a portal concept, or browse to the portal tree through the categories</div> </div>";
126 126
        String link_project_form_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\">&nbsp;</span> Information:</span> Search for projects using project name or grant id. Limit results filtering by funder.</div> </div>";
......
128 128
        String link_result_bulk_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\">&nbsp;</span> Information:</span> Upload a csv file containing a list of DOIs. For each DOI found in the file, metadata will be fetched from CrossRef or Datacite and will be added to your selected research results.</div> <div class=\"uk-margin-top uk-text-small\"><span class=\"uk-text-bold\">CSV format:</span> <ul class=\"uk-list\"> <li>The format of CSV file should be &quot;DOI&quot;,&quot;ACCESS_MODE&quot;,&quot;DATE&quot;.</li> <li>The value &quot;DOI&quot; is required</li> <li>Access mode column should have values: &quot;OPEN&quot;,&quot;CLOSED&quot; or &quot;EMBARGO&quot;.</li> <li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li> <li>In case access mode is not available default value is &quot;OPEN&quot;.</li> </ul> </div> </div>";
129 129
        String link_metadata_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\">&nbsp;</span> Information:</span> Manage access mode &amp; type of selected research results. For OpenAIRE this functionality isn&#39;t available.</div> </div>";
130 130

  
131
        List<DivId> divIds = divIdService.getDivIds(null, divIdName, null);
131
        List<DivId> divIds = divIdService.getDivIdsByPortalType(portalType);
132 132

  
133 133
        for( DivId div : divIds ) {
134
            if (div != null && div.getPortalType().equals(portalType) ) {
134
            if (div != null) {
135 135
//                    (div.getOpenaire() && pid.equals("openaire")) ||
136 136
//                            (div.getConnect() && pid.equals("connect")) ||
137 137
//                            (div.getCommunities() && !pid.equals("openaire") && !pid.equals("connect"))
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/PageService.java
41 41
    public List<PortalPage> getPagesFull(String pid, String page_route) {
42 42

  
43 43
        List<Page> pages = this.getAllPages(pid, page_route, null);
44
        if(pages == null) {
45
            return null;
46
        }
44 47

  
45 48
        List<PortalPage> portalPages = new ArrayList<>();
46 49
        for(Page page : pages) {
......
58 61
    }
59 62

  
60 63
    public List<Page> getAllPages(String pid, String page_route, String with_positions) {
61
        List<Page> pages;
64
        List<Page> pages = null;
62 65
        if (pid != null) {
63 66
            Portal portal = portalService.getPortal(pid);
67
            if(portal == null) {
68
                return null;
69
            }
70

  
64 71
            String portalType = portal.getType();
65 72

  
66 73
            if (page_route != null) {
67 74
                pages = new ArrayList<Page>();
68
                pages.add(pageDAO.findByPortalTypeAndRoute(portalType, page_route));
75
                Page page = pageDAO.findByPortalTypeAndRoute(portalType, page_route);
76
                if(page != null) {
77
                    pages.add(page);
78
                }
69 79
            } else {
70 80
                pages = pageDAO.findByPortalType(portalType);
71 81
            }
......
76 86
        }
77 87

  
78 88
        if (with_positions != null) {
89
            if(pages == null) {
90
                return null;
91
            }
92

  
79 93
            boolean at_least_one_position = Boolean.parseBoolean(with_positions);
80 94

  
81 95
            Iterator<Page> iteratorPages = pages.iterator();
......
93 107
                }
94 108
            }
95 109
        }
96
        pages.sort(Comparator.comparing(Page::getName));
110
        if(pages != null) {
111
            pages.sort(Comparator.comparing(Page::getName));
112
        }
97 113
        return pages;
98 114
    }
99 115

  
116
    public List<Page> getPagesByPortalType(String portalType) {
117
        if (portalType == null) {
118
            return null;
119
        }
120
        return pageDAO.findByPortalType(portalType);
121
    }
122

  
123
    public Page getPageByPortalTypeAndRoutegetPageByPortalTypeAndRoute(String portalType, String page_route) {
124
        if (page_route == null || portalType == null) {
125
            return null;
126
        }
127
        return pageDAO.findByPortalTypeAndRoute(portalType, page_route);
128
    }
129

  
100 130
    public void deleteAllPages() {
101 131
        pageDAO.deleteAll();
102 132
    }
......
155 185

  
156 186
        if(!portalPage.getTop()) {
157 187
            // delete page contents with position "top" related to this page from all portals
158
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getRoute(), "top", null, null);
188
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getPortalType(), portalPage.getRoute(), "top", null, null);
159 189
            for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
160 190
                pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
161 191
            }
......
163 193

  
164 194
        if(!portalPage.getBottom()) {
165 195
            // delete page contents with position "bottom" related to this page from all portals
166
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getRoute(), "bottom", null, null);
196
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getPortalType(), portalPage.getRoute(), "bottom", null, null);
167 197
            for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
168 198
                pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
169 199
            }
......
171 201

  
172 202
        if(!portalPage.getLeft()) {
173 203
            // delete page contents with position "left" related to this page from all portals
174
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getRoute(), "left", null, null);
204
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getPortalType(), portalPage.getRoute(), "left", null, null);
175 205
            for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
176 206
                pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
177 207
            }
......
179 209

  
180 210
        if(!portalPage.getRight()) {
181 211
            // delete page contents with position "right" related to this page from all portals
182
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getRoute(), "right", null, null);
212
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, portalPage.getPortalType(), portalPage.getRoute(), "right", null, null);
183 213
            for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
184 214
                pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
185 215
            }
......
188 218

  
189 219
    public Boolean deletePages(List<String> pages) throws Exception {
190 220
        for (String id: pages) {
221
            Page page = pageDAO.findById(id);
191 222
            pageDAO.delete(id);
192 223

  
193 224
            // delete divIds related only to this page from all portals, otherwise remove this page from divIds
......
211 242

  
212 243

  
213 244
            // delete page contents related to this page from all portals
214
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, id, null, null, null);
245
            List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentService.getPageHelpContents(null, page.getPortalType(), id, null, null, null);
215 246
            for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
216 247
                pageHelpContentService.deletePageHelpContent(pageHelpContentResponse.getId());
217 248
            }
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/entities/Portal.java
16 16
    private String type; // explore, connect, community, monitor
17 17
    private Map<String, Boolean> pages;
18 18
    private Map<String, Boolean> entities;
19
    private String layout;
20 19

  
21 20
    public Portal() {}
22 21

  
......
61 60
    public void setEntities(Map<String, Boolean> entities) {
62 61
        this.entities = entities;
63 62
    }
64

  
65
    public String getLayout() {
66
        return layout;
67
    }
68

  
69
    public void setLayout(String layout) {
70
        this.layout = layout;
71
    }
72 63
}
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/entities/fullEntities/PortalResponse.java
17 17
    private String type; // explore, connect, community, monitor
18 18
    private List<PortalPage> pages;
19 19
    private List<PortalEntity> entities;
20
    //private Layout layout;
21 20

  
22 21
    public PortalResponse() {}
23 22

  
......
69 68
    public void setEntities(List<PortalEntity> entities) {
70 69
        this.entities = entities;
71 70
    }
72

  
73
//    public Layout getLayout() {
74
//        return layout;
75
//    }
76
//
77
//    public void setLayout(Layout layout) {
78
//        this.layout = layout;
79
//    }
80 71
}
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/PageHelpContentController.java
20 20

  
21 21
    @RequestMapping(value = "/pagehelpcontent", method = RequestMethod.GET)
22 22
    public List<PageHelpContentResponse> getPageHelpContents(@RequestParam(value = "portal", required = false) String pid,
23
                                                             @RequestParam(required=false) String portalType,
23 24
                                                             @RequestParam(required=false) String page,
24 25
                                                             @RequestParam(required=false) String position,
25 26
                                                             @RequestParam(required=false) String active,
26 27
                                                             @RequestParam(required=false) String before) {
27
        return pageHelpContentService.getPageHelpContents(pid, page, position, active, before);
28
        return pageHelpContentService.getPageHelpContents(pid, portalType, page, position, active, before);
28 29
    }
29 30

  
30 31
    @RequestMapping(value = "/pagehelpcontent", method = RequestMethod.DELETE)
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/PortalController.java
1
package eu.dnetlib.uoaadmintoolslibrary.controllers;
2

  
3
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
4
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
5
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
6
import org.springframework.web.bind.annotation.*;
7
import org.apache.log4j.Logger;
8
import org.springframework.beans.factory.annotation.Autowired;
9

  
10
import java.util.List;
11
import java.util.Map;
12

  
13
@RestController
14
@CrossOrigin(origins = "*")
15
public class PortalController {
16
    private final Logger log = Logger.getLogger(this.getClass());
17

  
18
    @Autowired
19
    private PortalService portalService;
20

  
21
    @RequestMapping(value = {"/community", "/explore", "/connect"}, method = RequestMethod.GET)
22
    public List<Portal> getAllCommunities() {
23
        List<Portal> communities = portalService.getAllPortals();
24

  
25
        return communities;
26
    }
27

  
28
    @RequestMapping(value = {"/communityFull", "/exploreFull", "/connectFull"}, method = RequestMethod.GET)
29
    public List<PortalResponse> getAllCommunitiesFull() {
30
//        List<Community> communities = portalDAO.findAll();
31
//        List<CommunityResponse> communitiesResponse = new ArrayList<>();
32
//        for(Community community : communities) {
33
//            CommunityResponse communityResponse = new CommunityResponse(community);
34
//
35
//            List<CommunityPage> pages = this.getPagesForCommunityByType(community.getPid(), null, null, null);
36
//            log.debug("PAGES number="+pages.size());
37
//            Iterator<CommunityPage> iteratorPages = pages.iterator();
38
//            while(iteratorPages.hasNext()) {
39
//                CommunityPage page = iteratorPages.next();
40
//                if(!page.getIsEnabled()) {
41
//                    iteratorPages.remove();
42
//                }
43
//            }
44
//            communityResponse.setPages(pages);
45
//            log.debug("PAGES set");
46
//
47
//            List<CommunityEntity> entities = this.getEntitiesForCommunity(community.getPid(), null);
48
//            log.debug("ENTITIES number="+entities.size());
49
//            Iterator<CommunityEntity> iteratorEntities = entities.iterator();
50
//            while(iteratorEntities.hasNext()) {
51
//                CommunityEntity entity = iteratorEntities.next();
52
//                if(!entity.getIsEnabled()) {
53
//                    iteratorEntities.remove();
54
//                }
55
//            }
56
//            communityResponse.setEntities(entities);
57
//            Layout layout = layoutDAO.findById(community.getLayout());
58
//            communityResponse.setLayout(layout);
59
//            communitiesResponse.add(communityResponse);
60
//        }
61
//        return communitiesResponse;
62
        // TODO check where is this used? no more layout in response!!
63
        return portalService.getAllPortalsFull();
64
    }
65

  
66
    @RequestMapping(value = {"/communityFull/{pid}", "/exploreFull/{pid}", "/connectFull/{pid}"}, method = RequestMethod.GET)
67
    public PortalResponse getCommunityFull(@PathVariable(value = "pid") String pid) {
68
//        Community community = portalDAO.findByPid(pid);
69
//        CommunityResponse communityResponse = new CommunityResponse(community);
70
//
71
//        List<CommunityPage> pages = this.getPagesForCommunityByType(community.getPid(), null, null, null);
72
//        Iterator<CommunityPage> iteratorPages = pages.iterator();
73
//        while(iteratorPages.hasNext()) {
74
//            CommunityPage page = iteratorPages.next();
75
//            if(!page.getIsEnabled()) {
76
//                iteratorPages.remove();
77
//            }
78
//        }
79
//        communityResponse.setPages(pages);
80
//
81
//        List<CommunityEntity> entities = this.getEntitiesForCommunity(community.getPid(), null);
82
//        Iterator<CommunityEntity> iteratorEntities = entities.iterator();
83
//        while(iteratorEntities.hasNext()) {
84
//            CommunityEntity entity = iteratorEntities.next();
85
//            if(!entity.getIsEnabled()) {
86
//                iteratorEntities.remove();
87
//            }
88
//        }
89
//        communityResponse.setEntities(entities);
90
//        Layout layout = layoutDAO.findById(community.getLayout());
91
//        communityResponse.setLayout(layout);
92
//
93
//        return communityResponse;
94
        // TODO check where is this used? no more layout in response!!
95
        return portalService.getPortalFull(pid);
96
    }
97
/*
98

  
99
    @RequestMapping(value = "/communityFullByName/{name}", method = RequestMethod.GET)
100
    public CommunityResponse getCommunityFullByName(@PathVariable(value = "name") String name) {
101
        Community community = portalDAO.findByName(name);
102
        CommunityResponse communityResponse = new CommunityResponse(community);
103

  
104
        List<CommunityPage> pages = this.getPagesForCommunityByType(community.getId(), null, null);
105
        Iterator<CommunityPage> iteratorPages = pages.iterator();
106
        while(iteratorPages.hasNext()) {
107
            CommunityPage page = iteratorPages.next();
108
            if(!page.getIsEnabled()) {
109
                iteratorPages.remove();
110
            }
111
        }
112
        communityResponse.setPages(pages);
113

  
114
        List<CommunityEntity> entities = this.getEntitiesForCommunity(community.getId(), null);
115
        Iterator<CommunityEntity> iteratorEntities = entities.iterator();
116
        while(iteratorEntities.hasNext()) {
117
            CommunityEntity entity = iteratorEntities.next();
118
            if(!entity.getIsEnabled()) {
119
                iteratorEntities.remove();
120
            }
121
        }
122
        communityResponse.setEntities(entities);
123

  
124
        return communityResponse;
125
    }
126
*/
127

  
128
//    @RequestMapping(value = "/community", method = RequestMethod.DELETE)
129
//    public void deleteAllCommunities() {
130
//        portalDAO.deleteAll();
131
//    }
132

  
133
    @RequestMapping(value = {"/community", "/explore", "/connect"}, method = RequestMethod.POST)
134
    public Portal insertOrUpdateCommunity(@RequestBody Portal portal) {
135
        return portalService.insertOrUpdatePortal(portal);
136
    }
137

  
138
    @RequestMapping(value = {"/community/{pid}", "/explore/{pid}", "/connect/{pid}"}, method = RequestMethod.GET)
139
    public Portal getCommunity(@PathVariable(value = "pid") String pid) {
140
        log.debug("PID: "+ pid);
141
        return portalService.getPortal(pid);
142
    }
143

  
144
    @RequestMapping(value = {"/community/{id}", "/explore/{id}", "/connect/{id}"}, method = RequestMethod.DELETE)
145
    public void deleteCommunity(@PathVariable(value = "id") String id) {
146
        portalService.deletePortalId(id);
147
    }
148

  
149
    @RequestMapping(value = {"/community/{pid}/pages", "/explore/{pid}/pages", "/connect/{pid}/pages"}, method = RequestMethod.GET)
150
    public List<PortalPage> getPagesForCommunityByType(@PathVariable(value = "pid") String pid,
151
                                                       @RequestParam(value="page_type", required=false) String page_type,
152
                                                       @RequestParam(value="page_route", required=false) String page_route,
153
                                                       @RequestParam(value="div", required = false) String div) {
154
//        List<CommunityPage> return_pages = new ArrayList<CommunityPage>();
155
//        Map<String, Boolean> pages = portalDAO.findByPid(pid).getPages();
156
//
157
//        if(pages != null) {
158
//            for (Map.Entry<String, Boolean> page : pages.entrySet()) {
159
//                if(div != null && div.equals("true")) {
160
//                    Community community = portalDAO.findByPid(pid);
161
//                    List<DivId> divIds = divIdDAO.findByPagesContaining(page.getKey());
162
//                    Iterator<DivId> divIdIterator = divIds.iterator();
163
//
164
//                    while (divIdIterator.hasNext()) {
165
//                        DivId divId = divIdIterator.next();
166
//                        if((pid.equals("openaire") && !divId.getOpenaire()) ||
167
//                                (pid.equals("connect") && !divId.getConnect()) ||
168
//                                (!pid.equals("openaire") && !pid.equals("connect") && !divId.getCommunities())) {
169
//                            divIdIterator.remove();
170
//                        }
171
//                    }
172
//
173
//                    if(divIds.isEmpty()) {
174
//                        continue;
175
//                    }
176
//                }
177
//
178
//                Page p = pageDAO.findById(page.getKey());
179
//
180
//                if((pid.equals("openaire") && p.getOpenaire()) || (pid.equals("connect") && p.getConnect()) ||(!pid.equals("openaire") && !pid.equals("connect") && p.getCommunities())) {
181
//                    if ((page_type == null && page_route == null) || (page_route == null && p.getType().equals(page_type))
182
//                            || p.getRoute().equals(page_route)) {
183
//                        CommunityPage communityPage = new CommunityPage(p);
184
//
185
//                        List<Entity> entities = new ArrayList<>();
186
//                        for (String entity : p.getEntities()) {
187
//                            entities.add(entityDAO.findById(entity));
188
//                        }
189
//                        communityPage.setEntities(entities);
190
//                        communityPage.setIsEnabled(page.getValue());
191
//
192
//                        return_pages.add(communityPage);
193
//
194
//                        if (page_route != null) {
195
//                            break;
196
//                        }
197
//                    }
198
//                }
199
//            }
200
//        }
201
//        return_pages.sort(Comparator.comparing(CommunityPage::getName));
202
//        return return_pages;
203
        return portalService.getPagesForPortalByType(pid, page_type, page_route, div);
204
    }
205

  
206
    @RequestMapping(value = {"/community/{id}/page", "/explore/{id}/page", "/connect/{id}/page"}, method = RequestMethod.POST)
207
    public Portal insertOrUpdatePage(@PathVariable(value = "id") String id, @RequestBody PortalPage page) {
208
//        Community community = portalDAO.findById(id);
209
//        Map<String, Boolean> pages = community.getPages();
210
//
211
//        String name = page.getName();
212
//        boolean isEnabled = page.getIsEnabled();
213
//
214
//        pages.put(name, isEnabled);
215
//        community.setPages(pages);
216
//
217
//        return portalDAO.save(community);
218
        return portalService.insertOrUpdatePage(id, page);
219
    }
220

  
221
    @RequestMapping(value = {"/community/{pid}/page/toggle", "/explore/{pid}/page/toggle", "/connect/{pid}/page/toggle"}, method = RequestMethod.POST)
222
    public Portal togglePage(@PathVariable(value = "pid") String pid, @RequestBody List<String> pageIds, @RequestParam String status) throws Exception {
223
//        Community community = portalDAO.findByPid(pid);
224
//        Map<String, Boolean> pages = community.getPages();
225
//
226
//        for (String pageId: pageIds) {
227
//            log.debug("Toggle community page: " + pageId + " of community: " + pid + " to " + status);
228
//            pages.put(pageId, Boolean.parseBoolean(status));
229
//        }
230
//
231
//        community.setPages(pages);
232
//        return portalDAO.save(community);
233
        return portalService.togglePage(pid, pageIds, status);
234
    }
235

  
236
    @RequestMapping(value = {"/community/{pid}/entity/toggle", "/explore/{pid}/entity/toggle", "/connect/{pid}/entity/toggle"}, method = RequestMethod.POST)
237
    public Portal toggleEntity(@PathVariable(value = "pid") String pid, @RequestBody List<String> entityIds, @RequestParam String status) throws Exception {
238
//        Community community = portalDAO.findByPid(pid);
239
//        Map<String, Boolean> entities = community.getEntities();
240
//        Map<String, Boolean> pages = community.getPages();
241
//
242
//        for (String entityId: entityIds) {
243
//            log.debug("Toggle community entity: " + entityId + " of community: " + pid + " to " + status);
244
//
245
//            entities.put(entityId, Boolean.parseBoolean(status));
246
//
247
//            if(pages != null) {
248
//                for (Map.Entry<String, Boolean> pageEntry : pages.entrySet()) {
249
//                    Page page = pageDAO.findById(pageEntry.getKey());
250
//                    if (page.getEntities().contains(entityId) && page.getType().equals("search")) {
251
//                        pages.put(pageEntry.getKey(), Boolean.parseBoolean(status));
252
//                    }
253
//                }
254
//            }
255
//        }
256
//
257
//        community.setEntities(entities);
258
//        return portalDAO.save(community);
259
        return portalService.toggleEntity(pid, entityIds, status);
260
    }
261

  
262
    @RequestMapping(value = {"/community/{pid}/entities", "/explore/{pid}/entities", "/connect/{pid}/entities"}, method = RequestMethod.GET)
263
    public List<PortalEntity> getEntitiesForCommunity(@PathVariable(value = "pid") String pid, @RequestParam(value="entity", required=false) String entity) {
264
//        List<CommunityEntity> return_entities = new ArrayList<CommunityEntity>();
265
//        Map<String, Boolean> entities = portalDAO.findByPid(pid).getEntities();
266
//
267
//        log.debug("/community/"+pid+"/entities -- entity: "+entity);
268
//        if (entity != null) {
269
//            String entityId = entityDAO.findByPid(entity).getId();
270
//            CommunityEntity communityEntity = new CommunityEntity(entityDAO.findById(entityId));
271
//            communityEntity.setIsEnabled(entities.get(entityId));
272
//            return_entities.add(communityEntity);
273
//        } else {
274
//            if(entities != null) {
275
//                for (Map.Entry<String, Boolean> _entity : entities.entrySet()) {
276
//                    CommunityEntity communityEntity = new CommunityEntity(entityDAO.findById(_entity.getKey()));
277
//                    communityEntity.setIsEnabled(_entity.getValue());
278
//                    return_entities.add(communityEntity);
279
//                }
280
//            }
281
//        }
282
//        return return_entities;
283
        return portalService.getEntitiesForPortal(pid, entity);
284
    }
285

  
286

  
287
    @RequestMapping(value = {"/community/{pid}/pagehelpcontent", "/explore/{pid}/pagehelpcontent", "/connect/{pid}/pagehelpcontent"}, method = RequestMethod.GET)
288
    public Map<String, List<PageHelpContentResponse>> getPageHelpContentsByPosition(@PathVariable(value = "pid") String pid,
289
                                                                                    @RequestParam(required=false) String page,
290
                                                                                    @RequestParam(required=false) String active) {
291
//        Map<String, List<PageHelpContentResponse>> pageHelpContentResponses = new HashMap<>();
292
//
293
//        List<PageHelpContentResponse> pageHelpContents = null;
294
//        pageHelpContents = pageHelpContentService.getPageHelpContents(pid, page, null, active, null);
295
//
296
//        pageHelpContentResponses.put("top", new ArrayList<>());
297
//        pageHelpContentResponses.put("bottom", new ArrayList<>());
298
//        pageHelpContentResponses.put("left", new ArrayList<>());
299
//        pageHelpContentResponses.put("right", new ArrayList<>());
300
//
301
//        for (PageHelpContentResponse pageHelpContentResponse : pageHelpContents) {
302
//            pageHelpContentResponses.get(pageHelpContentResponse.getPlacement()).add(pageHelpContentResponse);
303
//        }
304
//
305
//
306
//        return pageHelpContentResponses;
307
        return portalService.getPageHelpContentsByPosition(pid, page, active);
308
    }
309

  
310
    @RequestMapping(value = {"/community/{pid}/divhelpcontent", "/explore/{pid}/divhelpcontent", "/connect/{pid}/divhelpcontent"}, method = RequestMethod.GET)
311
    public Map<String, List<DivHelpContentResponse>> getDivHelpContentsByPosition(@PathVariable(value = "pid") String pid,
312
                                                                                  @RequestParam(required=false) String page,
313
                                                                                  @RequestParam(required=false) String active) {
314
//        Map<String, List<DivHelpContentResponse>> divHelpContentResponses = new HashMap<>();
315
//
316
//        List<DivHelpContentResponse> divHelpContents = null;
317
//        divHelpContents = divHelpContentService.getDivHelpContents(pid, page, null, active);
318
//
319
//        for (DivHelpContentResponse divHelpContentResponse : divHelpContents) {
320
//            if(!divHelpContentResponses.containsKey(divHelpContentResponse.getDivId())) {
321
//                divHelpContentResponses.put(divHelpContentResponse.getDivId().getName(), new ArrayList<>());
322
//            }
323
//            divHelpContentResponses.get(divHelpContentResponse.getDivId().getName()).add(divHelpContentResponse);
324
//        }
325
//
326
//
327
//        return divHelpContentResponses;
328
        return portalService.getDivHelpContentsByPosition(pid, page, active);
329
    }
330
}
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/DivHelpContentController.java
21 21
    @RequestMapping(value = "/divhelpcontent", method = RequestMethod.GET)
22 22
    public List<DivHelpContentResponse> getDivHelpContents(@RequestParam(value = "portal", required = false) String pid,
23 23
                                                           @RequestParam(required = false) String page,
24
                                                           @RequestParam(required = false) String div,
24
                                                           @RequestParam(required = false) String divId,
25 25
                                                           @RequestParam(required = false) String active) {
26 26

  
27
        return divHelpContentService.getDivHelpContents(pid, page, div, active);
27
        return divHelpContentService.getDivHelpContents(pid, page, divId, active);
28 28
    }
29 29

  
30 30
    @RequestMapping(value = "/divhelpcontent/{id}", method = RequestMethod.GET)
......
52 52
        return divHelpContentService.toggleDivHelpContent(divHelpContents, status);
53 53
    }
54 54

  
55
    public void addDivHelpContentsInPortal(String pid, String portalId, String divIdName) {
56
        divHelpContentService.addDivHelpContentsInPortal(pid, portalId, divIdName);
57
    }
58

  
59 55
}

Also available in: Unified diff