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

View File

@ -7,14 +7,15 @@ import java.util.Date;
public class RepositorySnippet {
// Do not refactor names to keep compatibility with external api.
private String id;
private String officialName;
private String englishName;
private String websiteUrl;
private String officialname;
private String englishname;
private String websiteurl;
private String typology;
private String registeredBy;
private String registeredby;
private Organization[] organizations;
private String registrationDate;
private String registrationdate;
private String logoUrl;
private String description;
private String fullTextDownload;
@ -35,36 +36,36 @@ public class RepositorySnippet {
this.id = id;
}
public String getOfficialName() {
return officialName;
public String getOfficialname() {
return officialname;
}
public void setOfficialName(String officialName) {
this.officialName = officialName;
public void setOfficialname(String officialname) {
this.officialname = officialname;
}
public String getEnglishName() {
return englishName;
public String getEnglishname() {
return englishname;
}
public void setEnglishName(String englishName) {
this.englishName = englishName;
public void setEnglishname(String englishname) {
this.englishname = englishname;
}
public String getWebsiteUrl() {
return websiteUrl;
public String getWebsiteurl() {
return websiteurl;
}
public void setWebsiteUrl(String websiteUrl) {
this.websiteUrl = websiteUrl;
public void setWebsiteurl(String websiteurl) {
this.websiteurl = websiteurl;
}
public String getRegisteredBy() {
return registeredBy;
public String getRegisteredby() {
return registeredby;
}
public void setRegisteredBy(String registeredBy) {
this.registeredBy = registeredBy;
public void setRegisteredby(String registeredby) {
this.registeredby = registeredby;
}
public String getTypology() {
@ -83,12 +84,12 @@ public class RepositorySnippet {
this.organizations = organizations;
}
public String getRegistrationDate() {
return registrationDate;
public String getRegistrationdate() {
return registrationdate;
}
public void setRegistrationDate(String registrationDate) {
this.registrationDate = registrationDate;
public void setRegistrationdate(String registrationdate) {
this.registrationdate = registrationdate;
}
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.Tuple;
import eu.dnetlib.repo.manager.domain.broker.*;
import org.apache.commons.lang.NotImplementedException;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -81,7 +82,7 @@ public class BrokerServiceImpl implements BrokerService {
long start = System.currentTimeMillis();
DatasourcesBroker ret = new DatasourcesBroker();
try {
ret.setDatasourcesOfUser(getDatasourcesOfUserType(repoAPI.getRepositoriesSnippetOfUser(user, "0", "100")));
ret.setDatasourcesOfUser(getDatasourcesOfUserType(repoAPI.getRepositoriesSnippetsOfUser(user, "0", "100")));
//TODO fix bug when values are true
// if (Boolean.parseBoolean(includeShared)) {
// List<String> sharedDatasourceIds = new ArrayList<String>();
@ -165,9 +166,9 @@ public class BrokerServiceImpl implements BrokerService {
List<Tuple<BrowseEntry, String>> entries = new ArrayList<>();
for (RepositorySnippet repo : repositories) {
BrowseEntry temp = new BrowseEntry();
temp.setValue(repo.getOfficialName());
temp.setValue(repo.getOfficialname());
temp.setSize(new Long(0));
for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialName())) {
for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialname())) {
temp.setSize(temp.getSize() + e.getSize());
}
Tuple<BrowseEntry, String> tup = new Tuple<>(temp, repo.getLogoUrl());
@ -245,8 +246,8 @@ public class BrokerServiceImpl implements BrokerService {
@Override
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUserByRepoId(String userEmail, String repoId) throws BrokerException {
Map<String, List<SimpleSubscriptionDesc>> subscriptionsOfUser = getSimpleSubscriptionsOfUser(userEmail);
return null;
throw new NotImplementedException();
// return null;
}
@Override

View File

@ -32,11 +32,11 @@ public class DashboardServiceImpl implements DashboardService {
try {
List<RepositorySnippet> repositoriesOfUser = repositoryService.getRepositoriesSnippetOfUser(userEmail, page, size);
List<RepositorySnippet> repositoriesOfUser = repositoryService.getRepositoriesSnippetsOfUser(userEmail, page, size);
for (RepositorySnippet repository : repositoriesOfUser) {
RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo();
repositorySummaryInfo.setId(repository.getId());
repositorySummaryInfo.setRepositoryName(repository.getOfficialName());
repositorySummaryInfo.setRepositoryName(repository.getOfficialname());
repositorySummaryInfo.setLogoURL(repository.getLogoUrl());
//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 {
List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialName());
List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialname());
Long totalEvents = 0L;
for (BrowseEntry browseEntry : events)
totalEvents += browseEntry.getSize();

View File

@ -35,9 +35,9 @@ public interface RepositoryService {
String page,
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;

View File

@ -351,13 +351,13 @@ public class RepositoryServiceImpl implements RepositoryService {
}
@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());
return getRepositoriesSnippets(new ArrayList<>(repoIds));
}
@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));
return getRepositoriesSnippets(new ArrayList<>(repoIds));
}

View File

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