DefaultUserBase.java :  » Workflow-Engines » bonita-v3.1 » hero » user » Java Open Source

Java Open Source » Workflow Engines » bonita v3.1 
bonita v3.1 » hero » user » DefaultUserBase.java
package hero.user;
/**
*
* Bonita
* Copyright (C) 1999 Bull S.A.
* Bull 68 route de versailles  78434 Louveciennes Cedex France
* Further information: bonita@objectweb.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
* USA
*
*
--------------------------------------------------------------------------
* $Id: DefaultUserBase.java,v 1.3 2005/11/15 15:22:31 dparisek Exp $
*
--------------------------------------------------------------------------
*/
import hero.interfaces.BnUserLocal;
import hero.interfaces.BnUserLocalHome;
import javax.ejb.FinderException;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Hashtable;

public class DefaultUserBase implements UserBase {
  /**
   * 
   */
  private String url;
  private String user;
  private String password;
  private String driver;
  
  public DefaultUserBase() {

  }
  
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#getUserName(java.lang.String)
   */
  public String getUserName(String userId) throws UserBaseException {
    return userId;
  }
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#getUserInfos(java.lang.String)
   */
  public Map getUserInfos(String userId) throws UserBaseException {
    Hashtable uinfos=new Hashtable();
    try {
      BnUserLocalHome userhome = hero.interfaces.BnUserUtil.getLocalHome();
      BnUserLocal user = userhome.findByName(userId);
      uinfos.put("name",userId);
      if (user.getPassword()!=null)
        uinfos.put("password",user.getPassword());
      if (user.getEmail()!=null)
        uinfos.put("email",user.getEmail());
      if (user.getJabber()!=null)
        uinfos.put("jabber",user.getJabber());      
      return uinfos;    
    } catch (javax.naming.NamingException ne) {
        throw new UserBaseException(ne.getMessage());
    } catch (FinderException fe) {
      throw new UserBaseException(fe.getMessage());
    }          
  }
  
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#getUserInfos(java.lang.String)
   */
  public Collection getUsers() throws UserBaseException {    
    try {
      Collection allUsers = new ArrayList();
      BnUserLocalHome userhome = hero.interfaces.BnUserUtil.getLocalHome();
      Collection users = userhome.findAll();
      Iterator i = users.iterator();
      while (i.hasNext())
      {
        Hashtable uinfos=new Hashtable();
        BnUserLocal user = (BnUserLocal)i.next();
        uinfos.put("name",user.getName());
        allUsers.add(uinfos);
      }              
      return allUsers;    
    } catch (javax.naming.NamingException ne) {
        throw new UserBaseException(ne.getMessage());
    } catch (FinderException fe) {
      throw new UserBaseException(fe.getMessage());
    }          
  }
  
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#handle(java.lang.String)
   */
  public boolean handle(String userId) throws UserBaseException {
    // TODO Auto-generated method stub
    return false;
  }
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#isMutable()
   */
  public boolean isMutable() {
    return true;
  }
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#create(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Map)
   */
  public void create(String userId, String password, String userName,  String userEmail, Map userInfos) throws UserBaseException,
      ImmutableException {
  }
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#edit(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Map)
   */
  public void edit(String userId, String password, String userName,
      String userEmail, Map userInfos) throws UserBaseException,
      ImmutableException {
    // TODO Auto-generated method stub
  }
  /* (non-Javadoc)
   * @see hero.util.user.UserBase#deleteUser(java.lang.String)
   */
  public void deleteUser(String userId) throws UserBaseException,
      ImmutableException {
    // TODO Auto-generated method stub
  }  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.