Fixes source information and refactors "Reference" property of External References to meet the standards of the Application. (Issue #187)

This commit is contained in:
gkolokythas 2019-11-06 12:05:40 +02:00
parent 0049504304
commit 8567bcea91
22 changed files with 248 additions and 64 deletions

View File

@ -26,7 +26,7 @@ public class DataRepositoryDaoImpl extends DatabaseAccess<DataRepository> implem
if (criteria.getLike() != null)
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%")));
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId()));
return query;

View File

@ -25,7 +25,9 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
public QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria) {
QueryableList<ExternalDataset> query = this.getDatabaseService().getQueryable(ExternalDataset.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
return query;
}

View File

@ -27,7 +27,7 @@ public class RegistryDaoImpl extends DatabaseAccess<Registry> implements Registr
if (criteria.getLike() != null)
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%")));
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId()));
return query;

View File

@ -26,7 +26,7 @@ public class ServiceDaoImpl extends DatabaseAccess<Service> implements ServiceDa
if (criteria.getLike() != null)
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%")));
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId()));
return query;

View File

@ -499,9 +499,9 @@ public class DatasetManager {
if (dataset.getServices() != null && !dataset.getServices().isEmpty()) {
for (DatasetService service : dataset.getServices()) {
ServiceCriteria criteria = new ServiceCriteria();
criteria.setLike(service.getService().getLabel());
criteria.setLike(service.getService().getReference());
List<eu.eudat.data.entities.Service> entries = databaseRepository.getServiceDao().getWithCriteria(criteria).toList();
if (entries != null && entries.isEmpty()) {
if (entries != null && !entries.isEmpty()) {
service.setDataset(dataset);
service.getService().setCreated(new Date());
service.setService(service.getService());

View File

@ -29,6 +29,9 @@ public class RegistryManager {
}
public Registry create(RegistryModel registryModel, Principal principal) throws Exception {
if (registryModel.getLabel() == null || registryModel.getAbbreviation() == null || registryModel.getUri() == null) {
throw new Exception("Missing mandatory entity.");
}
Registry registry = registryModel.toDataModel();
registry.getCreationUser().setId(principal.getId());
return apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().createOrUpdate(registry);

View File

@ -18,9 +18,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by ikalyvas on 9/3/2018.
*/
@Component
public class ServiceManager {

View File

@ -15,11 +15,13 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
private UUID id;
@JsonProperty("name")
private String label;
private String pid;
private String abbreviation;
private String uri;
private Date created;
private Date modified;
private String tag;
private String tag; // Api fetching the data
private String source; // Actual harvested source
public UUID getId() {
return id;
@ -35,6 +37,13 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
this.label = label;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getAbbreviation() {
return abbreviation;
}
@ -70,13 +79,25 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
this.tag = tag;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public DataRepositoryModel fromDataModel(DataRepository entity) {
this.setAbbreviation(entity.getAbbreviation());
this.setLabel(entity.getLabel());
this.setUri(entity.getUri());
this.setId(entity.getId());
this.tag = "Internal";
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@ -88,7 +109,11 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
dataRepository.setCreated(this.created != null ? this.created : new Date());
dataRepository.setModified(new Date());
dataRepository.setLabel(this.label);
dataRepository.setReference("dmpdata/" + dataRepository.getId());
if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) {
dataRepository.setReference(this.id.toString());
} else {
dataRepository.setReference(this.source + ":" + this.id);
}
dataRepository.setUri(this.uri);
dataRepository.setStatus((short) 0);
dataRepository.setCreationUser(new UserInfo());

View File

@ -11,11 +11,12 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
private String uri;
private String info;
private String reference;
private String tag;
private String source;
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
@ -23,7 +24,6 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@ -31,7 +31,6 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
@ -39,7 +38,6 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
@ -47,16 +45,35 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public DataRepository fromDataModel(eu.eudat.data.entities.DataRepository entity) {
this.pid = entity.getReference();
this.label = entity.getLabel();
this.uri = entity.getUri();
this.reference = entity.getReference();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@ -68,7 +85,12 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
entity.setCreated(new Date());
entity.setModified(new Date());
entity.setStatus((short) 0);
entity.setReference("dmpdata/" + this.label);
if (this.source == null) this.source = "dmp";
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source + ":" + this.reference);
}
return entity;
}

View File

@ -13,6 +13,7 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
private String reference;
private String uri;
private String definition;
private String source;
public UUID getId() {
return id;
@ -60,6 +61,13 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
this.definition = definition;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public Registry fromDataModel(eu.eudat.data.entities.Registry entity) {
this.id = entity.getId();
this.label = entity.getLabel();
@ -67,6 +75,12 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
this.reference = entity.getReference();
this.uri = entity.getUri();
this.definition = entity.getDefinition();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@ -75,7 +89,12 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
entity.setId(this.id != null ? this.id : UUID.randomUUID());
entity.setLabel(this.label);
entity.setAbbreviation(this.abbreviation);
entity.setReference("dmpdata/" + this.label);
if (this.source == null) this.source = "dmp";
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source + ":" + this.reference);
}
entity.setUri(this.uri);
entity.setModified(new Date());
entity.setStatus((short)0);

View File

@ -14,6 +14,7 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
private String reference;
private String uri;
private String definition;
private String source;
public UUID getId() {
return id;
@ -57,6 +58,13 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
this.definition = definition;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public Service fromDataModel(eu.eudat.data.entities.Service entity) {
this.id = entity.getId();
this.label = entity.getLabel();
@ -64,6 +72,12 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
this.reference = entity.getReference();
this.uri = entity.getUri();
this.definition = entity.getDefinition();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@ -72,7 +86,13 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
entity.setId(this.id != null ? this.id : UUID.randomUUID());
entity.setLabel(this.label);
entity.setAbbreviation(this.abbreviation);
entity.setReference("dmpdata/" + this.label);
if (this.source == null) this.source = "dmp";
if (this.reference == null) this.reference = entity.getId().toString();
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source + ":" + this.reference);
}
entity.setUri(this.uri);
entity.setModified(new Date());
entity.setStatus((short)0);

View File

@ -202,14 +202,14 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
profile.setId(this.profile);
entity.setProfile(profile);
if (this.registries != null && !this.registries.isEmpty()) {
entity.setRegistries(new HashSet<eu.eudat.data.entities.Registry>());
entity.setRegistries(new HashSet<>());
for (Registry registry : this.registries) {
entity.getRegistries().add(registry.toDataModel());
}
}
if (this.dataRepositories != null && !this.dataRepositories.isEmpty()) {
entity.setDatasetDataRepositories(new HashSet<DatasetDataRepository>());
entity.setDatasetDataRepositories(new HashSet<>());
for (DataRepository dataRepositoryModel : this.dataRepositories) {
eu.eudat.data.entities.DataRepository dataRepository = dataRepositoryModel.toDataModel();
DatasetDataRepository datasetDataRepository = new DatasetDataRepository();
@ -224,7 +224,7 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
}
if (this.services != null && !this.services.isEmpty()) {
entity.setServices(new HashSet<DatasetService>());
entity.setServices(new HashSet<>());
for (Service serviceModel : this.services) {
eu.eudat.data.entities.Service service = serviceModel.toDataModel();
DatasetService datasetService = new DatasetService();
@ -234,7 +234,7 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
}
if (this.externalDatasets != null && !this.externalDatasets.isEmpty()) {
entity.setDatasetExternalDatasets(new HashSet<DatasetExternalDataset>());
entity.setDatasetExternalDatasets(new HashSet<>());
for (ExternalDatasetListingModel externalDataset : this.externalDatasets) {
ExternalDataset externalDatasetEntity = externalDataset.toDataModel();
DatasetExternalDataset datasetExternalDataset = new DatasetExternalDataset();

View File

@ -53,7 +53,7 @@ public class Organisation implements DataModel<eu.eudat.data.entities.Organisati
this.name = entity.getLabel();
this.label = entity.getUri();
if (entity.getReference().contains(":cristin")) {
this.tag = "Cristin";
this.tag = "cristin";
} else {
this.tag = entity.getReference().substring(0, entity.getReference().indexOf(":"));
}

View File

@ -60,7 +60,7 @@ public class Researcher implements DataModel<eu.eudat.data.entities.Researcher,
this.status = entity.getStatus();
if (entity.getReference().contains(":cristin")) {
this.tag = "Cristin";
this.tag = "cristin";
} else {
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source.equals("dmp"))

View File

@ -7,20 +7,17 @@ import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
/**
* Created by ikalyvas on 9/3/2018.
*/
public class ExternalDatasetModel implements DataModel<ExternalDataset, ExternalDatasetModel> {
public UUID id;
public String label;
public String abbreviation;
public Date created;
public Date modified;
private String source;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
@ -28,7 +25,6 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@ -36,7 +32,6 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
@ -44,7 +39,6 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@ -52,11 +46,17 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public ExternalDatasetModel fromDataModel(ExternalDataset entity) {
this.id = entity.getId();
@ -64,6 +64,12 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
this.abbreviation = entity.getAbbreviation();
this.created = entity.getCreated();
this.modified = new Date();
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@ -75,7 +81,7 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
externalDataset.setModified(new Date());
externalDataset.setId(this.id != null ? this.id : UUID.randomUUID());
externalDataset.setLabel(this.label);
externalDataset.setReference("dmpdata/" + externalDataset.getId());
externalDataset.setReference("dmp:" + externalDataset.getId());
externalDataset.setCreationUser(new UserInfo());
return externalDataset;
}

View File

@ -1,5 +1,6 @@
package eu.eudat.models.data.registries;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.eudat.data.entities.Registry;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.models.DataModel;
@ -8,17 +9,17 @@ import java.util.Date;
import java.util.Map;
import java.util.UUID;
/**
* Created by ikalyvas on 9/3/2018.
*/
public class RegistryModel implements DataModel<Registry, RegistryModel> {
private UUID id;
private String name;
private String label;
private String pid;
private String abbreviation;
private String uri;
private Date created;
private Date modified;
private String tag;
private String tag; // Api fetching the data
private String source; // Actual harvested source
public UUID getId() {
return id;
@ -27,6 +28,13 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLabel() {
return label;
}
@ -69,15 +77,35 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
this.tag = tag;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public RegistryModel fromDataModel(Registry entity) {
this.id = entity.getId();
this.abbreviation = entity.getAbbreviation();
this.created = entity.getCreated();
this.label = entity.getLabel();
this.name = entity.getLabel();
this.modified = entity.getModified();
this.uri = entity.getUri();
this.tag = "Internal";
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source1.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source1;
}
return this;
}
@ -87,10 +115,15 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
registry.setAbbreviation(this.abbreviation);
registry.setCreated(this.created != null ? this.created : new Date());
registry.setId(this.id != null ? this.id : UUID.randomUUID());
registry.setLabel(this.label);
registry.setLabel(this.label != null ? this.label : this.name);
registry.setUri(this.uri);
registry.setModified(new Date());
registry.setReference("dmpdata/" + registry.getId());
if (this.source == null) this.source = "dmp";
if (this.source.equals(registry.getId().toString().substring(0, this.source.length()))) {
registry.setReference(registry.getId().toString());
} else {
registry.setReference(this.source + ":" + registry.getId());
}
registry.setStatus((short)0);
registry.setCreationUser(new UserInfo());
return registry;

View File

@ -7,17 +7,18 @@ import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
/**
* Created by ikalyvas on 9/3/2018.
*/
public class ServiceModel implements DataModel<Service, ServiceModel> {
private UUID id;
private String label;
private String name;
private String pid;
private String abbreviation;
private String uri;
private Date created;
private Date modified;
private String reference;
private String tag;
private String source;
public UUID getId() {
return id;
@ -33,6 +34,20 @@ public class ServiceModel implements DataModel<Service, ServiceModel> {
this.label = label;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getAbbreviation() {
return abbreviation;
}
@ -61,6 +76,13 @@ public class ServiceModel implements DataModel<Service, ServiceModel> {
this.modified = modified;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getTag() {
return tag;
}
@ -68,15 +90,28 @@ public class ServiceModel implements DataModel<Service, ServiceModel> {
this.tag = tag;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public ServiceModel fromDataModel(Service entity) {
this.abbreviation = entity.getAbbreviation();
this.created = entity.getCreated();
this.id = entity.getId();
this.label = entity.getLabel();
this.name = entity.getLabel();
this.modified = entity.getModified();
this.uri = entity.getUri();
this.tag = "Internal";
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
if (source.equals("dmp")) {
this.source = "Internal";
} else {
this.source = source;
}
return this;
}
@ -86,12 +121,18 @@ public class ServiceModel implements DataModel<Service, ServiceModel> {
service.setId(this.id != null ? this.id : UUID.randomUUID());
service.setAbbreviation(this.abbreviation);
service.setCreated(this.created != null ? this.created : new Date());
service.setLabel(this.label);
service.setLabel(this.label != null ? this.label : this.name);
service.setModified(new Date());
service.setUri(this.uri);
service.setReference("innerdata/" + service.getId());
if (this.source == null) this.source = "dmp";
if (this.reference == null) this.reference = service.getId().toString();
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
service.setReference(this.reference);
} else {
service.setReference(this.source + ":" + this.reference);
}
service.setModified(new Date());
service.setStatus((short)0);
service.setStatus((short) 0);
service.setCreationUser(new UserInfo());
return service;
}

View File

@ -5,4 +5,5 @@ export interface DataRepositoryModel {
uri: string;
pid: string;
info: string;
source: string;
}

View File

@ -7,4 +7,5 @@ export interface ExternalDatasetModel {
reference: String;
type: ExternalDatasetType;
info: String;
}
source: String;
}

View File

@ -3,7 +3,9 @@ export interface RegistryModel {
abbreviation: String;
definition: String;
id: String;
pid: String;
label: String;
reference: String;
uri: String;
source: String;
}

View File

@ -219,14 +219,16 @@ export class ExternalRegistryEditorModel {
public label: String;
public reference: String;
public uri: String;
public source: String
constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String) {
constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
this.abbreviation = abbreviation;
this.definition = definition;
this.id = id;
this.label = label;
this.reference = reference;
this.uri = uri;
this.source = source;
}
fromModel(item: RegistryModel): ExternalRegistryEditorModel {
@ -234,8 +236,9 @@ export class ExternalRegistryEditorModel {
this.definition = item.definition;
this.id = item.id;
this.label = item.label;
this.reference = item.reference;
this.reference = item.pid ? item.pid : item.reference;
this.uri = item.uri;
this.source = item.source
return this;
}
@ -247,7 +250,8 @@ export class ExternalRegistryEditorModel {
label: [this.label],
reference: [this.reference],
uri: [this.uri],
definition: [this.definition]
definition: [this.definition],
source: [this.source]
});
}
}
@ -261,14 +265,16 @@ export class ExternalDatasetEditorModel {
public type: ExternalDatasetType;
public info: String;
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
public source: String;
constructor(id?: string, abbreviation?: string, label?: string, reference?: string, info?: string, type?: ExternalDatasetType) {
constructor(id?: string, abbreviation?: string, label?: string, reference?: string, info?: string, type?: ExternalDatasetType, source?: String) {
this.id = id;
this.label = label;
this.abbreviation = abbreviation;
this.reference = reference;
this.info = info;
this.type = type;
this.source = source;
}
fromModel(item: ExternalDatasetModel): ExternalDatasetEditorModel {
@ -278,6 +284,7 @@ export class ExternalDatasetEditorModel {
this.reference = item.reference;
this.type = item.type;
this.info = item.info;
this.source = item.source;
return this;
}
@ -288,7 +295,8 @@ export class ExternalDatasetEditorModel {
label: [this.label],
reference: [this.reference],
type: [this.type, Validators.required],
info: [this.info]
info: [this.info],
source: [this.source]
});
}
}
@ -302,13 +310,15 @@ export class ExternalDataRepositoryEditorModel {
public info: string;
public created: Date;
public modified: Date;
public source: string;
constructor(id?: string, label?: string, abbreviation?: string, uri?: string, reference?: string) {
constructor(id?: string, label?: string, abbreviation?: string, uri?: string, reference?: string, source?: string) {
this.id = id;
this.label = label;
this.abbreviation = abbreviation;
this.uri = uri;
this.reference = reference;
this.source = source;
}
fromModel(item: DataRepositoryModel): ExternalDataRepositoryEditorModel {
@ -318,6 +328,7 @@ export class ExternalDataRepositoryEditorModel {
this.uri = item.uri;
this.info = item.info;
this.reference = item.pid;
this.source = item.source;
return this;
}
@ -328,7 +339,8 @@ export class ExternalDataRepositoryEditorModel {
abbreviation: [this.abbreviation],
uri: [this.uri],
info: [this.info],
reference: [this.reference]
reference: [this.reference],
source: [this.source]
});
}
}

View File

@ -70,7 +70,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
initialItems: (type) => this.searchDatasetExternalDataRepositories('', type),
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
this.externalDatasetAutoCompleteConfiguration = {
@ -86,9 +86,9 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
filterFn: this.searchDatasetExternalRegistries.bind(this),
removeAfterSelection: true,
initialItems: (type) => this.searchDatasetExternalRegistries('', type),
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')
displayFn: (item) => item ? item.name : null,
titleFn: (item) => item ? item.name : null,
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};
this.servicesAutoCompleteConfiguration = {
@ -115,12 +115,12 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
}
externalDatasetsOnItemChange(event) {
const externalDatasetModel = new ExternalDatasetEditorModel(event.id, event.abbreviation, event.label, event.reference);
const externalDatasetModel = new ExternalDatasetEditorModel(event.id, event.abbreviation, event.label, event.reference, event.source);
(<FormArray>this.formGroup.get('externalDatasets')).push(externalDatasetModel.buildForm());
}
registriesOnItemChange(event) {
const registryModel = new ExternalRegistryEditorModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
const registryModel = new ExternalRegistryEditorModel(event.abbreviation, event.definition, event.id, event.name, event.pid ? event.pid : event.reference, event.uri, event.source);
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
}
@ -136,7 +136,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
dataRepositoriesOnItemChange(event) {
const dataRepositoryModel = new ExternalDataRepositoryEditorModel(event.id, event.name, event.abbreviation, event.uri, event.pid);
const dataRepositoryModel = new ExternalDataRepositoryEditorModel(event.id, event.name, event.abbreviation, event.uri, event.pid, event.source);
(<FormArray>this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm());
}