diff options
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java')
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java new file mode 100644 index 000000000..51f7e4da6 --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/ConfigPropertyByteValues.java @@ -0,0 +1,73 @@ +package at.gv.egovernment.moa.id.commons.db.dao.config; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Lob; +import javax.persistence.Table; + +import at.gv.egovernment.moa.logging.Logger; + + +/** + * Reflects a MOAID configuration entry with String values. + * + */ +@Table(name = "configpropertybytes") +@Entity +public class ConfigPropertyByteValues extends AbstractConfigProperty{ + + + + /** + * + */ + private static final long serialVersionUID = 1L; + + + @Lob + @Column(name = "propertyValueBytes") + private byte[] value = null; + + + /** + * Returns the property's value (which might be {@code null}). + * @return The property's value (might be {@code null}). + */ + @Override + public String getValue() { + try { + if (value != null) + return new String(value, "UTF-8"); + + } catch (UnsupportedEncodingException e) { + Logger.error("Internal DB read error! Can not read values from configuration DB.", e); + + } + + return null; + + } + + /** + * Sets the property's value. + * @param value The value + */ + @Override + public void setValue(String value) { + try { + this.value = value.getBytes("UTF-8"); + + } catch (UnsupportedEncodingException e) { + Logger.error("Internal DB write error! Can not read write to configuration DB.", e); + + } + } + + @Override + protected String getImpplementationName() { + return this.getClass().getName(); + } +} |