Attached is the User object...

package com.gcf.core;

import java.util.*;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.NotPersistent;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;




/**
 * Individual user access object that grants access to the site/
application under the ownership of
 * a specified Account.  Additional utility methods are provided to
deliver enhanced and extendible
 * capability beyond the base requirements.
 *
 * @author smd0772
 *
 */
@PersistenceCapable
public class User  implements java.io.Serializable
{

    /** Unique serial version id for this class */
    @NotPersistent
    private static final long serialVersionUID = 386273711850256872L;



    /** Unique User ID ID */
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;

    /** Full name of the user */
    @Persistent
    private String fullName;

    /** Username or login ID - used for authentication */
    @Persistent
    private String userName;

    /** Password - used for authentication */
    @Persistent
    private String password;

    /** Indicates the Account this user is associated with */
    @Persistent
    private long accountid;

    /** Indicates the security group this user is associated with */
    @Persistent
    private long groupid;

    /** Indicated the time of the last login */
    @Persistent
    private Date lastlogin;

    /** Indicated the time of the previous last login */
    @Persistent
    private Date prevlastlogin;

    /** Map of user defined attributes (email, contact #, etc) */
    //@Persistent(serialized = "true")
    //private Map <String,String> attributes = new HashMap
<String,String> ( );

    /** Map of custom dashboard query settings */
    //@Persistent(serialized = "true")
    //private Map <String,String> parameters = new HashMap
<String,String> ( );




    /**
     * CONSTRUCTOR - creates a new User object with the specified full
name,
     * user-id, and password.
     *
     * @param name (String) full user name
     * @param user (String) user id - used for authentication
     * @param pwd (String) password - used for authentication
     */
    public User ( String name, String user, String pwd )
    {
        this.fullName = name;
        this.userName = user;
        this.password = pwd;
    }




    /**
     * Gets the Unique Identifier for this object.
     *
     * @return (long) unique id
     */
    public long getID ( )
    {
        return id;
    }

    /**
     * Sets the Unique Identifier for this object.
     *
     * @param id (long) unique id
     */
    public void setID ( long id )
    {
        this.id = id;
    }

    /**
     * Returns the full name of the user.
     *
     * @return (String) full user name
     */
    public String getFullName ( )
    {
        return fullName;
    }

    /**
     * Sets the full name of the user.
     *
     * @param name (String) full user name
     */
    public void setFullName ( String name )
    {
        this.fullName = name;
    }

    /**
     * Returns the user-id of the user.  This is used for
     * authentication.
     *
     * @return (String) user-id
     */
    public String getUserID ( )
    {
        return userName;
    }

    /**
     * Sets the user-id of the user.  This is used for
     * authentication.
     *
     * @param id (String) user-id
     */
    public void setUserID ( String id )
    {
        this.userName = id;
    }

    /**
     * Returns the password for this user.  This is used for
     * authentication.
     *
     * @return (String) password
     */
    public String getPassword ( )
    {
        return this.password;
    }

    /**
     * Sets the password for this user.  This is used for
     * authentication.
     *
     * @return (String) password
     */
    public void setPassword ( String pwd )
    {
        this.password = pwd;
    }

    /**
     * Returns the time of the last login.
     *
     * @return (Date) date
     */
    public Date getLastLogin ( )
    {
        return lastlogin;
    }

    /**
     * Sets the time of the last login.
     *
     * @return (Date) date
     */
    public void setLastLogin ( Date date )
    {
        this.lastlogin = date;
    }

    /**
     * Returns the time of the previous last login.
     *
     * @return (Date) date
     */
    public Date getPreviousLastLogin ( )
    {
        return prevlastlogin;
    }

    /**
     * Sets the time of the previous last login.
     *
     * @return (Date) date
     */
    public void setPreviousLastLogin ( Date date )
    {
        this.prevlastlogin = date;
    }

    /**
     * Returns the account-id this user is associated with.
     *
     * @return (Long) owning account-id
     */
    public Long getOwningAccount ( )
    {
        return accountid;
    }

    /**
     * Sets the account-id this user is associated with.
     *
     * @return (long) customer
     */
    public void setOwningAccount ( Long accountid )
    {
        this.accountid = accountid;
    }

    /**
     * Returns the group-id this user is associated with.
     *
     * @return (long) group-id
     */
    public Long getGroup ( )
    {
        return groupid;
    }

    /**
     * Sets the group-id this user is associated with.
     *
     * @return (long) group id
     */
    public void setGroup ( long groupid )
    {
        this.groupid = groupid;
    }

    /**
     * Returns a map of attributes for this user.  Common
     * attributes include email, phone number, etc).
     *
     * @return (Map) account attributes
     */
    public Map <String,String> getAttributes ( )
    {
        //return attributes;
        return null;
    }

    /**
     * Sets a list of attributes for this user.  Common
     * attributes include email, phone number, etc).
     *
     * @param (Map) account attributes
     */
    public void setAttributes ( Map <String,String>  attributes )
    {
        //this.attributes = attributes;
    }

    /**
     * Adds the specified attribute to the user.  If
     * the specified attribute already exists, it is
     * removed from the list and the new one added in its
     * place
     *
     * @param attribute (String) name of the attribute
     * @param value (String) value of the attribute
     */
    public void addAttribute ( String attribute, String value )
    {
        //attributes.put ( attribute, value );
    }

    /**
     * Returns the value of the specified attribute.  If this
     * attribute cannot be found, the method will return null.
     *
     * @param attribute (String) attribute name
     * @return (String) attribute value
     */
    public String getAttributeValue ( String attribute )
    {
        //return attributes.get( attribute );
        return null;
    }

    /**
     * Returns a map of custom query params for this user's dashboard.
     *
     * @return (Map) custom query params
     */
    public Map <String,String> getDashboardParams ( )
    {
        //return parameters;
        return null;
    }

    /**
     * Sets a map of custom query params for this user's dashboard.
     *
     * @param (Map) custom query params
     */
    public void setDashboardParams ( Map <String,String>  params )
    {
        //this.parameters = params;
    }

    /**
     * Adds the specified key/value pair to the user's dashboard
settings.
     * If the specified attribute already exists, it is removed from
the
     * list and the new one added in its place.
     *
     * @param attribute (String) name of the parameter
     * @param value (String) value of the parameter
     */
    public void addDashboardParam ( String key, String value )
    {
        //parameters.put ( key, value );
    }

    /**
     * Returns the value of the specified dashboard parameter.  If
this
     * attribute cannot be found, the method will return null.
     *
     * @param attribute (String) parameter name
     * @return (String) parameter value
     */
    public String getDashboardParam ( String param )
    {
        //return parameters.get( param );
        return null;
    }

    /**
     * Overrides the java.lang.Object.toString() method to provide
     * a customized text description of the data in this User object.
     *
     * @return (String) user definition
     */
    public String toString ( )
    {
        StringBuffer buf = new StringBuffer ( );
        buf.append ( "User Definition :: \n" );
        buf.append ( "Full Name:    " + fullName + "\n" );
        buf.append ( "User ID:      " + userName + "\n" );
        buf.append ( "Password:     " + password + "\n" );
        buf.append ( "Account ID:   " + accountid + "\n" );
        buf.append ( "Group ID :    " + groupid + "\n" );

        /*if ( attributes.size ( ) > 0 )
        {
            buf.append ( "User Attributes :: \n" );
            Set <String> keys = attributes.keySet ( );
            Iterator <String> i1 = keys.iterator ( );
            while ( i1.hasNext ( ) )
            {
                String key = i1.next ( );
                buf.append ( "   " +  key + " | " + attributes.get
( key ) + "\n" );
            }
        }

        if ( parameters.size ( ) > 0 )
        {
            buf.append ( "Dashboard Parameters :: \n" );
            Set <String> keys = parameters.keySet ( );
            Iterator <String> i2 = keys.iterator ( );
            while ( i2.hasNext ( ) )
            {
                String key = i2.next ( );
                buf.append ( "   " +  key + " | " + parameters.get
( key ) + "\n" );
            }
        }*/

        return buf.toString ( );
    }

}


On Jun 3, 8:48 am, Ifnu bima <ifnub...@gmail.com> wrote:
> You need to implements serializable interface to User class, something like :
>
> public class User implements Serializable {
>
> }
>
> --
>
> regards

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to