argos/dmp-backend/web/src/main/java/eu/eudat/controllers/old/ManagementController.java

51 lines
1.9 KiB
Java
Raw Normal View History

2024-02-13 08:53:33 +01:00
package eu.eudat.controllers.old;
import eu.eudat.authorization.Permission;
import eu.eudat.logic.managers.DatasetProfileManager;
import gr.cite.commons.web.authz.service.AuthorizationService;
2024-02-08 10:04:38 +01:00
import jakarta.transaction.Transactional;
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;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api/management/"})
2024-02-08 10:04:38 +01:00
public class ManagementController{
private final DatasetProfileManager datasetProfileManager;
private final AuthorizationService authorizationService;
@Autowired
2024-02-08 10:04:38 +01:00
public ManagementController(DatasetProfileManager datasetProfileManager, AuthorizationService authorizationService){
this.datasetProfileManager = datasetProfileManager;
this.authorizationService = authorizationService;
}
@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 {
this.authorizationService.authorizeForce(Permission.AdminRole);
try {
2023-05-19 11:34:08 +02:00
this.datasetProfileManager.addSemanticsInDatasetProfiles();
2024-02-13 08:53:33 +01:00
return true;
} catch (Exception exception) {
2024-02-13 08:53:33 +01:00
return false;
}
}
@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 {
this.authorizationService.authorizeForce(Permission.AdminRole);
try {
2023-05-19 11:34:08 +02:00
this.datasetProfileManager.addRdaInSemanticsInDatasetProfiles();
2024-02-13 08:53:33 +01:00
return true;
} catch (Exception exception) {
2024-02-13 08:53:33 +01:00
return false;
}
}
}