Migrating packages to resolve conflicts with the refactored project (part 2)
This commit is contained in:
parent
ee4636e508
commit
ea7fa62922
|
@ -1,7 +1,7 @@
|
|||
package eu.old.eudat.data.dao.criteria;
|
||||
|
||||
import eu.old.eudat.data.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.old.eudat.data.dao.criteria;
|
||||
|
||||
import eu.old.eudat.data.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.types.grant.GrantStateType;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
package eu.old.eudat.elastic.criteria;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 7/5/2018.
|
|
@ -1,6 +1,6 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
package eu.old.eudat.elastic.criteria;
|
||||
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
package eu.old.eudat.elastic.criteria;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
package eu.old.eudat.elastic.criteria;
|
||||
|
||||
public class SortCriteria {
|
||||
public enum OrderByType {
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
package eu.old.eudat.elastic.criteria;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 7/5/2018.
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.slf4j.Logger;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.slf4j.Logger;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.document.DocumentField;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
package eu.old.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package eu.eudat.elastic.repository;
|
||||
package eu.old.eudat.elastic.repository;
|
||||
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.old.eudat.elastic.entities.Dataset;
|
||||
import eu.old.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import org.apache.lucene.search.join.ScoreMode;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
|
@ -28,8 +28,6 @@ import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
|
|||
import org.elasticsearch.search.sort.SortBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.elastic.repository;
|
||||
package eu.old.eudat.elastic.repository;
|
||||
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.old.eudat.elastic.entities.Dmp;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
|
@ -9,7 +9,6 @@ import org.elasticsearch.action.index.IndexRequest;
|
|||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.core.CountRequest;
|
|
@ -1,11 +1,9 @@
|
|||
package eu.eudat.elastic.repository;
|
||||
package eu.old.eudat.elastic.repository;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.elastic.criteria.Criteria;
|
||||
import eu.eudat.elastic.entities.ElasticEntity;
|
||||
import org.elasticsearch.client.Client;
|
||||
import eu.old.eudat.elastic.criteria.Criteria;
|
||||
import eu.old.eudat.elastic.entities.ElasticEntity;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.elastic.repository;
|
||||
package eu.old.eudat.elastic.repository;
|
||||
|
||||
import eu.eudat.elastic.criteria.Criteria;
|
||||
import eu.eudat.elastic.entities.ElasticEntity;
|
||||
import eu.old.eudat.elastic.criteria.Criteria;
|
||||
import eu.old.eudat.elastic.entities.ElasticEntity;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
|
@ -1,8 +1,8 @@
|
|||
package eu.old.eudat.controllers;
|
||||
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.old.eudat.elastic.entities.Dataset;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.old.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
|
|
|
@ -14,6 +14,7 @@ import eu.old.eudat.data.entities.Grant;
|
|||
import eu.old.eudat.data.entities.UserInfo;
|
||||
import eu.old.eudat.data.query.items.table.dataset.DatasetTableRequest;
|
||||
import eu.old.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
||||
import eu.old.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.old.eudat.logic.builders.model.models.RecentActivityDataBuilder;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
import eu.old.eudat.logic.services.operations.DatabaseRepository;
|
||||
|
@ -117,7 +118,7 @@ public class DashBoardManager {
|
|||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||
if (apiContext.getOperationsContext().getElasticRepository().getDatasetRepository() != null) {
|
||||
try {
|
||||
eu.eudat.elastic.criteria.DatasetCriteria datasetElasticCriteria = new eu.eudat.elastic.criteria.DatasetCriteria();
|
||||
eu.old.eudat.elastic.criteria.DatasetCriteria datasetElasticCriteria = new eu.old.eudat.elastic.criteria.DatasetCriteria();
|
||||
datasetElasticCriteria.setAllowAllVersions(false);
|
||||
datasetElasticCriteria.setPublic(false);
|
||||
datasetElasticCriteria.setCollaborators(Collections.singletonList(principal.getId()));
|
||||
|
@ -132,7 +133,7 @@ public class DashBoardManager {
|
|||
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
||||
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
|
||||
try {
|
||||
eu.eudat.elastic.criteria.DmpCriteria dmpElasticCriteria = new eu.eudat.elastic.criteria.DmpCriteria();
|
||||
DmpCriteria dmpElasticCriteria = new DmpCriteria();
|
||||
dmpElasticCriteria.setAllowAllVersions(false);
|
||||
dmpElasticCriteria.setPublic(false);
|
||||
dmpElasticCriteria.setCollaborators(Collections.singletonList(principal.getId()));
|
||||
|
|
|
@ -3,11 +3,11 @@ package eu.old.eudat.logic.managers;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.depositinterface.models.DMPDepositModel;
|
||||
import eu.eudat.depositinterface.repository.RepositoryDeposit;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.entities.Collaborator;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
import eu.eudat.elastic.entities.Organization;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.old.eudat.elastic.entities.Collaborator;
|
||||
import eu.old.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.elastic.entities.Organization;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
|
||||
import eu.old.eudat.configurations.dynamicgrant.entities.Property;
|
||||
import eu.old.eudat.data.dao.criteria.*;
|
||||
|
@ -880,7 +880,7 @@ public class DataManagementPlanManager {
|
|||
for (Dataset dataset: dmp.getDataset()) {
|
||||
try {
|
||||
List<Tag> tags = new ArrayList<>();
|
||||
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
eu.old.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
if (elastic != null) {
|
||||
tags = elastic.getTags();
|
||||
}
|
||||
|
@ -1012,7 +1012,7 @@ public class DataManagementPlanManager {
|
|||
Dataset tempDataset = datasetDao.find(dataset.getId());
|
||||
try {
|
||||
List<Tag> tags = new ArrayList<>();
|
||||
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
eu.old.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
if (elastic != null) {
|
||||
tags = elastic.getTags();
|
||||
}
|
||||
|
@ -1077,7 +1077,7 @@ public class DataManagementPlanManager {
|
|||
}).thenApplyAsync(item -> {
|
||||
futures.add(datasetDao.createOrUpdateAsync(item).whenComplete(((dataset1, throwable) -> {
|
||||
metricsManager.increaseValue(MetricNames.DATASET, 1, MetricNames.DRAFT);
|
||||
eu.eudat.elastic.entities.Dataset datasetElastic = new eu.eudat.elastic.entities.Dataset();
|
||||
eu.old.eudat.elastic.entities.Dataset datasetElastic = new eu.old.eudat.elastic.entities.Dataset();
|
||||
datasetElastic.setId(dataset1.getId().toString());
|
||||
datasetElastic.setLabel(dataset1.getLabel());
|
||||
datasetElastic.setDescription(dataset1.getDescription());
|
||||
|
@ -1113,7 +1113,7 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
|
||||
try {
|
||||
eu.eudat.elastic.entities.Dataset oldDatasetElastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
eu.old.eudat.elastic.entities.Dataset oldDatasetElastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
if (oldDatasetElastic != null) {
|
||||
datasetElastic.setTags(oldDatasetElastic.getTags());
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ public class DataManagementPlanManager {
|
|||
dmp1.getDataset().forEach(dataset -> {
|
||||
try {
|
||||
List<Tag> tags = new ArrayList<>();
|
||||
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
eu.old.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
if (elastic != null) {
|
||||
tags = elastic.getTags();
|
||||
}
|
||||
|
@ -2187,7 +2187,7 @@ public class DataManagementPlanManager {
|
|||
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmp.getId())).toList()));
|
||||
try {
|
||||
List<Tag> tags = new ArrayList<>();
|
||||
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
eu.old.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset);
|
||||
if (elastic != null) {
|
||||
tags = elastic.getTags();
|
||||
|
@ -2269,7 +2269,7 @@ public class DataManagementPlanManager {
|
|||
private void updateDatasetsIndex(List<Dataset> datasets) {
|
||||
datasets.forEach(dataset -> {
|
||||
List<Tag> tags = new ArrayList<>();
|
||||
eu.eudat.elastic.entities.Dataset elastic = null;
|
||||
eu.old.eudat.elastic.entities.Dataset elastic = null;
|
||||
try {
|
||||
elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
if (elastic != null) {
|
||||
|
|
|
@ -16,9 +16,9 @@ import eu.old.eudat.data.enumeration.notification.NotifyState;
|
|||
import eu.old.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
|
||||
import eu.old.eudat.data.query.items.table.dataset.DatasetTableRequest;
|
||||
import eu.old.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.old.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.old.eudat.exceptions.security.ForbiddenException;
|
||||
import eu.old.eudat.exceptions.security.UnauthorisedException;
|
||||
import eu.old.eudat.logic.builders.BuilderFactory;
|
||||
|
@ -159,7 +159,7 @@ public class DatasetManager {
|
|||
}
|
||||
datasetCriteria.setOffset(datasetTableRequest.getOffset());
|
||||
datasetCriteria.setSize(datasetTableRequest.getLength());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
List<eu.old.eudat.elastic.entities.Dataset> datasets;
|
||||
try {
|
||||
datasets = datasetRepository.exists() ?
|
||||
datasetRepository.queryIds(datasetCriteria) : null;
|
||||
|
@ -233,7 +233,7 @@ public class DatasetManager {
|
|||
}
|
||||
datasetCriteria.setOffset(datasetTableRequest.getOffset());
|
||||
datasetCriteria.setSize(datasetTableRequest.getLength());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
List<eu.old.eudat.elastic.entities.Dataset> datasets;
|
||||
try {
|
||||
datasets = datasetRepository.exists() ?
|
||||
datasetRepository.queryIds(datasetCriteria) : new LinkedList<>();
|
||||
|
@ -248,7 +248,7 @@ public class DatasetManager {
|
|||
if (datasets != null) {
|
||||
if (!datasets.isEmpty()) {
|
||||
items = databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class));
|
||||
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
|
||||
List<eu.old.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 = datasetTableRequest.applyCriteria();
|
||||
|
@ -328,10 +328,10 @@ public class DatasetManager {
|
|||
boolean latestVersion = profile.getVersion().toString().equals(datasetEntity.getProfile().getVersion().toString());
|
||||
dataset.setIsProfileLatestVersion(latestVersion);
|
||||
|
||||
eu.eudat.elastic.entities.Dataset datasetElastic;
|
||||
eu.old.eudat.elastic.entities.Dataset datasetElastic;
|
||||
try {
|
||||
datasetElastic = datasetRepository.exists() ?
|
||||
datasetRepository.findDocument(id) : new eu.eudat.elastic.entities.Dataset();
|
||||
datasetRepository.findDocument(id) : new eu.old.eudat.elastic.entities.Dataset();
|
||||
} catch (Exception ex) {
|
||||
logger.warn(ex.getMessage());
|
||||
datasetElastic = null;
|
||||
|
@ -793,12 +793,12 @@ public class DatasetManager {
|
|||
|
||||
public void updateTags(Dataset datasetEntity, List<Tag> tags) throws Exception {
|
||||
// if (datasetWizardModel.getTags() != null && !datasetWizardModel.getTags().isEmpty()) {
|
||||
/*eu.eudat.elastic.entities.Dataset dataset = new eu.eudat.elastic.entities.Dataset();
|
||||
/*eu.old.eudat.entities.elastic.Dataset dataset = new eu.old.eudat.entities.elastic.Dataset();
|
||||
dataset.setId(datasetWizardModel.getId().toString());
|
||||
if (datasetWizardModel.getTags() != null && !datasetWizardModel.getTags().isEmpty()) {
|
||||
DatasetCriteria criteria = new DatasetCriteria();
|
||||
criteria.setTags(datasetWizardModel.getTags());
|
||||
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream)
|
||||
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.old.eudat.entities.elastic.Dataset::getTags).flatMap(Collection::stream)
|
||||
.filter(StreamDistinctBy.distinctByKey(Tag::getId)).filter(tag -> datasetWizardModel.getTags().stream().anyMatch(tag1 -> tag1.getName().equals(tag.getName()))).collect(Collectors.toList());
|
||||
if (tags.isEmpty()) {
|
||||
datasetWizardModel.getTags().forEach(tag -> tag.setId(UUID.randomUUID().toString()));
|
||||
|
@ -847,7 +847,7 @@ public class DatasetManager {
|
|||
dataset.setGrantStatus(datasetWizardModel.getDmp().getGrant().getStatus());
|
||||
dataset.setFormData(this.getWordDocumentText(datasetWizardModel));*/
|
||||
DatasetMapper mapper = new DatasetMapper(apiContext, this);
|
||||
eu.eudat.elastic.entities.Dataset dataset = mapper.toElastic(datasetEntity, tags);
|
||||
eu.old.eudat.elastic.entities.Dataset dataset = mapper.toElastic(datasetEntity, tags);
|
||||
apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().createOrUpdate(dataset);
|
||||
// }
|
||||
}
|
||||
|
@ -1054,10 +1054,10 @@ public class DatasetManager {
|
|||
// Now at latest version.
|
||||
dataset.setIsProfileLatestVersion(true);
|
||||
|
||||
eu.eudat.elastic.entities.Dataset datasetElastic;
|
||||
eu.old.eudat.elastic.entities.Dataset datasetElastic;
|
||||
try {
|
||||
datasetElastic = datasetRepository.exists() ?
|
||||
datasetRepository.findDocument(id) : new eu.eudat.elastic.entities.Dataset();
|
||||
datasetRepository.findDocument(id) : new eu.old.eudat.elastic.entities.Dataset();
|
||||
} catch (Exception ex) {
|
||||
logger.warn(ex.getMessage());
|
||||
datasetElastic = null;
|
||||
|
@ -1104,7 +1104,7 @@ public class DatasetManager {
|
|||
List<Dataset> datasetEntities = new ArrayList<>(this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().toList());
|
||||
datasetEntities.forEach(datasetEntity -> {
|
||||
try {
|
||||
eu.eudat.elastic.entities.Dataset dataset = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(datasetEntity.getId().toString());
|
||||
eu.old.eudat.elastic.entities.Dataset dataset = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(datasetEntity.getId().toString());
|
||||
UUID dmpId = datasetEntity.getDmp().getId();
|
||||
datasetEntity.getDmp().setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||
updateTags(datasetEntity, dataset != null ? dataset.getTags() : null);
|
||||
|
@ -1133,7 +1133,7 @@ public class DatasetManager {
|
|||
JsonNode propertiesJson = mapper.readTree(json);
|
||||
DatasetCriteria criteria = new DatasetCriteria();
|
||||
criteria.setHasTags(true);
|
||||
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.old.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
Set<JsonNode> tagNodes = new HashSet<>();
|
||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "renderStyle", "tags", true));
|
||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "schematics", "rda.dataset.keyword"));
|
||||
|
|
|
@ -59,7 +59,7 @@ public class DatasetWizardManager {
|
|||
|
||||
public void delete(ApiContext apiContext, UUID uuid) throws IOException {
|
||||
Dataset oldDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(uuid);
|
||||
eu.eudat.elastic.entities.Dataset oldDatasetElasitc = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(uuid.toString());
|
||||
eu.old.eudat.elastic.entities.Dataset oldDatasetElasitc = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(uuid.toString());
|
||||
oldDataset.setStatus(Dataset.Status.DELETED.getValue());
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().createOrUpdate(oldDataset);
|
||||
if (oldDatasetElasitc != null && uuid != null && oldDatasetElasitc.getId()!= null) {
|
||||
|
|
|
@ -5,10 +5,10 @@ import eu.old.eudat.data.entities.EmailConfirmation;
|
|||
import eu.old.eudat.data.entities.UserDMP;
|
||||
import eu.old.eudat.data.entities.UserInfo;
|
||||
import eu.old.eudat.data.entities.UserToken;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.entities.Collaborator;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
import eu.eudat.elastic.repository.DmpRepository;
|
||||
import eu.old.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.old.eudat.elastic.entities.Collaborator;
|
||||
import eu.old.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.elastic.repository.DmpRepository;
|
||||
import eu.old.eudat.exceptions.emailconfirmation.HasConfirmedEmailException;
|
||||
import eu.old.eudat.exceptions.emailconfirmation.TokenExpiredException;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.old.eudat.logic.managers;
|
|||
import eu.old.eudat.data.dao.criteria.FunderCriteria;
|
||||
import eu.old.eudat.data.dao.criteria.GrantCriteria;
|
||||
import eu.old.eudat.data.dao.criteria.ProjectCriteria;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.data.entities.*;
|
||||
import eu.old.eudat.logic.mapper.elastic.DmpMapper;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.old.eudat.logic.mapper.elastic;
|
||||
|
||||
import eu.old.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.elastic.entities.Collaborator;
|
||||
import eu.old.eudat.elastic.entities.Collaborator;
|
||||
|
||||
public class CollaboratorMapper {
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package eu.old.eudat.logic.mapper.elastic;
|
|||
|
||||
import eu.old.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||
import eu.old.eudat.data.entities.DMP;
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.old.eudat.elastic.entities.Dataset;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.logic.managers.DatasetManager;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
import eu.old.eudat.logic.utilities.helpers.StreamDistinctBy;
|
||||
|
@ -32,7 +32,7 @@ public class DatasetMapper {
|
|||
DatasetCriteria criteria = new DatasetCriteria();
|
||||
criteria.setTags(tags);
|
||||
criteria.setHasTags(true);
|
||||
List<Tag> tags1 = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream)
|
||||
List<Tag> tags1 = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(Dataset::getTags).flatMap(Collection::stream)
|
||||
.filter(StreamDistinctBy.distinctByKey(Tag::getId)).filter(tag -> tags.stream().anyMatch(tag1 -> tag1.getName().equals(tag.getName()))).collect(Collectors.toList());
|
||||
if (tags1.isEmpty()) {
|
||||
tags.forEach(tag -> tag.setId(UUID.randomUUID().toString()));
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.old.eudat.logic.mapper.elastic;
|
|||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.old.eudat.data.entities.DMPDatasetProfile;
|
||||
import eu.eudat.elastic.entities.DatasetTempalate;
|
||||
import eu.old.eudat.elastic.entities.DatasetTempalate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -2,9 +2,9 @@ package eu.old.eudat.logic.mapper.elastic;
|
|||
|
||||
import eu.old.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||
import eu.old.eudat.data.entities.DMP;
|
||||
import eu.eudat.elastic.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Dataset;
|
||||
import eu.old.eudat.elastic.entities.Dmp;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.logic.managers.DatasetManager;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.old.eudat.logic.mapper.elastic;
|
||||
|
||||
import eu.old.eudat.data.entities.Organisation;
|
||||
import eu.eudat.elastic.entities.Organization;
|
||||
import eu.old.eudat.elastic.entities.Organization;
|
||||
|
||||
public class OrganizationMapper {
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import eu.old.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
|||
import eu.old.eudat.data.entities.Grant;
|
||||
import eu.old.eudat.data.query.definition.helpers.ColumnOrderings;
|
||||
import eu.old.eudat.data.query.definition.helpers.Ordering;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.criteria.SortCriteria;
|
||||
import eu.old.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.old.eudat.elastic.criteria.SortCriteria;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.old.eudat.data.entities.Dataset;
|
||||
import eu.old.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.logic.managers.DatasetManager;
|
||||
import eu.old.eudat.logic.managers.DatasetProfileManager;
|
||||
import eu.old.eudat.logic.managers.LicenseManager;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.old.eudat.logic.services.operations;
|
||||
|
||||
import eu.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.eudat.elastic.repository.DmpRepository;
|
||||
import eu.old.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.old.eudat.elastic.repository.DmpRepository;
|
||||
|
||||
public interface ElasticRepository {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.old.eudat.logic.services.operations;
|
||||
|
||||
import eu.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.eudat.elastic.repository.DmpRepository;
|
||||
import eu.old.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.old.eudat.elastic.repository.DmpRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package eu.old.eudat.models.data.datasetwizard;
|
||||
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.data.entities.*;
|
||||
import eu.old.eudat.models.DataModel;
|
||||
import eu.old.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
||||
|
|
|
@ -3,8 +3,8 @@ package eu.old.eudat.models.rda.mapper;
|
|||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.old.eudat.logic.managers.DatasetManager;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
|
@ -356,7 +356,7 @@ public class DatasetRDAMapper {
|
|||
// }
|
||||
DatasetCriteria criteria = new DatasetCriteria();
|
||||
criteria.setHasTags(true);
|
||||
List<Tag> tags = this.apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
List<Tag> tags = this.apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.old.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
if(!rda.getKeyword().isEmpty()){
|
||||
List<Tag> templateTags = tags.stream().filter(tag -> rda.getKeyword().contains(tag.getName())).collect(Collectors.toList());
|
||||
if(!templateTags.isEmpty()) {
|
||||
|
|
|
@ -115,7 +115,7 @@ public class DmpRDAMapper {
|
|||
rda.getContributor().addAll(dmp.getResearchers().stream().map(ContributorRDAMapper::toRDA).collect(Collectors.toList()));
|
||||
}
|
||||
// rda.getContributor().addAll(dmp.getUsers().stream().map(ContributorRDAMapper::toRDA).collect(Collectors.toList()));
|
||||
rda.setDataset(dmp.getDataset().stream().filter(dataset -> dataset.getStatus() != eu.eudat.elastic.entities.Dmp.DMPStatus.DELETED.getValue()).map(dataset -> datasetRDAMapper.toRDA(dataset, rda)).collect(Collectors.toList()));
|
||||
rda.setDataset(dmp.getDataset().stream().filter(dataset -> dataset.getStatus() != eu.old.eudat.elastic.entities.Dmp.DMPStatus.DELETED.getValue()).map(dataset -> datasetRDAMapper.toRDA(dataset, rda)).collect(Collectors.toList()));
|
||||
if (dmp.getProject() != null) {
|
||||
rda.setProject(Collections.singletonList(ProjectRDAMapper.toRDA(dmp.getProject(), dmp.getGrant())));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package eu.old.eudat.models.rda.mapper;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package eu.old.eudat.publicapi.criteria.dataset;
|
|||
|
||||
import eu.old.eudat.data.dao.criteria.Criteria;
|
||||
import eu.old.eudat.data.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
|
@ -2,8 +2,8 @@ package eu.old.eudat.publicapi.criteria.mapper;
|
|||
|
||||
import eu.old.eudat.data.query.definition.helpers.ColumnOrderings;
|
||||
import eu.old.eudat.data.query.definition.helpers.Ordering;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.criteria.SortCriteria;
|
||||
import eu.old.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.old.eudat.elastic.criteria.SortCriteria;
|
||||
import eu.old.eudat.publicapi.criteria.dmp.DataManagementPlanPublicCriteria;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -3,8 +3,8 @@ package eu.old.eudat.publicapi.managers;
|
|||
import eu.old.eudat.data.entities.Dataset;
|
||||
import eu.old.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.old.eudat.data.query.definition.helpers.ColumnOrderings;
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.old.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.old.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.old.eudat.exceptions.security.ForbiddenException;
|
||||
import eu.old.eudat.logic.managers.PaginationManager;
|
||||
import eu.old.eudat.logic.services.ApiContext;
|
||||
|
@ -69,7 +69,7 @@ public class DatasetPublicManager {
|
|||
}
|
||||
datasetCriteria.setOffset(datasetTableRequest.getOffset());
|
||||
datasetCriteria.setSize(datasetTableRequest.getLength());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
List<eu.old.eudat.elastic.entities.Dataset> datasets;
|
||||
try {
|
||||
datasets = datasetRepository.exists() ?
|
||||
datasetRepository.queryIds(datasetCriteria) : new LinkedList<>();
|
||||
|
@ -89,7 +89,7 @@ public class DatasetPublicManager {
|
|||
if (datasets != null) {
|
||||
if (!datasets.isEmpty()) {
|
||||
items = databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class));
|
||||
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
|
||||
List<eu.old.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 = datasetTableRequest.applyCriteria();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package eu.old.eudat.publicapi.models.overviewmodels;
|
||||
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.elastic.entities.Tag;
|
||||
import eu.old.eudat.data.entities.*;
|
||||
import eu.old.eudat.models.DataModel;
|
||||
import eu.old.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||
|
|
Loading…
Reference in New Issue