[PORTAL-7] Rebase
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / SharedContext.java
1 /*-\r
2  * ================================================================================\r
3  * ECOMP Portal\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ================================================================================\r
19  */\r
20 package org.openecomp.portalapp.portal.domain;\r
21 \r
22 import java.util.Date;\r
23 \r
24 import javax.persistence.Entity;\r
25 import javax.persistence.GeneratedValue;\r
26 import javax.persistence.GenerationType;\r
27 import javax.persistence.Id;\r
28 import javax.persistence.Table;\r
29 \r
30 import org.openecomp.portalsdk.core.domain.support.DomainVo;\r
31 \r
32 /**\r
33  * A shared context is a key-value pair in a session. All shared-context objects\r
34  * should be dropped when a session is destroyed. Because there's always a\r
35  * chance of missing that event, this object notes its creation time so that it\r
36  * can be expired after a suitable time interval.\r
37  */\r
38 @Entity\r
39 @Table(name = "fn_shared_context")\r
40 public class SharedContext extends DomainVo {\r
41 \r
42         // generated\r
43         private static final long serialVersionUID = 7287469622586677888L;\r
44 \r
45         @Id\r
46         @GeneratedValue(strategy = GenerationType.AUTO)\r
47         private Long id;\r
48         private Date create_time;\r
49         private String context_id;\r
50         private String ckey;\r
51         private String cvalue;\r
52 \r
53         /**\r
54          * Mandatory no-argument constructor\r
55          */\r
56         public SharedContext() {\r
57         }\r
58 \r
59         /**\r
60          * Convenience constructor. The database ID and creation timestamp are\r
61          * populated when the object is added to the database.\r
62          */\r
63         public SharedContext(final String contextId, final String key, final String value) {\r
64                 this.context_id = contextId;\r
65                 this.ckey = key;\r
66                 this.cvalue = value;\r
67         }\r
68 \r
69         /**\r
70          * Gets the database row ID.\r
71          * \r
72          * @return Database row ID\r
73          */\r
74         public Long getId() {\r
75                 return id;\r
76         }\r
77 \r
78         /**\r
79          * Sets the database row ID.\r
80          * \r
81          * @param id\r
82          */\r
83         public void setId(final Long id) {\r
84                 this.id = id;\r
85         }\r
86 \r
87         /**\r
88          * Gets the creation time\r
89          * \r
90          * @return Creation time as a Date\r
91          */\r
92         public Date getCreate_time() {\r
93                 return create_time;\r
94         }\r
95 \r
96         /**\r
97          * Sets the creation time\r
98          * \r
99          * @param create_time\r
100          */\r
101         public void setCreate_time(final Date create_time) {\r
102                 this.create_time = create_time;\r
103         }\r
104 \r
105         /**\r
106          * Gets the context ID\r
107          * \r
108          * @return Context ID\r
109          */\r
110         public String getContext_id() {\r
111                 return context_id;\r
112         }\r
113 \r
114         /**\r
115          * Sets the context ID\r
116          * \r
117          * @param context_id\r
118          */\r
119         public void setContext_id(final String context_id) {\r
120                 this.context_id = context_id;\r
121         }\r
122 \r
123         /**\r
124          * Gets the key of the key-value pair. Called ckey because "key" is a\r
125          * reserved word in Mysql.\r
126          * \r
127          * @return The key\r
128          */\r
129         public String getCkey() {\r
130                 return ckey;\r
131         }\r
132 \r
133         /**\r
134          * Sets the key of the key-value pair.\r
135          * \r
136          * @param ckey\r
137          */\r
138         public void setCkey(final String ckey) {\r
139                 this.ckey = ckey;\r
140         }\r
141 \r
142         /**\r
143          * Gets the value of the key-value pair. Called cvalue because "value" is a\r
144          * reserved word in Mysql.\r
145          * \r
146          * @return\r
147          */\r
148         public String getCvalue() {\r
149                 return cvalue;\r
150         }\r
151 \r
152         /**\r
153          * Sets the value of the key-value pair.\r
154          * \r
155          * @param cvalue\r
156          */\r
157         public void setCvalue(final String cvalue) {\r
158                 this.cvalue = cvalue;\r
159         }\r
160 \r
161 }\r