/*
 * $Id: FilterArgument.java 991 2009-01-15 02:46:02Z lhoriman $
 * $URL: http://subetha.tigris.org/svn/subetha/branches/resin/core/src/org/subethamail/entity/FilterArgument.java $
 */

package org.subethamail.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
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;

// In JBoss4, the copy of this in Config was sufficient to register
// the type.  In JBoss5, either the order of loading changed or the
// type must be registered in every class.
@org.hibernate.annotations.TypeDefs({
	@org.hibernate.annotations.TypeDef(
		name="anyImmutable",
		typeClass=org.subethamail.entity.type.AnyImmutableType.class
	)
})

/**
 * One parameter key and argument value for an enabled filter.
 *
 * @author Jeff Schnitzer
 */
@Entity
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
public class FilterArgument implements Serializable, Comparable<FilterArgument>
{
	private static final long serialVersionUID = 1L;

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

	/** */
	@Id
	@GeneratedValue
	Long id;

	/** */
	@ManyToOne
	@JoinColumn(name="filterId", nullable=false)
	EnabledFilter filter;

	/** */
	@Column(nullable=false, length=Validator.MAX_FILTER_ARGUMENT_NAME)
	String name;

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

	/**
	 */
	public FilterArgument() {}

	/**
	 */
	public FilterArgument(EnabledFilter filter, String name, Object value)
	{
		if (log.isDebugEnabled())
			log.debug("Creating new FilterArgument");

		this.filter = filter;
		this.name = name;
		this.value = value;
	}

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

	/** */
	public EnabledFilter getFilter()		{ return this.filter; }

	/**
	 */
	public String getName() { return this.name; }

	/**
	 * @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 + ", name=" + this.name + "}";
	}

	/**
	 * Natural sort order is based on name
	 */
	public int compareTo(FilterArgument other)
	{
		return this.name.compareTo(other.getName());
	}
}


@@ -250,16 +250,49 @@
 izable;%0D
+%0Aimport java.util.logging.Level;%0D
 %0A%0D%0Aimpor
@@ -505,42 +505,39 @@
 e;%0D%0A
+%0D%0A
 import 
-javax.persistence.Transient
+lombok.extern.java.Log
 ;%0D%0A%0D
@@ -725,67 +725,8 @@
 e;%0D%0A
-import org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A
 impo
@@ -1292,16 +1292,22 @@
 IONAL)%0D%0A
+@Log%0D%0A
 public c
@@ -1439,113 +1439,8 @@
 %0D%0A%0D%0A
-%09/** */%0D%0A%09@Transient private final static Logger log = LoggerFactory.getLogger(FilterArgument.class);%0D%0A%0D%0A
 %09/**
@@ -1984,49 +1984,31 @@
 %7B%0D%0A%09
-%09if (log.isDebugEnabled())%0D%0A%09%09%09log.debug(
+    log.log(Level.FINE,
 %22Cre

switch logging framework