本文整理汇总了Java中org.motechproject.mds.service.MotechDataService.retrieveAll方法的典型用法代码示例。如果您正苦于以下问题:Java MotechDataService.retrieveAll方法的具体用法?Java MotechDataService.retrieveAll怎么用?Java MotechDataService.retrieveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.motechproject.mds.service.MotechDataService
的用法示例。
在下文中一共展示了MotechDataService.retrieveAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stressTestRetrieval
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
private void stressTestRetrieval(MotechDataService service) {
Long startTime = System.nanoTime();
service.retrieveAll();
Long endTime = (System.nanoTime() - startTime) / 1000000;
LOGGER.info("MDS Service: Retrieving all instances took " + endTime + "ms.");
logToFile((double) endTime);
}
示例2: stressTestUpdating
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
private void stressTestUpdating(MotechDataService service) {
List<Object> allObjects = service.retrieveAll();
Long startTime = System.nanoTime();
for (Object object : allObjects) {
service.update(object);
}
Long endTime = (System.nanoTime() - startTime) / 1000000;
LOGGER.info("MDS Service: Updating " + TEST_INSTANCES + " instances took " + endTime + "ms.");
logToFile((double) endTime);
}
示例3: stressTestDeleting
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
private void stressTestDeleting(MotechDataService service) {
Long startTime = System.nanoTime();
for (Object object : service.retrieveAll()) {
service.delete(object);
}
Long endTime = (System.nanoTime() - startTime) / 1000000;
LOGGER.info("MDS Service: Deleting " + TEST_INSTANCES + " instances took " + endTime + "ms.");
logToFile((double) endTime);
}
示例4: retrieveAll
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@Override
public <T> List<T> retrieveAll(String entityClassName, QueryParams queryParams) {
MotechDataService<T> dataService = OSGiServiceUtils.findService(bundleContext,
MotechClassPool.getInterfaceName(entityClassName));
return dataService.retrieveAll(queryParams);
}
示例5: queryAndUpdate
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@Override
public void queryAndUpdate(Map<String, Object> parameters) throws ActionHandlerException {
LOGGER.debug("Action QUERY AND UPDATE: params {}", parameters);
String entityClassName = getEntityClassName(parameters);
MotechDataService dataService = getEntityDataService(entityClassName);
Entity entity = getEntity(entityClassName);
List<?> instances = dataService.retrieveAll();
for (Object instance : instances) {
setInstancePropertiesForQuery(instance, entity.getFields(), parameters);
dataService.update(instance);
}
}
示例6: exportData
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
protected long exportData(EntityInfo entityInfo, TableWriter writer, String lookupName, QueryParams params, List<String> headers,
Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer) {
final MotechDataService dataService = DataServiceHelper.getDataService(bundleContext, entityInfo.getClassName());
final Map<String, FieldDto> fieldMap = new HashMap<>();
for (FieldDto field : entityInfo.getFieldDtos()) {
fieldMap.put(exportCustomizer.exportDisplayName(field), field);
}
// we must respect field ordering
String[] orderedHeaders = orderHeaders(entityInfo.getAdvancedSettings().getBrowsing(), headers == null ? fieldsToHeaders(entityInfo.getFieldDtos(), exportCustomizer) : headers.toArray(new String[headers.size()]),
entityInfo.getFieldDtos(), exportCustomizer);
try {
writer.writeHeader(orderedHeaders);
long rowsExported = 0;
Map<String, String> row = new HashMap<>();
List<Object> instances = StringUtils.isBlank(lookupName) ? dataService.retrieveAll(params) :
mdsLookupService.findMany(entityInfo.getClassName(), lookupName, lookupFields, params);
for (Object instance : instances) {
buildCsvRow(row, fieldMap, instance, orderedHeaders, exportCustomizer);
writer.writeRow(row, orderedHeaders);
rowsExported++;
}
return rowsExported;
} catch (IOException e) {
throw new DataExportException("IO Error when writing data", e);
}
}
示例7: getEntityRecords
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@Override
public List<BasicEntityRecord> getEntityRecords(Long entityId, QueryParams queryParams) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId);
MotechDataService service = getServiceForEntity(entity);
List instances = service.retrieveAll(queryParams);
updateGridSize(entityId, queryParams);
return instancesToBasicRecords(instances, entity, fields, service, EntityType.STANDARD);
}