001/*
002 *  Copyright 2011 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.core.impl.userpref;
017
018import java.util.Date;
019import java.util.HashMap;
020import java.util.Map;
021
022import org.apache.avalon.framework.thread.ThreadSafe;
023
024import org.ametys.core.user.UserIdentity;
025import org.ametys.core.userpref.DefaultUserPreferencesStorage;
026import org.ametys.core.userpref.UserPreferencesException;
027
028/**
029 * An empty implementation of {@link DefaultUserPreferencesStorage}.
030 */
031public class EmptyUserPreferencesStorage implements DefaultUserPreferencesStorage, ThreadSafe
032{
033    @Override
034    public Map<String, String> getUnTypedUserPrefs(UserIdentity user, String storageContext, Map<String, String> contextVars) throws UserPreferencesException
035    {
036        return new HashMap<>();
037    }
038    
039    @Override
040    public void removeUserPreferences(UserIdentity user, String storageContext, Map<String, String> contextVars) throws UserPreferencesException
041    {
042        // Do nothing.
043    }
044    
045    @Override
046    public void setUserPreferences(UserIdentity user, String storageContext, Map<String, String> contextVars, Map<String, String> preferences) throws UserPreferencesException
047    {
048        // Do nothing
049    }
050
051    @Override
052    public String getUserPreferenceAsString(UserIdentity user, String storageContext, Map<String, String> contextVars, String id) throws UserPreferencesException
053    {
054        return null;
055    }
056    
057    @Override
058    public Long getUserPreferenceAsLong(UserIdentity user, String storageContext, Map<String, String> contextVars, String id) throws UserPreferencesException
059    {
060        return null;
061    }
062    
063    @Override
064    public Date getUserPreferenceAsDate(UserIdentity user, String storageContext, Map<String, String> contextVars, String id) throws UserPreferencesException
065    {
066        return null;
067    }
068    
069    @Override
070    public Boolean getUserPreferenceAsBoolean(UserIdentity user, String storageContext, Map<String, String> contextVars, String id) throws UserPreferencesException
071    {
072        return null;
073    }
074    
075    @Override
076    public Double getUserPreferenceAsDouble(UserIdentity user, String storageContext, Map<String, String> contextVars, String id) throws UserPreferencesException
077    {
078        return null;
079    }
080    
081}