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/AttachmentBean.java,v 1.4 2005/01/18 11:52:17 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.4 $
 * $Date: 2005/01/18 11:52:17 $
 *
 * ====================================================================
 *
 * 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;

import net.myvietnam.mvncore.util.StringUtil;

/*
 * Included columns: AttachID, PostID, MemberID, AttachFilename, AttachFileSize,
 *                   AttachMimeType, AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate,
 *                   AttachDownloadCount, AttachOption, AttachStatus
 * Excluded columns:
 */
public class AttachmentBean {
    private int attachID;
    private int postID;
    private int memberID;
    private String attachFilename;
    private int attachFileSize;
    private String attachMimeType;
    private String attachDesc;
    private String attachCreationIP;
    private Timestamp attachCreationDate;
    private Timestamp attachModifiedDate;
    private int attachDownloadCount;
    private int attachOption;
    private int attachStatus;

    public int getAttachID() {
        return attachID;
    }
    public void setAttachID(int attachID) {
        this.attachID = attachID;
    }

    public int getPostID() {
        return postID;
    }
    public void setPostID(int postID) {
        this.postID = postID;
    }

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

    public String getAttachFilename() {
        return attachFilename;
    }
    public void setAttachFilename(String attachFilename) {
        this.attachFilename = StringUtil.getEmptyStringIfNull(attachFilename);
    }

    public int getAttachFileSize() {
        return attachFileSize;
    }
    public void setAttachFileSize(int attachFileSize) {
        this.attachFileSize = attachFileSize;
    }

    public String getAttachMimeType() {
        return attachMimeType;
    }
    public void setAttachMimeType(String attachMimeType) {
        this.attachMimeType = StringUtil.getEmptyStringIfNull(attachMimeType);
    }

    public String getAttachDesc() {
        return attachDesc;
    }
    public void setAttachDesc(String attachDesc) {
        this.attachDesc = StringUtil.getEmptyStringIfNull(attachDesc);
    }

    public String getAttachCreationIP() {
        return attachCreationIP;
    }
    public void setAttachCreationIP(String attachCreationIP) {
        this.attachCreationIP = StringUtil.getEmptyStringIfNull(attachCreationIP);
    }

    public Timestamp getAttachCreationDate() {
        return attachCreationDate;
    }
    public void setAttachCreationDate(Timestamp attachCreationDate) {
        this.attachCreationDate = attachCreationDate;
    }

    public Timestamp getAttachModifiedDate() {
        return attachModifiedDate;
    }
    public void setAttachModifiedDate(Timestamp attachModifiedDate) {
        this.attachModifiedDate = attachModifiedDate;
    }

    public int getAttachDownloadCount() {
        return attachDownloadCount;
    }
    public void setAttachDownloadCount(int attachDownloadCount) {
        this.attachDownloadCount = attachDownloadCount;
    }

    public int getAttachOption() {
        return attachOption;
    }
    public void setAttachOption(int attachOption) {
        this.attachOption = attachOption;
    }

    public int getAttachStatus() {
        return attachStatus;
    }
    public void setAttachStatus(int attachStatus) {
        this.attachStatus = attachStatus;
    }

    public String getXML() {
        StringBuffer xml = new StringBuffer(1024);
        xml.append("<AttachmentSection>\n");
        xml.append("  <Rows>\n");
        xml.append("    <Row>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachID\n");
        xml.append("        <Value>").append(String.valueOf(attachID)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>PostID\n");
        xml.append("        <Value>").append(String.valueOf(postID)).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>AttachFilename\n");
        xml.append("        <Value>").append(String.valueOf(attachFilename)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachFileSize\n");
        xml.append("        <Value>").append(String.valueOf(attachFileSize)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachMimeType\n");
        xml.append("        <Value>").append(String.valueOf(attachMimeType)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachDesc\n");
        xml.append("        <Value>").append(String.valueOf(attachDesc)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachCreationIP\n");
        xml.append("        <Value>").append(String.valueOf(attachCreationIP)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachCreationDate\n");
        xml.append("        <Value>").append(String.valueOf(attachCreationDate)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachModifiedDate\n");
        xml.append("        <Value>").append(String.valueOf(attachModifiedDate)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachDownloadCount\n");
        xml.append("        <Value>").append(String.valueOf(attachDownloadCount)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachOption\n");
        xml.append("        <Value>").append(String.valueOf(attachOption)).append("\n");
        xml.append("      </Column>\n");
        xml.append("      <Column>\n");
        xml.append("        <Name>AttachStatus\n");
        xml.append("        <Value>").append(String.valueOf(attachStatus)).append("\n");
        xml.append("      </Column>\n");
        xml.append("    </Row>\n");
        xml.append("  </Rows>\n");
        xml.append("</AttachmentSection>\n");
        return xml.toString();
    }

    public static String getXML(Collection objAttachmentBeans) {
        StringBuffer xml = new StringBuffer(1024);
        Iterator iterator = objAttachmentBeans.iterator();
        xml.append("<AttachmentSection>\n");
        xml.append("  <Rows>\n");
        while (iterator.hasNext()) {
            AttachmentBean objAttachmentBean = (AttachmentBean)iterator.next();
            xml.append("    <Row>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachID\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>PostID\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.postID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>MemberID\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.memberID)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachFilename\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachFilename)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachFileSize\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachFileSize)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachMimeType\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachMimeType)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachDesc\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachDesc)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachCreationIP\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachCreationIP)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachCreationDate\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachCreationDate)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachModifiedDate\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachModifiedDate)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachDownloadCount\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachDownloadCount)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachOption\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachOption)).append("\n");
            xml.append("      </Column>\n");
            xml.append("      <Column>\n");
            xml.append("        <Name>AttachStatus\n");
            xml.append("        <Value>").append(String.valueOf(objAttachmentBean.attachStatus)).append("\n");
            xml.append("      </Column>\n");
            xml.append("    </Row>\n");
        }//while
        xml.append("  </Rows>\n");
        xml.append("</AttachmentSection>\n");
        return xml.toString();
    }
} //end of class AttachmentBean
... 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.