// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   User.java

package com.keyshop.pub.security.model;

import com.keyshop.pub.model.PubOneToManyBean;
import java.io.PrintStream;
import java.util.*;

// Referenced classes of package com.keyshop.pub.security.model:
//            Role, UserRole

public class User extends PubOneToManyBean
{

    private String userName;
    private String password;
    private String id;
    private List roleList;
    private String category;

    public User()
    {
        roleList = new ArrayList();
        category = "0";
    }

    public void clear()
    {
        id = null;
        userName = "";
        password = "";
        roleList = new ArrayList();
        category = "0";
    }

    public void addRole(Role role)
    {
        roleList.add(role);
        role.getUserList().add(this);
    }

    public String getId()
    {
        return id;
    }

    public String getPassword()
    {
        return password;
    }

    public List getRoleList()
    {
        return roleList;
    }

    public String getUserName()
    {
        return userName;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public void setRoleList(List roleList)
    {
        System.out.println("RoleList = " + roleList.size());
        this.roleList = roleList;
    }

    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    public String getCategory()
    {
        return category;
    }

    public void setCategory(String category)
    {
        this.category = category;
    }

    public boolean isRole(String role)
    {
        for(Iterator it = getChildList().iterator(); it.hasNext();)
        {
            String currentRole = ((UserRole)it.next()).getRoleId();
            if(currentRole.equals(role))
                return true;
        }

        return false;
    }
}
