blob: bd5dcef08bb00391856e42e09b040427df48520d [file] [log] [blame]
Simon Huntf844f632015-05-20 19:06:35 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Simon Huntf844f632015-05-20 19:06:35 -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 */
17
18package org.onosproject.cord.gui.model;
19
20
21import com.fasterxml.jackson.databind.node.ObjectNode;
22
23/**
24 * Designates a specific instance of an XOS function.
25 */
Simon Hunt09a32db2015-05-21 15:00:42 -070026public interface XosFunction {
Simon Huntf844f632015-05-20 19:06:35 -070027
28 /**
29 * Returns the descriptor for this function.
30 *
Simon Hunt6c2555b2015-05-21 18:17:56 -070031 * @return function descriptor
Simon Huntf844f632015-05-20 19:06:35 -070032 */
33 XosFunctionDescriptor descriptor();
34
35 /**
Simon Hunt6c2555b2015-05-21 18:17:56 -070036 * Applies a parameter change for the given user.
Simon Huntf844f632015-05-20 19:06:35 -070037 *
Simon Hunt6c2555b2015-05-21 18:17:56 -070038 * @param user user to apply change to
39 * @param param parameter name
40 * @param value new parameter value
Simon Huntf844f632015-05-20 19:06:35 -070041 */
Simon Hunt6c2555b2015-05-21 18:17:56 -070042 void applyParam(SubscriberUser user, String param, String value);
43
44 /**
45 * Create an initialized memento.
46 * If the function maintains no state per user, return null.
47 *
48 * @return a new memento
49 */
50 Memento createMemento();
51
52 /**
Simon Hunta00b0ce2015-05-22 15:57:11 -070053 * Create the XOS specific URL suffix for applying state change for
54 * the given user.
55 *
56 * @param user the user
57 * @return URL suffix
58 */
59 String xosUrlApply(SubscriberUser user);
60
61 /**
Simon Hunt6c2555b2015-05-21 18:17:56 -070062 * Internal state memento.
63 */
64 interface Memento {
65 /**
66 * Returns a JSON representation of this memento.
67 *
68 * @return memento state as object node
69 */
70 ObjectNode toObjectNode();
71 }
Simon Huntf844f632015-05-20 19:06:35 -070072}
73