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


Java PortletPreferences.getValues方法代碼示例

本文整理匯總了Java中javax.portlet.PortletPreferences.getValues方法的典型用法代碼示例。如果您正苦於以下問題:Java PortletPreferences.getValues方法的具體用法?Java PortletPreferences.getValues怎麽用?Java PortletPreferences.getValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.portlet.PortletPreferences的用法示例。


在下文中一共展示了PortletPreferences.getValues方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readConfiguration

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public FlashlightSearchConfiguration readConfiguration(PortletPreferences preferences) {
    // Get the ADT UUID
    String adtUUID = preferences.getValue(CONF_KEY_ADT_UUID, StringPool.BLANK);

    // Perform a search on startup?
    boolean doSearchOnStartup = preferences.getValue(CONF_KEY_DO_SEARCH_ON_STARTUP, StringPool.FALSE).equals(StringPool.TRUE);
    String doSearchOnStartupKeywords = preferences.getValue(CONF_KEY_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS);

    // Get the tabs
    String[] tabIds = preferences.getValues(CONF_KEY_TABS, EMPTY_ARRAY);
    int tabIdsLength = tabIds.length;
    ArrayList<FlashlightSearchConfigurationTab> tabs = new ArrayList<>(tabIdsLength);

    // For each tabs, get its configuration
    for(int i = 0; i < tabIdsLength; i++) {
        tabs.add(this.readTabConfiguration(preferences, tabIds[i]));
    }

    return new FlashlightSearchConfiguration(adtUUID, doSearchOnStartup, doSearchOnStartupKeywords, tabs);
}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:22,代碼來源:ConfigurationStorageV1.java

示例2: loadMyBooks

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
private SortedSet<Book> loadMyBooks(PortletPreferences prefs) {
	SortedSet<Book> myBooks = new TreeSet<Book>();
	String[] keys = prefs.getValues("myBooks", null);
	if (keys != null) {
		for (int i = 0; i < keys.length; i++) {
			try {
				Integer key = Integer.valueOf(keys[i]);
				Book book = bookService.getBook(key);
				if (book != null)
					myBooks.add(book);
			} catch (NumberFormatException ex) {
			}
		}
	}
	return myBooks;
}
 
開發者ID:sdeleuze,項目名稱:spring-portlet-sample,代碼行數:17,代碼來源:MyBooksController.java

示例3: doCheckDefaultPreference

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
/**
 * Private method that checks if a preference is not defined or has no
 * value in <code>portlet.xml</code>, the default values are returned.
 * @param request  the portlet request.
 * @param preferenceName  the preference name which is not defined or has no
 *        value in <code>portlet.xml</code>.
 * @return the test result.
 */
private TestResult doCheckDefaultPreference(PortletRequest request,
                                            String preferenceName) {
	TestResult result = new TestResult();
	result.setDescription("Ensure proper default is returned when "
			+ "a non-existing/value-undefined preference is requested.");
	result.setSpecPLT("14.1");

	PortletPreferences preferences = request.getPreferences();
	String value =  preferences.getValue(preferenceName, DEF_VALUE);
	String[] values = preferences.getValues(preferenceName,
	                                        new String[] { DEF_VALUE });
	if (DEF_VALUE.equals(value)
			&& values != null && values.length == 1
			&& DEF_VALUE.equals(values[0])) {
		result.setReturnCode(TestResult.PASSED);
	} else if (!DEF_VALUE.equals(value)) {
		TestUtils.failOnAssertion("preference value", value, DEF_VALUE, result);
	} else {
		TestUtils.failOnAssertion("preference values",
		                          values,
		                          new String[] { DEF_VALUE },
		                          result);
	}
	return result;
}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:34,代碼來源:PreferenceCommonTest.java

示例4: setupExcludedSites

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
/**
 * Sets the excluded sites property
 *
 * @param preferences PortletPreferences
 */
private void setupExcludedSites(PortletPreferences preferences) {
    // Get the properties source
    PropertiesSource source = Environment.getPropertiesSource();

    String[] excludedSites;

    // Preferences
    if (source == PropertiesSource.PREFERENCES) {
        // Take the value from preferences
        excludedSites = preferences.getValues(
                PortletPropertiesKeys.EXCLUDED_SITES,
                PortletPropertiesValues.EXCLUDED_SITES
        );
    }
    // Properties
    else {
        excludedSites = PortletPropertiesValues.EXCLUDED_SITES;
    }

    // Save in Environment
    Environment.setExcludedSites(excludedSites);
}
 
開發者ID:marcelmika,項目名稱:lims,代碼行數:28,代碼來源:PropertiesManagerImpl.java

示例5: setupBuddyListSiteExcludes

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
/**
 * Sets the buddy list site excludes property
 *
 * @param preferences PortletPreferences
 */
private void setupBuddyListSiteExcludes(PortletPreferences preferences) {
    // Get the properties source
    PropertiesSource source = Environment.getPropertiesSource();

    String[] buddyListSiteExcludes;

    // Preferences
    if (source == PropertiesSource.PREFERENCES) {
        // Take the value from preferences
        buddyListSiteExcludes = preferences.getValues(
                PortletPropertiesKeys.BUDDY_LIST_SITE_EXCLUDES,
                PortletPropertiesValues.BUDDY_LIST_SITE_EXCLUDES
        );
    }
    // Properties
    else {
        buddyListSiteExcludes = PortletPropertiesValues.BUDDY_LIST_SITE_EXCLUDES;
    }

    // Save in Environment
    Environment.setBuddyListSiteExcludes(buddyListSiteExcludes);
}
 
開發者ID:marcelmika,項目名稱:lims,代碼行數:28,代碼來源:PropertiesManagerImpl.java

示例6: setupBuddyListGroupExcludes

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
/**
 * Sets the buddy list group excludes property
 *
 * @param preferences PortletPreferences
 */
private void setupBuddyListGroupExcludes(PortletPreferences preferences) {
    // Get the properties source
    PropertiesSource source = Environment.getPropertiesSource();

    String[] buddyListGroupExcludes;

    // Preferences
    if (source == PropertiesSource.PREFERENCES) {
        // Take the value from preferences
        buddyListGroupExcludes = preferences.getValues(
                PortletPropertiesKeys.BUDDY_LIST_GROUP_EXCLUDES,
                PortletPropertiesValues.BUDDY_LIST_GROUP_EXCLUDES
        );
    }
    // Properties
    else {
        buddyListGroupExcludes = PortletPropertiesValues.BUDDY_LIST_GROUP_EXCLUDES;
    }

    // Save in Environment
    Environment.setBuddyListGroupExcludes(buddyListGroupExcludes);
}
 
開發者ID:marcelmika,項目名稱:lims,代碼行數:28,代碼來源:PropertiesManagerImpl.java

示例7: checkSetPreferenceMultiValues

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
protected TestResult checkSetPreferenceMultiValues(PortletRequest request) {
    TestResult result = new TestResult();
    result.setDescription("Ensure multiple preference values can be set.");
    result.setSpecPLT("14.1");

    PortletPreferences preferences = request.getPreferences();
    try {
        preferences.setValues("TEST", new String[] {"ONE", "ANOTHER"});
    } catch (ReadOnlyException ex) {
    	TestUtils.failOnException("Unable to set preference values.", ex, result);
    	return result;
    }

    String[] values = preferences.getValues("TEST", new String[] { DEF_VALUE });
    if (values != null && values.length == 2
    		&& values[0].equals("ONE") && values[1].equals("ANOTHER")) {
    	result.setReturnCode(TestResult.PASSED);
    } else if (values == null) {
    	TestUtils.failOnAssertion("preference values",
    	                          values,
    	                          new String[] { "ONE", "ANOTHER" },
    	                          result);
    } else if (values.length != 2) {
    	TestUtils.failOnAssertion("length of preference values",
    	                          String.valueOf(values.length),
    	                          String.valueOf(2),
    	                          result);
    } else {
    	TestUtils.failOnAssertion("preference values",
    	                          values,
    	                          new String[] { "ONE", "ANOTHER" },
    	                          result);
    }
    return result;
}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:36,代碼來源:PreferenceCommonTest.java

示例8: validate

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
public void validate(PortletPreferences preferences)
throws ValidatorException {
	validateInvoked++;
	String value = preferences.getValue(CHECK_VALIDATOR_COUNT, null);
	if (value != null && value.equalsIgnoreCase("true")) {
		checkValidatorCount();
	}

    //
    // TODO: Determine why we use this - I seem to remember it's a
    //   spec requirement, and fix it so that we don't have issues
    //   anymore.  When enabled, all preferences fail in testsuite.
    //
    final String[] DEFAULT_VALUES = new String[] { "no values" };
	Collection<String> failedNames = new ArrayList<String>();
    for (Enumeration<String> en = preferences.getNames(); 
    		en.hasMoreElements(); ) {
        String name = (String) en.nextElement();
        String[] values = preferences.getValues(name, DEFAULT_VALUES);
        if (values != null) { // null values are allowed
            for (int i = 0; i < values.length; i++) {
                if (values[i] != null) { // null values are allowed
                    // Validate that the preferences do not
                	//   start or end with white spaces.
                    if (!values[i].equals(values[i].trim())) {
                    	if (LOG.isDebugEnabled()) {
                    		LOG.debug("Validation failed: "
                    				+ "value has white spaces: "
                    				+ "name=" + name
                    				+ "; value=|" + values[i] + "|");
                    	}
                    	failedNames.add(name);
                    }
                }
            }
        }
    }

    if (!failedNames.isEmpty()) {
        throw new ValidatorException(
        		"One or more preferences do not pass the validation.",
        		failedNames);
    }
}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:45,代碼來源:PreferencesValidatorImpl.java

示例9: download

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
protected void download(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {

        int idx = ParamUtil.getInteger(resourceRequest, "idx");

        PortletPreferences portletPreferences = resourceRequest.getPreferences();

        List<TaskRecord> taskRecords = getTaskRecords(resourceRequest);

        Map<String, Object> contextObjects = new HashMap<>();

        contextObjects.put("taskRecords", taskRecords);

        String[] exportFileNames = portletPreferences.getValues("exportFileName",
                _timetrackerConfiguration.exportFileNames());
        String[] exportNames = portletPreferences.getValues("exportName", _timetrackerConfiguration.exportNames());
        String[] exportScripts = portletPreferences.getValues("exportScript",
                _timetrackerConfiguration.exportScripts());

        String exportStr = null;

        try {
            exportStr = TemplateUtil.transform(contextObjects, exportScripts[idx], exportNames[idx], "ftl");
        } catch (Exception e) {
            exportStr = e.getCause().getMessage();
        }

        PortletResponseUtil.sendFile(resourceRequest, resourceResponse, exportFileNames[idx], exportStr.getBytes());

    }
 
開發者ID:inofix,項目名稱:ch-inofix-timetracker,代碼行數:30,代碼來源:ExportTaskRecordsMVCResourceCommand.java

示例10: getPortalURLPrefixesAdd

import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
public static String[] getPortalURLPrefixesAdd(long companyId) 
	throws SystemException, PortalException {

	PortletPreferences preferences = getPreferences(companyId);

	return preferences.getValues("portalURLPrefixesAdd", new String[0]);
}
 
開發者ID:craigvershaw,項目名稱:link-scanner,代碼行數:8,代碼來源:LinkScannerUtil.java


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