in tablestore/src/main/java/com/alicloud/openservices/tablestore/core/protocol/timeseries/TimeseriesResponseFactory.java [272:339]
public static DescribeTimeseriesTableResponse createDescribeTimeseriesTableResponse(
ResponseContentWithMeta response, Timeseries.DescribeTimeseriesTableResponse pbResponse) {
DescribeTimeseriesTableResponse result = new DescribeTimeseriesTableResponse(response.getMeta());
Timeseries.TimeseriesTableMeta meta = pbResponse.getTableMeta();
TimeseriesTableMeta _meta = new TimeseriesTableMeta(meta.getTableName());
TimeseriesTableOptions timeseriesTableOptions = new TimeseriesTableOptions();
timeseriesTableOptions.setTimeToLive(meta.getTableOptions().getTimeToLive());
_meta.setTimeseriesTableOptions(timeseriesTableOptions);
_meta.setStatus((meta.getStatus()));
if (meta.hasMetaOptions()) {
Timeseries.TimeseriesMetaOptions pbMetaOptions = meta.getMetaOptions();
TimeseriesMetaOptions metaOptions = new TimeseriesMetaOptions();
if (pbMetaOptions.hasMetaTimeToLive()) {
metaOptions.setMetaTimeToLive(pbMetaOptions.getMetaTimeToLive());
}
if (pbMetaOptions.hasAllowUpdateAttributes()) {
metaOptions.setAllowUpdateAttributes(pbMetaOptions.getAllowUpdateAttributes());
}
_meta.setTimeseriesMetaOptions(metaOptions);
}
for (int i = 0; i < meta.getTimeseriesKeySchemaCount(); i++) {
String timeseriesKey = meta.getTimeseriesKeySchema(i);
_meta.addTimeseriesKey(timeseriesKey);
}
for (int i = 0; i < meta.getFieldPrimaryKeySchemaCount(); i++) {
OtsInternalApi.PrimaryKeySchema fieldPrimaryKeySchema = meta.getFieldPrimaryKeySchema(i);
_meta.addFieldPrimaryKey(fieldPrimaryKeySchema.getName(), OTSProtocolParser.toPrimaryKeyType(fieldPrimaryKeySchema.getType()));
}
result.setTimeseriesTableMeta(_meta);
if (!pbResponse.getAnalyticalStoresList().isEmpty()) {
List<TimeseriesAnalyticalStore> analyticalStores = new ArrayList<TimeseriesAnalyticalStore>();
for (Timeseries.TimeseriesAnalyticalStore pbAnalyticalStore : pbResponse.getAnalyticalStoresList()) {
TimeseriesAnalyticalStore analyticalStore = new TimeseriesAnalyticalStore(pbAnalyticalStore.getStoreName());
if (pbAnalyticalStore.hasTimeToLive()) {
analyticalStore.setTimeToLive(pbAnalyticalStore.getTimeToLive());
}
if (pbAnalyticalStore.hasSyncOption()) {
switch (pbAnalyticalStore.getSyncOption()) {
case SYNC_TYPE_FULL:
analyticalStore.setSyncOption(AnalyticalStoreSyncType.SYNC_TYPE_FULL);
break;
case SYNC_TYPE_INCR:
analyticalStore.setSyncOption(AnalyticalStoreSyncType.SYNC_TYPE_INCR);
break;
}
}
analyticalStores.add(analyticalStore);
}
result.setAnalyticalStores(analyticalStores);
}
if (!pbResponse.getLastpointIndexesList().isEmpty()) {
List<TimeseriesLastpointIndex> lastpointIndexes = new ArrayList<TimeseriesLastpointIndex>();
for (Timeseries.TimeseriesLastpointIndex pbLastpointIndex : pbResponse.getLastpointIndexesList()) {
TimeseriesLastpointIndex lastpointIndex = new TimeseriesLastpointIndex(pbLastpointIndex.getIndexTableName());
lastpointIndexes.add(lastpointIndex);
}
result.setLastpointIndexes(lastpointIndexes);
}
return result;
}