Skip to content

Commit 011008b

Browse files
author
Andrew Tivodar
committed
Added ErrorDescriptor and export status check
1 parent 8d808ee commit 011008b

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,32 @@ public URI getReportStatusCheckURI(String executionId) {
784784
return new UriTemplate(fullUri).expand(executionId);
785785
}
786786

787+
/**
788+
* Sends request for the current running export for the status check.
789+
*
790+
* @param executionId Identifies current id of running report.
791+
* @param exportOutput Identifier which refers to current requested export.
792+
* @return response which expose current export status.
793+
*/
794+
public ReportStatusResponse runExportStatusCheck(String executionId, String exportOutput) {
795+
return restTemplate.getForObject(getExportStatusCheckURI(executionId, exportOutput), ReportStatusResponse.class);
796+
}
797+
798+
/**
799+
* Generates link for requesting report execution status.
800+
*
801+
* @param executionId Identifies current id of running report.
802+
* @param exportOutput Identifier which refers to current requested export.
803+
* @return "{server url}/rest_v2/reportExecutions/{executionId}/exports/{exportOutput}/status"
804+
*/
805+
public URI getExportStatusCheckURI(String executionId, String exportOutput) {
806+
String outputResourceUri = "/{executionId}/exports/{exportOutput}/status";
807+
String fullUri = jsServerProfile.getServerUrl() + REST_SERVICES_V2_URI + REST_REPORT_EXECUTIONS + outputResourceUri;
808+
809+
UriTemplate uriTemplate = new UriTemplate(fullUri);
810+
return uriTemplate.expand(executionId, exportOutput);
811+
}
812+
787813
/**
788814
* Saves resource ouput in file.
789815
*

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
}

0 commit comments

Comments
 (0)