[PORTAL-16 PORTAL-18] Widget ms; staging
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / SharedContext.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.domain;
21
22 import java.util.Date;
23
24 import javax.persistence.Entity;
25 import javax.persistence.GeneratedValue;
26 import javax.persistence.GenerationType;
27 import javax.persistence.Id;
28 import javax.persistence.Table;
29
30 import org.openecomp.portalsdk.core.domain.support.DomainVo;
31
32 /**
33  * A shared context is a key-value pair in a session. All shared-context objects
34  * should be dropped when a session is destroyed. Because there's always a
35  * chance of missing that event, this object notes its creation time so that it
36  * can be expired after a suitable time interval.
37  */
38 @Entity
39 @Table(name = "fn_shared_context")
40 public class SharedContext extends DomainVo {
41
42         // generated
43         private static final long serialVersionUID = 7287469622586677888L;
44
45         @Id
46         @GeneratedValue(strategy = GenerationType.AUTO)
47         private Long id;
48         private Date create_time;
49         private String context_id;
50         private String ckey;
51         private String cvalue;
52
53         /**
54          * Mandatory no-argument constructor
55          */
56         public SharedContext() {
57         }
58
59         /**
60          * Convenience constructor. The database ID and creation timestamp are
61          * populated when the object is added to the database.
62          * 
63          * @param contextId
64          *            context ID
65          * @param key
66          *            context key
67          * @param value
68          *            context value
69          */
70         public SharedContext(final String contextId, final String key, final String value) {
71                 this.context_id = contextId;
72                 this.ckey = key;
73                 this.cvalue = value;
74         }
75
76         /**
77          * Gets the database row ID.
78          * 
79          * @return Database row ID
80          */
81         public Long getId() {
82                 return id;
83         }
84
85         /**
86          * Sets the database row ID.
87          * 
88          * @param id
89          *            database row ID
90          */
91         public void setId(final Long id) {
92                 this.id = id;
93         }
94
95         /**
96          * Gets the creation time
97          * 
98          * @return Creation time as a Date
99          */
100         public Date getCreate_time() {
101                 return create_time;
102         }
103
104         /**
105          * Sets the creation time
106          * 
107          * @param create_time
108          *            Date
109          */
110         public void setCreate_time(final Date create_time) {
111                 this.create_time = create_time;
112         }
113
114         /**
115          * Gets the context ID
116          * 
117          * @return Context ID
118          */
119         public String getContext_id() {
120                 return context_id;
121         }
122
123         /**
124          * Sets the context ID
125          * 
126          * @param context_id
127          *            String
128          */
129         public void setContext_id(final String context_id) {
130                 this.context_id = context_id;
131         }
132
133         /**
134          * Gets the key of the key-value pair. Called ckey because "key" is a
135          * reserved word in Mysql.
136          * 
137          * @return The key
138          */
139         public String getCkey() {
140                 return ckey;
141         }
142
143         /**
144          * Sets the key of the key-value pair.
145          * 
146          * @param ckey
147          *            String
148          */
149         public void setCkey(final String ckey) {
150                 this.ckey = ckey;
151         }
152
153         /**
154          * Gets the value of the key-value pair. Called cvalue because "value" is a
155          * reserved word in Mysql.
156          * 
157          * @return value
158          */
159         public String getCvalue() {
160                 return cvalue;
161         }
162
163         /**
164          * Sets the value of the key-value pair.
165          * 
166          * @param cvalue
167          *            value
168          */
169         public void setCvalue(final String cvalue) {
170                 this.cvalue = cvalue;
171         }
172
173 }