java类javax.portlet.ValidatorException的实例源码

ConfiguracaoManager.java 文件源码 项目:edemocracia 阅读 16 收藏 0 点赞 0 评论 0
public static void salvarConfiguracao(Configuracao config) throws ReadOnlyException, ValidatorException, IOException{

    PortletPreferences portletPrefs = LiferayFacesContext.getInstance().getPortletPreferences();
    portletPrefs.setValue(CONFIGURACAO_KEY, config.convertToJSON());
    portletPrefs.store();

}
PortletPreferencesImpl.java 文件源码 项目:portals-pluto 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Stores the portlet preferences to a persistent storage. This method
 * should only be invoked within <code>processAction()</code> method.
 * 
 * @see #internalStore()
 * 
 * @throws IllegalStateException  if this method is not invoked within
 *         <code>processAction()</code> method.
 * @throws ValidatorException  if the portlet preferences are not valid.
 * @throws IOException  if an error occurs with the persistence mechanism.
 */
public void store() throws IOException, ValidatorException {
    if (PortletRequest.RENDER_PHASE.equals(request.getAttribute(PortletRequest.LIFECYCLE_PHASE))) {
        throw new IllegalStateException(
                "store is not allowed during RENDER phase.");
    }
    internalStore();
}
PortletPreferencesImpl.java 文件源码 项目:GridSphere 阅读 19 收藏 0 点赞 0 评论 0
/**
     * Commits all changes made to the preferences via the
     * <code>set</code> methods in the persistent store.
     * <p/>
     * If this call returns succesfull, all changes are made
     * persistent. If this call fails, no changes are made
     * in the persistent store. This call is an atomic operation
     * regardless of how many preference attributes have been modified.
     * <p/>
     * All changes made to preferences not followed by a call
     * to the <code>store</code> method are discarded when the
     * portlet finishes the <code>processAction</code> method.
     * <p/>
     * If a validator is defined for this preferences in the
     * deployment descriptor, this validator is called before
     * the actual store is performed to check wether the given
     * preferences are vaild. If this check fails a
     * <code>ValidatorException</code> is thrown.
     *
     * @throws java.io.IOException if changes cannot be written into
     *                             the backend store
     * @throws javax.portlet.ValidatorException
     *                             if the validation performed by the
     *                             associated validator fails
     * @throws java.lang.IllegalStateException
     *                             if this method is called inside a render call
     * @see javax.portlet.PreferencesValidator
     */
    public void store() throws java.io.IOException, ValidatorException {
        if (isRender) throw new IllegalStateException("Cannot persist PortletPreferences in render method!");
        if (validator != null) validator.validate(this);
        try {
//            if (oid!=null) pm.saveOrUpdate(this); else pm.create(this);
            pm.saveOrUpdate(this);
        } catch (PersistenceManagerException e) {
            throw new IOException(e.getMessage());
        }
    }
ConfigurationStorage.java 文件源码 项目:flashlight-search 阅读 14 收藏 0 点赞 0 评论 0
/**
 * Saves the application's global settings
 *
 * @param adtUuid The ADT's UUID
 * @param doSearchOnStartup True to perform a search as soon as the portlet is displayed
 * @param doSearchOnStartupKeywords The keywords to send to the search if a search is triggered on startup
 * @param preferences The portlet preferences
 *
 * @throws ReadOnlyException If the configuration is read only
 * @throws ValidatorException If the configuration is invalid
 * @throws IOException If the configuration fails to save
 */
public void saveGlobalSettings(String adtUuid, boolean doSearchOnStartup, String doSearchOnStartupKeywords, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException;
ConfigurationStorage.java 文件源码 项目:flashlight-search 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Writes the given configuration tab model into the configuration. No format validation is performed at this level.
 * It is the developer's responsibility to send data that is in the expected format.
 *
 * Also, this method does not alter facet configurations. It only alters which facets are selected.
 *
 * @param configurationTab The configuration tab model
 * @param preferences The portlet preferences
 *
 * @throws ReadOnlyException If the configuration is read only
 * @throws ValidatorException If the configuration is invalid
 * @throws IOException If the configuration fails to save
 */
public void saveConfigurationTab(FlashlightSearchConfigurationTab configurationTab, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException;
ConfigurationStorage.java 文件源码 项目:flashlight-search 阅读 13 收藏 0 点赞 0 评论 0
/**
 * Delete the given configuration tab
 *
 * @param tabId The tab's unique ID
 * @param preferences The portlet preferences
 *
 * @throws ReadOnlyException If the configuration is read only
 * @throws ValidatorException If the configuration is invalid
 * @throws IOException If the configuration fails to save
 */
public void deleteConfigurationTab(String tabId, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException;
ConfigurationStorage.java 文件源码 项目:flashlight-search 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Writes the given facet configuration into the tab's configuration. No format validation is performed at this
 * level.
 *
 * @param configurationTab The tab for which we configure facets
 * @param searchFacet The facet to save
 * @param preferences The portlet preferences
 *
 * @throws ReadOnlyException If the configuration is read only
 * @throws ValidatorException If the configuration is invalid
 * @throws IOException If the configuration fails to save
 */
public void saveSearchFacetConfig(FlashlightSearchConfigurationTab configurationTab, SearchFacet searchFacet, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException;
PortletPreferencesService.java 文件源码 项目:portals-pluto 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Returns the preferences validator instance for the given portlet
 * definition. If no preferences validator class is defined for the portlet
 * definition, null is returned. This method caches the validator instances
 * in the cache to ensure that only one validator instance is created per
 * portlet definition.
 * @param portletDefinition  the portlet definition.
 * @return the preferences validator if defined for the portlet definition.
 * @throw ValidatorException  if fail to instantiate validator instance.
 */
PreferencesValidator getPreferencesValidator(PortletDefinition portletDefinition)
throws ValidatorException;
TestPreferencesValidator.java 文件源码 项目:portals-pluto 阅读 15 收藏 0 点赞 0 评论 0
@Override
public void validate(PortletPreferences arg0) throws ValidatorException {

}
PreferencesValidatorImpl.java 文件源码 项目:GridSphere 阅读 20 收藏 0 点赞 0 评论 0
/**
 * If the preferences values are successfully validated the call to this method
 * must finish gracefully. Otherwise it must throw a <code>ValidatorException</code>.
 *
 * @param preferences preferences to validate
 * @throws ValidatorException if the given preferences contains invalid
 *                            settings
 */

public void validate(PortletPreferences preferences)
        throws ValidatorException {
    // TODO
}


问题


面经


文章

微信
公众号

扫码关注公众号