Group.java
Upload User: gdxydsw
Upload Date: 2019-01-29
Package Size: 16721k
Code Size: 4k
Category:

Java Develop

Development Platform:

Java

  1. /*
  2.  * Copyright (c) JForum Team
  3.  * All rights reserved.
  4.  * Redistribution and use in source and binary forms, 
  5.  * with or without modification, are permitted provided 
  6.  * that the following conditions are met:
  7.  * 1) Redistributions of source code must retain the above 
  8.  * copyright notice, this list of conditions and the 
  9.  * following  disclaimer.
  10.  * 2)  Redistributions in binary form must reproduce the 
  11.  * above copyright notice, this list of conditions and 
  12.  * the following disclaimer in the documentation and/or 
  13.  * other materials provided with the distribution.
  14.  * 3) Neither the name of "Rafael Steil" nor 
  15.  * the names of its contributors may be used to endorse 
  16.  * or promote products derived from this software without 
  17.  * specific prior written permission.
  18.  * 
  19.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 
  20.  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
  21.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
  22.  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  23.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  24.  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
  25.  * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
  26.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
  27.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
  28.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
  29.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
  30.  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
  31.  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
  32.  * IN CONTRACT, STRICT LIABILITY, OR TORT 
  33.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
  34.  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  35.  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  36.  * 
  37.  * This file creating date: Feb 17, 2003 / 8:50:57 PM
  38.  * net.jforum.entities.Group.java
  39.  * The JForum Project
  40.  * http://www.jforum.net
  41.  * 
  42.  * $Id: Group.java,v 1.5 2006/08/23 02:13:46 rafaelsteil Exp $
  43.  */
  44. package net.jforum.entities;
  45. /**
  46.  * Represents a group in the system. 
  47.  * 
  48.  * @author Rafael Steil
  49.  */
  50. public class Group 
  51. {
  52. private int id;
  53. private int parentId;
  54. private String name;
  55. private String description;
  56. /**
  57.  * Default constructor  
  58.  * **/
  59. public Group() {}
  60. /**
  61.  * Create a new <code>Group</code> object.
  62.  *  
  63.  * @param id The Group ID
  64.  * @param parentId The parent ID for the group
  65.  * @param name The Group Name
  66.  * @param description The Group Description
  67.    **/
  68. public Group(int id, int parentId, String name, String description) 
  69. {
  70. setName(name);
  71. setId(id);
  72. setParentId(parentId);
  73. setDescription(description);
  74. }
  75. /**
  76.  * @return String
  77.  */
  78. public String getDescription() {
  79. return this.description;
  80. }
  81. /**
  82.  * @return int
  83.  */
  84. public int getId() {
  85. return this.id;
  86. }
  87. /**
  88.  * @return int
  89.  */
  90. public int getParentId() {
  91. return this.parentId;
  92. }
  93. /**
  94.  * @return String
  95.  */
  96. public String getName() {
  97. return this.name;
  98. }
  99. /**
  100.  * Sets the description.
  101.  * @param description The description to set
  102.  */
  103. public void setDescription(String description) {
  104. this.description = description;
  105. }
  106. /**
  107.  * Sets the id.
  108.  * @param id The id to set
  109.  */
  110. public void setId(int id) {
  111. this.id = id;
  112. }
  113. /**
  114.  * Sets the parent id.
  115.  * @param id The parent id to set
  116.  */
  117. public void setParentId(int parentId) {
  118. this.parentId = parentId;
  119. }
  120. /**
  121.  * Sets the name.
  122.  * @param name The name to set
  123.  */
  124. public void setName(String name) {
  125. this.name = name;
  126. }
  127. /* 
  128.  * @see java.lang.Object#equals(java.lang.Object)
  129.  */
  130. public boolean equals(Object o) 
  131. {
  132. if (!(o instanceof Group)) {
  133. return false;
  134. }
  135. return (((Group)o).getId() == this.id);
  136. }
  137. /* 
  138.  * @see java.lang.Object#hashCode()
  139.  */
  140. public int hashCode() 
  141. {
  142. return this.id;
  143. }
  144. /* 
  145.  * @see java.lang.Object#toString()
  146.  */
  147. public String toString() 
  148. {
  149. return this.name +" - "+ this.id;
  150. }
  151. }