From 40b7fa40cdd7720fc4117739e232ee9aecb347c3 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 25 Feb 2021 10:43:53 +0000 Subject: [PATCH] [Trunk | Admin Tools]: 1. SubscriberController.java & PortalSubscribersController.java: Commented POST/ DELETE methods from controllers related to subscribers (these files will be deleted after migration of roles to AAI). 2. StatisticsController.java: Commented all methods (file and statistics schema in general need update - currently not working). --- .../PortalSubscribersController.java | 310 +++++++++--------- .../controllers/StatisticsController.java | 246 +++++++------- .../controllers/SubscriberController.java | 26 +- 3 files changed, 291 insertions(+), 291 deletions(-) diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/PortalSubscribersController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/PortalSubscribersController.java index f80e73b..1089cf2 100644 --- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/PortalSubscribersController.java +++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/PortalSubscribersController.java @@ -1,6 +1,6 @@ package eu.dnetlib.uoaadmintools.controllers; -import eu.dnetlib.uoaadmintools.configuration.properties.SecurityConfig; +//import eu.dnetlib.uoaadmintools.configuration.properties.SecurityConfig; import eu.dnetlib.uoaadmintools.dao.PortalSubscribersDAO; import eu.dnetlib.uoaadmintools.dao.SubscriberDAO; import eu.dnetlib.uoaadmintools.entities.subscriber.PortalSubscribers; @@ -8,7 +8,7 @@ import eu.dnetlib.uoaadmintools.entities.subscriber.Subscriber; import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException; import eu.dnetlib.uoaadmintools.handlers.utils.AuthorizationUtils; import eu.dnetlib.uoaadmintools.handlers.utils.UserInfo; -import eu.dnetlib.uoaadmintools.responses.SingleValueWrapperResponse; +import eu.dnetlib.uoaadmintoolslibrary.responses.SingleValueWrapperResponse; import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -31,8 +31,8 @@ public class PortalSubscribersController { @Autowired PortalDAO portalDAO; - @Autowired - private SecurityConfig securityConfig; +// @Autowired +// private SecurityConfig securityConfig; private final Logger log = Logger.getLogger(this.getClass()); @@ -91,155 +91,155 @@ public class PortalSubscribersController { // // } - @RequestMapping(value = "/community/{pid}/is-subscriber", method = RequestMethod.GET) - public Boolean getIsSubscribedToPortal(@PathVariable(value="pid", required = true) String pid, - //@RequestBody String email, - @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { - AuthorizationUtils helper = new AuthorizationUtils(); - helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); - UserInfo userInfo = helper.getUserInfo(token); - - if(userInfo != null) { - String email = userInfo.getEmail(); - PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); - if (communitySubscribers != null) { - if (communitySubscribers.getSubscribers() != null) { - for (Subscriber subscriber : communitySubscribers.getSubscribers()) { - if (subscriber.getEmail().equals(email)) { - return true; - } - } - } - } else { - throw new ContentNotFoundException("Portal Subscribers not found"); - - } - } - return false; - } - - @RequestMapping(value = "/community/{pid}/subscriber", method = RequestMethod.POST) - public Boolean addSubscriberInPortal(@PathVariable(value="pid", required = true) String pid, - @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { - AuthorizationUtils helper = new AuthorizationUtils(); - helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); - UserInfo userInfo = helper.getUserInfo(token); - - if(userInfo != null) { - String email = userInfo.getEmail(); - Subscriber subscriber = new Subscriber(email); - - PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); - if (communitySubscribers == null) { - throw new ContentNotFoundException("Community Subscribers not found"); - } - - Subscriber savedSubscriber = subscriberDAO.findByEmail(email); - if (savedSubscriber == null) { - savedSubscriber = subscriberDAO.save(subscriber); - } - for (Subscriber sub : communitySubscribers.getSubscribers()) { - if (sub.getEmail().equals(subscriber.getEmail())) { - //already subscribed - return false; - } - } - //not subscribed yet - communitySubscribers.getSubscribers().add(savedSubscriber); - portalSubscribersDAO.save(communitySubscribers); - return true; - } - return false; - - } - @RequestMapping(value = "/community/{pid}/subscriber/delete", method = RequestMethod.POST) - public Boolean deleteSubscriberFromPortal(@PathVariable(value="pid", required = true) String pid, - @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { - AuthorizationUtils helper = new AuthorizationUtils(); - helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); - UserInfo userInfo = helper.getUserInfo(token); - - if(userInfo != null) { - String email = userInfo.getEmail(); - - PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); - if (communitySubscribers == null) { - throw new ContentNotFoundException("Community Subscribers not found"); - } - - Iterator subscriberIterator = communitySubscribers.getSubscribers().iterator(); - while(subscriberIterator.hasNext()) { - Subscriber subscriber = subscriberIterator.next(); - if(subscriber.getEmail().equals(email)) { - subscriberIterator.remove(); - portalSubscribersDAO.save(communitySubscribers); - return true; - } - } - } - return false; - } - - @RequestMapping(value = "/community/{pid}/subscribers", method = RequestMethod.POST) - public PortalSubscribers addSubscriberInPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody Subscriber subscriber) throws ContentNotFoundException { - PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); - if(communitySubscribers == null){ - throw new ContentNotFoundException("Community Subscribers not found"); - } - - Subscriber savedSubscriber = subscriberDAO.findByEmail(subscriber.getEmail()); - if(savedSubscriber==null){ - savedSubscriber = subscriberDAO.save(subscriber); - } - for(Subscriber sub:communitySubscribers.getSubscribers()){ - if(sub.getEmail().equals(subscriber.getEmail())){ - //already subscribed - return communitySubscribers; - } - } - //not subscribed yet - communitySubscribers.getSubscribers().add(savedSubscriber); - return portalSubscribersDAO.save(communitySubscribers); - - } - @RequestMapping(value = "/community/{pid}/subscribers/delete", method = RequestMethod.POST) - public PortalSubscribers deleteSubscriberFromPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody List emails) throws ContentNotFoundException { - PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); - if(communitySubscribers == null){ - throw new ContentNotFoundException("Community Subscribers not found"); - } - List list = new ArrayList<>(); - for(Subscriber s:communitySubscribers.getSubscribers()){ - if(emails.indexOf(s.getEmail())==-1){ - list.add(s); - } - } - communitySubscribers.setSubscribers(list); - return portalSubscribersDAO.save(communitySubscribers); - } - - @RequestMapping(value = "/subscriber/communities", method = RequestMethod.GET) - public List getPortalsPerSubcriber(//@RequestParam(value="email", required = true) String email, - @RequestHeader("X-XSRF-TOKEN") String token) { - AuthorizationUtils helper = new AuthorizationUtils(); - helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); - UserInfo userInfo = helper.getUserInfo(token); - - List list = new ArrayList<>(); - - if (userInfo != null) { - String email = userInfo.getEmail(); - List communitySubscribers = portalSubscribersDAO.findAll(); - - for (PortalSubscribers s : communitySubscribers) { - for (Subscriber sub : s.getSubscribers()) { - if (sub.getEmail().equals(email)) { - list.add(s.getPid()); - break; - } - } - } - } - return list; - } +// @RequestMapping(value = "/community/{pid}/is-subscriber", method = RequestMethod.GET) +// public Boolean getIsSubscribedToPortal(@PathVariable(value="pid", required = true) String pid, +// //@RequestBody String email, +// @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { +// AuthorizationUtils helper = new AuthorizationUtils(); +// helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); +// UserInfo userInfo = helper.getUserInfo(token); +// +// if(userInfo != null) { +// String email = userInfo.getEmail(); +// PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); +// if (communitySubscribers != null) { +// if (communitySubscribers.getSubscribers() != null) { +// for (Subscriber subscriber : communitySubscribers.getSubscribers()) { +// if (subscriber.getEmail().equals(email)) { +// return true; +// } +// } +// } +// } else { +// throw new ContentNotFoundException("Portal Subscribers not found"); +// +// } +// } +// return false; +// } +// +// @RequestMapping(value = "/community/{pid}/subscriber", method = RequestMethod.POST) +// public Boolean addSubscriberInPortal(@PathVariable(value="pid", required = true) String pid, +// @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { +// AuthorizationUtils helper = new AuthorizationUtils(); +// helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); +// UserInfo userInfo = helper.getUserInfo(token); +// +// if(userInfo != null) { +// String email = userInfo.getEmail(); +// Subscriber subscriber = new Subscriber(email); +// +// PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); +// if (communitySubscribers == null) { +// throw new ContentNotFoundException("Community Subscribers not found"); +// } +// +// Subscriber savedSubscriber = subscriberDAO.findByEmail(email); +// if (savedSubscriber == null) { +// savedSubscriber = subscriberDAO.save(subscriber); +// } +// for (Subscriber sub : communitySubscribers.getSubscribers()) { +// if (sub.getEmail().equals(subscriber.getEmail())) { +// //already subscribed +// return false; +// } +// } +// //not subscribed yet +// communitySubscribers.getSubscribers().add(savedSubscriber); +// portalSubscribersDAO.save(communitySubscribers); +// return true; +// } +// return false; +// +// } +// @RequestMapping(value = "/community/{pid}/subscriber/delete", method = RequestMethod.POST) +// public Boolean deleteSubscriberFromPortal(@PathVariable(value="pid", required = true) String pid, +// @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { +// AuthorizationUtils helper = new AuthorizationUtils(); +// helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); +// UserInfo userInfo = helper.getUserInfo(token); +// +// if(userInfo != null) { +// String email = userInfo.getEmail(); +// +// PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); +// if (communitySubscribers == null) { +// throw new ContentNotFoundException("Community Subscribers not found"); +// } +// +// Iterator subscriberIterator = communitySubscribers.getSubscribers().iterator(); +// while(subscriberIterator.hasNext()) { +// Subscriber subscriber = subscriberIterator.next(); +// if(subscriber.getEmail().equals(email)) { +// subscriberIterator.remove(); +// portalSubscribersDAO.save(communitySubscribers); +// return true; +// } +// } +// } +// return false; +// } +// +// @RequestMapping(value = "/community/{pid}/subscribers", method = RequestMethod.POST) +// public PortalSubscribers addSubscriberInPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody Subscriber subscriber) throws ContentNotFoundException { +// PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); +// if(communitySubscribers == null){ +// throw new ContentNotFoundException("Community Subscribers not found"); +// } +// +// Subscriber savedSubscriber = subscriberDAO.findByEmail(subscriber.getEmail()); +// if(savedSubscriber==null){ +// savedSubscriber = subscriberDAO.save(subscriber); +// } +// for(Subscriber sub:communitySubscribers.getSubscribers()){ +// if(sub.getEmail().equals(subscriber.getEmail())){ +// //already subscribed +// return communitySubscribers; +// } +// } +// //not subscribed yet +// communitySubscribers.getSubscribers().add(savedSubscriber); +// return portalSubscribersDAO.save(communitySubscribers); +// +// } +// @RequestMapping(value = "/community/{pid}/subscribers/delete", method = RequestMethod.POST) +// public PortalSubscribers deleteSubscriberFromPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody List emails) throws ContentNotFoundException { +// PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); +// if(communitySubscribers == null){ +// throw new ContentNotFoundException("Community Subscribers not found"); +// } +// List list = new ArrayList<>(); +// for(Subscriber s:communitySubscribers.getSubscribers()){ +// if(emails.indexOf(s.getEmail())==-1){ +// list.add(s); +// } +// } +// communitySubscribers.setSubscribers(list); +// return portalSubscribersDAO.save(communitySubscribers); +// } +// +// @RequestMapping(value = "/subscriber/communities", method = RequestMethod.GET) +// public List getPortalsPerSubcriber(//@RequestParam(value="email", required = true) String email, +// @RequestHeader("X-XSRF-TOKEN") String token) { +// AuthorizationUtils helper = new AuthorizationUtils(); +// helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); +// UserInfo userInfo = helper.getUserInfo(token); +// +// List list = new ArrayList<>(); +// +// if (userInfo != null) { +// String email = userInfo.getEmail(); +// List communitySubscribers = portalSubscribersDAO.findAll(); +// +// for (PortalSubscribers s : communitySubscribers) { +// for (Subscriber sub : s.getSubscribers()) { +// if (sub.getEmail().equals(email)) { +// list.add(s.getPid()); +// break; +// } +// } +// } +// } +// return list; +// } } diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/StatisticsController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/StatisticsController.java index 5c50824..2e36abc 100644 --- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/StatisticsController.java +++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/StatisticsController.java @@ -1,123 +1,123 @@ -package eu.dnetlib.uoaadmintools.controllers; - -import eu.dnetlib.uoaadmintools.dao.*; -import eu.dnetlib.uoaadmintools.entities.statistics.*; -import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.*; - -@RestController -@CrossOrigin(origins = "*") -public class StatisticsController { - private final Logger log = Logger.getLogger(this.getClass()); - - @Autowired - private StatisticsDAO statisticsDAO; - - @RequestMapping(value = "/statistics", method = RequestMethod.GET) - public List getAllStatistics() throws ContentNotFoundException { - log.info("getAllStatistics"); - List statistics = statisticsDAO.findAll(); - if(statistics == null){ - throw new ContentNotFoundException("Statistics not found"); - } - return statistics; - } - - - - @RequestMapping(value = "/statistics/{pid}", method = RequestMethod.GET) - public Statistics getStatistics(@PathVariable(value = "pid") String pid) throws ContentNotFoundException { - Statistics statistics = statisticsDAO.findByPid(pid); - if(statistics == null){ - throw new ContentNotFoundException("Statistics not found"); - } - return statistics; - } - - @RequestMapping(value = "/statistics/{id}/toggle", method = RequestMethod.POST) - public Boolean toggleStatistics(@PathVariable String id) throws Exception { - Statistics statistics = statisticsDAO.findById(id); - boolean status = statistics.getIsActive(); - statistics.setIsActive(!status); - statisticsDAO.save(statistics); - return statistics.getIsActive(); - } - - @RequestMapping(value = "/statistics/save", method = RequestMethod.POST) - public Statistics insertStatistics(@RequestBody Statistics statistics) { - Statistics savedStatistics = statisticsDAO.save(statistics); - return savedStatistics; - } - - - - @RequestMapping(value = "/statistics/delete", method = RequestMethod.POST) - public Boolean deleteStatistics(@RequestBody List statistics) throws Exception { - for (String id: statistics) { - statisticsDAO.delete(id); - } - return true; - } - - - - - @RequestMapping(value = "statistics/{pid}/{entity}/charts", method = RequestMethod.POST) - public Statistics toggleCharts(@PathVariable(value = "pid") String pid, @PathVariable(value = "entity") String entity, @RequestBody String key, @RequestParam String status, @RequestParam String monitor) throws ContentNotFoundException { - Statistics statistics = statisticsDAO.findByPid(pid); - if(statistics == null){ - throw new ContentNotFoundException("Statistics not found for portal"); - } - StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); - if(statisticsEntity == null ){ - throw new ContentNotFoundException("Statistics not found for entity"); - } - ChartsMap charts = statisticsEntity.getCharts(); - if(charts == null){ - throw new ContentNotFoundException("Statistics not found - no charts"); - } - StatisticsStatus statisticsStatus= charts.getMap().get(key); - if(statisticsStatus == null){ - throw new ContentNotFoundException("Statistics not found for key"); - } - if(Boolean.parseBoolean(monitor)){ - statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); - }else{ - statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); - } -// stats.put(key,statisticsStatus); - return statisticsDAO.save(statistics); - } - @RequestMapping(value = "statistics/{pid}/{entity}/numbers", method = RequestMethod.POST) - public Statistics toggleNumber(@PathVariable(value = "pid") String pid, @PathVariable(value = "entity") String entity, @RequestBody String key, @RequestParam String status, @RequestParam String monitor) throws ContentNotFoundException { - Statistics statistics = statisticsDAO.findByPid(pid); - if(statistics == null){ - throw new ContentNotFoundException("Statistics not found for portal"); - } - StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); - if(statisticsEntity == null ){ - throw new ContentNotFoundException("Statistics not found for entity"); - } - NumbersMap numbers = statisticsEntity.getNumbers(); - if(numbers == null){ - throw new ContentNotFoundException("Statistics not found - no numbers"); - } - StatisticsStatus statisticsStatus= numbers.getMap().get(key); - if(statisticsStatus == null){ - throw new ContentNotFoundException("Statistics not found for key"); - } - if(Boolean.parseBoolean(monitor)){ - statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); - }else{ - statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); - } -// stats.put(key,statisticsStatus); - return statisticsDAO.save(statistics); - } - - -} \ No newline at end of file +//package eu.dnetlib.uoaadmintools.controllers; +// +//import eu.dnetlib.uoaadmintools.dao.*; +//import eu.dnetlib.uoaadmintools.entities.statistics.*; +//import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException; +//import org.apache.log4j.Logger; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.*; +// +//import java.util.*; +// +//@RestController +//@CrossOrigin(origins = "*") +//public class StatisticsController { +// private final Logger log = Logger.getLogger(this.getClass()); +// +// @Autowired +// private StatisticsDAO statisticsDAO; +// +// @RequestMapping(value = "/statistics", method = RequestMethod.GET) +// public List getAllStatistics() throws ContentNotFoundException { +// log.info("getAllStatistics"); +// List statistics = statisticsDAO.findAll(); +// if(statistics == null){ +// throw new ContentNotFoundException("Statistics not found"); +// } +// return statistics; +// } +// +// +// +// @RequestMapping(value = "/statistics/{pid}", method = RequestMethod.GET) +// public Statistics getStatistics(@PathVariable(value = "pid") String pid) throws ContentNotFoundException { +// Statistics statistics = statisticsDAO.findByPid(pid); +// if(statistics == null){ +// throw new ContentNotFoundException("Statistics not found"); +// } +// return statistics; +// } +// +// @RequestMapping(value = "/statistics/{id}/toggle", method = RequestMethod.POST) +// public Boolean toggleStatistics(@PathVariable String id) throws Exception { +// Statistics statistics = statisticsDAO.findById(id); +// boolean status = statistics.getIsActive(); +// statistics.setIsActive(!status); +// statisticsDAO.save(statistics); +// return statistics.getIsActive(); +// } +// +// @RequestMapping(value = "/statistics/save", method = RequestMethod.POST) +// public Statistics insertStatistics(@RequestBody Statistics statistics) { +// Statistics savedStatistics = statisticsDAO.save(statistics); +// return savedStatistics; +// } +// +// +// +// @RequestMapping(value = "/statistics/delete", method = RequestMethod.POST) +// public Boolean deleteStatistics(@RequestBody List statistics) throws Exception { +// for (String id: statistics) { +// statisticsDAO.delete(id); +// } +// return true; +// } +// +// +// +// +// @RequestMapping(value = "statistics/{pid}/{entity}/charts", method = RequestMethod.POST) +// public Statistics toggleCharts(@PathVariable(value = "pid") String pid, @PathVariable(value = "entity") String entity, @RequestBody String key, @RequestParam String status, @RequestParam String monitor) throws ContentNotFoundException { +// Statistics statistics = statisticsDAO.findByPid(pid); +// if(statistics == null){ +// throw new ContentNotFoundException("Statistics not found for portal"); +// } +// StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); +// if(statisticsEntity == null ){ +// throw new ContentNotFoundException("Statistics not found for entity"); +// } +// ChartsMap charts = statisticsEntity.getCharts(); +// if(charts == null){ +// throw new ContentNotFoundException("Statistics not found - no charts"); +// } +// StatisticsStatus statisticsStatus= charts.getMap().get(key); +// if(statisticsStatus == null){ +// throw new ContentNotFoundException("Statistics not found for key"); +// } +// if(Boolean.parseBoolean(monitor)){ +// statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); +// }else{ +// statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); +// } +//// stats.put(key,statisticsStatus); +// return statisticsDAO.save(statistics); +// } +// @RequestMapping(value = "statistics/{pid}/{entity}/numbers", method = RequestMethod.POST) +// public Statistics toggleNumber(@PathVariable(value = "pid") String pid, @PathVariable(value = "entity") String entity, @RequestBody String key, @RequestParam String status, @RequestParam String monitor) throws ContentNotFoundException { +// Statistics statistics = statisticsDAO.findByPid(pid); +// if(statistics == null){ +// throw new ContentNotFoundException("Statistics not found for portal"); +// } +// StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); +// if(statisticsEntity == null ){ +// throw new ContentNotFoundException("Statistics not found for entity"); +// } +// NumbersMap numbers = statisticsEntity.getNumbers(); +// if(numbers == null){ +// throw new ContentNotFoundException("Statistics not found - no numbers"); +// } +// StatisticsStatus statisticsStatus= numbers.getMap().get(key); +// if(statisticsStatus == null){ +// throw new ContentNotFoundException("Statistics not found for key"); +// } +// if(Boolean.parseBoolean(monitor)){ +// statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); +// }else{ +// statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); +// } +//// stats.put(key,statisticsStatus); +// return statisticsDAO.save(statistics); +// } +// +// +//} \ No newline at end of file diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/SubscriberController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/SubscriberController.java index af33101..9510a55 100644 --- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/SubscriberController.java +++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/SubscriberController.java @@ -34,18 +34,18 @@ public class SubscriberController { } return subscriber; } - @RequestMapping(value = "/subscriber", method = RequestMethod.POST) - public Subscriber saveSubscriber(@RequestBody Subscriber subscriber) { - return subscriberDAO.save(subscriber); - } - @RequestMapping(value = "/subscriber/{email}", method = RequestMethod.DELETE) - public void deleteSubscriber(@PathVariable(value="email", required = true) String email) throws ContentNotFoundException { - Subscriber subscriber = subscriberDAO.findByEmail(email); - if(subscriber == null){ - throw new ContentNotFoundException("Subscribers not found"); - } - subscriberDAO.delete(subscriber.getId()); - - } +// @RequestMapping(value = "/subscriber", method = RequestMethod.POST) +// public Subscriber saveSubscriber(@RequestBody Subscriber subscriber) { +// return subscriberDAO.save(subscriber); +// } +// @RequestMapping(value = "/subscriber/{email}", method = RequestMethod.DELETE) +// public void deleteSubscriber(@PathVariable(value="email", required = true) String email) throws ContentNotFoundException { +// Subscriber subscriber = subscriberDAO.findByEmail(email); +// if(subscriber == null){ +// throw new ContentNotFoundException("Subscribers not found"); +// } +// subscriberDAO.delete(subscriber.getId()); +// +// } }