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


Java SiteService.getSites方法代码示例

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


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

示例1: init

import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
public void init() {
	log.info("init ConnectorHelper");
	siteService = (SiteService) ComponentManager.get("org.sakaiproject.site.api.SiteService");
	assignmentService = (AssignmentService) ComponentManager.get("org.sakaiproject.assignment.api.AssignmentService");
	authzGroupService = (AuthzGroupService) ComponentManager.get("org.sakaiproject.authz.api.AuthzGroupService");
	securityService = (SecurityService) ComponentManager.get("org.sakaiproject.authz.api.SecurityService");
	sites = siteService.getSites(org.sakaiproject.site.api.SiteService.SelectionType.UPDATE, null, null, null, SortType.TITLE_ASC, null);
	loggedInUserId = SessionManager.getCurrentSession().getUserId();
	
	entityBroker = (EntityBroker) ComponentManager.get(EntityBroker.class);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:12,代码来源:ConnectorHelper.java

示例2: testJoinableSiteSQL

import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
@Test
public void testJoinableSiteSQL() throws Exception {
	// This test came about through KNL-1294 and was written to test that joinable sites search worked
	// when also supplying a map of properties to search for.
	SessionManager sessionManager = getService(SessionManager.class);
	SiteService siteService = getService(SiteService.class);

	Session session = sessionManager.getCurrentSession();
	session.setUserEid("admin");
	session.setUserId("admin");

	// Use a random UUID for type so database state can't break the test.
	String type = UUID.randomUUID().toString();
	Site site = siteService.addSite(UUID.randomUUID().toString(), type);
	site.setJoinable(true);
	site.setJoinerRole("access");
	site.setPublished(true);
	site.setTitle("Site");
	site.getPropertiesEdit().addProperty("key", "value");
	siteService.save(site);

	Map stringMap = Collections.singletonMap("key", "value");

	// Need to switch user so we're not a member of the site.
	session.setUserEid("someuser");
	session.setUserId("someuser");
	List<Site> sites;
	// First test search for any with properties.
	sites = siteService.getSites(SelectionType.ANY, type, null, stringMap, SiteService.SortType.TITLE_ASC, null);
	Assert.assertEquals(1, sites.size());
	// Then test that it's joinable with properties
	sites = siteService.getSites(SelectionType.JOINABLE, type, null, stringMap, SiteService.SortType.TITLE_ASC, null);
	Assert.assertEquals(1, sites.size());
	// Then test that it's joinable and with criteria
	sites = siteService.getSites(SelectionType.JOINABLE, type, "Site", null, SiteService.SortType.TITLE_ASC, null);
	Assert.assertEquals(1, sites.size());
	// Then test that it's joinable and with criteria and properties
	sites = siteService.getSites(SelectionType.JOINABLE, type, "Site", stringMap, SiteService.SortType.TITLE_ASC, null);
	Assert.assertEquals(1, sites.size());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:41,代码来源:SiteSearchTest.java


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