/*
* Copyright 2012 XueSong Guo.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package wbbs.web;
import cn.webwheel.Action;
import cn.webwheel.results.ErrorResult;
import cn.webwheel.results.TemplateResult;
import com.google.inject.Inject;
import wbbs.domain.Board;
import wbbs.domain.Topic;
import wbbs.service.BoardService;
import wbbs.service.PaginatedList;
import wbbs.service.TopicService;
import java.sql.SQLException;
public class board extends BaseAction {
public int id;
public int pg;
@Inject
BoardService boardService;
@Inject
TopicService topicService;
Board board;
PaginatedList<Topic> topics;
@Action
public Object html() throws SQLException {
board = boardService.findBoard(id);
if (board == null) {
return new ErrorResult(404);
}
topics = topicService.listBoardTopic(id, pg, 30);
return new TemplateResult(this);
}
public Board getBoard() {
return board;
}
public PaginatedList<Topic> getTopics() {
return topics;
}
}