no message

This commit is contained in:
annabakouli 2018-01-04 11:32:39 +02:00
parent 3f5a627d18
commit 9407442bcb
24 changed files with 456 additions and 331 deletions

View File

@ -5,6 +5,7 @@ import java.util.UUID;
import eu.eudat.dao.entities.*;
import eu.eudat.managers.DashBoardManager;
import eu.eudat.models.dashboard.DashBoardStatistics;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
@ -27,20 +28,16 @@ import javax.validation.Valid;
public class Admin extends BaseController{
@Autowired
public Admin(ApplicationContext springContext) {
super(springContext);
public Admin(ApiContext apiContext) {
super(apiContext);
}
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp" },consumes = "application/json", produces="application/json")
public ResponseEntity<Object> addDmp(@Valid @RequestBody DatasetProfile profile){
try{
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile);
datasetProfileDao.createOrUpdate(modelDefinition);
this.getApiContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
}catch(Exception ex){
@ -55,9 +52,9 @@ public class Admin extends BaseController{
try{
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile);
eu.eudat.entities.DatasetProfile datasetprofile = datasetProfileDao.find(UUID.fromString(id));
eu.eudat.entities.DatasetProfile datasetprofile = this.getApiContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
datasetprofile.setDefinition(modelDefinition.getDefinition());
datasetProfileDao.createOrUpdate(datasetprofile);
this.getApiContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
return ResponseEntity.status(HttpStatus.OK).body(null);
}catch(Exception ex){
@ -69,7 +66,7 @@ public class Admin extends BaseController{
@RequestMapping(method = RequestMethod.GET, value = { "/admin/get/{id}" }, produces="application/json")
public ResponseEntity<Object> get(@PathVariable String id){
try{
eu.eudat.entities.DatasetProfile profile = datasetProfileDao.find(UUID.fromString(id));
eu.eudat.entities.DatasetProfile profile = this.getApiContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
}catch(Exception ex){

View File

@ -1,5 +1,6 @@
package eu.eudat.controllers;
import eu.eudat.services.ApiContext;
import eu.eudat.validators.DataManagementPlanTableRequestValidator;
import eu.eudat.validators.DatasetProfileValidator;
import eu.eudat.validators.ProjectModelValidator;
@ -14,18 +15,22 @@ import org.springframework.web.bind.annotation.InitBinder;
*/
public abstract class BaseController {
private ApplicationContext springContext;
private ApiContext apiContext;
public BaseController(ApplicationContext springContext){
this.springContext = springContext;
public ApiContext getApiContext() {
return apiContext;
}
public BaseController(ApiContext apiContext){
this.apiContext = apiContext;
}
@InitBinder()
protected void initBinder(WebDataBinder binder) {
if (binder.getTarget() != null && DataManagementPlanTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.springContext.getBean("dataManagementPlanTableRequestValidator",DataManagementPlanTableRequestValidator.class));
if (binder.getTarget() != null && ProjectTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.springContext.getBean("projectTableRequestValidator",ProjectTableRequestValidator.class));
if (binder.getTarget() != null && DatasetProfileValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.springContext.getBean("datasetProfileValidator",DatasetProfileValidator.class));
if (binder.getTarget() != null && ProjectModelValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.springContext.getBean("projectModelValidator",ProjectModelValidator.class));
if (binder.getTarget() != null && DataManagementPlanTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("dataManagementPlanTableRequestValidator",DataManagementPlanTableRequestValidator.class));
if (binder.getTarget() != null && ProjectTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("projectTableRequestValidator",ProjectTableRequestValidator.class));
if (binder.getTarget() != null && DatasetProfileValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("datasetProfileValidator",DatasetProfileValidator.class));
if (binder.getTarget() != null && ProjectModelValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("projectModelValidator",ProjectModelValidator.class));
}
}

View File

@ -14,6 +14,7 @@ import eu.eudat.models.helpers.DataTableData;
import eu.eudat.models.helpers.responses.*;
import eu.eudat.models.listingmodels.DataManagementPlanListingModel;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
import eu.eudat.validators.DataManagementPlanTableRequestValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -41,29 +42,16 @@ import eu.eudat.managers.DataManagementPlanManager;
@RestController
@CrossOrigin
public class DMPs extends BaseController {
@Autowired
public DMPs(ApplicationContext applicationContext){
super(applicationContext);
}
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private UserInfoDao userInfoDao;
@Autowired
public DMPs(ApiContext apiContext){
super(apiContext);
}
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<DataTableData<DataManagementPlanListingModel>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest) {
try {
DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(dMPDao, dataManagementPlanTableRequest);
DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(this.getApiContext().getDatabaseRepository().getDmpDao(), dataManagementPlanTableRequest);
return new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(HttpStatus.OK).payload(dataTable);
} catch (Exception ex) {
@ -75,7 +63,7 @@ public class DMPs extends BaseController {
@RequestMapping(method = RequestMethod.GET, value = { "/dmps/getSingle/{id}" }, produces="application/json")
public @ResponseBody ResponseItem<DataManagementPlan> getSingle(@PathVariable String id) {
try {
eu.eudat.models.dmp.DataManagementPlan project = new DataManagementPlanManager().getSingle(dMPDao, id);
eu.eudat.models.dmp.DataManagementPlan project = new DataManagementPlanManager().getSingle(this.getApiContext().getDatabaseRepository().getDmpDao(), id);
return new ResponseItem<DataManagementPlan>().status(HttpStatus.OK).payload(project);
} catch (Exception ex) {
@ -88,7 +76,7 @@ public class DMPs extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/createOrUpdate" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<DMP> createOrUpdate(@RequestBody eu.eudat.models.dmp.DataManagementPlan dataManagementPlan, Principal principal) {
try{
DataManagementPlanManager.createOrUpdate(dMPDao,projectDao,researcherDao,userInfoDao,organisationDao,dataManagementPlan,principal);
DataManagementPlanManager.createOrUpdate(this.getApiContext(),dataManagementPlan,principal);
return new ResponseItem<DMP>().status(HttpStatus.CREATED);
}catch (Exception ex){
ex.printStackTrace();
@ -102,7 +90,7 @@ public class DMPs extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/get" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<List<DataManagementPlan>> getWithCriteria(@RequestBody DataManagementPlanCriteriaRequest dataManagementPlanCriteria) {
try {
List<DataManagementPlan> dataTable = new DataManagementPlanManager().getWithCriteria(dMPDao, dataManagementPlanCriteria);
List<DataManagementPlan> dataTable = new DataManagementPlanManager().getWithCriteria(this.getApiContext().getDatabaseRepository().getDmpDao(), dataManagementPlanCriteria);
return new ResponseItem<List<DataManagementPlan>>().status(HttpStatus.OK).payload(dataTable);

View File

@ -2,6 +2,7 @@ package eu.eudat.controllers;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
@ -17,16 +18,18 @@ import eu.eudat.models.dashboard.DashBoardStatistics;
@RestController
@CrossOrigin
public class DashBoardController {
@Autowired private DatasetDao datasetDao;
@Autowired private DMPDao dMPDao;
@Autowired private ProjectDao projectDao;
public class DashBoardController extends BaseController{
@Autowired
public DashBoardController(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/dashboard/getStatistics" }, produces="application/json")
public ResponseItem<DashBoardStatistics> getStatistics(Principal principal){
try {
DashBoardStatistics statistics = new DashBoardManager().getStatistics(datasetDao, dMPDao, projectDao);
DashBoardStatistics statistics = new DashBoardManager().getStatistics(this.getApiContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getDatabaseRepository().getDmpDao()
, this.getApiContext().getDatabaseRepository().getProjectDao());
return new ResponseItem<DashBoardStatistics>().status(HttpStatus.OK).payload(statistics);
}
catch(Exception ex) {

View File

@ -7,6 +7,7 @@ import java.util.UUID;
import javax.transaction.Transactional;
import eu.eudat.entities.DataRepository;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -38,29 +39,17 @@ import eu.eudat.proxy.fetching.RemoteFetcher;
@RestController
@CrossOrigin
public class DataRepositories {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private RemoteFetcher remoteFetcher;
public class DataRepositories extends BaseController{
@Autowired
public DataRepositories(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/datarepos" }, produces="application/json")
public @ResponseBody ResponseEntity<List<Map<String,String>>> listExternalDataRepositories(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = remoteFetcher.getRepositories(query);
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRepositories(query);
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
}
catch(NoURLFound ex) {

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.UUID;
import eu.eudat.models.components.commons.datafield.AutoCompleteData;
import eu.eudat.services.ApiContext;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -31,17 +32,17 @@ import eu.eudat.utilities.builders.XmlBuilder;
@RestController
@CrossOrigin
public class DatasetProfileController {
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DatasetDao datasetDao;
public class DatasetProfileController extends BaseController{
@Autowired
public DatasetProfileController(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/datasetwizard/get/{id}" }, produces="application/json")
public ResponseEntity<Object> getSingle(@PathVariable String id){
try {
eu.eudat.entities.Dataset dataset = datasetDao.find(UUID.fromString(id));
eu.eudat.entities.Dataset dataset = this.getApiContext().getDatabaseRepository().getDatasetDao().find(UUID.fromString(id));
eu.eudat.models.user.composite.DatasetProfile datasetprofile = UserManager.generateDatasetProfileModel(dataset.getProfile());
datasetprofile.setStatus(dataset.getStatus());
if(dataset.getProperties()!=null){
@ -61,13 +62,13 @@ public class DatasetProfileController {
@RequestMapping(method = RequestMethod.POST, value = { "/datasetprofile/save/{id}" }, consumes="application/json",produces="application/json")
public ResponseEntity<Object> updateDataset(@PathVariable String id,@RequestBody PropertiesModel properties){
try {
eu.eudat.entities.Dataset dataset = datasetDao.find(UUID.fromString(id));
eu.eudat.entities.Dataset dataset = this.getApiContext().getDatabaseRepository().getDatasetDao().find(UUID.fromString(id));
Map<String,Object> values = new HashMap();
properties.toMap(values);
JSONObject jobject = new JSONObject(values);
dataset.setProperties(jobject.toString());
dataset.setStatus((short)properties.getStatus());
datasetDao.createOrUpdate(dataset); //TODO
this.getApiContext().getDatabaseRepository().getDatasetDao().createOrUpdate(dataset); //TODO
return ResponseEntity.status(HttpStatus.OK).body(properties);
}
@ -79,11 +80,8 @@ public class DatasetProfileController {
@RequestMapping(method = RequestMethod.POST, value = { "/search/autocomplete" }, consumes="application/json",produces="application/json")
public ResponseEntity<Object> getDataForAutocomplete(@RequestBody AutoCompleteLookupItem lookupItem){
try {
eu.eudat.entities.Dataset dataset = datasetDao.find(UUID.fromString(lookupItem.getProfileID()));
//Document viewStyleDoc = XmlBuilder.fromXml(dataset.getProfile().getViewstyle().getDefinition());
//Element field = viewStyleDoc.getElementById(lookupItem.getFieldID());
eu.eudat.entities.Dataset dataset = this.getApiContext().getDatabaseRepository().getDatasetDao().find(UUID.fromString(lookupItem.getProfileID()));
eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field modelfield = new eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field();
//modelfield.fromXml(field);
AutoCompleteData data = new AutoCompleteData().fromData(modelfield.getData());
URL url = new URL(data.getUrl()+lookupItem.getSearchTerm());

View File

@ -16,6 +16,7 @@ import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.models.helpers.DataTableData;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -43,26 +44,17 @@ import eu.eudat.dao.entities.ServiceDao;
@RestController
@CrossOrigin
public class DatasetProfiles {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
public class DatasetProfiles extends BaseController{
@Autowired
public DatasetProfiles(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/datasetprofiles/get" }, produces="application/json")
public @ResponseBody ResponseItem<List<DatasetProfileAutocompleteItem>> get(@RequestBody DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) {
try {
List<DatasetProfileAutocompleteItem> datasetProfileAutocompleteItems = DatasetProfileManager.getWithCriteria(datasetProfileDao,datasetProfileAutocompleteRequest);
List<DatasetProfileAutocompleteItem> datasetProfileAutocompleteItems = DatasetProfileManager.getWithCriteria(this.getApiContext().getDatabaseRepository().getDatasetProfileDao(),datasetProfileAutocompleteRequest);
return new ResponseItem<List<DatasetProfileAutocompleteItem>>().status(HttpStatus.OK).payload(datasetProfileAutocompleteItems);
}
catch(Exception ex) {
@ -73,7 +65,7 @@ public class DatasetProfiles {
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/datasetprofiles/getPaged" }, produces="application/json")
public @ResponseBody ResponseItem<DataTableData<DatasetProfileListingModel>> getPaged(@RequestBody DatasetProfileTableRequestItem datasetProfileTableRequestItem) {
try {
DataTableData<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getPaged(datasetProfileDao,datasetProfileTableRequestItem);
DataTableData<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getPaged(this.getApiContext().getDatabaseRepository().getDatasetProfileDao(),datasetProfileTableRequestItem);
return new ResponseItem<DataTableData<DatasetProfileListingModel>>().status(HttpStatus.OK).payload(datasetProfileTableData );
}
catch(Exception ex) {
@ -84,7 +76,7 @@ public class DatasetProfiles {
@RequestMapping(method = RequestMethod.GET, value = { "/datasetprofiles/getAll" }, produces="application/json")
public @ResponseBody ResponseItem<List<DatasetProfileListingModel>> getAll() {
try {
List<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getAll(datasetProfileDao);
List<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getAll(this.getApiContext().getDatabaseRepository().getDatasetProfileDao());
return new ResponseItem<List<DatasetProfileListingModel>>().status(HttpStatus.OK).payload(datasetProfileTableData );
}
catch(Exception ex) {

View File

@ -15,6 +15,7 @@ import eu.eudat.models.helpers.DataTableData;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.listingmodels.DatasetListingModel;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -31,28 +32,18 @@ import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping( value = { "/datasetwizard" })
public class DatasetWizardController {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private UserInfoDao userInfoDao;
public class DatasetWizardController extends BaseController{
@Autowired
public DatasetWizardController(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.POST, value = { "/userDmps" }, produces="application/json")
public @ResponseBody
ResponseItem<List<DataManagentPlanListingModel>> getUserDmps(@RequestBody DatasetWizardAutocompleteRequest datasetWizardAutocompleteRequest, Principal principal) {
try {
List<DataManagentPlanListingModel> dataManagementPlans = DatasetWizardManager.getUserDmps(dMPDao,datasetWizardAutocompleteRequest,principal);
List<DataManagentPlanListingModel> dataManagementPlans = DatasetWizardManager.getUserDmps(this.getApiContext().getDatabaseRepository().getDmpDao(),datasetWizardAutocompleteRequest,principal);
return new ResponseItem<List<DataManagentPlanListingModel>>().status(HttpStatus.OK).payload(dataManagementPlans);
} catch (Exception ex) {
@ -64,7 +55,7 @@ public class DatasetWizardController {
@RequestMapping(method = RequestMethod.POST, value = { "/getAvailableProfiles" }, produces="application/json")
public @ResponseBody ResponseItem<List<AssociatedProfile>> getAvailableProfiles(@RequestBody DatasetProfileWizardAutocompleteRequest datasetProfileWizardAutocompleteRequest, Principal principal) {
try {
List<AssociatedProfile> dataManagementPlans = DatasetWizardManager.getAvailableProfiles(dMPDao,datasetProfileWizardAutocompleteRequest);
List<AssociatedProfile> dataManagementPlans = DatasetWizardManager.getAvailableProfiles(this.getApiContext().getDatabaseRepository().getDmpDao(),datasetProfileWizardAutocompleteRequest);
return new ResponseItem<List<AssociatedProfile>>().status(HttpStatus.OK).payload(dataManagementPlans);
} catch (Exception ex) {
@ -76,7 +67,7 @@ public class DatasetWizardController {
@RequestMapping(method = RequestMethod.GET, value = { "/getSingle/{id}" }, produces="application/json")
public @ResponseBody ResponseItem<DatasetWizardModel> getPaged(@PathVariable String id) {
try {
DatasetWizardModel dataset = new DatasetManager().getSingle(datasetDao, id);
DatasetWizardModel dataset = new DatasetManager().getSingle(this.getApiContext().getDatabaseRepository().getDatasetDao(), id);
return new ResponseItem<DatasetWizardModel>().status(HttpStatus.OK).payload(dataset);
} catch (Exception ex) {
@ -89,7 +80,7 @@ public class DatasetWizardController {
@RequestMapping(method = RequestMethod.POST, value = { "/createOrUpdate" }, produces="application/json")
public @ResponseBody ResponseItem<eu.eudat.entities.Dataset> createOrUpdate(@RequestBody DatasetWizardModel profile) {
try {
eu.eudat.entities.Dataset dataset= DatasetManager.createOrUpdate(datasetDao, dataRepositoryDao,serviceDao,registryDao,profile);
eu.eudat.entities.Dataset dataset= DatasetManager.createOrUpdate(this.getApiContext(),profile);
return new ResponseItem<eu.eudat.entities.Dataset>().status(HttpStatus.OK).payload(dataset);
} catch (Exception ex) {
ex.printStackTrace();

View File

@ -13,6 +13,7 @@ import eu.eudat.models.dataset.DatasetTableRequest;
import eu.eudat.models.helpers.DataTableData;
import eu.eudat.models.helpers.responses.*;
import eu.eudat.models.listingmodels.DatasetListingModel;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -48,29 +49,17 @@ import javax.transaction.Transactional;
@RestController
@CrossOrigin
public class Datasets {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private UserInfoDao userInfoDao;
public class Datasets extends BaseController{
@Autowired
public Datasets(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.POST, value = { "/datasets/getPaged" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<DataTableData<DatasetListingModel>> getPaged(@RequestBody DatasetTableRequest datasetTableRequest) {
try {
DataTableData<DatasetListingModel> dataTable = new DatasetManager().getPaged(datasetDao, datasetTableRequest);
DataTableData<DatasetListingModel> dataTable = new DatasetManager().getPaged(this.getApiContext().getDatabaseRepository().getDatasetDao(), datasetTableRequest);
return new ResponseItem<DataTableData<DatasetListingModel>>().status(HttpStatus.OK).payload(dataTable);
} catch (Exception ex) {

View File

@ -6,6 +6,7 @@ import java.util.UUID;
import javax.transaction.Transactional;
import eu.eudat.entities.DMPProfile;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -34,28 +35,17 @@ import eu.eudat.entities.responses.IDLabelPair;
@RestController
@CrossOrigin
public class DmpProfiles {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
// MANAGE DMPPROFILE(S)
public class DmpProfiles extends BaseController{
@Autowired
public DmpProfiles(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/dmpprofiles" })
public @ResponseBody ResponseEntity<List<UUID>> listDmpProfiles(){
try {
List<UUID> allIDs = dMPProfileDao.listAllIDs();
List<UUID> allIDs = this.getApiContext().getDatabaseRepository().getDMPProfileDao().listAllIDs();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -69,7 +59,7 @@ public class DmpProfiles {
@RequestMapping(method = RequestMethod.GET, value = { "/dmpprofiles/{id}" })
public @ResponseBody ResponseEntity<DMPProfile> getDmpProfile(@PathVariable("id") String id) {
try {
DMPProfile dmpProfile = dMPProfileDao.read(UUID.fromString(id));
DMPProfile dmpProfile = this.getApiContext().getDatabaseRepository().getDMPProfileDao().read(UUID.fromString(id));
return ResponseEntity.status(HttpStatus.OK).body(dmpProfile);
}
catch(Exception ex) {
@ -82,7 +72,7 @@ public class DmpProfiles {
@RequestMapping(method = RequestMethod.GET, value = { "/dmpprofile/listAllLabelIDs" })
public @ResponseBody ResponseEntity<List<IDLabelPair>> listLabelIds(){
try {
List<IDLabelPair> allIDs = dMPProfileDao.listAllIDsLabels();
List<IDLabelPair> allIDs = this.getApiContext().getDatabaseRepository().getDMPProfileDao().listAllIDsLabels();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -94,7 +84,7 @@ public class DmpProfiles {
@RequestMapping(method = RequestMethod.GET, value = { "/dmpprofile/getAll" }, produces="application/json")
public @ResponseBody ResponseEntity<Object> getAllDmpProfiles(){
try {
List<DMPProfile> allDmpProfiles = dMPProfileDao.getAll();
List<DMPProfile> allDmpProfiles = this.getApiContext().getDatabaseRepository().getDMPProfileDao().getAll();
return ResponseEntity.status(HttpStatus.OK).body(allDmpProfiles);
}
catch(Exception ex) {
@ -107,7 +97,7 @@ public class DmpProfiles {
@RequestMapping(method = RequestMethod.POST, value = { "/dmpprofile/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<DMPProfile> setDmpProfile(@RequestBody DMPProfile dmpprofile) {
try {
DMPProfile createdDMPProfile = dMPProfileDao.update(dmpprofile);
DMPProfile createdDMPProfile = this.getApiContext().getDatabaseRepository().getDMPProfileDao().update(dmpprofile);
return ResponseEntity.status(HttpStatus.CREATED).body(createdDMPProfile);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
@ -121,7 +111,7 @@ public class DmpProfiles {
DMPProfile dmpp = new DMPProfile();
dmpp.setId(dmpprofile.getId());
try {
dMPProfileDao.delete(dmpp);
this.getApiContext().getDatabaseRepository().getDMPProfileDao().delete(dmpp);
return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted DMP Profile!\"}");
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not Delete DMP Profile!\"}");

View File

@ -10,6 +10,7 @@ import eu.eudat.entities.Organisation;
import eu.eudat.models.external.OrganisationsExternalSourcesModel;
import eu.eudat.models.external.ProjectsExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -41,29 +42,17 @@ import eu.eudat.proxy.fetching.RemoteFetcher;
@RestController
@CrossOrigin
public class Organisations {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private RemoteFetcher remoteFetcher;
public class Organisations extends BaseController{
@Autowired
public Organisations(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/organisations" }, produces="application/json")
public @ResponseBody ResponseItem<OrganisationsExternalSourcesModel> listExternalOrganisations(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = remoteFetcher.getOrganisations(query);
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getOrganisations(query);
OrganisationsExternalSourcesModel projectsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos);
return new ResponseItem<OrganisationsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(HttpStatus.OK);
}
@ -83,7 +72,7 @@ public class Organisations {
@RequestMapping(method = RequestMethod.GET, value = { "/organisations" })
public @ResponseBody ResponseEntity<List<UUID>> listOrganisations(){
try {
List<UUID> allIDs = organisationDao.listAllIDs();
List<UUID> allIDs = this.getApiContext().getDatabaseRepository().getOrganisationDao().listAllIDs();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -95,7 +84,7 @@ public class Organisations {
@RequestMapping(method = RequestMethod.GET, value = { "/organisations/{id}" })
public @ResponseBody ResponseEntity<Organisation> getOrganisations(@PathVariable("id") String id) {
try {
Organisation organisation = organisationDao.read(UUID.fromString(id));
Organisation organisation = this.getApiContext().getDatabaseRepository().getOrganisationDao().read(UUID.fromString(id));
return ResponseEntity.status(HttpStatus.OK).body(organisation);
}
catch(Exception ex) {
@ -107,7 +96,7 @@ public class Organisations {
@RequestMapping(method = RequestMethod.GET, value = { "/organisation/getAll" }, produces="application/json")
public @ResponseBody ResponseEntity<Object> getAllOrganisations(){
try {
List<Organisation> allOrganisations = organisationDao.getAll();
List<Organisation> allOrganisations = this.getApiContext().getDatabaseRepository().getOrganisationDao().getAll();
return ResponseEntity.status(HttpStatus.OK).body(allOrganisations);
}
catch(Exception ex) {
@ -120,7 +109,7 @@ public class Organisations {
@RequestMapping(method = RequestMethod.POST, value = { "/organisation/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Organisation> setOrganisation(@RequestBody Organisation organisation) {
try {
Organisation createdOrganisation = organisationDao.update(organisation);
Organisation createdOrganisation = this.getApiContext().getDatabaseRepository().getOrganisationDao().update(organisation);
return ResponseEntity.status(HttpStatus.CREATED).body(createdOrganisation);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
@ -134,7 +123,7 @@ public class Organisations {
Organisation org = new Organisation();
org.setId(organisation.getId());
try {
organisationDao.delete(org);
this.getApiContext().getDatabaseRepository().getOrganisationDao().delete(org);
return ResponseEntity.status(HttpStatus.CREATED).body(null);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);

View File

@ -16,6 +16,7 @@ import eu.eudat.models.external.RegistriesExternalSourcesModel;
import eu.eudat.models.helpers.responses.*;
import eu.eudat.models.project.ProjectCriteriaRequest;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
@ -61,33 +62,14 @@ import eu.eudat.proxy.fetching.RemoteFetcher;
public class Projects extends BaseController{
@Autowired
public Projects(ApplicationContext applicationContext){
super(applicationContext);
public Projects(ApiContext apiContext){
super(apiContext);
}
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private UserInfoDao userInfoDao;
@Autowired private RemoteFetcher remoteFetcher;
@RequestMapping(method = RequestMethod.POST, value = { "/projects/getPaged" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<DataTableData<eu.eudat.models.project.Project>> getPaged(@Valid @RequestBody ProjectTableRequest projectTableRequest) {
try {
DataTableData<eu.eudat.models.project.Project> dataTable = new ProjectManager().getPaged(projectDao, projectTableRequest);
DataTableData<eu.eudat.models.project.Project> dataTable = new ProjectManager().getPaged(this.getApiContext().getDatabaseRepository().getProjectDao(), projectTableRequest);
return new ResponseItem<DataTableData<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
} catch (Exception ex) {
@ -99,7 +81,7 @@ public class Projects extends BaseController{
@RequestMapping(method = RequestMethod.GET, value = { "/projects/getSingle/{id}" }, produces="application/json")
public @ResponseBody ResponseItem<eu.eudat.models.project.Project> getPaged(@PathVariable String id) {
try {
eu.eudat.models.project.Project project = new ProjectManager().getSingle(projectDao, id);
eu.eudat.models.project.Project project = new ProjectManager().getSingle(this.getApiContext().getDatabaseRepository().getProjectDao(), id);
return new ResponseItem<eu.eudat.models.project.Project>().payload(project).status(HttpStatus.OK);
} catch (Exception ex) {
ex.printStackTrace();
@ -112,7 +94,7 @@ public class Projects extends BaseController{
@RequestMapping(method = RequestMethod.POST, value = { "/projects/createOrUpdate" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<eu.eudat.entities.Project> addProject(@Valid @RequestBody eu.eudat.models.project.Project project, Principal principal) {
try {
ProjectManager.createOrUpdate(projectDao,userInfoDao,project,principal);
ProjectManager.createOrUpdate(this.getApiContext().getDatabaseRepository().getProjectDao(),this.getApiContext().getDatabaseRepository().getUserInfoDao(),project,principal);
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.OK);
}catch (Exception ex){
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
@ -124,7 +106,7 @@ public class Projects extends BaseController{
@RequestMapping(method = RequestMethod.DELETE, value = { "/projects/inactivate/{id}" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<eu.eudat.entities.Project> inactivate(@PathVariable String id) {
try {
Project project = new ProjectManager().inactivate(projectDao,id);
Project project = new ProjectManager().inactivate(this.getApiContext().getDatabaseRepository().getProjectDao(),id);
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.OK);
}catch (Exception ex){
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
@ -135,7 +117,7 @@ public class Projects extends BaseController{
@RequestMapping(method = RequestMethod.POST, value = { "/projects/getWithExternal" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<List<eu.eudat.models.project.Project>> getWithExternal(@RequestBody ProjectCriteriaRequest projectCriteria) {
try {
List<eu.eudat.models.project.Project> dataTable = new ProjectManager().getCriteriaWithExternal(projectDao, projectCriteria,remoteFetcher);
List<eu.eudat.models.project.Project> dataTable = new ProjectManager().getCriteriaWithExternal(this.getApiContext().getDatabaseRepository().getProjectDao(), projectCriteria,this.getApiContext().getRemoteFetcher());
return new ResponseItem<List<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
} catch (Exception ex) {
ex.printStackTrace();
@ -146,7 +128,7 @@ public class Projects extends BaseController{
@RequestMapping(method = RequestMethod.POST, value = { "/projects/get" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseItem<List<eu.eudat.models.project.Project>> get(@RequestBody ProjectCriteriaRequest projectCriteria) {
try {
List<eu.eudat.models.project.Project> dataTable = new ProjectManager().getCriteria(projectDao, projectCriteria,remoteFetcher);
List<eu.eudat.models.project.Project> dataTable = new ProjectManager().getCriteria(this.getApiContext().getDatabaseRepository().getProjectDao(), projectCriteria,this.getApiContext().getRemoteFetcher());
return new ResponseItem<List<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
} catch (Exception ex) {
ex.printStackTrace();
@ -160,7 +142,7 @@ public class Projects extends BaseController{
@RequestMapping(method = RequestMethod.GET, value = { "/external/projects" }, produces="application/json")
public @ResponseBody ResponseItem<ProjectsExternalSourcesModel> listExternalProjects(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = remoteFetcher.getProjects(query);
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getProjects(query);
ProjectsExternalSourcesModel projectsExternalSourcesModel = new ProjectsExternalSourcesModel().fromExternalItem(remoteRepos);
return new ResponseItem<ProjectsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(HttpStatus.OK);
}

View File

@ -8,6 +8,7 @@ import eu.eudat.entities.Registry;
import eu.eudat.models.external.RegistriesExternalSourcesModel;
import eu.eudat.models.external.ResearchersExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -42,28 +43,17 @@ import javax.transaction.Transactional;
@RestController
@CrossOrigin
public class Registries {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private RemoteFetcher remoteFetcher;
public class Registries extends BaseController{
@Autowired
public Registries(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/registries" }, produces="application/json")
public @ResponseBody ResponseItem<RegistriesExternalSourcesModel> listExternalRegistries(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = remoteFetcher.getRegistries(query);
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRegistries(query);
RegistriesExternalSourcesModel registriesExternalSourcesModel = new RegistriesExternalSourcesModel().fromExternalItem(remoteRepos);
return new ResponseItem<RegistriesExternalSourcesModel>().payload(registriesExternalSourcesModel).status(HttpStatus.OK);
}
@ -83,7 +73,7 @@ public class Registries {
@RequestMapping(method = RequestMethod.GET, value = { "/registries" })
public @ResponseBody ResponseEntity<List<UUID>> listRegistries(){
try {
List<UUID> allIDs = registryDao.listAllIDs();
List<UUID> allIDs = this.getApiContext().getDatabaseRepository().getRegistryDao().listAllIDs();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -95,7 +85,7 @@ public class Registries {
@RequestMapping(method = RequestMethod.GET, value = { "/registries/{id}" })
public @ResponseBody ResponseEntity<Registry> getRegistries(@PathVariable("id") String id) {
try {
Registry registry = registryDao.read(UUID.fromString(id));
Registry registry = this.getApiContext().getDatabaseRepository().getRegistryDao().read(UUID.fromString(id));
return ResponseEntity.status(HttpStatus.OK).body(registry);
}
catch(Exception ex) {
@ -108,7 +98,7 @@ public class Registries {
@RequestMapping(method = RequestMethod.GET, value = { "/registries/listAllLabelIDs" })
public @ResponseBody ResponseEntity<List<IDLabelPair>> listLabelIds(){
try {
List<IDLabelPair> allIDs = registryDao.listAllIDsLabels();
List<IDLabelPair> allIDs = this.getApiContext().getDatabaseRepository().getRegistryDao().listAllIDsLabels();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -120,7 +110,7 @@ public class Registries {
@RequestMapping(method = RequestMethod.GET, value = { "/registry/getAll" }, produces="application/json")
public @ResponseBody ResponseEntity<Object> getAllRegistries(){
try {
List<Registry> allRegistries = registryDao.getAll();
List<Registry> allRegistries = this.getApiContext().getDatabaseRepository().getRegistryDao().getAll();
return ResponseEntity.status(HttpStatus.OK).body(allRegistries);
@ -134,7 +124,7 @@ public class Registries {
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/registry/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Registry> setRegistry(@RequestBody Registry registry) {
Registry createdRegistry = registryDao.update(registry);
Registry createdRegistry = this.getApiContext().getDatabaseRepository().getRegistryDao().update(registry);
try {
return ResponseEntity.status(HttpStatus.CREATED).body(createdRegistry);
} catch (Exception e) {
@ -149,7 +139,7 @@ public class Registries {
Registry r = new Registry();
r.setId(registry.getId());
try {
registryDao.delete(r);
this.getApiContext().getDatabaseRepository().getRegistryDao().delete(r);
return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted registry!\"}");
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not Delete registry!\"}");

View File

@ -10,6 +10,7 @@ import eu.eudat.entities.Researcher;
import eu.eudat.models.external.ResearchersExternalSourcesModel;
import eu.eudat.models.external.ServiceExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -41,28 +42,17 @@ import eu.eudat.proxy.fetching.RemoteFetcher;
@RestController
@CrossOrigin
public class Researchers {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private RemoteFetcher remoteFetcher;
public class Researchers extends BaseController{
@Autowired
public Researchers(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/researchers" }, produces="application/json")
public @ResponseBody ResponseItem<ResearchersExternalSourcesModel> listExternalResearchers(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = remoteFetcher.getResearchers(query);
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getResearchers(query);
ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos);
return new ResponseItem<ResearchersExternalSourcesModel>().payload(researchersExternalSourcesModel).status(HttpStatus.OK);
}
@ -82,7 +72,7 @@ public class Researchers {
@RequestMapping(method = RequestMethod.GET, value = { "/researchers" })
public @ResponseBody ResponseEntity<List<UUID>> listResearchers(){
try {
List<UUID> allIDs = researcherDao.listAllIDs();
List<UUID> allIDs = this.getApiContext().getDatabaseRepository().getResearcherDao().listAllIDs();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -94,7 +84,7 @@ public class Researchers {
@RequestMapping(method = RequestMethod.GET, value = { "/researchers/{id}" })
public @ResponseBody ResponseEntity<Researcher> getResearchers(@PathVariable("id") String id) {
try {
Researcher researcher = researcherDao.read(UUID.fromString(id));
Researcher researcher = this.getApiContext().getDatabaseRepository().getResearcherDao().read(UUID.fromString(id));
return ResponseEntity.status(HttpStatus.OK).body(researcher);
}
catch(Exception ex) {
@ -105,7 +95,7 @@ public class Researchers {
@RequestMapping(method = RequestMethod.GET, value = { "/researcher/getByEmail" }, produces="application/json")
public @ResponseBody ResponseEntity<Researcher> getResearcherByEmail(@RequestParam("email") String email){
try {
Researcher researcher = researcherDao.getResearcherByEmail(email);
Researcher researcher = this.getApiContext().getDatabaseRepository().getResearcherDao().getResearcherByEmail(email);
return ResponseEntity.status(HttpStatus.OK).body(researcher);
}
catch(Exception ex) {
@ -118,7 +108,7 @@ public class Researchers {
@RequestMapping(method = RequestMethod.GET, value = { "/researcher/getAll" }, produces="application/json")
public @ResponseBody ResponseEntity<List<Researcher>> getAllResearchers(){
try {
List<Researcher> allResearchers = researcherDao.getAll();
List<Researcher> allResearchers = this.getApiContext().getDatabaseRepository().getResearcherDao().getAll();
return ResponseEntity.status(HttpStatus.OK).body(allResearchers);
@ -132,7 +122,7 @@ public class Researchers {
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/researcher/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Researcher> setResearcher(@RequestBody Researcher researcher) {
Researcher createdResearcher = researcherDao.update(researcher);
Researcher createdResearcher = this.getApiContext().getDatabaseRepository().getResearcherDao().update(researcher);
try {
return ResponseEntity.status(HttpStatus.CREATED).body(createdResearcher);
} catch (Exception e) {
@ -147,7 +137,7 @@ public class Researchers {
Researcher res = new Researcher();
res.setId(researcher.getId());
try {
researcherDao.delete(res);
this.getApiContext().getDatabaseRepository().getResearcherDao().delete(res);
return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted researcher!\"}");
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not delete researcher!\"}");

View File

@ -9,6 +9,7 @@ import javax.transaction.Transactional;
import eu.eudat.entities.Service;
import eu.eudat.models.external.ServiceExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -40,28 +41,17 @@ import eu.eudat.proxy.fetching.RemoteFetcher;
@RestController
@CrossOrigin
public class Services {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private RemoteFetcher remoteFetcher;
public class Services extends BaseController{
@Autowired
public Services(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/services" }, produces="application/json")
public @ResponseBody ResponseItem<ServiceExternalSourcesModel> listExternalServices(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = remoteFetcher.getServices(query);
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getServices(query);
ServiceExternalSourcesModel serviceExternalSourcesModel = new ServiceExternalSourcesModel().fromExternalItem(remoteRepos);
return new ResponseItem<ServiceExternalSourcesModel>().payload(serviceExternalSourcesModel).status(HttpStatus.OK);
}
@ -87,7 +77,7 @@ public class Services {
@RequestMapping(method = RequestMethod.GET, value = { "/services" })
public @ResponseBody ResponseEntity<List<UUID>> listServices(){
try {
List<UUID> allIDs = serviceDao.listAllIDs();
List<UUID> allIDs = this.getApiContext().getDatabaseRepository().getServiceDao().listAllIDs();
return ResponseEntity.status(HttpStatus.OK).body(allIDs);
}
catch(Exception ex) {
@ -99,7 +89,7 @@ public class Services {
@RequestMapping(method = RequestMethod.GET, value = { "/services/{id}" })
public @ResponseBody ResponseEntity<Service> getServices(@PathVariable("id") String id) {
try {
Service service = serviceDao.read(UUID.fromString(id));
Service service = this.getApiContext().getDatabaseRepository().getServiceDao().read(UUID.fromString(id));
return ResponseEntity.status(HttpStatus.OK).body(service);
}
catch(Exception ex) {
@ -112,7 +102,7 @@ public class Services {
@RequestMapping(method = RequestMethod.GET, value = { "/service/getAll" }, produces="application/json")
public @ResponseBody ResponseEntity<Object> getAllServices(){
try {
List<Service> allServices = serviceDao.getAll();
List<Service> allServices = this.getApiContext().getDatabaseRepository().getServiceDao().getAll();
return ResponseEntity.status(HttpStatus.OK).body(allServices);
@ -127,7 +117,7 @@ public class Services {
@RequestMapping(method = RequestMethod.POST, value = { "/service/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Service> setService(@RequestBody Service service) {
Service createdService = serviceDao.update(service);
Service createdService = this.getApiContext().getDatabaseRepository().getServiceDao().update(service);
try {
return ResponseEntity.status(HttpStatus.CREATED).body(createdService);
} catch (Exception e) {
@ -142,7 +132,7 @@ public class Services {
System.out.println(service);
try {
serviceDao.delete(service);
this.getApiContext().getDatabaseRepository().getServiceDao().delete(service);
return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted Service entity!\"}");
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not Delete Service entity!\"}");

View File

@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import javax.transaction.Transactional;
import eu.eudat.services.ApiContext;
import org.apache.commons.lang3.SerializationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -55,28 +56,15 @@ import eu.eudat.helpers.Transformers;
@RestController
@CrossOrigin
public class Users {
@Autowired private DataRepositoryDao dataRepositoryDao;
@Autowired private DatasetDao datasetDao;
@Autowired private DatasetProfileDao datasetProfileDao;
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
@Autowired private DMPDao dMPDao;
@Autowired private DMPProfileDao dMPProfileDao;
@Autowired private OrganisationDao organisationDao;
@Autowired private ProjectDao projectDao;
@Autowired private RegistryDao registryDao;
@Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao;
@Autowired private UserInfoDao userInfoDao;
public class Users extends BaseController{
@Autowired
public Users(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/user/whoami" }, produces="application/json;charset=UTF-8")
public @ResponseBody ResponseEntity<UserInfo> whoami(){
String userID = null;
try {
userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
@ -85,7 +73,7 @@ public class Users {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
UserInfo userInfo = userInfoDao.getUserInfo(userID);
UserInfo userInfo = this.getApiContext().getDatabaseRepository().getUserInfoDao().getUserInfo(userID);
if(userInfo==null) //this should normally never happer

View File

@ -18,6 +18,7 @@ import eu.eudat.models.helpers.DataTableData;
import eu.eudat.models.listingmodels.DataManagementPlanListingModel;
import eu.eudat.models.security.Principal;
import eu.eudat.queryable.QueryableList;
import eu.eudat.services.ApiContext;
import eu.eudat.utilities.builders.DomainModelConverter;
public class DataManagementPlanManager {
@ -45,14 +46,14 @@ public class DataManagementPlanManager {
return datamanagementPlans;
}
public static void createOrUpdate(DMPDao dmpsRepository, ProjectDao projectDao,ResearcherDao researcherRepository, UserInfoDao userInfoDao, OrganisationDao organisationRepository, DataManagementPlan dataManagementPlan, Principal principal){
public static void createOrUpdate(ApiContext apiContext, DataManagementPlan dataManagementPlan, Principal principal){
DMP newDmp = dataManagementPlan.toDataModel();
createOrganisationsIfTheyDontExist(newDmp,organisationRepository);
createResearchersIfTheyDontExist(newDmp,researcherRepository);
UserInfo user = userInfoDao.read(principal.getId());
createProjectIfItDoesntExist(newDmp,projectDao,user);
createOrganisationsIfTheyDontExist(newDmp,apiContext.getDatabaseRepository().getOrganisationDao());
createResearchersIfTheyDontExist(newDmp,apiContext.getDatabaseRepository().getResearcherDao());
UserInfo user = apiContext.getDatabaseRepository().getUserInfoDao().read(principal.getId());
createProjectIfItDoesntExist(newDmp,apiContext.getDatabaseRepository().getProjectDao(),user);
newDmp.setCreator(user);
dmpsRepository.createOrUpdate(newDmp);
apiContext.getDatabaseRepository().getDmpDao().createOrUpdate(newDmp);
}

View File

@ -12,6 +12,7 @@ import eu.eudat.models.listingmodels.DatasetListingModel;
import eu.eudat.models.project.Project;
import eu.eudat.models.project.ProjectTableRequest;
import eu.eudat.queryable.QueryableList;
import eu.eudat.services.ApiContext;
import eu.eudat.utilities.builders.DomainModelConverter;
import org.json.JSONObject;
@ -50,12 +51,12 @@ public class DatasetManager {
return dataset;
}
public static eu.eudat.entities.Dataset createOrUpdate(DatasetDao datatasetRepository, DataRepositoryDao dataRepositoryDao, ServiceDao serviceDao, RegistryDao registryDao, DatasetWizardModel profile) throws InstantiationException, IllegalAccessException{
public static eu.eudat.entities.Dataset createOrUpdate(ApiContext apiContext, DatasetWizardModel profile) throws InstantiationException, IllegalAccessException{
eu.eudat.entities.Dataset dataset = profile.toDataModel();
createRegistriesIfTheyDontExist(registryDao,dataset);
createDataRepositoriesIfTheyDontExist(dataRepositoryDao,dataset);
createServicesIfTheyDontExist(serviceDao,dataset);
return datatasetRepository.createOrUpdate(dataset);
createRegistriesIfTheyDontExist(apiContext.getDatabaseRepository().getRegistryDao(),dataset);
createDataRepositoriesIfTheyDontExist(apiContext.getDatabaseRepository().getDataRepositoryDao(),dataset);
createServicesIfTheyDontExist(apiContext.getDatabaseRepository().getServiceDao(),dataset);
return apiContext.getDatabaseRepository().getDatasetDao().createOrUpdate(dataset);
}

View File

@ -1,7 +1,6 @@
package eu.eudat.queryable.hibernatequeryablelist;
import eu.eudat.entities.DataEntity;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.predicates.OrderByPredicate;
@ -30,6 +29,7 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
private Integer offset;
private Set<String> hints;
private String hint;
public QueryableHibernateList(EntityManager manager, Class<T> tClass) {
this.manager = manager;
this.tClass = tClass;
@ -40,10 +40,11 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
return this;
}
public void withHint(String hint){
public void withHint(String hint) {
this.hint = hint;
}
public QueryableList<T> setHints(Set<String> hints){
public QueryableList<T> setHints(Set<String> hints) {
this.hints = hints;
return this;
}
@ -101,7 +102,7 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
return this;
}
public Long count(){
public Long count() {
CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
criteriaQuery.select(criteriaBuilder.count(criteriaQuery.from(this.tClass)));
@ -117,16 +118,16 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
this.query.where(array);
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if(this.offset!=null)typedQuery.setFirstResult(this.offset);
if(this.length!=null)typedQuery.setMaxResults(this.length);
if(this.hint!=null&&this.hints.contains(hint)){
List ids = typedQuery.getResultList().stream().map(item->item.getKeys()[0]).collect(Collectors.toList());
if (this.offset != null) typedQuery.setFirstResult(this.offset);
if (this.length != null) typedQuery.setMaxResults(this.length);
if (this.hint != null && this.hints.contains(hint)) {
List ids = typedQuery.getResultList().stream().map(item -> item.getKeys()[0]).collect(Collectors.toList());
typedQuery = queryWithHint(ids);
}
return typedQuery.getResultList();
}
private TypedQuery<T> queryWithHint(List ids){
private TypedQuery<T> queryWithHint(List ids) {
CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
CriteriaQuery<T> criteriaQuery = criteriaBuilder.createQuery(tClass);
Root<T> criteriaRoot = criteriaQuery.from(this.tClass);

View File

@ -0,0 +1,13 @@
package eu.eudat.services;
import eu.eudat.proxy.fetching.RemoteFetcher;
import org.springframework.context.ApplicationContext;
/**
* Created by ikalyvas on 1/3/2018.
*/
public interface ApiContext {
DatabaseRepository getDatabaseRepository();
ApplicationContext getApplicationContext();
RemoteFetcher getRemoteFetcher();
}

View File

@ -0,0 +1,47 @@
package eu.eudat.services;
import eu.eudat.proxy.fetching.RemoteFetcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
/**
* Created by ikalyvas on 1/3/2018.
*/
@Service("apiContext")
public class ApiContextImpl implements ApiContext{
private DatabaseRepository databaseRepository;
private ApplicationContext applicationContext;
private RemoteFetcher remoteFetcher;
@Autowired
public void setDatabaseRepository(DatabaseRepository databaseRepository) {
this.databaseRepository = databaseRepository;
}
@Override
public DatabaseRepository getDatabaseRepository() {
return databaseRepository;
}
@Override
public ApplicationContext getApplicationContext() {
return applicationContext;
}
@Autowired
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public RemoteFetcher getRemoteFetcher() {
return remoteFetcher;
}
@Autowired
public void setRemoteFetcher(RemoteFetcher remoteFetcher) {
this.remoteFetcher = remoteFetcher;
}
}

View File

@ -0,0 +1,23 @@
package eu.eudat.services;
import eu.eudat.dao.entities.*;
/**
* Created by ikalyvas on 1/4/2018.
*/
public interface DatabaseRepository {
DataRepositoryDao getDataRepositoryDao();
DatasetDao getDatasetDao();
DatasetProfileDao getDatasetProfileDao();
DatasetRegistryDao getDatasetRegistryDao();
DatasetServiceDao getDatasetServiceDao();
DMPDao getDmpDao();
DMPProfileDao getDMPProfileDao();
DMPResearcherDao getDMPResearcherDao();
OrganisationDao getOrganisationDao();
ProjectDao getProjectDao();
RegistryDao getRegistryDao();
ResearcherDao getResearcherDao();
ServiceDao getServiceDao();
UserInfoDao getUserInfoDao();
}

View File

@ -0,0 +1,177 @@
package eu.eudat.services;
import eu.eudat.dao.entities.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by ikalyvas on 1/4/2018.
*/
@Service("databaseRepository")
public class DatabaseRepositoryImpl implements DatabaseRepository{
private DataRepositoryDao dataRepositoryDao;
private DatasetDao datasetDao;
private DatasetProfileDao datasetProfileDao;
private DatasetRegistryDao datasetRegistryDao;
private DatasetServiceDao datasetServiceDao;
private DMPDao dmpDao;
private DMPProfileDao dmpProfileDao;
private DMPResearcherDao dmpResearcherDao;
private OrganisationDao organisationDao;
private ProjectDao projectDao;
private RegistryDao registryDao;
private ResearcherDao researcherDao;
private ServiceDao serviceDao;
private UserInfoDao userInfoDao;
@Autowired
private void setDataRepositoryDao(DataRepositoryDao dataRepositoryDao) {
this.dataRepositoryDao = dataRepositoryDao;
}
@Autowired
private void setDatasetDao(DatasetDao datasetDao) {
this.datasetDao = datasetDao;
}
@Autowired
private void setDatasetProfileDao(DatasetProfileDao datasetProfileDao) {
this.datasetProfileDao = datasetProfileDao;
}
@Autowired
public void setDatasetRegistryDao(DatasetRegistryDao datasetRegistryDao) {
this.datasetRegistryDao = datasetRegistryDao;
}
@Autowired
private void setDatasetServiceDao(DatasetServiceDao datasetServiceDao) {
this.datasetServiceDao = datasetServiceDao;
}
@Autowired
private void setDmpDao(DMPDao dmpDao) {
this.dmpDao = dmpDao;
}
@Autowired
private DMPProfileDao getDmpProfileDao() {
return dmpProfileDao;
}
@Autowired
public void setDmpProfileDao(DMPProfileDao dmpProfileDao) {
this.dmpProfileDao = dmpProfileDao;
}
@Autowired
private DMPResearcherDao getDmpResearcherDao() {
return dmpResearcherDao;
}
@Autowired
private void setDmpResearcherDao(DMPResearcherDao dmpResearcherDao) {
this.dmpResearcherDao = dmpResearcherDao;
}
@Autowired
private void setOrganisationDao(OrganisationDao organisationDao) {
this.organisationDao = organisationDao;
}
@Autowired
private void setProjectDao(ProjectDao projectDao) {
this.projectDao = projectDao;
}
@Autowired
private void setRegistryDao(RegistryDao registryDao) {
this.registryDao = registryDao;
}
@Autowired
private void setResearcherDao(ResearcherDao researcherDao) {
this.researcherDao = researcherDao;
}
@Autowired
public void setServiceDao(ServiceDao serviceDao) {
this.serviceDao = serviceDao;
}
@Autowired
private void setUserInfoDao(UserInfoDao userInfoDao) {
this.userInfoDao = userInfoDao;
}
@Override
public DataRepositoryDao getDataRepositoryDao() {
return dataRepositoryDao;
}
@Override
public DatasetDao getDatasetDao() {
return datasetDao;
}
@Override
public DatasetProfileDao getDatasetProfileDao() {
return datasetProfileDao;
}
@Override
public DatasetRegistryDao getDatasetRegistryDao() {
return datasetRegistryDao;
}
@Override
public DatasetServiceDao getDatasetServiceDao() {
return datasetServiceDao;
}
@Override
public DMPDao getDmpDao() {
return dmpDao;
}
@Override
public DMPProfileDao getDMPProfileDao() {
return dmpProfileDao;
}
@Override
public DMPResearcherDao getDMPResearcherDao() {
return dmpResearcherDao;
}
@Override
public OrganisationDao getOrganisationDao() {
return organisationDao;
}
@Override
public ProjectDao getProjectDao() {
return projectDao;
}
@Override
public RegistryDao getRegistryDao() {
return registryDao;
}
@Override
public ResearcherDao getResearcherDao() {
return researcherDao;
}
@Override
public ServiceDao getServiceDao() {
return serviceDao;
}
@Override
public UserInfoDao getUserInfoDao() {
return userInfoDao;
}
}

View File

@ -1,9 +0,0 @@
package eu.eudat.validators;
import org.springframework.validation.Validator;
/**
* Created by ikalyvas on 1/2/2018.
*/
public abstract class ApiValidator implements Validator {
}