Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
# Conflicts: # dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.ts
This commit is contained in:
commit
18cbd7468c
|
@ -38,7 +38,6 @@ public class Admin extends BaseController{
|
||||||
try{
|
try{
|
||||||
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile);
|
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile);
|
||||||
this.getApiContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
this.getApiContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
||||||
}catch(Exception ex){
|
}catch(Exception ex){
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import eu.eudat.entities.DataRepository;
|
import eu.eudat.entities.DataRepository;
|
||||||
|
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.services.ApiContext;
|
import eu.eudat.services.ApiContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
@ -47,16 +48,16 @@ public class DataRepositories extends BaseController{
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = { "/external/datarepos" }, produces="application/json")
|
@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 ){
|
public @ResponseBody ResponseItem<List<Map<String,String>>> listExternalDataRepositories(@RequestParam(value="query", required=false) String query ){
|
||||||
try {
|
try {
|
||||||
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRepositories(query);
|
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRepositories(query);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
|
return new ResponseItem<List<Map<String,String>>>().status(HttpStatus.OK).payload(remoteRepos);
|
||||||
}
|
}
|
||||||
catch(NoURLFound ex) {
|
catch(NoURLFound ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
return new ResponseItem<List<Map<String,String>>>().status(HttpStatus.INTERNAL_SERVER_ERROR).payload(null);
|
||||||
}
|
}
|
||||||
catch(HugeResultSet ex) {
|
catch(HugeResultSet ex) {
|
||||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null);
|
return new ResponseItem<List<Map<String,String>>>().status(HttpStatus.UNPROCESSABLE_ENTITY).payload(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class DatasetWizardController extends BaseController{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/createOrUpdate" }, produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/createOrUpdate" }, consumes = "application/json",produces="application/json")
|
||||||
public @ResponseBody ResponseItem<eu.eudat.entities.Dataset> createOrUpdate(@RequestBody DatasetWizardModel profile,Principal principal) {
|
public @ResponseBody ResponseItem<eu.eudat.entities.Dataset> createOrUpdate(@RequestBody DatasetWizardModel profile,Principal principal) {
|
||||||
try {
|
try {
|
||||||
eu.eudat.entities.Dataset dataset= DatasetManager.createOrUpdate(this.getApiContext(),profile);
|
eu.eudat.entities.Dataset dataset= DatasetManager.createOrUpdate(this.getApiContext(),profile);
|
||||||
|
|
|
@ -45,10 +45,10 @@ public class ExternalDatasets extends BaseController{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/external/datasets"}, consumes = "application/json", produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"/external/datasets"}, produces = "application/json")
|
||||||
public @ResponseBody ResponseItem<List<ExternalDatasetListingModel>> getWithExternal(@RequestBody ExternalDatasetCriteria externalDatasetCriteria, Principal principal) {
|
public @ResponseBody ResponseItem<List<ExternalDatasetListingModel>> getWithExternal(@RequestParam(value = "query", required = false) String query, Principal principal) {
|
||||||
try {
|
try {
|
||||||
List<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getWithExternal(this.getApiContext().getDatabaseRepository().getExternalDatasetDao(), externalDatasetCriteria, this.getApiContext().getRemoteFetcher());
|
List<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getWithExternal(this.getApiContext().getDatabaseRepository().getExternalDatasetDao(), query, this.getApiContext().getRemoteFetcher());
|
||||||
return new ResponseItem<List<ExternalDatasetListingModel>>().payload(dataTable).status(HttpStatus.OK);
|
return new ResponseItem<List<ExternalDatasetListingModel>>().payload(dataTable).status(HttpStatus.OK);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -58,11 +58,14 @@ public class Registries extends BaseController{
|
||||||
return new ResponseItem<RegistriesExternalSourcesModel>().payload(registriesExternalSourcesModel).status(HttpStatus.OK);
|
return new ResponseItem<RegistriesExternalSourcesModel>().payload(registriesExternalSourcesModel).status(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
catch(NoURLFound ex) {
|
catch(NoURLFound ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
||||||
}
|
}
|
||||||
catch(HugeResultSet ex) {
|
catch(HugeResultSet ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class DatasetDaoImpl implements DatasetDao {
|
||||||
if (criteria.getStatus() != null)query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
|
if (criteria.getStatus() != null)query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
|
||||||
if (criteria.getPeriodEnd() != null)query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
|
if (criteria.getPeriodEnd() != null)query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
|
||||||
if (criteria.getPeriodStart() != null) query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
if (criteria.getPeriodStart() != null) query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
||||||
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty()) query.where((builder, root) -> root.get("dmp.id").in( criteria.getDmpIds()));
|
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty()) query.where((builder, root) -> root.get("dmp").get("id").in( criteria.getDmpIds()));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package eu.eudat.entities;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/17/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="\"DatasetExternalDataset\"")
|
||||||
|
public class DatasetExternalDataset {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
|
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
|
||||||
|
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||||
|
@Column(name = "\"Dataset\"", nullable = false)
|
||||||
|
private UUID dataset;
|
||||||
|
|
||||||
|
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||||
|
@Column(name = "\"ExternalDataset\"", nullable = false)
|
||||||
|
private UUID externalDataset;
|
||||||
|
|
||||||
|
@Column(name = "\"Role\"")
|
||||||
|
private Integer role;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getDataset() {
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataset(UUID dataset) {
|
||||||
|
this.dataset = dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getExternalDataset() {
|
||||||
|
return externalDataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalDataset(UUID externalDataset) {
|
||||||
|
this.externalDataset = externalDataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(Integer role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,7 +35,9 @@ public class ExternalDatasetManager {
|
||||||
return externalDatasetDataTableData;
|
return externalDatasetDataTableData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ExternalDatasetListingModel> getWithExternal(ExternalDatasetDao externalDatasetDao , ExternalDatasetCriteria criteria, RemoteFetcher remoteFetcher) throws HugeResultSet, NoURLFound, InstantiationException, IllegalAccessException {
|
public List<ExternalDatasetListingModel> getWithExternal(ExternalDatasetDao externalDatasetDao , String query, RemoteFetcher remoteFetcher) throws HugeResultSet, NoURLFound, InstantiationException, IllegalAccessException {
|
||||||
|
ExternalDatasetCriteria criteria = new ExternalDatasetCriteria();
|
||||||
|
criteria.setLike(query);
|
||||||
QueryableList<eu.eudat.entities.ExternalDataset> items = externalDatasetDao.getWithCriteria(criteria);
|
QueryableList<eu.eudat.entities.ExternalDataset> items = externalDatasetDao.getWithCriteria(criteria);
|
||||||
List<ExternalDatasetListingModel> externalDatasets = new DomainModelConverter<eu.eudat.entities.ExternalDataset, ExternalDatasetListingModel>().fromDataModel(items.toList(), ExternalDatasetListingModel.class);
|
List<ExternalDatasetListingModel> externalDatasets = new DomainModelConverter<eu.eudat.entities.ExternalDataset, ExternalDatasetListingModel>().fromDataModel(items.toList(), ExternalDatasetListingModel.class);
|
||||||
return externalDatasets;
|
return externalDatasets;
|
||||||
|
|
|
@ -2,12 +2,15 @@ package eu.eudat.models.datasetwizard;
|
||||||
|
|
||||||
import eu.eudat.entities.DMP;
|
import eu.eudat.entities.DMP;
|
||||||
import eu.eudat.entities.Dataset;
|
import eu.eudat.entities.Dataset;
|
||||||
|
import eu.eudat.entities.ExternalDataset;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.dataset.DataRepository;
|
import eu.eudat.models.dataset.DataRepository;
|
||||||
import eu.eudat.models.dataset.Registry;
|
import eu.eudat.models.dataset.Registry;
|
||||||
import eu.eudat.models.dataset.Service;
|
import eu.eudat.models.dataset.Service;
|
||||||
import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
|
import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
|
||||||
import eu.eudat.models.dmp.DataManagementPlan;
|
import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
|
import eu.eudat.models.externaldataset.ExternalDatasetListingModel;
|
||||||
|
import eu.eudat.models.listingmodels.DatasetListingModel;
|
||||||
import eu.eudat.models.user.composite.DatasetProfile;
|
import eu.eudat.models.user.composite.DatasetProfile;
|
||||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||||
|
|
||||||
|
@ -32,6 +35,7 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
||||||
private List<Registry> registries;
|
private List<Registry> registries;
|
||||||
private List<Service> services;
|
private List<Service> services;
|
||||||
private List<DataRepository> dataRepositories;
|
private List<DataRepository> dataRepositories;
|
||||||
|
private List<ExternalDatasetListingModel> externalDatasets;
|
||||||
private DatasetProfileListingModel profile;
|
private DatasetProfileListingModel profile;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
@ -146,6 +150,14 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ExternalDatasetListingModel> getExternalDatasets() {
|
||||||
|
return externalDatasets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalDatasets(List<ExternalDatasetListingModel> externalDatasets) {
|
||||||
|
this.externalDatasets = externalDatasets;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromDataModel(Dataset entity) throws InstantiationException, IllegalAccessException {
|
public void fromDataModel(Dataset entity) throws InstantiationException, IllegalAccessException {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
|
@ -160,6 +172,7 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
||||||
this.services = new DomainModelConverter<eu.eudat.entities.Service, Service>().fromDataModel(entity.getServices().stream().collect(Collectors.toList()), Service.class);
|
this.services = new DomainModelConverter<eu.eudat.entities.Service, Service>().fromDataModel(entity.getServices().stream().collect(Collectors.toList()), Service.class);
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
this.dmp = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlan>().fromDataModel(Arrays.asList(entity.getDmp()), DataManagementPlan.class).get(0);
|
this.dmp = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlan>().fromDataModel(Arrays.asList(entity.getDmp()), DataManagementPlan.class).get(0);
|
||||||
|
this.externalDatasets = new DomainModelConverter<ExternalDataset, ExternalDatasetListingModel>().fromDataModel(entity.getExternalDatasets().stream().collect(Collectors.toList()), ExternalDatasetListingModel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,26 +189,33 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
||||||
entity.setCreated(this.created != null ? this.created : new Date());
|
entity.setCreated(this.created != null ? this.created : new Date());
|
||||||
entity.setModified(new Date());
|
entity.setModified(new Date());
|
||||||
entity.setProfile(profile.toDataModel()); ///TODO
|
entity.setProfile(profile.toDataModel()); ///TODO
|
||||||
if (!this.registries.isEmpty()) {
|
if (this.registries != null && !this.registries.isEmpty()) {
|
||||||
entity.setRegistries(new HashSet<eu.eudat.entities.Registry>());
|
entity.setRegistries(new HashSet<eu.eudat.entities.Registry>());
|
||||||
for (Registry registry : this.registries) {
|
for (Registry registry : this.registries) {
|
||||||
entity.getRegistries().add(registry.toDataModel());
|
entity.getRegistries().add(registry.toDataModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.dataRepositories.isEmpty()) {
|
if (this.dataRepositories != null && !this.dataRepositories.isEmpty()) {
|
||||||
entity.setDataRepositories(new HashSet<eu.eudat.entities.DataRepository>());
|
entity.setDataRepositories(new HashSet<eu.eudat.entities.DataRepository>());
|
||||||
for (DataRepository dataRepository : this.dataRepositories) {
|
for (DataRepository dataRepository : this.dataRepositories) {
|
||||||
entity.getDataRepositories().add(dataRepository.toDataModel());
|
entity.getDataRepositories().add(dataRepository.toDataModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.services.isEmpty()) {
|
if (this.services != null && !this.services.isEmpty()) {
|
||||||
entity.setServices(new HashSet<eu.eudat.entities.Service>());
|
entity.setServices(new HashSet<eu.eudat.entities.Service>());
|
||||||
for (Service service : this.services) {
|
for (Service service : this.services) {
|
||||||
entity.getServices().add(service.toDataModel());
|
entity.getServices().add(service.toDataModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.externalDatasets != null && !this.externalDatasets.isEmpty()) {
|
||||||
|
entity.setExternalDatasets(new HashSet<eu.eudat.entities.ExternalDataset>());
|
||||||
|
for (ExternalDatasetListingModel externalDataset : this.externalDatasets) {
|
||||||
|
entity.getExternalDatasets().add(externalDataset.toDataModel());
|
||||||
|
}
|
||||||
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,7 @@ import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
@ -32,7 +25,8 @@ import eu.eudat.proxy.config.exceptions.NoURLFound;
|
||||||
public class RemoteFetcher {
|
public class RemoteFetcher {
|
||||||
|
|
||||||
|
|
||||||
@Autowired private ConfigLoader configLoader;
|
@Autowired
|
||||||
|
private ConfigLoader configLoader;
|
||||||
|
|
||||||
// private static int MAX_RESULTS = 30;
|
// private static int MAX_RESULTS = 30;
|
||||||
|
|
||||||
|
@ -87,8 +81,6 @@ public class RemoteFetcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<Map<String, String>> getAll(List<UrlConfig> urlConfigs, FetchStrategy fetchStrategy, String query) throws NoURLFound, HugeResultSet {
|
private List<Map<String, String>> getAll(List<UrlConfig> urlConfigs, FetchStrategy fetchStrategy, String query) throws NoURLFound, HugeResultSet {
|
||||||
|
|
||||||
if (urlConfigs == null || urlConfigs.isEmpty())
|
if (urlConfigs == null || urlConfigs.isEmpty())
|
||||||
|
@ -101,9 +93,6 @@ public class RemoteFetcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<Map<String, String>> getAllResultsFromUrl(String path, FetchStrategy fetchStrategy, final String jsonDataPath, final String jsonPaginationPath, String query) throws HugeResultSet {
|
private List<Map<String, String>> getAllResultsFromUrl(String path, FetchStrategy fetchStrategy, final String jsonDataPath, final String jsonPaginationPath, String query) throws HugeResultSet {
|
||||||
Set<Integer> pages = new HashSet<Integer>();
|
Set<Integer> pages = new HashSet<Integer>();
|
||||||
|
|
||||||
|
@ -114,7 +103,7 @@ public class RemoteFetcher {
|
||||||
|
|
||||||
//if fetch strategy is to get only first page, then return that
|
//if fetch strategy is to get only first page, then return that
|
||||||
if (fetchStrategy == FetchStrategy.FIRST)
|
if (fetchStrategy == FetchStrategy.FIRST)
|
||||||
return results.getResults();
|
return results == null ? new LinkedList<>() : results.getResults();
|
||||||
|
|
||||||
if (results.getPagination() != null && results.getPagination().get("pages") != null) //if has more pages, add them to the pages set
|
if (results.getPagination() != null && results.getPagination().get("pages") != null) //if has more pages, add them to the pages set
|
||||||
for (int i = 2; i <= results.getPagination().get("pages"); i++)
|
for (int i = 2; i <= results.getPagination().get("pages"); i++)
|
||||||
|
@ -156,18 +145,18 @@ public class RemoteFetcher {
|
||||||
Results results = new Results(jsonContext.read(jsonDataPath), jsonContext.read(jsonPaginationPath));
|
Results results = new Results(jsonContext.read(jsonDataPath), jsonContext.read(jsonPaginationPath));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
} catch (MalformedURLException e1) {
|
||||||
|
} //maybe print smth...
|
||||||
|
catch (IOException e2) {
|
||||||
|
} //maybe print smth...
|
||||||
|
finally {
|
||||||
}
|
}
|
||||||
catch(MalformedURLException e1) {} //maybe print smth...
|
|
||||||
catch(IOException e2) {} //maybe print smth...
|
|
||||||
finally {}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Results {
|
class Results {
|
||||||
|
|
||||||
List<Map<String, String>> results;
|
List<Map<String, String>> results;
|
||||||
|
@ -186,19 +175,20 @@ public class RemoteFetcher {
|
||||||
public List<Map<String, String>> getResults() {
|
public List<Map<String, String>> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResults(List<Map<String, String>> results) {
|
public void setResults(List<Map<String, String>> results) {
|
||||||
this.results = results;
|
this.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getPagination() {
|
public Map<String, Integer> getPagination() {
|
||||||
return pagination;
|
return pagination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPagination(Map<String, Integer> pagination) {
|
public void setPagination(Map<String, Integer> pagination) {
|
||||||
this.pagination = pagination;
|
this.pagination = pagination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,11 @@
|
||||||
(inputChange)="filterExternalDatasets($event)" requireMatch>
|
(inputChange)="filterExternalDatasets($event)" requireMatch>
|
||||||
<ng-template td-chip let-chip="chip">
|
<ng-template td-chip let-chip="chip">
|
||||||
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.label.substring(0, 1).toUpperCase()}}</div>
|
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.label.substring(0, 1).toUpperCase()}}</div>
|
||||||
{{chip.name}}
|
{{chip.label}}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-template td-autocomplete-option let-option="option">
|
<ng-template td-autocomplete-option let-option="option">
|
||||||
<div layout="row" layout-align="start center">
|
<div layout="row" layout-align="start center">
|
||||||
{{option.name}}
|
{{option.label}}
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<mat-progress-bar [style.height.px]="2" *ngIf="filteringExternalDatasetsAsync" mode="indeterminate"></mat-progress-bar>
|
<mat-progress-bar [style.height.px]="2" *ngIf="filteringExternalDatasetsAsync" mode="indeterminate"></mat-progress-bar>
|
||||||
|
|
|
@ -17,9 +17,9 @@ import { Observable } from "rxjs/Observable";
|
||||||
import { RequestItem } from "../models/criteria/RequestItem";
|
import { RequestItem } from "../models/criteria/RequestItem";
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
||||||
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
|
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
|
||||||
import { ExternalSourcesItemModel } from '@app/models/external-sources/ExternalSourcesItemModel';
|
import { DatasetProfileModel } from '../models/datasetprofile/DatasetProfileModel';
|
||||||
import { ExternalSourcesService } from '@app/services/external-sources/external-sources.service';
|
import { ExternalSourcesItemModel } from '../models/external-sources/ExternalSourcesItemModel';
|
||||||
import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel';
|
import { ExternalSourcesService } from '../services/external-sources/external-sources.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-wizard-component',
|
selector: 'app-dataset-wizard-component',
|
||||||
|
@ -81,11 +81,6 @@ export class DatasetWizardComponent implements AfterViewInit {
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel);
|
this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel);
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
//this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
|
|
||||||
// this.formGroup.get("dmp").valueChanges.subscribe(change => {
|
|
||||||
// this.formGroup.get('profile').setValue(null, { emitEvent: false });
|
|
||||||
// //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
} else if (dmpId != null) {
|
} else if (dmpId != null) {
|
||||||
this.isNew = true;
|
this.isNew = true;
|
||||||
|
@ -93,24 +88,10 @@ export class DatasetWizardComponent implements AfterViewInit {
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.datasetWizardModel = new DatasetWizardModel();
|
this.datasetWizardModel = new DatasetWizardModel();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
|
||||||
this.datasetWizardModel.dmp = data;
|
this.datasetWizardModel.dmp = data;
|
||||||
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
this.loadDatasetProfiles();
|
this.loadDatasetProfiles();
|
||||||
//this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
|
|
||||||
// this.formGroup.get("dmp").valueChanges.subscribe(change => {
|
|
||||||
// this.formGroup.get('profile').setValue(null, { emitEvent: false });
|
|
||||||
// //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel);
|
|
||||||
// this.formGroup = this.datasetWizardModel.buildForm();
|
|
||||||
//this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
|
|
||||||
// this.formGroup.get("dmp").valueChanges.subscribe(change => {
|
|
||||||
// this.formGroup.get('profile').setValue(null, { emitEvent: false });
|
|
||||||
|
|
||||||
// //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -203,7 +184,7 @@ export class DatasetWizardComponent implements AfterViewInit {
|
||||||
if (value) {
|
if (value) {
|
||||||
this.filtereddataRepositoriesAsync = true;
|
this.filtereddataRepositoriesAsync = true;
|
||||||
|
|
||||||
this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
|
this.externalSourcesService.searchDatasetRepository(value).subscribe(items => {
|
||||||
this.filtereddataRepositories = items;
|
this.filtereddataRepositories = items;
|
||||||
this.filtereddataRepositoriesAsync = false;
|
this.filtereddataRepositoriesAsync = false;
|
||||||
|
|
||||||
|
@ -221,7 +202,7 @@ export class DatasetWizardComponent implements AfterViewInit {
|
||||||
if (value) {
|
if (value) {
|
||||||
this.filteredRegistriesAsync = true;
|
this.filteredRegistriesAsync = true;
|
||||||
|
|
||||||
this.externalSourcesService.searchDMPResearchers(value).subscribe(items => {
|
this.externalSourcesService.searchDatasetRegistry(value).subscribe(items => {
|
||||||
this.filteredRegistries = items;
|
this.filteredRegistries = items;
|
||||||
this.filteredRegistriesAsync = false;
|
this.filteredRegistriesAsync = false;
|
||||||
|
|
||||||
|
|
|
@ -49,4 +49,5 @@ export class ExternalSourcesService {
|
||||||
public searchDMPProfiles(like: string): Observable<ExternalSourcesItemModel[]> {
|
public searchDMPProfiles(like: string): Observable<ExternalSourcesItemModel[]> {
|
||||||
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers });
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue