KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > db > GroupPermissionBean


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/GroupPermissionBean.java,v 1.6 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.6 $
5  * $Date: 2006/04/14 17:05:26 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Minh Nguyen
39  * @author: Mai Nguyen
40  */

41 package com.mvnforum.db;
42
43 import java.util.Collection JavaDoc;
44 import java.util.Iterator JavaDoc;
45
46 /*
47  * Included columns: GroupID, Permission
48  * Excluded columns:
49  */

50 public class GroupPermissionBean {
51     private int groupID;
52     private int permission;
53
54     public int getGroupID() {
55         return groupID;
56     }
57     public void setGroupID(int groupID) {
58         this.groupID = groupID;
59     }
60
61     public int getPermission() {
62         return permission;
63     }
64     public void setPermission(int permission) {
65         this.permission = permission;
66     }
67
68     public String JavaDoc getXML() {
69         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
70         xml.append("<GroupPermissionSection>\n");
71         xml.append(" <Rows>\n");
72         xml.append(" <Row>\n");
73         xml.append(" <Column>\n");
74         xml.append(" <Name>GroupID</Name>\n");
75         xml.append(" <Value>").append(String.valueOf(groupID)).append("</Value>\n");
76         xml.append(" </Column>\n");
77         xml.append(" <Column>\n");
78         xml.append(" <Name>Permission</Name>\n");
79         xml.append(" <Value>").append(String.valueOf(permission)).append("</Value>\n");
80         xml.append(" </Column>\n");
81         xml.append(" </Row>\n");
82         xml.append(" </Rows>\n");
83         xml.append("</GroupPermissionSection>\n");
84         return xml.toString();
85     }
86
87     public static String JavaDoc getXML(Collection JavaDoc objGroupPermissionBeans) {
88         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
89         Iterator JavaDoc iterator = objGroupPermissionBeans.iterator();
90         xml.append("<GroupPermissionSection>\n");
91         xml.append(" <Rows>\n");
92         while (iterator.hasNext()) {
93             GroupPermissionBean objGroupPermissionBean = (GroupPermissionBean)iterator.next();
94             xml.append(" <Row>\n");
95             xml.append(" <Column>\n");
96             xml.append(" <Name>GroupID</Name>\n");
97             xml.append(" <Value>").append(String.valueOf(objGroupPermissionBean.groupID)).append("</Value>\n");
98             xml.append(" </Column>\n");
99             xml.append(" <Column>\n");
100             xml.append(" <Name>Permission</Name>\n");
101             xml.append(" <Value>").append(String.valueOf(objGroupPermissionBean.permission)).append("</Value>\n");
102             xml.append(" </Column>\n");
103             xml.append(" </Row>\n");
104         }//while
105
xml.append(" </Rows>\n");
106         xml.append("</GroupPermissionSection>\n");
107         return xml.toString();
108     }
109 } //end of class GroupPermissionBean
110
Popular Tags