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


Java CachedList类代码示例

本文整理汇总了Java中com.belladati.sdk.util.CachedList的典型用法代码示例。如果您正苦于以下问题:Java CachedList类的具体用法?Java CachedList怎么用?Java CachedList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: load

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
@Override
public CachedList<T> load() {
	data.clear();
	JsonNode json = service.getAsJson(uri);

	if (json.get(field) instanceof ArrayNode) {
		ArrayNode nodes = (ArrayNode) json.get(field);
		for (JsonNode node : nodes) {
			try {
				data.add(parse(service, node));
			} catch (ParseException e) {
				// nothing to do, just ignore
			}
		}
	}
	isLoaded = true;
	return this;
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:19,代码来源:CachedListImpl.java

示例2: getDomainUsers

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
@Override
public CachedList<User> getDomainUsers(String domainId, String userGroupId) {
	final String cacheKey = domainId + "-" + userGroupId;
	CachedList<User> existing = users.get(cacheKey);
	if (existing != null) {
		return existing;
	} else {
		synchronized (users) {
			existing = users.get(cacheKey);
			if (existing != null) {
				return existing;
			} else {
				String params = userGroupId != null && !userGroupId.isEmpty() ? "?userGroup_id=" + userGroupId : "";
				String endpoint = "api/domains/" + domainId + "/users" + params;
				CachedList<User> newList = new CachedListImpl<User>(this, endpoint, "users") {
					@Override
					protected User parse(BellaDatiServiceImpl service, JsonNode node) {
						return new UserImpl(service, node);
					}
				};
				users.put(cacheKey, newList);
				return newList;
			}
		}
	}
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:27,代码来源:BellaDatiServiceImpl.java

示例3: getDomainUserGroups

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
@Override
public CachedList<UserGroup> getDomainUserGroups(String domainId) {
	CachedList<UserGroup> existing = userGroups.get(domainId);
	if (existing != null) {
		return existing;
	} else {
		synchronized (userGroups) {
			existing = userGroups.get(domainId);
			if (existing != null) {
				return existing;
			} else {
				CachedList<UserGroup> newList = new CachedListImpl<UserGroup>(this, "api/domains/" + domainId + "/userGroups",
					"userGroups") {
					@Override
					protected UserGroup parse(BellaDatiServiceImpl service, JsonNode node) {
						return new UserGroupImpl(node);
					}
				};
				userGroups.put(domainId, newList);
				return newList;
			}
		}
	}
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:25,代码来源:BellaDatiServiceImpl.java

示例4: getDataSourceImports

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
@Override
public CachedList<DataSourceImport> getDataSourceImports(String id) throws NotFoundException {
	CachedList<DataSourceImport> list = dataSourceImportList.get(id);
	if (list == null) {
		// we don't have this data set's sources in our cache yet
		list = new CachedListImpl<DataSourceImport>(this, "api/dataSets/dataSources/" + id + "/executions", "executions") {
			@Override
			protected DataSourceImport parse(BellaDatiServiceImpl service, JsonNode node) throws ParseException {
				try {
					return new DataSourceImportImpl(node);
				} catch (InvalidDataSourceImportException e) {
					throw new ParseException(node, e);
				}
			}
		};
		dataSourceImportList.put(id, list);
	}
	return list;
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:20,代码来源:BellaDatiServiceImpl.java

示例5: loadDataSource

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Import is loaded correctly from getService(). */
public void loadDataSource() {
	registerSingleImport(
		builder.buildSourceImportNode(id, caller, lastImport, overwritePolicy, interval, customIntervalLength));

	CachedList<DataSourceImport> imports = getService().getDataSourceImports(dsId);
	imports.load();
	server.assertRequestUris(importUri);
	assertEquals(imports.toList().size(), 1);

	DataSourceImport exec = imports.toList().get(0);

	assertEquals(exec.getId(), id);
	assertEquals(exec.getCallerName(), caller);
	Calendar expectedImport = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	expectedImport.set(2012, 3, 16, 10, 17, 26);
	expectedImport.set(Calendar.MILLISECOND, 0);
	assertEquals(exec.getNextExecutionDate(), expectedImport.getTime());
	assertEquals(exec.getRepeatInterval().getMinutes(), customIntervalLength);
	assertTrue(exec.isOverwriting());
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:22,代码来源:DataSourceImportTest.java

示例6: loadFromDataSet

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Import is loaded correctly from data source. */
public void loadFromDataSet() {
	registerSingleImport(
		builder.buildSourceImportNode(id, caller, lastImport, overwritePolicy, interval, customIntervalLength));

	DataSource source = new DataSourceImpl(getService(), builder.buildDataSourceNode(dsId, "", ""));
	CachedList<DataSourceImport> imports = source.getImports();
	imports.load();
	server.assertRequestUris(importUri);
	assertEquals(imports.toList().size(), 1);

	DataSourceImport exec = imports.toList().get(0);

	assertEquals(exec.getId(), id);
	assertEquals(exec.getCallerName(), caller);
	Calendar expectedImport = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	expectedImport.set(2012, 3, 16, 10, 17, 26);
	expectedImport.set(Calendar.MILLISECOND, 0);
	assertEquals(exec.getNextExecutionDate(), expectedImport.getTime());
	assertEquals(exec.getRepeatInterval().getMinutes(), customIntervalLength);
	assertTrue(exec.isOverwriting());
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:23,代码来源:DataSourceImportTest.java

示例7: loadDataSource

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Data source is loaded correctly from service. */
public void loadDataSource() {
	registerSingleDataSource(builder.buildDataSourceNode(id, name, type));

	CachedList<DataSource> dataSources = getService().getDataSources(dsId);
	dataSources.load();
	server.assertRequestUris(dataSourcesUri);
	assertEquals(dataSources.toList().size(), 1);

	DataSource source = dataSources.toList().get(0);

	assertEquals(source.getId(), id);
	assertEquals(source.getName(), name);
	assertEquals(source.getType(), type);

	assertEquals(source.toString(), name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:18,代码来源:DataSourcesTest.java

示例8: loadFromDataSet

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Data source is loaded correctly from data set. */
public void loadFromDataSet() {
	registerSingleDataSource(builder.buildDataSourceNode(id, name, type));

	DataSet dataSet = new DataSetImpl(getService(), builder.buildDataSetNode(dsId, "", null, null, null));
	CachedList<DataSource> dataSources = dataSet.getDataSources();
	dataSources.load();
	server.assertRequestUris(dataSourcesUri);
	assertEquals(dataSources.toList().size(), 1);

	DataSource source = dataSources.toList().get(0);

	assertEquals(source.getId(), id);
	assertEquals(source.getName(), name);
	assertEquals(source.getType(), type);

	assertEquals(source.toString(), name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:19,代码来源:DataSourcesTest.java

示例9: loadForms_withElements

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
public void loadForms_withElements() {
	server.registerPaginatedItem(baseUri, "importForms", builder.buildFormNode(id, name, recordTimestamp, testElements()));

	CachedList<Form> list = getService().getImportForms();
	list.load();
	server.assertRequestUris(baseUri);
	assertEquals(list.get().size(), 1);

	Form form = list.get().get(0);
	assertEquals(form.getId(), id);
	assertEquals(form.getName(), name);
	assertEquals(form.getRecordTimestamp() + "", recordTimestamp);
	assertEquals(form.toString(), name);
	assertEquals(form.getElements().size(), 6);
	assertElements(form.getElements());
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:17,代码来源:FormTest.java

示例10: loadDomainInfo

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Regular domain info data is loaded correctly. */
public void loadDomainInfo() {
	server.registerPaginatedItem(baseUri, "domains", builder.buildDomainInfoNode(id, name, description, active));

	CachedList<DomainInfo> infos = getService().getDomainInfo();
	infos.load();
	server.assertRequestUris(baseUri);
	assertEquals(infos.get().size(), 1);

	DomainInfo info = infos.get().get(0);
	assertEquals(info.getId(), id);
	assertEquals(info.getName(), name);
	assertEquals(info.getDescription(), description);
	assertEquals(info.getActive() + "", active);
	assertEquals(info.toString(), name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:17,代码来源:DomainTest.java

示例11: loadUsers_withoutGroupFilter

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Users (without group filter) are loaded correctly from getService(). */
public void loadUsers_withoutGroupFilter() {
	registerSingleUser(builder.buildUserNode(user_id, user_name, "", "", "", "", "", "", null, null, id, null, null));

	ObjectNode node = builder.buildDomainNode(id, name, description, dateFormat, timeFormat, timeZone, locale, active);
	Domain domain = new DomainImpl(getService(), node);
	CachedList<User> list = domain.loadUsers(null);
	list.load();
	server.assertRequestUris(usersUri);
	assertEquals(list.toList().size(), 1);

	User item = list.toList().get(0);

	assertEquals(item.getId(), user_id);
	assertEquals(item.getUsername(), user_name);
	assertEquals(item.getDomainId(), id);
	assertEquals(item.getUserGroups().size(), 0);

	assertEquals(item.toString(), user_name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:21,代码来源:DomainTest.java

示例12: loadUsers_withGroupFilter

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Users (with group filter) are loaded correctly from getService(). */
public void loadUsers_withGroupFilter() {
	registerSingleUser(
		builder.buildUserNode(user_id, user_name, "", "", "", "", "", "", null, null, id, null, userGroupsJson));

	ObjectNode infoJson = builder.buildDomainInfoNode(id, name, description, active);
	DomainInfo domainInfo = new DomainInfoImpl(getService(), infoJson);
	CachedList<User> list = domainInfo.loadUsers(userGroup_id);
	list.load();
	server.assertRequestUris(usersUri);
	assertEquals(list.toList().size(), 1);

	User item = list.toList().get(0);

	assertEquals(item.getId(), user_id);
	assertEquals(item.getUsername(), user_name);
	assertEquals(item.getDomainId(), id);
	assertEquals(item.getUserGroups().size(), 1);
	UserGroup[] groups = item.getUserGroups().toArray(new UserGroup[1]);
	assertEquals(groups[0].getId(), userGroup_id);
	assertEquals(groups[0].getName(), userGroup_name);
	assertEquals(groups[0].getDescription(), "");

	assertEquals(item.toString(), user_name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:26,代码来源:DomainTest.java

示例13: loadUserGroups_fromDomain

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Loads UserGroups from Domain. */
public void loadUserGroups_fromDomain() {
	ObjectNode infoJson = builder.buildDomainInfoNode(id, name, description, active);
	server.register(apiUri + id, infoJson.toString());
	registerSingleUserGroup(builder.buildUserGroupNode(userGroup_id, userGroup_name, description));

	DomainInfo domainInfo = new DomainInfoImpl(getService(), infoJson);
	assertEquals(domainInfo.getId(), id);
	Domain domain = domainInfo.loadDetails();
	CachedList<UserGroup> list = domain.loadUserGroups();

	list.load();
	assertEquals(list.toList().size(), 1);

	UserGroup item = list.toList().get(0);
	assertEquals(item.getId(), userGroup_id);
	assertEquals(item.getName(), userGroup_name);
	assertEquals(item.getDescription(), description);
	assertEquals(item.toString(), userGroup_name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:21,代码来源:DomainTest.java

示例14: loadUserGroups_fromDomainInfo

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
/** Loads UserGroups from DomainInfo. */
public void loadUserGroups_fromDomainInfo() {
	registerSingleUserGroup(builder.buildUserGroupNode(userGroup_id, userGroup_name, description));

	ObjectNode infoJson = builder.buildDomainInfoNode(id, name, description, active);
	DomainInfo domainInfo = new DomainInfoImpl(getService(), infoJson);
	assertEquals(domainInfo.getId(), id);
	CachedList<UserGroup> list = domainInfo.loadUserGroups();

	list.load();
	assertEquals(list.toList().size(), 1);

	UserGroup item = list.toList().get(0);
	assertEquals(item.getId(), userGroup_id);
	assertEquals(item.getName(), userGroup_name);
	assertEquals(item.getDescription(), description);
	assertEquals(item.toString(), userGroup_name);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:19,代码来源:DomainTest.java

示例15: getDataSourceImports

import com.belladati.sdk.util.CachedList; //导入依赖的package包/类
@Override
public CachedList<DataSourceImport> getDataSourceImports(String id) throws NotFoundException {
	CachedListImpl<DataSourceImport> list = dataSourceImportList.get(id);
	if (list == null) {
		// we don't have this data set's sources in our cache yet
		list = new CachedListImpl<DataSourceImport>(this, "api/dataSets/dataSources/" + id + "/executions", "executions") {
			@Override
			protected DataSourceImport parse(BellaDatiServiceImpl service, JsonNode node) throws ParseException {
				try {
					return new DataSourceImportImpl(node);
				} catch (InvalidDataSourceImportException e) {
					throw new ParseException(node, e);
				}
			}
		};
		dataSourceImportList.put(id, list);
	}
	return list;
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-android,代码行数:20,代码来源:BellaDatiServiceImpl.java


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