Package org.mapache.business.topic

Examples of org.mapache.business.topic.Topic


    public Object getAsObject(FacesContext facesContext,
                              UIComponent uiComponent,
                              String string) throws ConverterException {
        if(string.equals("-1")){
            Topic t = new Topic();
            t.setTopicID(-1);
            return t;
        }
        try {
            return new BusinessController().loadTopicByTopicID(Integer.parseInt(string));
        } catch (MapacheException e) {
View Full Code Here


        }
        return "deleteClicked";
    }

    public String createTopic() {
        Topic newTopic = new Topic();
        newTopic.setTitle(_title);
        newTopic.setContent(_content);
        newTopic.setVisible(_visible);
        newTopic.setPublishDate(_publishDate);
        newTopic.setCategories(_categories);
        try {
            getBusinessController().createTopic(newTopic,_blog.getBlogID());
            FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_INFO,MapacheUIUtils.getTranslation("info_topic_created",null),MapacheUIUtils.getTranslation("info_topic_created",null)));
            _createMode = false;
        } catch (MapacheException e) {
View Full Code Here

    public List<SelectItem> getTopicSelectItems(){
        List<SelectItem> topicSelectItems = new ArrayList<SelectItem>();
        List<Topic> topics;
        Blog b = new Blog();
        b.setBlogID(-1);
        Topic tr = new Topic();
        tr.setTopicID(-1);
        tr.setTitle(MapacheUIUtils.getTranslation("pleaseSelect",null));
        topicSelectItems.add(0,new SelectItem(tr, tr.getTitle(), String.valueOf(tr.getTopicID())));
        if(_topic==null){
            _topic = tr;
        }
        try{
            topics = getBusinessController().loadTopicsOfBlog(b);
            for(Iterator it = topics.iterator();it.hasNext();){
                Topic t = (Topic)it.next();
                topicSelectItems.add(new SelectItem(t,t.getTitle(),String.valueOf(t.getTopicID())));
            }
        }
        catch(MapacheException e){
            e.printStackTrace();   
        }
View Full Code Here

        return _topic;
    }

    public void validateTopic(FacesContext facesContext,
                              UIComponent uiComponent, Object object) {
         Topic t =(Topic)object;
         if(t.getTopicID()==-1){
             throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,MapacheUIUtils.getTranslation("error_please_select_topic",null),MapacheUIUtils.getTranslation("error_please_select_topic",null)),null);
         }
    }
View Full Code Here

            topics.add(fetchRecordInTopicObject(resultSet));
        }
    }
    private Topic fetchRecordInTopicObject(ResultSet record) throws SQLException,
                                                                    MapacheException {
        Topic topic = new Topic();
        topic.setTopicID(record.getInt("TopicID"));
        topic.setTitle(record.getString("Title"));
        topic.setContent(record.getString("Content"));
        topic.setCreationDate(MySQLDataUtils.stringToDate(record.getString("CreationDate")));
        topic.setVisible(record.getBoolean("Visible"));
        topic.setPublishDate(MySQLDataUtils.stringToDate(record.getString("PublishDate")));
        topic.setReplyCount(record.getInt("ReplyCount"));
        topic.setCategories(MySQLDAOFactory.getInstance().getCategoryDAO().loadCategoriesForTopic(topic.getTopicID()));
        return topic;
    }
View Full Code Here

            MySQLDAOFactory.freeConnection(_oConn);
        }
    }
   
    public Topic loadTopicByTopicID(int topicID) throws MapacheException {
        Topic topic = null;
        try {
            _oConn = MySQLDAOFactory.createConnection();
            _loadTopicByTopicIDStmt = _oConn.prepareStatement("SELECT T.TopicID as TopicID ,Title,T.Content as Content,T.CreationDate as CreationDate,Visible,PublishDate, count(C.TopicID) as ReplyCount FROM Topic T LEFT JOIN Comment C ON C.TopicID=T.TopicID WHERE T.TopicID = ? GROUP BY T.TopicID ORDER BY CreationDate DESC, PublishDate DESC");
            _loadTopicByTopicIDStmt.setInt(1,topicID);
            ResultSet resultSet = _loadTopicByTopicIDStmt.executeQuery();
View Full Code Here

        }
        return topics;
    }
   
     public Topic loadTopicByTitle_visitor(String topicTitle) throws MapacheException {
         Topic topic = null;
         try {
             _oConn = MySQLDAOFactory.createConnection();
             _loadTopicByTopicIDStmt = _oConn.prepareStatement("SELECT T.TopicID as TopicID ,Title,T.Content as Content,T.CreationDate as CreationDate,Visible,PublishDate, count(C.TopicID) as ReplyCount FROM Topic T LEFT JOIN Comment C ON C.TopicID=T.TopicID WHERE T.Title = ? GROUP BY T.TopicID ORDER BY CreationDate DESC, PublishDate DESC");
             _loadTopicByTopicIDStmt.setString(1,topicTitle);
             ResultSet resultSet = _loadTopicByTopicIDStmt.executeQuery();
View Full Code Here

TOP

Related Classes of org.mapache.business.topic.Topic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.