001    /**
002     * Copyright (c) 2000-2013 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            @Override
037            public Map<String, String[]> getMap() {
038                    return _portalPreferencesImpl.getMap();
039            }
040    
041            @Override
042            public Enumeration<String> getNames() {
043                    return _portalPreferencesImpl.getNames();
044            }
045    
046            public PortalPreferencesImpl getPortalPreferencesImpl() {
047                    return _portalPreferencesImpl;
048            }
049    
050            @Override
051            public String getValue(String key, String def) {
052                    return _portalPreferencesImpl.getValue(null, key, def);
053            }
054    
055            @Override
056            public String[] getValues(String key, String[] def) {
057                    return _portalPreferencesImpl.getValues(null, key, def);
058            }
059    
060            @Override
061            public boolean isReadOnly(String key) {
062                    return _portalPreferencesImpl.isReadOnly(key);
063            }
064    
065            @Override
066            public void reset(String key) throws ReadOnlyException {
067                    _portalPreferencesImpl.reset(key);
068            }
069    
070            @Override
071            public void setValue(String key, String value) throws ReadOnlyException {
072                    _portalPreferencesImpl.setValue(key, value);
073            }
074    
075            @Override
076            public void setValues(String key, String[] values)
077                    throws ReadOnlyException {
078    
079                    _portalPreferencesImpl.setValues(key, values);
080            }
081    
082            @Override
083            public void store() throws IOException {
084                    _portalPreferencesImpl.store();
085            }
086    
087            private PortalPreferencesImpl _portalPreferencesImpl;
088    
089    }