package net.sourceforge.jsurveyor;
import java.util.*;

/**
 * Class to model UserGroups.
 * Used to represent a group of users and or usergroups that need to be handled as a larger identity in the system.
 * 
 * @version 1.0
 * @author Claus Methmann Christensen
 * @author Anders Spliid Hansen
 * @author Esben Iversen Hansen
 * @author Lars H Jensen
 * @author Marcus Overheu
 * @author Thomas Ramdal
 * @author Peter Thomsen
 */
public class UserGroup extends UserComponent {

	/**
	 * Field userGroupID
	 */
	private int userGroupID;
	/**
	 * Field groupName
	 */
	private String groupName; // NOT NULL

	/**
	 * Constructor for UserGroup, use through DataAccess.
	 * @param userGroupID int
	 * @param groupName String
	 * @param refChildren ArrayList
	 * @param refParents ArrayList
	 */
	public UserGroup(
		int userGroupID,
		String groupName,
		ArrayList refChildren,
		ArrayList refParents) {
		super(refChildren, refParents);
		this.userGroupID = userGroupID;
		this.groupName = groupName;
	}

	/**
	 * Constructor for UserGroup
	 * @param groupName String
	 * @param refChildren ArrayList
	 * @param refParents ArrayList
	 */
	public UserGroup(
		String groupName,
		ArrayList refChildren,
		ArrayList refParents) {
		super();
		this.groupName = groupName;
	}

	/**
	 * Constructor for UserGroup
	 * @param groupName String
	 */
	public UserGroup(String groupName) {
		super();
		this.groupName = groupName;
	}

	/**
	 * Construct a UserGroup with no data. 
	 */
	public UserGroup() {
		super();
	}

	/**
	 * Returns the ID of the usergroup.
	 * @return int
	 */
	public int getUserGroupID() {
		return userGroupID;
	}

	/**
	 * Sets the ID of the usergroup.
	 * @param userGroupID int
	 */
	public void setUserGroupID(int userGroupID) {
		this.userGroupID = userGroupID;
	}

	/**
	 * Returns the name of the usergroup.
	 * @return String
	 */
	public String getUserGroupName() {
		return groupName;
	}

	/**
	 * Sets a name for the usergroup.
	 * @param groupName
	 */
	public void setUserGroupName(String groupName) {
		this.groupName = groupName;
	}

	/**
	 * Returns the name of the usergroup.
	 * This method will be removed in a future version, use the method getUserGroupName() instead.
	 * @return String
	 */
	public String getGroupName() {
		return groupName;
	}

	/**
	 * Sets the name of the usergroup.
	 * This method will be removed in a future version, use the method setUserGroupName() instead.
	 * @param groupName String
	 */
	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	/**
	 * Returns the usergroupID prefixed with a G to represent it is a group.
	 * @return String
	 */
	public String toString() {
		return "G" + userGroupID;
	}
}