no message
This commit is contained in:
parent
c8caa8d50a
commit
730db6655d
|
@ -45,7 +45,7 @@ public class ExternalDatasets extends BaseController{
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getWithExternal"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/external/datasets"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody ResponseItem<List<ExternalDatasetListingModel>> getWithExternal(@RequestBody ExternalDatasetCriteria externalDatasetCriteria, Principal principal) {
|
||||
try {
|
||||
List<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getWithExternal(this.getApiContext().getDatabaseRepository().getExternalDatasetDao(), externalDatasetCriteria, this.getApiContext().getRemoteFetcher());
|
||||
|
|
|
@ -33,14 +33,11 @@ public class DatasetDaoImpl implements DatasetDao {
|
|||
@Override
|
||||
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
|
||||
QueryableList<Dataset> query = databaseService.getQueryable(Dataset.class, Dataset.getHints());
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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.getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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.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()));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,15 +38,6 @@ public class ExternalDatasetManager {
|
|||
public List<ExternalDatasetListingModel> getWithExternal(ExternalDatasetDao externalDatasetDao , ExternalDatasetCriteria criteria, RemoteFetcher remoteFetcher) throws HugeResultSet, NoURLFound, InstantiationException, IllegalAccessException {
|
||||
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<Map<String, String>> remoteRepos = remoteFetcher.getDatasets(criteria.getLike());
|
||||
ExternalDatasetModel externalSourcesItemModels = new ExternalDatasetModel().fromExternalItem(remoteRepos);
|
||||
for (ExternalSourcesItemModel externalListingItem : externalSourcesItemModels) {
|
||||
ExternalDatasetListingModel externalDatasetListingModel = new ExternalDatasetListingModel();
|
||||
externalDatasetListingModel.setReference(externalListingItem.getRemoteId());
|
||||
externalDatasetListingModel.setLabel(externalListingItem.getName());
|
||||
externalDatasetListingModel.setAbbreviation(externalListingItem.getAbbreviation());
|
||||
externalDatasets.add(externalDatasetListingModel);
|
||||
}
|
||||
return externalDatasets;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package eu.eudat.models.criteria;
|
|||
import eu.eudat.entities.Dataset;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/15/2017.
|
||||
|
@ -11,6 +13,7 @@ public class DatasetCriteria extends Criteria<Dataset>{
|
|||
private Integer status;
|
||||
private Date periodStart;
|
||||
private Date periodEnd;
|
||||
private List<UUID> dmpIds;
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
|
@ -35,4 +38,12 @@ public class DatasetCriteria extends Criteria<Dataset>{
|
|||
public void setPeriodEnd(Date periodEnd) {
|
||||
this.periodEnd = periodEnd;
|
||||
}
|
||||
|
||||
public List<UUID> getDmpIds() {
|
||||
return dmpIds;
|
||||
}
|
||||
|
||||
public void setDmpIds(List<UUID> dmpIds) {
|
||||
this.dmpIds = dmpIds;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue