當前位置: 首頁>>代碼示例>>Java>>正文


Java Placement類代碼示例

本文整理匯總了Java中org.sakaiproject.tool.api.Placement的典型用法代碼示例。如果您正苦於以下問題:Java Placement類的具體用法?Java Placement怎麽用?Java Placement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Placement類屬於org.sakaiproject.tool.api包,在下文中一共展示了Placement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
        }

    }
 
開發者ID:ITYug,項目名稱:kaltura-ce-sakai-extension,代碼行數:17,代碼來源:SakaiExternalLogicImpl.java

示例2: getSiteId

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
/**
 * Get the current site id
 * @param state SessionState
 * @throws SessionDataException
 * @return Site id (GUID)
 */
private String getSiteId(SessionState state) throws SessionDataException
{
	// Check if it is state (i.e. we are a helper in site.info)
	String retval = (String) state.getAttribute(STATE_SITE_INSTANCE_ID);
	if ( retval != null ) return retval;

	// If it is not in state, we must be stand alone
	Placement placement = ToolManager.getCurrentPlacement();

	if (placement == null)
	{
		throw new SessionDataException("No current tool placement");
	}
	return placement.getContext();
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:22,代碼來源:LinkAction.java

示例3: getCorrectProperty

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
public static String getCorrectProperty(Properties config,
		String propName, Placement placement)
{
	// Check for global overrides in properties
	String allowSettings = ServerConfigurationService.getString(BASICLTI_SETTINGS_ENABLED, BASICLTI_SETTINGS_ENABLED_DEFAULT);
	if ( LTIService.LTI_ALLOWSETTINGS.equals(propName) && ! "true".equals(allowSettings) ) return "false";

	String allowRoster = ServerConfigurationService.getString(BASICLTI_ROSTER_ENABLED, BASICLTI_ROSTER_ENABLED_DEFAULT);
	if ( LTIService.LTI_ALLOWROSTER.equals(propName) && ! "true".equals(allowRoster) ) return "false";

	String allowContentLink = ServerConfigurationService.getString(BASICLTI_CONTENTLINK_ENABLED, BASICLTI_CONTENTLINK_ENABLED_DEFAULT);
	if ( "contentlink".equals(propName) && ! "true".equals(allowContentLink) ) return null;

	// Check for explicit setting in properties
	String propertyName = placement.getToolId() + "." + propName;
	String propValue = ServerConfigurationService.getString(propertyName,null);
	if ( propValue != null && propValue.trim().length() > 0 ) {
		log.debug("Sakai.home {}={}", propName, propValue);
		return propValue;
	}

	// Take it from the placement
	return config.getProperty("imsti."+propName, null);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:25,代碼來源:SakaiBLTIUtil.java

示例4: doGet

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
/**
 * Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode
 */
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException
{
	// set in VmServlet
	ParameterParser params = (ParameterParser) req.getAttribute(ATTR_PARAMS);

	// we will need some covers... Note: parameters are parsed (i.e. files are read) here
	Context context = new Context(this, req);
	Placement placement = ToolManager.getCurrentPlacement();
	PortletConfig config = new PortletConfig(getServletConfig(), placement.getPlacementConfig(), placement.getTool()
			.getRegisteredConfig(), placement);
	VelocityPortlet portlet = new VelocityPortlet(getPid(req), config);
	JetspeedRunData rundata = new JetspeedRunData(req, getState(req), getPid(req), params);

	req.setAttribute(ATTR_CONTEXT, context);
	req.setAttribute(ATTR_CONFIG, config);
	req.setAttribute(ATTR_PORTLET, portlet);
	req.setAttribute(ATTR_RUNDATA, rundata);

	super.doGet(req, res);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:24,代碼來源:VelocityPortletPaneledAction.java

示例5: isPropertyFinal

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
public boolean isPropertyFinal(String propName)
{
	Placement placement = ToolManager.getCurrentPlacement();
	String propertyName = placement.getToolId() + "." + propName;
	String propValue = ServerConfigurationService.getString(propertyName,null);
	if ( propValue != null && propValue.trim().length() > 0 ) {
		return true;
	}

	Properties config = placement.getConfig();
	propValue = getSakaiProperty(config, "imsti."+propName);
	if ( propValue != null && "true".equals(config.getProperty("final."+propName)) )
	{
		return true;
	}
	return false;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:18,代碼來源:IMSBLTIPortlet.java

示例6: 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);
	}

}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:28,代碼來源:PresenceToolAction.java

示例7: isPortletModeAllowed

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
public boolean isPortletModeAllowed(Placement placement, String mode)
{
	if (placement == null || mode == null) return false;
	PortletDD pdd = getPortletDD(placement);
	if (pdd == null) return true;
	Iterator supports = pdd.getSupports().iterator();
	while (supports.hasNext())
	{
		SupportsDD sup = (SupportsDD) supports.next();
		Iterator modes = sup.getPortletModes().iterator();
		while (modes.hasNext())
		{
			if (modes.next().toString().equalsIgnoreCase(mode.toString()))
			{
				return true;
			}
		}
	}
	return false;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:21,代碼來源:PortletToolRenderService.java

示例8: getContextId

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
/**
 * ContextId is present site id for now.
 */
private String getContextId() {
    if (TestUtil.isRunningTests()) {
        return "test-context";
    }
    String presentSiteId = null;
    Placement placement = toolManager.getCurrentPlacement();
    if(placement == null){
    	//current placement is null.. let's try another approach to getting the site id
    	if(sessionManager.getCurrentToolSession() != null){
    		ToolConfiguration toolConfig = siteService.findTool(sessionManager.getCurrentToolSession().getId());
    		if(toolConfig != null){
    			presentSiteId = toolConfig.getSiteId();
    		}
    	}
    }else{
    	presentSiteId = placement.getContext();
    }
    log.debug("site: " + presentSiteId);
    return presentSiteId;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:24,代碼來源:MessageForumsForumManagerImpl.java

示例9: 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;

}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:26,代碼來源:VelocityPortletPaneledAction.java

示例10: getSiteId

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
/**
 * Get the current site id
 * @throws SessionDataException
 * @return Site id (GUID)
 */
private String getSiteId() throws SessionDataException
{
	Placement placement = ToolManager.getCurrentPlacement();

	if (placement == null)
	{
		throw new SessionDataException("No current tool placement");
	}
	return placement.getContext();
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:16,代碼來源:PortletIFrame.java

示例11: getAllProperties

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
private Properties getAllProperties(Placement placement)
{
    Properties config = placement.getTool().getRegisteredConfig();
    Properties mconfig = placement.getPlacementConfig();
    for ( Object okey : mconfig.keySet() ) {
        String key = (String) okey;
        config.setProperty(key,mconfig.getProperty(key));
    }
    return config;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:11,代碼來源:PortletIFrame.java

示例12: processActionEdit

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
public void processActionEdit(ActionRequest request, ActionResponse response)
throws PortletException, IOException 
{
	// TODO: Check Role

	// Stay in EDIT mode unless we are successful
	response.setPortletMode(PortletMode.EDIT);

	Placement placement = ToolManager.getCurrentPlacement();
	// get the site toolConfiguration, if this is part of a site.
	ToolConfiguration toolConfig = SiteService.findTool(placement.getId());
	String id = request.getParameter(LTIService.LTI_ID);
	String toolId = request.getParameter(LTIService.LTI_TOOL_ID);
	Properties reqProps = new Properties();
	Enumeration names = request.getParameterNames();
	while (names.hasMoreElements())
	{
		String name = (String) names.nextElement();
		reqProps.setProperty(name, request.getParameter(name));
	}
	Object retval = m_ltiService.updateContent(Long.parseLong(id), reqProps, placement.getContext());
	String fa_icon = (String)request.getParameter(LTIService.LTI_FA_ICON);
	if ( fa_icon != null && fa_icon.length() > 0 ) {
		placement.getPlacementConfig().setProperty("imsti.fa_icon",fa_icon);
	}

	placement.save();

	response.setPortletMode(PortletMode.VIEW);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:31,代碼來源:SakaiIFrame.java

示例13: sakaiInfo

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
public static boolean sakaiInfo(Properties props, Placement placement, ResourceLoader rb)
{
	log.debug("placement={}", placement.getId());
	log.debug("placement title={}", placement.getTitle());
	String context = placement.getContext();
	log.debug("ContextID={}", context);

	return sakaiInfo(props, context, placement.getId(), rb);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:10,代碼來源:SakaiBLTIUtil.java

示例14: getContentItemFromRequest

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
/**
 * Create a ContentItem from the current request (may throw runtime)
 */
public static ContentItem getContentItemFromRequest(Map<String, Object> tool)
{

	Placement placement = ToolManager.getCurrentPlacement();
	String siteId = placement.getContext();

	String toolSiteId = (String) tool.get(LTIService.LTI_SITE_ID);
	if ( toolSiteId != null && ! toolSiteId.equals(siteId) ) {
		throw new RuntimeException("Incorrect site id");
	}

	HttpServletRequest req = ToolUtils.getRequestFromThreadLocal();

	String lti_log = req.getParameter("lti_log");
	String lti_errorlog = req.getParameter("lti_errorlog");
	if ( lti_log != null ) log.debug(lti_log);
	if ( lti_errorlog != null ) log.warn(lti_errorlog);

	ContentItem contentItem = new ContentItem(req);

	String oauth_consumer_key = req.getParameter("oauth_consumer_key");
	String oauth_secret = (String) tool.get(LTIService.LTI_SECRET);
	oauth_secret = decryptSecret(oauth_secret);

	String URL = getOurServletPath(req);
	if ( ! contentItem.validate(oauth_consumer_key, oauth_secret, URL) ) {
		log.warn("Provider failed to validate message: {}", contentItem.getErrorMessage());
		String base_string = contentItem.getBaseString();
		if ( base_string != null ) log.warn("base_string={}", base_string);
		throw new RuntimeException("Failed OAuth validation");
	}
	return contentItem;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:37,代碼來源:SakaiBLTIUtil.java

示例15: getCorrectProperty

import org.sakaiproject.tool.api.Placement; //導入依賴的package包/類
public String getCorrectProperty(PortletRequest request, String propName, String defaultValue)
{
	Placement placement = ToolManager.getCurrentPlacement();
	String propertyName = placement.getToolId() + "." + propName;
	String propValue = ServerConfigurationService.getString(propertyName,null);
	if ( propValue != null && propValue.trim().length() > 0 ) {
		log.debug("Sakai.home {}={}", propName, propValue);
		return propValue;
	}

	Properties config = placement.getConfig();
	propValue = getSakaiProperty(config, "imsti."+propName);
	if ( propValue != null && "true".equals(config.getProperty("final."+propName)) )
	{
		log.debug("Frozen {} ={}", propName, propValue);
		return propValue;
	}

	PortletPreferences prefs = request.getPreferences();
	propValue = prefs.getValue("imsti."+propName, null);
	if ( propValue != null ) {
		log.debug("Portlet {} ={}", propName, propValue);
		return propValue;
	}

	propValue = getSakaiProperty(config, "imsti."+propName);
	if ( propValue != null ) {
		log.debug("Tool {} ={}", propName, propValue);
		return propValue;
	}

	if ( defaultValue != null ) {
		log.debug("Default {} ={}", propName, defaultValue);
		return defaultValue;
	}
	log.debug("Fell through {}", propName);
	return null;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:39,代碼來源:IMSBLTIPortlet.java


注:本文中的org.sakaiproject.tool.api.Placement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。