[PORTAL-7] Rebase
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / SharedContext.java
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java
new file mode 100644 (file)
index 0000000..f966c96
--- /dev/null
@@ -0,0 +1,161 @@
+/*-\r
+ * ================================================================================\r
+ * ECOMP Portal\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ================================================================================\r
+ */\r
+package org.openecomp.portalapp.portal.domain;\r
+\r
+import java.util.Date;\r
+\r
+import javax.persistence.Entity;\r
+import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
+import javax.persistence.Id;\r
+import javax.persistence.Table;\r
+\r
+import org.openecomp.portalsdk.core.domain.support.DomainVo;\r
+\r
+/**\r
+ * A shared context is a key-value pair in a session. All shared-context objects\r
+ * should be dropped when a session is destroyed. Because there's always a\r
+ * chance of missing that event, this object notes its creation time so that it\r
+ * can be expired after a suitable time interval.\r
+ */\r
+@Entity\r
+@Table(name = "fn_shared_context")\r
+public class SharedContext extends DomainVo {\r
+\r
+       // generated\r
+       private static final long serialVersionUID = 7287469622586677888L;\r
+\r
+       @Id\r
+       @GeneratedValue(strategy = GenerationType.AUTO)\r
+       private Long id;\r
+       private Date create_time;\r
+       private String context_id;\r
+       private String ckey;\r
+       private String cvalue;\r
+\r
+       /**\r
+        * Mandatory no-argument constructor\r
+        */\r
+       public SharedContext() {\r
+       }\r
+\r
+       /**\r
+        * Convenience constructor. The database ID and creation timestamp are\r
+        * populated when the object is added to the database.\r
+        */\r
+       public SharedContext(final String contextId, final String key, final String value) {\r
+               this.context_id = contextId;\r
+               this.ckey = key;\r
+               this.cvalue = value;\r
+       }\r
+\r
+       /**\r
+        * Gets the database row ID.\r
+        * \r
+        * @return Database row ID\r
+        */\r
+       public Long getId() {\r
+               return id;\r
+       }\r
+\r
+       /**\r
+        * Sets the database row ID.\r
+        * \r
+        * @param id\r
+        */\r
+       public void setId(final Long id) {\r
+               this.id = id;\r
+       }\r
+\r
+       /**\r
+        * Gets the creation time\r
+        * \r
+        * @return Creation time as a Date\r
+        */\r
+       public Date getCreate_time() {\r
+               return create_time;\r
+       }\r
+\r
+       /**\r
+        * Sets the creation time\r
+        * \r
+        * @param create_time\r
+        */\r
+       public void setCreate_time(final Date create_time) {\r
+               this.create_time = create_time;\r
+       }\r
+\r
+       /**\r
+        * Gets the context ID\r
+        * \r
+        * @return Context ID\r
+        */\r
+       public String getContext_id() {\r
+               return context_id;\r
+       }\r
+\r
+       /**\r
+        * Sets the context ID\r
+        * \r
+        * @param context_id\r
+        */\r
+       public void setContext_id(final String context_id) {\r
+               this.context_id = context_id;\r
+       }\r
+\r
+       /**\r
+        * Gets the key of the key-value pair. Called ckey because "key" is a\r
+        * reserved word in Mysql.\r
+        * \r
+        * @return The key\r
+        */\r
+       public String getCkey() {\r
+               return ckey;\r
+       }\r
+\r
+       /**\r
+        * Sets the key of the key-value pair.\r
+        * \r
+        * @param ckey\r
+        */\r
+       public void setCkey(final String ckey) {\r
+               this.ckey = ckey;\r
+       }\r
+\r
+       /**\r
+        * Gets the value of the key-value pair. Called cvalue because "value" is a\r
+        * reserved word in Mysql.\r
+        * \r
+        * @return\r
+        */\r
+       public String getCvalue() {\r
+               return cvalue;\r
+       }\r
+\r
+       /**\r
+        * Sets the value of the key-value pair.\r
+        * \r
+        * @param cvalue\r
+        */\r
+       public void setCvalue(final String cvalue) {\r
+               this.cvalue = cvalue;\r
+       }\r
+\r
+}\r