⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 news.java

📁 jsp+servlet实现的标准MVC系统 jsp-servlet-service-DAO-DBMS
💻 JAVA
字号:
/*
 * Created on 2005-12-2
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.mycompany.news.dto;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;

import com.mycompany.database.Database;
import com.mycompany.news.dao.NewsAttributeDAO;
import com.mycompany.news.dao.impl.NewsAttributeDAOImpl;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class News {
	private Long newsId;
	private Long columnId;
	private String subject;
	private Date createTime;
	private Date showTime;
	private String content;
	private String author;
	private Integer newsStatus;
	
	/**
	 * @return Returns the author.
	 */
	public String getAuthor() {
		return author;
	}
	/**
	 * @param author The author to set.
	 */
	public void setAuthor(String author) {
		this.author = author;
	}
	/**
	 * @return Returns the column_id.
	 */
	public Long getColumnId() {
		return columnId;
	}
	/**
	 * @param column_id The column_id to set.
	 */
	public void setColumnId(Long column_id) {
		this.columnId = column_id;
	}
	/**
	 * @return Returns the content.
	 */
	public String getContent() {
		return content;
	}
	/**
	 * @param content The content to set.
	 */
	public void setContent(String content) {
		this.content = content;
	}
	/**
	 * @return Returns the create_time.
	 */
	public Date getCreateTime() {
		return createTime;
	}
	/**
	 * @param create_time The create_time to set.
	 */
	public void setCreateTime(Date create_time) {
		this.createTime = create_time;
	}
	/**
	 * @return Returns the news_id.
	 */
	public Long getNewsId() {
		return newsId;
	}
	/**
	 * @param news_id The news_id to set.
	 */
	public void setNewsId(Long news_id) {
		this.newsId = news_id;
	}
	/**
	 * @return Returns the news_status.
	 */
	public Integer getNewsStatus() {
		return newsStatus;
	}
	/**
	 * @param news_status The news_status to set.
	 */
	public void setNewsStatus(Integer news_status) {
		this.newsStatus = news_status;
	}
	/**
	 * @return Returns the show_time.
	 */
	public Date getShowTime() {
		return showTime;
	}
	/**
	 * @param show_time The show_time to set.
	 */
	public void setShowTime(Date show_time) {
		this.showTime = show_time;
	}
	/**
	 * @return Returns the subject.
	 */
	public String getSubject() {
		return subject;
	}
	/**
	 * @param subject The subject to set.
	 */
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public boolean isRecommended(){
		NewsAttributeDAO dao = new NewsAttributeDAOImpl();
		Connection connection =null;
		
		try {
			connection =Database.getConnection();
			dao.setConnection(connection);
			String attributeValue = dao.getAttributeValue(this.getNewsId().longValue(),"is_recommend",0);
			if(attributeValue!=null&&attributeValue.equals("true"))
				return true;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			Database.releaseConnection(connection);
		}
		return false;
	}
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -