本文整理汇总了Java中org.sakaiproject.site.api.SiteService.getSite方法的典型用法代码示例。如果您正苦于以下问题:Java SiteService.getSite方法的具体用法?Java SiteService.getSite怎么用?Java SiteService.getSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.site.api.SiteService
的用法示例。
在下文中一共展示了SiteService.getSite方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canRead
import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
public boolean canRead(String reference)
{
Reference ref = getReference(reference);
EntityProducer ep = getProducer(ref);
if (ep instanceof SiteService)
{
try
{
SiteService ss = (SiteService) ep;
ss.getSite(ref.getId());
return true;
}
catch (Exception ex)
{
log.debug(ex.getMessage());
}
}
return false;
}
示例2: getContent
import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
public String getContent(String reference)
{
Reference ref = getReference(reference);
EntityProducer ep = getProducer(ref);
if (ep instanceof SiteService)
{
try
{
SiteService ss = (SiteService) ep;
Site s = ss.getSite(ref.getId());
StringBuilder sb = new StringBuilder();
SearchUtils.appendCleanString(s.getTitle(), sb);
sb.append(" ");
for (HTMLParser hp = new HTMLParser(s.getShortDescription()); hp.hasNext();)
{
SearchUtils.appendCleanString(hp.next(), sb);
sb.append(" ");
}
for (HTMLParser hp = new HTMLParser(s.getDescription()); hp.hasNext();)
{
SearchUtils.appendCleanString(hp.next(), sb);
sb.append(" ");
}
return sb.toString();
}
catch (IdUnusedException e)
{
throw new RuntimeException(" Failed to get message content ", e); //$NON-NLS-1$
}
}
throw new RuntimeException(" Not a Message Entity " + reference); //$NON-NLS-1$
}
示例3: SearchAdminBeanImpl
import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
/**
* Construct a SearchAdminBean, checking permissions first
*
* @param request
* @param searchService
* @param siteService
* @param toolManager
* @param sessionManager
* @param securityService
* @param serverConfigurationService
* @throws IdUnusedException
* @throws PermissionException
*/
public SearchAdminBeanImpl(HttpServletRequest request,
SearchService searchService, SiteService siteService,
ToolManager toolManager, SessionManager sessionManager, SecurityService securityService, ServerConfigurationService serverConfigurationService)
throws IdUnusedException, PermissionException
{
this.serverConfigurationService = serverConfigurationService;
siteId = toolManager.getCurrentPlacement().getContext();
Site currentSite = siteService.getSite(siteId);
siteCheck = currentSite.getReference();
userName = sessionManager.getCurrentSessionUserId();
superUser = securityService.isSuperUser();
boolean allow = ( superUser ) || ( "true".equals(serverConfigurationService.getString("search.allow.maintain.admin","false")) &&
siteService.allowUpdateSite(siteId));
if ( !allow )
{
throw new PermissionException(userName, "site.update", siteCheck);
}
this.searchService = searchService;
// process any commands
String command = request.getParameter(COMMAND);
if (command != null)
{
internCommand = command.intern();
}
String indexBuilderName = request.getParameter(INDEX_BUILDER_NAME);
doCommand(indexBuilderName);
internCommand = null;
}
示例4: getIntersectionWithAvailableToolsInSite
import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
/**
* Intersect an event registry subset with tools available in site.
* @param eventRegistrySubset An Event Registry subset to intersect with.
* @param siteId The id of the site.
* @return The Event Registry containing events for tools present in site.
*/
public static List<ToolInfo> getIntersectionWithAvailableToolsInSite(SiteService M_ss, List<ToolInfo> eventRegistrySubset, String siteId) {
List<ToolInfo> intersected = new ArrayList<ToolInfo>();
Site site = null;
try{
site = M_ss.getSite(siteId);
}catch(IdUnusedException e){
return eventRegistrySubset;
}
// search the pages
List<ToolConfiguration> siteTools = new ArrayList<ToolConfiguration>();
for(Iterator<SitePage> iPages = site.getPages().iterator(); iPages.hasNext();){
SitePage page = iPages.next();
siteTools.addAll(page.getTools());
}
// add only tools in both lists
Iterator<ToolInfo> iTED = eventRegistrySubset.iterator();
while (iTED.hasNext()){
ToolInfo t = iTED.next();
Iterator<ToolConfiguration> iST = siteTools.iterator();
while (iST.hasNext()){
ToolConfiguration tc = iST.next();
if(tc.getToolId().equals(t.getToolId())){
intersected.add(t);
break;
}
}
}
return intersected;
}
示例5: siteForPID
import org.sakaiproject.site.api.SiteService; //导入方法依赖的package包/类
public static Site siteForPID(SiteService siteservice, String pid) {
Site togo = null;
try {
ToolConfiguration tc = siteservice.findTool(pid);
String siteID = tc.getSiteId();
togo = siteservice.getSite(siteID);
} catch (Exception iue) {
// In Mercury, we may get an NPE since there is no ToolConfiguration
}
return togo;
}