in src/main/java/com/aliyun/openservices/log/response/GetLogsResponse.java [68:183]
public GetLogsResponse(Map<String, String> headers) {
super(headers);
this.SetProcessStatus(headers.get(Consts.CONST_X_SLS_PROCESS));
// check x-log-agg-query
if (headers.containsKey(Consts.CONST_X_LOG_AGGQUERY))
this.setAggQuery(headers.get(Consts.CONST_X_LOG_AGGQUERY));
// check x-log-where-query
if (headers.containsKey(Consts.CONST_X_LOG_WHEREQUERY))
this.setWhereQuery(headers.get(Consts.CONST_X_LOG_WHEREQUERY));
// check x-log-has-sql
if (headers.containsKey(Consts.CONST_X_LOG_HASSQL))
this.setHasSQL(Boolean.parseBoolean(headers.get(Consts.CONST_X_LOG_HASSQL)));
// check x-log-processed-rows
if (headers.containsKey(Consts.CONST_X_LOG_PROCESSEDROWS))
this.setProcessedRow(Long.parseLong(headers.get(Consts.CONST_X_LOG_PROCESSEDROWS)));
// checck x-log-elapsed-millisecond
if (headers.containsKey(Consts.CONST_X_LOG_ELAPSEDMILLISECOND))
this.setElapsedMilliSecond(Long.parseLong(headers.get(Consts.CONST_X_LOG_ELAPSEDMILLISECOND)));
//check x-log-cpu-sec
if (headers.containsKey(Consts.CONST_X_LOG_CPU_SEC))
this.setCpuSec(Double.parseDouble(headers.get(Consts.CONST_X_LOG_CPU_SEC)));
if (headers.containsKey(Consts.CONST_X_LOG_CPU_CORES))
this.setCpuCores(Long.parseLong(headers.get(Consts.CONST_X_LOG_CPU_CORES)));
if (headers.containsKey(Consts.CONST_X_LOG_QUERY_INFO)) {
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(headers.get(Consts.CONST_X_LOG_QUERY_INFO));
JSONArray keys = object.getJSONArray("keys");
mKeys = new ArrayList<String>();
if (keys != null) {
for (int i = 0; i < keys.size(); ++i) {
mKeys.add(keys.getString(i));
}
}
JSONArray terms = object.getJSONArray("terms");
mTerms = new ArrayList<ArrayList<String>>();
if (terms != null) {
for (int i = 0; i < terms.size(); ++i) {
ArrayList<String> list = new ArrayList<String>();
JSONArray term = terms.getJSONArray(i);
if (term.size() == 2) {
list.add(term.getString(0));
list.add(term.getString(1));
}
mTerms.add(list);
}
}
if (object.containsKey("limited")) {
mLimited = Long.parseLong(object.getString("limited"));
}
if (object.containsKey("marker")) {
mMarker = object.getString("marker");
}
if (object.containsKey("mode")) {
mQueryMode = object.getIntValue("mode");
if (mQueryMode == 1)
mIsPhraseQuery = true;
}
if (object.containsKey("phraseQueryInfo")) {
JSONObject phraseQueryInfo = object.getJSONObject("phraseQueryInfo");
if (phraseQueryInfo.containsKey("scanAll")) {
mScanAll = Boolean.parseBoolean(phraseQueryInfo.getString("scanAll"));
}
if (phraseQueryInfo.containsKey("beginOffset")) {
mBeginOffset = Long.parseLong(phraseQueryInfo.getString("beginOffset"));
}
if (phraseQueryInfo.containsKey("endOffset")) {
mEndOffset = Long.parseLong(phraseQueryInfo.getString("endOffset"));
}
if (phraseQueryInfo.containsKey("endTime")) {
mEndTime = Long.parseLong(phraseQueryInfo.getString("endTime"));
}
}
if (object.containsKey("shard")) {
mShard = object.getIntValue("shard");
}
if (object.containsKey("scanBytes")) {
mScanBytes = object.getLongValue("scanBytes");
}
JSONArray highlights = object.getJSONArray("highlights");
if (highlights != null) {
mHighlights = new ArrayList<List<LogContent>>(highlights.size());
for (int i = 0; i < highlights.size(); ++i) {
JSONObject jsonObject = highlights.getJSONObject(i);
if (jsonObject == null) {
mHighlights.add(new ArrayList<LogContent>());
} else {
ArrayList<LogContent> logContents = new ArrayList<LogContent>(jsonObject.size());
Set<String> keySey = jsonObject.keySet();
for (String key : keySey) {
String value = jsonObject.getString(key);
logContents.add(new LogContent(key, value));
}
mHighlights.add(logContents);
}
}
}
JSONArray columnTypesAsJson = object.getJSONArray("columnTypes");
if (columnTypesAsJson != null) {
mColumnTypes = new ArrayList<String>(columnTypesAsJson.size());
for (int i = 0; i < columnTypesAsJson.size(); ++i) {
mColumnTypes.add(columnTypesAsJson.getString(i));
}
}
}
}