Project

General

Profile

« Previous | Next » 

Revision 50845

1. Fix new dev api
2. Fix bugs on validator / broker / piwik api.
3. JSON changes on convert file for dev api
4. Add new class RequestFilter on utils package for search queries.

View differences:

modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/utils/Converter.java
1 1
package eu.dnetlib.repo.manager.service.utils;
2 2

  
3
import com.fasterxml.jackson.core.JsonProcessingException;
3 4
import com.fasterxml.jackson.databind.ObjectMapper;
4 5
import eu.dnetlib.domain.data.Repository;
5 6
import eu.dnetlib.domain.data.RepositoryInterface;
......
21 22
    public static Repository jsonToRepositoryObject(JSONObject repositoryObject) throws JSONException {
22 23

  
23 24
        Repository repository = new Repository();
24

  
25

  
26
        LOGGER.debug("datasource response -> " + repositoryObject);
25
        
27 26
        JSONObject datasource = repositoryObject.getJSONObject("datasource");
28 27

  
29 28
        if( datasource.equals(null))
......
97 96
        repository.setDatasourceClass(datasource.get("typology").toString());
98 97

  
99 98
        //TODO change organization to list
100
        repository.setOrganization( ((JSONArray)datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
101
        String countryCode = ((JSONArray)datasource.get("organizations")).getJSONObject(0).get("country").toString();
102
        repository.setCountryCode(countryCode);
99
        JSONArray organizations = ((JSONArray)datasource.get("organizations"));
100
        if(organizations.length() != 0) {
101
            repository.setOrganization(((JSONArray) datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
102
            String countryCode = ((JSONArray) datasource.get("organizations")).getJSONObject(0).get("country").toString();
103
            repository.setCountryCode(countryCode);
104
        }
103 105

  
104

  
106
        
105 107
        String collectedFrom = datasource.get("collectedfrom").toString();
106 108
        //TODO check data consistency
107 109
        String type = "UNKNOWN";
......
300 302
        return list;
301 303
    }
302 304

  
303
    public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject repositoryObject) throws JSONException {
305
    public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject datasourceInfo) throws JSONException {
304 306

  
305
       /* if( repositoryObject.get("aggregationHistory").toString().equals("[]") ||
306
                repositoryObject.get("aggregationHistory")!= null)
307
            return null;*/
308
       if(repositoryObject.get("aggregationHistory").toString().equals("[]"))
307

  
308
       if(datasourceInfo.get("aggregationHistory").toString().equals("[]"))
309 309
           return null;
310 310

  
311

  
312
        JSONArray rs = new JSONArray(repositoryObject.get("aggregationHistory").toString());
313

  
314
        LOGGER.debug(rs.length());
315

  
311
        JSONArray rs = new JSONArray(datasourceInfo.get("aggregationHistory").toString());
316 312
        List<AggregationDetails> aggregationDetailsList = new ArrayList<>();
317 313
        for(int i=0;i<rs.length();i++)
318 314
            aggregationDetailsList.add(jsonToAggregationDetails(rs.getJSONObject(i)));
......
331 327
        return aggregationDetails;
332 328
    }
333 329

  
334
    public static AggregationDetails getLastCollectionFromJson(JSONObject repositoryObject) throws JSONException {
330
    public static AggregationDetails getLastCollectionFromJson(JSONObject datasourceInfo) throws JSONException {
335 331

  
336
        if( repositoryObject.get("lastCollection").equals(null))
332
        if( datasourceInfo.get("lastCollection").equals(null))
337 333
            return null;
338 334

  
339
        return jsonToAggregationDetails(repositoryObject.getJSONObject("lastCollection"));
335
        return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastCollection"));
340 336
    }
341 337

  
342
    public static AggregationDetails getLastTransformationFromJson(JSONObject repositoryObject) throws JSONException {
338
    public static AggregationDetails getLastTransformationFromJson(JSONObject datasourceInfo) throws JSONException {
343 339

  
344
        if( repositoryObject.get("lastTransformation").equals(null))
340
        if( datasourceInfo.get("lastTransformation").equals(null))
345 341
            return null;
346 342

  
347
        return jsonToAggregationDetails(repositoryObject.getJSONObject("lastTransformation"));
343
        return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastTransformation"));
348 344
    }
349 345

  
350 346
    public static List<Timezone> toTimezones(List<String> timezones) {
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/utils/EmailUtils.java
1
package eu.dnetlib.repo.manager.service.utils;
2

  
3
import eu.dnetlib.domain.data.PiwikInfo;
4
import eu.dnetlib.domain.functionality.UserProfile;
5

  
6
public interface EmailUtils {
7

  
8

  
9
    void reportException(Exception exception);
10

  
11
    void sendAdministratorRequestToEnableMetrics(PiwikInfo piwikInfo) throws Exception;
12

  
13
    void sendUserRequestToEnableMetrics(PiwikInfo piwikInfo) throws Exception;
14

  
15
    void sendAdministratorMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
16

  
17
    void sendUserMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
18
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/utils/EmailUtilsImpl.java
1
package eu.dnetlib.repo.manager.service.utils;
2

  
3
import eu.dnetlib.domain.data.PiwikInfo;
4
import eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader;
5
import eu.dnetlib.utils.MailLibrary;
6
import org.apache.log4j.Logger;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.beans.factory.annotation.Value;
9
import org.springframework.stereotype.Component;
10

  
11
import java.io.PrintWriter;
12
import java.io.StringWriter;
13
import java.io.Writer;
14
import java.util.ArrayList;
15
import java.util.List;
16

  
17

  
18
@Component
19
public class EmailUtilsImpl implements EmailUtils {
20

  
21
    private static Logger LOGGER = Logger.getLogger(EmailUtilsImpl.class);
22

  
23
    private List<String> specialRecipients = new ArrayList<String>();
24
    private boolean override = false, logonly = false;
25
    private String overrideEmail = null, from = null;
26

  
27
    @Autowired
28
    private MailLibrary mailLibrary;
29

  
30
    @Autowired
31
    private CascadingPropertyLoader pLoader;
32

  
33
    @Value("${services.repo-manager.baseUrl}")
34
    private String baseUrl;
35

  
36
    @Value("${services.repo-manager.adminEmail}")
37
    private String adminEmail;
38

  
39
    @Value("${services.repomanager.usagestats.adminEmail}")
40
    private String usageStatsAdminEmail;
41

  
42

  
43
    @Override
44
    public void reportException(Exception exception) {
45
        Writer writer = new StringWriter();
46
        PrintWriter printWriter = new PrintWriter(writer);
47
        exception.printStackTrace(printWriter);
48

  
49
        List<String> recipients = new ArrayList<String>();
50

  
51
        try {
52
            recipients.add(this.adminEmail);
53
            String message = "An exception has occurred:\n"+writer.toString();
54
            String subject = "Automatic Bug Report";
55
            this.sendMail(recipients, subject, message, false, null);
56
        } catch (Exception e) {
57
            LOGGER.error("Error sending error report", e);
58
        }
59
    }
60

  
61
    @Override
62
    public void sendAdministratorRequestToEnableMetrics(PiwikInfo piwikInfo) throws Exception {
63

  
64
        try {
65
            String subject = "[OpenAIRE-Usage Statistics] New request to enable usage statistics";
66

  
67
            String message = "Dear administrator,\n" +
68
                    "\n" +
69
                    "we have received a request to enable the OpenAIRE usage statistics for the following repository \n" +
70
                    "\n" +
71
                    "Repository - " + piwikInfo.getRepositoryName() + ", " + piwikInfo.getCountry() + " (" + piwikInfo.getRepositoryId() + ")\n" +
72
                    "Requestor - " + piwikInfo.getRequestorName() + ", " + piwikInfo.getRequestorEmail() + "\n" +
73
                    "Piwik ID - " + piwikInfo.getSiteId() + "\n" +
74
                    "Authentication token - " + piwikInfo.getAuthenticationToken() + "\n" +
75
                    "\n" +
76
                    "For more information about this request, go here: \n" +
77
                    this.baseUrl + "/#admin/metrics\n" +
78
                    "\n" +
79
                    "Best,\n" +
80
                    "The OpenAIRE team";
81

  
82
            this.sendMail(this.usageStatsAdminEmail, subject, message, false, null);
83

  
84
        } catch (Exception e) {
85
            LOGGER.error("Error while sending request to enable metrics email to administrator: " + this.usageStatsAdminEmail, e);
86
            throw e;
87
        }
88
    }
89

  
90
    @Override
91
    public void sendUserRequestToEnableMetrics(PiwikInfo piwikInfo) throws Exception {
92

  
93
        try {
94
            String subject = "[OpenAIRE-Usage Statistics] Your request to enable usage statistics";
95

  
96
            String message = "Dear " + piwikInfo.getRequestorName() + ",\n" +
97
                    "\n" +
98
                    "we have received your request to enable the OpenAIRE usage statistics for your repository\n" +
99
                    "\n" +
100
                    "Repository - " + piwikInfo.getRepositoryName() + ", " + piwikInfo.getCountry() + " (" + piwikInfo.getRepositoryId() + ")\n" +
101
                    "Piwik ID - " + piwikInfo.getSiteId() + "\n" +
102
                    "Authentication token - " + piwikInfo.getAuthenticationToken() + "\n" +
103
                    "\n" +
104
                    "In order to enable the usage statistics, you must install the OpenAIRE's tracking code in your repository software. " +
105
                    "OpenAIRE's usage statistics service tracking code is maintained on Github as a patch for various versions of DSpace " +
106
                    "(https://github.com/openaire/OpenAIRE-Piwik-DSpace) and as an Eprints plugin for version 3 " +
107
                    "(https://github.com/openaire/EPrints-OAPiwik). In case the platform is different from DSpace or EPrints please contact " +
108
                    "the OpenAIRE team in repositoryusagestats@openaire.eu in order to find a solution.\n" +
109
                    "\n" +
110
                    "For more information about your request and configuration details, go here: \n" +
111
                    this.baseUrl + "/#getImpact/instructions/" + piwikInfo.getRepositoryId() + "\n" +
112
                    "\n" +
113
                    "Once you have finished configuring your repository or if you have any questions, please notify the OpenAIRE team by sending \n" +
114
                    "an email to repositoryusagestats@openaire.eu\n" +
115
                    "\n" +
116
                    "Best,\n" +
117
                    "The OpenAIRE team";
118

  
119
            this.sendMail(piwikInfo.getRequestorEmail(), subject, message, false, null);
120

  
121
        } catch (Exception e) {
122
            LOGGER.error("Error while sending request to enable metrics email to user: " + piwikInfo.getRequestorEmail(), e);
123
            throw e;
124
        }
125
    }
126

  
127
    @Override
128
    public void sendAdministratorMetricsEnabled(PiwikInfo piwikInfo) throws Exception {
129

  
130
        try {
131
            String subject = "[OpenAIRE-Usage Statistics] Usage statistics have been enabled";
132

  
133
            String message = "Dear administrator,\n" +
134
                    "\n" +
135
                    "The installation and configuration of OpenAIRE's tracking code for the following repository " +
136
                    "has been completed and validated and the usage statistics have been enabled in OpenAIRE.\n" +
137
                    "\n" +
138
                    "Repository - " + piwikInfo.getRepositoryName() + ", " + piwikInfo.getCountry() + " (" + piwikInfo.getRepositoryId() + ")\n" +
139
                    "Requestor - " + piwikInfo.getRequestorName() + ", " + piwikInfo.getRequestorEmail() + "\n" +
140
                    "Piwik ID - " + piwikInfo.getSiteId() + "\n" +
141
                    "Authentication token - " + piwikInfo.getAuthenticationToken() + "\n" +
142
                    "\n" +
143
                    "Best,\n" +
144
                    "The OpenAIRE team";
145

  
146
            this.sendMail(piwikInfo.getRequestorEmail(), subject, message, false, null);
147

  
148
        } catch (Exception e) {
149
            LOGGER.error("Error while sending metrics enabled notification email to administator: " + this.usageStatsAdminEmail, e);
150
            throw e;
151
        }
152
    }
153

  
154
    @Override
155
    public void sendUserMetricsEnabled(PiwikInfo piwikInfo) throws Exception {
156

  
157
        try {
158
            String subject = "[OpenAIRE-Usage Statistics] Usage statistics have been enabled";
159

  
160
            String message = "Dear " + piwikInfo.getRequestorName() + ",\n" +
161
                    "\n" +
162
                    "The installation and configuration of OpenAIRE's tracking code for your repository \"" + piwikInfo.getRepositoryName() +
163
                    "\" has been completed and validated and the usage statistics have been enabled in OpenAIRE.\n" +
164
                    "\n" +
165
                    "You can preview the statistics in your repository's dashboard: \n" +
166
                    this.baseUrl + "/#getImpact/" + piwikInfo.getRepositoryId() + "\n" +
167
                    "\n" +
168
                    " For more information and questions, you can contact the openaire support team by sending an email to " +
169
                    "repositoryusagestats@openaire.eu\n" +
170
                    "\n" +
171
                    "Best,\n" +
172
                    "The OpenAIRE team";
173

  
174
            this.sendMail(piwikInfo.getRequestorEmail(), subject, message, false, null);
175

  
176
        } catch (Exception e) {
177
            LOGGER.error("Error while sending metrics enabled notification email to user: " + piwikInfo.getRequestorEmail(), e);
178
            throw e;
179
        }
180
    }
181

  
182
    private void sendMail(String email, String subject, String message, boolean sendToSpecial, List<String> repoAdminMails) throws Exception {
183
        ArrayList<String> to = new ArrayList<String>();
184
        to.add(email);
185
        this.sendMail(to,subject,message,sendToSpecial,repoAdminMails);
186
    }
187

  
188
    private void sendMail(List<String> recipients, String subject, String message, boolean sendToSpecial, List<String> repoAdminMails) throws Exception {
189

  
190
       /* try {
191
            if (sendToSpecial) {
192
                recipients.addAll(this.specialRecipients);
193
            }
194

  
195
            if (repoAdminMails != null)
196
                recipients.addAll(repoAdminMails);
197

  
198
            if (this.override) {
199
                recipients.clear();
200
                recipients.add(overrideEmail);
201
            }
202
            if (!logonly)
203
                mailLibrary.sendEmail(recipients.toArray(new String[]{}), subject, message);
204
            LOGGER.debug("Sending mail to Recipients: " + recipients + " Subject: " + subject + " Message: " + message);
205
        } catch (Exception e) {
206
            LOGGER.error("Error sending mail to Recipients: " + recipients + " Subject: " + subject + " Message: " + message, e);
207
            throw new Exception(e);
208
        }*/
209
    }
210

  
211
    private String getEmailProperty(String key) {
212
        return pLoader.getProperties().getProperty(key);
213
    }
214

  
215
    public void setSpecialRecipients(String specialRecipients) {
216
        String[] recps = specialRecipients.split(",");
217

  
218
        for (String recp : recps) {
219
            recp = recp.trim();
220

  
221
            this.specialRecipients.add(recp);
222
        }
223
    }
224

  
225

  
226
    public void setOverride(boolean override) {
227
        this.override = override;
228
    }
229

  
230
    public void setOverrideEmail(String overrideEmail) {
231
        this.overrideEmail = overrideEmail;
232
    }
233

  
234
    public String getFrom() {
235
        return from;
236
    }
237

  
238
    public void setFrom(String from) {
239
        this.from = from;
240
    }
241

  
242
    public boolean isLogonly() {
243
        return logonly;
244
    }
245

  
246
    public void setLogonly(boolean logonly) {
247
        this.logonly = logonly;
248
    }
249

  
250

  
251
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/utils/RequestFilter.java
1 1
package eu.dnetlib.repo.manager.service.utils;
2 2

  
3
import com.fasterxml.jackson.annotation.JsonInclude;
3 4

  
5
@JsonInclude(JsonInclude.Include.NON_NULL)
4 6
public class RequestFilter{
5 7

  
6
    private String registeredby = "";
7
    private String typology = "";
8
    private String country = "";
8
    private String registeredby = null;
9
    private String typology = null;
10
    private String country = null;
11
    private String id = null;
12
    private String officialname = null;
9 13

  
10 14

  
11 15
    public RequestFilter() {
......
35 39
    public void setCountry(String country) {
36 40
        this.country = country;
37 41
    }
42

  
43
    public String getId() {
44
        return id;
45
    }
46

  
47
    public void setId(String id) {
48
        this.id = id;
49
    }
50

  
51
    public String getOfficialname() {
52
        return officialname;
53
    }
54

  
55
    public void setOfficialname(String officialname) {
56
        this.officialname = officialname;
57
    }
38 58
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApiImpl.java
77 77
    }
78 78

  
79 79
    @Override
80
    public String getOpenaireId(@PathVariable("repositoryId") String repositoryid) {
80
    public String getOpenaireId(@PathVariable("repositoryId") String repositoryId) {
81
        LOGGER.debug("Getting openaire id for repository: " + repositoryId);
81 82
        try {
82
            if (repositoryid != null && repositoryid.contains("::"))
83
                return repositoryid.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryid.split("::")[1]);
83
            if (repositoryId != null && repositoryId.contains("::")) {
84
                return repositoryId.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryId.split("::")[1]);
85
            }
84 86
            else
85 87
                return null;
86 88
        } catch (NoSuchAlgorithmException e) {
87
            e.printStackTrace();
89
            LOGGER.debug(e);
88 90
        }
89 91
        return null;
90 92
    }
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java
31 31
    @ResponseBody
32 32
    List<RuleSet> getRuleSets(String mode);
33 33

  
34
    @RequestMapping(value = "/getSetsOfRepository" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
34
    @RequestMapping(value = "/getSetsOfRepository/{url}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
35 35
    @ResponseBody
36
    List<String> getSetsOfRepository(@RequestBody String url);
36
    List<String> getSetsOfRepository(String url);
37 37

  
38 38
    @RequestMapping(value = "/identifyRepository/{url}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
39 39
    @ResponseBody
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java
126 126
    }
127 127

  
128 128
    @Override
129
    public List<String> getSetsOfRepository(@PathVariable("url") String url) {
129
    public List<String> getSetsOfRepository(@RequestParam(value = "url", required = true) String url) {
130 130
        LOGGER.debug("Getting sets of repository with url : " + url);
131 131
        try {
132 132
            return OaiTools.getSetsOfRepo(url);
......
137 137
    }
138 138

  
139 139
    @Override
140
    public boolean identifyRepo(@PathVariable("url") String url) {
140
    public boolean identifyRepo(@RequestParam(value = "url", required = true) String url) {
141 141
        LOGGER.debug("Identify repository with url : " + url);
142 142
        try {
143 143
            return OaiTools.identifyRepository(url);
......
185 185
    }
186 186

  
187 187
    @Override
188
    public InterfaceInformation getInterfaceInformation(@PathVariable("baseUrl") String baseUrl) throws ValidationServiceException {
188
    public InterfaceInformation getInterfaceInformation(@RequestParam(value = "baseUrl", required = true) String baseUrl) throws ValidationServiceException {
189 189
        try {
190 190
            LOGGER.debug("Getting interface information with url: " + baseUrl);
191 191
            InterfaceInformation interfaceInformation = new InterfaceInformation();
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java
199 199

  
200 200
        List<Repository> reps = new ArrayList<>();
201 201
        for (Repository r : rs) {
202
            LOGGER.debug(r.getCollectedFrom());
203 202
            if (r.getCollectedFrom() != null && r.getCollectedFrom().equals(mode))
204 203
                reps.add(r);
205 204
        }
......
216 215
        RequestFilter requestFilter = new RequestFilter();
217 216
        requestFilter.setRegisteredby(userEmail);
218 217
        String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
219
        LOGGER.debug(rs);
218

  
220 219
        List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs));
221 220
        for (Repository r : repos)
222 221
            this.getRepositoryInfo(r);
......
227 226
    @Override
228 227
    public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException {
229 228

  
230
        UriComponents uriComponents = UriComponentsBuilder
231
                .fromHttpUrl(baseAddress + "/ds/get/")
232
                .path("/{id}/")
233
                .build().expand(id).encode();
234

  
235
        String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
236
        Repository repo = Converter.jsonToRepositoryObject(new JSONObject(rs));
229
        LOGGER.debug("Retreiving repositories with id : " + id );
230
        UriComponents uriComponents = searchDatasource("0","100");
231
        RequestFilter requestFilter = new RequestFilter();
232
        requestFilter.setId(id);
233
        String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
234
        JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
235
        Repository repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0));
237 236
        if (repo != null)
238 237
            getRepositoryInfo(repo);
239 238
        return repo;
......
243 242
    @Override
244 243
    public Aggregations getRepositoryAggregations(@PathVariable("id") String id) throws JSONException {
245 244

  
246
        UriComponents uriComponents = UriComponentsBuilder
247
                .fromHttpUrl(baseAddress + "/ds/get/")
248
                .path("/{id}/")
249
                .build().expand(id).encode();
250

  
251
        String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
245
        LOGGER.debug("Retreiving aggregations for repository with id : " + id );
246
        UriComponents uriComponents = searchDatasource("0","100");
247
        RequestFilter requestFilter = new RequestFilter();
248
        requestFilter.setId(id);
249
        String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
252 250
        JSONObject repository = new JSONObject(rs);
253 251

  
254 252
        Aggregations aggregations = new Aggregations();
255 253

  
256 254
        try {
257
            aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository));
258
            aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository));
259
            aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository));
255
            LOGGER.debug(repository.getJSONArray("datasourceInfo").getJSONObject(0));
256
            aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0)));
257
            aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0)));
258
            aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0)));
260 259
            return aggregations;
261 260
        } catch (JSONException e) {
262 261
            LOGGER.debug("JSON aggregation exception ", e);
......
269 268
    public List<Repository> getRepositoriesByName(@PathVariable("name") String name,
270 269
                                                  @PathVariable("page") String page,
271 270
                                                  @PathVariable("size") String size) throws JSONException {
272
        UriComponents uriComponents = UriComponentsBuilder
273
                .fromHttpUrl(baseAddress + "/ds/search/name/")
274
                .path("/{page}/{size}")
275
                .queryParam("name", name)
276
                .build().expand(page, size).encode();
277 271

  
278
        String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
272
        LOGGER.debug("Retreiving  repositories with official name : " + name );
273
        UriComponents uriComponents = searchDatasource("0","100");
274
        RequestFilter requestFilter = new RequestFilter();
275
        requestFilter.setOfficialname(name);
276
        String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
277

  
279 278
        List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs));
280 279
        for (Repository r : repos)
281 280
            getRepositoryInfo(r);
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApi.java
24 24
    @RequestMapping(value = "/getPiwikSitesForRepos" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
25 25
    List<PiwikInfo> getPiwikSitesForRepos();
26 26

  
27
    @RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
27
    @RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET)
28 28
    @ResponseBody
29 29
    void approvePiwikSite(String repositoryId);
30 30

  
31
    @RequestMapping(value = "/getOpenaireId/{repositoryid}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
31
    @RequestMapping(value = "/getOpenaireId/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
32 32
    @ResponseBody
33 33
    String getOpenaireId(String repositoryid);
34 34
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java
18 18
@Api(description = "Broker API",  tags = {"broker"})
19 19
public interface BrokerApi {
20 20

  
21
    @RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
21
    @RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,
22
            produces = MediaType.APPLICATION_JSON_VALUE)
23
    @ResponseBody
22 24
    DatasourcesBroker getDatasourcesOfUser(String user,String includeShared,String includeByOthers) throws BrokerException, JSONException;
23 25

  
24
    @RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
26
    @RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,
27
            produces = MediaType.APPLICATION_JSON_VALUE)
28
    @ResponseBody
25 29
    List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
26 30

  
27
    @RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
31
    @RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,
32
            produces = MediaType.APPLICATION_JSON_VALUE)
33
    @ResponseBody
28 34
    EventsPage advancedShowEvents(String page,
29 35
                                  String size,
30 36
                                  AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException;
31 37

  
32
    @RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
38
    @RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,
39
            produces = MediaType.APPLICATION_JSON_VALUE)
40
    @ResponseBody
33 41
    EventsPage showEvents(String datasourceName,
34 42
                          String topic,
35 43
                          String page) throws BrokerException, JSONException;
36 44

  
37
    @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
45
    @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,
46
            produces = MediaType.APPLICATION_JSON_VALUE)
38 47
    @ResponseBody
39 48
    Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
40 49

  
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/broker/Subscription.java
95 95
    public void setConditionsAsList(List<MapConditions> conditionsAsList) {
96 96
        this.conditionsAsList = conditionsAsList;
97 97
    }
98

  
99

  
98 100
}

Also available in: Unified diff