package tryslim3.controller.crud2;

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

import tryslim3.meta.Crud2Meta;
import tryslim3.model.Crud2;
import tryslim3.service.Crud2Service;

public class EditController extends Controller {

    private Crud2Service service = new Crud2Service();

    private Crud2Meta meta = Crud2Meta.get();

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