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


Java ServerConfigurationService.getStrings方法代码示例

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


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

示例1: filterCourseSetList

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * Depending on institutional setting, all or part of the CourseSet list will be shown in the dropdown list in find course page
 * for example, sakai.properties could have following setting:
 * sitemanage.cm.courseset.categories.count=1
 * sitemanage.cm.courseset.categories.1=Department
 * Hence, only CourseSet object with category of "Department" will be shown
 * @param courseSets
 * @return
 */
private Set<CourseSet> filterCourseSetList(Set<CourseSet> courseSets) {
	if (ServerConfigurationService.getStrings("sitemanage.cm.courseset.categories") != null) {
		List<String> showCourseSetTypes = new ArrayList(Arrays.asList(ServerConfigurationService.getStrings("sitemanage.cm.courseset.categories")));
		Set<CourseSet> rv = new HashSet<CourseSet>();
		for(CourseSet courseSet:courseSets)
		{
			if (showCourseSetTypes.contains(courseSet.getCategory()))
			{
				rv.add(courseSet);
			}
		}
		courseSets = rv;
	}
	return courseSets;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:SiteAction.java

示例2: getOptionalAttributes

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * Get the Map of optional attributes from sakai.properties
 * 
 * First list defines the attribute , second the display value. If no display value the attribute name is used.
 * 
 * Format is:
 * 
 * user.additional.attribute.count=3
 * user.additional.attribute.1=att1
 * user.additional.attribute.2=att2
 * user.additional.attribute.3=att3
 *
 * user.additional.attribute.display.att1=Attribute 1
 * user.additional.attribute.display.att2=Attribute 2
 * user.additional.attribute.display.att3=Attribute 3
 * @return
 */
private Map<String,String> getOptionalAttributes() {
	
	Map<String,String> atts = new LinkedHashMap<String,String>();
	
	String configs[] = ServerConfigurationService.getStrings("user.additional.attribute");
	if (configs != null) {
		for (int i = 0; i < configs.length; i++) {
			String key = configs[i];
			if (!key.isEmpty()) {
				String value = ServerConfigurationService.getString("user.additional.attribute.display." + key, key);
				atts.put(key, value);
			}
		}
	}
	
	return atts;
	
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:36,代码来源:UsersAction.java

示例3: initState

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * Populate the state object, if needed.
 */
protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)
{
	super.initState(state, portlet, rundata);

	state.setAttribute(STATE_PAGESIZE, Integer.valueOf(DEFAULT_PAGE_SIZE));

	// if site type which requires term search exists
	// get all term-search related data from configuration,
	String termSearchSiteType = ServerConfigurationService.getString("sitebrowser.termsearch.type");
	if (termSearchSiteType != null)
	{
		state.setAttribute(SEARCH_TERM_SITE_TYPE, termSearchSiteType);

		String termSearchProperty = ServerConfigurationService.getString("sitebrowser.termsearch.property");
		state.setAttribute(SEARCH_TERM_PROP, termSearchProperty);
	}

	String[] noSearchSiteTypes = ServerConfigurationService.getStrings("sitesearch.noshow.sitetype");
	if (noSearchSiteTypes != null)
	{
		state.setAttribute(NO_SHOW_SEARCH_TYPE, noSearchSiteTypes);
	}

	// Make sure we have a permission to be looking for.
	if (!(state.getAttribute(SiteHelper.SITE_PICKER_PERMISSION) instanceof org.sakaiproject.site.api.SiteService.SelectionType))
	{
		// The default is pubview.
		state.setAttribute(SiteHelper.SITE_PICKER_PERMISSION, org.sakaiproject.site.api.SiteService.SelectionType.PUBVIEW);
	}

	// setup the observer to notify our main panel
	/*
	 * if (state.getAttribute(STATE_OBSERVER) == null) { // the delivery location for this tool String deliveryId = clientWindowId(state, portlet.getID()); // the html element to update on delivery String elementId =
	 * mainPanelUpdateId(portlet.getID()); // the event resource reference pattern to watch for String pattern = SiteService.siteReference(""); state.setAttribute(STATE_OBSERVER, new EventObservingCourier(deliveryId, elementId, pattern)); } // make
	 * sure the observer is in sync with state updateObservationOfChannel(state, portlet.getID());
	 */
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:41,代码来源:SiteBrowserAction.java

示例4: setupIcons

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * setupSkins
 * 
 */
private void setupIcons(SessionState state) {
	List icons = new Vector();

	String[] iconNames = {"*default*"};
	String[] iconUrls = null;
	String[] iconSkins = null;

	// get icon information
	if (ServerConfigurationService.getStrings("iconNames") != null) {
		iconNames = ServerConfigurationService.getStrings("iconNames");
	}
	if (ServerConfigurationService.getStrings("iconUrls") != null) {
		iconUrls = ServerConfigurationService.getStrings("iconUrls");
	}
	if (ServerConfigurationService.getStrings("iconSkins") != null) {
		iconSkins = ServerConfigurationService.getStrings("iconSkins");
	}

	if ((iconNames != null) && (iconUrls != null) && (iconSkins != null)
			&& (iconNames.length == iconUrls.length)
			&& (iconNames.length == iconSkins.length)) {
		for (int i = 0; i < iconNames.length; i++) {
			MyIcon s = new MyIcon(StringUtils.trimToNull((String) iconNames[i]),
					StringUtils.trimToNull((String) iconUrls[i]), StringUtils.trimToNull((String) iconSkins[i]));
			icons.add(s);
		}
	}

	state.setAttribute(STATE_ICONS, icons);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:35,代码来源:SiteAction.java

示例5: isProvidedType

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * Check to see if the type is in the list of known provided types
 * @param userType User's type
 * @return
 */
private boolean isProvidedType(String userType) {
	boolean provided = false;
	String[] providedTypes = ServerConfigurationService.getStrings("user.type.provided");
	if (providedTypes != null && providedTypes.length > 0) {
		List<String> typeList = Arrays.asList(providedTypes);
		if (typeList.contains(userType))
			provided = true;
	}
	return provided;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:UsersAction.java

示例6: processRegisteredNotificationItems

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * Determine the sorting and if any should be hidden from view
 * @param decoItems
 */
private void processRegisteredNotificationItems() {
	
	Map<String, Integer> toolOrderMap = new HashMap<String, Integer>();
	String[] toolOrder = ServerConfigurationService.getStrings("prefs.tool.order");
	//String hiddenTools = ServerConfigurationService.getString("prefs.tool.hidden");
	
	String[] parsedHidden = getHiddenTools();
	Map<String, Integer> hiddenToolMap = new HashMap<String, Integer>();
	
	toolOrderMap = stringArrayToMap(toolOrder);
	hiddenToolMap = stringArrayToMap(parsedHidden);
	
	Preferences prefs = m_preferencesService.getPreferences(getUserId());
	
	for (DecoratedNotificationPreference dnp : m_registereddNotificationItems) {
		String toolId = dnp.getUserNotificationPreferencesRegistration().getToolId();
		Integer sort = toolOrderMap.get(toolId);
		if (sort != null)
			dnp.setSortOrder(sort);
		if (hiddenToolMap.get(toolId) != null) {
			dnp.setHidden(true);
		}
		
		ResourceProperties expandProps = prefs.getProperties(PREFS_EXPAND);
		if (expandProps != null) {
			String expandProp = expandProps.getProperty(dnp.key);
			if (expandProp != null) {
				boolean overrideExpand = expandProp.equalsIgnoreCase(PREFS_EXPAND_TRUE) ? true : false;
				dnp.setExpandOverride(overrideExpand);
			}
		}
	}
	Collections.sort(m_registereddNotificationItems, new DecoratedNotificationPreferenceSorter());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:39,代码来源:UserPrefsTool.java

示例7: getSiteTypeStrings

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
public List<String> getSiteTypeStrings(String type)
{
	String[] siteTypes = ServerConfigurationService.getStrings(type + "SiteType");
	if (siteTypes == null || siteTypes.length == 0)
	{
		siteTypes = new String[] {type};
	}
	return Arrays.asList(siteTypes);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:10,代码来源:UserPrefsTool.java

示例8: availableRoleIds

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * Asks the Server Configuration Service to get a list of available roles with the prefix "resources.enabled.roles""
 * We should expect language strings for these to be defined in the bundles.
 * @return a set of role ids that can be used
 */
public Set<String> availableRoleIds() {
    String[] configStrings = ServerConfigurationService.getStrings("resources.enabled.roles");

    LinkedHashSet<String> availableIds = new LinkedHashSet<String>();

    if(configStrings != null) {
        availableIds.addAll(Arrays.asList(configStrings));
    } else {
        // By default just include the public
        availableIds.add(PUBVIEW_ROLE);
    }

    return availableIds;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:20,代码来源:ListItem.java

示例9: getZipCharsets

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
private List<String> getZipCharsets() {
	String[] charsetConfig = ServerConfigurationService.getStrings("content.zip.expand.charsets");
	if (charsetConfig == null) {
		charsetConfig = new String[0];
	}
	List<String> charsets = new ArrayList<>(Arrays.asList(charsetConfig));
	// Add UTF-8 as fallback
	charsets.add("UTF-8");
	return charsets;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:11,代码来源:ZipContentUtil.java

示例10: getOrientation

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
** Return orientation of given locale
**
** @param loc Locale to obtain orientation
** @return String with two possible values "rtl" or "ltr"
** @author jjmerono
**/
public String getOrientation(Locale loc) {
	String [] locales = ServerConfigurationService.getStrings("locales.rtl");
	if (locales==null) {
		locales = new String[]{"ar","dv","fa","ha","he","iw","ji","ps","ur","yi"};
	}
	return ArrayUtil.contains(locales,loc.getLanguage())?"rtl":"ltr";
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:ResourceLoader.java

示例11: getAutoRolesNone

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * 
 * @return list of role titles appropriate to this site which should be set to None when autocreating topics
 */
private List getAutoRolesNone() {
	ArrayList autoRolesNone = new ArrayList();
	ArrayList siteRolesList = (ArrayList) getSiteRolesNames();
	String[] rolesNone = ServerConfigurationService.getStrings("msgcntr.rolesnone");
	if (rolesNone != null && rolesNone.length > 0) {
		for (String role : rolesNone) {
			if (siteRolesList.contains(role.trim())) autoRolesNone.add(role.trim());
		}
	}
	return autoRolesNone;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:DiscussionForumTool.java

示例12: doMenu_edit_site_access

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * doMenu_edit_site_access
 * 
 */
public void doMenu_edit_site_access(RunData data) {
	SessionState state = ((JetspeedRunData) data)
			.getPortletSessionState(((JetspeedRunData) data).getJs_peid());

	try {
		Site site = getStateSite(state);
		state.setAttribute(STATE_SITE_ACCESS_PUBLISH, Boolean.valueOf(site.isPublished()));
		state.setAttribute(STATE_SITE_ACCESS_INCLUDE, Boolean.valueOf(site.isPubView()));
		boolean joinable = site.isJoinable();
		state.setAttribute(STATE_JOINABLE, Boolean.valueOf(joinable));
		String joinerRole = site.getJoinerRole();
		if (joinerRole == null || joinerRole.length() == 0)
		{
			String[] joinerRoles = ServerConfigurationService.getStrings("siteinfo.default_joiner_role");
			Set<Role> roles = site.getRoles();
			if (roles != null && joinerRole != null && joinerRoles.length > 0)
			{
				// find the role match
				for (Role r : roles)
				{
					for(int i = 0; i < joinerRoles.length; i++)
					{
						if (r.getId().equalsIgnoreCase(joinerRoles[i]))
						{
							joinerRole = r.getId();
							break;
						}
					}
					if (joinerRole != null)
					{
						break;
					}
				}
			}
		}
		state.setAttribute(STATE_JOINERROLE, joinerRole); 

		// SAK-24423 - update state for joinable site settings
		JoinableSiteSettings.updateStateFromSitePropertiesOnEditAccessOrNewSite( site.getProperties(), state );
	}
	catch (Exception e)
	{
		log.warn(this + " doMenu_edit_site_access problem of getting site" + e.getMessage());
	}
	if (state.getAttribute(STATE_MESSAGE) == null) {
		state.setAttribute(STATE_TEMPLATE_INDEX, "18");
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:54,代码来源:SiteAction.java

示例13: getJoinerRoles

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * getRoles
 * 
 * SAK-23257 - added state and siteType parameters so list 
 * of joiner roles can respect the restricted role lists in sakai.properties.
 * 
 */
private List<Role> getJoinerRoles(String realmId, SessionState state, String siteType) {
	List roles = new ArrayList();
	/** related to SAK-18462, this is a list of permissions that the joinable roles shouldn't have ***/
	String[] prohibitPermissionForJoinerRole = ServerConfigurationService.getStrings("siteinfo.prohibited_permission_for_joiner_role");
	if (prohibitPermissionForJoinerRole == null) {
		prohibitPermissionForJoinerRole = new String[]{"site.upd"};
	}
	if (realmId != null)
	{
		try {
			AuthzGroup realm = authzGroupService.getAuthzGroup(realmId);
			// get all roles that allows at least one permission in the list
			Set<String> permissionAllowedRoleIds = new HashSet<String>();
			for(String permission:prohibitPermissionForJoinerRole)
			{
				permissionAllowedRoleIds.addAll(realm.getRolesIsAllowed(permission));
			}
			
			// SAK-23257
			List<Role> allowedRoles = null;
			Set<String> restrictedRoles = null;
			if (null == state.getAttribute(STATE_SITE_INSTANCE_ID)) {
				restrictedRoles = SiteParticipantHelper.getRestrictedRoles(state.getAttribute(STATE_SITE_TYPE ).toString());
			}
			else {
				allowedRoles = SiteParticipantHelper.getAllowedRoles(siteType, getRoles(state));
			}
			
			for(Role role:realm.getRoles())
			{
				if (isUserRole(role) && (permissionAllowedRoleIds == null 
						|| permissionAllowedRoleIds!= null && !permissionAllowedRoleIds.contains(role.getId())))
				{
					// SAK-23257
					if (allowedRoles != null && allowedRoles.contains(role)) {
						roles.add(role);
					}
					else if (restrictedRoles != null &&
							(!restrictedRoles.contains(role.getId()) || !restrictedRoles.contains(role.getId().toLowerCase()))) {
						roles.add(role);
					}
				}
			}
			Collections.sort(roles);
		} catch (GroupNotDefinedException e) {
			log.error( this + ".getRoles: IdUnusedException " + realmId, e);
		}
	}
	return roles;

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:59,代码来源:SiteAction.java

示例14: setTemplateListForContext

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
/**
 * created based on setTermListForContext - Denny
 * @param context
 * @param state
 */
private void setTemplateListForContext(Context context, SessionState state)
{
	List<Site> templateSites = new ArrayList<Site>();

	boolean allowedForTemplateSites = true;
	
	// system wide setting for disable site creation based on template sites
	if (ServerConfigurationService.getString("wsetup.enableSiteTemplate", "true").equalsIgnoreCase(Boolean.FALSE.toString()))
	{
		allowedForTemplateSites = false;
	}
	else
	{
		if (ServerConfigurationService.getStrings("wsetup.enableSiteTemplate.userType") != null) {
			List<String> userTypes = new ArrayList(Arrays.asList(ServerConfigurationService.getStrings("wsetup.enableSiteTemplate.userType")));
			if (userTypes != null && userTypes.size() > 0)
			{
				User u = UserDirectoryService.getCurrentUser();
				if (!(u != null && (SecurityService.isSuperUser() || userTypes.contains(u.getType()))))
				{
					// be an admin type user or any type of users defined in the configuration
					allowedForTemplateSites = false;
				}
			}
		}
	}
			
	if (allowedForTemplateSites)
	{
		// We're searching for template sites and these are marked by a property
		// called 'template' with a value of true
		Map templateCriteria = new HashMap(1);
		templateCriteria.put("template", "true");
		
		templateSites = SiteService.getSites(org.sakaiproject.site.api.SiteService.SelectionType.ANY, null, null, templateCriteria, SortType.TITLE_ASC, null);
	}
	
	// If no templates could be found, stick an empty list in the context
	if(templateSites == null || templateSites.size() <= 0)
		templateSites = new ArrayList();

               //SAK25400 sort templates by type
               context.put("templateSites",sortTemplateSitesByType(templateSites));
	context.put("titleMaxLength", state.getAttribute(STATE_SITE_TITLE_MAX));
	
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:52,代码来源:SiteAction.java

示例15: checkCSRFToken

import org.sakaiproject.component.cover.ServerConfigurationService; //导入方法依赖的package包/类
public boolean checkCSRFToken(HttpServletRequest request, RunData rundata, String action)
{
	ParameterParser params = rundata.getParameters();

	// if user if manipulating data via POST, check for presence of CSRF token
	if ("POST".equals(rundata.getRequest().getMethod()))
	{
		// check if tool id is in list of tools to skip the CSRF check
		Placement placement = ToolManager.getCurrentPlacement();
		String toolId = null;
		if (placement != null)
		{
			toolId = placement.getToolId();
		}
		
		boolean skipCSRFCheck = false;
		String[] insecureTools = ServerConfigurationService.getStrings("velocity.csrf.insecure.tools");
		if (toolId != null && insecureTools != null)
		{
			for (int i = 0; i < insecureTools.length; i++)
			{
				if (StringUtils.equalsIgnoreCase(toolId, insecureTools[i]))
				{
					if (log.isDebugEnabled())
					{
						log.debug("Will skip all CSRF checks on toolId=" + toolId);
					}
					skipCSRFCheck = true;
					break;
				}
			}
		}
					
		// if the user is not logged in, then do not worry about csrf
		Session session = SessionManager.getCurrentSession();
		boolean loggedIn = session.getUserId() != null;
		
		if (loggedIn && !skipCSRFCheck)
		{
			// If the attribute is missing, it is likely an internal error,
			// not an error in the tool
			Object sessionAttr = SessionManager.getCurrentSession().getAttribute(UsageSessionService.SAKAI_CSRF_SESSION_ATTRIBUTE);
			if ( sessionAttr == null )
			{
				log.warn("Missing CSRF Token session attribute: " + action + "; toolId=" + toolId);
				return false;
			}
			
			String csrfToken = params.getString(SAKAI_CSRF_TOKEN);
			String sessionToken = sessionAttr.toString();
			if (csrfToken == null || sessionToken == null || !StringUtils.equals(csrfToken, sessionToken)) 
			{
				log.warn("CSRF Token mismatched or missing on velocity action: " + action + "; toolId=" + toolId);
				return false;
			}
			if (log.isDebugEnabled())
			{
				log.debug("CSRF token (" + csrfToken + ") matches on action: " + action + "; toolId=" + toolId);
			}
		}
	}
	return true;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:64,代码来源:VelocityPortletPaneledAction.java


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