Thomas Vachuska | 0af2691 | 2016-03-21 21:37:30 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Thomas Vachuska | 0af2691 | 2016-03-21 21:37:30 -0700 | [diff] [blame] | 3 | * |
| 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 | |
| 17 | package org.onosproject.ui; |
| 18 | |
| 19 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 20 | |
| 21 | import java.util.Map; |
| 22 | import java.util.Set; |
| 23 | |
| 24 | /** |
| 25 | * Service for tracking user interface preferences. |
| 26 | */ |
| 27 | public 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 Hunt | cfef6f9 | 2017-07-25 16:58:42 -0700 | [diff] [blame] | 45 | * 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 Vachuska | 99b7bbe | 2018-02-01 15:29:46 -0800 | [diff] [blame] | 55 | * Sets or clears the named preference for the specified user. |
Thomas Vachuska | 0af2691 | 2016-03-21 21:37:30 -0700 | [diff] [blame] | 56 | * |
Simon Hunt | cfef6f9 | 2017-07-25 16:58:42 -0700 | [diff] [blame] | 57 | * @param username user name |
| 58 | * @param key preference key |
Thomas Vachuska | 99b7bbe | 2018-02-01 15:29:46 -0800 | [diff] [blame] | 59 | * @param value preference value; if null it will be cleared |
Thomas Vachuska | 0af2691 | 2016-03-21 21:37:30 -0700 | [diff] [blame] | 60 | */ |
Simon Hunt | cfef6f9 | 2017-07-25 16:58:42 -0700 | [diff] [blame] | 61 | void setPreference(String username, String key, ObjectNode value); |
Thomas Vachuska | 0af2691 | 2016-03-21 21:37:30 -0700 | [diff] [blame] | 62 | |
| 63 | } |