Examples of PreferenceSetImpl


Examples of org.jasig.portal.container.om.common.PreferenceSetImpl

   
    /**
     * @see org.jasig.portal.IPortletPreferencesStore#getDefinitionPreferences(int)
     */
    public PreferenceSet getDefinitionPreferences(final int chanId) throws Exception {
        final PreferenceSetImpl prefs = new PreferenceSetImpl();
        final Connection con = RDBMServices.getConnection();
       
        final String selectPrefs =
            "SELECT UPDP.PORTLET_PREF_NAME, UPDP.PORTLET_PREF_READONLY, UPPV.PORTLET_PREF_VALUE " +
            "FROM UP_PORTLET_DEFINITION_PREFS UPDP, UP_PORTLET_PREF_VALUES UPPV " +
            "WHERE UPDP.PREF_ID=UPPV.PREF_ID AND CHAN_ID=?";
       
        if (log.isDebugEnabled())
            log.debug("RDBMPortletPreferencesStore::getDefinitionPreferences(chanId=" + chanId + ")");
               
        try {
            PreparedStatement selectCurrentPrefsPstmt = null;
           
            try {
                selectCurrentPrefsPstmt = con.prepareStatement(selectPrefs);
               
                if (log.isDebugEnabled())
                    log.debug("RDBMPortletPreferencesStore::getDefinitionPreferences(): " + selectPrefs);
                selectCurrentPrefsPstmt.setInt(1, chanId);
                final ResultSet rs = selectCurrentPrefsPstmt.executeQuery();
               
                final Map prefsBuilder = new HashMap();
                final Map readOnlyMap = new HashMap();
               
                try {
                    while (rs.next()) {
                        final String prefName = rs.getString("PORTLET_PREF_NAME");
                        final String prefReadOnly = rs.getString("PORTLET_PREF_READONLY");
                        String prefValue = rs.getString("PORTLET_PREF_VALUE");
                        if (prefValue != null && prefValue.startsWith(PREFIX))
                            prefValue = prefValue.substring(PREFIX.length());
                       
                        if (!readOnlyMap.containsKey(prefName)) {
                            if (READ_ONLY_TRUE.equals(prefReadOnly)) {
                                readOnlyMap.put(prefName, Boolean.TRUE);
                            }
                            else {
                                readOnlyMap.put(prefName, Boolean.FALSE);
                            }
                        }
                       
                        List prefList = (List)prefsBuilder.get(prefName);
                       
                        if (prefList == null)
                        {
                            prefList = new LinkedList();
                            prefsBuilder.put(prefName, prefList);
                        }
                       
                        prefList.add(prefValue);
                    }
                }
                finally {
                    try { rs.close(); } catch (Exception e) { }
                }
               
                for (final Iterator prefKeyItr = prefsBuilder.keySet().iterator(); prefKeyItr.hasNext();) {
                    final String prefName = (String)prefKeyItr.next();
                    final List prefValues = (List)prefsBuilder.get(prefName);
                    final boolean readOnly = Boolean.TRUE.equals(readOnlyMap.get(prefName));
                   
                    prefs.add(prefName, prefValues, readOnly);
                }
            }
            finally {
                try { selectCurrentPrefsPstmt.close(); } catch (Exception e) { }
            }
View Full Code Here

Examples of org.jasig.portal.container.om.common.PreferenceSetImpl

    /**
     * @see org.jasig.portal.IPortletPreferencesStore#getEntityPreferences(int, int, java.lang.String)
     */
    public PreferenceSet getEntityPreferences(final int userId, final int layoutId, final String chanDescId) throws Exception {
        final PreferenceSetImpl prefs = new PreferenceSetImpl();
        final Connection con = RDBMServices.getConnection();

        final String selectPrefs =
            "SELECT UPEP.PORTLET_PREF_NAME, UPPV.PORTLET_PREF_VALUE " +
            "FROM UP_PORTLET_ENTITY_PREFS UPEP, UP_PORTLET_PREF_VALUES UPPV " +
            "WHERE UPEP.PREF_ID=UPPV.PREF_ID AND UPEP.USER_ID=? AND UPEP.LAYOUT_ID=? AND UPEP.CHAN_DESC_ID=?";

        if (log.isDebugEnabled())
            log.debug("RDBMPortletPreferencesStore::getEntityPreferences(userId=" + userId + ", layoutId=" + layoutId + ", chanDescId=" + chanDescId + ")");

        try {
            PreparedStatement selectCurrentPrefsPstmt = null;
           
            try {
                selectCurrentPrefsPstmt = con.prepareStatement(selectPrefs);
               
                if (log.isDebugEnabled())
                    log.debug("RDBMPortletPreferencesStore::getEntityPreferences(): " + selectPrefs);
               
                selectCurrentPrefsPstmt.setInt(1, userId);
                selectCurrentPrefsPstmt.setInt(2, layoutId);
                selectCurrentPrefsPstmt.setString(3, chanDescId);
                ResultSet rs = selectCurrentPrefsPstmt.executeQuery();
               
                final Map prefsBuilder = new HashMap();
               
                try {
                    while (rs.next()) {
                        final String prefName = rs.getString("PORTLET_PREF_NAME");
                        String prefValue = rs.getString("PORTLET_PREF_VALUE");
                        if (prefValue != null && prefValue.startsWith(PREFIX))
                            prefValue = prefValue.substring(PREFIX.length());
                                               
                        List prefList = (List)prefsBuilder.get(prefName);
                       
                        if (prefList == null)
                        {
                            prefList = new LinkedList();
                            prefsBuilder.put(prefName, prefList);
                        }
                       
                        prefList.add(prefValue);
                    }
                }
                finally {
                    try { rs.close(); } catch (Exception e) { }
                }
               
                for (final Iterator prefKeyItr = prefsBuilder.keySet().iterator(); prefKeyItr.hasNext();) {
                    final String prefName = (String)prefKeyItr.next();
                    final List prefValues = (List)prefsBuilder.get(prefName);
                   
                    prefs.add(prefName, prefValues);
                }
            }
            finally {
                try { selectCurrentPrefsPstmt.close(); } catch (Exception e) { }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.