2024-02-13 08:53:33 +01:00
|
|
|
package eu.eudat.controllers.old;
|
2023-03-27 13:58:45 +02:00
|
|
|
|
2023-10-18 17:52:03 +02:00
|
|
|
import eu.eudat.authorization.Permission;
|
2023-03-27 13:58:45 +02:00
|
|
|
import eu.eudat.logic.managers.DatasetProfileManager;
|
2023-10-18 17:52:03 +02:00
|
|
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
2024-02-08 10:04:38 +01:00
|
|
|
import jakarta.transaction.Transactional;
|
2023-03-27 13:58:45 +02:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2024-02-08 10:04:38 +01:00
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
2023-03-27 13:58:45 +02:00
|
|
|
|
|
|
|
@RestController
|
|
|
|
@CrossOrigin
|
|
|
|
@RequestMapping(value = {"/api/management/"})
|
2024-02-08 10:04:38 +01:00
|
|
|
public class ManagementController{
|
2023-03-27 13:58:45 +02:00
|
|
|
|
2023-10-18 17:52:03 +02:00
|
|
|
private final DatasetProfileManager datasetProfileManager;
|
|
|
|
private final AuthorizationService authorizationService;
|
2023-03-27 13:58:45 +02:00
|
|
|
|
|
|
|
@Autowired
|
2024-02-08 10:04:38 +01:00
|
|
|
public ManagementController(DatasetProfileManager datasetProfileManager, AuthorizationService authorizationService){
|
2023-03-27 13:58:45 +02:00
|
|
|
this.datasetProfileManager = datasetProfileManager;
|
2023-10-18 17:52:03 +02:00
|
|
|
this.authorizationService = authorizationService;
|
2023-03-27 13:58:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
2023-05-19 11:34:08 +02:00
|
|
|
@RequestMapping(method = RequestMethod.POST, value = {"/addSemantics"})
|
2024-02-13 08:53:33 +01:00
|
|
|
public boolean addSemanticsInDatasetProfiles() throws Exception {
|
2023-10-18 17:52:03 +02:00
|
|
|
this.authorizationService.authorizeForce(Permission.AdminRole);
|
2023-03-27 13:58:45 +02:00
|
|
|
try {
|
2023-05-19 11:34:08 +02:00
|
|
|
this.datasetProfileManager.addSemanticsInDatasetProfiles();
|
2024-02-13 08:53:33 +01:00
|
|
|
return true;
|
2023-04-20 09:12:55 +02:00
|
|
|
} catch (Exception exception) {
|
2024-02-13 08:53:33 +01:00
|
|
|
return false;
|
2023-04-20 09:12:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
2023-05-19 11:34:08 +02:00
|
|
|
@RequestMapping(method = RequestMethod.POST, value = {"/addRdaInSemantics"})
|
2024-02-13 08:53:33 +01:00
|
|
|
public boolean addRdaInSemanticsInDatasetProfiles() throws Exception {
|
2023-10-18 17:52:03 +02:00
|
|
|
this.authorizationService.authorizeForce(Permission.AdminRole);
|
2023-04-20 09:12:55 +02:00
|
|
|
try {
|
2023-05-19 11:34:08 +02:00
|
|
|
this.datasetProfileManager.addRdaInSemanticsInDatasetProfiles();
|
2024-02-13 08:53:33 +01:00
|
|
|
return true;
|
2023-03-27 13:58:45 +02:00
|
|
|
} catch (Exception exception) {
|
2024-02-13 08:53:33 +01:00
|
|
|
return false;
|
2023-03-27 13:58:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|