Skip to content

Commit c54c652

Browse files
author
TanyaEf
committed
Fixed bug #124 (Bundles service doesn't work )
1 parent b75207f commit c54c652

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/bundles/BundlesService.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
import com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.handling.DefaultErrorHandler;
2828
import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResult;
2929
import java.util.Locale;
30+
import java.util.Map;
31+
import javax.ws.rs.core.GenericType;
3032
import javax.ws.rs.core.MediaType;
31-
import org.codehaus.jettison.json.JSONObject;
3233

3334

3435
public class BundlesService extends AbstractAdapter {
@@ -47,21 +48,28 @@ public BundlesService forLocale(String locale) {
4748
return this;
4849
}
4950

50-
public OperationResult<JSONObject> allBundles() {
51-
return buildBundleRequest("/bundles").addParam("expanded", "true").get();
51+
public OperationResult<Map<String, Map<String, String>>> allBundles() {
52+
return buildBundlesRequest().addParam("expanded", "true").get();
5253
}
5354

54-
public OperationResult<JSONObject> bundle(String name) {
55-
return buildBundleRequest("/bundles", name).get();
55+
public OperationResult<Map<String, String>> bundle(String name) {
56+
return buildBundleRequest(name).get();
5657
}
5758

58-
private JerseyRequest<JSONObject> buildBundleRequest(String... path) {
59-
JerseyRequest<JSONObject> request =
60-
JerseyRequest.buildRequest(sessionStorage, JSONObject.class, path, new DefaultErrorHandler());
59+
private JerseyRequest<Map<String, String>> buildBundleRequest(String bundleName) {
60+
JerseyRequest<Map<String, String>> request =
61+
JerseyRequest.buildRequest(sessionStorage, new GenericType<Map<String, String>>() {
62+
}, new String[]{"/bundles", bundleName}, new DefaultErrorHandler());
6163
request.setAccept(MediaType.APPLICATION_JSON).addHeader("Accept-Language", locale.toString().replace('_', '-'));
6264
return request;
6365
}
6466

65-
67+
private JerseyRequest<Map<String, Map<String, String>>> buildBundlesRequest() {
68+
JerseyRequest<Map<String, Map<String, String>>> request =
69+
JerseyRequest.buildRequest(sessionStorage, new GenericType<Map<String, Map<String, String>>>() {
70+
}, new String[]{"/bundles"}, new DefaultErrorHandler());
71+
request.setAccept(MediaType.APPLICATION_JSON).addHeader("Accept-Language", locale.toString().replace('_', '-'));
72+
return request;
73+
}
6674

6775
}

0 commit comments

Comments
 (0)