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    import java.io.Serializable;
019    
020    import java.util.Enumeration;
021    import java.util.Map;
022    
023    import javax.portlet.PortletPreferences;
024    import javax.portlet.ReadOnlyException;
025    
026    /**
027     * @author Alexander Chow
028     */
029    public class PortalPreferencesWrapper
030            implements Cloneable, PortletPreferences, Serializable {
031    
032            public PortalPreferencesWrapper(
033                    PortalPreferencesImpl portalPreferencesImpl) {
034    
035                    _portalPreferencesImpl = portalPreferencesImpl;
036            }
037    
038            @Override
039            public PortalPreferencesWrapper clone() {
040                    return new PortalPreferencesWrapper(_portalPreferencesImpl.clone());
041            }
042    
043            @Override
044            public Map<String, String[]> getMap() {
045                    return _portalPreferencesImpl.getMap();
046            }
047    
048            @Override
049            public Enumeration<String> getNames() {
050                    return _portalPreferencesImpl.getNames();
051            }
052    
053            public PortalPreferencesImpl getPortalPreferencesImpl() {
054                    return _portalPreferencesImpl;
055            }
056    
057            @Override
058            public String getValue(String key, String def) {
059                    return _portalPreferencesImpl.getValue(null, key, def);
060            }
061    
062            @Override
063            public String[] getValues(String key, String[] def) {
064                    return _portalPreferencesImpl.getValues(null, key, def);
065            }
066    
067            @Override
068            public boolean isReadOnly(String key) {
069                    return _portalPreferencesImpl.isReadOnly(key);
070            }
071    
072            @Override
073            public void reset(String key) throws ReadOnlyException {
074                    _portalPreferencesImpl.reset(key);
075            }
076    
077            @Override
078            public void setValue(String key, String value) throws ReadOnlyException {
079                    _portalPreferencesImpl.setValue(key, value);
080            }
081    
082            @Override
083            public void setValues(String key, String[] values)
084                    throws ReadOnlyException {
085    
086                    _portalPreferencesImpl.setValues(key, values);
087            }
088    
089            @Override
090            public void store() throws IOException {
091                    _portalPreferencesImpl.store();
092            }
093    
094            private PortalPreferencesImpl _portalPreferencesImpl;
095    
096    }