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


Java ValidatorException类代码示例

本文整理汇总了Java中javax.portlet.ValidatorException的典型用法代码示例。如果您正苦于以下问题:Java ValidatorException类的具体用法?Java ValidatorException怎么用?Java ValidatorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: checkValidatorCount

import javax.portlet.ValidatorException; //导入依赖的package包/类
private void checkValidatorCount() throws ValidatorException {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Checking validator count...");
	}
	Integer instanceCreated = (Integer) INSTANCE_COUNTER.get(
			getClass().getName());
	if (LOG.isDebugEnabled()) {
		LOG.debug("Method validate() invoked " + validateInvoked + " times.");
		LOG.debug("Validator created " + instanceCreated.intValue() + " times.");
	}
	if (instanceCreated.intValue() != 1) {
		throw new ValidatorException(instanceCreated.toString()
				+ " validator instances were created, "
				+ "expected 1 validator instance per portlet definition.",
				null);
	}
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:18,代码来源:PreferencesValidatorImpl.java

示例2: internalStore

import javax.portlet.ValidatorException; //导入依赖的package包/类
/**
 * Stores the portlet preferences to a persistent storage. If a preferences
 * validator is defined for this portlet, this method firstly validates the
 * portlet preferences.
 * <p>
 * This method is invoked internally, thus it does not check the portlet
 * request method ID (METHOD_RENDER or METHOD_ACTION).
 * </p>
 * @throws ValidatorException  if the portlet preferences are not valid.
 * @throws IOException  if an error occurs with the persistence mechanism.
 */
protected final void internalStore() throws IOException, ValidatorException {
    // Validate the preferences before storing, if a validator is defined.
    //   If the preferences cannot pass the validation,
    //   an ValidatorException will be thrown out.
    PortletDefinition portletD = window.getPortletDefinition();
    PreferencesValidator validator = preferencesService.getPreferencesValidator(portletD);
    if (validator != null)
    {
        validator.validate(this);
    }
    // Store the portlet preferences.
    try {
    	preferencesService.store(window, request, preferences);
    } catch (PortletContainerException ex) {
        LOG.error("Error storing preferences.", ex);
        throw new IOException("Error storing perferences: " + ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:30,代码来源:PortletPreferencesImpl.java

示例3: deleteVoiceCommand

import javax.portlet.ValidatorException; //导入依赖的package包/类
public static PortletPreferences deleteVoiceCommand(ActionRequest request, String voiceCommand) 
        throws PortalException, SystemException, ReadOnlyException, ValidatorException, IOException {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    long plid = themeDisplay.getLayout().getPlid();
    long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
    int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
    long companyId = themeDisplay.getCompanyId();

    PortletPreferences preference = request.getPreferences();
    Map<String, String[]> preferencesMap = new HashMap<String, String[]>(preference.getMap());
    preferencesMap.remove(voiceCommand);

    PortletPreferencesLocalServiceUtil.deletePortletPreferences(ownerId, ownerType, plid, SpeechConstants.PORTLET_NAMESPACE);

    preference = PortletPreferencesLocalServiceUtil.getPreferences(companyId, ownerId, ownerType, plid,
            SpeechConstants.PORTLET_NAMESPACE);
    
    for (Map.Entry<String, String[]> entry : preferencesMap.entrySet()) {
        preference.setValue(entry.getKey(), entry.getValue()[0]);
    }
    preference.store();
    return preference;
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:24,代码来源:SpeechUtil.java

示例4: search

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public SearchResultsContainer search(PortletRequest request, PortletResponse response, String tabId, int pageOffset, boolean isLoadMore) throws ReadOnlyException, ValidatorException, IOException, SearchException {
    FlashlightSearchConfiguration config = this.readConfiguration(request.getPreferences());
    Map<String, FlashlightSearchConfigurationTab> tabs = config.getTabs();
    FacetedSearcher searcher = this.facetedSearcherManager.createFacetedSearcher();

    LinkedHashMap<FlashlightSearchConfigurationTab, SearchPage> resultMap = new LinkedHashMap<>(tabs.size());
    for(FlashlightSearchConfigurationTab tab : tabs.values()) {
        int pageSize;
        int loadMoreSize;

        if(tab.getId().equals(tabId)) {
            pageSize = tab.getFullPageSize();
        } else {
            pageSize = tab.getPageSize();
        }

        if(isLoadMore) {
            loadMoreSize = tab.getLoadMorePageSize();
        } else {
            loadMoreSize = 0;
        }

        resultMap.put(tab, this.search(request, response, config, tab, searcher, pageOffset, pageSize, loadMoreSize));
    }

    return new SearchResultsContainer(resultMap);
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:29,代码来源:FlashlightSearchServiceImpl.java

示例5: saveGlobalSettings

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public void saveGlobalSettings(String adtUuid, boolean doSearchOnStartup, String doSearchOnStartupKeywords, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    if(Validator.isNull(doSearchOnStartupKeywords)) {
        doSearchOnStartupKeywords = FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS;
    }
    preferences.setValue(CONF_KEY_ADT_UUID, adtUuid);
    preferences.setValue(CONF_KEY_DO_SEARCH_ON_STARTUP, Boolean.toString(doSearchOnStartup));
    preferences.setValue(CONF_KEY_DO_SEARCH_ON_STARTUP_KEYWORDS, doSearchOnStartupKeywords);
    preferences.store();
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:11,代码来源:ConfigurationStorageV1.java

示例6: saveSearchFacetConfig

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public void saveSearchFacetConfig(FlashlightSearchConfigurationTab configurationTab, SearchFacet searchFacet, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    String tabId = configurationTab.getId();
    String facetConfigKey = format(CONF_KEY_FORMAT_SEARCH_FACET, tabId, searchFacet.getClass().getName());
    preferences.setValue(facetConfigKey, searchFacet.getData().toJSONString());
    preferences.store();
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:8,代码来源:ConfigurationStorageV1.java

示例7: saveSettings

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Action
public Response saveSettings(String enableStoreData,String invitationUrl) throws ReadOnlyException, IOException, ValidatorException {
  portletPreferences.setValue(ENABLE_STORE_DATA,enableStoreData);
  portletPreferences.setValue(INVITATION_URL,invitationUrl);
  portletPreferences.store();
  return JuZExoInviteFriendFrontendApplication_.index().with(JuzuPortlet.PORTLET_MODE, PortletMode.VIEW);
}
 
开发者ID:exo-addons,项目名称:invite-friend,代码行数:8,代码来源:JuZExoInviteFriendFrontendApplication.java

示例8: store

import javax.portlet.ValidatorException; //导入依赖的package包/类
/**
 * Stores the values of this bean into the preferences and stays in the current portlet mode.
 */
public void store() {
	try {
		final PortletPreferences portletPreferences = getPortletPreferences();
		store(portletPreferences);
		portletPreferences.store();
	} catch (final ReadOnlyException | ValidatorException | IOException e) {
		log.error("Could not store portlet preferences", e);
	}
}
 
开发者ID:liefke,项目名称:org.portletbeans,代码行数:13,代码来源:AbstractMangedBean.java

示例9: initForm

import javax.portlet.ValidatorException; //导入依赖的package包/类
private void initForm() {

		
		
		form = new Form<Void>("form") {

			private static final long serialVersionUID = 1L;

			@Override
			protected void onSubmit() {
				PortletPreferences prefs = UIUtils.getPortletPreferences();
				HtmlStripper htmlStripper = new HtmlStripper();

				try {
					prefs.setValue("titulo", tituloProjetoLei.getModelObject());
					prefs.setValue("tituloDescricao", tituloDescricaoProjeto.getModelObject());
					prefs.setValue("descricaoProjeto", htmlStripper.strip(descricaoProjeto.getModelObject()));
					prefs.setValue("habilitaPlugins", habilitaPlugins.getModelObject().toString());
					prefs.setValue("habilitaSugestoes", habilitaSugestoes.getModelObject().toString());
					
					info("Alterações realizadas com sucesso!");
					getRequestCycle().setRequestTarget(new RedirectRequestTarget(viewUrl));
				} catch (ReadOnlyException e) {
					error("Erro ao gravar alterações");
					return;
				}
				try {
					prefs.store();
				} catch (ValidatorException e) {
					error("Erro ao gravar alterações");
				} catch (IOException e) {
					error("Erro ao gravar alterações");
				}
			}
		};
		add(form);
	}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:38,代码来源:ConfiguracaoPage.java

示例10: validate

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public void validate(PortletPreferences preferences) throws ValidatorException {

  EnvironmentTests_PortletPreferences_ApiAction.tr32_success = true;
  EnvironmentTests_PortletPreferences_ApiEvent_event.tr32_success = true;
  EnvironmentTests_PortletPreferences_ApiResource.tr32_success = true;
  
  if (preferences.getValue("tr33", "true").equals("false")) {
    ArrayList<String> al = new ArrayList<String>();
    al.add("tr33");
    al.add("tr34");
    throw new ValidatorException("ValidatorException for tr33 and tr34", al);
  }
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:15,代码来源:V2EnvironmentTests_PortletPreferences_Validator.java

示例11: saveMaximumRatings

import javax.portlet.ValidatorException; //导入依赖的package包/类
public void saveMaximumRatings(SetOfOpinion tmpSetOfOpinionWithOnlyMaxValues, ActionRequest actionRequest) throws ReadOnlyException, ValidatorException, IOException {
		javax.portlet.PortletPreferences prefs = actionRequest.getPreferences();
		
		if(tmpSetOfOpinionWithOnlyMaxValues.validateMaxValues()){
			prefs.setValue("maximumRatingPerUser", Integer.toString(tmpSetOfOpinionWithOnlyMaxValues.getNumberOfMaximumScoresByUser()));
			prefs.setValue("maximumOfRatingPerSubtopic", Integer.toString(tmpSetOfOpinionWithOnlyMaxValues.getNumberOfMaximumScoreBySubtopic()));
			prefs.store();
		} else {
			SessionErrors.add(actionRequest, "maximumsInputNotValid");
		}
}
 
开发者ID:PolitAktiv,项目名称:politaktiv-aktuelles-meinungsbild-portlet,代码行数:12,代码来源:MeinungsbildRepository.java

示例12: readConfiguration

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public FlashlightSearchConfiguration readConfiguration(PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    return this.storageEngine.readConfiguration(preferences);
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:5,代码来源:FlashlightSearchServiceImpl.java

示例13: saveGlobalSettings

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public void saveGlobalSettings(String adtUuid, boolean doSearchOnStartup, String doSearchOnStartupKeywords, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    this.storageEngine.saveGlobalSettings(adtUuid, doSearchOnStartup, doSearchOnStartupKeywords, preferences);
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:5,代码来源:FlashlightSearchServiceImpl.java

示例14: saveConfigurationTab

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public void saveConfigurationTab(FlashlightSearchConfigurationTab configurationTab, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    this.storageEngine.saveConfigurationTab(configurationTab, preferences);
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:5,代码来源:FlashlightSearchServiceImpl.java

示例15: saveSearchFacetConfig

import javax.portlet.ValidatorException; //导入依赖的package包/类
@Override
public void saveSearchFacetConfig(FlashlightSearchConfigurationTab configurationTab, SearchFacet searchFacet, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    this.storageEngine.saveSearchFacetConfig(configurationTab, searchFacet, preferences);
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:5,代码来源:FlashlightSearchServiceImpl.java


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