Fixes Dataset Description not updating two External References (Registries, Services) when harvesting from external url.
This commit is contained in:
parent
6921d819a5
commit
3164ee4144
|
@ -297,6 +297,11 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
if (this.getServices() == null) this.setServices(new HashSet<>());
|
||||
if(!this.getServices().containsAll(entity.getServices())) {
|
||||
this.getServices().removeAll(this.getServices());
|
||||
this.getServices().addAll(entity.getServices());
|
||||
}
|
||||
this.setDmp(entity.getDmp());
|
||||
this.setStatus(entity.getStatus());
|
||||
this.setProfile(entity.getProfile());
|
||||
|
|
|
@ -334,7 +334,7 @@ public class DatasetManager {
|
|||
checkDatasetValidation(dataset);
|
||||
UserInfo userInfo = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
|
||||
dataset.setCreator(userInfo);
|
||||
updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
|
||||
// updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
|
||||
createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), dataset);
|
||||
createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), dataset);
|
||||
createServicesIfTheyDontExist(dataset);
|
||||
|
@ -390,7 +390,10 @@ public class DatasetManager {
|
|||
criteria.setLike(registry.getReference());
|
||||
List<eu.eudat.data.entities.Registry> entries = registryDao.getWithCriteria(criteria).toList();
|
||||
if (entries != null && !entries.isEmpty()) registry.setId(entries.get(0).getId());
|
||||
else registry = registryDao.createOrUpdate(registry);
|
||||
else {
|
||||
registry.setCreated(new Date());
|
||||
registryDao.createOrUpdate(registry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -431,8 +434,10 @@ public class DatasetManager {
|
|||
datasetService.setDataset(dataset);
|
||||
dataset.getServices().add(datasetService);
|
||||
} else {
|
||||
datasetService.getService().setCreated(new Date());
|
||||
Service service = databaseRepository.getServiceDao().createOrUpdate(datasetService.getService());
|
||||
datasetService.setService(service);
|
||||
datasetService.setDataset(dataset);
|
||||
dataset.getServices().add(datasetService);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,10 @@ public class RemoteFetcher {
|
|||
List<Map<String, String>> list = new LinkedList<>();
|
||||
for (Map<String, String> map : internalResults)
|
||||
{
|
||||
if (map.get("name").toUpperCase().contains(query.toUpperCase())) {
|
||||
if (map.get("name") != null && map.get("name").toUpperCase().contains(query.toUpperCase())) {
|
||||
list.add(map);
|
||||
}
|
||||
if (map.get("label") != null && map.get("label").toUpperCase().contains(query.toUpperCase())) {
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.models.data.dataset;
|
|||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.logic.utilities.helpers.LabelGenerator;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Registry implements DataModel<eu.eudat.data.entities.Registry, Registry>, LabelGenerator {
|
||||
|
@ -16,7 +17,6 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -32,12 +31,10 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateLabel() {
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -45,7 +42,6 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -53,7 +49,6 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -61,7 +56,6 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@ -78,6 +72,13 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
|
|||
|
||||
public eu.eudat.data.entities.Registry toDataModel() {
|
||||
eu.eudat.data.entities.Registry entity = new eu.eudat.data.entities.Registry();
|
||||
entity.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
entity.setLabel(this.label);
|
||||
entity.setAbbreviation(this.abbreviation);
|
||||
entity.setReference("dmpdata/" + this.label);
|
||||
entity.setUri(this.uri);
|
||||
entity.setModified(new Date());
|
||||
entity.setStatus((short)0);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,24 +3,21 @@ package eu.eudat.models.data.dataset;
|
|||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.logic.utilities.helpers.LabelGenerator;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Service implements DataModel<eu.eudat.data.entities.Service, Service>, LabelGenerator {
|
||||
|
||||
private UUID id;
|
||||
private String label;
|
||||
|
||||
private String abbreviation;
|
||||
|
||||
private String reference;
|
||||
|
||||
private String uri;
|
||||
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -28,7 +25,6 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -36,7 +32,6 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -44,7 +39,6 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -52,7 +46,6 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -60,7 +53,6 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
|
|||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@ -77,6 +69,13 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
|
|||
|
||||
public eu.eudat.data.entities.Service toDataModel() {
|
||||
eu.eudat.data.entities.Service entity = new eu.eudat.data.entities.Service();
|
||||
entity.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
entity.setLabel(this.label);
|
||||
entity.setAbbreviation(this.abbreviation);
|
||||
entity.setReference("dmpdata/" + this.label);
|
||||
entity.setUri(this.uri);
|
||||
entity.setModified(new Date());
|
||||
entity.setStatus((short)0);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<path>$['data'][*]['attributes']</path>
|
||||
<fields>
|
||||
<id>'pid'</id>
|
||||
<name>'name'</name>
|
||||
<label>'name'</label>
|
||||
<uri>'uri'</uri>
|
||||
<description>'description'</description>
|
||||
</fields>
|
||||
|
@ -411,7 +411,7 @@
|
|||
<path>$['data'][*]['attributes']</path>
|
||||
<fields>
|
||||
<id>'pid'</id>
|
||||
<name>'name'</name>
|
||||
<label>'name'</label>
|
||||
<uri>'uri'</uri>
|
||||
<description>'description'</description>
|
||||
</fields>
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
[
|
||||
{
|
||||
"pid": "registriesmockup:internal/001",
|
||||
"remote_id": "",
|
||||
"remote_pid": "",
|
||||
"name": "Registries test 1",
|
||||
"uri": "",
|
||||
"abbreviation": "RT1",
|
||||
"label": "Registries test 1",
|
||||
"uri": "mock.registries.com",
|
||||
"last_fetched": "",
|
||||
"description": "",
|
||||
"tag": "internal"
|
||||
},
|
||||
{
|
||||
"pid": "registriesmockup:internal/002",
|
||||
"remote_id": "",
|
||||
"remote_pid": "",
|
||||
"name": "Registries test 2",
|
||||
"uri": "",
|
||||
"abbreviation": "RT2",
|
||||
"label": "Registries test 2",
|
||||
"uri": "mock.registries.com",
|
||||
"last_fetched": "",
|
||||
"description": "",
|
||||
"tag": "internal"
|
||||
},
|
||||
{
|
||||
"pid": "registriesmockup:internal/003",
|
||||
"remote_id": "",
|
||||
"remote_pid": "",
|
||||
"name": "Registries test 3",
|
||||
"uri": "",
|
||||
"abbreviation": "RT3",
|
||||
"label": "Registries test 3",
|
||||
"uri": "mock.registries.com",
|
||||
"last_fetched": "",
|
||||
"description": "",
|
||||
"tag": "internal"
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
[
|
||||
{
|
||||
"pid": "servicesmockup:internal/001",
|
||||
"remote_id": "",
|
||||
"remote_pid": "",
|
||||
"name": "Services test 1",
|
||||
"uri": "",
|
||||
"abbreviation": "ST1",
|
||||
"label": "Services test 1",
|
||||
"uri": "mock.services.com",
|
||||
"last_fetched": "",
|
||||
"description": "",
|
||||
"tag": "internal"
|
||||
},
|
||||
{
|
||||
"pid": "servicesmockup:internal/002",
|
||||
"remote_id": "",
|
||||
"remote_pid": "",
|
||||
"name": "Services test 2",
|
||||
"uri": "",
|
||||
"abbreviation": "ST2",
|
||||
"label": "Services test 2",
|
||||
"uri": "mock.services.com",
|
||||
"last_fetched": "",
|
||||
"description": "",
|
||||
"tag": "internal"
|
||||
},
|
||||
{
|
||||
"pid": "servicesmockup:internal/003",
|
||||
"remote_id": "",
|
||||
"remote_pid": "",
|
||||
"name": "Services test 3",
|
||||
"uri": "",
|
||||
"abbreviation": "ST3",
|
||||
"label": "Services test 3",
|
||||
"uri": "mock.services.com",
|
||||
"last_fetched": "",
|
||||
"description": "",
|
||||
"tag": "internal"
|
||||
|
|
|
@ -3,7 +3,7 @@ export interface RegistryModel {
|
|||
abbreviation: String;
|
||||
definition: String;
|
||||
id: String;
|
||||
name: String;
|
||||
label: String;
|
||||
reference: String;
|
||||
uri: String;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ export interface ServiceModel {
|
|||
abbreviation: String;
|
||||
definition: String;
|
||||
uri: String;
|
||||
name: String;
|
||||
label: String;
|
||||
reference: String;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,15 +178,15 @@ export class ExternalServiceEditorModel {
|
|||
public abbreviation: String;
|
||||
public definition: String;
|
||||
public uri: String;
|
||||
public name: String;
|
||||
public label: String;
|
||||
public reference: String;
|
||||
|
||||
constructor(abbreviation?: String, definition?: String, id?: String, name?: String, reference?: String, uri?: String) {
|
||||
constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String) {
|
||||
this.id = id;
|
||||
this.abbreviation = abbreviation;
|
||||
this.definition = definition;
|
||||
this.uri = uri;
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ export class ExternalServiceEditorModel {
|
|||
this.abbreviation = item.abbreviation;
|
||||
this.definition = item.definition;
|
||||
this.uri = item.uri;
|
||||
this.name = item.name;
|
||||
this.label = item.label;
|
||||
this.reference = item.reference;
|
||||
return this;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ export class ExternalServiceEditorModel {
|
|||
return new FormBuilder().group({
|
||||
id: [this.id],
|
||||
abbreviation: [this.abbreviation],
|
||||
name: [this.name],
|
||||
label: [this.label],
|
||||
reference: [this.reference],
|
||||
uri: [this.uri],
|
||||
definition: [this.definition]
|
||||
|
@ -216,15 +216,15 @@ export class ExternalRegistryEditorModel {
|
|||
public abbreviation: String;
|
||||
public definition: String;
|
||||
public id: String;
|
||||
public name: String;
|
||||
public label: String;
|
||||
public reference: String;
|
||||
public uri: String;
|
||||
|
||||
constructor(abbreviation?: String, definition?: String, id?: String, name?: String, reference?: String, uri?: String) {
|
||||
constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String) {
|
||||
this.abbreviation = abbreviation;
|
||||
this.definition = definition;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.reference = reference;
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ export class ExternalRegistryEditorModel {
|
|||
this.abbreviation = item.abbreviation;
|
||||
this.definition = item.definition;
|
||||
this.id = item.id;
|
||||
this.name = item.name;
|
||||
this.label = item.label;
|
||||
this.reference = item.reference;
|
||||
this.uri = item.uri;
|
||||
|
||||
|
@ -244,7 +244,7 @@ export class ExternalRegistryEditorModel {
|
|||
return new FormBuilder().group({
|
||||
id: [this.id],
|
||||
abbreviation: [this.abbreviation],
|
||||
name: [this.name],
|
||||
label: [this.label],
|
||||
reference: [this.reference],
|
||||
uri: [this.uri],
|
||||
definition: [this.definition]
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
<div class="col-12 row align-items-center">
|
||||
<div class="col">
|
||||
<p>
|
||||
{{i+1}}) {{suggestion.get('name').value}}
|
||||
{{i+1}}) {{suggestion.get('label').value}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
@ -125,7 +125,7 @@
|
|||
<div class="col-12 row align-items-center">
|
||||
<div class="col">
|
||||
<p>
|
||||
{{i+1}}) {{suggestion.get('name').value}}
|
||||
{{i+1}}) {{suggestion.get('label').value}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
|
|
@ -83,16 +83,16 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
this.registriesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalRegistries.bind(this),
|
||||
initialItems: (type) => this.searchDatasetExternalRegistries('', type),
|
||||
displayFn: (item) => item ? item.name : null,
|
||||
titleFn: (item) => item ? item.name : null,
|
||||
displayFn: (item) => item ? item.label : null,
|
||||
titleFn: (item) => item ? item.label: null,
|
||||
subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
|
||||
};
|
||||
|
||||
this.servicesAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasetExternalServices.bind(this),
|
||||
initialItems: (type) => this.searchDatasetExternalServices('', type),
|
||||
displayFn: (item) => item ? item.name : null,
|
||||
titleFn: (item) => item ? item.name : null,
|
||||
displayFn: (item) => item ? item.label : null,
|
||||
titleFn: (item) => item ? item.label : null,
|
||||
subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
|
||||
};
|
||||
|
||||
|
@ -115,12 +115,12 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
}
|
||||
|
||||
registriesOnItemChange(event) {
|
||||
const registryModel = new ExternalRegistryEditorModel(event.abbreviation, event.definition, event.id, event.name, event.reference, event.uri);
|
||||
const registryModel = new ExternalRegistryEditorModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
|
||||
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
|
||||
}
|
||||
|
||||
servicesOnItemChange(event) {
|
||||
const serviceModel = new ExternalServiceEditorModel(event.abbreviation, event.definition, event.id, event.name, event.reference, event.uri);
|
||||
const serviceModel = new ExternalServiceEditorModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
|
||||
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => {
|
||||
if (!result) { return; }
|
||||
const registryModel = new ExternalRegistryEditorModel(result.abbreviation, result.definition, result.id, result.name, result.reference, result.uri);
|
||||
const registryModel = new ExternalRegistryEditorModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
|
||||
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
|
||||
});
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => {
|
||||
if (!result) { return; }
|
||||
const serviceModel = new ExternalServiceEditorModel(result.abbreviation, result.definition, result.id, result.name, result.reference, result.uri);
|
||||
const serviceModel = new ExternalServiceEditorModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
|
||||
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<h1 mat-dialog-title>{{'DATASET-REFERENCED-MODELS.REGISTRY.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content class="row">
|
||||
<mat-form-field class="col-auto">
|
||||
<input matInput formControlName="name" placeholder="{{'DATASET-REFERENCED-MODELS.REGISTRY.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('name').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<input matInput formControlName="label" placeholder="{{'DATASET-REFERENCED-MODELS.REGISTRY.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-auto">
|
||||
<input matInput formControlName="abbreviation" placeholder="{{'DATASET-REFERENCED-MODELS.REGISTRY.ABBREVIATION' | translate}}" required>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<h1 mat-dialog-title>{{'DATASET-REFERENCED-MODELS.SERVICES.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content class="row">
|
||||
<mat-form-field class="col-auto">
|
||||
<input matInput formControlName="name" placeholder="{{'DATASET-REFERENCED-MODELS.SERVICES.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('name').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<input matInput formControlName="label" placeholder="{{'DATASET-REFERENCED-MODELS.SERVICES.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-auto">
|
||||
<input matInput formControlName="abbreviation" placeholder="{{'DATASET-REFERENCED-MODELS.SERVICES.ABBREVIATION' | translate}}" required>
|
||||
|
|
Loading…
Reference in New Issue