/*
 * $Id: Config.java 988 2008-12-30 08:51:13Z lhoriman $
 * $URL: http://subetha.tigris.org/svn/subetha/branches/resin/core/src/org/subethamail/entity/Config.java $
 */

package org.subethamail.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.entity.i.Validator;

// Moved this here from package-info.java to fix JDK5/6 incompatibility problem
// For some reason package-info.java built with JDK6 doesn't work on JDK5
@org.hibernate.annotations.TypeDefs({
	@org.hibernate.annotations.TypeDef(
		name="anyImmutable",
		typeClass=org.subethamail.entity.type.AnyImmutableType.class
	)
})

/**
 * Contains config parameter, key and value.
 *
 * @author Jeff Schnitzer
 */
@Entity
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
public class Config implements Serializable, Comparable<Config>
{
	private static final long serialVersionUID = 1L;

	/** */
	@Transient private final static Logger log = LoggerFactory.getLogger(Config.class);

	/** */
	@Id
	@Column(length=Validator.MAX_CONFIG_ID)
	String id;

	/** */
	@Type(type="anyImmutable")
	@Columns(columns={
		@Column(name="type"),
		@Column(name="value", length=Validator.MAX_CONFIG_VALUE)
	})
	Object value;

	/**
	 */
	public Config() {}

	/**
	 */
	public Config(String id, Object value)
	{
		if (log.isDebugEnabled())
			log.debug("Creating new Config: " + id);

		this.id = id;
		this.value = value;
	}

	/** */
	public String getId()		{ return this.id; }

	/**
	 * @return the value object in its native type
	 */
	public Object getValue() { return this.value; }

	public void setValue(Object val)
	{
		this.value = val;
	}

	/** */
	@Override
	public String toString()
	{
		return this.getClass() + " {id=" + this.id + "}";
	}

	/**
	 * Natural sort order is based on id
	 */
	public int compareTo(Config other)
	{
		return this.id.compareTo(other.getId());
	}
}


@@ -234,16 +234,49 @@
 izable;%0D
+%0Aimport java.util.logging.Level;%0D
 %0A%0D%0Aimpor
@@ -372,42 +372,39 @@
 d;%0D%0A
+%0D%0A
 import 
-javax.persistence.Transient
+lombok.extern.java.Log
 ;%0D%0A%0D
@@ -592,67 +592,8 @@
 e;%0D%0A
-import org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A
 impo
@@ -1115,16 +1115,22 @@
 IONAL)%0D%0A
+@Log%0D%0A
 public c
@@ -1246,105 +1246,8 @@
 %0D%0A%0D%0A
-%09/** */%0D%0A%09@Transient private final static Logger log = LoggerFactory.getLogger(Config.class);%0D%0A%0D%0A
 %09/**
@@ -1578,49 +1578,31 @@
 %7B%0D%0A%09
-%09if (log.isDebugEnabled())%0D%0A%09%09%09log.debug(
+    log.log(Level.FINE,
 %22Cre
@@ -1619,19 +1619,21 @@
 Config: 
-%22 +
+%7B0%7D%22,
  id);%0D%0A%0D

switch logging framework