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

package org.subethamail.web.action;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.common.SearchException;
import org.subethamail.core.lists.i.SearchHit;
import org.subethamail.core.lists.i.SearchResult;
import org.subethamail.web.Backend;
import org.subethamail.web.action.auth.AuthAction;
import org.subethamail.web.model.PaginateModel;

/**
 * Gets one page of search results for an archive.  Note that the
 * mail summaries will not have replies.
 * 
 * @author Jeff Schnitzer
 */
public class SearchArchive extends AuthAction 
{
	/** */
	@SuppressWarnings("unused")
	private final static Logger log = LoggerFactory.getLogger(SearchArchive.class);

	public static class Model extends PaginateModel
	{
		public Model()
		{
			this.setCount(100);	// default to 100
		}
		
		/** */
		@Getter @Setter Long listId;
		@Getter @Setter String query;
		@Getter @Setter List<SearchHit> hits;

		@Getter @Setter String error;
	}

	public void initialize()
	{
		this.getCtx().setModel(new Model());
	}

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

		try
		{
			SearchResult result = Backend.instance().getArchiver().search(model.listId, model.query, model.getSkip(), model.getCount());
			
			model.hits = result.getHits();
			model.setTotalCount(result.getTotal());
		}
		catch (SearchException se)
		{
			model.error = se.getMessage();
		}
	}
}

@@ -138,67 +138,40 @@
 r;%0D%0A
-%0D%0A
 import 
-org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;
+lombok.extern.java.Log;%0D%0A
 %0D%0Aim
@@ -606,16 +606,22 @@
 r%0D%0A */%0D%0A
+@Log%0D%0A
 public c
@@ -667,131 +667,8 @@
 %0A%7B%0D%0A
-%09/** */%0D%0A%09@SuppressWarnings(%22unused%22)%0D%0A%09private final static Logger log = LoggerFactory.getLogger(SearchArchive.class);%0D%0A%0D%0A
 %09pub

switch logging framework