diff options
author | Manoop Talasila <talasila@research.att.com> | 2019-07-09 15:29:40 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-09 15:29:40 +0000 |
commit | a2c93d258e4c564880601470434a7c0e168785c8 (patch) | |
tree | 1260f6d5ae3626b56a5d5d4c1bf6dec5fb1a6465 | |
parent | a8001bfd4a8a77fb402a5679ccb80dd14a3658c1 (diff) | |
parent | 08f6ad728c235f12bea357553f3195c137f480f8 (diff) |
Merge "SharedContext class DB constraints"
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java | 141 |
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; - } - } |