001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019
020package org.apache.isis.core.runtime.userprofile;
021
022import java.util.List;
023
024import org.apache.isis.core.commons.authentication.AuthenticationSession;
025import org.apache.isis.core.commons.components.ApplicationScopedComponent;
026import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
027
028/**
029 * Intended to acts like a bridge, loading the profile from the underlying
030 * store.
031 * 
032 * <p>
033 * This is an interface only to make it easy to mock in tests. In practice there
034 * is only a single implementation, {@link UserProfileLoaderDefault}.
035 */
036public interface UserProfileLoader extends ApplicationScopedComponent {
037
038    // //////////////////////////////////////////////////////
039    // Fixtures
040    // //////////////////////////////////////////////////////
041
042    /**
043     * @see PersistenceSession#isFixturesInstalled()
044     */
045    public boolean isFixturesInstalled();
046
047    // //////////////////////////////////////////////////////
048    // saveAs...
049    // //////////////////////////////////////////////////////
050
051    public void saveAsDefault(UserProfile userProfile);
052
053    public void saveForUser(String userName, UserProfile userProfile);
054
055    // //////////////////////////////////////////////////////
056    // saveSession
057    // //////////////////////////////////////////////////////
058
059    public void saveSession(List<ObjectAdapter> objects);
060
061    // //////////////////////////////////////////////////////
062    // getProfile
063    // //////////////////////////////////////////////////////
064
065    public UserProfile getProfile(AuthenticationSession session);
066
067    @Deprecated
068    public UserProfile getProfile();
069
070    // //////////////////////////////////////////////////////
071    // Services
072    // //////////////////////////////////////////////////////
073
074    public void setServices(List<Object> servicesList);
075
076    public List<Object> getServices();
077
078}