001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet;
016    
017    import java.io.IOException;
018    
019    import java.util.Enumeration;
020    import java.util.Map;
021    
022    import javax.portlet.PortletPreferences;
023    import javax.portlet.ReadOnlyException;
024    
025    /**
026     * @author Alexander Chow
027     */
028    public class PortalPreferencesWrapper implements PortletPreferences {
029    
030            public PortalPreferencesWrapper(
031                    PortalPreferencesImpl portalPreferencesImpl) {
032    
033                    _portalPreferencesImpl = portalPreferencesImpl;
034            }
035    
036            public Map<String, String[]> getMap() {
037                    return _portalPreferencesImpl.getMap();
038            }
039    
040            public Enumeration<String> getNames() {
041                    return _portalPreferencesImpl.getNames();
042            }
043    
044            public PortalPreferencesImpl getPortalPreferencesImpl() {
045                    return _portalPreferencesImpl;
046            }
047    
048            public String getValue(String key, String def) {
049                    return _portalPreferencesImpl.getValue(null, key, def);
050            }
051    
052            public String[] getValues(String key, String[] def) {
053                    return _portalPreferencesImpl.getValues(null, key, def);
054            }
055    
056            public boolean isReadOnly(String key) {
057                    return _portalPreferencesImpl.isReadOnly(key);
058            }
059    
060            public void reset(String key) throws ReadOnlyException {
061                    _portalPreferencesImpl.reset(key);
062            }
063    
064            public void setValue(String key, String value) throws ReadOnlyException {
065                    _portalPreferencesImpl.setValue(key, value);
066            }
067    
068            public void setValues(String key, String[] values)
069                    throws ReadOnlyException {
070    
071                    _portalPreferencesImpl.setValues(key, values);
072            }
073    
074            public void store() throws IOException {
075                    _portalPreferencesImpl.store();
076            }
077    
078            private PortalPreferencesImpl _portalPreferencesImpl;
079    
080    }