alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/WatchBean.java,v 1.6 2005/01/18 11:52:19 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.6 $
 * $Date: 2005/01/18 11:52:19 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2005 by MyVietnam.net
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * All copyright notices regarding mvnForum MUST remain intact
 * in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in the
 * footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info@MyVietnam.net
 *
 * @author: Minh Nguyen  minhnn@MyVietnam.net
 * @author: Mai  Nguyen  mai.nh@MyVietnam.net
 */
package com.mvnforum.db;

import java.sql.Timestamp;
import java.util.Collection;
import java.util.Iterator;

/*
 * Included columns: WatchID, MemberID, CategoryID, ForumID, ThreadID,
 *                   WatchType, WatchOption, WatchStatus, WatchCreationDate, WatchLastSentDate,
 *                   WatchEndDate
 * Excluded columns:
 */
public class WatchBean {
    /*************************************************************************
     * NOTE: below constants MUST NOT be changed IN ALL CASES,
     *       or it will break the compatibility
     *************************************************************************/
    public final static int WATCH_OPTION_DEFAULT= 0;
    public final static int WATCH_OPTION_LIVE   = 1;
    public final static int WATCH_OPTION_HOURLY = 2;
    public final static int WATCH_OPTION_DAILY  = 3;
    public final static int WATCH_OPTION_WEEKLY = 4;

    private int watchID;
    private int memberID;
    private int categoryID;
    private int forumID;
    private int threadID;
    private int watchType;
    private int watchOption;
    private int watchStatus;
    private Timestamp watchCreationDate;
    private Timestamp watchLastSentDate;
    private Timestamp watchEndDate;

    public int getWatchID() {
        return watchID;
    }
    public void setWatchID(int watchID) {
        this.watchID = watchID;
    }

    public int getMemberID() {
        return memberID;
    }
    public void setMemberID(int memberID) {
        this.memberID = memberID;
    }

    public int getCategoryID() {
        return categoryID;
    }
    public void setCategoryID(int categoryID) {
        this.categoryID = categoryID;
    }

    public int getForumID() {
        return forumID;
    }
    public void setForumID(int forumID) {
        this.forumID = forumID;
    }

    public int getThreadID() {
        return threadID;
    }
    public void setThreadID(int threadID) {
        this.threadID = threadID;
    }

    public int getWatchType() {
        return watchType;
    }
    public void setWatchType(int watchType) {
        this.watchType = watchType;
    }

    public int getWatchOption() {
        return watchOption;
    }
    public void setWatchOption(int watchOption) {
        this.watchOption = watchOption;
    }

    public int getWatchStatus() {
        return watchStatus;
    }
    public void setWatchStatus(int watchStatus) {
        this.watchStatus = watchStatus;
    }

    public Timestamp getWatchCreationDate() {
        return watchCreationDate;
    }
    public void setWatchCreationDate(Timestamp watchCreationDate) {
        this.watchCreationDate = watchCreationDate;
    }

    public Timestamp getWatchLastSentDate() {
        return watchLastSentDate;
    }
    public void setWatchLastSentDate(Timestamp watchLastSentDate) {
        this.watchLastSentDate = watchLastSentDate;
    }

    public Timestamp getWatchEndDate() {
        return watchEndDate;
    }
    public void setWatchEndDate(Timestamp watchEndDate) {
        this.watchEndDate = watchEndDate;
    }

    public String getXML() {
        StringBuffer xml = new StringBuffer(1024);
        xml.append("<WatchSection>\n");
        xml.append("  <Rows>\n");
        xml.append("    <Row>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchID\n");
        xml.append("        <Value>").append(String.valueOf(watchID)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>MemberID\n");
        xml.append("        <Value>").append(String.valueOf(memberID)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>CategoryID\n");
        xml.append("        <Value>").append(String.valueOf(categoryID)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>ForumID\n");
        xml.append("        <Value>").append(String.valueOf(forumID)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>ThreadID\n");
        xml.append("        <Value>").append(String.valueOf(threadID)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchType\n");
        xml.append("        <Value>").append(String.valueOf(watchType)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchOption\n");
        xml.append("        <Value>").append(String.valueOf(watchOption)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchStatus\n");
        xml.append("        <Value>").append(String.valueOf(watchStatus)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchCreationDate\n");
        xml.append("        <Value>").append(String.valueOf(watchCreationDate)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchLastSentDate\n");
        xml.append("        <Value>").append(String.valueOf(watchLastSentDate)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>WatchEndDate\n");
        xml.append("        <Value>").append(String.valueOf(watchEndDate)).append("\n");
        xml.append("      </Column>\n");
        xml.append("    </Row>\n");
        xml.append("  </Rows>\n");
        xml.append("</WatchSection>\n");
        return xml.toString();
    }

    public static String getXML(Collection objWatchBeans) {
        StringBuffer xml = new StringBuffer(1024);
        Iterator iterator = objWatchBeans.iterator();
        xml.append("<WatchSection>\n");
        xml.append("  <Rows>\n");
        while (iterator.hasNext()) {
            WatchBean objWatchBean = (WatchBean)iterator.next();
            xml.append("    <Row>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchID\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>MemberID\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.memberID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>CategoryID\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.categoryID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>ForumID\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.forumID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>ThreadID\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.threadID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchType\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchType)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchOption\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchOption)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchStatus\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchStatus)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchCreationDate\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchCreationDate)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchLastSentDate\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchLastSentDate)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>WatchEndDate\n");
            xml.append("        <Value>").append(String.valueOf(objWatchBean.watchEndDate)).append("\n");
            xml.append("      </Column>\n");
            xml.append("    </Row>\n");
        }//while
        xml.append("  </Rows>\n");
        xml.append("</WatchSection>\n");
        return xml.toString();
    }

    // Store the ThreadBean if this is a Thread Watch
    ThreadBean threadBean = null;

    public ThreadBean getThreadBean() {
        return threadBean;
    }
    public void setThreadBean(ThreadBean threadBean) {
        this.threadBean = threadBean;
    }

} //end of class WatchBean
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.