PortletPreferencesImpl.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:GridSphere 作者:
/**
     * 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());
        }
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号