Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
UserPreferencesConfigurationSource | 41 | 3 | 0% | 3 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.configuration.internal; | |
21 | ||
22 | import javax.inject.Inject; | |
23 | import javax.inject.Named; | |
24 | import javax.inject.Singleton; | |
25 | ||
26 | import org.xwiki.bridge.DocumentAccessBridge; | |
27 | import org.xwiki.component.annotation.Component; | |
28 | import org.xwiki.model.reference.DocumentReference; | |
29 | import org.xwiki.model.reference.LocalDocumentReference; | |
30 | ||
31 | /** | |
32 | * Configuration source taking its data in the User Preferences wiki document (the user profile page) using data from a | |
33 | * XWikiUsers object attached to that document. | |
34 | * | |
35 | * @version $Id: 537be5d9342a6ae23d41702794e0e443384f1bd1 $ | |
36 | * @since 2.0M2 | |
37 | */ | |
38 | @Component | |
39 | @Named("user") | |
40 | @Singleton | |
41 | public class UserPreferencesConfigurationSource extends AbstractDocumentConfigurationSource | |
42 | { | |
43 | static final String SPACE_NAME = "XWiki"; | |
44 | ||
45 | /** | |
46 | * The local reference of the class containing user preferences. | |
47 | */ | |
48 | static final LocalDocumentReference CLASS_REFERENCE = new LocalDocumentReference(SPACE_NAME, "XWikiUsers"); | |
49 | ||
50 | @Inject | |
51 | private DocumentAccessBridge documentAccessBridge; | |
52 | ||
53 | 722 | @Override |
54 | protected String getCacheId() | |
55 | { | |
56 | 722 | return "configuration.document.user"; |
57 | } | |
58 | ||
59 | 1065 | @Override |
60 | protected LocalDocumentReference getClassReference() | |
61 | { | |
62 | 1065 | return CLASS_REFERENCE; |
63 | } | |
64 | ||
65 | 40783 | @Override |
66 | protected DocumentReference getDocumentReference() | |
67 | { | |
68 | 40784 | return this.documentAccessBridge.getCurrentUserReference(); |
69 | } | |
70 | } |