Package com.nordija.portal.entity

Source Code of com.nordija.portal.entity.UserPK

/**
* Copyright 1999-2001 by Nordija <www.nordija.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
**/


package com.nordija.portal.entity;

import com.nordija.midtier.ejb.EjbUtil;
import com.nordija.midtier.ejb.PkHashCode;
import java.io.Serializable;

/**
* This defines the primary key for the User bean
*
* Generated by Nordija BeanBuilder - www.nordija.com
*
* @author Nordija ApS
*/
public class UserPK implements Serializable
{
   
    /** Unique id of the user */
    public long id;

    /**
     * Constructor without parameters - required for serialization
     */

    public UserPK()
    {
    }

    /**
     * Constructor with parameters
     *
     * @param id Unique id of the user
     */
   
    public UserPK(long id)
    {
        this.id = id;
   
    }
 
 
    /**
     * Compares two Primary Keys for equality (overriding method in Object).
     * See section 9.2.9 in EJB spec 1.1
     *
     * @param otherPk the reference object with which to compare (expected to be a AfregningPK)
     * @return true if this object is the same as the obj argument; false otherwise
     */

    public boolean equals(Object otherPk)
    {
       
      return otherPk instanceof UserPK &&
               EjbUtil.testEquals(id, ((UserPK)otherPk).id);       
     
     
    }

    /**
     * Returns a hash code value for the object (overriding method in Object).
     * See section 9.2.9 in EJB spec 1.1 and www.ejbnow.com/ejbtips/ejbtip_1.html
     * Thanks to Richard Monson-Haefel
     *
     * @return a hash code value for this object
     */

    public int hashCode()
    {
     
      PkHashCode hc = new PkHashCode();

        hc.add(id);
     
        return hc.getPkHashCode();
      }

    /**
     * Provide a string representation of this PK. Typically useful in order to
     * create more meaningful exception messages.
     *
     * @return String representation of object
     */

    public String toString()
    {
        StringBuffer s = new StringBuffer(100);
        s.append("UserPK: ");
      s.append(id);
     
        return s.toString();
    }
 
}
TOP

Related Classes of com.nordija.portal.entity.UserPK

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.