Commit 3aa7dc04 authored by Georgios Kolokythas's avatar Georgios Kolokythas
Browse files

Refactors Funder, Grant and Project external fetching by adding distinct...

Refactors Funder, Grant and Project external fetching by adding distinct values for key, indicating the source it was fetched, and it's respected display value.
parent ff9aa140
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ public class FunderBuilder extends Builder<Funder> {
	private Date modified;
	private Integer type;
	private String source;
	private String key;

	public FunderBuilder id(UUID id) {
		this.id = id;
@@ -63,6 +64,11 @@ public class FunderBuilder extends Builder<Funder> {
		return this;
	}

	public FunderBuilder key(String key) {
		this.key = key;
		return this;
	}

	@Override
	public Funder build() {
		Funder funder = new Funder();
@@ -75,6 +81,7 @@ public class FunderBuilder extends Builder<Funder> {
		funder.setModified(modified);
		funder.setType(type);
		funder.setSource(source);
		funder.setKey(key);
		return funder;
	}
}
+8 −3
Original line number Diff line number Diff line
@@ -9,9 +9,6 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * Created by ikalyvas on 2/15/2018.
 */
public class GrantBuilder extends Builder<Grant> {

    private UUID id;
@@ -44,6 +41,8 @@ public class GrantBuilder extends Builder<Grant> {

    private String source;

    private String key;

    public GrantBuilder id(UUID id) {
        this.id = id;
        return this;
@@ -119,6 +118,11 @@ public class GrantBuilder extends Builder<Grant> {
        return this;
    }

    public GrantBuilder key(String key) {
        this.key = key;
        return this;
    }

    @Override
    public Grant build() {
        Grant grant = new Grant();
@@ -137,6 +141,7 @@ public class GrantBuilder extends Builder<Grant> {
        grant.setCreationUser(creationUser);
        grant.setStartDate(startDate);
        grant.setSource(source);
        grant.setKey(key);
        return grant;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ public class ProjectBuilder extends Builder<Project> {
	private Date modified;
	private String description;
	private String source;
	private String key;

	public ProjectBuilder id(UUID id) {
		this.id = id;
@@ -109,6 +110,11 @@ public class ProjectBuilder extends Builder<Project> {
		return this;
	}

	public ProjectBuilder key(String key) {
		this.key = key;
		return this;
	}

	@Override
	public Project build() {
		Project project = new Project();
@@ -127,6 +133,7 @@ public class ProjectBuilder extends Builder<Project> {
		project.setCreationUser(creationUser);
		project.setStartDate(startDate);
		project.setSource(source);
		project.setKey(key);
		return project;
	}
}
+3 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ package eu.eudat.logic.managers;
import eu.eudat.data.query.items.item.funder.FunderCriteriaRequest;
import eu.eudat.logic.builders.model.models.FunderBuilder;
import eu.eudat.logic.proxy.config.ExternalUrlCriteria;
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
@@ -47,6 +48,8 @@ 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))
					.key(externalListingItem.getKey())
					.source(externalListingItem.getTag())
					.build();
			if (externalListingItem.getSource() != null) {
				funder.setSource(externalListingItem.getSource());
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public class GrantManager {
            eu.eudat.models.data.grant.Grant grant = apiContext.getOperationsContext().getBuilderFactory().getBuilder(GrantBuilder.class)
                    .reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
                    .description(externalListingItem.getDescription()).uri(externalListingItem.getUri())
                    .key(externalListingItem.getKey())
                    .abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.entities.Grant.Status.fromInteger(0))
                    .source(externalListingItem.getTag())
                    .build();
Loading