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

package org.subethamail.core.admin;

import java.net.URL;
import java.util.Collection;

import javax.annotation.security.RolesAllowed;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.mail.internet.InternetAddress;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.core.admin.i.Admin;
import org.subethamail.core.admin.i.BlueprintData;
import org.subethamail.core.admin.i.DuplicateListDataException;
import org.subethamail.core.admin.i.InvalidListDataException;
import org.subethamail.core.admin.i.ListWizard;
import org.subethamail.core.plugin.i.Blueprint;
import org.subethamail.core.util.Transmute;
import org.subethamail.entity.Person;

import com.caucho.remote.HessianService;

/**
 * Implementation of the ListWizard interface.
 *
 * @author Jeff Schnitzer
 * @author Scott Hernandez
 */
@ApplicationScoped
@RolesAllowed(Person.ROLE_ADMIN)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@HessianService(urlPattern="/api/ListWizard")
public class ListWizardBean implements ListWizard
{
	/** */
	private final static Logger log = LoggerFactory.getLogger(ListWizardBean.class);

	/** */
	@Inject Admin admin;
	@Inject @Any Instance<Blueprint> blueprints;

	/* */
	@Override
	public Collection<BlueprintData> getBlueprints()
	{
		return Transmute.blueprints(this.blueprints);
	}

	/* */
	@Override
	@SuppressWarnings("unchecked")
	public Long createMailingList(InternetAddress address, URL url, String description, InternetAddress[] initialOwners, String blueprintId) throws DuplicateListDataException, InvalidListDataException
	{
		log.debug("Creating ML from " + super.toString() + ", blueprints are: " + this.blueprints);
		
		Class<Blueprint> bpClass;
		try
		{
			bpClass = (Class<Blueprint>)Class.forName(blueprintId);
		}
		catch (ClassNotFoundException e)
		{
			throw new IllegalStateException("Blueprint does not exist: " + blueprintId);
		}
		
		Blueprint blue = this.blueprints.select(bpClass).get();

		Long listId = this.admin.createMailingList(address, url, description, initialOwners);

		blue.configureMailingList(listId);

		return listId;
	}
}
@@ -276,24 +276,57 @@
 Collection;%0D
+%0Aimport java.util.logging.Level;%0D
 %0A%0D%0Aimport ja
@@ -666,60 +666,35 @@
 ort 
-org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory
+lombok.extern.java.Log
 ;%0D%0A
+%0D%0A
 impo
@@ -1417,16 +1417,22 @@
 zard%22)%0D%0A
+@Log%0D%0A
 public c
@@ -1481,102 +1481,8 @@
 %0A%7B%0D%0A
-%09/** */%0D%0A%09private final static Logger log = LoggerFactory.getLogger(ListWizardBean.class);%0D%0A%0D%0A
 %09/**
@@ -1949,82 +1949,138 @@
 %7B%0D%0A%09
-%09log.debug(%22Creating ML from %22 + super.toString() + %22, blueprints are: %22 +
+    if (log.isLoggable(Level.FINE)) log.log(Level.FINE,%22Creating ML from %7B0%7D, blueprints are: %7B1%7D%22, new Object%5B%5D%7Bsuper.toString(),
  thi
@@ -2087,24 +2087,25 @@
 s.blueprints
+%7D
 );%0D%0A%09%09%0D%0A%09%09Cl

switch logging framework