Revision 40801
Added by Nikon Gasparis over 8 years ago
modules/uoa-repository-manager-gui/trunk/src/main/java/eu/dnetlib/repo/manager/server/RepositoryServiceImpl.java | ||
---|---|---|
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
@Override |
92 |
public Repository getRepository(String repoId, String officialName) throws RepositoryServiceException {
|
|
92 |
public DatasourcesCollection getRepositoriesOfUser(String userEmail, boolean includeShared, boolean includeByOthers) throws RepositoryServiceException {
|
|
93 | 93 |
try { |
94 |
LOGGER.debug("Getting repository with id: " + repoId + " and name: " + officialName); |
|
94 |
LOGGER.debug("Getting repositories of user: " + userEmail + " . IncludeShared: " + includeShared + " . IncludeByOthers: " + includeByOthers); |
|
95 |
DatasourcesCollection retDatasources = new DatasourcesCollection(); |
|
96 |
retDatasources.setDatasourcesOfUser(this.repoAPI.getRepos(userEmail, false)); |
|
97 |
if (includeShared) { |
|
98 |
//TODO create dao to save-get shared datasourcesIDs |
|
99 |
List<String> sharedDatasourceIds = new ArrayList<String>(); |
|
100 |
retDatasources.setSharedDatasources(this.repoAPI.getReposByIds(sharedDatasourceIds)); |
|
101 |
} |
|
95 | 102 |
|
96 |
Repository repo = this.repoAPI.getRepository(officialName, repoId); |
|
103 |
if (includeByOthers) |
|
104 |
retDatasources.setDatasourcesOfUser(this.repoAPI.getRepos(userEmail, true)); |
|
105 |
|
|
106 |
return retDatasources; |
|
107 |
|
|
108 |
} catch (Exception e) { |
|
109 |
LOGGER.error("Error while getting repositories of user: " + userEmail + " . IncludeShared: " + includeShared + " . IncludeByOthers: " + includeByOthers, e); |
|
110 |
if (e instanceof RepositoryServiceException) { |
|
111 |
throw (RepositoryServiceException) e; |
|
112 |
} else { |
|
113 |
emailUtils.reportException(e); |
|
114 |
throw new RepositoryServiceException("login.generalError", RepositoryServiceException.ErrorCode.GENERAL_ERROR); |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public Repository getRepository(String repoId) throws RepositoryServiceException { |
|
121 |
try { |
|
122 |
LOGGER.debug("Getting repository with id: " + repoId); |
|
123 |
|
|
124 |
Repository repo = this.repoAPI.getRepository(repoId); |
|
97 | 125 |
if (repo == null) { |
98 | 126 |
throw new RepositoryServiceException("registration.repositoryNotExists", RepositoryServiceException.ErrorCode.REPOSITORY_NOT_EXISTS); |
99 | 127 |
} |
100 | 128 |
return repo; |
101 | 129 |
|
102 | 130 |
} catch (Exception e) { |
103 |
LOGGER.error("Error while getting repository with id: " + repoId + " and name: " + officialName, e);
|
|
131 |
LOGGER.error("Error while getting repository with id: " + repoId, e); |
|
104 | 132 |
if (e instanceof RepositoryServiceException) { |
105 | 133 |
throw (RepositoryServiceException) e; |
106 | 134 |
} else { |
modules/uoa-repository-manager-gui/trunk/src/main/java/eu/dnetlib/repo/manager/shared/DatasourcesCollection.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.shared; |
|
2 |
|
|
3 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
4 |
import eu.dnetlib.domain.data.Repository; |
|
5 |
|
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.List; |
|
8 |
|
|
9 |
/** |
|
10 |
* Created by nikonas on 14/1/16. |
|
11 |
*/ |
|
12 |
public class DatasourcesCollection implements IsSerializable{ |
|
13 |
|
|
14 |
private List<Repository> datasourcesOfUser; |
|
15 |
private List<Repository> sharedDatasources; |
|
16 |
private List<Repository> datasourcesOfOthers; |
|
17 |
|
|
18 |
public DatasourcesCollection() { |
|
19 |
this.datasourcesOfOthers = new ArrayList<Repository>(); |
|
20 |
this.datasourcesOfUser = new ArrayList<Repository>(); |
|
21 |
this.datasourcesOfOthers = new ArrayList<Repository>(); |
|
22 |
} |
|
23 |
|
|
24 |
public List<Repository> getDatasourcesOfUser() { |
|
25 |
return datasourcesOfUser; |
|
26 |
} |
|
27 |
|
|
28 |
public void setDatasourcesOfUser(List<Repository> datasourcesOfUser) { |
|
29 |
this.datasourcesOfUser = datasourcesOfUser; |
|
30 |
} |
|
31 |
|
|
32 |
public List<Repository> getDatasourcesOfOthers() { |
|
33 |
return datasourcesOfOthers; |
|
34 |
} |
|
35 |
|
|
36 |
public void setDatasourcesOfOthers(List<Repository> datasourcesOfOthers) { |
|
37 |
this.datasourcesOfOthers = datasourcesOfOthers; |
|
38 |
} |
|
39 |
|
|
40 |
public List<Repository> getSharedDatasources() { |
|
41 |
return sharedDatasources; |
|
42 |
} |
|
43 |
|
|
44 |
public void setSharedDatasources(List<Repository> sharedDatasources) { |
|
45 |
this.sharedDatasources = sharedDatasources; |
|
46 |
} |
|
47 |
} |
modules/uoa-repository-manager-gui/trunk/src/main/java/eu/dnetlib/repo/manager/client/RepositoryService.java | ||
---|---|---|
3 | 3 |
import com.google.gwt.user.client.rpc.RemoteService; |
4 | 4 |
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; |
5 | 5 |
import eu.dnetlib.domain.data.Repository; |
6 |
import eu.dnetlib.repo.manager.shared.Timezone; |
|
7 |
import eu.dnetlib.repo.manager.shared.RepositoryServiceException; |
|
8 |
import eu.dnetlib.repo.manager.shared.Tuple; |
|
9 |
import eu.dnetlib.repo.manager.shared.DatasourceVocabularies; |
|
6 |
import eu.dnetlib.repo.manager.shared.*; |
|
10 | 7 |
|
11 | 8 |
import java.util.List; |
12 | 9 |
import java.util.Map; |
... | ... | |
19 | 16 |
|
20 | 17 |
Tuple<List<Repository>, List<Repository>> getRepositoriesByCountry(String country, String mode, boolean includeUnknownCountries) throws RepositoryServiceException; |
21 | 18 |
|
22 |
Repository getRepository(String repoId, String officialName) throws RepositoryServiceException;
|
|
19 |
Repository getRepository(String repoId) throws RepositoryServiceException; |
|
23 | 20 |
|
24 | 21 |
Map<String, String> getCountries(Boolean existingOnly, String mode) throws RepositoryServiceException; |
25 | 22 |
|
... | ... | |
41 | 38 |
|
42 | 39 |
List<Repository> getRepositoriesByCountry(String country, String mode) throws RepositoryServiceException; |
43 | 40 |
|
41 |
DatasourcesCollection getRepositoriesOfUser(String userEmail, boolean includeShared, boolean includeByOthers) throws RepositoryServiceException; |
|
42 |
|
|
44 | 43 |
} |
modules/uoa-repository-manager-gui/trunk/src/main/java/eu/dnetlib/repo/manager/client/datasources/utils/SelectRepositoryWidget.java | ||
---|---|---|
244 | 244 |
} |
245 | 245 |
|
246 | 246 |
final RadioButton radioButton; |
247 |
if(repository.getRegistered()) {
|
|
247 |
if(repository.isRegistered()) {
|
|
248 | 248 |
radioButton = new RadioButton("repository", repositoryName + |
249 | 249 |
"<span class=\"label label-warning registeredLabel\">Registered</span>" + |
250 | 250 |
"<a target=\"_blank\" href=\"" + repository.getWebsiteUrl() + "\"><i class=\"fa " + |
Also available in: Unified diff
updated getRepository to need an id only.
added method to get Datasources of user