package tryslim3.controller.slim3demo_crud;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.util.BeanUtil;

import tryslim3.meta.BlogMeta;
import tryslim3.model.Blog;
import tryslim3.service.BlogService;

public class EditController extends Controller {

    private BlogService service = new BlogService();

    private BlogMeta meta = BlogMeta.get();

    @Override
    public Navigation run() throws Exception {
        Blog blog = service.get(asKey(meta.key), asLong(meta.version));
        BeanUtil.copy(blog, request);
        return forward("/slim3demo_crud/edit.jsp");
    }
}