001/*
002 * (C) Copyright 2011-2019 Nuxeo (http://nuxeo.com/) and others.
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 *
016 * Contributors:
017 *     Quentin Lamerand <qlamerand@nuxeo.com>
018 */
019
020package org.nuxeo.ecm.user.center.profile;
021
022import org.nuxeo.ecm.core.api.CoreSession;
023import org.nuxeo.ecm.core.api.DocumentModel;
024
025/**
026 * A service to manage user profiles
027 *
028 * @author <a href="mailto:qlamerand@nuxeo.com">Quentin Lamerand</a>
029 * @since 5.5
030 */
031public interface UserProfileService {
032
033    /**
034     * Get the current user profile. It's stored in its user workspace.
035     *
036     * @param session the current CoreSession
037     * @return the user profile DocumentModel
038     */
039    DocumentModel getUserProfileDocument(CoreSession session);
040
041    /**
042     * Get the profile of a specific user. It's stored in its user workspace.
043     *
044     * @param userName the user name
045     * @param session the current CoreSession
046     * @return the user profile DocumentModel
047     */
048    DocumentModel getUserProfileDocument(String userName, CoreSession session);
049
050    /**
051     * Get a DocumentModel containing both user and user profile schemas
052     *
053     * @param userModel the user DocumentModel
054     * @param session the current CoreSession
055     * @return a SimpleDocumentModel with the two schemas
056     */
057    DocumentModel getUserProfile(DocumentModel userModel, CoreSession session);
058
059    /**
060     * Clears the user profile cache.
061     */
062    void clearCache();
063
064    /**
065     * Get the user profile XMap descriptor for the importer config
066     *
067     * @return an XMap ImportConfig descriptor
068     */
069    ImporterConfig getImporterConfig();
070}