Revision 58395
Added by Konstantina Galouni about 4 years ago
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\"> </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\"> </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\"> </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 "DOI","ACCESS_MODE","DATE".</li> <li>The value "DOI" is required</li> <li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</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 "OPEN".</li> </ul> </div> </div>"; |
129 | 129 |
String link_metadata_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\"> </span> Information:</span> Manage access mode & type of selected research results. For OpenAIRE this functionality isn'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")) |
Also available in: Unified diff
[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).