[Trunk | Admin tools library Service]: Rename "Community" to "Portal".
1. Entity "Community" renamed to "Portal" - Files renamed accordingly. 2. PageHelpContent.java & DivHelpContent.java & PageHelpContentResponse.java & DivHelpContentResponse.java: Rename "community" field to "portal". 3. PageHelpContentDAO.java & DivHelpContentDAO.java & MongoDBPageHelpContentDAO.java & MongoDBDivHelpContentDAO.java: Methods changed to use "portal" field instead of "community". 4. PageHelpContentController.java: In "getPageHelpContents()" method rename "community" parameter to "portal". 5. DivIdController.java: In "getDivIds()", "getDivIdsFull()", "getDivIdsPages()" methods rename "communityId" or "community" parameter to "portal". 6. DivHelpContentController.java: In "getDivHelpContents()" method rename "community" parameter to "portal".
This commit is contained in:
parent
30e8d91991
commit
cf47b7b4bf
|
@ -1,5 +1,7 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -7,10 +9,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.DivHelpContentDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.DivIdDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.DivHelpContent;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
|
@ -32,18 +32,18 @@ public class DivHelpContentController {
|
|||
private DivIdDAO divIdDAO;
|
||||
|
||||
@Autowired
|
||||
private CommunityDAO communityDAO;
|
||||
private PortalDAO portalDAO;
|
||||
|
||||
@RequestMapping(value = "/divhelpcontent", method = RequestMethod.GET)
|
||||
public List<DivHelpContentResponse> getDivHelpContents(@RequestParam(required = false) String community,
|
||||
public List<DivHelpContentResponse> getDivHelpContents(@RequestParam(value = "portal", required = false) String pid,
|
||||
@RequestParam(required = false) String page,
|
||||
@RequestParam(required = false) String div,
|
||||
@RequestParam(required = false) String active) {
|
||||
|
||||
Community _community = communityDAO.findByPid(community);
|
||||
String communityId = null;
|
||||
if(_community != null) {
|
||||
communityId = _community.getId();
|
||||
Portal _portal = portalDAO.findByPid(pid);
|
||||
String portalId = null;
|
||||
if(_portal != null) {
|
||||
portalId = _portal.getId();
|
||||
}
|
||||
|
||||
DivId divId = divIdDAO.findByName(div);
|
||||
|
@ -55,16 +55,16 @@ public class DivHelpContentController {
|
|||
List<DivHelpContentResponse> divHelpContentResponses = new ArrayList<>();
|
||||
|
||||
List<DivHelpContent> divHelpContents = null;
|
||||
if(community != null && div != null && active != null) {
|
||||
divHelpContents = divHelpContentDAO.findByCommunityAndDivIdAndIsActive(communityId, divIdId, Boolean.parseBoolean(active));
|
||||
} else if(community != null && div != null) {
|
||||
divHelpContents = divHelpContentDAO.findByCommunityAndDivId(communityId, divIdId);
|
||||
} else if(community != null && active != null) {
|
||||
divHelpContents = divHelpContentDAO.findByCommunityAndIsActive(communityId, Boolean.parseBoolean(active));
|
||||
if(pid != null && div != null && active != null) {
|
||||
divHelpContents = divHelpContentDAO.findByPortalAndDivIdAndIsActive(portalId, divIdId, Boolean.parseBoolean(active));
|
||||
} else if(pid != null && div != null) {
|
||||
divHelpContents = divHelpContentDAO.findByPortalAndDivId(portalId, divIdId);
|
||||
} else if(pid != null && active != null) {
|
||||
divHelpContents = divHelpContentDAO.findByPortalAndIsActive(portalId, Boolean.parseBoolean(active));
|
||||
} else if(div != null && active != null) {
|
||||
divHelpContents = divHelpContentDAO.findByDivIdAndIsActive(divIdId, Boolean.parseBoolean(active));
|
||||
} else if(community != null) {
|
||||
divHelpContents = divHelpContentDAO.findByCommunity(communityId);
|
||||
} else if(pid != null) {
|
||||
divHelpContents = divHelpContentDAO.findByPortal(portalId);
|
||||
} else if(div != null) {
|
||||
divHelpContents = divHelpContentDAO.findByDivId(divIdId);
|
||||
} else if(active != null){
|
||||
|
@ -80,15 +80,15 @@ public class DivHelpContentController {
|
|||
}
|
||||
divIdResponse = divIdController.divIdResponseFromDivId(divId);
|
||||
|
||||
if(community == null) {
|
||||
_community = communityDAO.findById(divHelpContent.getCommunity());
|
||||
if(pid == null) {
|
||||
_portal = portalDAO.findById(divHelpContent.getPortal());
|
||||
}
|
||||
|
||||
for(Page p : divIdResponse.getPages()) {
|
||||
if (page == null || p.getRoute().equals(page)) {
|
||||
DivHelpContentResponse divHelpContentResponse = new DivHelpContentResponse(divHelpContent);
|
||||
divHelpContentResponse.setDivId(divIdResponse);
|
||||
divHelpContentResponse.setCommunity(_community);
|
||||
divHelpContentResponse.setPortal(_portal);
|
||||
divHelpContentResponses.add(divHelpContentResponse);
|
||||
break;
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ public class DivHelpContentController {
|
|||
return divHelpContents;
|
||||
}
|
||||
|
||||
public void addDivHelpContentsInCommunity(String pid, String communityId, String divIdName) {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
String dashboardAlias = community.getAlias();
|
||||
public void addDivHelpContentsInPortal(String pid, String portalId, String divIdName) {
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
String dashboardAlias = portal.getAlias();
|
||||
|
||||
//String organizations_class_content = "<div> <p>Here you can write more details about the organizations related to your community.</p> </div>";
|
||||
String link_context_form_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\"> </span> Information:</span> Select a research community and/or a category and search for a community concept, or browse to the community tree through the categories</div> </div>";
|
||||
//String organizations_class_content = "<div> <p>Here you can write more details about the organizations related to your portal.</p> </div>";
|
||||
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>";
|
||||
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>";
|
||||
String link_result_form_content = "<div> <div><span class=\"uk-text-bold\"><span uk-icon=\"icon: info\"> </span> Information:</span></div> Search for research results in OpenAIRE information space, Datacite, CrossRef or ORCID. <div class=\"uk-text-small\">Use keywords, DOI (more than one - space separated), author's ORCID</div> </div>";
|
||||
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>";
|
||||
|
@ -153,19 +153,19 @@ public class DivHelpContentController {
|
|||
// )) {
|
||||
/*
|
||||
if (div.getName().equals("organizations")) {
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, organizations_class_content, false));
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), portalId, organizations_class_content, false));
|
||||
} else
|
||||
*/
|
||||
if (div.getName().equals("link-context-form")) {
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_context_form_content, false));
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), portalId, link_context_form_content, false));
|
||||
} else if (div.getName().equals("link-project-form")) {
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_project_form_content, false));
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), portalId, link_project_form_content, false));
|
||||
} else if (div.getName().equals("link-result-form")) {
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_result_form_content, false));
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), portalId, link_result_form_content, false));
|
||||
} else if (div.getName().equals("link-result-bulk")) {
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_result_bulk_content, false));
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), portalId, link_result_bulk_content, false));
|
||||
} else if (div.getName().equals("link-metadata")) {
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_metadata_content, false));
|
||||
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), portalId, link_metadata_content, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.DivIdDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PageDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivHelpContentResponse;
|
||||
|
@ -27,10 +27,10 @@ public class DivIdController {
|
|||
private PageDAO pageDAO;
|
||||
|
||||
@Autowired
|
||||
private CommunityDAO communityDAO;
|
||||
private PortalDAO portalDAO;
|
||||
|
||||
@Autowired
|
||||
private CommunityController communityController;
|
||||
private PortalController portalController;
|
||||
|
||||
@Autowired
|
||||
private DivHelpContentController divHelpContentController;
|
||||
|
@ -40,9 +40,9 @@ public class DivIdController {
|
|||
@RequestMapping(value = "/div", method = RequestMethod.GET)
|
||||
public List<DivId> getDivIds(@RequestParam(required = false) String page,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(value = "communityId", required = false) String pid) {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
String dashboardAlias = community.getAlias();
|
||||
@RequestParam(value = "portal", required = false) String pid) {
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
String dashboardAlias = portal.getAlias();
|
||||
|
||||
List<DivId> divIds = null;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class DivIdController {
|
|||
@RequestMapping(value = "/divFull", method = RequestMethod.GET)
|
||||
public List<DivIdResponse> getDivIdsFull(@RequestParam(required = false) String page,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(value="communityId", required = false) String pid) {
|
||||
@RequestParam(value="portal", required = false) String pid) {
|
||||
|
||||
List<DivId> divIds = this.getDivIds(page, name, pid);
|
||||
|
||||
|
@ -161,26 +161,26 @@ public class DivIdController {
|
|||
// boolean connectEnabled = divId.getConnect();
|
||||
//
|
||||
// if(divId.getCommunities() && !divIdOld.getCommunities()) {
|
||||
// List<Community> communities = communityController.getAllCommunities();
|
||||
// for( Community community : communities ) {
|
||||
// List<Portal> communities = communityController.getAllPortals();
|
||||
// for( Portal community : communities ) {
|
||||
// if(!community.getPid().equals("openaire") && !community.getPid().equals("connect")) {
|
||||
// divHelpContentController.addDivHelpContentsInCommunity(community.getPid(), community.getId(), divId.getName());
|
||||
// divHelpContentController.addDivHelpContentsInPortal(community.getPid(), community.getId(), divId.getName());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(openaireEnabled && !divIdOld.getOpenaire()) {
|
||||
// Community community = communityController.getCommunity("openaire");
|
||||
// divHelpContentController.addDivHelpContentsInCommunity(community.getPid(), community.getId(), divId.getName());
|
||||
// Portal community = communityController.getPortal("openaire");
|
||||
// divHelpContentController.addDivHelpContentsInPortal(community.getPid(), community.getId(), divId.getName());
|
||||
// }
|
||||
//
|
||||
// if(connectEnabled && !divIdOld.getConnect()) {
|
||||
// Community community = communityController.getCommunity("connect");
|
||||
// divHelpContentController.addDivHelpContentsInCommunity(community.getPid(), community.getId(), divId.getName());
|
||||
// Portal community = communityController.getPortal("connect");
|
||||
// divHelpContentController.addDivHelpContentsInPortal(community.getPid(), community.getId(), divId.getName());
|
||||
// }
|
||||
//
|
||||
// if(!divId.getCommunities()) {
|
||||
// List<Community> communities = communityController.getAllCommunities();
|
||||
// for( Community community : communities ) {
|
||||
// List<Portal> communities = communityController.getAllPortals();
|
||||
// for( Portal community : communities ) {
|
||||
// if(!community.getPid().equals("openaire") && !community.getPid().equals("connect")) {
|
||||
// // delete div contents related to this divId
|
||||
// List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents(community.getPid(), null, divId.getName(), null);
|
||||
|
@ -192,7 +192,7 @@ public class DivIdController {
|
|||
// }
|
||||
//
|
||||
// if(!openaireEnabled) {
|
||||
// Community community = communityController.getCommunity("openaire");
|
||||
// Portal community = communityController.getPortal("openaire");
|
||||
//
|
||||
// // delete div contents related to this divId
|
||||
// List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents("openaire", null, divId.getName(), null);
|
||||
|
@ -202,7 +202,7 @@ public class DivIdController {
|
|||
// }
|
||||
//
|
||||
// if(!connectEnabled) {
|
||||
// Community community = communityController.getCommunity("connect");
|
||||
// Portal community = communityController.getPortal("connect");
|
||||
//
|
||||
// // delete div contents related to this divId
|
||||
// List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents("connect", null, divId.getName(), null);
|
||||
|
@ -239,12 +239,12 @@ public class DivIdController {
|
|||
}
|
||||
|
||||
@RequestMapping(value = "/div/pages", method = RequestMethod.GET)
|
||||
public Set<String> getDivIdsPages(@RequestParam(value="communityId", required = false) String pid) {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
String dashboardAlias = community.getAlias();
|
||||
public Set<String> getDivIdsPages(@RequestParam(value="portal", required = false) String pid) {
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
String dashboardAlias = portal.getAlias();
|
||||
|
||||
List<DivId> divIds = null;
|
||||
Set<String> hasCommunityPageDivIds = new HashSet<>();
|
||||
Set<String> hasPortalPageDivIds = new HashSet<>();
|
||||
|
||||
if(dashboardAlias != null) {
|
||||
divIds = divIdDAO.findByDashboardAlias(dashboardAlias);
|
||||
|
@ -254,10 +254,10 @@ public class DivIdController {
|
|||
|
||||
for(DivId divId : divIds) {
|
||||
for(String pageId : divId.getPages()) {
|
||||
hasCommunityPageDivIds.add(pageId);
|
||||
hasPortalPageDivIds.add(pageId);
|
||||
}
|
||||
}
|
||||
return hasCommunityPageDivIds;
|
||||
return hasPortalPageDivIds;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.EntityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PageDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Entity;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.CommunityEntity;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalEntity;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -26,7 +26,7 @@ public class EntityController {
|
|||
private PageDAO pageDAO;
|
||||
|
||||
@Autowired
|
||||
private CommunityDAO communityDAO;
|
||||
private PortalDAO portalDAO;
|
||||
|
||||
@RequestMapping(value = "/entity", method = RequestMethod.GET)
|
||||
public List<Entity> getAllEntities() {
|
||||
|
@ -54,36 +54,36 @@ public class EntityController {
|
|||
}
|
||||
|
||||
@RequestMapping(value = "/entity/update", method = RequestMethod.POST)
|
||||
public CommunityEntity updateEntity(@RequestBody CommunityEntity communityEntity) {
|
||||
Entity entity = this.getEntityByCommunityEntity(communityEntity);
|
||||
public PortalEntity updateEntity(@RequestBody PortalEntity portalEntity) {
|
||||
Entity entity = this.getEntityByPortalEntity(portalEntity);
|
||||
entityDAO.save(entity);
|
||||
|
||||
return communityEntity;
|
||||
return portalEntity;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/entity/save", method = RequestMethod.POST)
|
||||
public CommunityEntity insertEntity(@RequestBody Entity entity) {
|
||||
//Entity entity = this.getEntityByCommunityEntity(communityEntity);
|
||||
public PortalEntity insertEntity(@RequestBody Entity entity) {
|
||||
//Entity entity = this.getEntityByPortalEntity(portalEntity);
|
||||
Entity savedEntity = entityDAO.save(entity);
|
||||
CommunityEntity communityEntity = new CommunityEntity(savedEntity);
|
||||
PortalEntity portalEntity = new PortalEntity(savedEntity);
|
||||
|
||||
// add entity in communities
|
||||
List<Community> communities = communityDAO.findAll();
|
||||
for( Community community : communities ) {
|
||||
Map<String, Boolean> entities = community.getEntities();
|
||||
// add entity in portals
|
||||
List<Portal> portals = portalDAO.findAll();
|
||||
for( Portal portal : portals ) {
|
||||
Map<String, Boolean> entities = portal.getEntities();
|
||||
entities.put(entity.getId(), true);
|
||||
community.setEntities(entities);
|
||||
communityDAO.save(community);
|
||||
portal.setEntities(entities);
|
||||
portalDAO.save(portal);
|
||||
}
|
||||
|
||||
return communityEntity;
|
||||
return portalEntity;
|
||||
}
|
||||
|
||||
private Entity getEntityByCommunityEntity(CommunityEntity communityEntity) {
|
||||
private Entity getEntityByPortalEntity(PortalEntity portalEntity) {
|
||||
Entity entity = new Entity();
|
||||
entity.setId(communityEntity.getId());
|
||||
entity.setPid(communityEntity.getPid());
|
||||
entity.setName(communityEntity.getName());
|
||||
entity.setId(portalEntity.getId());
|
||||
entity.setPid(portalEntity.getPid());
|
||||
entity.setName(portalEntity.getName());
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
@ -93,13 +93,13 @@ public class EntityController {
|
|||
for (String id: entities) {
|
||||
entityDAO.delete(id);
|
||||
|
||||
// delete entity from communities
|
||||
List<Community> communities = communityDAO.findAll();
|
||||
for( Community community : communities ) {
|
||||
Map<String, Boolean> communityEntities = community.getEntities();
|
||||
communityEntities.remove(id);
|
||||
community.setEntities(communityEntities);
|
||||
communityDAO.save(community);
|
||||
// delete entity from portals
|
||||
List<Portal> portals = portalDAO.findAll();
|
||||
for( Portal portal : portals ) {
|
||||
Map<String, Boolean> portalEntities = portal.getEntities();
|
||||
portalEntities.remove(id);
|
||||
portal.setEntities(portalEntities);
|
||||
portalDAO.save(portal);
|
||||
}
|
||||
|
||||
// delete entity from pages
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.DivIdDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PageDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Entity;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.CommunityPage;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalPage;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivHelpContentResponse;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PageHelpContentResponse;
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class PageController {
|
|||
private PageDAO pageDAO;
|
||||
|
||||
@Autowired
|
||||
private CommunityDAO communityDAO;
|
||||
private PortalDAO portalDAO;
|
||||
|
||||
@Autowired
|
||||
private DivIdDAO divIdDAO;
|
||||
|
@ -44,24 +44,24 @@ public class PageController {
|
|||
private EntityController entityController;
|
||||
|
||||
@RequestMapping(value = "/pageFull", method = RequestMethod.GET)
|
||||
public List<CommunityPage> getPagesFull(@RequestParam(value="pid", required=false) String pid,
|
||||
@RequestParam(value="page_route", required=false) String page_route) {
|
||||
public List<PortalPage> getPagesFull(@RequestParam(value="pid", required=false) String pid,
|
||||
@RequestParam(value="page_route", required=false) String page_route) {
|
||||
|
||||
List<Page> pages = this.getAllPages(pid, page_route, null);
|
||||
|
||||
List<CommunityPage> communityPages = new ArrayList<>();
|
||||
List<PortalPage> portalPages = new ArrayList<>();
|
||||
for(Page page : pages) {
|
||||
CommunityPage communityPage = new CommunityPage(page);
|
||||
PortalPage portalPage = new PortalPage(page);
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
for(String entityId : page.getEntities()) {
|
||||
entities.add(entityController.getEntity(entityId));
|
||||
}
|
||||
communityPage.setEntities(entities);
|
||||
portalPage.setEntities(entities);
|
||||
|
||||
communityPages.add(communityPage);
|
||||
portalPages.add(portalPage);
|
||||
}
|
||||
|
||||
return communityPages;
|
||||
return portalPages;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
|
@ -70,8 +70,8 @@ public class PageController {
|
|||
@RequestParam(value="with_positions", required=false) String with_positions) {
|
||||
List<Page> pages;
|
||||
if (pid != null) {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
String dashboardAlias = community.getAlias();
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
String dashboardAlias = portal.getAlias();
|
||||
|
||||
if (page_route != null) {
|
||||
pages = new ArrayList<Page>();
|
||||
|
@ -113,44 +113,44 @@ public class PageController {
|
|||
}
|
||||
|
||||
@RequestMapping(value = "/page/update", method = RequestMethod.POST)
|
||||
public CommunityPage updatePage(@RequestBody CommunityPage communityPage) {
|
||||
this.deletePageHelpContentsForPositionsIfDisabled(communityPage);
|
||||
Page page = this.getPageByCommunityPage(communityPage);
|
||||
public PortalPage updatePage(@RequestBody PortalPage portalPage) {
|
||||
this.deletePageHelpContentsForPositionsIfDisabled(portalPage);
|
||||
Page page = this.getPageByPortalPage(portalPage);
|
||||
pageDAO.save(page);
|
||||
return communityPage;
|
||||
return portalPage;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/page/save", method = RequestMethod.POST)
|
||||
public CommunityPage insertPage(@RequestBody CommunityPage communityPage) {
|
||||
Page page = this.getPageByCommunityPage(communityPage);
|
||||
public PortalPage insertPage(@RequestBody PortalPage portalPage) {
|
||||
Page page = this.getPageByPortalPage(portalPage);
|
||||
Page savedPage = pageDAO.save(page);
|
||||
communityPage.setId(savedPage.getId());
|
||||
portalPage.setId(savedPage.getId());
|
||||
|
||||
// add page in communities
|
||||
List<Community> communities = communityDAO.findAll();
|
||||
for( Community community : communities ) {
|
||||
Map<String, Boolean> pages = community.getPages();
|
||||
// add page in portals
|
||||
List<Portal> portals = portalDAO.findAll();
|
||||
for( Portal portal : portals ) {
|
||||
Map<String, Boolean> pages = portal.getPages();
|
||||
pages.put(page.getId(), true);
|
||||
community.setPages(pages);
|
||||
communityDAO.save(community);
|
||||
portal.setPages(pages);
|
||||
portalDAO.save(portal);
|
||||
}
|
||||
|
||||
return communityPage;
|
||||
return portalPage;
|
||||
}
|
||||
|
||||
private Page getPageByCommunityPage(CommunityPage communityPage) {
|
||||
private Page getPageByPortalPage(PortalPage portalPage) {
|
||||
Page page = new Page();
|
||||
page.setId(communityPage.getId());
|
||||
page.setRoute(communityPage.getRoute());
|
||||
page.setName(communityPage.getName());
|
||||
page.setType(communityPage.getType());
|
||||
page.setDashboardAlias(communityPage.getDashboardAlias());
|
||||
page.setTop(communityPage.getTop());
|
||||
page.setBottom(communityPage.getBottom());
|
||||
page.setLeft(communityPage.getLeft());
|
||||
page.setRight(communityPage.getRight());
|
||||
page.setId(portalPage.getId());
|
||||
page.setRoute(portalPage.getRoute());
|
||||
page.setName(portalPage.getName());
|
||||
page.setType(portalPage.getType());
|
||||
page.setDashboardAlias(portalPage.getDashboardAlias());
|
||||
page.setTop(portalPage.getTop());
|
||||
page.setBottom(portalPage.getBottom());
|
||||
page.setLeft(portalPage.getLeft());
|
||||
page.setRight(portalPage.getRight());
|
||||
|
||||
List<Entity> fullEntities = communityPage.getEntities();
|
||||
List<Entity> fullEntities = portalPage.getEntities();
|
||||
List<String> entities = new ArrayList<String>();
|
||||
for(Entity entity : fullEntities) {
|
||||
entities.add(entity.getId());
|
||||
|
@ -160,35 +160,35 @@ public class PageController {
|
|||
return page;
|
||||
}
|
||||
|
||||
private void deletePageHelpContentsForPositionsIfDisabled(CommunityPage communityPage) {
|
||||
private void deletePageHelpContentsForPositionsIfDisabled(PortalPage portalPage) {
|
||||
|
||||
if(!communityPage.getTop()) {
|
||||
// delete page contents with position "top" related to this page from all communities
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, communityPage.getRoute(), "top", null, null);
|
||||
if(!portalPage.getTop()) {
|
||||
// delete page contents with position "top" related to this page from all portals
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, portalPage.getRoute(), "top", null, null);
|
||||
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
|
||||
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
|
||||
}
|
||||
}
|
||||
|
||||
if(!communityPage.getBottom()) {
|
||||
// delete page contents with position "bottom" related to this page from all communities
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, communityPage.getRoute(), "bottom", null, null);
|
||||
if(!portalPage.getBottom()) {
|
||||
// delete page contents with position "bottom" related to this page from all portals
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, portalPage.getRoute(), "bottom", null, null);
|
||||
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
|
||||
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
|
||||
}
|
||||
}
|
||||
|
||||
if(!communityPage.getLeft()) {
|
||||
// delete page contents with position "left" related to this page from all communities
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, communityPage.getRoute(), "left", null, null);
|
||||
if(!portalPage.getLeft()) {
|
||||
// delete page contents with position "left" related to this page from all portals
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, portalPage.getRoute(), "left", null, null);
|
||||
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
|
||||
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
|
||||
}
|
||||
}
|
||||
|
||||
if(!communityPage.getRight()) {
|
||||
// delete page contents with position "right" related to this page from all communities
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, communityPage.getRoute(), "right", null, null);
|
||||
if(!portalPage.getRight()) {
|
||||
// delete page contents with position "right" related to this page from all portals
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, portalPage.getRoute(), "right", null, null);
|
||||
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
|
||||
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
|
||||
}
|
||||
|
@ -200,13 +200,13 @@ public class PageController {
|
|||
for (String id: pages) {
|
||||
pageDAO.delete(id);
|
||||
|
||||
// delete divIds related only to this page from all communities, otherwise remove this page from divIds
|
||||
// delete divIds related only to this page from all portals, otherwise remove this page from divIds
|
||||
List<DivId> divIds = divIdController.getDivIds(id, null, null);
|
||||
for(DivId divId : divIds) {
|
||||
if(divId.getPages().size() == 1) {
|
||||
divIdController.deleteDivId(divId.getId());
|
||||
|
||||
// delete div contents related to this page from all communities
|
||||
// delete div contents related to this page from all portals
|
||||
List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents(null, id, divId.getId(), null);
|
||||
for (DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) {
|
||||
divHelpContentController.deleteDivHelpContent(divHelpContentResponse.getId());
|
||||
|
@ -220,19 +220,19 @@ public class PageController {
|
|||
}
|
||||
|
||||
|
||||
// delete page contents related to this page from all communities
|
||||
// delete page contents related to this page from all portals
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(null, id, null, null, null);
|
||||
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
|
||||
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
|
||||
}
|
||||
|
||||
// delete page from communities
|
||||
List<Community> communities = communityDAO.findAll();
|
||||
for( Community community : communities ) {
|
||||
Map<String, Boolean> communityPages = community.getPages();
|
||||
communityPages.remove(id);
|
||||
community.setPages(communityPages);
|
||||
communityDAO.save(community);
|
||||
// delete page from portals
|
||||
List<Portal> portals = portalDAO.findAll();
|
||||
for( Portal portal : portals ) {
|
||||
Map<String, Boolean> portalPages = portal.getPages();
|
||||
portalPages.remove(id);
|
||||
portal.setPages(portalPages);
|
||||
portalDAO.save(portal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PageHelpContentDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.PageHelpContent;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PageHelpContentResponse;
|
||||
|
@ -26,53 +26,52 @@ public class PageHelpContentController {
|
|||
private PageController pageController;
|
||||
|
||||
@Autowired
|
||||
private CommunityController communityController;
|
||||
private PortalController portalController;
|
||||
|
||||
@Autowired
|
||||
private CommunityDAO communityDAO;
|
||||
private PortalDAO portalDAO;
|
||||
|
||||
@RequestMapping(value = "/pagehelpcontent", method = RequestMethod.GET)
|
||||
public List<PageHelpContentResponse> getPageHelpContents(@RequestParam(required=false) String community,
|
||||
public List<PageHelpContentResponse> getPageHelpContents(@RequestParam(value = "portal", required = false) String pid,
|
||||
@RequestParam(required=false) String page,
|
||||
@RequestParam(required=false) String position,
|
||||
@RequestParam(required=false) String active,
|
||||
@RequestParam(required=false) String before) {
|
||||
List<PageHelpContent> pageHelpContents = null;
|
||||
|
||||
Community _community = null;
|
||||
String communityId = null;
|
||||
if(community != null) {
|
||||
_community = communityController.getCommunity(community);
|
||||
if(_community != null) {
|
||||
communityId = _community.getId();
|
||||
Portal _portal = null;
|
||||
String portalId = null;
|
||||
if(pid != null) {
|
||||
_portal = portalController.getPortal(pid);
|
||||
if(_portal != null) {
|
||||
portalId = _portal.getId();
|
||||
}
|
||||
}
|
||||
//pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsActiveAndisPriorToOrderByOrderAsc(community, position, Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
|
||||
if(community != null && position != null && active != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(communityId, position, Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
} else if(community != null && position != null && active != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsActiveOrderByOrderAsc(communityId, position, Boolean.parseBoolean(active));
|
||||
} else if(community != null && position != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementAndIsPriorToOrderByOrderAsc(communityId, position, Boolean.parseBoolean(before));
|
||||
} else if(community != null && active != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(communityId, Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
if(pid != null && position != null && active != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(portalId, position, Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
} else if(pid != null && position != null && active != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndPlacementAndIsActiveOrderByOrderAsc(portalId, position, Boolean.parseBoolean(active));
|
||||
} else if(pid != null && position != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndPlacementAndIsPriorToOrderByOrderAsc(portalId, position, Boolean.parseBoolean(before));
|
||||
} else if(pid != null && active != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(portalId, Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
} else if(position != null && active != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(position, Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
} else if(community != null && position != null ) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndPlacementOrderByOrderAsc(communityId, position);
|
||||
} else if(community != null && active != null ) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndIsActiveOrderByPlacementAscOrderAsc(communityId, Boolean.parseBoolean(active));
|
||||
} else if(community != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityAndIsPriorToOrderByPlacementAscOrderAsc(communityId, Boolean.parseBoolean(before));
|
||||
} else if(pid != null && position != null ) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndPlacementOrderByOrderAsc(portalId, position);
|
||||
} else if(pid != null && active != null ) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndIsActiveOrderByPlacementAscOrderAsc(portalId, Boolean.parseBoolean(active));
|
||||
} else if(pid != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalAndIsPriorToOrderByPlacementAscOrderAsc(portalId, Boolean.parseBoolean(before));
|
||||
} else if(position != null && active != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPlacementAndIsActiveOrderByOrderAsc(position, Boolean.parseBoolean(active));
|
||||
} else if(position != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPlacementAndIsPriorToOrderByOrderAsc(position, Boolean.parseBoolean(before));
|
||||
} else if(active != null && before != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(Boolean.parseBoolean(active), Boolean.parseBoolean(before));
|
||||
} else if(community != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByCommunityOrderByPlacementAscOrderAsc(communityId);
|
||||
} else if(pid != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPortalOrderByPlacementAscOrderAsc(portalId);
|
||||
} else if(position != null) {
|
||||
pageHelpContents = pageHelpContentDAO.findByPlacementOrderByOrderAsc(position);
|
||||
} else if(active != null) {
|
||||
|
@ -90,26 +89,13 @@ public class PageHelpContentController {
|
|||
PageHelpContentResponse pageHelpContentResponse = new PageHelpContentResponse(pageHelpContent);
|
||||
|
||||
pageHelpContentResponse.setPage(_page);
|
||||
pageHelpContentResponse.setCommunity(communityDAO.findById(pageHelpContent.getCommunity()));
|
||||
pageHelpContentResponse.setPortal(portalDAO.findById(pageHelpContent.getPortal()));
|
||||
pageHelpContentResponses.add(pageHelpContentResponse);
|
||||
}
|
||||
}
|
||||
return pageHelpContentResponses;
|
||||
}
|
||||
/*
|
||||
@RequestMapping(value = "/pagehelpcontent/community/{id}", method = RequestMethod.GET)
|
||||
public List<PageHelpContentResponse> getCommunityPageHelpContents(@PathVariable(value = "id") String communityId) {
|
||||
List<PageHelpContent> pageHelpContents = pageHelpContentDAO.findByCommunity(communityId);
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = new ArrayList<>();
|
||||
for (PageHelpContent pageHelpContent : pageHelpContents) {
|
||||
PageHelpContentResponse pageHelpContentResponse = new PageHelpContentResponse(pageHelpContent);
|
||||
pageHelpContentResponse.setPage(pageDAO.findById(pageHelpContent.getPage()));
|
||||
pageHelpContentResponse.setCommunity(communityDAO.findById(pageHelpContent.getCommunity()));
|
||||
pageHelpContentResponses.add(pageHelpContentResponse);
|
||||
}
|
||||
return pageHelpContentResponses;
|
||||
}
|
||||
*/
|
||||
|
||||
@RequestMapping(value = "/pagehelpcontent", method = RequestMethod.DELETE)
|
||||
public void deleteAllPageHelpContents() {
|
||||
pageHelpContentDAO.deleteAll();
|
||||
|
@ -117,8 +103,8 @@ public class PageHelpContentController {
|
|||
|
||||
@RequestMapping(value = "/pagehelpcontent/save", method = RequestMethod.POST)
|
||||
public PageHelpContent insertPageHelpContent(@RequestBody PageHelpContent pageHelpContent) {
|
||||
String communityId = communityController.getCommunity(pageHelpContent.getCommunity()).getId();
|
||||
pageHelpContent.setCommunity(communityId);
|
||||
String portalId = portalController.getPortal(pageHelpContent.getPortal()).getId();
|
||||
pageHelpContent.setPortal(portalId);
|
||||
return pageHelpContentDAO.save(pageHelpContent);
|
||||
}
|
||||
|
||||
|
@ -156,7 +142,7 @@ public class PageHelpContentController {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void addPageHelpContentsInCommunity(String pid, String communityId) {
|
||||
public void addPageHelpContentsInPortal(String pid, String portalId) {
|
||||
if (pid != "connect" && pid != "openaire") {
|
||||
String organizations_page_content = "<div> <p>Here you can write more details about the organizations related to your community.</p> </div>";
|
||||
Page organizationsPage = (pageController.getAllPages(null, "/organizations", null)).get(0);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.DivIdDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.EntityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PageDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Entity;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
|
@ -18,11 +18,11 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
|
|||
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
public class CommunityController {
|
||||
public class PortalController {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private CommunityDAO communityDAO;
|
||||
private PortalDAO portalDAO;
|
||||
|
||||
@Autowired
|
||||
private PageDAO pageDAO;
|
||||
|
@ -40,151 +40,151 @@ public class CommunityController {
|
|||
private DivHelpContentController divHelpContentController;
|
||||
|
||||
@RequestMapping(value = "/community", method = RequestMethod.GET)
|
||||
public List<Community> getAllCommunities() {
|
||||
List<Community> communities = communityDAO.findAll();
|
||||
public List<Portal> getAllPortals() {
|
||||
List<Portal> portals = portalDAO.findAll();
|
||||
|
||||
return communities;
|
||||
return portals;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/communityFull", method = RequestMethod.GET)
|
||||
public List<CommunityResponse> getAllCommunitiesFull() {
|
||||
List<Community> communities = communityDAO.findAll();
|
||||
List<CommunityResponse> communitiesResponse = new ArrayList<>();
|
||||
for(Community community : communities) {
|
||||
CommunityResponse communityResponse = new CommunityResponse(community);
|
||||
public List<PortalResponse> getAllPortalsFull() {
|
||||
List<Portal> portals = portalDAO.findAll();
|
||||
List<PortalResponse> portalResponses = new ArrayList<>();
|
||||
for(Portal portal : portals) {
|
||||
PortalResponse portalResponse = new PortalResponse(portal);
|
||||
|
||||
List<CommunityPage> pages = this.getPagesForCommunityByType(community.getPid(), null, null, null);
|
||||
List<PortalPage> pages = this.getPagesForPortalByType(portal.getPid(), null, null, null);
|
||||
log.debug("PAGES number="+pages.size());
|
||||
Iterator<CommunityPage> iteratorPages = pages.iterator();
|
||||
Iterator<PortalPage> iteratorPages = pages.iterator();
|
||||
while(iteratorPages.hasNext()) {
|
||||
CommunityPage page = iteratorPages.next();
|
||||
PortalPage page = iteratorPages.next();
|
||||
if(!page.getIsEnabled()) {
|
||||
iteratorPages.remove();
|
||||
}
|
||||
}
|
||||
communityResponse.setPages(pages);
|
||||
portalResponse.setPages(pages);
|
||||
log.debug("PAGES set");
|
||||
|
||||
List<CommunityEntity> entities = this.getEntitiesForCommunity(community.getPid(), null);
|
||||
List<PortalEntity> entities = this.getEntitiesForPortal(portal.getPid(), null);
|
||||
log.debug("ENTITIES number="+entities.size());
|
||||
Iterator<CommunityEntity> iteratorEntities = entities.iterator();
|
||||
Iterator<PortalEntity> iteratorEntities = entities.iterator();
|
||||
while(iteratorEntities.hasNext()) {
|
||||
CommunityEntity entity = iteratorEntities.next();
|
||||
PortalEntity entity = iteratorEntities.next();
|
||||
if(!entity.getIsEnabled()) {
|
||||
iteratorEntities.remove();
|
||||
}
|
||||
}
|
||||
communityResponse.setEntities(entities);
|
||||
// Layout layout = layoutDAO.findById(community.getLayout());
|
||||
// communityResponse.setLayout(layout);
|
||||
communitiesResponse.add(communityResponse);
|
||||
portalResponse.setEntities(entities);
|
||||
// Layout layout = layoutDAO.findById(portal.getLayout());
|
||||
// portalResponse.setLayout(layout);
|
||||
portalResponses.add(portalResponse);
|
||||
}
|
||||
return communitiesResponse;
|
||||
return portalResponses;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/communityFull/{pid}", method = RequestMethod.GET)
|
||||
public CommunityResponse getCommunityFull(@PathVariable(value = "pid") String pid) {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
CommunityResponse communityResponse = new CommunityResponse(community);
|
||||
public PortalResponse getPortalFull(@PathVariable(value = "pid") String pid) {
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
PortalResponse portalResponse = new PortalResponse(portal);
|
||||
|
||||
List<CommunityPage> pages = this.getPagesForCommunityByType(community.getPid(), null, null, null);
|
||||
Iterator<CommunityPage> iteratorPages = pages.iterator();
|
||||
List<PortalPage> pages = this.getPagesForPortalByType(portal.getPid(), null, null, null);
|
||||
Iterator<PortalPage> iteratorPages = pages.iterator();
|
||||
while(iteratorPages.hasNext()) {
|
||||
CommunityPage page = iteratorPages.next();
|
||||
PortalPage page = iteratorPages.next();
|
||||
if(!page.getIsEnabled()) {
|
||||
iteratorPages.remove();
|
||||
}
|
||||
}
|
||||
communityResponse.setPages(pages);
|
||||
portalResponse.setPages(pages);
|
||||
|
||||
List<CommunityEntity> entities = this.getEntitiesForCommunity(community.getPid(), null);
|
||||
Iterator<CommunityEntity> iteratorEntities = entities.iterator();
|
||||
List<PortalEntity> entities = this.getEntitiesForPortal(portal.getPid(), null);
|
||||
Iterator<PortalEntity> iteratorEntities = entities.iterator();
|
||||
while(iteratorEntities.hasNext()) {
|
||||
CommunityEntity entity = iteratorEntities.next();
|
||||
PortalEntity entity = iteratorEntities.next();
|
||||
if(!entity.getIsEnabled()) {
|
||||
iteratorEntities.remove();
|
||||
}
|
||||
}
|
||||
communityResponse.setEntities(entities);
|
||||
// Layout layout = layoutDAO.findById(community.getLayout());
|
||||
// communityResponse.setLayout(layout);
|
||||
// communityResponse.setPages(this.getPagesForCommunityByType(community.getId(), null));
|
||||
// communityResponse.setEntities(this.getEntitiesForCommunity(community.getId()));
|
||||
portalResponse.setEntities(entities);
|
||||
// Layout layout = layoutDAO.findById(portal.getLayout());
|
||||
// portalResponse.setLayout(layout);
|
||||
// portalResponse.setPages(this.getPagesForPortalByType(portal.getId(), null));
|
||||
// portalResponse.setEntities(this.getEntitiesForPortal(portal.getId()));
|
||||
|
||||
return communityResponse;
|
||||
return portalResponse;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/update", method = RequestMethod.POST)
|
||||
public CommunityResponse updateCommunity(@RequestBody Community community) {
|
||||
Community com = communityDAO.findById(community.getId());
|
||||
public PortalResponse updatePortal(@RequestBody Portal portal) {
|
||||
Portal com = portalDAO.findById(portal.getId());
|
||||
|
||||
// Statistics statistics = statisticsDAO.findByPid(com.getPid());
|
||||
// statistics.setPid(community.getPid());
|
||||
// statistics.setPid(portal.getPid());
|
||||
// statisticsDAO.save(statistics);
|
||||
//
|
||||
// CommunitySubscribers communitySubscribers = communitySubscribersDAO.findByPid(com.getPid());
|
||||
// communitySubscribers.setPid(community.getPid());
|
||||
// communitySubscribers.setPid(portal.getPid());
|
||||
// communitySubscribersDAO.save(communitySubscribers);
|
||||
|
||||
com.setName(community.getName());
|
||||
com.setPid(community.getPid());
|
||||
// = this.getCommunityByCommunityResponse(communityResponse);
|
||||
communityDAO.save(com);
|
||||
CommunityResponse communityResponse = this.getCommunityFull(community.getPid());
|
||||
com.setName(portal.getName());
|
||||
com.setPid(portal.getPid());
|
||||
// = this.getPortalByPortalResponse(portalResponse);
|
||||
portalDAO.save(com);
|
||||
PortalResponse portalResponse = this.getPortalFull(portal.getPid());
|
||||
|
||||
return communityResponse;
|
||||
return portalResponse;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/save", method = RequestMethod.POST)
|
||||
public CommunityResponse insertCommunity(@RequestBody Community community) {
|
||||
//Community community = this.getCommunityByCommunityResponse(communityResponse);
|
||||
public PortalResponse insertPortal(@RequestBody Portal portal) {
|
||||
//Portal portal = this.getPortalByPortalResponse(portalResponse);
|
||||
|
||||
List<CommunityEntity> communityEntities = new ArrayList<>();
|
||||
List<CommunityPage> communityPages = new ArrayList<>();
|
||||
List<PortalEntity> portalEntities = new ArrayList<>();
|
||||
List<PortalPage> portalPages = new ArrayList<>();
|
||||
Map<String, Boolean> entities = new HashMap<>();
|
||||
Map<String, Boolean> pages = new HashMap<>();
|
||||
|
||||
for(Entity entity : entityDAO.findAll()) {
|
||||
entities.put(entity.getId(), true);
|
||||
|
||||
CommunityEntity communityEntity = new CommunityEntity(entity);
|
||||
communityEntity.setIsEnabled(true);
|
||||
communityEntities.add(communityEntity);
|
||||
PortalEntity portalEntity = new PortalEntity(entity);
|
||||
portalEntity.setIsEnabled(true);
|
||||
portalEntities.add(portalEntity);
|
||||
}
|
||||
|
||||
for(Page page : pageDAO.findAll()) {
|
||||
pages.put(page.getId(), true);
|
||||
|
||||
CommunityPage communityPage = new CommunityPage(page);
|
||||
PortalPage portalPage = new PortalPage(page);
|
||||
if(page.getRoute().equals("/curators") || page.getRoute().equals("/organizations")) {
|
||||
communityPage.setIsEnabled(false);
|
||||
portalPage.setIsEnabled(false);
|
||||
} else {
|
||||
communityPage.setIsEnabled(true);
|
||||
portalPage.setIsEnabled(true);
|
||||
}
|
||||
|
||||
communityPages.add(communityPage);
|
||||
portalPages.add(portalPage);
|
||||
}
|
||||
|
||||
community.setEntities(entities);
|
||||
community.setPages(pages);
|
||||
// Statistics statistics = new Statistics(community.getPid());
|
||||
portal.setEntities(entities);
|
||||
portal.setPages(pages);
|
||||
// Statistics statistics = new Statistics(portal.getPid());
|
||||
// statisticsDAO.save(statistics);
|
||||
// CommunitySubscribers communitySubscribers = new CommunitySubscribers(community.getPid());
|
||||
// CommunitySubscribers communitySubscribers = new CommunitySubscribers(portal.getPid());
|
||||
// communitySubscribersDAO.save(communitySubscribers);
|
||||
Community savedCommunity = communityDAO.save(community);
|
||||
CommunityResponse communityResponse = this.getCommunityFull(savedCommunity.getPid());
|
||||
Portal savedPortal = portalDAO.save(portal);
|
||||
PortalResponse portalResponse = this.getPortalFull(savedPortal.getPid());
|
||||
|
||||
log.debug("pid of saved community: "+savedCommunity.getPid());
|
||||
log.debug("pid of saved portal: "+ savedPortal.getPid());
|
||||
|
||||
String id = savedCommunity.getId();
|
||||
String id = savedPortal.getId();
|
||||
|
||||
divHelpContentController.addDivHelpContentsInCommunity(savedCommunity.getPid(), id, null);
|
||||
pageHelpContentController.addPageHelpContentsInCommunity(savedCommunity.getPid(), id);
|
||||
divHelpContentController.addDivHelpContentsInPortal(savedPortal.getPid(), id, null);
|
||||
pageHelpContentController.addPageHelpContentsInPortal(savedPortal.getPid(), id);
|
||||
/*
|
||||
Page page = null;
|
||||
page = pageDAO.findByRoute("/about" );
|
||||
if(page != null) {
|
||||
String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> About the community </div> <p> This is an introductory text. To be updated... </p> </div>";
|
||||
String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> About the portal </div> <p> This is an introductory text. To be updated... </p> </div>";
|
||||
HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent);
|
||||
htmlPageContentController.updateHtmlPageContent(htmlPageContent);
|
||||
}
|
||||
|
@ -193,23 +193,23 @@ public class CommunityController {
|
|||
/*
|
||||
page = pageDAO.findByRoute("/organizations");
|
||||
if(page != null) {
|
||||
String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> Organizations related to the community </div> <p> This is an introductory text. Here follows the list of organizations... </p> <div class=\"uk-child-width-1-3@m uk-text-center uk-grid-match \" uk-grid > <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"https://upload.wikimedia.org/wikipedia/el/2/2b/Logo_uoa_blue.png\" alt=\"\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"https://www.uoa.gr/\">University of Athens</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"https://pbs.twimg.com/profile_images/631127495933165569/ElbqhHK0_400x400.jpg\" alt=\"\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"https://www.athena-innovation.gr/en\">Athena Research & Innovation center</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 1\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 1</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 2\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 2</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 3\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 3</a> </h3> </div> </div> </div></div>";
|
||||
String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> Organizations related to the portal </div> <p> This is an introductory text. Here follows the list of organizations... </p> <div class=\"uk-child-width-1-3@m uk-text-center uk-grid-match \" uk-grid > <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"https://upload.wikimedia.org/wikipedia/el/2/2b/Logo_uoa_blue.png\" alt=\"\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"https://www.uoa.gr/\">University of Athens</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"https://pbs.twimg.com/profile_images/631127495933165569/ElbqhHK0_400x400.jpg\" alt=\"\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"https://www.athena-innovation.gr/en\">Athena Research & Innovation center</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 1\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 1</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 2\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 2</a> </h3> </div> </div> <div class=\"uk-card uk-card-default uk-margin-bottom uk-padding-remove\"> <div class=\"uk-card-media-top\"> <img src=\"\" alt=\"Logo 3\" class=\"uk-height-small uk-responsive-height \"> </div> <div class=\"uk-card-body\"> <h3 class=\"uk-card-title\"> <a class=\"wk-link-reset\" href=\"\">Organization 3</a> </h3> </div> </div> </div></div>";
|
||||
HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent);
|
||||
htmlPageContentController.updateHtmlPageContent(htmlPageContent);
|
||||
}
|
||||
*/
|
||||
|
||||
return communityResponse;
|
||||
return portalResponse;
|
||||
}
|
||||
|
||||
private Community getCommunityByCommunityResponse(CommunityResponse communityResponse) {
|
||||
Community community = new Community();
|
||||
community.setId(communityResponse.getId());
|
||||
community.setName(communityResponse.getName());
|
||||
private Portal getPortalByPortalResponse(PortalResponse portalResponse) {
|
||||
Portal portal = new Portal();
|
||||
portal.setId(portalResponse.getId());
|
||||
portal.setName(portalResponse.getName());
|
||||
|
||||
List<CommunityEntity> fullEntities = communityResponse.getEntities();
|
||||
List<PortalEntity> fullEntities = portalResponse.getEntities();
|
||||
Map<String, Boolean> entities = new HashMap<String, Boolean>();
|
||||
for(CommunityEntity entity : fullEntities) {
|
||||
for(PortalEntity entity : fullEntities) {
|
||||
entities.put(entity.getId(), true);
|
||||
}
|
||||
for(Entity entity : entityDAO.findAll()) {
|
||||
|
@ -217,11 +217,11 @@ public class CommunityController {
|
|||
entities.put(entity.getId(), false);
|
||||
}
|
||||
}
|
||||
community.setEntities(entities);
|
||||
portal.setEntities(entities);
|
||||
|
||||
List<CommunityPage> fullPages = communityResponse.getPages();
|
||||
List<PortalPage> fullPages = portalResponse.getPages();
|
||||
Map<String, Boolean> pages = new HashMap<String, Boolean>();
|
||||
for(CommunityPage page : fullPages) {
|
||||
for(PortalPage page : fullPages) {
|
||||
pages.put(page.getId(), true);
|
||||
}
|
||||
for(Page page : pageDAO.findAll()) {
|
||||
|
@ -229,26 +229,26 @@ public class CommunityController {
|
|||
pages.put(page.getId(), false);
|
||||
}
|
||||
}
|
||||
community.setPages(pages);
|
||||
// Layout layout = communityResponse.getLayout();
|
||||
// community.setLayout(layout.getId());
|
||||
portal.setPages(pages);
|
||||
// Layout layout = portalResponse.getLayout();
|
||||
// portal.setLayout(layout.getId());
|
||||
|
||||
return community;
|
||||
return portal;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/delete", method = RequestMethod.POST)
|
||||
public Boolean deleteCommunities(@RequestBody List<String> communities) throws Exception {
|
||||
for (String id: communities) {
|
||||
Community community = communityDAO.findById(id);
|
||||
String pid = community.getPid();
|
||||
public Boolean deletePortals(@RequestBody List<String> portals) throws Exception {
|
||||
for (String id: portals) {
|
||||
Portal portal = portalDAO.findById(id);
|
||||
String pid = portal.getPid();
|
||||
|
||||
// delete div contents related to this community
|
||||
// delete div contents related to this portal
|
||||
List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents(pid, null, null, null);
|
||||
for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) {
|
||||
divHelpContentController.deleteDivHelpContent(divHelpContentResponse.getId());
|
||||
}
|
||||
|
||||
// delete page contents related to this community
|
||||
// delete page contents related to this portal
|
||||
List<PageHelpContentResponse> pageHelpContentResponses = pageHelpContentController.getPageHelpContents(pid, null, null, null, null);
|
||||
for(PageHelpContentResponse pageHelpContentResponse : pageHelpContentResponses) {
|
||||
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId());
|
||||
|
@ -269,12 +269,12 @@ public class CommunityController {
|
|||
// communitySubscribersDAO.delete(communitySubscribers.getId());
|
||||
// }
|
||||
//
|
||||
// Layout layout = layoutDAO.findById(community.getLayout());
|
||||
// Layout layout = layoutDAO.findById(portal.getLayout());
|
||||
// if(layout != null) {
|
||||
// layoutDAO.delete(layout.getId());
|
||||
// }
|
||||
|
||||
communityDAO.delete(id);
|
||||
portalDAO.delete(id);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -282,33 +282,33 @@ public class CommunityController {
|
|||
|
||||
// @RequestMapping(value = "/community", method = RequestMethod.DELETE)
|
||||
// public void deleteAllCommunities() {
|
||||
// communityDAO.deleteAll();
|
||||
// portalDAO.deleteAll();
|
||||
// }
|
||||
|
||||
@RequestMapping(value = "/community", method = RequestMethod.POST)
|
||||
public Community insertOrUpdateCommunity(@RequestBody Community community) {
|
||||
return communityDAO.save(community);
|
||||
public Portal insertOrUpdatePortal(@RequestBody Portal portal) {
|
||||
return portalDAO.save(portal);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{pid}", method = RequestMethod.GET)
|
||||
public Community getCommunity(@PathVariable(value = "pid") String pid) {
|
||||
public Portal getPortal(@PathVariable(value = "pid") String pid) {
|
||||
log.debug("PID: "+ pid);
|
||||
return communityDAO.findByPid(pid);
|
||||
return portalDAO.findByPid(pid);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}", method = RequestMethod.DELETE)
|
||||
public void deleteCommunity(@PathVariable(value = "id") String id) {
|
||||
communityDAO.delete(id);
|
||||
public void deletePortal(@PathVariable(value = "id") String id) {
|
||||
portalDAO.delete(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{pid}/pages", method = RequestMethod.GET)
|
||||
public List<CommunityPage> getPagesForCommunityByType(@PathVariable(value = "pid") String pid,
|
||||
@RequestParam(value="page_type", required=false) String page_type,
|
||||
@RequestParam(value="page_route", required=false) String page_route,
|
||||
@RequestParam(value="div", required = false) String div) {
|
||||
List<CommunityPage> return_pages = new ArrayList<CommunityPage>();
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
Map<String, Boolean> pages = community.getPages();
|
||||
public List<PortalPage> getPagesForPortalByType(@PathVariable(value = "pid") String pid,
|
||||
@RequestParam(value="page_type", required=false) String page_type,
|
||||
@RequestParam(value="page_route", required=false) String page_route,
|
||||
@RequestParam(value="div", required = false) String div) {
|
||||
List<PortalPage> return_pages = new ArrayList<PortalPage>();
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
Map<String, Boolean> pages = portal.getPages();
|
||||
|
||||
if(pages != null) {
|
||||
for (Map.Entry<String, Boolean> page : pages.entrySet()) {
|
||||
|
@ -321,7 +321,7 @@ public class CommunityController {
|
|||
// if((pid.equals("openaire") && !divId.getOpenaire()) ||
|
||||
// (pid.equals("connect") && !divId.getConnect()) ||
|
||||
// (!pid.equals("openaire") && !pid.equals("connect") && !divId.getCommunities())) {
|
||||
if(community.getAlias().equals(divId.getDashboardAlias())) {
|
||||
if(portal.getAlias().equals(divId.getDashboardAlias())) {
|
||||
divIdIterator.remove();
|
||||
}
|
||||
}
|
||||
|
@ -334,19 +334,19 @@ public class CommunityController {
|
|||
Page p = pageDAO.findById(page.getKey());
|
||||
|
||||
//if((pid.equals("openaire") && p.getOpenaire()) || (pid.equals("connect") && p.getConnect()) ||(!pid.equals("openaire") && !pid.equals("connect") && p.getCommunities())) {
|
||||
if(community.getAlias().equals(p.getDashboardAlias())) {
|
||||
if(portal.getAlias().equals(p.getDashboardAlias())) {
|
||||
if ((page_type == null && page_route == null) || (page_route == null && p.getType().equals(page_type))
|
||||
|| p.getRoute().equals(page_route)) {
|
||||
CommunityPage communityPage = new CommunityPage(p);
|
||||
PortalPage portalPage = new PortalPage(p);
|
||||
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
for (String entity : p.getEntities()) {
|
||||
entities.add(entityDAO.findById(entity));
|
||||
}
|
||||
communityPage.setEntities(entities);
|
||||
communityPage.setIsEnabled(page.getValue());
|
||||
portalPage.setEntities(entities);
|
||||
portalPage.setIsEnabled(page.getValue());
|
||||
|
||||
return_pages.add(communityPage);
|
||||
return_pages.add(portalPage);
|
||||
|
||||
if (page_route != null) {
|
||||
break;
|
||||
|
@ -355,46 +355,46 @@ public class CommunityController {
|
|||
}
|
||||
}
|
||||
}
|
||||
return_pages.sort(Comparator.comparing(CommunityPage::getName));
|
||||
return_pages.sort(Comparator.comparing(PortalPage::getName));
|
||||
return return_pages;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/page", method = RequestMethod.POST)
|
||||
public Community insertOrUpdatePage(@PathVariable(value = "id") String id, @RequestBody CommunityPage page) {
|
||||
Community community = communityDAO.findById(id);
|
||||
Map<String, Boolean> pages = community.getPages();
|
||||
public Portal insertOrUpdatePage(@PathVariable(value = "id") String id, @RequestBody PortalPage page) {
|
||||
Portal portal = portalDAO.findById(id);
|
||||
Map<String, Boolean> pages = portal.getPages();
|
||||
|
||||
String name = page.getName();
|
||||
boolean isEnabled = page.getIsEnabled();
|
||||
|
||||
pages.put(name, isEnabled);
|
||||
community.setPages(pages);
|
||||
portal.setPages(pages);
|
||||
|
||||
return communityDAO.save(community);
|
||||
return portalDAO.save(portal);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "community/{pid}/page/toggle", method = RequestMethod.POST)
|
||||
public Community togglePage(@PathVariable(value = "pid") String pid, @RequestBody List<String> pageIds, @RequestParam String status) throws Exception {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
Map<String, Boolean> pages = community.getPages();
|
||||
public Portal togglePage(@PathVariable(value = "pid") String pid, @RequestBody List<String> pageIds, @RequestParam String status) throws Exception {
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
Map<String, Boolean> pages = portal.getPages();
|
||||
|
||||
for (String pageId: pageIds) {
|
||||
log.debug("Toggle community page: " + pageId + " of community: " + pid + " to " + status);
|
||||
log.debug("Toggle portal page: " + pageId + " of portal: " + pid + " to " + status);
|
||||
pages.put(pageId, Boolean.parseBoolean(status));
|
||||
}
|
||||
|
||||
community.setPages(pages);
|
||||
return communityDAO.save(community);
|
||||
portal.setPages(pages);
|
||||
return portalDAO.save(portal);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "community/{pid}/entity/toggle", method = RequestMethod.POST)
|
||||
public Community toggleEntity(@PathVariable(value = "pid") String pid, @RequestBody List<String> entityIds, @RequestParam String status) throws Exception {
|
||||
Community community = communityDAO.findByPid(pid);
|
||||
Map<String, Boolean> entities = community.getEntities();
|
||||
Map<String, Boolean> pages = community.getPages();
|
||||
public Portal toggleEntity(@PathVariable(value = "pid") String pid, @RequestBody List<String> entityIds, @RequestParam String status) throws Exception {
|
||||
Portal portal = portalDAO.findByPid(pid);
|
||||
Map<String, Boolean> entities = portal.getEntities();
|
||||
Map<String, Boolean> pages = portal.getPages();
|
||||
|
||||
for (String entityId: entityIds) {
|
||||
log.debug("Toggle community entity: " + entityId + " of community: " + pid + " to " + status);
|
||||
log.debug("Toggle portal entity: " + entityId + " of portal: " + pid + " to " + status);
|
||||
|
||||
entities.put(entityId, Boolean.parseBoolean(status));
|
||||
|
||||
|
@ -408,27 +408,27 @@ public class CommunityController {
|
|||
}
|
||||
}
|
||||
|
||||
community.setEntities(entities);
|
||||
return communityDAO.save(community);
|
||||
portal.setEntities(entities);
|
||||
return portalDAO.save(portal);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{pid}/entities", method = RequestMethod.GET)
|
||||
public List<CommunityEntity> getEntitiesForCommunity(@PathVariable(value = "pid") String pid, @RequestParam(value="entity", required=false) String entity) {
|
||||
List<CommunityEntity> return_entities = new ArrayList<CommunityEntity>();
|
||||
Map<String, Boolean> entities = communityDAO.findByPid(pid).getEntities();
|
||||
public List<PortalEntity> getEntitiesForPortal(@PathVariable(value = "pid") String pid, @RequestParam(value="entity", required=false) String entity) {
|
||||
List<PortalEntity> return_entities = new ArrayList<PortalEntity>();
|
||||
Map<String, Boolean> entities = portalDAO.findByPid(pid).getEntities();
|
||||
|
||||
log.debug("/community/"+pid+"/entities -- entity: "+entity);
|
||||
if (entity != null) {
|
||||
String entityId = entityDAO.findByPid(entity).getId();
|
||||
CommunityEntity communityEntity = new CommunityEntity(entityDAO.findById(entityId));
|
||||
communityEntity.setIsEnabled(entities.get(entityId));
|
||||
return_entities.add(communityEntity);
|
||||
PortalEntity portalEntity = new PortalEntity(entityDAO.findById(entityId));
|
||||
portalEntity.setIsEnabled(entities.get(entityId));
|
||||
return_entities.add(portalEntity);
|
||||
} else {
|
||||
if(entities != null) {
|
||||
for (Map.Entry<String, Boolean> _entity : entities.entrySet()) {
|
||||
CommunityEntity communityEntity = new CommunityEntity(entityDAO.findById(_entity.getKey()));
|
||||
communityEntity.setIsEnabled(_entity.getValue());
|
||||
return_entities.add(communityEntity);
|
||||
PortalEntity portalEntity = new PortalEntity(entityDAO.findById(_entity.getKey()));
|
||||
portalEntity.setIsEnabled(_entity.getValue());
|
||||
return_entities.add(portalEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ public class CommunityController {
|
|||
|
||||
// @RequestMapping(value = "/community/{pid}/layout", method = RequestMethod.GET)
|
||||
// public Layout getLayoutForCommunity(@PathVariable(value = "pid") String pid) {
|
||||
// Community community = communityDAO.findByPid(pid);
|
||||
// Portal community = portalDAO.findByPid(pid);
|
||||
// if(community.getLayout() != null) {
|
||||
// return layoutDAO.findById(community.getLayout());
|
||||
// } else {
|
||||
|
@ -447,14 +447,14 @@ public class CommunityController {
|
|||
//
|
||||
// @RequestMapping(value = "/community/{pid}/layout", method = RequestMethod.POST)
|
||||
// public Layout updateLayoutForCommunity(@PathVariable(value = "pid") String pid, @RequestBody Layout layout) {
|
||||
// Community community = communityDAO.findByPid(pid);
|
||||
// Portal community = portalDAO.findByPid(pid);
|
||||
// if(community.getLayout() != null) {
|
||||
// layout.setId(community.getLayout());
|
||||
// layout = layoutDAO.save(layout);
|
||||
// } else {
|
||||
// layout = layoutDAO.save(layout);
|
||||
// community.setLayout(layout.getId());
|
||||
// communityDAO.save(community);
|
||||
// portalDAO.save(community);
|
||||
// }
|
||||
// return layout;
|
||||
// }
|
|
@ -1,21 +0,0 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
|
||||
public interface CommunityDAO {
|
||||
List<Community> findAll();
|
||||
|
||||
Community findById(String Id);
|
||||
|
||||
Community findByPid(String Pid);
|
||||
|
||||
Community findByName(String Name);
|
||||
|
||||
Community save(Community community);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
void delete(String id);
|
||||
}
|
|
@ -7,13 +7,13 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.DivHelpContent;
|
|||
public interface DivHelpContentDAO {
|
||||
List<DivHelpContent> findAll();
|
||||
|
||||
List<DivHelpContent> findByCommunity(String community);
|
||||
List<DivHelpContent> findByPortal(String portalId);
|
||||
List<DivHelpContent> findByDivId(String divId);
|
||||
List<DivHelpContent> findByIsActive(boolean isActive);
|
||||
List<DivHelpContent> findByCommunityAndDivId(String community, String divId);
|
||||
List<DivHelpContent> findByCommunityAndIsActive(String community, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndDivId(String portalId, String divId);
|
||||
List<DivHelpContent> findByPortalAndIsActive(String portalId, boolean isActive);
|
||||
List<DivHelpContent> findByDivIdAndIsActive(String divId, boolean isActive);
|
||||
List<DivHelpContent> findByCommunityAndDivIdAndIsActive(String community, String divId, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndDivIdAndIsActive(String portalId, String divId, boolean isActive);
|
||||
|
||||
DivHelpContent findById(String Id);
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.dao.MongoDBDAOs;
|
||||
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.CommunityDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
|
||||
public interface MongoDBCommunityDAO extends CommunityDAO, MongoRepository<Community, String> {
|
||||
List<Community> findAll();
|
||||
|
||||
Community findById(String Id);
|
||||
|
||||
Community findByPid(String Pid);
|
||||
|
||||
Community findByName(String Name);
|
||||
|
||||
Community save(Community community);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
void delete(String id);
|
||||
}
|
|
@ -10,13 +10,13 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.DivHelpContent;
|
|||
public interface MongoDBDivHelpContentDAO extends DivHelpContentDAO, MongoRepository<DivHelpContent, String> {
|
||||
List<DivHelpContent> findAll();
|
||||
|
||||
List<DivHelpContent> findByCommunity(String community);
|
||||
List<DivHelpContent> findByPortal(String portalId);
|
||||
List<DivHelpContent> findByDivId(String divId);
|
||||
List<DivHelpContent> findByIsActive(boolean isActive);
|
||||
List<DivHelpContent> findByCommunityAndDivId(String community, String divId);
|
||||
List<DivHelpContent> findByCommunityAndIsActive(String community, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndDivId(String portalId, String divId);
|
||||
List<DivHelpContent> findByPortalAndIsActive(String portalId, boolean isActive);
|
||||
List<DivHelpContent> findByDivIdAndIsActive(String divId, boolean isActive);
|
||||
List<DivHelpContent> findByCommunityAndDivIdAndIsActive(String community, String divId, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndDivIdAndIsActive(String portalId, String divId, boolean isActive);
|
||||
|
||||
DivHelpContent findById(String Id);
|
||||
|
||||
|
|
|
@ -10,26 +10,23 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.PageHelpContent;
|
|||
public interface MongoDBPageHelpContentDAO extends PageHelpContentDAO, MongoRepository<PageHelpContent, String> {
|
||||
List<PageHelpContent> findAll();
|
||||
|
||||
List<PageHelpContent> findByCommunityAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String communityId, String position, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityAndPlacementAndIsActiveOrderByOrderAsc(String communityId, String position, boolean isActive);
|
||||
List<PageHelpContent> findByCommunityAndPlacementAndIsPriorToOrderByOrderAsc(String communityId, String position, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(String communityId, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String portalId, String position, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndPlacementAndIsActiveOrderByOrderAsc(String portalId, String position, boolean isActive);
|
||||
List<PageHelpContent> findByPortalAndPlacementAndIsPriorToOrderByOrderAsc(String portalId, String position, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(String portalId, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String position, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityAndPlacementOrderByOrderAsc(String communityId, String postion);
|
||||
List<PageHelpContent> findByCommunityAndIsActiveOrderByPlacementAscOrderAsc(String communityId, boolean isActive);
|
||||
List<PageHelpContent> findByCommunityAndIsPriorToOrderByPlacementAscOrderAsc(String communityId, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndPlacementOrderByOrderAsc(String portalId, String postion);
|
||||
List<PageHelpContent> findByPortalAndIsActiveOrderByPlacementAscOrderAsc(String portalId, boolean isActive);
|
||||
List<PageHelpContent> findByPortalAndIsPriorToOrderByPlacementAscOrderAsc(String portalId, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPlacementAndIsActiveOrderByOrderAsc(String position, boolean isActive);
|
||||
List<PageHelpContent> findByPlacementAndIsPriorToOrderByOrderAsc(String position, boolean isPriorTo);
|
||||
List<PageHelpContent> findByIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityOrderByPlacementAscOrderAsc(String communityId);
|
||||
List<PageHelpContent> findByPortalOrderByPlacementAscOrderAsc(String portalId);
|
||||
List<PageHelpContent> findByPlacementOrderByOrderAsc(String postion);
|
||||
List<PageHelpContent> findByIsActiveOrderByPlacementAscOrderAsc(boolean isActive);
|
||||
List<PageHelpContent> findByIsPriorToOrderByPlacementAscOrderAsc(boolean isPriorTo);
|
||||
List<PageHelpContent> findAllByOrderByPlacementAscOrderAsc();
|
||||
|
||||
|
||||
//List<PageHelpContent> findByCommunityAndPlacementAndIsActiveAndBeforeOrderByOrderAsc(String communityId, String postion, boolean isActive, boolean before);
|
||||
|
||||
PageHelpContent findById(String Id);
|
||||
|
||||
PageHelpContent findByIdOrderByOrder(String Id);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.dao.MongoDBDAOs;
|
||||
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
|
||||
public interface MongoDBPortalDAO extends PortalDAO, MongoRepository<Portal, String> {
|
||||
List<Portal> findAll();
|
||||
|
||||
Portal findById(String Id);
|
||||
|
||||
Portal findByPid(String Pid);
|
||||
|
||||
Portal findByName(String Name);
|
||||
|
||||
Portal save(Portal portal);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
void delete(String id);
|
||||
}
|
|
@ -7,24 +7,24 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.PageHelpContent;
|
|||
public interface PageHelpContentDAO {
|
||||
List<PageHelpContent> findAll();
|
||||
|
||||
List<PageHelpContent> findByCommunityAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String communityId, String position, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityAndPlacementAndIsActiveOrderByOrderAsc(String communityId, String position, boolean isActive);
|
||||
List<PageHelpContent> findByCommunityAndPlacementAndIsPriorToOrderByOrderAsc(String communityId, String position, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(String communityId, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String portalId, String position, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndPlacementAndIsActiveOrderByOrderAsc(String portalId, String position, boolean isActive);
|
||||
List<PageHelpContent> findByPortalAndPlacementAndIsPriorToOrderByOrderAsc(String portalId, String position, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(String portalId, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String position, boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityAndPlacementOrderByOrderAsc(String communityId, String postion);
|
||||
List<PageHelpContent> findByCommunityAndIsActiveOrderByPlacementAscOrderAsc(String communityId, boolean isActive);
|
||||
List<PageHelpContent> findByCommunityAndIsPriorToOrderByPlacementAscOrderAsc(String communityId, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPortalAndPlacementOrderByOrderAsc(String portalId, String postion);
|
||||
List<PageHelpContent> findByPortalAndIsActiveOrderByPlacementAscOrderAsc(String portalId, boolean isActive);
|
||||
List<PageHelpContent> findByPortalAndIsPriorToOrderByPlacementAscOrderAsc(String portalId, boolean isPriorTo);
|
||||
List<PageHelpContent> findByPlacementAndIsActiveOrderByOrderAsc(String position, boolean isActive);
|
||||
List<PageHelpContent> findByPlacementAndIsPriorToOrderByOrderAsc(String position, boolean isPriorTo);
|
||||
List<PageHelpContent> findByIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(boolean isActive, boolean isPriorTo);
|
||||
List<PageHelpContent> findByCommunityOrderByPlacementAscOrderAsc(String communityId);
|
||||
List<PageHelpContent> findByPortalOrderByPlacementAscOrderAsc(String portalId);
|
||||
List<PageHelpContent> findByPlacementOrderByOrderAsc(String postion);
|
||||
List<PageHelpContent> findByIsActiveOrderByPlacementAscOrderAsc(boolean isActive);
|
||||
List<PageHelpContent> findByIsPriorToOrderByPlacementAscOrderAsc(boolean isPriorTo);
|
||||
List<PageHelpContent> findAllByOrderByPlacementAscOrderAsc();
|
||||
|
||||
//List<PageHelpContent> findByCommunityAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String communityId, String postion, boolean isActive, boolean isBefore);
|
||||
//List<PageHelpContent> findByPortalAndPlacementAndIsActiveAndIsPriorToOrderByOrderAsc(String portalId, String postion, boolean isActive, boolean isBefore);
|
||||
|
||||
|
||||
PageHelpContent findById(String Id);
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
|
||||
public interface PortalDAO {
|
||||
List<Portal> findAll();
|
||||
|
||||
Portal findById(String Id);
|
||||
|
||||
Portal findByPid(String Pid);
|
||||
|
||||
Portal findByName(String Name);
|
||||
|
||||
Portal save(Portal portal);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
void delete(String id);
|
||||
}
|
|
@ -9,15 +9,15 @@ public class DivHelpContent {
|
|||
private String id;
|
||||
|
||||
private String divId;
|
||||
private String community;
|
||||
private String portal;
|
||||
private String content;
|
||||
private boolean isActive = true;
|
||||
|
||||
public DivHelpContent() {}
|
||||
|
||||
public DivHelpContent(String divId, String community, String content, boolean isActive) {
|
||||
public DivHelpContent(String divId, String portal, String content, boolean isActive) {
|
||||
this.divId = divId;
|
||||
this.community = community;
|
||||
this.portal = portal;
|
||||
this.content = content;
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ public class DivHelpContent {
|
|||
this.divId = divId;
|
||||
}
|
||||
|
||||
public String getCommunity() {
|
||||
return community;
|
||||
public String getPortal() {
|
||||
return portal;
|
||||
}
|
||||
|
||||
public void setCommunity(String community) {
|
||||
this.community = community;
|
||||
public void setPortal(String portal) {
|
||||
this.portal = portal;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
|
|
|
@ -9,7 +9,7 @@ public class PageHelpContent {
|
|||
private String id;
|
||||
|
||||
private String page;
|
||||
private String community;
|
||||
private String portal;
|
||||
private String placement;
|
||||
private int order;
|
||||
private String content;
|
||||
|
@ -18,9 +18,9 @@ public class PageHelpContent {
|
|||
|
||||
public PageHelpContent() {}
|
||||
|
||||
public PageHelpContent(String page, String community, String placement, int order, String content, boolean isActive, boolean isPriorTo) {
|
||||
public PageHelpContent(String page, String portal, String placement, int order, String content, boolean isActive, boolean isPriorTo) {
|
||||
this.page = page;
|
||||
this.community = community;
|
||||
this.portal = portal;
|
||||
this.placement = placement;
|
||||
this.order = order;
|
||||
this.content = content;
|
||||
|
@ -44,12 +44,12 @@ public class PageHelpContent {
|
|||
this.page = page;
|
||||
}
|
||||
|
||||
public String getCommunity() {
|
||||
return community;
|
||||
public String getPortal() {
|
||||
return portal;
|
||||
}
|
||||
|
||||
public void setCommunity(String community) {
|
||||
this.community = community;
|
||||
public void setPortal(String portal) {
|
||||
this.portal = portal;
|
||||
}
|
||||
|
||||
public String getPlacement() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.springframework.data.annotation.Id;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public class Community {
|
||||
public class Portal {
|
||||
|
||||
@Id
|
||||
@JsonProperty("_id")
|
||||
|
@ -18,7 +18,7 @@ public class Community {
|
|||
private Map<String, Boolean> entities;
|
||||
private String layout;
|
||||
|
||||
public Community() {}
|
||||
public Portal() {}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
|
@ -1,9 +1,9 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.DivHelpContent;
|
||||
|
||||
public class DivHelpContentResponse {
|
||||
|
@ -12,7 +12,7 @@ public class DivHelpContentResponse {
|
|||
private String id;
|
||||
|
||||
private DivIdResponse divId;
|
||||
private Community community;
|
||||
private Portal portal;
|
||||
private String content;
|
||||
private boolean isActive = true;
|
||||
|
||||
|
@ -38,12 +38,12 @@ public class DivHelpContentResponse {
|
|||
this.divId = divId;
|
||||
}
|
||||
|
||||
public Community getCommunity() {
|
||||
return community;
|
||||
public Portal getPortal() {
|
||||
return portal;
|
||||
}
|
||||
|
||||
public void setCommunity(Community community) {
|
||||
this.community = community;
|
||||
public void setPortal(Portal portal) {
|
||||
this.portal = portal;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.PageHelpContent;
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class PageHelpContentResponse {
|
|||
private String id;
|
||||
|
||||
private Page page;
|
||||
private Community community;
|
||||
private Portal portal;
|
||||
private String placement;
|
||||
private int order;
|
||||
private String content;
|
||||
|
@ -48,12 +48,12 @@ public class PageHelpContentResponse {
|
|||
this.page = page;
|
||||
}
|
||||
|
||||
public Community getCommunity() {
|
||||
return community;
|
||||
public Portal getPortal() {
|
||||
return portal;
|
||||
}
|
||||
|
||||
public void setCommunity(Community community) {
|
||||
this.community = community;
|
||||
public void setPortal(Portal portal) {
|
||||
this.portal = portal;
|
||||
}
|
||||
|
||||
public String getPlacement() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.springframework.data.annotation.Id;
|
|||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Entity;
|
||||
|
||||
public class CommunityEntity {
|
||||
public class PortalEntity {
|
||||
@Id
|
||||
@JsonProperty("_id")
|
||||
private String id;
|
||||
|
@ -14,9 +14,9 @@ public class CommunityEntity {
|
|||
private String name;
|
||||
private Boolean isEnabled;
|
||||
|
||||
public CommunityEntity() {}
|
||||
public PortalEntity() {}
|
||||
|
||||
public CommunityEntity(Entity entity) {
|
||||
public PortalEntity(Entity entity) {
|
||||
this.setId(entity.getId());
|
||||
this.setPid(entity.getPid());
|
||||
this.setName(entity.getName());
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
import eu.dnetlib.uoaadmintoolslibrary.entities.Entity;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
|
||||
|
||||
public class CommunityPage {
|
||||
public class PortalPage {
|
||||
|
||||
@Id
|
||||
@JsonProperty("_id")
|
||||
|
@ -31,9 +31,9 @@ public class CommunityPage {
|
|||
private Boolean left;
|
||||
private Boolean right;
|
||||
|
||||
public CommunityPage() {}
|
||||
public PortalPage() {}
|
||||
|
||||
public CommunityPage(Page page) {
|
||||
public PortalPage(Page page) {
|
||||
this.setId(page.getId());
|
||||
this.setRoute(page.getRoute());
|
||||
this.setName(page.getName());
|
|
@ -5,25 +5,25 @@ import org.springframework.data.annotation.Id;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Community;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
|
||||
public class CommunityResponse {
|
||||
public class PortalResponse {
|
||||
@Id
|
||||
@JsonProperty("_id")
|
||||
private String id;
|
||||
|
||||
private String pid;
|
||||
private String name;
|
||||
private List<CommunityPage> pages;
|
||||
private List<CommunityEntity> entities;
|
||||
private List<PortalPage> pages;
|
||||
private List<PortalEntity> entities;
|
||||
//private Layout layout;
|
||||
|
||||
public CommunityResponse() {}
|
||||
public PortalResponse() {}
|
||||
|
||||
public CommunityResponse(Community community) {
|
||||
this.setId(community.getId());
|
||||
this.setPid(community.getPid());
|
||||
this.setName(community.getName());
|
||||
public PortalResponse(Portal portal) {
|
||||
this.setId(portal.getId());
|
||||
this.setPid(portal.getPid());
|
||||
this.setName(portal.getName());
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@ -50,13 +50,13 @@ public class CommunityResponse {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public List<CommunityPage> getPages() { return pages; }
|
||||
public List<PortalPage> getPages() { return pages; }
|
||||
|
||||
public void setPages(List<CommunityPage> pages) { this.pages = pages; }
|
||||
public void setPages(List<PortalPage> pages) { this.pages = pages; }
|
||||
|
||||
public List<CommunityEntity> getEntities() { return entities; }
|
||||
public List<PortalEntity> getEntities() { return entities; }
|
||||
|
||||
public void setEntities(List<CommunityEntity> entities) {
|
||||
public void setEntities(List<PortalEntity> entities) {
|
||||
this.entities = entities;
|
||||
}
|
||||
|
Loading…
Reference in New Issue