Ahead on xref fields renaming. GNP-5564.

parent 58e7c9b9
......@@ -31,12 +31,12 @@ public class XRefDocumentController {
@ApiOperation("Find xref documents")
@GetMapping(value = "/faidare/v1/xref/documentbyfulltextid")
public PaginatedList<XRefDocumentVO> documentByFullTextId(
@RequestParam(required = false, value = "entry_type") String entryType,
@RequestParam(required = false) List<String> linkedRessourcesID
@RequestParam(required = false, value = "entryType") String entryType,
@RequestParam(required = false) List<String> linkedResourcesID
) {
XRefDocumentSearchCriteria criteria = new XRefDocumentSearchCriteria();
criteria.setEntryType(entryType);
criteria.setLinkedRessourcesID(linkedRessourcesID);
criteria.setLinkedResourcesID(linkedResourcesID);
return repository.find(criteria);
}
......
......@@ -5,7 +5,7 @@ package fr.inra.urgi.faidare.domain.xref;
*/
public enum DocumentFields {
ENTRY_TYPE("entry_type"), LINKEDRESSOURCESID("linkedRessourcesID");
ENTRY_TYPE("entryType"), LINKED_RESOURCES_ID("linkedResourcesID");
private String field;
......
......@@ -12,11 +12,11 @@ import java.util.List;
@CriteriaForDocument(XRefDocumentVO.class)
public class XRefDocumentSearchCriteria extends PaginationCriteriaImpl {
@DocumentPath("entry_type")
@DocumentPath("entryType")
private String entryType;
@DocumentPath("linkedRessourcesID")
private List<String> linkedRessourcesID;
@DocumentPath("linkedResourcesID") // pragma: allowlist secret
private List<String> linkedResourcesID;
public String getEntryType() {
return entryType;
......@@ -26,11 +26,11 @@ public class XRefDocumentSearchCriteria extends PaginationCriteriaImpl {
this.entryType = entryType;
}
public List<String> getLinkedRessourcesID() {
return linkedRessourcesID;
public List<String> getLinkedResourcesID() {
return linkedResourcesID;
}
public void setLinkedRessourcesID(List<String> linkedRessourcesID) {
this.linkedRessourcesID = linkedRessourcesID;
public void setLinkedResourcesID(List<String> linkedResourcesID) {
this.linkedResourcesID = linkedResourcesID;
}
}
......@@ -24,7 +24,7 @@ public class XRefDocumentVO {
private String databaseName;
@JsonProperty("identifier")
private String dbId;
private String identifier;
@JsonProperty("name")
private String name;
......@@ -65,11 +65,11 @@ public class XRefDocumentVO {
}
public String getIdentifier() {
return dbId;
return identifier;
}
public void setIdentifier(String dbId) {
this.dbId = dbId;
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getName() {
......
......@@ -61,13 +61,13 @@ class XRefDocumentRepositoryTest {
@Test
void should_Find_By_Linked_Id() {
String id = "ID2";
List<String> linkedRessourcesID = Collections.singletonList(id);
String id = "ID2";
List<String> linkedResourcesID = Collections.singletonList(id);
XRefDocumentSearchCriteria criteria = new XRefDocumentSearchCriteria();
criteria.setLinkedRessourcesID(linkedRessourcesID);
criteria.setLinkedResourcesID(linkedResourcesID);
PaginatedList<XRefDocumentVO> documents = repository.find(criteria);
assertThat(documents).isNotNull().hasSize(2)
.flatExtracting("linkedRessourcesID")
.flatExtracting("linkedResourcesID")
.contains(id);
}
......
{
"transplant": {
"xref": {
"dynamic": "true",
"properties": {
"entry_type": {
"entryType": {
"type": "keyword"
},
"linkedRessourcesID": {
"linkedResourcesID": {
"type": "keyword"
}
}
......
......@@ -24,7 +24,7 @@ export const BASE_URL = 'faidare/v1';
providedIn: 'root'
})
export class GnpisService {
static URGI_SOURCE_URI = 'https://urgi.versailles.inra.fr';
static URGI_SOURCE_URI = 'https://urgi.versailles.inrae.fr';
sourceByURI$ = new ReplaySubject<Record<string, DataDiscoverySource>>(1);
sources$ = new ReplaySubject<DataDiscoverySource[]>(1);
......@@ -136,7 +136,7 @@ export class GnpisService {
}
xref(xrefId: string): Observable<XrefResponse> {
return this.http.get<XrefResponse>(`${BASE_URL}/xref/documentbyfulltextid?linkedRessourcesID=${xrefId}`);
return this.http.get<XrefResponse>(`${BASE_URL}/xref/documentbyfulltextid?linkedResourcesID=${xrefId}`);
}
// TODO Change the service's response to return an object with the number of results and handle here if the number is over the limit
......
......@@ -2,9 +2,9 @@ export interface XrefModel {
url: string;
description: string;
database_name: string;
entry_type: string;
db_version: string;
databaseName: string;
entryType: string;
identifier: string;
name: string;
}
......
......@@ -13,8 +13,8 @@
<ng-template let-crossRef>
<tr>
<td><a [href]="crossRef.url" target="_blank">{{ crossRef.name }}</a></td>
<td>{{ crossRef.database_name }}</td>
<td>{{ crossRef.entry_type }}</td>
<td>{{ crossRef.databaseName }}</td>
<td>{{ crossRef.entryType }}</td>
<td>{{ crossRef.description | slice:0:120 }}...</td>
</tr>
</ng-template>
......
......@@ -35,9 +35,9 @@ describe('XrefsComponent', () => {
url: 'https://urgi.versailles.inra.fr/association/association/viewer.do#results/analysisIds=1808038',
description: 'Col-Fa-b*_MLM+Q+K is a GWASd anté paneCol-Fa-b*_MLM+Q+K is aGAS anlysis involving CC_Qualité' +
'djs dsqdsq djsqpodsjqodsqdsqkpdqpdWOLOLOLOOOOOOOsqpkdsqkdsqkdsqdsdsqdsqdsqddsqffjùsodfusjùfsfsd',
database_name: 'GnpIS',
entry_type: 'GWAS analysis',
db_version: 'GWAS_ANALYSIS_1808038_1',
databaseName: 'GnpIS',
entryType: 'GWAS analysis',
identifier: 'GWAS_ANALYSIS_1808038_1',
name: 'Col-Fa-b*_MLM+Q+K'
}];
......@@ -64,8 +64,8 @@ describe('XrefsComponent', () => {
expect(tester.cardHeader).toContainText('Cross References');
expect(tester.columns[0]).toContainText(xref[0].name);
expect(tester.columns[1]).toContainText(xref[0].database_name);
expect(tester.columns[2]).toContainText(xref[0].entry_type);
expect(tester.columns[1]).toContainText(xref[0].databaseName);
expect(tester.columns[2]).toContainText(xref[0].entryType);
expect(tester.columns[3].textContent.length).toBeLessThanOrEqual(124);
}));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment