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 via Hibernate.
30 public interface SharedContextService {
33 * Gets all shared context objects for the specified context ID.
35 * @return List of SharedContext objects
37 List<SharedContext> getSharedContexts(String contextId);
40 * Gets the shared context with the specified context ID and key.
43 * Context ID; usually a session ID
45 * Key for the key-value pair
46 * @return Value found in the database, null if any parameter is null or no
47 * shared context exists with that context ID - key pair.
49 SharedContext getSharedContext(String contextId, String key);
52 * Creates a new shared context in the database with the specified context
56 * SharedContext object to save.
58 * Key for the key-value pair.
60 * Value for the key-value pair.
62 void addSharedContext(String contextId, String key, String value);
65 * Saves the specified shared context to the database.
68 * SharedContext object to save.
70 void saveSharedContext(SharedContext context);
73 * Deletes the specified shared context from the database.
76 * SharedContext object to delete.
78 void deleteSharedContext(SharedContext context);
81 * Deletes all shared contexts with the specified context ID.
84 * Context ID; usually a session ID
85 * @return number of shared-context objects deleted
87 int deleteSharedContexts(String contextId);
90 * Deletes all shared contexts that are older (judged from creation
91 * timestamp) than the specified value.
94 * Expiration threshold in seconds
96 void expireSharedContexts(int ageInSeconds);