SalesforceResponse.java
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.JSONObject
*/
package com.adobe.cq.mcm.salesforce;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
public class SalesforceResponse {
private String body;
private Integer code;
private Boolean accessTokenUpdated = false;
public SalesforceResponse(Integer code, String body) {
this.body = body;
this.code = code;
}
public SalesforceResponse() {
}
public String getBody() {
return this.body;
}
public void setBody(String body) {
this.body = body;
}
public Integer getCode() {
return this.code;
}
public void setCode(Integer code) {
this.code = code;
}
public Boolean getAccessTokenUpdated() {
return this.accessTokenUpdated;
}
public void setAccessTokenUpdated(Boolean accessTokenUpdated) {
this.accessTokenUpdated = accessTokenUpdated;
}
public JSONObject getBodyAsJSON() throws JSONException {
if (this.getBody() != null) {
if (this.getBody().charAt(0) == '[' && this.getBody().charAt(this.getBody().length() - 1) == ']') {
String responseBody = this.getBody().substring(1, this.getBody().length() - 1);
return new JSONObject(responseBody);
}
return new JSONObject(this.getBody());
}
return null;
}
}