summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src/main/java
diff options
context:
space:
mode:
authorDominik Mizyn <d.mizyn@samsung.com>2019-06-18 11:17:30 +0200
committerDominik Mizyn <d.mizyn@samsung.com>2019-06-18 11:17:32 +0200
commit08f6ad728c235f12bea357553f3195c137f480f8 (patch)
treee7c1ece83391e8427b6fe6dd9793d19f18c5f744 /ecomp-portal-BE-common/src/main/java
parent44be7f841e451097d29bd9313d9558e3f9031d1b (diff)
SharedContext class DB constraints
Java Bean Validation SR 380 annotations added to classes Getter, Setter changed to lombok annotation Issue-ID: PORTAL-643 Change-Id: I690665b97e431de50750d5a497afcf0cc2efa065 Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
Diffstat (limited to 'ecomp-portal-BE-common/src/main/java')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java141
1 files changed, 25 insertions, 116 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java
index b3adf0a6..14837dbf 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java
@@ -45,6 +45,13 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import javax.validation.constraints.Digits;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.hibernate.validator.constraints.SafeHtml;
import org.onap.portalsdk.core.domain.support.DomainVo;
/**
@@ -55,137 +62,39 @@ import org.onap.portalsdk.core.domain.support.DomainVo;
*/
@Entity
@Table(name = "fn_shared_context")
+@NoArgsConstructor
+@Getter
+@Setter
public class SharedContext extends DomainVo {
-
- // generated
private static final long serialVersionUID = 7287469622586677888L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
+ @Digits(integer = 11, fraction = 0)
private Long id;
+
+ @NotNull
private Date create_time;
+
+ @NotNull
+ @SafeHtml
+ @Size(max = 64)
private String context_id;
+
+ @NotNull
+ @SafeHtml
+ @Size(max = 128)
private String ckey;
- private String cvalue;
- /**
- * Mandatory no-argument constructor
- */
- public SharedContext() {
- }
+ @NotNull
+ @SafeHtml
+ @Size(max = 1024)
+ private String cvalue;
- /**
- * Convenience constructor. The database ID and creation timestamp are
- * populated when the object is added to the database.
- *
- * @param contextId
- * context ID
- * @param key
- * context key
- * @param value
- * context value
- */
public SharedContext(final String contextId, final String key, final String value) {
this.context_id = contextId;
this.ckey = key;
this.cvalue = value;
}
- /**
- * Gets the database row ID.
- *
- * @return Database row ID
- */
- public Long getId() {
- return id;
- }
-
- /**
- * Sets the database row ID.
- *
- * @param id
- * database row ID
- */
- public void setId(final Long id) {
- this.id = id;
- }
-
- /**
- * Gets the creation time
- *
- * @return Creation time as a Date
- */
- public Date getCreate_time() {
- return create_time;
- }
-
- /**
- * Sets the creation time
- *
- * @param create_time
- * Date
- */
- public void setCreate_time(final Date create_time) {
- this.create_time = create_time;
- }
-
- /**
- * Gets the context ID
- *
- * @return Context ID
- */
- public String getContext_id() {
- return context_id;
- }
-
- /**
- * Sets the context ID
- *
- * @param context_id
- * String
- */
- public void setContext_id(final String context_id) {
- this.context_id = context_id;
- }
-
- /**
- * Gets the key of the key-value pair. Called ckey because "key" is a
- * reserved word in Mysql.
- *
- * @return The key
- */
- public String getCkey() {
- return ckey;
- }
-
- /**
- * Sets the key of the key-value pair.
- *
- * @param ckey
- * String
- */
- public void setCkey(final String ckey) {
- this.ckey = ckey;
- }
-
- /**
- * Gets the value of the key-value pair. Called cvalue because "value" is a
- * reserved word in Mysql.
- *
- * @return value
- */
- public String getCvalue() {
- return cvalue;
- }
-
- /**
- * Sets the value of the key-value pair.
- *
- * @param cvalue
- * value
- */
- public void setCvalue(final String cvalue) {
- this.cvalue = cvalue;
- }
-
}