From d534f989b469810596fa4a18d64de240377bdfe1 Mon Sep 17 00:00:00 2001 From: Thomas Knall Date: Tue, 24 Feb 2015 11:02:41 +0100 Subject: Add key/value configuration entity. --- .../id/commons/db/dao/config/ConfigProperty.java | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java new file mode 100644 index 000000000..6e2743b81 --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigProperty.java @@ -0,0 +1,95 @@ +package at.gv.egovernment.moa.id.commons.db.dao.config; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.Table; + +/** + * Reflects a MOAID configuration entry. + * + */ +@Table(name = "configproperty") +@Entity +public class ConfigProperty implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "propertyKey", unique = true) + private String key; + + @Lob + @Column(name = "propertyValue") + private String value; + + /** + * Returns the property's key. + * @return The key. + */ + public String getKey() { + return key; + } + + /** + * Sets the property's key. + * @param key The key + */ + public void setKey(String key) { + this.key = key; + } + + /** + * Returns the property's value (which might be {@code null}). + * @return The property's value (might be {@code null}). + */ + public String getValue() { + return value; + } + + /** + * Sets the property's value. + * @param value The value + */ + public void setValue(String value) { + this.value = value; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((key == null) ? 0 : key.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfigProperty other = (ConfigProperty) obj; + if (key == null) { + if (other.key != null) + return false; + } else if (!key.equals(other.key)) + return false; + return true; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("ConfigProperty [key="); + builder.append(key); + builder.append(", value="); + builder.append(value); + builder.append("]"); + return builder.toString(); + } +} -- cgit v1.2.3