nexus site path corrected
[portal.git] / ecomp-portal-BE / src / main / java / org / openecomp / portalapp / portal / service / SharedContextService.java
1 /*-
2  * ================================================================================
3  * eCOMP Portal
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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  * ================================================================================
19  */
20 package org.openecomp.portalapp.portal.service;
21
22 import java.util.List;
23
24 import org.openecomp.portalapp.portal.domain.SharedContext;
25
26 /**
27  * Defines the methods exposed by the service that manages shared context
28  * objects in the database via Hibernate.
29  */
30 public interface SharedContextService {
31
32         /**
33          * Gets all shared context objects for the specified context ID.
34          * 
35          * @return List of SharedContext objects
36          */
37         List<SharedContext> getSharedContexts(String contextId);
38
39         /**
40          * Gets the shared context with the specified context ID and key.
41          * 
42          * @param contextId
43          *            Context ID; usually a session ID
44          * @param key
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.
48          */
49         SharedContext getSharedContext(String contextId, String key);
50
51         /**
52          * Creates a new shared context in the database with the specified context
53          * ID, key and value.
54          * 
55          * @param context
56          *            SharedContext object to save.
57          * @param key
58          *            Key for the key-value pair.
59          * @param value
60          *            Value for the key-value pair.
61          */
62         void addSharedContext(String contextId, String key, String value);
63
64         /**
65          * Saves the specified shared context to the database.
66          * 
67          * @param context
68          *            SharedContext object to save.
69          */
70         void saveSharedContext(SharedContext context);
71
72         /**
73          * Deletes the specified shared context from the database.
74          * 
75          * @param context
76          *            SharedContext object to delete.
77          */
78         void deleteSharedContext(SharedContext context);
79
80         /**
81          * Deletes all shared contexts with the specified context ID.
82          * 
83          * @param contextId
84          *            Context ID; usually a session ID
85          * @return number of shared-context objects deleted
86          */
87         int deleteSharedContexts(String contextId);
88
89         /**
90          * Deletes all shared contexts that are older (judged from creation
91          * timestamp) than the specified value.
92          * 
93          * @param ageInSeconds
94          *            Expiration threshold in seconds
95          */
96         void expireSharedContexts(int ageInSeconds);
97
98 }