grant reference fix
This commit is contained in:
parent
2f0056c62b
commit
0eb78b5107
|
@ -19,7 +19,7 @@ public class QueryCaseConfigEntity implements QueryCaseConfig {
|
||||||
return referenceTypeSourceKey;
|
return referenceTypeSourceKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "defaultValue")
|
@XmlElement(name = "referenceTypeSourceKey")
|
||||||
public void setReferenceTypeSourceKey(String referenceTypeSourceKey) {
|
public void setReferenceTypeSourceKey(String referenceTypeSourceKey) {
|
||||||
this.referenceTypeSourceKey = referenceTypeSourceKey;
|
this.referenceTypeSourceKey = referenceTypeSourceKey;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class QueryCaseConfigEntity implements QueryCaseConfig {
|
||||||
return referenceTypeId;
|
return referenceTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "referenceTypeSourceKey")
|
@XmlElement(name = "referenceTypeId")
|
||||||
public void setReferenceTypeId(UUID referenceTypeId) {
|
public void setReferenceTypeId(UUID referenceTypeId) {
|
||||||
this.referenceTypeId = referenceTypeId;
|
this.referenceTypeId = referenceTypeId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ReferenceTypeDefinitionBuilder extends BaseBuilder<ReferenceTypeDef
|
||||||
m.setSources(new ArrayList<>());
|
m.setSources(new ArrayList<>());
|
||||||
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities));
|
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities));
|
||||||
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherStaticOptionSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities));
|
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherStaticOptionSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities));
|
||||||
m.getSources().sort(Comparator.comparing(ExternalFetcherBaseSourceConfiguration::getOrdinal));
|
m.getSources().sort(Comparator.comparing(x -> x.getOrdinal() == null ? 0 : x.getOrdinal()));
|
||||||
}
|
}
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,8 +184,12 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
if (dependencyReference != null){
|
if (dependencyReference != null){
|
||||||
|
|
||||||
for (Field field : dependencyReference.getDefinition().getFields()){
|
for (Field field : dependencyReference.getDefinition().getFields()){
|
||||||
filterValue = filterValue.replaceAll("{" + field.getCode() + "}", field.getValue());
|
filterValue = filterValue.replaceAll("\\{" + field.getCode() + "}", field.getValue());
|
||||||
}
|
}
|
||||||
|
filterValue = filterValue.replaceAll("\\{" + Reference._reference + "}", dependencyReference.getReference());
|
||||||
|
filterValue = filterValue.replaceAll("\\{" + Reference._label + "}", dependencyReference.getLabel());
|
||||||
|
filterValue = filterValue.replaceAll("\\{" + Reference._source + "}", dependencyReference.getSource());
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (!this.conventionService.isNullOrEmpty(likeValue)) {
|
} else if (!this.conventionService.isNullOrEmpty(likeValue)) {
|
||||||
if (caseConfig.getSeparator() != null) {
|
if (caseConfig.getSeparator() != null) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ BEGIN
|
||||||
INSERT INTO public."ReferenceType" VALUES ('51225b6a-86a6-48ac-9192-f15096dbcb8a', 'publications', 'publications', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="pid" label="pid" description="pid" dataType="Text"/><field code="pidTypeField" label="pidTypeField" description="pidTypeField" dataType="Text"/></fields><sources><api><key>openaire</key><label>OpenAIRE Publications</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json;charset=UTF-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><defaultValue>*</defaultValue><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>originalId</responsePath></field><field><code>label</code><responsePath>title</responsePath></field><field><code>description</code><responsePath>title</responsePath></field><field><code>pid</code><responsePath>[''pid''][''content'']</responsePath></field><field><code>pidTypeField</code><responsePath>[''pid''][''classid'']</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:result'']</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/resources?query=oaftype exact result and {like}&page={page}&size={pageSize}&format=json</url></api></sources></definition>', 1, '2023-11-16 13:07:20.591433', '2024-02-19 08:23:49.91191', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('51225b6a-86a6-48ac-9192-f15096dbcb8a', 'publications', 'publications', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="pid" label="pid" description="pid" dataType="Text"/><field code="pidTypeField" label="pidTypeField" description="pidTypeField" dataType="Text"/></fields><sources><api><key>openaire</key><label>OpenAIRE Publications</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json;charset=UTF-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><defaultValue>*</defaultValue><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>originalId</responsePath></field><field><code>label</code><responsePath>title</responsePath></field><field><code>description</code><responsePath>title</responsePath></field><field><code>pid</code><responsePath>[''pid''][''content'']</responsePath></field><field><code>pidTypeField</code><responsePath>[''pid''][''classid'']</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:result'']</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/resources?query=oaftype exact result and {like}&page={page}&size={pageSize}&format=json</url></api></sources></definition>', 1, '2023-11-16 13:07:20.591433', '2024-02-19 08:23:49.91191', NULL);
|
||||||
INSERT INTO public."ReferenceType" VALUES ('538928bb-c7c6-452e-b66d-08e539f5f082', 'funders', 'funders', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><sources><api><key>openaire</key><label>OpenAIRE</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>1</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>local</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[*]</paginationPath><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>id</responsePath></field><field><code>label</code><responsePath>name</responsePath></field><field><code>description</code><responsePath>name</responsePath></field></fieldsMapping><resultsArrayPath>$[''refineResults''][''relfunder''][*]</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/publications?&refine=true&fields=relfunder&page={page}&size=0&format=json</url></api></sources></definition>', 1, '2023-11-16 11:22:57.942097', '2024-02-16 09:16:19.195353', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('538928bb-c7c6-452e-b66d-08e539f5f082', 'funders', 'funders', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><sources><api><key>openaire</key><label>OpenAIRE</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>1</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>local</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[*]</paginationPath><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>id</responsePath></field><field><code>label</code><responsePath>name</responsePath></field><field><code>description</code><responsePath>name</responsePath></field></fieldsMapping><resultsArrayPath>$[''refineResults''][''relfunder''][*]</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/publications?&refine=true&fields=relfunder&page={page}&size=0&format=json</url></api></sources></definition>', 1, '2023-11-16 11:22:57.942097', '2024-02-16 09:16:19.195353', NULL);
|
||||||
INSERT INTO public."ReferenceType" VALUES ('5a2112e7-ea99-4cfe-98a1-68665e26726e', 'researchers', 'researchers', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="firstName" label="Researchers First Name" description="Researchers First Name" dataType="Text"/><field code="lastName" label="Researchers Last Name" description="Researchers Last Name" dataType="Text"/></fields><sources><api><key>orcid</key><label>ORCID</label><ordinal>1</ordinal><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=UTF-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''num-found'']</paginationPath><queries><query><cases><case><likePattern>^[A-Za-z0-9]+ [A-Za-z0-9]+$</likePattern><separator> </separator><value>((given-names:{like1}+AND+family-name:{like2})+OR+(given-names:{like2}+AND+family-name:{like1}))</value></case><case><likePattern>\d{4}-\d{4}-\d{4}-\d{4}</likePattern><value>orcid:{like}</value></case><case><likePattern>.+</likePattern><value>given-names:{like}+OR+family-name:{like}</value></case></cases><defaultValue>*</defaultValue><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>orcid-id</responsePath></field><field><code>label</code><responsePath>@{{given-names}} @{{family-names}} (@{{orcid-id}})</responsePath></field><field><code>description</code><responsePath>institution-name</responsePath></field><field><code>fistName</code><responsePath>given-names</responsePath></field><field><code>lastName</code><responsePath>family-names</responsePath></field></fieldsMapping><resultsArrayPath>$[''expanded-result''][*]</resultsArrayPath></results><url>https://pub.orcid.org/v3.0/expanded-search/?q={like}&start={page}&rows={pageSize}</url></api></sources></definition>', 1, '2023-11-16 18:21:43.272982', '2024-04-17 09:44:53.656849', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('5a2112e7-ea99-4cfe-98a1-68665e26726e', 'researchers', 'researchers', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="firstName" label="Researchers First Name" description="Researchers First Name" dataType="Text"/><field code="lastName" label="Researchers Last Name" description="Researchers Last Name" dataType="Text"/></fields><sources><api><key>orcid</key><label>ORCID</label><ordinal>1</ordinal><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=UTF-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''num-found'']</paginationPath><queries><query><cases><case><likePattern>^[A-Za-z0-9]+ [A-Za-z0-9]+$</likePattern><separator> </separator><value>((given-names:{like1}+AND+family-name:{like2})+OR+(given-names:{like2}+AND+family-name:{like1}))</value></case><case><likePattern>\d{4}-\d{4}-\d{4}-\d{4}</likePattern><value>orcid:{like}</value></case><case><likePattern>.+</likePattern><value>given-names:{like}+OR+family-name:{like}</value></case></cases><defaultValue>*</defaultValue><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>orcid-id</responsePath></field><field><code>label</code><responsePath>@{{given-names}} @{{family-names}} (@{{orcid-id}})</responsePath></field><field><code>description</code><responsePath>institution-name</responsePath></field><field><code>fistName</code><responsePath>given-names</responsePath></field><field><code>lastName</code><responsePath>family-names</responsePath></field></fieldsMapping><resultsArrayPath>$[''expanded-result''][*]</resultsArrayPath></results><url>https://pub.orcid.org/v3.0/expanded-search/?q={like}&start={page}&rows={pageSize}</url></api></sources></definition>', 1, '2023-11-16 18:21:43.272982', '2024-04-17 09:44:53.656849', NULL);
|
||||||
INSERT INTO public."ReferenceType" VALUES ('5b9c284f-f041-4995-96cc-fad7ad13289c', 'grants', 'grants', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><sources><api><key>openaire</key><label>OpenAIRE</label><ordinal>1</ordinal><referenceTypeDependencyIds><referenceTypeDependencyIds>538928bb-c7c6-452e-b66d-08e539f5f082</referenceTypeDependencyIds></referenceTypeDependencyIds><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><referenceTypeSourceKey>538928bb-c7c6-452e-b66d-08e539f5f082</referenceTypeSourceKey><defaultValue>openaire</defaultValue><value>{like}</value></case></cases><defaultValue>*</defaultValue><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>originalId</responsePath></field><field><code>label</code><responsePath>title</responsePath></field><field><code>description</code><responsePath>title</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:project'']</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like})))&page={page}&size={pageSize}&format=json</url></api></sources></definition>', 1, '2023-11-16 16:41:53.106646', '2024-02-19 12:33:49.420526', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('5b9c284f-f041-4995-96cc-fad7ad13289c', 'grants', 'grants', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><sources><api><key>openaire</key><label>OpenAIRE</label><ordinal>1</ordinal><referenceTypeDependencyIds><referenceTypeDependencyIds>538928bb-c7c6-452e-b66d-08e539f5f082</referenceTypeDependencyIds></referenceTypeDependencyIds><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody/><authTokenPath/><authUrl/><enabled>false</enabled><authType/></authentication><contentType>application/json; charset=utf-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><defaultValue>*</defaultValue><name>like</name></query><query><cases><case><value>&fq=(funder exact "{reference}")</value><referenceTypeId>538928bb-c7c6-452e-b66d-08e539f5f082</referenceTypeId><referenceTypeSourceKey>openaire</referenceTypeSourceKey></case></cases><defaultValue/><name>funderQuery</name></query></queries><requestBody/><results><fieldsMapping><field><code>reference_id</code><responsePath>originalId</responsePath></field><field><code>label</code><responsePath>title</responsePath></field><field><code>description</code><responsePath>title</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:project'']</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like}))){funderQuery}&page={page}&size={pageSize}&format=json</url></api></sources></definition>', 1, '2023-11-16 16:41:53.106646', '2024-04-17 13:13:30.853978', NULL);
|
||||||
INSERT INTO public."ReferenceType" VALUES ('7eeffb98-58fb-4921-82ec-e27f32f8e738', 'organisations', 'organisations', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="pid" label="Pid Organisations" description="Pid Organisations" dataType="Text"/><field code="pidTypeField" label="PidType Organisations" description="PidType Organisations" dataType="Text"/></fields><sources><api><key>openaire</key><label>OpenAIRE</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>originalId</responsePath></field><field><code>label</code><responsePath>legalname</responsePath></field><field><code>description</code><responsePath>legalname</responsePath></field><field><code>pid</code><responsePath>[''pid''][''content'']</responsePath></field><field><code>pidTypeField</code><responsePath>[''pid''][''classid'']</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:organization'']</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/organizations/?q={like}&page={page}&size={pageSize}&format=json</url></api></sources></definition>', 1, '2023-11-17 10:13:15.873808', '2024-02-16 15:35:47.874131', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('7eeffb98-58fb-4921-82ec-e27f32f8e738', 'organisations', 'organisations', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="pid" label="Pid Organisations" description="Pid Organisations" dataType="Text"/><field code="pidTypeField" label="PidType Organisations" description="PidType Organisations" dataType="Text"/></fields><sources><api><key>openaire</key><label>OpenAIRE</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>originalId</responsePath></field><field><code>label</code><responsePath>legalname</responsePath></field><field><code>description</code><responsePath>legalname</responsePath></field><field><code>pid</code><responsePath>[''pid''][''content'']</responsePath></field><field><code>pidTypeField</code><responsePath>[''pid''][''classid'']</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:organization'']</resultsArrayPath></results><url>https://services.openaire.eu/search/v2/api/organizations/?q={like}&page={page}&size={pageSize}&format=json</url></api></sources></definition>', 1, '2023-11-17 10:13:15.873808', '2024-02-16 15:35:47.874131', NULL);
|
||||||
INSERT INTO public."ReferenceType" VALUES ('8ec7556b-749d-4c4a-a4b9-43d064693795', 'journals', 'journals', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><sources><api><key>openaire</key><label>OpenAIRE Journals</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>1</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><name>like</name></query></queries><requestBody>{"officialname": "{like}", "typology":"journal"}</requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>id</responsePath></field><field><code>label</code><responsePath>officialname</responsePath></field><field><code>description</code><responsePath>officialname</responsePath></field></fieldsMapping><resultsArrayPath>$[''datasourceInfo''][*]</resultsArrayPath></results><url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url></api></sources></definition>', 1, '2023-11-16 17:40:12.811667', '2024-02-16 09:09:22.816978', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('8ec7556b-749d-4c4a-a4b9-43d064693795', 'journals', 'journals', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><sources><api><key>openaire</key><label>OpenAIRE Journals</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>1</requestHttpMethod><paginationPath>$[''meta''][''pagination''][''page'',''pages'',''count'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><name>like</name></query></queries><requestBody>{"officialname": "{like}", "typology":"journal"}</requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>id</responsePath></field><field><code>label</code><responsePath>officialname</responsePath></field><field><code>description</code><responsePath>officialname</responsePath></field></fieldsMapping><resultsArrayPath>$[''datasourceInfo''][*]</resultsArrayPath></results><url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url></api></sources></definition>', 1, '2023-11-16 17:40:12.811667', '2024-02-16 09:09:22.816978', NULL);
|
||||||
INSERT INTO public."ReferenceType" VALUES ('9ec2000d-95c7-452e-b356-755fc8e2574c', 'services', 'services', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="uri" label="Service Uri" description="Service Uri" dataType="Text"/></fields><sources><api><key>eosc</key><label>EOSC Providers</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''from'',''to'',''total'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>id</responsePath></field><field><code>label</code><responsePath>name</responsePath></field><field><code>description</code><responsePath>description</responsePath></field><field><code>uri</code><responsePath>webpage</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*]</resultsArrayPath></results><url>https://providers.eosc-portal.eu/api/service/all?query={like}&from={page}&quantity={pageSize}</url></api></sources></definition>', 1, '2023-11-16 17:57:22.081053', '2024-02-16 09:07:13.944104', NULL);
|
INSERT INTO public."ReferenceType" VALUES ('9ec2000d-95c7-452e-b356-755fc8e2574c', 'services', 'services', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definition><fields><field code="uri" label="Service Uri" description="Service Uri" dataType="Text"/></fields><sources><api><key>eosc</key><label>EOSC Providers</label><ordinal>1</ordinal><referenceTypeDependencyIds/><type>0</type><authentication><authUrlMethod>0</authUrlMethod><authUrlBody></authUrlBody><authTokenPath></authTokenPath><authUrl></authUrl><enabled>false</enabled><authType></authType></authentication><contentType>application/json; charset=utf-8</contentType><filterType>remote</filterType><firstPage>0</firstPage><requestHttpMethod>0</requestHttpMethod><paginationPath>$[''from'',''to'',''total'']</paginationPath><queries><query><cases><case><value>{like}</value></case></cases><name>like</name></query></queries><requestBody></requestBody><results><fieldsMapping><field><code>reference_id</code><responsePath>id</responsePath></field><field><code>label</code><responsePath>name</responsePath></field><field><code>description</code><responsePath>description</responsePath></field><field><code>uri</code><responsePath>webpage</responsePath></field></fieldsMapping><resultsArrayPath>$[''results''][*]</resultsArrayPath></results><url>https://providers.eosc-portal.eu/api/service/all?query={like}&from={page}&quantity={pageSize}</url></api></sources></definition>', 1, '2023-11-16 17:57:22.081053', '2024-02-16 09:07:13.944104', NULL);
|
||||||
|
|
|
@ -118,10 +118,10 @@ export class ReferenceService {
|
||||||
//
|
//
|
||||||
// Autocomplete Commons - Search
|
// Autocomplete Commons - Search
|
||||||
//
|
//
|
||||||
public getSingleAutocompleteSearchConfiguration(typeId: Guid): SingleAutoCompleteConfiguration {
|
public getSingleAutocompleteSearchConfiguration(typeId: Guid, dependencyReferences: Reference[]): SingleAutoCompleteConfiguration {
|
||||||
return {
|
return {
|
||||||
initialItems: (data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId)).pipe(map(x => x)),
|
initialItems: (data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences)).pipe(map(x => x)),
|
||||||
filterFn: (searchQuery: string, data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)),
|
filterFn: (searchQuery: string, data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, searchQuery)).pipe(map(x => x)),
|
||||||
displayFn: (item: Reference) => item.label,
|
displayFn: (item: Reference) => item.label,
|
||||||
subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'),
|
subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'),
|
||||||
titleFn: (item: Reference) => item.label,
|
titleFn: (item: Reference) => item.label,
|
||||||
|
@ -130,10 +130,10 @@ export class ReferenceService {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
public getMultipleAutoCompleteSearchConfiguration(typeId: Guid): MultipleAutoCompleteConfiguration {
|
public getMultipleAutoCompleteSearchConfiguration(typeId: Guid, dependencyReferences: Reference[]): MultipleAutoCompleteConfiguration {
|
||||||
return {
|
return {
|
||||||
initialItems: (excludedItems: any[], data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, null)).pipe(map(x => x)),
|
initialItems: (excludedItems: any[], data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, null)).pipe(map(x => x)),
|
||||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)),
|
filterFn: (searchQuery: string, excludedItems: any[]) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, searchQuery)).pipe(map(x => x)),
|
||||||
displayFn: (item: Reference) => item.label,
|
displayFn: (item: Reference) => item.label,
|
||||||
titleFn: (item: Reference) => item.label,
|
titleFn: (item: Reference) => item.label,
|
||||||
subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'),
|
subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'),
|
||||||
|
@ -142,7 +142,7 @@ export class ReferenceService {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildAutocompleteSearchLookup(typeId: Guid, like?: string): ReferenceSearchLookup {
|
private buildAutocompleteSearchLookup(typeId: Guid, dependencyReferences: Reference[], like?: string): ReferenceSearchLookup {
|
||||||
const lookup: ReferenceSearchLookup = new ReferenceSearchLookup();
|
const lookup: ReferenceSearchLookup = new ReferenceSearchLookup();
|
||||||
lookup.page = { size: 100, offset: 0 };
|
lookup.page = { size: 100, offset: 0 };
|
||||||
lookup.project = {
|
lookup.project = {
|
||||||
|
@ -163,34 +163,7 @@ export class ReferenceService {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
lookup.typeId = typeId;
|
lookup.typeId = typeId;
|
||||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
lookup.dependencyReferences = dependencyReferences;
|
||||||
if (like) { lookup.like = this.filterService.transformLike(like); }
|
|
||||||
return lookup;
|
|
||||||
}
|
|
||||||
|
|
||||||
private buildAutocompleteSearchSelectedItemsLookup(referenceTypeIds?: Guid[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
|
||||||
const lookup: ReferenceLookup = new ReferenceLookup();
|
|
||||||
lookup.page = { size: 100, offset: 0 };
|
|
||||||
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
|
||||||
if (ids && ids.length > 0) { lookup.ids = ids; }
|
|
||||||
lookup.isActive = [IsActive.Active];
|
|
||||||
lookup.project = {
|
|
||||||
fields: [
|
|
||||||
nameof<Reference>(x => x.id),
|
|
||||||
nameof<Reference>(x => x.label),
|
|
||||||
nameof<Reference>(x => x.type),
|
|
||||||
nameof<Reference>(x => x.description),
|
|
||||||
[nameof<Reference>(x => x.definition), nameof<Definition>(x => x.fields), nameof<Field>(x => x.code)].join('.'),
|
|
||||||
[nameof<Reference>(x => x.definition), nameof<Definition>(x => x.fields), nameof<Field>(x => x.dataType)].join('.'),
|
|
||||||
[nameof<Reference>(x => x.definition), nameof<Definition>(x => x.fields), nameof<Field>(x => x.value)].join('.'),
|
|
||||||
nameof<Reference>(x => x.reference),
|
|
||||||
nameof<Reference>(x => x.abbreviation),
|
|
||||||
nameof<Reference>(x => x.source),
|
|
||||||
nameof<Reference>(x => x.sourceType),
|
|
||||||
]
|
|
||||||
};
|
|
||||||
if (referenceTypeIds && referenceTypeIds.length > 0) { lookup.typeIds = referenceTypeIds; }
|
|
||||||
if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; }
|
|
||||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
||||||
if (like) { lookup.like = this.filterService.transformLike(like); }
|
if (like) { lookup.like = this.filterService.transformLike(like); }
|
||||||
return lookup;
|
return lookup;
|
||||||
|
|
|
@ -209,4 +209,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -250,7 +250,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.ReferenceType">
|
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.ReferenceType">
|
||||||
<div>
|
<div>
|
||||||
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="field.referenceType"></app-reference-field-component>
|
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [dependencies]="formGroup.get('properties').get('dmpBlueprintValues')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="field.referenceType"></app-reference-field-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.Extra">
|
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.Extra">
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { Description } from '@app/core/model/description/description';
|
||||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||||
import { Dmp, DmpBlueprintValue, DmpContact, DmpDescriptionTemplate, DmpProperties, DmpUser } from '@app/core/model/dmp/dmp';
|
import { Dmp, DmpBlueprintValue, DmpContact, DmpDescriptionTemplate, DmpProperties, DmpUser } from '@app/core/model/dmp/dmp';
|
||||||
import { DmpReference, DmpReferenceData } from '@app/core/model/dmp/dmp-reference';
|
import { DmpReference, DmpReferenceData } from '@app/core/model/dmp/dmp-reference';
|
||||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
import { ExternalFetcherBaseSourceConfiguration } from '@app/core/model/external-fetcher/external-fetcher';
|
||||||
|
import { ReferenceType, ReferenceTypeDefinition } from '@app/core/model/reference-type/reference-type';
|
||||||
import { Reference } from '@app/core/model/reference/reference';
|
import { Reference } from '@app/core/model/reference/reference';
|
||||||
import { DmpAssociatedUser, User } from '@app/core/model/user/user';
|
import { DmpAssociatedUser, User } from '@app/core/model/user/user';
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||||
|
@ -76,7 +77,7 @@ export class DmpEditorResolver extends BaseEditorResolver {
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.data), nameof<DmpReferenceData>(x => x.blueprintFieldId)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.data), nameof<DmpReferenceData>(x => x.blueprintFieldId)].join('.'),
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.source)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.source)].join('.'),
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
|
||||||
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.sourceType)].join('.'),
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.sourceType)].join('.'),
|
||||||
|
@ -120,6 +121,7 @@ export class DmpEditorResolver extends BaseEditorResolver {
|
||||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.id)].join('.'),
|
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.id)].join('.'),
|
||||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.name)].join('.'),
|
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.name)].join('.'),
|
||||||
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.code)].join('.'),
|
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.code)].join('.'),
|
||||||
|
(prefix ? prefix + '.' : '') + [nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.fields), nameof<ReferenceTypeFieldInSection>(x => x.referenceType), nameof<ReferenceType>(x => x.definition), nameof<ReferenceTypeDefinition>(x=> x.sources), nameof<ExternalFetcherBaseSourceConfiguration>(x=> x.referenceTypeDependencies) , nameof<ReferenceType>(x => x.id)].join('.'),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,4 @@
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<span *ngIf="!form.disabled" class="not-found">{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}}</span>
|
<span *ngIf="!form.disabled" class="not-found">{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}}</span>
|
||||||
<span *ngIf="!form.disabled" class="insert-manually" (click)="addReference($event)">{{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}</span>
|
<span *ngIf="!form.disabled" class="insert-manually" (click)="addReference($event)">{{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,6 +30,8 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
|
||||||
@Input() placeholder: string;
|
@Input() placeholder: string;
|
||||||
@Input() dependencies: UntypedFormGroup = null;
|
@Input() dependencies: UntypedFormGroup = null;
|
||||||
|
|
||||||
|
referenceToUse: Reference[]= [];
|
||||||
|
referenceToUseInitialized = false;
|
||||||
|
|
||||||
multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration;
|
multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration;
|
||||||
singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration;
|
singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration;
|
||||||
|
@ -41,10 +43,66 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.multiple) {
|
const referenceDepedencyIds = this.referenceType.definition.sources.filter(x => x.referenceTypeDependencies).flatMap(x => x.referenceTypeDependencies).filter(x => x).map(x => x.id);
|
||||||
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id);
|
if (referenceDepedencyIds.length > 0) {
|
||||||
|
this.referenceToUseInitialized = false;
|
||||||
|
this.dependencies.valueChanges.pipe(takeUntil(this._destroyed)).subscribe(changes => {
|
||||||
|
this.resolveReferenceDepedency(referenceDepedencyIds);
|
||||||
|
});
|
||||||
|
this.resolveReferenceDepedency(referenceDepedencyIds);
|
||||||
} else {
|
} else {
|
||||||
this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id);
|
if (this.multiple) {
|
||||||
|
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id, null);
|
||||||
|
} else {
|
||||||
|
this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resolveReferenceDepedency(referenceDepedencyIds: Guid[]) {
|
||||||
|
const referenceToUse : Reference[]= [];
|
||||||
|
Object.keys(this.dependencies.controls).forEach(controlName => {
|
||||||
|
// (this.dependencies.get(controlName).get('references').value as Reference[]).filter(x=> sourcesWithDependencies.some(y => y.referenceTypeDependencies) x.type.id == this.referenceType.id &&)
|
||||||
|
const foudReferences: any[] = this.dependencies.get(controlName).get('references')?.value;
|
||||||
|
if (foudReferences != null) {
|
||||||
|
for (let i = 0; i < foudReferences.length; i++) {
|
||||||
|
const foudReference = foudReferences[i];
|
||||||
|
if (foudReference?.typeId && referenceDepedencyIds.includes(foudReference.typeId)) {
|
||||||
|
const typed = foudReference as ReferencePersist;
|
||||||
|
|
||||||
|
referenceToUse.push({
|
||||||
|
id: typed.id,
|
||||||
|
hash: typed.hash,
|
||||||
|
description: typed.description,
|
||||||
|
reference: typed.reference,
|
||||||
|
abbreviation: typed.abbreviation,
|
||||||
|
source: typed.source,
|
||||||
|
sourceType: typed.sourceType,
|
||||||
|
label: typed.label,
|
||||||
|
definition: typed.definition,
|
||||||
|
type: {
|
||||||
|
id: typed.typeId,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (foudReference?.type?.id && referenceDepedencyIds.includes(foudReference.type.id)) {
|
||||||
|
const typed = foudReference as Reference;
|
||||||
|
if (typed != null) referenceToUse.push(typed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.referenceToUseInitialized && (!referenceToUse.map(x => x.reference).every(x => this.referenceToUse.map(y => y.reference).includes(x)) ||
|
||||||
|
!this.referenceToUse.map(x => x.reference).every(x => referenceToUse.map(y => y.reference).includes(x)))) {
|
||||||
|
this.form.setValue(null, {onlySelf: true, emitEvent: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.referenceToUse = referenceToUse;
|
||||||
|
this.referenceToUseInitialized = true;
|
||||||
|
|
||||||
|
if (this.multiple) {
|
||||||
|
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id, this.referenceToUse);
|
||||||
|
} else {
|
||||||
|
this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id, this.referenceToUse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +124,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
|
||||||
dialogRef.afterClosed()
|
dialogRef.afterClosed()
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(newResult => {
|
.subscribe(newResult => {
|
||||||
if (!newResult) { return; }
|
if (!newResult) { return; }
|
||||||
let results = this.form.value as ReferencePersist[];
|
let results = this.form.value as ReferencePersist[];
|
||||||
if (results == undefined) results = [];
|
if (results == undefined) results = [];
|
||||||
results.push(newResult);
|
results.push(newResult);
|
||||||
|
@ -87,14 +145,6 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
|
||||||
lookup.typeId = typeId;
|
lookup.typeId = typeId;
|
||||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
||||||
|
|
||||||
// const sourcesWithDependencies = this.referenceType.definition.sources.filter(x => x.referenceTypeDependencies);
|
|
||||||
// if (sourcesWithDependencies.length > 0) {
|
|
||||||
// Object.keys(this.dependencies.controls).forEach(controlName => {
|
|
||||||
// (this.dependencies.get(controlName).get('references').value as Reference[]).filter(x=> sourcesWithDependencies.some(y => y.referenceTypeDependencies) x.type.id == this.referenceType.id &&)
|
|
||||||
// });
|
|
||||||
// lookup.dependencyReferences = [];
|
|
||||||
// }
|
|
||||||
|
|
||||||
return lookup;
|
return lookup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue