/*
 * $Id$
 * $URL$
 */

package org.subethamail.web.action;

import lombok.Getter;
import lombok.Setter;

import org.hibernate.validator.constraints.Email;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.common.NotFoundException;
import org.subethamail.web.Backend;
import org.subethamail.web.action.auth.AuthRequired;
import org.subethamail.web.model.ErrorMapModel;

/**
 * Adds a site admin.
 *
 * @author Jon Stevens
 * @author Jeff Schnitzer
 */
public class AdminAdd extends AuthRequired
{
	/** */
	private final static Logger log = LoggerFactory.getLogger(AdminAdd.class);

	public class Model extends ErrorMapModel
	{
		@Getter @Setter
		@Email String email;
	}

	/** */
	@Override
	public void initialize()
	{
		this.getCtx().setModel(new Model());
	}

	/** */
	@Override
	public void authExecute() throws Exception
	{
		Model model = (Model)this.getCtx().getModel();

		if (log.isDebugEnabled())
			log.debug("Adding site admin: " + model.email);

		model.validate();

		if (model.getErrors().isEmpty())
		{
			try
			{
				Backend.instance().getAdmin().setSiteAdminByEmail(model.email, true);
			}
			catch (NotFoundException nfe)
			{
				model.setError("email", "Could not find email address.");
			}
		}
	}
}

@@ -58,24 +58,59 @@
 .action;%0D%0A%0D%0A
+import java.util.logging.Level;%0D%0A%0D%0A
 import lombo
@@ -142,16 +142,48 @@
 Setter;%0D
+%0Aimport lombok.extern.java.Log;%0D
 %0A%0D%0Aimpor
@@ -232,67 +232,8 @@
 l;%0D%0A
-import org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A
 impo
@@ -508,16 +508,22 @@
 r%0D%0A */%0D%0A
+@Log%0D%0A
 public c
@@ -565,96 +565,8 @@
 %0A%7B%0D%0A
-%09/** */%0D%0A%09private final static Logger log = LoggerFactory.getLogger(AdminAdd.class);%0D%0A%0D%0A
 %09pub
@@ -893,38 +893,56 @@
 g.is
-DebugEnabled())%0D%0A%09%09%09log.debug(
+Loggable(Level.FINE))%0D%0A%09%09    log.log(Level.FINE,
 %22Add
@@ -961,11 +961,13 @@
 in: 
-%22 +
+%7B0%7D%22,
  mod

switch logging framework