Merge branch 'ui-refactoring' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-refactoring
This commit is contained in:
commit
8a07e98d9e
|
@ -1,12 +1,16 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.core.logger.Logger;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.logic.managers.AdminManager;
|
||||
import eu.eudat.logic.managers.DatasetProfileManager;
|
||||
import eu.eudat.logic.managers.UserManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.helpers.LoggerService;
|
||||
import eu.eudat.models.data.admin.composite.DatasetProfile;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||
|
@ -24,16 +28,19 @@ import static eu.eudat.types.Authorities.ADMIN;
|
|||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
@RequestMapping(value = {"/api/admin/"})
|
||||
public class Admin extends BaseController {
|
||||
|
||||
DatasetProfileManager datasetProfileManager;
|
||||
|
||||
@Autowired
|
||||
public Admin(ApiContext apiContext, Logger logger) {
|
||||
public Admin(ApiContext apiContext,DatasetProfileManager datasetProfileManager, Logger logger) {
|
||||
super(apiContext);
|
||||
this.datasetProfileManager = datasetProfileManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addDmp"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<Object> addDmp(@Valid @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||
//this.getLoggerService().info(principal, "Admin Added Dataset Profile");
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
|
||||
|
@ -42,7 +49,7 @@ public class Admin extends BaseController {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addDmp/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
|
||||
eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
|
@ -51,7 +58,7 @@ public class Admin extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/admin/get/{id}"}, produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
|
@ -59,7 +66,14 @@ public class Admin extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(datasetprofile));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/admin/preview"}, consumes = "application/json",produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofiles/getPaged"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<DatasetProfileListingModel>>> getPaged(@RequestBody DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws Exception {
|
||||
DataTableData<DatasetProfileListingModel> datasetProfileTableData = this.datasetProfileManager.getPaged(this.getApiContext(), datasetProfileTableRequestItem);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileTableData));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/preview"}, consumes = "application/json",produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
|
||||
eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = UserManager.generateDatasetProfileModel(modelDefinition);
|
||||
|
@ -67,4 +81,13 @@ public class Admin extends BaseController {
|
|||
pagedDatasetProfile.buildPagedDatasetProfile(datasetProfile);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<PagedDatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(pagedDatasetProfile));
|
||||
}
|
||||
|
||||
@org.springframework.transaction.annotation.Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) {
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(this.getApiContext(), id);
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
datasetprofile.setLabel(profile.getLabel() + " new ");
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,38 +27,33 @@ import java.util.List;
|
|||
@RequestMapping(value = {"/api/dmpprofile"})
|
||||
public class DMPProfileController extends BaseController {
|
||||
|
||||
private DataManagementProfileManager dataManagementProfileManager;
|
||||
|
||||
@Autowired
|
||||
public DMPProfileController(ApiContext apiContext) {
|
||||
public DMPProfileController(ApiContext apiContext, DataManagementProfileManager dataManagementProfileManager) {
|
||||
super(apiContext);
|
||||
this.dataManagementProfileManager = dataManagementProfileManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/createOrUpdate"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DMPProfile>> createOrUpdate(@RequestBody DataManagementPlanProfileListingModel dataManagementPlan, Principal principal) throws Exception {
|
||||
DataManagementProfileManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal);
|
||||
this.dataManagementProfileManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMPProfile>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataManagementPlanProfileListingModel>> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel = new DataManagementProfileManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpProfileDao(), id, principal);
|
||||
DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel = this.dataManagementProfileManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpProfileDao(), id, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanProfileListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanProfileListingModel));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/getPaged"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanProfileTableRequest dataManagementPlanProfileTableRequest, Principal principal) throws Exception {
|
||||
DataTableData<DataManagementPlanProfileListingModel> dataTable = new DataManagementProfileManager().getPaged(this.getApiContext(), dataManagementPlanProfileTableRequest, principal);
|
||||
DataTableData<DataManagementPlanProfileListingModel> dataTable = this.dataManagementProfileManager.getPaged(this.getApiContext(), dataManagementPlanProfileTableRequest, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/get"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<DataManagementPlanProfileListingModel>>> getWithCriteria(@RequestBody DataManagementPlanProfileCriteriaRequest dataManagementPlanCriteria, Principal principal) throws InstantiationException, IllegalAccessException {
|
||||
List<DataManagementPlanProfileListingModel> dataTable = new DataManagementProfileManager().getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpProfileDao(), dataManagementPlanCriteria);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DataManagementPlanProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,15 +23,18 @@ import java.util.Map;
|
|||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
@RequestMapping(value = {"/api/external/datarepos"})
|
||||
public class DataRepositories extends BaseController {
|
||||
|
||||
private DataRepositoryManager dataRepositoryManager;
|
||||
|
||||
@Autowired
|
||||
public DataRepositories(ApiContext apiContext) {
|
||||
public DataRepositories(ApiContext apiContext, DataRepositoryManager dataRepositoryManager) {
|
||||
super(apiContext);
|
||||
this.dataRepositoryManager = dataRepositoryManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/datarepos"}, produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<Map<String, String>>>> listExternalDataRepositories(
|
||||
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type
|
||||
|
@ -41,10 +44,10 @@ public class DataRepositories extends BaseController {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datarepos/create"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataRepository>> create(@RequestBody eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel, Principal principal) throws Exception {
|
||||
DataRepository dataRepository = DataRepositoryManager.create(this.getApiContext(), dataRepositoryModel);
|
||||
DataRepository dataRepository = this.dataRepositoryManager.create(this.getApiContext(), dataRepositoryModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataRepository>().payload(dataRepository).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,12 @@ import static eu.eudat.types.Authorities.ANONYMOUS;
|
|||
@RequestMapping(value = {"/api"})
|
||||
public class DatasetProfileController extends BaseController {
|
||||
|
||||
private DatasetProfileManager datasetProfileManager;
|
||||
|
||||
@Autowired
|
||||
public DatasetProfileController(ApiContext apiContext) {
|
||||
public DatasetProfileController(ApiContext apiContext, DatasetProfileManager datasetProfileManager) {
|
||||
super(apiContext);
|
||||
this.datasetProfileManager = datasetProfileManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -57,7 +60,7 @@ public class DatasetProfileController extends BaseController {
|
|||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) {
|
||||
eu.eudat.data.entities.DatasetProfile profile = new DatasetProfileManager().clone(this.getApiContext(), id);
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(this.getApiContext(), id);
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
datasetprofile.setLabel(profile.getLabel() + " new ");
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
|
||||
|
@ -66,9 +69,9 @@ public class DatasetProfileController extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<Object> getDataForAutocomplete(@RequestBody RequestItem<AutoCompleteLookupItem> lookupItem) throws XPathExpressionException {
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID()));
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = DatasetProfileManager.queryForField(datasetProfile.getDefinition(), lookupItem.getCriteria().getFieldID());
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = this.datasetProfileManager.queryForField(datasetProfile.getDefinition(), lookupItem.getCriteria().getFieldID());
|
||||
AutoCompleteData data = (AutoCompleteData) modelfield.getData();
|
||||
List<Tuple<String, String>> items = DatasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike());
|
||||
List<Tuple<String, String>> items = this.datasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(items);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,29 +22,25 @@ import java.util.List;
|
|||
@RequestMapping(value = {"/api"})
|
||||
public class DatasetProfiles extends BaseController {
|
||||
|
||||
private DatasetProfileManager datasetProfileManager;
|
||||
|
||||
@Autowired
|
||||
public DatasetProfiles(ApiContext apiContext) {
|
||||
public DatasetProfiles(ApiContext apiContext, DatasetProfileManager datasetProfileManager) {
|
||||
super(apiContext);
|
||||
this.datasetProfileManager = datasetProfileManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/datasetprofiles/get"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<DatasetProfileAutocompleteItem>>> get(@RequestBody DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws InstantiationException, IllegalAccessException {
|
||||
List<DatasetProfileAutocompleteItem> datasetProfileAutocompleteItems = DatasetProfileManager.getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(), datasetProfileAutocompleteRequest);
|
||||
List<DatasetProfileAutocompleteItem> datasetProfileAutocompleteItems = this.datasetProfileManager.getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(), datasetProfileAutocompleteRequest);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DatasetProfileAutocompleteItem>>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileAutocompleteItems));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/admin/datasetprofiles/getPaged"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<DatasetProfileListingModel>>> getPaged(@RequestBody DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws Exception {
|
||||
DataTableData<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getPaged(this.getApiContext(), datasetProfileTableRequestItem);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileTableData));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/datasetprofiles/getAll"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<DatasetProfileListingModel>>> getAll() throws InstantiationException, IllegalAccessException {
|
||||
List<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getAll(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao());
|
||||
List<DatasetProfileListingModel> datasetProfileTableData = this.datasetProfileManager.getAll(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DatasetProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileTableData));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,42 +25,22 @@ import java.util.UUID;
|
|||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
@RequestMapping(value = {"/api/externaldatasets/"})
|
||||
public class ExternalDatasets extends BaseController {
|
||||
|
||||
private ExternalDatasetManager externalDatasetManager;
|
||||
|
||||
@Autowired
|
||||
public ExternalDatasets(ApiContext apiContext) {
|
||||
public ExternalDatasets(ApiContext apiContext, ExternalDatasetManager externalDatasetManager) {
|
||||
super(apiContext);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getPaged"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<ExternalDatasetListingModel>>> getPaged(@RequestBody ExternalDatasetTableRequest datasetTableRequest, Principal principal) throws Exception {
|
||||
DataTableData<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getPaged(this.getApiContext(), datasetTableRequest);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<ExternalDatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/datasets"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<ExternalDatasetListingModel>>> getWithExternal(
|
||||
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal
|
||||
) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
||||
List<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getWithExternal(this.getApiContext(), query, this.getApiContext().getOperationsContext().getRemoteFetcher());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<ExternalDatasetListingModel>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getSingle/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseItem<ExternalDatasetListingModel> getWithExternal(@PathVariable UUID id, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
||||
ExternalDatasetListingModel externalDatasetModel = new ExternalDatasetManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getExternalDatasetDao(), id);
|
||||
return new ResponseItem<ExternalDatasetListingModel>().payload(externalDatasetModel).status(ApiMessageCode.NO_MESSAGE);
|
||||
this.externalDatasetManager = externalDatasetManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/create"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<ExternalDataset>> create(@RequestBody eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel, Principal principal) throws Exception {
|
||||
ExternalDataset externalDataset = ExternalDatasetManager.create(this.getApiContext(), externalDatasetModel);
|
||||
ExternalDataset externalDataset = this.externalDatasetManager.create(this.getApiContext(), externalDatasetModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ExternalDataset>().payload(externalDataset).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@ import java.util.Map;
|
|||
@RequestMapping(value = {"/api"})
|
||||
public class Organisations extends BaseController {
|
||||
|
||||
private OrganisationsExternalSourcesModel organisationsExternalSourcesModel;
|
||||
@Autowired
|
||||
public Organisations(ApiContext apiContext) {
|
||||
public Organisations(ApiContext apiContext, OrganisationsExternalSourcesModel organisationsExternalSourcesModel) {
|
||||
super(apiContext);
|
||||
this.organisationsExternalSourcesModel = organisationsExternalSourcesModel;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/organisations"}, produces = "application/json")
|
||||
|
@ -31,7 +33,7 @@ public class Organisations extends BaseController {
|
|||
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type
|
||||
) throws HugeResultSet, NoURLFound {
|
||||
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getOrganisations(query, type);
|
||||
OrganisationsExternalSourcesModel projectsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
OrganisationsExternalSourcesModel projectsExternalSourcesModel = this.organisationsExternalSourcesModel.fromExternalItem(remoteRepos);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<OrganisationsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,12 @@ import java.util.Map;
|
|||
@RequestMapping(value = {"/api"})
|
||||
public class Registries extends BaseController {
|
||||
|
||||
private RegistryManager registryManager;
|
||||
|
||||
@Autowired
|
||||
public Registries(ApiContext apiContext) {
|
||||
public Registries(ApiContext apiContext, RegistryManager registryManager) {
|
||||
super(apiContext);
|
||||
this.registryManager = registryManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/registries"}, produces = "application/json")
|
||||
|
@ -39,10 +42,10 @@ public class Registries extends BaseController {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/registries/create"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/registries"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Registry>> create(@RequestBody RegistryModel registryModel, Principal principal) throws Exception {
|
||||
Registry registry = RegistryManager.create(this.getApiContext(), registryModel);
|
||||
Registry registry = this.registryManager.create(this.getApiContext(), registryModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Registry>().payload(registry).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,32 +26,34 @@ import java.util.Map;
|
|||
|
||||
public class Researchers extends BaseController {
|
||||
|
||||
private ResearcherManager researcherManager;
|
||||
@Autowired
|
||||
public Researchers(ApiContext apiContext) {
|
||||
public Researchers(ApiContext apiContext, ResearcherManager researcherManager) {
|
||||
super(apiContext);
|
||||
this.researcherManager = researcherManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/researchers"}, produces = "application/json")
|
||||
/*@RequestMapping(method = RequestMethod.GET, value = {"/external/researchers"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<ResearchersExternalSourcesModel>> listExternalResearchers(
|
||||
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type) throws HugeResultSet, NoURLFound {
|
||||
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getResearchers(query, type);
|
||||
ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ResearchersExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
}*/
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/researchers/getWithExternal"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<eu.eudat.models.data.dmp.Researcher>>> getWithExternal(@RequestBody ResearcherCriteriaRequest researcherCriteriaRequest, Principal principal) throws HugeResultSet, NoURLFound {
|
||||
List<eu.eudat.models.data.dmp.Researcher> dataTable = new ResearcherManager().getCriteriaWithExternal(this.getApiContext(), this.getApiContext().getOperationsContext().getRemoteFetcher(), researcherCriteriaRequest);
|
||||
List<eu.eudat.models.data.dmp.Researcher> dataTable = this.researcherManager.getCriteriaWithExternal(this.getApiContext(), this.getApiContext().getOperationsContext().getRemoteFetcher(), researcherCriteriaRequest);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.models.data.dmp.Researcher>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/researchers/create"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Researcher>> create(@RequestBody eu.eudat.models.data.researcher.Researcher researcher, Principal principal) throws Exception {
|
||||
ResearcherManager.create(this.getApiContext(), researcher);
|
||||
this.researcherManager.create(this.getApiContext(), researcher);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Researcher>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class Services extends BaseController {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/services/create"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/services"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Service>> create(@RequestBody ServiceModel serviceModel, Principal principal) throws Exception {
|
||||
Service service = ServiceManager.create(this.getApiContext(), serviceModel);
|
||||
|
|
|
@ -35,13 +35,13 @@ public class TagController extends BaseController {
|
|||
this.datasetRepository = tagRepository;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
/*@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/tag/create"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Dataset>> create(@RequestBody Dataset dataset) throws IOException {
|
||||
Dataset tagEntity = this.datasetRepository.createOrUpdate(dataset);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Dataset>().payload(dataset).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
}*/
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/tags"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
|
|
|
@ -9,6 +9,7 @@ import eu.eudat.models.data.listingmodels.DataManagementPlanProfileListingModel;
|
|||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -17,6 +18,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
/**
|
||||
* Created by ikalyvas on 3/21/2018.
|
||||
*/
|
||||
@Component
|
||||
public class DataManagementProfileManager {
|
||||
|
||||
public DataTableData<DataManagementPlanProfileListingModel> getPaged(ApiContext apiContext, DataManagementPlanProfileTableRequest dataManagementPlanProfileTableRequest, Principal principal) throws Exception {
|
||||
|
@ -51,7 +53,7 @@ public class DataManagementProfileManager {
|
|||
return datamanagementPlans;
|
||||
}
|
||||
|
||||
public static void createOrUpdate(ApiContext apiContext, DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel, Principal principal) throws Exception {
|
||||
public void createOrUpdate(ApiContext apiContext, DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel, Principal principal) throws Exception {
|
||||
DMPProfile dmpProfile = dataManagementPlanProfileListingModel.toDataModel();
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().createOrUpdate(dmpProfile);
|
||||
}
|
||||
|
|
|
@ -4,12 +4,14 @@ import eu.eudat.data.entities.DataRepository;
|
|||
import eu.eudat.data.entities.Researcher;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
@Component
|
||||
public class DataRepositoryManager {
|
||||
public static DataRepository create(ApiContext apiContext, eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel) throws Exception {
|
||||
public DataRepository create(ApiContext apiContext, eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel) throws Exception {
|
||||
DataRepository dataRepository = dataRepositoryModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().createOrUpdate(dataRepository);
|
||||
}
|
||||
|
|
|
@ -49,14 +49,22 @@ public class DatasetManager {
|
|||
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetTableRequest datasetTableRequest, Principal principal) throws Exception {
|
||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||
datasetCriteria.setTags(datasetTableRequest.getCriteria().getTags());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets = apiContext.getOperationsContext().getDatasetRepository().exists() ?
|
||||
apiContext.getOperationsContext().getDatasetRepository().query(datasetCriteria) : new LinkedList<>();
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
try {
|
||||
datasets = datasetCriteria.getTags() != null && datasetCriteria.getTags().size() > 0 && apiContext.getOperationsContext().getDatasetRepository().exists() ?
|
||||
apiContext.getOperationsContext().getDatasetRepository().query(datasetCriteria) : new LinkedList<>();
|
||||
}
|
||||
catch (Exception ex){
|
||||
datasets = null;
|
||||
}
|
||||
|
||||
UserInfo userInfo = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
|
||||
QueryableList<eu.eudat.data.entities.Dataset> items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(datasetTableRequest.getCriteria()).withHint(HintedModelFactory.getHint(DatasetListingModel.class));
|
||||
if (datasetTableRequest.getCriteria().getTags() != null && !datasetTableRequest.getCriteria().getTags().isEmpty()) {
|
||||
if (!datasets.isEmpty())
|
||||
items.where((builder, root) -> root.get("id").in(datasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())));
|
||||
if (datasets != null && datasetTableRequest.getCriteria().getTags() != null && !datasetTableRequest.getCriteria().getTags().isEmpty()) {
|
||||
if (!datasets.isEmpty()){
|
||||
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
|
||||
items.where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())));
|
||||
}
|
||||
else
|
||||
items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()}));
|
||||
}
|
||||
|
@ -81,14 +89,21 @@ public class DatasetManager {
|
|||
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetPublicTableRequest datasetTableRequest, Principal principal) throws Exception {
|
||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||
datasetCriteria.setTags(datasetTableRequest.getCriteria().getTags());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets = apiContext.getOperationsContext().getDatasetRepository().exists() ?
|
||||
apiContext.getOperationsContext().getDatasetRepository().query(datasetCriteria) : new LinkedList<>();
|
||||
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
try{
|
||||
datasets = datasetCriteria.getTags() != null && datasetCriteria.getTags().size() > 0 && apiContext.getOperationsContext().getDatasetRepository().exists() ?
|
||||
apiContext.getOperationsContext().getDatasetRepository().query(datasetCriteria) : new LinkedList<>();
|
||||
}
|
||||
catch (Exception ex){
|
||||
datasets = null;
|
||||
}
|
||||
datasetTableRequest.setQuery(apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
||||
QueryableList<Dataset> items = datasetTableRequest.applyCriteria();
|
||||
if (datasetTableRequest.getCriteria().getTags() != null && !datasetTableRequest.getCriteria().getTags().isEmpty()) {
|
||||
if (!datasets.isEmpty())
|
||||
items.where((builder, root) -> root.get("id").in(datasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())));
|
||||
if (datasets != null && datasetTableRequest.getCriteria().getTags() != null && !datasetTableRequest.getCriteria().getTags().isEmpty()) {
|
||||
if (!datasets.isEmpty()) {
|
||||
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
|
||||
items.where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())));
|
||||
}
|
||||
else
|
||||
items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()}));
|
||||
}
|
||||
|
@ -111,8 +126,14 @@ public class DatasetManager {
|
|||
public DatasetWizardModel getSingle(DatasetDao datatasetRepository, DatasetRepository elasticDatasetRepository, String id) throws InstantiationException, IllegalAccessException, IOException {
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
eu.eudat.data.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
|
||||
eu.eudat.elastic.entities.Dataset datasetElastic = elasticDatasetRepository.exists() ?
|
||||
elasticDatasetRepository.findDocument(id) : new eu.eudat.elastic.entities.Dataset();
|
||||
eu.eudat.elastic.entities.Dataset datasetElastic;
|
||||
try{
|
||||
datasetElastic = elasticDatasetRepository.exists() ?
|
||||
elasticDatasetRepository.findDocument(id) : new eu.eudat.elastic.entities.Dataset();
|
||||
}
|
||||
catch (Exception ex){
|
||||
datasetElastic = new eu.eudat.elastic.entities.Dataset();
|
||||
}
|
||||
dataset.setDatasetProfileDefinition(getPagedProfile(dataset, datasetEntity));
|
||||
dataset.fromDataModel(datasetEntity);
|
||||
dataset.setTags(datasetElastic.getTags());
|
||||
|
|
|
@ -17,6 +17,7 @@ import eu.eudat.models.data.helpermodels.Tuple;
|
|||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
@ -24,10 +25,10 @@ import org.w3c.dom.Element;
|
|||
import javax.xml.xpath.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Component
|
||||
public class DatasetProfileManager {
|
||||
|
||||
public static List<DatasetProfileAutocompleteItem> getWithCriteria(DatasetProfileDao datasetProfileRepository, DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException {
|
||||
public List<DatasetProfileAutocompleteItem> getWithCriteria(DatasetProfileDao datasetProfileRepository, DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException {
|
||||
QueryableList<DatasetProfile> items = datasetProfileRepository.getWithCriteria(datasetProfileAutocompleteRequest.getCriteria());
|
||||
List<DatasetProfileAutocompleteItem> datasetProfiles = items.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item));
|
||||
return datasetProfiles;
|
||||
|
@ -40,20 +41,20 @@ public class DatasetProfileManager {
|
|||
return profile;
|
||||
}
|
||||
|
||||
public static DataTableData<DatasetProfileListingModel> getPaged(ApiContext apiContext, DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws Exception {
|
||||
public DataTableData<DatasetProfileListingModel> getPaged(ApiContext apiContext, DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws Exception {
|
||||
QueryableList<DatasetProfile> items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria());
|
||||
QueryableList<DatasetProfile> pagedItems = PaginationManager.applyPaging(items, datasetProfileTableRequestItem);
|
||||
List<DatasetProfileListingModel> datasetProfiles = pagedItems.select(item -> new DatasetProfileListingModel().fromDataModel(item));
|
||||
return apiContext.getOperationsContext().getBuilderFactory().getBuilder(DataTableDataBuilder.class).data(datasetProfiles).totalCount(items.count()).build();
|
||||
}
|
||||
|
||||
public static List<DatasetProfileListingModel> getAll(DatasetProfileDao datasetProfileRepository) throws IllegalAccessException, InstantiationException {
|
||||
public List<DatasetProfileListingModel> getAll(DatasetProfileDao datasetProfileRepository) throws IllegalAccessException, InstantiationException {
|
||||
QueryableList<DatasetProfile> items = datasetProfileRepository.getAll();
|
||||
List<DatasetProfileListingModel> datasetProfiles = items.select(item -> new DatasetProfileListingModel().fromDataModel(item));
|
||||
return datasetProfiles;
|
||||
}
|
||||
|
||||
public static eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field queryForField(String xml, String fieldId) throws XPathExpressionException {
|
||||
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field queryForField(String xml, String fieldId) throws XPathExpressionException {
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field field = new Field();
|
||||
Document document = XmlBuilder.fromXml(xml);
|
||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||
|
@ -65,7 +66,7 @@ public class DatasetProfileManager {
|
|||
return field;
|
||||
}
|
||||
|
||||
public static List<Tuple<String, String>> getAutocomplete(AutoCompleteData data, String like) {
|
||||
public List<Tuple<String, String>> getAutocomplete(AutoCompleteData data, String like) {
|
||||
List<Tuple<String, String>> result = new LinkedList<>();
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
|
|
@ -13,11 +13,12 @@ import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
|||
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Component
|
||||
public class ExternalDatasetManager {
|
||||
|
||||
public DataTableData<ExternalDatasetListingModel> getPaged(ApiContext apiContext, ExternalDatasetTableRequest externalDatasetTableRequest) throws Exception {
|
||||
|
@ -41,7 +42,7 @@ public class ExternalDatasetManager {
|
|||
return externalDatasetModel;
|
||||
}
|
||||
|
||||
public static ExternalDataset create(ApiContext apiContext, eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel) throws Exception {
|
||||
public ExternalDataset create(ApiContext apiContext, eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel) throws Exception {
|
||||
ExternalDataset externalDataset = externalDatasetModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().createOrUpdate(externalDataset);
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ import eu.eudat.data.entities.Registry;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
import eu.eudat.models.data.registries.RegistryModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
@Component
|
||||
public class RegistryManager {
|
||||
public static Registry create(ApiContext apiContext, RegistryModel registryModel) throws Exception {
|
||||
public Registry create(ApiContext apiContext, RegistryModel registryModel) throws Exception {
|
||||
Registry registry = registryModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().createOrUpdate(registry);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
|||
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -17,14 +18,15 @@ import java.util.Map;
|
|||
/**
|
||||
* Created by ikalyvas on 2/5/2018.
|
||||
*/
|
||||
@Component
|
||||
public class ResearcherManager {
|
||||
|
||||
public static Researcher create(ApiContext apiContext, eu.eudat.models.data.researcher.Researcher researcher) throws Exception {
|
||||
public Researcher create(ApiContext apiContext, eu.eudat.models.data.researcher.Researcher researcher) throws Exception {
|
||||
Researcher researcherEntity = researcher.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().createOrUpdate(researcherEntity);
|
||||
}
|
||||
|
||||
public static List<eu.eudat.models.data.dmp.Researcher> getCriteriaWithExternal(ApiContext apiContext, RemoteFetcher remoteFetcher, ResearcherCriteriaRequest researcherCriteriaRequest) throws HugeResultSet, NoURLFound {
|
||||
public List<eu.eudat.models.data.dmp.Researcher> getCriteriaWithExternal(ApiContext apiContext, RemoteFetcher remoteFetcher, ResearcherCriteriaRequest researcherCriteriaRequest) throws HugeResultSet, NoURLFound {
|
||||
|
||||
QueryableList<eu.eudat.data.entities.Researcher> items = apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().getWithCriteria(researcherCriteriaRequest.getCriteria());
|
||||
List<eu.eudat.models.data.dmp.Researcher> researchers = items.select(item -> new eu.eudat.models.data.dmp.Researcher().fromDataModel(item));
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package eu.eudat.models.data.external;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
public class OrganisationsExternalSourcesModel extends ExternalListingItem<OrganisationsExternalSourcesModel> {
|
||||
@Override
|
||||
public OrganisationsExternalSourcesModel fromExternalItem(List<Map<String, String>> values) {
|
||||
|
|
|
@ -39,6 +39,6 @@ export class DatasetProfileService {
|
|||
}
|
||||
|
||||
clone(id: string): Observable<DatasetProfile> {
|
||||
return this.http.post<DatasetProfile>(environment.Server + 'datasetprofile/clone/' + id, {});
|
||||
return this.http.post<DatasetProfile>(this.actionUrl + 'datasetprofile/clone/' + id, {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,6 @@ export class DmpProfileService {
|
|||
}
|
||||
|
||||
createDmp(dataManagementPlanModel: DmpProfile): Observable<DmpProfile> {
|
||||
return this.http.post<DmpProfile>(this.actionUrl + 'createOrUpdate', dataManagementPlanModel, { headers: this.headers });
|
||||
}
|
||||
|
||||
getAll(criteria: RequestItem<DmpProfileCriteria>): Observable<DmpProfileListing> {
|
||||
return this.http.post<DmpProfileListing>(this.actionUrl + 'get/', criteria, { headers: this.headers });
|
||||
return this.http.post<DmpProfile>(this.actionUrl, dataManagementPlanModel, { headers: this.headers });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ export class ExternalDataRepositoryService {
|
|||
|
||||
private actionUrl: string;
|
||||
constructor(private http: BaseHttpService) {
|
||||
this.actionUrl = environment.Server + 'datarepos/';
|
||||
this.actionUrl = environment.Server + 'external/datarepos';
|
||||
}
|
||||
|
||||
create(dataRepoModel: DataRepositoryModel): Observable<DataRepositoryModel> {
|
||||
return this.http.post<DataRepositoryModel>(this.actionUrl + 'create', dataRepoModel);
|
||||
return this.http.post<DataRepositoryModel>(this.actionUrl , dataRepoModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,23 +16,7 @@ export class ExternalDatasetService {
|
|||
this.actionUrl = environment.Server + 'externaldatasets/';
|
||||
}
|
||||
|
||||
getPaged(dataTableRequest: DataTableRequest<ExternalDatasetCriteria>): Observable<DataTableData<ExternalDatasetModel>> {
|
||||
return this.http.post<DataTableData<ExternalDatasetModel>>(this.actionUrl + 'getPaged', dataTableRequest);
|
||||
}
|
||||
|
||||
/* get(requestItem: RequestItem<ProjectCriteria>): Observable<ProjectListingModel[]> {
|
||||
return this.http.post<ProjectListingModel[]>(this.actionUrl + 'get', requestItem);
|
||||
}*/
|
||||
|
||||
getWithExternal(requestItem: RequestItem<ExternalDatasetCriteria>): Observable<ExternalDatasetModel[]> {
|
||||
return this.http.post<ExternalDatasetModel[]>(this.actionUrl + 'getWithExternal', requestItem);
|
||||
}
|
||||
|
||||
getSingle(id: string): Observable<ExternalDatasetModel> {
|
||||
return this.http.get<ExternalDatasetModel>(this.actionUrl + 'getSingle/' + id);
|
||||
}
|
||||
|
||||
create(externalDatasetModel: ExternalDatasetModel): Observable<ExternalDatasetModel> {
|
||||
return this.http.post<ExternalDatasetModel>(this.actionUrl + 'create', externalDatasetModel);
|
||||
return this.http.post<ExternalDatasetModel>(this.actionUrl, externalDatasetModel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ export class ExternalSourcesService {
|
|||
return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + 'organisations' + '?query=' + like, { headers: this.headers });
|
||||
}//organizationscriteria.criteria.like
|
||||
|
||||
// TODO: currently not used.
|
||||
public searchDMPProfiles(like: string): Observable<ExternalSourceItemModel[]> {
|
||||
return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + 'datasetprofiles/get' + '?query=' + like, { headers: this.headers });
|
||||
}
|
||||
|
|
|
@ -13,6 +13,6 @@ export class ExternalRegistryService {
|
|||
}
|
||||
|
||||
create(registerModel: RegistryModel): Observable<RegistryModel> {
|
||||
return this.http.post<RegistryModel>(this.actionUrl + 'create', registerModel);
|
||||
return this.http.post<RegistryModel>(this.actionUrl, registerModel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export class ExternalResearcherService {
|
|||
}
|
||||
|
||||
public createResearcher(researcher: ResearcherModel) {
|
||||
return this.http.post(this.actionUrl + 'create', researcher);
|
||||
return this.http.post(this.actionUrl, researcher);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export class ExternalServiceService {
|
|||
}
|
||||
|
||||
create(serviceModel: ServiceModel): Observable<ServiceModel> {
|
||||
return this.http.post<ServiceModel>(this.actionUrl + 'create', serviceModel);
|
||||
return this.http.post<ServiceModel>(this.actionUrl, serviceModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue