package at.gv.egovernment.moa.id.commons.db.dao.config; import java.io.UnsupportedEncodingException; import javax.persistence.Column; import javax.persistence.Entity; 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; @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 { if (value == null) this.value = null; else this.value = value.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { Logger.error("Internal DB write error! Can not read write to configuration DB.", e); } } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.commons.db.dao.config.AbstractConfigProperty#getImplementationClass() */ @Override protected Class getImplementationClass() { return this.getClass(); } }