blob: 682e1a6758153308555739b4dad9c5900352507f [file] [log] [blame]
Thomas Vachuska0af26912016-03-21 21:37:30 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Thomas Vachuska0af26912016-03-21 21:37:30 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.ui;
18
19import com.fasterxml.jackson.databind.node.ObjectNode;
20
21import java.util.Map;
22import java.util.Set;
23
24/**
25 * Service for tracking user interface preferences.
26 */
27public interface UiPreferencesService {
28
29 /**
30 * Returns the list of user names that have user preferences available.
31 *
32 * @return list of user names
33 */
34 Set<String> getUserNames();
35
36 /**
37 * Returns an immutable copy of the preferences for the specified user.
38 *
39 * @param userName user name
40 * @return map of user preferences
41 */
42 Map<String, ObjectNode> getPreferences(String userName);
43
44 /**
Simon Huntcfef6f92017-07-25 16:58:42 -070045 * Returns the named preference for the specified user.
46 * If no such preferences exist, null will be returned.
47 *
48 * @param username user name
49 * @param key preference key
50 * @return named preference
51 */
52 ObjectNode getPreference(String username, String key);
53
54 /**
Thomas Vachuska99b7bbe2018-02-01 15:29:46 -080055 * Sets or clears the named preference for the specified user.
Thomas Vachuska0af26912016-03-21 21:37:30 -070056 *
Simon Huntcfef6f92017-07-25 16:58:42 -070057 * @param username user name
58 * @param key preference key
Thomas Vachuska99b7bbe2018-02-01 15:29:46 -080059 * @param value preference value; if null it will be cleared
Thomas Vachuska0af26912016-03-21 21:37:30 -070060 */
Simon Huntcfef6f92017-07-25 16:58:42 -070061 void setPreference(String username, String key, ObjectNode value);
Thomas Vachuska0af26912016-03-21 21:37:30 -070062
63}