本文整理汇总了Java中org.sakaiproject.site.api.ToolConfiguration.getPageId方法的典型用法代码示例。如果您正苦于以下问题:Java ToolConfiguration.getPageId方法的具体用法?Java ToolConfiguration.getPageId怎么用?Java ToolConfiguration.getPageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.site.api.ToolConfiguration
的用法示例。
在下文中一共展示了ToolConfiguration.getPageId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPortalPageUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getPortalPageUrl(ToolConfiguration p)
{
SitePage sitePage = p.getContainingPage();
String page = getSiteHelper().lookupPageToAlias(p.getSiteId(), sitePage);
if (page == null)
{
// Fall back to default of using the page Id.
page = p.getPageId();
}
StringBuilder portalPageUrl = new StringBuilder();
portalPageUrl.append("/site/");
portalPageUrl.append(p.getSiteId());
portalPageUrl.append("/page/");
portalPageUrl.append(page);
return portalPageUrl.toString();
}
示例2: getCurrentSitePageId
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Get the current site page our current tool is placed on.
*
* @return The site page id on which our tool is placed.
*/
protected String getCurrentSitePageId()
{
ToolSession ts = SessionManager.getCurrentToolSession();
if (ts != null)
{
ToolConfiguration tool = SiteService.findTool(ts.getPlacementId());
if (tool != null)
{
return tool.getPageId();
}
}
return null;
}
示例3: getCurrentSitePageId
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Get the current site page our current tool is placed on.
*
* @return The site page id on which our tool is placed.
*/
protected String getCurrentSitePageId()
{
Placement placement = ToolManager.getCurrentPlacement();
ToolConfiguration tool = SiteService.findTool(placement.getId());
if (tool != null)
{
return tool.getPageId();
}
return null;
}
示例4: findPageIdFromToolId
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
private String findPageIdFromToolId(String pageId, String toolContextPath,
Site site) {
// If still can't find page id see if can determine it from a well known
// tool id (assumes that such a tool is in the site and the first instance of
// the tool found would be the right one).
String toolSegment = "/tool/";
String toolId = null;
try
{
// does the URL contain a tool id?
if (toolContextPath.contains(toolSegment)) {
toolId = toolContextPath.substring(toolContextPath.lastIndexOf(toolSegment)+toolSegment.length());
ToolConfiguration toolConfig = site.getToolForCommonId(toolId);
log.debug("trying to resolve page id from toolId: [{}]", toolId);
if (toolConfig != null) {
pageId = toolConfig.getPageId();
}
}
}
catch (Exception e) {
log.error("exception resolving page id from toolid :["+toolId+"]",e);
}
return pageId;
}
示例5: saveToolConfigTx
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* The transactino code for saving a tool config.
*/
protected void saveToolConfigTx(ToolConfiguration tool)
{
// delete this tool and tool properties
Object fields[] = new Object[2];
fields[0] = caseId(tool.getSiteId());
fields[1] = caseId(tool.getId());
String statement = siteServiceSql.getDeleteToolPropertySql();
m_sql.dbWrite(statement, fields);
statement = siteServiceSql.getDeleteToolSql();
m_sql.dbWrite(statement, fields);
// write the tool
statement = siteServiceSql.getInsertToolSql();
fields = new Object[7];
fields[0] = tool.getId();
fields[1] = tool.getPageId();
fields[2] = caseId(tool.getSiteId());
fields[3] = tool.getToolId();
fields[4] = Integer.valueOf(tool.getPageOrder());
fields[5] = tool.getTitle();
fields[6] = tool.getLayoutHints();
m_sql.dbWrite(statement, fields);
// write the tool's properties
writeProperties("SAKAI_SITE_TOOL_PROPERTY", "TOOL_ID", tool.getId(), "SITE_ID", caseId(tool.getSiteId()), tool.getPlacementConfig());
}
示例6: deleteContentLinkDao
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
protected String deleteContentLinkDao(Long key, String siteId, boolean isAdminRole, boolean isMaintainRole)
{
if ( ! isMaintainRole ) {
return rb.getString("error.maintain.link");
}
if ( key == null ) {
return rb.getString("error.id.not.found");
}
Map<String,Object> content = getContentDao(key, siteId, isAdminRole);
if ( content == null ) {
return rb.getString("error.content.not.found");
}
String pstr = (String) content.get(LTIService.LTI_PLACEMENT);
if ( pstr == null || pstr.length() < 1 ) {
return rb.getString("error.placement.not.found");
}
ToolConfiguration tool = siteService.findTool(pstr);
if ( tool == null ) {
return rb.getString("error.placement.not.found");
}
String siteStr = (String) content.get(LTI_SITE_ID);
// only admin can remove content from other site
if ( ! siteId.equals(siteStr) && !isAdminRole ) {
return rb.getString("error.placement.not.found");
}
try
{
Site site = siteService.getSite(siteStr);
String sitePageId = tool.getPageId();
SitePage page = site.getPage(sitePageId);
if ( page != null ) {
site.removePage(page);
try {
siteService.save(site);
} catch (Exception e) {
return rb.getString("error.placement.not.removed");
}
} else {
log.warn("LTI content={} placement={} could not find page in site={}", key, tool.getId(), siteStr);
}
// Remove the placement from the content item
// Our caller can remove the contentitem if they like
Properties newProps = new Properties();
newProps.setProperty(LTIService.LTI_PLACEMENT, "");
Object retval = updateContentDao(key, newProps, siteId, isAdminRole, isMaintainRole);
if ( retval instanceof String ) {
// Lets make this non-fatal
return rb.getFormattedMessage("error.link.placement.update", new Object[]{retval});
}
// success
return null;
}
catch (IdUnusedException ee)
{
log.warn("LTI content={} placement={} could not remove page from site={}", key, tool.getId(), siteStr);
return new String(rb.getFormattedMessage("error.link.placement.update", new Object[]{key.toString()}));
}
}