本文整理汇总了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);
}
示例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());
}