本文整理汇总了Java中org.sakaiproject.site.api.SiteService类的典型用法代码示例。如果您正苦于以下问题:Java SiteService类的具体用法?Java SiteService怎么用?Java SiteService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SiteService类属于org.sakaiproject.site.api包,在下文中一共展示了SiteService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: update
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
@Override
public void update(Observable o, Object obj) {
if (obj == null || !(obj instanceof Event))
{
return;
}
Event event = (Event) obj;
if (SiteService.EVENT_SITE_USER_INVALIDATE.equals(event.getEvent()))
{
Site site = null;
try {
site = siteService().getSite(event.getResource());
} catch (IdUnusedException e) {
log.warn("Security invalidation error when handling an event (" + event.getEvent() + "), for site " + event.getResource());
}
if (site != null) {
resetSecurityCache(site.getReference());
}
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:SakaiSecurity.java
示例2: setupServices
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Sets up the services needed by the BaseSite to operate
* @param siteService the BSS
* @param sessionManager the SM
* @param userDirectoryService the UDS
* @throws java.lang.IllegalStateException if the services would be null
*/
void setupServices(BaseSiteService siteService, SessionManager sessionManager, UserDirectoryService userDirectoryService) {
this.siteService = siteService;
if (this.siteService == null) {
this.siteService = (BaseSiteService) ComponentManager.get(SiteService.class);
if (this.siteService == null) {
throw new IllegalStateException("Cannot get the SiteService when constructing BaseSite");
}
}
this.authzGroupService = this.siteService.authzGroupService();
this.sessionManager = sessionManager;
if (this.sessionManager == null) {
this.sessionManager = (SessionManager) ComponentManager.get(SessionManager.class);
if (this.sessionManager == null) {
throw new IllegalStateException("Cannot get the SessionManager when constructing BaseSite");
}
}
this.userDirectoryService = userDirectoryService;
if (this.userDirectoryService == null) {
this.userDirectoryService = (UserDirectoryService) ComponentManager.get(UserDirectoryService.class);
if (this.userDirectoryService == null) {
throw new IllegalStateException("Cannot get the UserDirectoryService when constructing BaseSite");
}
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:32,代码来源:BaseSite.java
示例3: getSiteUpdaters
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Returns a map of display name onto user id for each user, in the
* specified site, with site.upd. If a user doesn't have an email specced,
* they aren't returned.
*
* @param siteId The site to retrieve updaters for
* @return A map of display name onto user id
*/
public Map<String, String> getSiteUpdaters(String siteId) {
try {
Site site = siteService.getSite(siteId);
Map<String, String> map = new HashMap<String, String>();
Set<String> userIds = site.getUsersIsAllowed(SiteService.SECURE_UPDATE_SITE);
Set<String> hiddenUserIds = privacyManager.findHidden("/site/" + siteId, userIds);
userIds.removeAll(hiddenUserIds);
List<User> users = userDirectoryService.getUsers(userIds);
for (User user : users) {
String email = user.getEmail();
if (email != null && email.length() > 0) {
map.put(user.getId(), user.getDisplayName());
}
}
return map;
} catch (Exception e) {
log.error("Failed to get site updaters for site : " + siteId + ". Returning an empty map ...");
return new HashMap<String, String>();
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:SakaiProxy.java
示例4: refreshAuthzGroup
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void refreshAuthzGroup(BaseAuthzGroup azGroup) {
if (azGroup == null) return;
if (azGroup.m_isNew) {
// refresh new authz groups immediately
log.debug("Refresh new authz group: {}", azGroup.getId());
refreshAuthzGroupInternal(azGroup);
// refresh parent
Reference reference = entityManager.newReference(azGroup.getId());
if (SiteService.APPLICATION_ID.equals(reference.getType()) && SiteService.GROUP_SUBTYPE.equals(reference.getSubType())) {
try {
refreshAuthzGroupInternal((BaseAuthzGroup) getAuthzGroup(siteService.siteReference(reference.getContainer())));
} catch (Exception e) {
log.warn("Cannot refresh parent authz group for authz group: {}", azGroup.getId(), e);
}
}
} else {
// Add the AuthzGroup to the queue, keyed on id to eliminate duplicate refreshes
log.debug("Queue authz group for refresh " + azGroup.getId());
refreshQueue.put(azGroup.getId(), azGroup);
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:DbAuthzGroupService.java
示例5: SiteEmailNotificationRWiki
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Construct.
*/
public SiteEmailNotificationRWiki(RWikiObjectService rwikiObjectService,
RenderService renderService, PreferenceService preferenceService,
SiteService siteService, SecurityService securityService,
EntityManager entityManager, ThreadLocalManager threadLocalManager,
TimeService timeService, DigestService digestService, UserDirectoryService userDirectoryService, String siteId) {
super(siteId);
this.renderService = renderService;
this.rwikiObjectService = rwikiObjectService;
this.preferenceService = preferenceService;
this.siteService = siteService;
this.securityService = securityService;
this.entityManager = entityManager;
this.threadLocalManager = threadLocalManager;
this.timeService = timeService;
this.digestService = digestService;
this.userDirectoryService = userDirectoryService;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:SiteEmailNotificationRWiki.java
示例6: DeveloperHelperServiceImpl
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Full constructor
* @param entityBroker
* @param entityBrokerManager
* @param authzGroupService
* @param functionManager
* @param securityService
* @param serverConfigurationService
* @param sessionManager
* @param siteService
* @param toolManager
* @param userDirectoryService
*/
public DeveloperHelperServiceImpl(EntityBroker entityBroker,
EntityBrokerManager entityBrokerManager,
AuthzGroupService authzGroupService,
FunctionManager functionManager, SecurityService securityService,
ServerConfigurationService serverConfigurationService, SessionManager sessionManager,
SiteService siteService, ToolManager toolManager,
UserDirectoryService userDirectoryService) {
super(entityBroker, entityBrokerManager);
this.authzGroupService = authzGroupService;
this.functionManager = functionManager;
this.securityService = securityService;
this.serverConfigurationService = serverConfigurationService;
this.sessionManager = sessionManager;
this.siteService = siteService;
this.toolManager = toolManager;
this.userDirectoryService = userDirectoryService;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:31,代码来源:DeveloperHelperServiceImpl.java
示例7: init
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Initialize the servlet.
*
* @param config
* The servlet config.
* @throws ServletException
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
//load service level dependecies from the ComponentManager
siteService = (SiteService) ComponentManager.get("org.sakaiproject.site.api.SiteService");
accessProviderManager = (HttpServletAccessProviderManager) ComponentManager
.get("org.sakaiproject.entitybroker.access.HttpServletAccessProviderManager");
forumManager = (DiscussionForumManager) ComponentManager
.get("org.sakaiproject.api.app.messageforums.ui.DiscussionForumManager");
//register forum Entity prefixes for direct servlet request handling
if (accessProviderManager != null) {
accessProviderManager.registerProvider("forum_topic", this);
accessProviderManager.registerProvider("forum", this);
accessProviderManager.registerProvider("forum_message", this);
}
//mark initialization of dependecies as complete
if (siteService != null && forumManager != null)
initComplete = true;
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:32,代码来源:MessageForumsFilePickerServlet.java
示例8: testRaisesCheckedExceptionsInUncheckedExceptionsIfSoConfigured
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
public void testRaisesCheckedExceptionsInUncheckedExceptionsIfSoConfigured() throws PermissionException {
cleanupAction.setPropagateExceptions(true);
expectInit();
final String resourceId = "/entity/id";
final PermissionException failure =
new PermissionException("user-123", SiteService.SECURE_REMOVE_SITE, resourceId);
checking(new Expectations() {{
allowing(inboundEvent).getResource(); will(returnValue(resourceId));
one(aliasService).removeTargetAliases(resourceId); will(throwException(failure));
}});
cleanupAction.init();
try {
cleanupAction.notify(inboundNotification, inboundEvent);
fail("Should have raised an unchecked exception wrapping the checked exception indicating failure to delete aliases");
} catch ( RuntimeException e ) {
assertSame("Didn't wrap exception representing failure to delete aliases", failure, e.getCause());
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:20,代码来源:SiteAliasCleanupNotificationActionTest.java
示例9: doSearch2
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Uses ONLY Sakai API for site membership, user role and group membership.
* @throws SQLException
*/
private void doSearch2() throws SQLException {
long start = (new Date()).getTime();
userSitesRows = new ArrayList<>();
thisUserId = M_session.getCurrentSessionUserId();
setSakaiSessionUser(userId);
log.debug("Switched CurrentSessionUserId: " + M_session.getCurrentSessionUserId());
List siteList = org.sakaiproject.site.cover.SiteService.getSites(SelectionType.ACCESS, null, null, null, SortType.TITLE_ASC, null);
setSakaiSessionUser(thisUserId);
Iterator i = siteList.iterator();
while (i.hasNext()){
Site s = (Site) i.next();
UserSitesRow row = new UserSitesRow(s, getGroups(userId, s.getId()), getActiveUserRoleInSite(userId, s));
userSitesRows.add(row);
}
long end = (new Date()).getTime();
log.debug("doSearch2() took total of "+((end - start)/1000)+" sec.");
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:SiteListBean.java
示例10: CurrentSiteViewImpl
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
public CurrentSiteViewImpl(PortalSiteHelperImpl siteHelper,
SiteNeighbourhoodService siteNeighbourhoodService,
HttpServletRequest request, Session session, String currentSiteId,
SiteService siteService,
ServerConfigurationService serverConfigurationService,
PreferencesService preferencesService)
{
this.siteHelper = siteHelper;
this.request = request;
this.currentSiteId = currentSiteId;
this.session = session;
Site myWorkspaceSite = siteHelper.getMyWorkspace(session);
loggedIn = session.getUserId() != null;
if (myWorkspaceSite != null)
{
myWorkspaceSiteId = myWorkspaceSite.getId();
}
initDone = false;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:CurrentSiteViewImpl.java
示例11: testNonExistentSiteId
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
@Test
public void testNonExistentSiteId() {
/*
* See KNL-512 sending a realm ID that doesn't exit to
* .BaseSiteService.setUserSecurity causes a db error
*
*/
SiteService siteService = getService(SiteService.class);
workAsAdmin();
Set<String> siteSet = new TreeSet<String>();
siteSet.add("nosuchSite");
try {
siteService.setUserSecurity("admin", siteSet, siteSet, siteSet);
}
catch (Exception e) {
log.error(e.getMessage(), e);
Assert.fail();
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:SiteServiceTest.java
示例12: testSiteIdAccept
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
@Test
public void testSiteIdAccept() throws Exception {
User sender = mock(User.class);
when(userDirectoryService.findUsersByEmail("[email protected]")).thenReturn(Collections.singleton(sender));
MailArchiveChannel channel = mock(MailArchiveChannel.class);
when(channel.getEnabled()).thenReturn(true);
when(channel.getOpen()).thenReturn(false);
when(channel.allowAddMessage(sender)).thenReturn(true);
when(channel.getId()).thenReturn("channelId");
when(channel.getContext()).thenReturn("siteId");
when(mailArchiveService.channelReference("siteId", SiteService.MAIN_CONTAINER)).thenReturn("/site/siteId");
when(mailArchiveService.getMailArchiveChannel("/site/siteId")).thenReturn(channel);
SmartClient client = createClient();
client.from("[email protected]");
client.to("[email protected]");
writeData(client, "/simple-email.txt");
verify(channel, times(1)).addMailArchiveMessage(anyString(), eq("[email protected]"), any(), any(), any(), any());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:SakaiMessageHandlerTest.java
示例13: DropboxNotification
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
public DropboxNotification(SecurityService securityService, ContentHostingService contentHostingService, EntityManager entityManager,
SiteService siteService, UserDirectoryService userDirectoryService, ServerConfigurationService serverConfigurationService) {
this.securityService = securityService;
this.contentHostingService = contentHostingService;
this.entityManager = entityManager;
this.siteService = siteService;
this.userDirectoryService = userDirectoryService;
this.serverConfigurationService = serverConfigurationService;
loadResources();
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:11,代码来源:DropboxNotification.java
示例14: searchForEvalGroupIds
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
public List<String> searchForEvalGroupIds(String searchString, String order, int startResult, int maxResults) {
//for now support sakai sites only TODO:// support hierarchy and adhoc groups. Ordering?
List<String> sakaiSites = new ArrayList<String>(); //keep site ref
List<Site> searchResults = siteService.getSites(SiteService.SelectionType.ANY, null, searchString, null, SiteService.SortType.TITLE_ASC, new PagingPosition(1, maxResults));
for ( Object rawSite : searchResults){
Site site = (Site) rawSite;
sakaiSites.add(site.getReference());
}
return sakaiSites;
}
开发者ID:sakaicontrib,项目名称:evaluation,代码行数:11,代码来源:EvalExternalLogicImpl.java
示例15: updateSiteSecurity
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* Update the site security based on the values in the AuthzGroup, if it is a site AuthzGroup.
*
* @param azGroup
* The AuthzGroup.
*/
protected void updateSiteSecurity(AuthzGroup azGroup)
{
// Special code for the site service
Reference ref = entityManager().newReference(azGroup.getId());
if (SiteService.APPLICATION_ID.equals(ref.getType()) && SiteService.SITE_SUBTYPE.equals(ref.getSubType()))
{
// collect the users
Set updUsers = azGroup.getUsersIsAllowed(SiteService.SECURE_UPDATE_SITE);
Set unpUsers = azGroup.getUsersIsAllowed(SiteService.SITE_VISIT_UNPUBLISHED);
Set visitUsers = azGroup.getUsersIsAllowed(SiteService.SITE_VISIT);
siteService.setSiteSecurity(ref.getId(), updUsers, unpUsers, visitUsers);
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:BaseAuthzGroupService.java
示例16: testSearch
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
@Test
public void testSearch() throws Exception {
SiteService siteService = getService(SiteService.class);
siteService.countSites(SelectionType.ACCESS, null, null, null);
siteService.countSites(SelectionType.ANY, null, null, null);
siteService.countSites(SelectionType.JOINABLE, null, null, null);
siteService.countSites(SelectionType.NON_USER, null, null, null);
siteService.countSites(SelectionType.PUBVIEW, null, null, null);
siteService.countSites(SelectionType.UPDATE, null, null, null);
siteService.countSites(SelectionType.DELETED, null, null, null);
siteService.countSites(SelectionType.ANY_DELETED, null, null, null);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:14,代码来源:SiteSearchTest.java
示例17: SearchBeanImpl
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
/**
* @see #SearchBeanImpl(HttpServletRequest, SearchService, SiteService, ToolManager)
*/
public SearchBeanImpl(HttpServletRequest request, String sortName,
String filterName, SearchService searchService,
SiteService siteService, ToolManager toolManager,
UserDirectoryService userDirectoryService, SecurityService securityService, ServerConfigurationService serverConfigurationService) throws IdUnusedException
{
this(request, searchService, siteService, toolManager, userDirectoryService, securityService, serverConfigurationService);
this.sortName = sortName;
this.filterName = filterName;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:SearchBeanImpl.java
示例18: init
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
public void init()
{
ComponentManager cm = org.sakaiproject.component.cover.ComponentManager
.getInstance();
sessionManager = (SessionManager) load(cm, SessionManager.class
.getName());
searchService = (SearchService) load(cm, SearchService.class.getName());
siteService = (SiteService) load(cm, SiteService.class.getName());
toolManager = (ToolManager) load(cm, ToolManager.class.getName());
userDirectoryService = (UserDirectoryService) load(cm, UserDirectoryService.class.getName());
securityService = (SecurityService)load(cm, SecurityService.class.getName());
serverConfigurationService = (ServerConfigurationService) load(cm, ServerConfigurationService.class.getName());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:SearchBeanFactoryImpl.java
示例19: 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
示例20: init
import org.sakaiproject.site.api.SiteService; //导入依赖的package包/类
public void init()
{
addEvents = new ArrayList<String>();
removeEvents = new ArrayList<String>();
addEvents.add(SiteService.SECURE_ADD_COURSE_SITE);
addEvents.add(SiteService.SECURE_ADD_SITE);
addEvents.add(SiteService.SECURE_ADD_USER_SITE);
addEvents.add(SiteService.SECURE_UPDATE_GROUP_MEMBERSHIP);
addEvents.add(SiteService.SECURE_UPDATE_SITE);
addEvents.add(SiteService.SECURE_UPDATE_SITE_MEMBERSHIP);
removeEvents.add(SiteService.SECURE_REMOVE_SITE);
if ("true".equals(serverConfigurationService.getString("search.enable", "false")))
{
for (Iterator i = addEvents.iterator(); i.hasNext();)
{
searchService.registerFunction((String) i.next());
}
for (Iterator i = removeEvents.iterator(); i.hasNext();)
{
searchService.registerFunction((String) i.next());
}
searchIndexBuilder.registerEntityContentProducer(this);
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:28,代码来源:SiteContentProducer.java
注:本文中的org.sakaiproject.site.api.SiteService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论