当前位置: 首页>>代码示例>>Java>>正文


Java AnalyticsDataAPI.get方法代码示例

本文整理汇总了Java中org.wso2.carbon.analytics.api.AnalyticsDataAPI.get方法的典型用法代码示例。如果您正苦于以下问题:Java AnalyticsDataAPI.get方法的具体用法?Java AnalyticsDataAPI.get怎么用?Java AnalyticsDataAPI.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.analytics.api.AnalyticsDataAPI的用法示例。


在下文中一共展示了AnalyticsDataAPI.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllEventsForDevice

import org.wso2.carbon.analytics.api.AnalyticsDataAPI; //导入方法依赖的package包/类
private static EventRecords getAllEventsForDevice(String tableName, String query, List<SortByField> sortByFields
        , int offset, int limit) throws AnalyticsException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI();
    EventRecords eventRecords = new EventRecords();
    int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
    if (eventCount == 0) {
        eventRecords.setCount(0);
    }
    List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, offset, limit,
                                                                    sortByFields);
    List<String> recordIds = getRecordIds(resultEntries);
    AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
    eventRecords.setCount(eventCount);
    eventRecords.setList(AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response));
    return eventRecords;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceEventManagementServiceImpl.java

示例2: getAllEventsForDevice

import org.wso2.carbon.analytics.api.AnalyticsDataAPI; //导入方法依赖的package包/类
public static List<SensorRecord> getAllEventsForDevice(String tableName, String query,
                                                       List<SortByField> sortByFields) throws AnalyticsException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI();
    int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
    // limiting the data read from the server
    int start = 0;
    int dataCount = 100;
    if (eventCount == 0) {
        return null;
    } else if (eventCount >= dataCount){
        start = eventCount - dataCount;
    }

    List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, start, eventCount,
                                                                    sortByFields);
    List<String> recordIds = getRecordIds(resultEntries);
    AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
    Map<String, SensorRecord> sensorDatas = createSensorData(AnalyticsDataAPIUtil.listRecords(
            analyticsDataAPI, response));
    List<SensorRecord> sortedSensorData = getSortedSensorData(sensorDatas, resultEntries);
    return sortedSensorData;
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:24,代码来源:APIUtil.java

示例3: getAllEventsForDevice

import org.wso2.carbon.analytics.api.AnalyticsDataAPI; //导入方法依赖的package包/类
/**
 * Get sensor data for a device.
 *
 * @param tableName    table name of the data source
 * @param query        query for the table
 * @param sortByFields list of fields to sort the data by
 * @return List of SensorRecords that is sorted by the fields provided
 * @throws AnalyticsException
 */
public static List<SensorRecord> getAllEventsForDevice(String tableName, String query,
                                                       List<SortByField> sortByFields) throws AnalyticsException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI();
    int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
    if (eventCount == 0) {
        return null;
    }
    List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount,
            sortByFields);
    List<String> recordIds = getRecordIds(resultEntries);
    AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
    Map<String, SensorRecord> sensorDatas = createSensorData(AnalyticsDataAPIUtil.listRecords(
            analyticsDataAPI, response));
    List<SensorRecord> sortedSensorData = getSortedSensorData(sensorDatas, resultEntries);
    return sortedSensorData;
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:27,代码来源:APIUtil.java

示例4: getAllEventsForDevice

import org.wso2.carbon.analytics.api.AnalyticsDataAPI; //导入方法依赖的package包/类
public static List<SensorRecord> getAllEventsForDevice(String tableName, String query,
                                                       List<SortByField> sortByFields) throws AnalyticsException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI();
    int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
    if (eventCount == 0) {
        return null;
    }
    List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount,
            sortByFields);
    List<String> recordIds = getRecordIds(resultEntries);
    AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
    Map<String, SensorRecord> sensorDatas = createSensorData(AnalyticsDataServiceUtils.listRecords(
            analyticsDataAPI, response));
    List<SensorRecord> sortedSensorData = getSortedSensorData(sensorDatas, resultEntries);
    return sortedSensorData;
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:18,代码来源:APIUtil.java

示例5: getEventBeans

import org.wso2.carbon.analytics.api.AnalyticsDataAPI; //导入方法依赖的package包/类
private List<Event> getEventBeans(AnalyticsDataAPI analyticsDataAPI, int tenantId, String tableName,
                                  List<String> columns,
                                  List<SearchResultEntry> searchResults) throws AnalyticsException {
    List<String> ids = getIds(searchResults);
    List<String> requiredColumns = (columns == null || columns.isEmpty()) ? null : columns;
    AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, requiredColumns, ids);
    List<Record> records = AnalyticsDataAPIUtil.listRecords(analyticsDataAPI, response);
    Map<String, Event> eventBeanMap = getEventBeanKeyedWithIds(records);
    return getSortedEventBeans(eventBeanMap, searchResults);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:11,代码来源:GeoLocationBasedServiceImpl.java


注:本文中的org.wso2.carbon.analytics.api.AnalyticsDataAPI.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。