/*  Copyright (c) 2000 by Oracle Corporation. All Rights Reserved. */

package oracle.portal.provider.tools.v1;

import java.security.Principal;
import java.util.Calendar;

import oracle.portal.provider.v1.ProviderUser;
import oracle.portal.provider.v1.UserLocation;
import oracle.portal.provider.v1.ProviderSession;

/**
 * Represents the Portal user for the purposes of the FileToDatabase utility
 *
 * This class is a partial implementation of the ProviderUser abstract class
 * that supports only those methods required by the FileToDatabase utility.
 *
 * This implementation should not be used to represent a ProviderUser
 * outside the context of the FileToDatabase utility
 */
public class FileToDatabaseUser extends ProviderUser
{

    FileToDatabaseUser(String name)
    {
        mName = name;
    }

    /**
     *  @return the portal user.
     */
    public Principal getPrincipal()
    {
        return null;
    }

    /**
     * @return the mapped application user.  <b>null</b> is there is no mapped user.
     *
     */
    public Principal getMappedPrincipal()
    {
        return null;
    }

    /**
     *  @return the portal username. Convenience method for getPrincipal().getName()
     */
    public String getName()
    {
        return mName;
    }

    /**
     *  @return the subscriber id. Convenience method for getPrincipal().getSubscriberId()
     */
    public String getSubscriberId()
    {
        return null;
    }

    /**
     *  @return the company name. Convenience method for getPrincipal().getCompanyName()
     */

    public String getCompanyName()
    {
        return null;
    }

    /**
     *  @return the mapped application username.
     *  Convenience method for getMappedPrincipal().getName()
     */
    public String getMappedName()
    {
        return null;
    }

   /**
     *  @return the qulaified username, ie username appended with company name
     *  separator is "@@"
     */
    public String getQualifiedName()
    {
        return null;
    }

    /**
     *  @return the time when this user logged into the Portal
     */
    public Calendar getLoginTime()
    {
        return null;
    }

    /**
     *  @return the user's location.  Value is allowed to be <code>null</code>.
     *  This means the information is not available.
     */
    public UserLocation getLocation()
    {
        return null;
    }

    /**
     *  @return the Portal session ID for this user.  Portlet developers can use
     *  this ID to map to their in memory "session" state vs. using a cookie based
     *  mechanism.  The benefit is performance.  If the provider doesn't use cookies
     *  the portal can communicate more efficiently with it.
     */
    public String getPortalSessionId()
    {
        return null;
    }

    /**
    * @return the authentication level for the user
    */
    public int getAuthenticationLevel()
    {
        return ProviderUser.NOT_AUTHENTICATED;
    }

    /**
    * @return true if the user has logged onto the portal in the current session.
    *  A user who is weakly authentication has not logged on to the portal in the
    *  current session so this method will return false.
    */
    public boolean isLoggedOn()
    {
        return false;
    }

    /**
    * @return true if the current user is at least weakly authenticated
    */
    public boolean isWeaklyAuthenticated()
    {
        return false;
    }

    /**
     *  Tests whether we are running in public mode.  ie the user has not
     *  logged in and is not weakly authenticated based on a prior login
     *  @return true if the user is accessing the portal in public mode.
     */
    public boolean isPublicUser()
    {
        return false;
    }

    /**
     *  Used to create and/or reacquire the user session.  If running as a HttpProvider
     *  (servlet) and sessions are maintained via cookies then the sessions must only
     *  be created in Provider.initSession().  Note: this method can throw an
     *  IllegalStateException.  This occurs if the user object has become stale.
     *  I.e. no longer contains the state that it needs to acquire/create the
     *  session.  As all Provider/Portlet APIs give you access to the User object
     *  per request you should not (need to) retain the user object via reference
     *  in cross-request object (like the session itself).  This only leads to
     *  possibilities of memory leaks.
     *  @param create if true then a session is created for the user if it
     *  doesn't currently exist.
     *  @return the session object for this user. <b>null</b> if create is
     *  false and the session doesn't already exist.
     */
    public ProviderSession getSession(boolean create)
        throws IllegalStateException
    {
        throw new IllegalStateException();
    }

    /**
     *  Used to create and/or reacquire the user session.  Always creates a session
     *  if it doesn't currently exist. The same as calling
     *  getSession(true). If running as a HttpProvider
     *  (servlet) and sessions are maintained via cookies then the sessions must only
     *  be created in Provider.initSession(). Note: this method can throw an
     *  IllegalStateException.  This occurs if the user object has become stale.
     *  I.e. no longer contains the state that it needs to acquire/create the
     *  session.  As all Provider/Portlet APIs give you access to the User object
     *  per request you should not (need to) retain the user object via reference
     *  in cross-request object (like the session itself).  This only leads to
     *  possibilities of memory leaks.
     *  @return the session object for this user.
     */
    public ProviderSession getSession()
        throws IllegalStateException
    {
        throw new IllegalStateException();
    }


    // name of the user
    private String mName = null;

}

