[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).
This commit is contained in:
Konstantina Galouni 2021-02-25 10:43:53 +00:00
parent 9389c43ec6
commit 40b7fa40cd
3 changed files with 291 additions and 291 deletions

View File

@ -1,6 +1,6 @@
package eu.dnetlib.uoaadmintools.controllers; 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.PortalSubscribersDAO;
import eu.dnetlib.uoaadmintools.dao.SubscriberDAO; import eu.dnetlib.uoaadmintools.dao.SubscriberDAO;
import eu.dnetlib.uoaadmintools.entities.subscriber.PortalSubscribers; 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.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintools.handlers.utils.AuthorizationUtils; import eu.dnetlib.uoaadmintools.handlers.utils.AuthorizationUtils;
import eu.dnetlib.uoaadmintools.handlers.utils.UserInfo; 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 eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -31,8 +31,8 @@ public class PortalSubscribersController {
@Autowired @Autowired
PortalDAO portalDAO; PortalDAO portalDAO;
@Autowired // @Autowired
private SecurityConfig securityConfig; // private SecurityConfig securityConfig;
private final Logger log = Logger.getLogger(this.getClass()); private final Logger log = Logger.getLogger(this.getClass());
@ -91,155 +91,155 @@ public class PortalSubscribersController {
// //
// } // }
@RequestMapping(value = "/community/{pid}/is-subscriber", method = RequestMethod.GET) // @RequestMapping(value = "/community/{pid}/is-subscriber", method = RequestMethod.GET)
public Boolean getIsSubscribedToPortal(@PathVariable(value="pid", required = true) String pid, // public Boolean getIsSubscribedToPortal(@PathVariable(value="pid", required = true) String pid,
//@RequestBody String email, // //@RequestBody String email,
@RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { // @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException {
AuthorizationUtils helper = new AuthorizationUtils(); // AuthorizationUtils helper = new AuthorizationUtils();
helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); // helper.setUserInfoUrl(securityConfig.getUserInfoUrl());
UserInfo userInfo = helper.getUserInfo(token); // UserInfo userInfo = helper.getUserInfo(token);
//
if(userInfo != null) { // if(userInfo != null) {
String email = userInfo.getEmail(); // String email = userInfo.getEmail();
PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); // PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid);
if (communitySubscribers != null) { // if (communitySubscribers != null) {
if (communitySubscribers.getSubscribers() != null) { // if (communitySubscribers.getSubscribers() != null) {
for (Subscriber subscriber : communitySubscribers.getSubscribers()) { // for (Subscriber subscriber : communitySubscribers.getSubscribers()) {
if (subscriber.getEmail().equals(email)) { // if (subscriber.getEmail().equals(email)) {
return true; // return true;
} // }
} // }
} // }
} else { // } else {
throw new ContentNotFoundException("Portal Subscribers not found"); // throw new ContentNotFoundException("Portal Subscribers not found");
//
} // }
} // }
return false; // return false;
} // }
//
@RequestMapping(value = "/community/{pid}/subscriber", method = RequestMethod.POST) // @RequestMapping(value = "/community/{pid}/subscriber", method = RequestMethod.POST)
public Boolean addSubscriberInPortal(@PathVariable(value="pid", required = true) String pid, // public Boolean addSubscriberInPortal(@PathVariable(value="pid", required = true) String pid,
@RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { // @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException {
AuthorizationUtils helper = new AuthorizationUtils(); // AuthorizationUtils helper = new AuthorizationUtils();
helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); // helper.setUserInfoUrl(securityConfig.getUserInfoUrl());
UserInfo userInfo = helper.getUserInfo(token); // UserInfo userInfo = helper.getUserInfo(token);
//
if(userInfo != null) { // if(userInfo != null) {
String email = userInfo.getEmail(); // String email = userInfo.getEmail();
Subscriber subscriber = new Subscriber(email); // Subscriber subscriber = new Subscriber(email);
//
PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); // PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid);
if (communitySubscribers == null) { // if (communitySubscribers == null) {
throw new ContentNotFoundException("Community Subscribers not found"); // throw new ContentNotFoundException("Community Subscribers not found");
} // }
//
Subscriber savedSubscriber = subscriberDAO.findByEmail(email); // Subscriber savedSubscriber = subscriberDAO.findByEmail(email);
if (savedSubscriber == null) { // if (savedSubscriber == null) {
savedSubscriber = subscriberDAO.save(subscriber); // savedSubscriber = subscriberDAO.save(subscriber);
} // }
for (Subscriber sub : communitySubscribers.getSubscribers()) { // for (Subscriber sub : communitySubscribers.getSubscribers()) {
if (sub.getEmail().equals(subscriber.getEmail())) { // if (sub.getEmail().equals(subscriber.getEmail())) {
//already subscribed // //already subscribed
return false; // return false;
} // }
} // }
//not subscribed yet // //not subscribed yet
communitySubscribers.getSubscribers().add(savedSubscriber); // communitySubscribers.getSubscribers().add(savedSubscriber);
portalSubscribersDAO.save(communitySubscribers); // portalSubscribersDAO.save(communitySubscribers);
return true; // return true;
} // }
return false; // return false;
//
} // }
@RequestMapping(value = "/community/{pid}/subscriber/delete", method = RequestMethod.POST) // @RequestMapping(value = "/community/{pid}/subscriber/delete", method = RequestMethod.POST)
public Boolean deleteSubscriberFromPortal(@PathVariable(value="pid", required = true) String pid, // public Boolean deleteSubscriberFromPortal(@PathVariable(value="pid", required = true) String pid,
@RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException { // @RequestHeader("X-XSRF-TOKEN") String token) throws ContentNotFoundException {
AuthorizationUtils helper = new AuthorizationUtils(); // AuthorizationUtils helper = new AuthorizationUtils();
helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); // helper.setUserInfoUrl(securityConfig.getUserInfoUrl());
UserInfo userInfo = helper.getUserInfo(token); // UserInfo userInfo = helper.getUserInfo(token);
//
if(userInfo != null) { // if(userInfo != null) {
String email = userInfo.getEmail(); // String email = userInfo.getEmail();
//
PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); // PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid);
if (communitySubscribers == null) { // if (communitySubscribers == null) {
throw new ContentNotFoundException("Community Subscribers not found"); // throw new ContentNotFoundException("Community Subscribers not found");
} // }
//
Iterator<Subscriber> subscriberIterator = communitySubscribers.getSubscribers().iterator(); // Iterator<Subscriber> subscriberIterator = communitySubscribers.getSubscribers().iterator();
while(subscriberIterator.hasNext()) { // while(subscriberIterator.hasNext()) {
Subscriber subscriber = subscriberIterator.next(); // Subscriber subscriber = subscriberIterator.next();
if(subscriber.getEmail().equals(email)) { // if(subscriber.getEmail().equals(email)) {
subscriberIterator.remove(); // subscriberIterator.remove();
portalSubscribersDAO.save(communitySubscribers); // portalSubscribersDAO.save(communitySubscribers);
return true; // return true;
} // }
} // }
} // }
return false; // return false;
} // }
//
@RequestMapping(value = "/community/{pid}/subscribers", method = RequestMethod.POST) // @RequestMapping(value = "/community/{pid}/subscribers", method = RequestMethod.POST)
public PortalSubscribers addSubscriberInPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody Subscriber subscriber) throws ContentNotFoundException { // public PortalSubscribers addSubscriberInPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody Subscriber subscriber) throws ContentNotFoundException {
PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); // PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid);
if(communitySubscribers == null){ // if(communitySubscribers == null){
throw new ContentNotFoundException("Community Subscribers not found"); // throw new ContentNotFoundException("Community Subscribers not found");
} // }
//
Subscriber savedSubscriber = subscriberDAO.findByEmail(subscriber.getEmail()); // Subscriber savedSubscriber = subscriberDAO.findByEmail(subscriber.getEmail());
if(savedSubscriber==null){ // if(savedSubscriber==null){
savedSubscriber = subscriberDAO.save(subscriber); // savedSubscriber = subscriberDAO.save(subscriber);
} // }
for(Subscriber sub:communitySubscribers.getSubscribers()){ // for(Subscriber sub:communitySubscribers.getSubscribers()){
if(sub.getEmail().equals(subscriber.getEmail())){ // if(sub.getEmail().equals(subscriber.getEmail())){
//already subscribed // //already subscribed
return communitySubscribers; // return communitySubscribers;
} // }
} // }
//not subscribed yet // //not subscribed yet
communitySubscribers.getSubscribers().add(savedSubscriber); // communitySubscribers.getSubscribers().add(savedSubscriber);
return portalSubscribersDAO.save(communitySubscribers); // return portalSubscribersDAO.save(communitySubscribers);
//
} // }
@RequestMapping(value = "/community/{pid}/subscribers/delete", method = RequestMethod.POST) // @RequestMapping(value = "/community/{pid}/subscribers/delete", method = RequestMethod.POST)
public PortalSubscribers deleteSubscriberFromPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody List<String> emails) throws ContentNotFoundException { // public PortalSubscribers deleteSubscriberFromPortalByEmail(@PathVariable(value="pid", required = true) String pid, @RequestBody List<String> emails) throws ContentNotFoundException {
PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid); // PortalSubscribers communitySubscribers = portalSubscribersDAO.findByPid(pid);
if(communitySubscribers == null){ // if(communitySubscribers == null){
throw new ContentNotFoundException("Community Subscribers not found"); // throw new ContentNotFoundException("Community Subscribers not found");
} // }
List<Subscriber> list = new ArrayList<>(); // List<Subscriber> list = new ArrayList<>();
for(Subscriber s:communitySubscribers.getSubscribers()){ // for(Subscriber s:communitySubscribers.getSubscribers()){
if(emails.indexOf(s.getEmail())==-1){ // if(emails.indexOf(s.getEmail())==-1){
list.add(s); // list.add(s);
} // }
} // }
communitySubscribers.setSubscribers(list); // communitySubscribers.setSubscribers(list);
return portalSubscribersDAO.save(communitySubscribers); // return portalSubscribersDAO.save(communitySubscribers);
} // }
//
@RequestMapping(value = "/subscriber/communities", method = RequestMethod.GET) // @RequestMapping(value = "/subscriber/communities", method = RequestMethod.GET)
public List<String> getPortalsPerSubcriber(//@RequestParam(value="email", required = true) String email, // public List<String> getPortalsPerSubcriber(//@RequestParam(value="email", required = true) String email,
@RequestHeader("X-XSRF-TOKEN") String token) { // @RequestHeader("X-XSRF-TOKEN") String token) {
AuthorizationUtils helper = new AuthorizationUtils(); // AuthorizationUtils helper = new AuthorizationUtils();
helper.setUserInfoUrl(securityConfig.getUserInfoUrl()); // helper.setUserInfoUrl(securityConfig.getUserInfoUrl());
UserInfo userInfo = helper.getUserInfo(token); // UserInfo userInfo = helper.getUserInfo(token);
//
List<String> list = new ArrayList<>(); // List<String> list = new ArrayList<>();
//
if (userInfo != null) { // if (userInfo != null) {
String email = userInfo.getEmail(); // String email = userInfo.getEmail();
List<PortalSubscribers> communitySubscribers = portalSubscribersDAO.findAll(); // List<PortalSubscribers> communitySubscribers = portalSubscribersDAO.findAll();
//
for (PortalSubscribers s : communitySubscribers) { // for (PortalSubscribers s : communitySubscribers) {
for (Subscriber sub : s.getSubscribers()) { // for (Subscriber sub : s.getSubscribers()) {
if (sub.getEmail().equals(email)) { // if (sub.getEmail().equals(email)) {
list.add(s.getPid()); // list.add(s.getPid());
break; // break;
} // }
} // }
} // }
} // }
return list; // return list;
} // }
} }

View File

@ -1,123 +1,123 @@
package eu.dnetlib.uoaadmintools.controllers; //package eu.dnetlib.uoaadmintools.controllers;
//
import eu.dnetlib.uoaadmintools.dao.*; //import eu.dnetlib.uoaadmintools.dao.*;
import eu.dnetlib.uoaadmintools.entities.statistics.*; //import eu.dnetlib.uoaadmintools.entities.statistics.*;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException; //import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import org.apache.log4j.Logger; //import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; //import org.springframework.web.bind.annotation.*;
//
import java.util.*; //import java.util.*;
//
@RestController //@RestController
@CrossOrigin(origins = "*") //@CrossOrigin(origins = "*")
public class StatisticsController { //public class StatisticsController {
private final Logger log = Logger.getLogger(this.getClass()); // private final Logger log = Logger.getLogger(this.getClass());
//
@Autowired // @Autowired
private StatisticsDAO statisticsDAO; // private StatisticsDAO statisticsDAO;
//
@RequestMapping(value = "/statistics", method = RequestMethod.GET) // @RequestMapping(value = "/statistics", method = RequestMethod.GET)
public List<Statistics> getAllStatistics() throws ContentNotFoundException { // public List<Statistics> getAllStatistics() throws ContentNotFoundException {
log.info("getAllStatistics"); // log.info("getAllStatistics");
List<Statistics> statistics = statisticsDAO.findAll(); // List<Statistics> statistics = statisticsDAO.findAll();
if(statistics == null){ // if(statistics == null){
throw new ContentNotFoundException("Statistics not found"); // throw new ContentNotFoundException("Statistics not found");
} // }
return statistics; // return statistics;
} // }
//
//
//
@RequestMapping(value = "/statistics/{pid}", method = RequestMethod.GET) // @RequestMapping(value = "/statistics/{pid}", method = RequestMethod.GET)
public Statistics getStatistics(@PathVariable(value = "pid") String pid) throws ContentNotFoundException { // public Statistics getStatistics(@PathVariable(value = "pid") String pid) throws ContentNotFoundException {
Statistics statistics = statisticsDAO.findByPid(pid); // Statistics statistics = statisticsDAO.findByPid(pid);
if(statistics == null){ // if(statistics == null){
throw new ContentNotFoundException("Statistics not found"); // throw new ContentNotFoundException("Statistics not found");
} // }
return statistics; // return statistics;
} // }
//
@RequestMapping(value = "/statistics/{id}/toggle", method = RequestMethod.POST) // @RequestMapping(value = "/statistics/{id}/toggle", method = RequestMethod.POST)
public Boolean toggleStatistics(@PathVariable String id) throws Exception { // public Boolean toggleStatistics(@PathVariable String id) throws Exception {
Statistics statistics = statisticsDAO.findById(id); // Statistics statistics = statisticsDAO.findById(id);
boolean status = statistics.getIsActive(); // boolean status = statistics.getIsActive();
statistics.setIsActive(!status); // statistics.setIsActive(!status);
statisticsDAO.save(statistics); // statisticsDAO.save(statistics);
return statistics.getIsActive(); // return statistics.getIsActive();
} // }
//
@RequestMapping(value = "/statistics/save", method = RequestMethod.POST) // @RequestMapping(value = "/statistics/save", method = RequestMethod.POST)
public Statistics insertStatistics(@RequestBody Statistics statistics) { // public Statistics insertStatistics(@RequestBody Statistics statistics) {
Statistics savedStatistics = statisticsDAO.save(statistics); // Statistics savedStatistics = statisticsDAO.save(statistics);
return savedStatistics; // return savedStatistics;
} // }
//
//
//
@RequestMapping(value = "/statistics/delete", method = RequestMethod.POST) // @RequestMapping(value = "/statistics/delete", method = RequestMethod.POST)
public Boolean deleteStatistics(@RequestBody List<String> statistics) throws Exception { // public Boolean deleteStatistics(@RequestBody List<String> statistics) throws Exception {
for (String id: statistics) { // for (String id: statistics) {
statisticsDAO.delete(id); // statisticsDAO.delete(id);
} // }
return true; // return true;
} // }
//
//
//
//
@RequestMapping(value = "statistics/{pid}/{entity}/charts", method = RequestMethod.POST) // @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 { // 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); // Statistics statistics = statisticsDAO.findByPid(pid);
if(statistics == null){ // if(statistics == null){
throw new ContentNotFoundException("Statistics not found for portal"); // throw new ContentNotFoundException("Statistics not found for portal");
} // }
StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); // StatisticsEntity statisticsEntity = statistics.getEntities().get(entity);
if(statisticsEntity == null ){ // if(statisticsEntity == null ){
throw new ContentNotFoundException("Statistics not found for entity"); // throw new ContentNotFoundException("Statistics not found for entity");
} // }
ChartsMap charts = statisticsEntity.getCharts(); // ChartsMap charts = statisticsEntity.getCharts();
if(charts == null){ // if(charts == null){
throw new ContentNotFoundException("Statistics not found - no charts"); // throw new ContentNotFoundException("Statistics not found - no charts");
} // }
StatisticsStatus statisticsStatus= charts.getMap().get(key); // StatisticsStatus statisticsStatus= charts.getMap().get(key);
if(statisticsStatus == null){ // if(statisticsStatus == null){
throw new ContentNotFoundException("Statistics not found for key"); // throw new ContentNotFoundException("Statistics not found for key");
} // }
if(Boolean.parseBoolean(monitor)){ // if(Boolean.parseBoolean(monitor)){
statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); // statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status));
}else{ // }else{
statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); // statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status));
} // }
// stats.put(key,statisticsStatus); //// stats.put(key,statisticsStatus);
return statisticsDAO.save(statistics); // return statisticsDAO.save(statistics);
} // }
@RequestMapping(value = "statistics/{pid}/{entity}/numbers", method = RequestMethod.POST) // @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 { // 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); // Statistics statistics = statisticsDAO.findByPid(pid);
if(statistics == null){ // if(statistics == null){
throw new ContentNotFoundException("Statistics not found for portal"); // throw new ContentNotFoundException("Statistics not found for portal");
} // }
StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); // StatisticsEntity statisticsEntity = statistics.getEntities().get(entity);
if(statisticsEntity == null ){ // if(statisticsEntity == null ){
throw new ContentNotFoundException("Statistics not found for entity"); // throw new ContentNotFoundException("Statistics not found for entity");
} // }
NumbersMap numbers = statisticsEntity.getNumbers(); // NumbersMap numbers = statisticsEntity.getNumbers();
if(numbers == null){ // if(numbers == null){
throw new ContentNotFoundException("Statistics not found - no numbers"); // throw new ContentNotFoundException("Statistics not found - no numbers");
} // }
StatisticsStatus statisticsStatus= numbers.getMap().get(key); // StatisticsStatus statisticsStatus= numbers.getMap().get(key);
if(statisticsStatus == null){ // if(statisticsStatus == null){
throw new ContentNotFoundException("Statistics not found for key"); // throw new ContentNotFoundException("Statistics not found for key");
} // }
if(Boolean.parseBoolean(monitor)){ // if(Boolean.parseBoolean(monitor)){
statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); // statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status));
}else{ // }else{
statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); // statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status));
} // }
// stats.put(key,statisticsStatus); //// stats.put(key,statisticsStatus);
return statisticsDAO.save(statistics); // return statisticsDAO.save(statistics);
} // }
//
//
} //}

View File

@ -34,18 +34,18 @@ public class SubscriberController {
} }
return subscriber; return subscriber;
} }
@RequestMapping(value = "/subscriber", method = RequestMethod.POST) // @RequestMapping(value = "/subscriber", method = RequestMethod.POST)
public Subscriber saveSubscriber(@RequestBody Subscriber subscriber) { // public Subscriber saveSubscriber(@RequestBody Subscriber subscriber) {
return subscriberDAO.save(subscriber); // return subscriberDAO.save(subscriber);
} // }
@RequestMapping(value = "/subscriber/{email}", method = RequestMethod.DELETE) // @RequestMapping(value = "/subscriber/{email}", method = RequestMethod.DELETE)
public void deleteSubscriber(@PathVariable(value="email", required = true) String email) throws ContentNotFoundException { // public void deleteSubscriber(@PathVariable(value="email", required = true) String email) throws ContentNotFoundException {
Subscriber subscriber = subscriberDAO.findByEmail(email); // Subscriber subscriber = subscriberDAO.findByEmail(email);
if(subscriber == null){ // if(subscriber == null){
throw new ContentNotFoundException("Subscribers not found"); // throw new ContentNotFoundException("Subscribers not found");
} // }
subscriberDAO.delete(subscriber.getId()); // subscriberDAO.delete(subscriber.getId());
//
} // }
} }