本文整理匯總了Java中org.sakaiproject.tool.api.Placement.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java Placement.getId方法的具體用法?Java Placement.getId怎麽用?Java Placement.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.sakaiproject.tool.api.Placement
的用法示例。
在下文中一共展示了Placement.getId方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCurrentToolId
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
public String getCurrentToolId() {
/*
* Attempt to get the current tool from the tool manager. The current
* tool is tracked via a ThreadLocal and is not accessible via the
* EntityBroker.
*/
Placement placement = toolManager.getCurrentPlacement();
if (placement != null) {
return placement.getId();
} else {
return null;
}
}
示例2: initState
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
/**
* Populate the state object, if needed.
*/
protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)
{
super.initState(state, portlet, rundata);
// setup the observer to notify our main panel
if (state.getAttribute(STATE_OBSERVER) == null)
{
// get the current tool placement
Placement placement = ToolManager.getCurrentPlacement();
// location is just placement
String location = placement.getId();
// setup the observer to watch for all presence, disabled so we start in manual mode
PresenceObservingCourier courier = new PresenceObservingCourier(location);
courier.setResourcePattern(null);
courier.disable();
state.setAttribute(STATE_OBSERVER, courier);
// init the display mode
state.setAttribute(STATE_DISPLAY_MODE, MODE_SERVERS);
}
}
示例3: clientWindowId
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
/**
* Compute the deliver address for the current request. Compute the client window id, based on the float state
*
* @param state
* The tool state.
* @param toolId
* The tool instance id, which might be used as part of the client window id if floating.
* @return The client window id, based on the float state.
*/
protected String clientWindowId(SessionState state, String toolId)
{
// TODO: drop the params
// get the Sakai session
Session session = SessionManager.getCurrentSession();
// get the current tool placement
Placement placement = ToolManager.getCurrentPlacement();
// compute our courier delivery address: this placement in this session
String deliveryId = session.getId() + placement.getId();
return deliveryId;
}
示例4: createPortletWindow
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
private void createPortletWindow(Placement placement) throws ToolRenderException
{
SakaiPortletConfig pc = new SakaiPortletConfig(placement);
if (!pc.isPortletConfig())
{
return;
}
String windowId = placement.getId();
SakaiPortletWindow window = new SakaiPortletWindow(windowId, pc.contextPath,
pc.portletName);
portletWindows.put(windowId, window);
}
示例5: doOptions
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
/**
* Handle a request to set options.
*/
public void doOptions(RunData runData, Context context)
{
// ignore if not allowed
if (!allowedToOptions())
{
return;
//msg = "you do not have permission to set options for this Worksite.";
}
Placement placement = ToolManager.getCurrentPlacement();
String pid = null;
if (placement != null) pid = placement.getId();
SessionState state = ((JetspeedRunData) runData).getPortletSessionState(pid);
// go into options mode
state.setAttribute(STATE_MODE, MODE_OPTIONS);
// disable auto-updates while editing
disableObservers(state);
// if we're not in the main panel for this tool, schedule an update of the main panel
String currentPanelId = runData.getParameters().getString(ActionURL.PARAM_PANEL);
if (!LAYOUT_MAIN.equals(currentPanelId))
{
String mainPanelId = mainPanelUpdateId(pid);
schedulePeerFrameRefresh(mainPanelId);
}
}
示例6: rewriteURL
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
/**
* Rewrites the given URL to insert the current tool placement id, if any, as the start of the path
*
* @param url
* The url to rewrite.
*/
protected String rewriteURL(String url)
{
// only if we are in native url mode - if in Sakai mode, don't include the placement id
if (m_req.getAttribute(NATIVE_URL) != null)
{
// if we have a tool placement to add, add it
Placement placement = (Placement) m_req.getAttribute(PLACEMENT);
if (placement != null)
{
String placementId = placement.getId();
// compute the URL root "back" to this servlet
// Note: this must not be pre-computed, as it can change as things are dispatched
StringBuilder full = new StringBuilder();
full.append(m_req.getScheme());
full.append("://");
full.append(m_req.getServerName());
if (((m_req.getServerPort() != 80) && (!m_req.isSecure()))
|| ((m_req.getServerPort() != 443) && (m_req.isSecure())))
{
full.append(":");
full.append(m_req.getServerPort());
}
// include just the context path - anything to this context will get the encoding
StringBuilder rel = new StringBuilder();
rel.append(m_req.getContextPath());
full.append(rel.toString());
// if we match the fullUrl, or the relUrl, assume that this is a URL back to this servlet context
if ((url.startsWith(full.toString()) || url.startsWith(rel.toString())))
{
// put the placementId in as a parameter
StringBuilder newUrl = new StringBuilder(url);
if (url.indexOf('?') != -1)
{
newUrl.append('&');
}
else
{
newUrl.append('?');
}
newUrl.append(Tool.PLACEMENT_ID);
newUrl.append("=");
newUrl.append(placementId);
// TODO: (or not) let the wrapped resp. do the work, too
return newUrl.toString();
}
}
}
return url;
}
示例7: init
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
public void init() {
Tool tool = (Tool) request.getAttribute("sakai.tool");
placement = (Placement) request.getAttribute("sakai.tool.placement");
if (tool != null && placement != null) {
String toolid = tool.getId();
String toolinstancepid = placement.getId();
String frameid = FrameAdjustingProducer.deriveFrameTitle(toolinstancepid);
// Deliver the rewrite rule to the renderer that will invoke the
// relevant
// Javascript magic to resize our frame.
String sakaionload = (String) request.getAttribute("sakai.html.body.onload");
String hname = "addSakaiRSFDomModifyHook";
// String fullonload = "if (" + hname + "){" + hname + "(\"" +
// frameid +
// "\");};" + sakaionload;
String fullonload = "if (typeof(" + hname + ") != 'undefined'){ " + hname + "('" + frameid + "');}"
+ sakaionload;
FlatSCR bodyscr = new FlatSCR();
bodyscr.addNameValue(new NameValue("onload", fullonload));
bodyscr.tag_type = ComponentRenderer.NESTING_TAG;
Logger.log.info("Got tool dispatcher id of " + toolid + " resourceBaseURL " + bup.getResourceBaseURL()
+ " baseURL " + bup.getBaseURL() + " and Sakai PID " + toolinstancepid);
// Compute the ConsumerInfo object.
site = SakaiNavConversion.siteForPID(siteservice, toolinstancepid);
// tc will be null for Mercury portal
ToolConfiguration tc = siteservice.findTool(toolinstancepid);
if (tc != null) {
sitepage = SakaiNavConversion.pageForToolConfig(siteservice, tc);
}
bodyscr.setName(SakaiBodyTPI.SAKAI_BODY);
src.addSCR(bodyscr);
} else {
NullRewriteSCR bodyscr2 = new NullRewriteSCR();
bodyscr2.setName(SakaiBodyTPI.SAKAI_BODY);
src.addSCR(bodyscr2);
}
SakaiPortalMatterSCR matterscr = new SakaiPortalMatterSCR();
String headMatter = (String) request.getAttribute("sakai.html.head");
if (headMatter == null) {
headMatter = DefaultPortalMatter.getDefaultPortalMatter(site,request);
}
matterscr.setHeadMatter(headMatter);
src.addSCR(matterscr);
consumerinfo = new ConsumerInfo();
consumerinfo.urlbase = bup.getBaseURL();
consumerinfo.resourceurlbase = bup.getResourceBaseURL();
consumerinfo.consumertype = "sakai";
consumerinfo.externalURL = sitepage == null ? consumerinfo.urlbase : URLUtil.deSpace(sitepage.getUrl());
}
示例8: setupTool
import org.sakaiproject.tool.api.Placement; //導入方法依賴的package包/類
protected void setupTool() {
Placement placement = getToolManager().getCurrentPlacement();
placementId = placement.getId();
// Really only calling this just to make sure a room gets created
getSiteChannels();
ChatChannel defaultChannel = getChatManager().getDefaultChannel(placement.getContext(), placement.getId());
setCurrentChannel(new DecoratedChatChannel(this, defaultChannel));
return;
}