restored RepositorySnippet field names

This commit is contained in:
Konstantinos Spyrou 2021-07-14 10:50:11 +00:00
parent d2c45c2db7
commit 443c936ce0
7 changed files with 50 additions and 48 deletions

View File

@ -65,7 +65,7 @@ public class RepositoryController {
@ResponseBody @ResponseBody
@PreAuthorize("hasAuthority('REGISTERED_USER')") @PreAuthorize("hasAuthority('REGISTERED_USER')")
public List<RepositorySnippet> getRepositoriesSnippetsOfUser() throws Exception { public List<RepositorySnippet> getRepositoriesSnippetsOfUser() throws Exception {
return repositoryService.getRepositoriesSnippetOfUser("0", "100"); return repositoryService.getRepositoriesSnippetsOfUser("0", "100");
} }
@RequestMapping(value = "/searchRegisteredRepositories/{page}/{size}", method = RequestMethod.GET, @RequestMapping(value = "/searchRegisteredRepositories/{page}/{size}", method = RequestMethod.GET,

View File

@ -7,14 +7,15 @@ import java.util.Date;
public class RepositorySnippet { public class RepositorySnippet {
// Do not refactor names to keep compatibility with external api.
private String id; private String id;
private String officialName; private String officialname;
private String englishName; private String englishname;
private String websiteUrl; private String websiteurl;
private String typology; private String typology;
private String registeredBy; private String registeredby;
private Organization[] organizations; private Organization[] organizations;
private String registrationDate; private String registrationdate;
private String logoUrl; private String logoUrl;
private String description; private String description;
private String fullTextDownload; private String fullTextDownload;
@ -35,36 +36,36 @@ public class RepositorySnippet {
this.id = id; this.id = id;
} }
public String getOfficialName() { public String getOfficialname() {
return officialName; return officialname;
} }
public void setOfficialName(String officialName) { public void setOfficialname(String officialname) {
this.officialName = officialName; this.officialname = officialname;
} }
public String getEnglishName() { public String getEnglishname() {
return englishName; return englishname;
} }
public void setEnglishName(String englishName) { public void setEnglishname(String englishname) {
this.englishName = englishName; this.englishname = englishname;
} }
public String getWebsiteUrl() { public String getWebsiteurl() {
return websiteUrl; return websiteurl;
} }
public void setWebsiteUrl(String websiteUrl) { public void setWebsiteurl(String websiteurl) {
this.websiteUrl = websiteUrl; this.websiteurl = websiteurl;
} }
public String getRegisteredBy() { public String getRegisteredby() {
return registeredBy; return registeredby;
} }
public void setRegisteredBy(String registeredBy) { public void setRegisteredby(String registeredby) {
this.registeredBy = registeredBy; this.registeredby = registeredby;
} }
public String getTypology() { public String getTypology() {
@ -83,12 +84,12 @@ public class RepositorySnippet {
this.organizations = organizations; this.organizations = organizations;
} }
public String getRegistrationDate() { public String getRegistrationdate() {
return registrationDate; return registrationdate;
} }
public void setRegistrationDate(String registrationDate) { public void setRegistrationdate(String registrationdate) {
this.registrationDate = registrationDate; this.registrationdate = registrationdate;
} }
public PiwikInfo getPiwikInfo() { public PiwikInfo getPiwikInfo() {

View File

@ -7,6 +7,7 @@ import eu.dnetlib.repo.manager.domain.RepositorySnippet;
import eu.dnetlib.repo.manager.domain.Term; import eu.dnetlib.repo.manager.domain.Term;
import eu.dnetlib.repo.manager.domain.Tuple; import eu.dnetlib.repo.manager.domain.Tuple;
import eu.dnetlib.repo.manager.domain.broker.*; import eu.dnetlib.repo.manager.domain.broker.*;
import org.apache.commons.lang.NotImplementedException;
import org.json.JSONException; import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -81,7 +82,7 @@ public class BrokerServiceImpl implements BrokerService {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
DatasourcesBroker ret = new DatasourcesBroker(); DatasourcesBroker ret = new DatasourcesBroker();
try { try {
ret.setDatasourcesOfUser(getDatasourcesOfUserType(repoAPI.getRepositoriesSnippetOfUser(user, "0", "100"))); ret.setDatasourcesOfUser(getDatasourcesOfUserType(repoAPI.getRepositoriesSnippetsOfUser(user, "0", "100")));
//TODO fix bug when values are true //TODO fix bug when values are true
// if (Boolean.parseBoolean(includeShared)) { // if (Boolean.parseBoolean(includeShared)) {
// List<String> sharedDatasourceIds = new ArrayList<String>(); // List<String> sharedDatasourceIds = new ArrayList<String>();
@ -165,9 +166,9 @@ public class BrokerServiceImpl implements BrokerService {
List<Tuple<BrowseEntry, String>> entries = new ArrayList<>(); List<Tuple<BrowseEntry, String>> entries = new ArrayList<>();
for (RepositorySnippet repo : repositories) { for (RepositorySnippet repo : repositories) {
BrowseEntry temp = new BrowseEntry(); BrowseEntry temp = new BrowseEntry();
temp.setValue(repo.getOfficialName()); temp.setValue(repo.getOfficialname());
temp.setSize(new Long(0)); temp.setSize(new Long(0));
for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialName())) { for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialname())) {
temp.setSize(temp.getSize() + e.getSize()); temp.setSize(temp.getSize() + e.getSize());
} }
Tuple<BrowseEntry, String> tup = new Tuple<>(temp, repo.getLogoUrl()); Tuple<BrowseEntry, String> tup = new Tuple<>(temp, repo.getLogoUrl());
@ -245,8 +246,8 @@ public class BrokerServiceImpl implements BrokerService {
@Override @Override
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUserByRepoId(String userEmail, String repoId) throws BrokerException { public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUserByRepoId(String userEmail, String repoId) throws BrokerException {
Map<String, List<SimpleSubscriptionDesc>> subscriptionsOfUser = getSimpleSubscriptionsOfUser(userEmail); Map<String, List<SimpleSubscriptionDesc>> subscriptionsOfUser = getSimpleSubscriptionsOfUser(userEmail);
throw new NotImplementedException();
return null; // return null;
} }
@Override @Override

View File

@ -32,11 +32,11 @@ public class DashboardServiceImpl implements DashboardService {
try { try {
List<RepositorySnippet> repositoriesOfUser = repositoryService.getRepositoriesSnippetOfUser(userEmail, page, size); List<RepositorySnippet> repositoriesOfUser = repositoryService.getRepositoriesSnippetsOfUser(userEmail, page, size);
for (RepositorySnippet repository : repositoriesOfUser) { for (RepositorySnippet repository : repositoriesOfUser) {
RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo(); RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo();
repositorySummaryInfo.setId(repository.getId()); repositorySummaryInfo.setId(repository.getId());
repositorySummaryInfo.setRepositoryName(repository.getOfficialName()); repositorySummaryInfo.setRepositoryName(repository.getOfficialname());
repositorySummaryInfo.setLogoURL(repository.getLogoUrl()); repositorySummaryInfo.setLogoURL(repository.getLogoUrl());
//TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there? //TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there?
@ -65,7 +65,7 @@ public class DashboardServiceImpl implements DashboardService {
try { try {
List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialName()); List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialname());
Long totalEvents = 0L; Long totalEvents = 0L;
for (BrowseEntry browseEntry : events) for (BrowseEntry browseEntry : events)
totalEvents += browseEntry.getSize(); totalEvents += browseEntry.getSize();

View File

@ -35,9 +35,9 @@ public interface RepositoryService {
String page, String page,
String size) throws JSONException, IOException; String size) throws JSONException, IOException;
List<RepositorySnippet> getRepositoriesSnippetOfUser(String page, String size) throws Exception; List<RepositorySnippet> getRepositoriesSnippetsOfUser(String page, String size) throws Exception;
List<RepositorySnippet> getRepositoriesSnippetOfUser(String userEmail, String page, String size) throws Exception; List<RepositorySnippet> getRepositoriesSnippetsOfUser(String userEmail, String page, String size) throws Exception;
RepositorySnippet getRepositorySnippetById(String id) throws JSONException, ResourceNotFoundException; RepositorySnippet getRepositorySnippetById(String id) throws JSONException, ResourceNotFoundException;

View File

@ -351,13 +351,13 @@ public class RepositoryServiceImpl implements RepositoryService {
} }
@Override @Override
public List<RepositorySnippet> getRepositoriesSnippetOfUser(String page, String size) throws Exception { public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String page, String size) throws Exception {
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles()); Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
return getRepositoriesSnippets(new ArrayList<>(repoIds)); return getRepositoriesSnippets(new ArrayList<>(repoIds));
} }
@Override @Override
public List<RepositorySnippet> getRepositoriesSnippetOfUser(String userEmail, String page, String size) throws Exception { public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String userEmail, String page, String size) throws Exception {
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail)); Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail));
return getRepositoriesSnippets(new ArrayList<>(repoIds)); return getRepositoriesSnippets(new ArrayList<>(repoIds));
} }

View File

@ -156,19 +156,19 @@ public class Converter {
repositorySnippet.setId(repositorySnippetObject.get("id").toString()); repositorySnippet.setId(repositorySnippetObject.get("id").toString());
repositorySnippet.setOfficialName(repositorySnippetObject.get("officialname").toString()); repositorySnippet.setOfficialname(repositorySnippetObject.get("officialname").toString());
repositorySnippet.setEnglishName(repositorySnippetObject.get("englishname").toString()); repositorySnippet.setEnglishname(repositorySnippetObject.get("englishname").toString());
if (repositorySnippet.getEnglishName().equals("null")) if (repositorySnippet.getEnglishname().equals("null"))
repositorySnippet.setEnglishName(""); repositorySnippet.setEnglishname("");
repositorySnippet.setWebsiteUrl(repositorySnippetObject.get("websiteurl").toString()); repositorySnippet.setWebsiteurl(repositorySnippetObject.get("websiteurl").toString());
if (repositorySnippet.getWebsiteUrl().equals("null")) if (repositorySnippet.getWebsiteurl().equals("null"))
repositorySnippet.setWebsiteUrl(""); repositorySnippet.setWebsiteurl("");
repositorySnippet.setRegisteredBy(repositorySnippetObject.get("registeredby").toString()); repositorySnippet.setRegisteredby(repositorySnippetObject.get("registeredby").toString());
if (repositorySnippet.getRegisteredBy().equals("null")) if (repositorySnippet.getRegisteredby().equals("null"))
repositorySnippet.setRegisteredBy(""); repositorySnippet.setRegisteredby("");
return repositorySnippet; return repositorySnippet;
} }