Adds "source" property to Grants fetched from external sources.
This commit is contained in:
parent
1bd789b924
commit
9281864a70
|
@ -42,6 +42,8 @@ public class GrantBuilder extends Builder<Grant> {
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
private String source;
|
||||||
|
|
||||||
public GrantBuilder id(UUID id) {
|
public GrantBuilder id(UUID id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
return this;
|
return this;
|
||||||
|
@ -112,6 +114,11 @@ public class GrantBuilder extends Builder<Grant> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GrantBuilder source(String source) {
|
||||||
|
this.source = source;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Grant build() {
|
public Grant build() {
|
||||||
Grant grant = new Grant();
|
Grant grant = new Grant();
|
||||||
|
@ -129,6 +136,7 @@ public class GrantBuilder extends Builder<Grant> {
|
||||||
grant.setReference(reference);
|
grant.setReference(reference);
|
||||||
grant.setCreationUser(creationUser);
|
grant.setCreationUser(creationUser);
|
||||||
grant.setStartDate(startDate);
|
grant.setStartDate(startDate);
|
||||||
|
grant.setSource(source);
|
||||||
return grant;
|
return grant;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,7 @@ public class GrantManager {
|
||||||
.reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
|
.reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
|
||||||
.description(externalListingItem.getDescription()).uri(externalListingItem.getUri())
|
.description(externalListingItem.getDescription()).uri(externalListingItem.getUri())
|
||||||
.abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.entities.Grant.Status.fromInteger(0))
|
.abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.entities.Grant.Status.fromInteger(0))
|
||||||
|
.source(externalListingItem.getSource())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
grants.add(grant);
|
grants.add(grant);
|
||||||
|
|
|
@ -10,6 +10,7 @@ public class DataFieldsUrlConfiguration {
|
||||||
private String name;
|
private String name;
|
||||||
private String uri;
|
private String uri;
|
||||||
private String description;
|
private String description;
|
||||||
|
private String source;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -47,4 +48,13 @@ public class DataFieldsUrlConfiguration {
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "source")
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,8 @@ public class RemoteFetcher {
|
||||||
DocumentContext jsonContext = JsonPath.parse(con.getInputStream());
|
DocumentContext jsonContext = JsonPath.parse(con.getInputStream());
|
||||||
Results results = new Results(jsonContext.read(jsonDataPath.getPath()
|
Results results = new Results(jsonContext.read(jsonDataPath.getPath()
|
||||||
+ "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription()
|
+ "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription()
|
||||||
+ "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId() + "]"),
|
+ "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId()
|
||||||
|
+ "," + jsonDataPath.getFieldsUrlConfiguration().getSource() + "]"),
|
||||||
jsonContext.read(jsonPaginationPath));
|
jsonContext.read(jsonPaginationPath));
|
||||||
results.results = results.results.stream().map(e -> e.entrySet().stream().collect(Collectors.toMap(x -> this.transformKey(jsonDataPath,x.getKey()), Map.Entry::getValue)))
|
results.results = results.results.stream().map(e -> e.entrySet().stream().collect(Collectors.toMap(x -> this.transformKey(jsonDataPath,x.getKey()), Map.Entry::getValue)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -219,6 +220,7 @@ public class RemoteFetcher {
|
||||||
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getDescription().replace("'",""))) return "description";
|
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getDescription().replace("'",""))) return "description";
|
||||||
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getUri().replace("'",""))) return "uri";
|
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getUri().replace("'",""))) return "uri";
|
||||||
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getName().replace("'",""))) return "name";
|
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getName().replace("'",""))) return "name";
|
||||||
|
if (key.equals(dataUrlConfiguration.getFieldsUrlConfiguration().getSource().replace("'",""))) return "source";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ExternalSourcesItemModel {
|
||||||
private String remoteId;
|
private String remoteId;
|
||||||
private String abbreviation;
|
private String abbreviation;
|
||||||
private String tag;
|
private String tag;
|
||||||
|
private String source;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -65,4 +66,12 @@ public class ExternalSourcesItemModel {
|
||||||
public void setTag(String tag) {
|
public void setTag(String tag) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ public class GrantsExternalSourcesModel extends ExternalListingItem<GrantsExtern
|
||||||
model.setUri(item.get("uri"));
|
model.setUri(item.get("uri"));
|
||||||
model.setName(item.get("name"));
|
model.setName(item.get("name"));
|
||||||
model.setDescription(item.get("description"));
|
model.setDescription(item.get("description"));
|
||||||
|
model.setSource(item.get("source"));
|
||||||
this.add(model);
|
this.add(model);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class Grant implements DataModel<eu.eudat.data.entities.Grant, Grant> {
|
||||||
private String description;
|
private String description;
|
||||||
private List<ContentFile> files;
|
private List<ContentFile> files;
|
||||||
private UUID funderId;
|
private UUID funderId;
|
||||||
|
private String source;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -151,6 +152,13 @@ public class Grant implements DataModel<eu.eudat.data.entities.Grant, Grant> {
|
||||||
this.funderId = funderId;
|
this.funderId = funderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Grant fromDataModel(eu.eudat.data.entities.Grant entity) {
|
public Grant fromDataModel(eu.eudat.data.entities.Grant entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
<name>'name'</name>
|
<name>'name'</name>
|
||||||
<uri>'uri'</uri>
|
<uri>'uri'</uri>
|
||||||
<description>'description'</description>
|
<description>'description'</description>
|
||||||
|
<source>'source'</source>
|
||||||
</fields>
|
</fields>
|
||||||
</data>
|
</data>
|
||||||
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
|
Loading…
Reference in New Issue