001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/GroupsBean.java,v 1.11 2007/10/09 11:09:18 lexuanttkhtn Exp $
003: * $Author: lexuanttkhtn $
004: * $Revision: 1.11 $
005: * $Date: 2007/10/09 11:09:18 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding mvnForum MUST remain
012: * intact in the scripts and in the outputted HTML.
013: * The "powered by" text/logo with a link back to
014: * http://www.mvnForum.com and http://www.MyVietnam.net in
015: * the footer of the pages MUST remain visible when the pages
016: * are viewed on the internet or intranet.
017: *
018: * This program is free software; you can redistribute it and/or modify
019: * it under the terms of the GNU General Public License as published by
020: * the Free Software Foundation; either version 2 of the License, or
021: * any later version.
022: *
023: * This program is distributed in the hope that it will be useful,
024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
026: * GNU General Public License for more details.
027: *
028: * You should have received a copy of the GNU General Public License
029: * along with this program; if not, write to the Free Software
030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
031: *
032: * Support can be obtained from support forums at:
033: * http://www.mvnForum.com/mvnforum/index
034: *
035: * Correspondence and Marketing Questions can be sent to:
036: * info at MyVietnam net
037: *
038: * @author: Minh Nguyen
039: * @author: Mai Nguyen
040: */
041: package com.mvnforum.db;
042:
043: import java.sql.Timestamp;
044: import java.util.Collection;
045: import java.util.Iterator;
046:
047: import net.myvietnam.mvncore.exception.ObjectNotFoundException;
048: import net.myvietnam.mvncore.util.StringUtil;
049:
050: /*
051: * Included columns: GroupID, GroupOwnerID, GroupOwnerName, GroupName, GroupDesc,
052: * GroupOption, GroupCreationDate, GroupModifiedDate
053: * Excluded columns:
054: */
055: public class GroupsBean {
056:
057: private int groupID;
058: private int groupOwnerID;
059: private String groupOwnerName;
060: private String groupName;
061: private String groupDesc;
062: private int groupOption;
063: private Timestamp groupCreationDate;
064: private Timestamp groupModifiedDate;
065:
066: public int getGroupID() {
067: return groupID;
068: }
069:
070: public void setGroupID(int groupID) {
071: this .groupID = groupID;
072: }
073:
074: public int getGroupOwnerID() {
075: return groupOwnerID;
076: }
077:
078: public void setGroupOwnerID(int groupOwnerID) {
079: this .groupOwnerID = groupOwnerID;
080: }
081:
082: public String getGroupOwnerName() {
083: return groupOwnerName;
084: }
085:
086: public void setGroupOwnerName(String groupOwnerName) {
087: this .groupOwnerName = StringUtil
088: .getEmptyStringIfNull(groupOwnerName);
089: }
090:
091: public String getGroupName() {
092: return groupName;
093: }
094:
095: public void setGroupName(String groupName) {
096: this .groupName = groupName;
097: }
098:
099: public String getGroupDesc() {
100: return groupDesc;
101: }
102:
103: public void setGroupDesc(String groupDesc) {
104: this .groupDesc = StringUtil.getEmptyStringIfNull(groupDesc);
105: }
106:
107: public int getGroupOption() {
108: return groupOption;
109: }
110:
111: public void setGroupOption(int groupOption) {
112: this .groupOption = groupOption;
113: }
114:
115: public Timestamp getGroupCreationDate() {
116: return groupCreationDate;
117: }
118:
119: public void setGroupCreationDate(Timestamp groupCreationDate) {
120: this .groupCreationDate = groupCreationDate;
121: }
122:
123: public Timestamp getGroupModifiedDate() {
124: return groupModifiedDate;
125: }
126:
127: public void setGroupModifiedDate(Timestamp groupModifiedDate) {
128: this .groupModifiedDate = groupModifiedDate;
129: }
130:
131: /************************************************
132: * Customized methods come below
133: ************************************************/
134: private int groupMemberCount;
135:
136: public int getGroupMemberCount() {
137: return groupMemberCount;
138: }
139:
140: public void setGroupMemberCount(int groupMemberCount) {
141: this .groupMemberCount = groupMemberCount;
142: }
143:
144: public static GroupsBean getGroupsBean(Collection objGroupsBeans,
145: int groupID) throws ObjectNotFoundException {
146: Iterator iterator = objGroupsBeans.iterator();
147: while (iterator.hasNext()) {
148: GroupsBean objGroupsBean = (GroupsBean) iterator.next();
149: if (objGroupsBean.getGroupID() == groupID) {
150: return objGroupsBean;
151: }
152: }//while
153: //@todo : localize me
154: throw new ObjectNotFoundException(
155: "Cannot find GroupsBean with GroupID = " + groupID);
156: }
157:
158: } //end of class GroupsBean
|