Adds "source" property to Funders and Projects fetched from external sources.

This commit is contained in:
gkolokythas 2019-08-30 17:47:23 +03:00
parent a9a39db622
commit eb48edfb2d
10 changed files with 38 additions and 0 deletions

View File

@ -16,6 +16,7 @@ public class FunderBuilder extends Builder<Funder> {
private Date created;
private Date modified;
private Integer type;
private String source;
public FunderBuilder id(UUID id) {
this.id = id;
@ -57,6 +58,11 @@ public class FunderBuilder extends Builder<Funder> {
return this;
}
public FunderBuilder source(String source) {
this.source = source;
return this;
}
@Override
public Funder build() {
Funder funder = new Funder();
@ -68,6 +74,7 @@ public class FunderBuilder extends Builder<Funder> {
funder.setCreated(created);
funder.setModified(modified);
funder.setType(type);
funder.setSource(source);
return funder;
}
}

View File

@ -27,6 +27,7 @@ public class ProjectBuilder extends Builder<Project> {
private Date created;
private Date modified;
private String description;
private String source;
public ProjectBuilder id(UUID id) {
this.id = id;
@ -103,6 +104,11 @@ public class ProjectBuilder extends Builder<Project> {
return this;
}
public ProjectBuilder source(String source) {
this.source = source;
return this;
}
@Override
public Project build() {
Project project = new Project();
@ -120,6 +126,7 @@ public class ProjectBuilder extends Builder<Project> {
project.setReference(reference);
project.setCreationUser(creationUser);
project.setStartDate(startDate);
project.setSource(source);
return project;
}
}

View File

@ -41,6 +41,7 @@ public class FunderManager {
eu.eudat.models.data.funder.Funder funder = apiContext.getOperationsContext().getBuilderFactory().getBuilder(FunderBuilder.class)
.reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
.status(eu.eudat.data.entities.Funder.Status.fromInteger(0))
.source(externalListingItem.getSource())
.build();
funders.add(funder);

View File

@ -42,6 +42,7 @@ public class ProjectManager {
.reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
.description(externalListingItem.getDescription()).uri(externalListingItem.getUri())
.abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.entities.Project.Status.fromInteger(0))
.source(externalListingItem.getSource())
.build();
projects.add(project);

View File

@ -13,6 +13,7 @@ public class FundersExternalSourcesModel extends ExternalListingItem<FundersExte
model.setUri(item.get("uri"));
model.setName(item.get("name"));
model.setDescription(item.get("description"));
model.setSource(item.get("source"));
this.add(model);
}
return this;

View File

@ -12,6 +12,7 @@ public class ProjectsExternalSourcesModel extends ExternalListingItem<ProjectsEx
model.setUri(item.get("uri"));
model.setName(item.get("name"));
model.setDescription(item.get("description"));
model.setSource(item.get("source"));
this.add(model);
}
return this;

View File

@ -15,6 +15,7 @@ public class Funder implements DataModel<eu.eudat.data.entities.Funder, Funder>
private Date created;
private Date modified;
private Integer type;
private String source;
public UUID getId() {
return id;
@ -72,6 +73,13 @@ public class Funder implements DataModel<eu.eudat.data.entities.Funder, Funder>
this.type = type;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public Funder fromDataModel(eu.eudat.data.entities.Funder entity) {
this.id = entity.getId();
@ -82,6 +90,7 @@ public class Funder implements DataModel<eu.eudat.data.entities.Funder, Funder>
this.status = entity.getStatus();
this.created = entity.getCreated();
this.modified = entity.getModified();
this.source = "Internal";
return this;
}

View File

@ -28,6 +28,7 @@ public class Project implements DataModel<eu.eudat.data.entities.Project, Projec
private Date modified;
private String description;
private List<ContentFile> files;
private String source;
public UUID getId() {
return id;
@ -141,6 +142,13 @@ public class Project implements DataModel<eu.eudat.data.entities.Project, Projec
this.files = files;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public Project fromDataModel(eu.eudat.data.entities.Project entity) {
this.id = entity.getId();
@ -157,6 +165,7 @@ public class Project implements DataModel<eu.eudat.data.entities.Project, Projec
this.modified = entity.getModified();
this.description = entity.getDescription();
this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null));
this.source = "Internal";
return this;
}

View File

@ -51,6 +51,7 @@
<name>'name'</name>
<uri>'uri'</uri>
<description>'description'</description>
<source>'source'</source>
</fields>
</data>
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>

View File

@ -51,6 +51,7 @@
<name>'name'</name>
<uri>'uri'</uri>
<description>'description'</description>
<source>'source'</source>
</fields>
</data>
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>