Skip to content

Commit f5266e3

Browse files
author
andrewtivodar
committed
Merge pull request #2 from Jaspersoft/develop
Release: Publishing 1.9.3 changes
2 parents 9266a07 + 3569f8b commit f5266e3

File tree

6 files changed

+103
-3
lines changed

6 files changed

+103
-3
lines changed

client/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
22
apply plugin: 'com.github.dcendents.android-maven'
33

44
description = 'js-android-sdk-client'
5-
version = '1.9.2'
5+
version = '1.9.3'
66

77
ext {
88
PUBLISH_GROUP_ID = group
99
PUBLISH_ARTIFACT_ID = description
10-
PUBLISH_VERSION = '1.9.2'
10+
PUBLISH_VERSION = '1.9.3'
1111
}
1212

1313
android {
@@ -17,7 +17,7 @@ android {
1717
defaultConfig {
1818
minSdkVersion androidMinSdkVersion
1919
targetSdkVersion androidTargetSdkVersion
20-
versionCode 9010920
20+
versionCode 9010930
2121
versionName version
2222
}
2323

client/src/main/java/com/jaspersoft/android/sdk/client/JsRestClient.java

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,33 @@ public JsServerProfile getServerProfile() {
181181
return jsServerProfile;
182182
}
183183

184+
/**
185+
* Alternative way to change server profile.
186+
* This method mutates request factory.
187+
* This method doesn't mutates interceptors collection.
188+
*
189+
* @param serverProfile store of user auth credentials
190+
*/
191+
public void updateServerProfile(final JsServerProfile serverProfile) {
192+
this.serverInfo = null;
193+
this.jsServerProfile = serverProfile;
194+
195+
// We allow user to set profile to null value
196+
if (jsServerProfile != null) {
197+
this.restServicesUrl = serverProfile.getServerUrl() + REST_SERVICES_URI;
198+
updateRequestFactoryTimeouts();
199+
restTemplate.setRequestFactory(requestFactory);
200+
}
201+
}
202+
203+
/**
204+
* Legacy way to change server profile.
205+
* This method mutates request factory.
206+
* This method mutates interceptors collection.
207+
*
208+
* @param serverProfile store of user auth credentials
209+
*/
210+
@Deprecated
184211
public void setServerProfile(final JsServerProfile serverProfile) {
185212
this.serverInfo = null;
186213
this.jsServerProfile = serverProfile;
@@ -200,6 +227,15 @@ public void setServerProfile(final JsServerProfile serverProfile) {
200227
}
201228
}
202229

230+
/**
231+
* Allows to mutate list of request request interceptors.
232+
*
233+
* @param interceptors list of new request interceptors.
234+
*/
235+
public void setRequestInterceptors(List<ClientHttpRequestInterceptor> interceptors) {
236+
restTemplate.setInterceptors(interceptors);
237+
}
238+
203239
/**
204240
* Gets server information details
205241
*
@@ -767,6 +803,32 @@ public URI getReportStatusCheckURI(String executionId) {
767803
return new UriTemplate(fullUri).expand(executionId);
768804
}
769805

806+
/**
807+
* Sends request for the current running export for the status check.
808+
*
809+
* @param executionId Identifies current id of running report.
810+
* @param exportOutput Identifier which refers to current requested export.
811+
* @return response which expose current export status.
812+
*/
813+
public ReportStatusResponse runExportStatusCheck(String executionId, String exportOutput) {
814+
return restTemplate.getForObject(getExportStatusCheckURI(executionId, exportOutput), ReportStatusResponse.class);
815+
}
816+
817+
/**
818+
* Generates link for requesting report execution status.
819+
*
820+
* @param executionId Identifies current id of running report.
821+
* @param exportOutput Identifier which refers to current requested export.
822+
* @return "{server url}/rest_v2/reportExecutions/{executionId}/exports/{exportOutput}/status"
823+
*/
824+
public URI getExportStatusCheckURI(String executionId, String exportOutput) {
825+
String outputResourceUri = "/{executionId}/exports/{exportOutput}/status";
826+
String fullUri = jsServerProfile.getServerUrl() + REST_SERVICES_V2_URI + REST_REPORT_EXECUTIONS + outputResourceUri;
827+
828+
UriTemplate uriTemplate = new UriTemplate(fullUri);
829+
return uriTemplate.expand(executionId, exportOutput);
830+
}
831+
770832
/**
771833
* Saves resource ouput in file.
772834
*

client/src/main/java/com/jaspersoft/android/sdk/client/oxm/report/ErrorDescriptor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.jaspersoft.android.sdk.client.oxm.report;
22

33
import org.simpleframework.xml.Element;
4+
import org.simpleframework.xml.ElementList;
45
import org.simpleframework.xml.Root;
56
import org.simpleframework.xml.Serializer;
67
import org.simpleframework.xml.core.Persister;
78
import org.springframework.web.client.HttpStatusCodeException;
89

910
import java.io.StringWriter;
11+
import java.util.List;
1012

1113
/**
1214
* @author Tom Koptel
@@ -19,6 +21,9 @@ public class ErrorDescriptor {
1921
@Element(required = false)
2022
private String message;
2123

24+
@ElementList(name = "parameters", entry = "parameter", required = false)
25+
private List<String> parameters;
26+
2227
public static ErrorDescriptor valueOf(HttpStatusCodeException exception) {
2328
String response = exception.getResponseBodyAsString();
2429
Serializer serializer = new Persister();
@@ -46,4 +51,13 @@ public String getMessage() {
4651
public void setMessage(String message) {
4752
this.message = message;
4853
}
54+
55+
public List<String> getParameters() {
56+
return parameters;
57+
}
58+
59+
public void setParameters(List<String> parameters) {
60+
this.parameters = parameters;
61+
}
62+
4963
}

client/src/main/java/com/jaspersoft/android/sdk/client/oxm/report/ExportExecution.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class ExportExecution {
5050
@ElementList(empty=false, entry="attachment", required=false)
5151
private List<ReportOutputResource> attachments;
5252

53+
@Element(required=false)
54+
private ErrorDescriptor errorDescriptor;
55+
5356

5457
public String getId() {
5558
return id;
@@ -83,4 +86,12 @@ public void setAttachments(List<ReportOutputResource> attachments) {
8386
this.attachments = attachments;
8487
}
8588

89+
public ErrorDescriptor getErrorDescriptor() {
90+
return errorDescriptor;
91+
}
92+
93+
public void setErrorDescriptor(ErrorDescriptor errorDescriptor) {
94+
this.errorDescriptor = errorDescriptor;
95+
}
96+
8697
}

client/src/main/java/com/jaspersoft/android/sdk/client/oxm/report/ReportExecutionResponse.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public class ReportExecutionResponse {
5757
@Element(required=false)
5858
private int totalPages;
5959

60+
@Element(required=false)
61+
ErrorDescriptor errorDescriptor;
62+
6063

6164
public String getRequestId() {
6265
return requestId;
@@ -109,4 +112,13 @@ public void setTotalPages(int totalPages) {
109112
public ReportStatus getReportStatus() {
110113
return ReportStatus.valueOf(status);
111114
}
115+
116+
public ErrorDescriptor getErrorDescriptor() {
117+
return errorDescriptor;
118+
}
119+
120+
public void setErrorDescriptor(ErrorDescriptor errorDescriptor) {
121+
this.errorDescriptor = errorDescriptor;
122+
}
123+
112124
}

client/src/main/java/com/jaspersoft/android/sdk/util/CookieHttpRequestInterceptor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @author Tom Koptel
1919
* @since 1.9
2020
*/
21+
@Deprecated
2122
public class CookieHttpRequestInterceptor implements ClientHttpRequestInterceptor {
2223
private static final String SET_COOKIE = "set-cookie";
2324
private static final String COOKIE = "Cookie";

0 commit comments

Comments
 (0)