adding key property in the prefilling model as the identifier of the prefilling repository

This commit is contained in:
Bernaldo Mihasi 2023-07-17 10:29:06 +03:00
parent 1715463422
commit dd6a2a0df7
5 changed files with 15 additions and 5 deletions

View File

@ -363,7 +363,7 @@ public class RemoteFetcher {
Results remainingResults = optionalResults.orElseGet(Results::new); Results remainingResults = optionalResults.orElseGet(Results::new);
remainingResults.getResults().addAll(results.getResults()); remainingResults.getResults().addAll(results.getResults());
return remainingResults.getResults().stream().peek(x -> x.put("tag", tag)).collect(Collectors.toList()); return remainingResults.getResults().stream().peek(x -> x.put("tag", tag)).peek(x -> x.put("key", key)).collect(Collectors.toList());
} }
else { else {
return new LinkedList<>(); return new LinkedList<>();

View File

@ -6,6 +6,7 @@ public class Prefilling {
private String pid; private String pid;
private String name; private String name;
private Map<String, Object> data; private Map<String, Object> data;
private String key;
private String tag; private String tag;
public String getPid() { public String getPid() {
@ -32,6 +33,14 @@ public class Prefilling {
this.data = data; this.data = data;
} }
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getTag() { public String getTag() {
return tag; return tag;
} }

View File

@ -1203,7 +1203,7 @@ but not
<prefillingSearch> <prefillingSearch>
<urlConfig> <urlConfig>
<key>zenodo</key> <key>zenodo</key>
<label>zenodo</label> <label>Zenodo</label>
<ordinal>1</ordinal> <ordinal>1</ordinal>
<type>External</type> <type>External</type>
<url>https://zenodo.org/api/records/?page={page}&amp;size={pageSize}&amp;q=title:"{like}" doi:"{like}" conceptdoi:"{like}"</url> <url>https://zenodo.org/api/records/?page={page}&amp;size={pageSize}&amp;q=title:"{like}" doi:"{like}" conceptdoi:"{like}"</url>
@ -1264,7 +1264,7 @@ but not
<prefillingSearch> <prefillingSearch>
<urlConfig> <urlConfig>
<key>openaire</key> <key>openaire</key>
<label>openaire</label> <label>Openaire</label>
<ordinal>1</ordinal> <ordinal>1</ordinal>
<type>External</type> <type>External</type>
<url>https://services.openaire.eu/search/v2/api/datasets/?q={like}&amp;page={page}&amp;size={pageSize}&amp;format=json</url> <url>https://services.openaire.eu/search/v2/api/datasets/?q={like}&amp;page={page}&amp;size={pageSize}&amp;format=json</url>

View File

@ -2,5 +2,6 @@ export interface Prefilling {
pid: string; pid: string;
name: string; name: string;
data: any; data: any;
key: string;
tag: string; tag: string;
} }

View File

@ -69,13 +69,13 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit {
next() { next() {
if(this.isPrefilled) { if(this.isPrefilled) {
if(this.prefillForm.get('prefill').value.data == null) { if(this.prefillForm.get('prefill').value.data == null) {
this.prefillingService.getPrefillingDataset(this.prefillForm.get('prefill').value.pid, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.tag).subscribe(wizard => { this.prefillingService.getPrefillingDataset(this.prefillForm.get('prefill').value.pid, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.key).subscribe(wizard => {
wizard.profile = this.prefillForm.get('profile').value; wizard.profile = this.prefillForm.get('profile').value;
this.closeDialog(wizard); this.closeDialog(wizard);
}); });
} }
else { else {
this.prefillingService.getPrefillingDatasetUsingData(this.prefillForm.get('prefill').value.data, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.tag).subscribe(wizard => { this.prefillingService.getPrefillingDatasetUsingData(this.prefillForm.get('prefill').value.data, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.key).subscribe(wizard => {
wizard.profile = this.prefillForm.get('profile').value; wizard.profile = this.prefillForm.get('profile').value;
this.closeDialog(wizard); this.closeDialog(wizard);
}); });