当前位置: 首页>>代码示例>>Java>>正文


Java ToolConfiguration.getConfig方法代码示例

本文整理汇总了Java中org.sakaiproject.site.api.ToolConfiguration.getConfig方法的典型用法代码示例。如果您正苦于以下问题:Java ToolConfiguration.getConfig方法的具体用法?Java ToolConfiguration.getConfig怎么用?Java ToolConfiguration.getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sakaiproject.site.api.ToolConfiguration的用法示例。


在下文中一共展示了ToolConfiguration.getConfig方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isVisible

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
 * Checks if users can see a page or not
 * 
 * @param page The SitePage whose visibility is in question
 * @return true if users can see the page
 */
public boolean isVisible(SitePage page) {
    List<ToolConfiguration> tools = page.getTools();
    Iterator<ToolConfiguration> iPt = tools.iterator();

    boolean visible = false;
    while( !visible && iPt.hasNext() ) 
    {
        ToolConfiguration placement = iPt.next();
        Properties roleConfig = placement.getConfig();
        String visibility = roleConfig.getProperty(PORTAL_VISIBLE);

        if ( ! "false".equals(visibility) ) visible = true;
    }
    
    return visible;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:SitePageEditHandler.java

示例2: sakaiInfo

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public static boolean sakaiInfo(Properties props, String context, String placementId, ResourceLoader rb)
{

	Site site = null;
	try {
		site = SiteService.getSite(context);
	} catch (Exception e) {
		log.error("No site/page associated with Launch context={}", context);
		return false;
	}

	// Add the generic information
	addGlobalData(site, props, null, rb);
	ToolConfiguration placement = SiteService.findTool(placementId);
	Properties config = placement.getConfig();
	String roleMapProp = toNull(getCorrectProperty(config, "rolemap", placement));
	addRoleInfo(props, null, context, roleMapProp);
	addSiteInfo(props, null, site);

	// Add Placement Information
	addPlacementInfo(props, placementId);
	return true;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:SakaiBLTIUtil.java

示例3: getToolPopupUrl

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
 * Captures the rules for the various tools and when they want a popup
 *
 * @param <code>pageTool</code>
 *		The tools configuration object.
 * @return The url to be uded in the popup of null of there is no 
 *		tool-requested popup.
 */
public static String getToolPopupUrl(ToolConfiguration pageTool)
{
	Properties pro = pageTool.getConfig();
	String source = null;
	if ( "sakai.web.168".equals(pageTool.getToolId()) 
			&& "true".equals(pro.getProperty("popup")) ) {
		source = pro.getProperty("source");
	} else if ( "sakai.iframe".equals(pageTool.getToolId()) 
			&& "true".equals(pro.getProperty("popup")) ) {
		source = pro.getProperty("source");
	} else if ( "sakai.basiclti".equals(pageTool.getToolId()) 
			&& "on".equals(pro.getProperty("imsti.newpage")) ) {
		source = "/access/basiclti/site/"+pageTool.getContext()+"/"+pageTool.getId();
	}
	return source;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:ToolUtils.java

示例4: isFragmentTool

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
private boolean isFragmentTool(ToolConfiguration configuration)
{
	Properties placementProperties = configuration.getConfig();
	String fragmentCapable = placementProperties
			.getProperty(TOOL_FRAGMENT_PRODUCER_ID);

	if (fragmentCapable == null || fragmentCapable.length() == 0)
	{
		return false;
	}
	return true;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:FragmentToolRenderService.java

示例5: getChannels

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
 * Helper to get the channels for a site.
 * <p>
 * If user site and not superuser, returns all available channels for this
 * user.<br />
 * 
 * @param siteId
 * @return
 */
private List<String> getChannels(String siteId) {

	List<String> channels = new ArrayList<String>();

	Site site = null;
	try {
		site = siteService.getSite(siteId);
	} catch (IdUnusedException e) {
		// this should have been caught and dealt with already so just
		// return empty list
		return channels;
	}
	if (site != null) {
		ToolConfiguration toolConfig = site
				.getToolForCommonId("sakai.mailbox");

		if (toolConfig != null) {
			Properties props = toolConfig.getPlacementConfig();
			if (props.isEmpty()) {
				props = toolConfig.getConfig();
			}

			if (props != null) {
				channels = Collections.singletonList(mailArchiveService
						.channelReference(siteId,
								SiteService.MAIN_CONTAINER));
			}
		}
	}

	return channels;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:42,代码来源:MailArchiveEntityProvider.java

示例6: getCalendarSubscriptionChannelsForChannel

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public Set<String> getCalendarSubscriptionChannelsForChannel(String reference)
{
	Set<String> channels = new HashSet<String>();
	if (!isEnabled() || reference == null) return channels;

	// get externally subscribed urls from tool config
	Reference ref = m_entityManager.newReference(reference);
	Site site = null;
	try
	{
		site = m_siteService.getSite(ref.getContext());
	}
	catch (IdUnusedException e)
	{
		log.error("ExternalCalendarSubscriptionService.getCalendarSubscriptionChannelsForChannel(): IdUnusedException for context in reference: "
						+ reference);
		return channels;
	}
	ToolConfiguration tc = site.getToolForCommonId(SCHEDULE_TOOL_ID);
	Properties config = tc == null? null : tc.getConfig();
	if (tc != null && config != null)
	{
		String prop = config.getProperty(TC_PROP_SUBCRIPTIONS);
		if (prop != null)
		{
			String[] chsPair = prop.split(SUBS_REF_DELIMITER);
			for (String aChsPair : chsPair) {
				String[] pair = aChsPair.split(SUBS_NAME_DELIMITER);
				channels.add(pair[0]);
			}
		}
	}

	return channels;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:36,代码来源:BaseExternalCalendarSubscriptionService.java

示例7: setSubscriptionsForChannel

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public void setSubscriptionsForChannel(String reference,
		Collection<ExternalSubscription> subscriptions)
{
	if (!isEnabled() || reference == null) return;

	// set externally subscriptions in tool config
	Reference ref = m_entityManager.newReference(reference);
	Site site = null;
	try
	{
		site = m_siteService.getSite(ref.getContext());
	}
	catch (IdUnusedException e)
	{
		log.error("ExternalCalendarSubscriptionService.setSubscriptionsForChannel(): IdUnusedException for context in reference: "
						+ reference);
		return;
	}

	ToolConfiguration tc = site.getToolForCommonId(SCHEDULE_TOOL_ID);
	if (tc != null)
	{
		boolean first = true;
		StringBuilder tmpStr = new StringBuilder();
		for (ExternalSubscription subscription : subscriptions)
		{
			if (!first) tmpStr.append(SUBS_REF_DELIMITER);
			first = false;

			tmpStr.append(subscription.getReference());

			if (!isInstitutionalCalendar(subscription.getReference()))
				tmpStr.append(SUBS_NAME_DELIMITER + subscription.getSubscriptionName());
		}

		Properties config = tc.getConfig();
		config.setProperty(TC_PROP_SUBCRIPTIONS, tmpStr.toString());
		tc.save();
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:41,代码来源:BaseExternalCalendarSubscriptionService.java

示例8: getMultiToolConfiguration

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
private HashMap<String, String> getMultiToolConfiguration(String toolId, ToolConfiguration toolConfig)
{
	HashMap<String, String> rv = new HashMap<String, String>();

	// read attribute list from configuration file
	ArrayList<String> attributes=new ArrayList<String>();
	String attributesConfig = ServerConfigurationService.getString(CONFIG_TOOL_ATTRIBUTE + toolId);
	if ( attributesConfig != null && attributesConfig.length() > 0)
	{
		// read attributes from config file
		attributes = new ArrayList(Arrays.asList(attributesConfig.split(",")));
	}
	else
	{
		if (toolId.equals(NEWS_TOOL_ID))
		{
			// default setting for News tool
			attributes.add(NEWS_TOOL_CHANNEL_CONFIG);
		}
		else if (toolId.equals(WEB_CONTENT_TOOL_ID))
		{
			// default setting for Web Content tool
			attributes.add(WEB_CONTENT_TOOL_SOURCE_CONFIG);
		}
	}
	
	// read the defaul attribute setting from configuration
	ArrayList<String> defaultValues =new ArrayList<String>();
	String defaultValueConfig = ServerConfigurationService.getString(CONFIG_TOOL_ATTRIBUTE_DEFAULT + toolId);
	if ( defaultValueConfig != null && defaultValueConfig.length() > 0)
	{
		defaultValues = new ArrayList(Arrays.asList(defaultValueConfig.split(",")));
	}
	else
	{
		// otherwise, treat News tool and Web Content tool differently
		if (toolId.equals(NEWS_TOOL_ID))
		{
			// default value
			defaultValues.add(NEWS_TOOL_CHANNEL_CONFIG_VALUE);
		}
		else if (toolId.equals(WEB_CONTENT_TOOL_ID))
		{
			// default value
			defaultValues.add(WEB_CONTENT_TOOL_SOURCE_CONFIG_VALUE);
		}
	}
		
	if (attributes != null && attributes.size() > 0 && defaultValues != null && defaultValues.size() > 0 && attributes.size() == defaultValues.size())
	{
		for (int i = 0; i < attributes.size(); i++)
		{
			String attribute = attributes.get(i);
			
			// check to see the current settings first
			Properties config = toolConfig != null ? toolConfig.getConfig() : null;
			if (config != null && config.containsKey(attribute))
			{
				rv.put(attribute, config.getProperty(attribute));
			}
			else
			{
				// set according to the default setting
				rv.put(attribute, defaultValues.get(i));
			}
		}
	}
	
	
	return rv;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:72,代码来源:SiteAction.java

示例9: getChannels

import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
 * Helper to get the channels for a site. 
 * <p>
 * If user site and not superuser, returns all available channels for this user.<br />
 * If user site and superuser, return all merged channels.<br />
 * If normal site, returns all merged channels.<br />
 * If motd site, returns the motd channel.
 * 
 * @param siteId
 * @return
 */
private List<String> getChannels(String siteId) {
	
	List<String> channels = new ArrayList<String>();
	
	//if motd
	if(StringUtils.equals(siteId, MOTD_SITEID)) {
		log.debug("is motd site, returning motd channel");
		channels = Collections.singletonList(announcementService.channelReference(siteId, MOTD_CHANNEL_SUFFIX));
		return channels;
	}
	
	//if user site
	if(siteService.isUserSite(siteId)) {
		//if not super user, get all channels this user has access to
		if(!securityService.isSuperUser()){
			log.debug("is user site and not super user, returning all permitted channels");
			channels = Arrays.asList(new MergedList().getAllPermittedChannels(new AnnouncementChannelReferenceMaker()));
			return channels;
		}
	}
	
	//this is either a normal site, or we are a super user
	//so get the merged announcements for this site
	Site site = null;
	try {
		site = siteService.getSite(siteId);
	} catch (IdUnusedException e) {
		//this should have been caught and dealt with already so just return empty list
		return channels;
	}
	if(site != null) {
		ToolConfiguration toolConfig = site.getToolForCommonId("sakai.announcements");
		
		if(toolConfig != null){
			Properties props = toolConfig.getPlacementConfig();
			if(props.isEmpty()) {
				props = toolConfig.getConfig();
			}
			
			if(props != null){

				String mergeProp = (String)props.get(PORTLET_CONFIG_PARAM_MERGED_CHANNELS);
				if(StringUtils.isNotBlank(mergeProp)) {
					log.debug("is normal site or super user, returning all merged channels in this site");
					log.debug("mergeProp: {}", mergeProp);
					channels = Arrays.asList(new MergedList().getChannelReferenceArrayFromDelimitedString(new AnnouncementChannelReferenceMaker().makeReference(siteId), mergeProp));
				} else {
					log.debug("is normal site or super user but no merged channels, using original siteId channel");
					channels = Collections.singletonList(announcementService.channelReference(siteId, SiteService.MAIN_CONTAINER));
				}
			}
		}
	}
	
	return channels;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:68,代码来源:AnnouncementEntityProviderImpl.java


注:本文中的org.sakaiproject.site.api.ToolConfiguration.getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。