2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalapp.portal.service;
22 import java.util.List;
24 import org.openecomp.portalapp.portal.domain.SharedContext;
27 * Defines the methods exposed by the service that manages shared context
28 * objects in the database.
30 public interface SharedContextService {
33 * Gets all shared context objects for the specified context ID.
37 * @return List of SharedContext objects
39 List<SharedContext> getSharedContexts(String contextId);
42 * Gets the shared context with the specified context ID and key.
45 * Context ID; usually a session ID
47 * Key for the key-value pair
48 * @return Value found in the database, null if any parameter is null or no
49 * shared context exists with that context ID - key pair.
51 SharedContext getSharedContext(String contextId, String key);
54 * Creates a new shared context entry with the specified context ID, key and
60 * Key for the key-value pair.
62 * Value for the key-value pair.
64 void addSharedContext(String contextId, String key, String value);
67 * Saves the specified shared context.
70 * SharedContext object to save.
72 void saveSharedContext(SharedContext context);
75 * Deletes the specified shared context.
78 * SharedContext object to delete.
80 void deleteSharedContext(SharedContext context);
83 * Deletes all shared contexts with the specified context ID.
86 * Context ID; usually a session ID
87 * @return number of shared-context objects deleted
89 int deleteSharedContexts(String contextId);
92 * Deletes all shared contexts with a creation time that is older than the
96 * Expiration threshold in seconds
98 void expireSharedContexts(int ageInSeconds);